diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 46f04bf65..c56f389ca 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -787,17 +787,17 @@ Function38511: ; 38511 ; 3851e Function3851e: ; 3851e - ld [hMultiplier], a + ld [hDivisor], a ld hl, EnemyMonMaxHP ld a, [hli] - ld [hProduct], a + ld [hDividend], a ld a, [hl] - ld [hMultiplicand], a + ld [hDividend + 1], a ld b, $2 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] ld c, a - ld a, [$ffb5] + ld a, [hQuotient + 1] ld b, a ld hl, EnemyMonHP + 1 ld a, [hld] diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm index a7cbd8236..80b9bf41d 100644 --- a/battle/anim_commands.asm +++ b/battle/anim_commands.asm @@ -240,14 +240,14 @@ Functioncc220: ; cc220 ld a, $80 ld [hBGMapAddress], a ld a, $9a - ld [$ffd7], a + ld [hBGMapAddress + 1], a call Function3200 ld a, $60 ld [hWY], a xor a ld [hBGMapAddress], a ld a, $98 - ld [$ffd7], a + ld [hBGMapAddress + 1], a call BattleAnimDelayFrame ret ; cc23d diff --git a/battle/anim_objects.asm b/battle/anim_objects.asm index 5bf3e7c01..5c4c43525 100644 --- a/battle/anim_objects.asm +++ b/battle/anim_objects.asm @@ -1696,9 +1696,9 @@ Functioncd677: ; cd677 (33:5677) ld a, $42 ld [hLCDStatCustom], a ; $ff00+$c6 ld a, $58 - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $5e - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ret Functioncd687: ; cd687 (33:5687) @@ -1712,7 +1712,7 @@ Functioncd687: ; cd687 (33:5687) jr nc, .asm_cd69b call Functionce72c xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ret .asm_cd69b dec a @@ -1730,7 +1730,7 @@ Functioncd687: ; cd687 (33:5687) add [hl] sub $10 ret c - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld hl, $9 add hl, bc ld a, [hl] @@ -1754,8 +1754,8 @@ Functioncd6c6: ; cd6c6 (33:56c6) jr c, asm_cd6da xor a ld [hLCDStatCustom], a ; $ff00+$c6 - ld [$ffc7], a - ld [$ffc8], a + ld [hLCDStatCustom + 1], a + ld [hLCDStatCustom + 2], a Functioncd6d6: ; cd6d6 (33:56d6) call Functioncc9bd @@ -1767,7 +1767,7 @@ endr ld [hl], a sub $10 ret c - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ret Functioncd6e3: ; cd6e3 (33:56e3) diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm index a2fd9f731..5b22308f2 100644 --- a/battle/bg_effects.asm +++ b/battle/bg_effects.asm @@ -932,7 +932,7 @@ Functionc8565: ; c8565 (32:4565) ld hl, w5_d422 ld bc, $0 .asm_c8580 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] cp e jr nc, .asm_c858b push hl @@ -969,9 +969,9 @@ Functionc85a2: ; c85a2 (32:45a2) ld a, $42 ld [hLCDStatCustom], a ; $ff00+$c6 xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $5e - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld de, $202 call Functionc8f2e ret @@ -1044,9 +1044,9 @@ Functionc8610: ; c8610 (32:4610) ld a, $43 ld [hLCDStatCustom], a ; $ff00+$c6 xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $5f - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld de, $605 call Functionc8f2e ld hl, $3 @@ -1140,9 +1140,9 @@ Functionc8698: ; c8698 (32:4698) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $2 add hl, bc ld [hl], $0 @@ -1196,9 +1196,9 @@ Functionc86ea: ; c86ea (32:46ea) inc a ld d, a ld h, $d2 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l srl a push af @@ -1238,7 +1238,7 @@ Functionc8712: ; c8712 (32:4712) ld d, $2 call Functionc8f2e ld h, $d2 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] ld l, a ld [hl], $0 dec l @@ -1246,7 +1246,7 @@ Functionc8712: ; c8712 (32:4712) ret Functionc8732: ; c8732 (32:4732) - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] ld l, a ld h, $d2 ld e, l @@ -1256,11 +1256,11 @@ Functionc8732: ; c8732 (32:4732) ld a, [de] dec de ld [hld], a - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] cp l jr nz, .asm_c873a ld [hl], $90 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] ld l, a ld a, [hl] cp $1 @@ -1296,9 +1296,9 @@ Functionc876a: ; c876a (32:476a) call Functionc8eca ld a, $42 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $2 add hl, bc ld [hl], $1 @@ -1347,9 +1347,9 @@ Functionc87b2: ; c87b2 (32:47b2) call Functionc8eca ld a, $42 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $2 add hl, bc ld [hl], $2 @@ -1371,9 +1371,9 @@ Functionc87cf: ; c87cf (32:47cf) call Functionc80e5 Functionc87de: ; c87de (32:47de) - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l dec a ld hl, $2 @@ -1416,9 +1416,9 @@ Functionc8810: ; c8810 (32:4810) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld [hl], $0 @@ -1451,9 +1451,9 @@ Functionc8842: ; c8842 (32:4842) call Functionc8eca ld a, $43 call Functionc8ef4 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld [hl], $0 @@ -1524,16 +1524,16 @@ Functionc88a5: ; c88a5 (32:48a5) pop af jp Functionc900b .asm_c88b7 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld d, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub d ld d, a ld h, LYOverridesBackup / $100 ld a, [hSCY] ; $ff00+$d0 or a jr nz, .asm_c88d0 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] or a jr z, .asm_c88d6 dec a @@ -1541,14 +1541,14 @@ Functionc88a5: ; c88a5 (32:48a5) ld [hl], $0 jr .asm_c88d6 .asm_c88d0 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] dec a ld l, a ld [hl], $0 .asm_c88d6 ld a, [hSCY] ; $ff00+$d0 ld l, a - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] sub l jr nc, .asm_c88e0 xor a @@ -1581,9 +1581,9 @@ Functionc88f6: ; c88f6 (32:48f6) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld [hl], $0 @@ -1628,9 +1628,9 @@ Functionc8933: ; c8933 (32:4933) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld [hl], $0 @@ -1668,9 +1668,9 @@ Functionc896d: ; c896d (32:496d) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a xor a ld hl, $2 add hl, bc @@ -1767,9 +1767,9 @@ Functionc89f7: ; c89f7 (32:49f7) call Functionc8eca ld a, $42 call Functionc8ef4 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $2 add hl, bc ld [hl], $1 @@ -1824,14 +1824,14 @@ Functionc8a49: ; c8a49 (32:4a49) call Functionc8ecb ld a, $47 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a - ld a, [$ffc7] + ld [hLCDStatCustom + 2], a + ld a, [hLCDStatCustom + 1] ld l, a ld h, $d2 .asm_c8a60 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] cp l jr z, .asm_c8a69 xor a @@ -1854,9 +1854,9 @@ Functionc8a70: ; c8a70 (32:4a70) ld hl, $3 add hl, bc ld [hl], $0 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] inc a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a call Functionc80e5 ret @@ -1864,7 +1864,7 @@ Functionc8a88: ; c8a88 (32:4a88) call Functionc8ab0 jr nc, .asm_c8a96 call Functionc8a9a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] dec a ld l, a ld [hl], e @@ -1875,9 +1875,9 @@ Functionc8a88: ; c8a88 (32:4a88) Functionc8a9a: ; c8a9a (32:4a9a) ld e, a - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l srl a ld h, $d2 @@ -1971,9 +1971,9 @@ Functionc8b0e: ; c8b0e (32:4b0e) ld a, $47 ld [hLCDStatCustom], a ; $ff00+$c6 xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $60 - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ret Functionc8b22: ; c8b22 (32:4b22) @@ -2221,9 +2221,9 @@ Functionc8c68: ; c8c68 (32:4c68) call Functionc8eca ld a, $43 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $2 add hl, bc ld [hl], $1 @@ -2268,9 +2268,9 @@ Functionc8cab: ; c8cab (32:4cab) ld a, $43 ld [hLCDStatCustom], a ; $ff00+$c6 xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $37 - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld [hl], $0 @@ -2431,9 +2431,9 @@ Functionc8d8b: ; c8d8b (32:4d8b) call Functionc8ecb ld a, $47 call Functionc8ede - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] inc a - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ld hl, $3 add hl, bc ld a, [hl] @@ -2669,9 +2669,9 @@ Functionc8ede: ; c8ede (32:4ede) ld de, $2f5e .asm_c8eed ld a, d - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, e - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ret Functionc8ef4: ; c8ef4 (32:4ef4) @@ -2684,15 +2684,15 @@ Functionc8ef4: ; c8ef4 (32:4ef4) ld de, $2d5e .asm_c8f03 ld a, d - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, e - ld [$ffc8], a + ld [hLCDStatCustom + 2], a ret Functionc8f0a: ; c8f0a (32:4f0a) xor a - ld [$ffc7], a - ld [$ffc8], a + ld [hLCDStatCustom + 1], a + ld [hLCDStatCustom + 2], a call Functionc8eca xor a ld [hLCDStatCustom], a ; $ff00+$c6 @@ -2706,8 +2706,8 @@ Functionc8f19: ; c8f19 (32:4f19) ld [rBGP], a ; $ff00+$47 ld [wcfc7], a ld [wcfc9], a - ld [$ffc7], a - ld [$ffc8], a + ld [hLCDStatCustom + 1], a + ld [hLCDStatCustom + 2], a call Functionc8eca ret @@ -2723,10 +2723,10 @@ Functionc8f2e: ; c8f2e (32:4f2e) ld [BattleAnimTemps + 3], a ld bc, LYOverridesBackup .asm_c8f43 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] cp c jr nc, .asm_c8f58 - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] cp c jr c, .asm_c8f58 ld a, [BattleAnimTemps + 2] @@ -2800,14 +2800,14 @@ Functionc8f9a: ; c8f9a (32:4f9a) call Functionc905d ld e, a pop hl - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] cp c jr c, .asm_c8fcf ld a, e ld [bc], a inc bc .asm_c8fcf - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] cp l jr nc, .asm_c8fd6 ld [hl], e @@ -2824,7 +2824,7 @@ Functionc8f9a: ; c8f9a (32:4f9a) ret Functionc8fe4: ; c8fe4 (32:4fe4) - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld e, a ld a, [BattleAnimTemps] add e @@ -2834,13 +2834,13 @@ Functionc8fe4: ; c8fe4 (32:4fe4) Functionc8fef: ; c8fef (32:4fef) push bc - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a inc a ld e, a ld h, $d2 ld d, h - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l and a jr z, .asm_c9009 @@ -2862,9 +2862,9 @@ Functionc8fef: ; c8fef (32:4fef) Functionc900b: ; c900b (32:500b) push af ld h, $d2 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l ld d, a pop af @@ -2877,14 +2877,14 @@ Functionc900b: ; c900b (32:500b) Functionc901b: ; c901b (32:501b) push af ld e, a - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a - ld a, [$ffc8] + ld a, [hLCDStatCustom + 2] sub l sub e ld d, a ld h, $d2 - ld a, [$ffc7] + ld a, [hLCDStatCustom + 1] ld l, a ld a, $90 .asm_c902c diff --git a/battle/core.asm b/battle/core.asm index c7f0e7bb5..287ad4120 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -3233,7 +3233,7 @@ Function3d444: ; 3d444 Function3d490: ; 3d490 - ld [$ffaf], a + ld [hConnectionStripLength], a ld c, a .asm_3d493 push bc @@ -3257,7 +3257,7 @@ Function3d490: ; 3d490 ; 3d4ae Function3d4ae: ; 3d4ae - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld c, a cp $8 jr nz, .back @@ -9442,7 +9442,7 @@ Function3fc30: ; 3fc30 Function3fc5b: ; 3fc5b ld hl, Sprites xor a - ld [$ffaf], a + ld [hConnectionStripLength], a ld b, $6 ld e, $a8 .asm_3fc65 @@ -9453,10 +9453,10 @@ Function3fc5b: ; 3fc5b inc hl ld [hl], e inc hl - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld [hli], a inc a - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, $1 ld [hli], a ld a, d @@ -9464,9 +9464,9 @@ Function3fc5b: ; 3fc5b ld d, a dec c jr nz, .asm_3fc69 - ld a, [$ffaf] + ld a, [hConnectionStripLength] add $3 - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, e add $8 ld e, a diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index e0bd41859..1b8d8b9fc 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -1390,7 +1390,7 @@ BattleCommand07: ; 346d2 cp c jr z, .stab - jr .asm_3473a + jr .SkipStab .stab ld hl, CurDamage + 1 @@ -1412,13 +1412,13 @@ BattleCommand07: ; 346d2 ld hl, TypeModifier set 7, [hl] -.asm_3473a +.SkipStab ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVar ld b, a ld hl, TypeMatchup -.asm_34743 +.TypesLoop ld a, [hli] cp $ff @@ -1426,38 +1426,39 @@ BattleCommand07: ; 346d2 ; foresight cp $fe - jr nz, .asm_34757 + jr nz, .SkipForesightCheck ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a jr nz, .end - jr .asm_34743 + jr .TypesLoop -.asm_34757 +.SkipForesightCheck cp b - jr nz, .asm_347b3 + jr nz, .SkipType ld a, [hl] cp d - jr z, .asm_34763 + jr z, .GotMatchup cp e - jr z, .asm_34763 - jr .asm_347b3 + jr z, .GotMatchup + jr .SkipType -.asm_34763 +.GotMatchup push hl push bc inc hl ld a, [TypeModifier] and %10000000 ld b, a +; If the target is immune to the move, treat it as a miss and calculate the damage as 0 ld a, [hl] and a - jr nz, .asm_34775 + jr nz, .NotImmune inc a ld [AttackMissed], a xor a -.asm_34775 +.NotImmune ld [hMultiplier], a add b ld [TypeModifier], a @@ -1480,34 +1481,35 @@ BattleCommand07: ; 346d2 ld b, a ld a, [hProduct + 3] or b - jr z, .asm_347ab + jr z, .ok ; This is a very convoluted way to get back that we've essentially dealt no damage. - ld a, $a +; Take the product and divide it by 10. + ld a, 10 ld [hDivisor], a - ld b, $4 + ld b, 4 call Divide ld a, [hQuotient + 1] ld b, a ld a, [hQuotient + 2] or b - jr nz, .asm_347ab + jr nz, .ok - ld a, $1 - ld [$ffb6], a + ld a, 1 + ld [hMultiplicand + 2], a -.asm_347ab - ld a, [$ffb5] +.ok + ld a, [hMultiplicand + 1] ld [hli], a - ld a, [$ffb6] + ld a, [hMultiplicand + 2] ld [hl], a pop bc pop hl -.asm_347b3 +.SkipType rept 2 inc hl endr - jr .asm_34743 + jr .TypesLoop .end call Function347c8 @@ -1545,32 +1547,32 @@ Function347d3: ; 347d3 ld a, 10 ; 1.0 ld [wd265], a ld hl, TypeMatchup -.asm_347e7 +.TypesLoop ld a, [hli] cp $ff - jr z, .asm_3482f + jr z, .End cp $fe - jr nz, .asm_347fb + jr nz, .Next ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a - jr nz, .asm_3482f - jr .asm_347e7 -.asm_347fb + jr nz, .End + jr .TypesLoop +.Next cp d - jr nz, .asm_34807 + jr nz, .Nope ld a, [hli] cp b - jr z, .asm_3480b + jr z, .Yup cp c - jr z, .asm_3480b - jr .asm_34808 -.asm_34807 + jr z, .Yup + jr .Nope2 +.Nope inc hl -.asm_34808 +.Nope2 inc hl - jr .asm_347e7 -.asm_3480b + jr .TypesLoop +.Yup xor a ld [hDividend + 0], a ld [hMultiplicand + 0], a @@ -1588,9 +1590,9 @@ Function347d3: ; 347d3 pop bc ld a, [hQuotient + 2] ld [wd265], a - jr .asm_347e7 + jr .TypesLoop -.asm_3482f +.End pop bc pop de pop hl @@ -1603,14 +1605,14 @@ BattleCommanda3: ; 34833 ld a, [wd265] and a ld a, 10 ; 1.0 - jr nz, .asm_3484a + jr nz, .skip call ResetDamage xor a ld [TypeModifier], a inc a ld [AttackMissed], a ret -.asm_3484a +.skip ld [wd265], a ret ; 3484e diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index cb368ee0a..9bb72b2a2 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -72,3 +72,7 @@ PLAYER_SURF_PIKA EQU 8 OBJECT_STRUCT_LENGTH EQU 40 NUM_OBJECT_STRUCTS EQU 13 + +; After-Champion Spawn +SPAWN_LANCE EQU 1 +SPAWN_RED EQU 2 diff --git a/engine/events.asm b/engine/events.asm index 3fedf691d..cf8b4e647 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -121,7 +121,7 @@ StartMap: ; 96724 xor a ld [ScriptRunning], a ld hl, MapStatus - ld bc, $3e + ld bc, $3e ; 62 call ByteFill callba Function113e5 call ClearJoypad @@ -137,13 +137,13 @@ EnterMap: ; 9673e callba RunMapSetupScript call ClearAllScriptFlags3 - ld a, [$ff9f] + ld a, [hMapEntryMethod] cp $f7 jr nz, .dontset call SetAll_ScriptFlags3 .dontset - ld a, [$ff9f] + ld a, [hMapEntryMethod] cp $f3 jr nz, .dontresetpoison xor a @@ -151,7 +151,7 @@ EnterMap: ; 9673e .dontresetpoison xor a - ld [$ff9f], a + ld [hMapEntryMethod], a ld a, 2 ; HandleMap ld [MapStatus], a ret diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 888952ab8..d9282d965 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -1499,7 +1499,7 @@ Function4af0: ; 4af0 add hl, bc ld [hl], 2 ld hl, wd4cf - ld a, [$ffaf] + ld a, [hConnectionStripLength] cp [hl] jr z, .ok ld hl, OBJECT_09 @@ -2508,7 +2508,7 @@ Function54b8: ; 54b8 ret z ld a, [wd4cd] ld d, a - ld a, [$ffaf] + ld a, [hConnectionStripLength] cp d ret nz ld a, e @@ -2651,7 +2651,7 @@ Function5565: ; 5565 Function5579: ; 5579 push bc - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld c, a call Function5582 pop bc @@ -2712,7 +2712,7 @@ Function55b9: ; 55b9 ld [hli], a ld a, [de] ld [hli], a - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld [hli], a push hl ld hl, OBJECT_MAP_X @@ -2737,7 +2737,7 @@ Function55e0:: ; 55e0 ld bc, ObjectStructs xor a .loop - ld [$ffaf], a + ld [hConnectionStripLength], a call GetObjectSprite jr z, .ok call Function565c @@ -2747,7 +2747,7 @@ Function55e0:: ; 55e0 add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECT_STRUCTS jr nz, .loop @@ -2801,13 +2801,13 @@ Function5645: ; 5645 xor a ld bc, ObjectStructs .loop - ld [$ffaf], a + ld [hConnectionStripLength], a call Function5680 ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECT_STRUCTS jr nz, .loop @@ -3032,7 +3032,7 @@ Function5781: ; 5781 ld bc, ObjectStructs xor a .loop - ld [$ffaf], a + ld [hConnectionStripLength], a call GetObjectSprite jr z, .next call Function437b @@ -3042,7 +3042,7 @@ Function5781: ; 5781 add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECT_STRUCTS jr nz, .loop diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 9ac712872..f89d68a19 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -1,6 +1,6 @@ RunMapSetupScript:: ; 15363 - ld a, [$ff9f] + ld a, [hMapEntryMethod] and $f dec a ld c, a diff --git a/engine/predef.asm b/engine/predef.asm index 9ee46bf47..47bc2528a 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -36,7 +36,7 @@ PredefPointers:: ; 856b add_predef FlagPredef add_predef Functionc699 add_predef FillPP - add_predef Functiond88c + add_predef TryAddMonToParty add_predef Functionda96 add_predef Functiondb3f ; $8 add_predef SentPkmnIntoBox diff --git a/engine/scripting.asm b/engine/scripting.asm index 3ef1c3853..f5e1347b8 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1258,7 +1258,7 @@ Script_appear: ; 0x972dd call GetScriptByte call GetScriptPerson call _CopyObjectStruct - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld b, 0 ; clear call ApplyEventActionAppearDisappear ret @@ -1276,7 +1276,7 @@ Script_disappear: ; 0x972ee ld a, [hLastTalked] .ok call DeleteObjectStruct - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld b, 1 ; set call ApplyEventActionAppearDisappear callba RefreshMapAppearDisappear @@ -1584,7 +1584,7 @@ Script_reloadmap: ; 0x97491 xor a ld [wd459], a ld a, $f3 - ld [$ff9f], a + ld [hMapEntryMethod], a ld a, $1 call LoadMapStatus call StopScript @@ -2839,7 +2839,7 @@ Script_warp: ; 0x97a1d ld a, -1 ld [wd001], a ld a, -15 - ld [$ff9f], a + ld [hMapEntryMethod], a ld a, 1 call LoadMapStatus call StopScript @@ -2851,7 +2851,7 @@ Script_warp: ; 0x97a1d ld a, -1 ld [wd001], a ld a, -5 - ld [$ff9f], a + ld [hMapEntryMethod], a ld a, 1 call LoadMapStatus call StopScript @@ -2994,7 +2994,7 @@ Script_newloadmap: ; 0x97b08 ; which_method (SingleByteParam) call GetScriptByte - ld [$ff9f], a + ld [hMapEntryMethod], a ld a, 1 call LoadMapStatus call StopScript @@ -3198,7 +3198,7 @@ Script_halloffame: ; 0x97bd5 Script_credits: ; 0x97bf3 ; script command 0xa2 - callba Function86455 + callba RedCredits ; fallthrough DisplayCredits: diff --git a/home/joypad.asm b/home/joypad.asm index 78a1ac143..c07157376 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -354,12 +354,12 @@ Functiona57:: ; a57 ; a80 Functiona80:: ; a80 - ld a, [$ffaf] + ld a, [hConnectionStripLength] push af ld a, [$ffb0] push af xor a - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, $6 ld [$ffb0], a .asm_a8d @@ -374,7 +374,7 @@ Functiona80:: ; a80 pop af ld [$ffb0], a pop af - ld [$ffaf], a + ld [hConnectionStripLength], a ret ; aa5 @@ -452,9 +452,9 @@ Functionb06:: ; b06 cp b pop bc jr nz, .asm_b27 - ld a, [$ffaf] + ld a, [hConnectionStripLength] dec a - ld [$ffaf], a + ld [hConnectionStripLength], a ret nz ld a, [$ffb0] dec a @@ -463,20 +463,20 @@ Functionb06:: ; b06 ld a, $7a ld [hl], a ld a, $ff - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, $6 ld [$ffb0], a ret .asm_b27 - ld a, [$ffaf] + ld a, [hConnectionStripLength] and a ret z dec a - ld [$ffaf], a + ld [hConnectionStripLength], a ret nz dec a - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, [$ffb0] dec a ld [$ffb0], a diff --git a/home/map.asm b/home/map.asm index 8dccf51a0..1deb6c3d2 100644 --- a/home/map.asm +++ b/home/map.asm @@ -207,10 +207,10 @@ endr Function222a:: ; 222a ld a, $fa - ld [$ff9f], a + ld [hMapEntryMethod], a callba RunMapSetupScript xor a - ld [$ff9f], a + ld [hMapEntryMethod], a ret ; 2238 diff --git a/hram.asm b/hram.asm index 18bbd0218..92b8c53fe 100644 --- a/hram.asm +++ b/hram.asm @@ -17,6 +17,7 @@ hSeconds EQU $ff98 hROMBank EQU $ff9d hVBlank EQU $ff9e +hMapEntryMethod EQU $ff9f hJoypadReleased EQU $ffa2 hJoypadPressed EQU $ffa3 diff --git a/items/item_effects.asm b/items/item_effects.asm index 4978a54a1..2e9bfd516 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -562,7 +562,7 @@ endr ld [MonType], a call ClearSprites - predef Functiond88c + predef TryAddMonToParty callba Function4db49 @@ -691,7 +691,7 @@ endr jr .asm_ebe2 .asm_ebd1 - callba Functione6ce + callba BugContest_SetCaughtContestMon jr .asm_ebe2 .asm_ebd9 diff --git a/main.asm b/main.asm index 37213c669..bb8d7b66b 100644 --- a/main.asm +++ b/main.asm @@ -142,8 +142,8 @@ NewGame: ; 5b6b ld [wd001], a ld a, $f1 - ld [$ff9f], a - jp Function5e5d + ld [hMapEntryMethod], a + jp FinishContinueFunction ; 5b8f Function5b8f: ; 5b8f @@ -421,18 +421,18 @@ Continue: ; 5d65 ld [hBGMapMode], a ld c, $14 call DelayFrames - call Function5e34 - jr nc, .asm_5d8c + call ConfirmContinue + jr nc, .Check1Pass call WriteBackup jr .FailToLoad -.asm_5d8c +.Check1Pass call Function5e48 - jr nc, .asm_5d96 + jr nc, .Check2Pass call WriteBackup jr .FailToLoad -.asm_5d96 +.Check2Pass ld a, $8 ld [MusicFade], a ld a, MUSIC_NONE % $100 @@ -443,38 +443,38 @@ Continue: ; 5d65 call Function5df0 call WriteBackup call ClearTileMap - ld c, $14 + ld c, 20 call DelayFrames callba JumpRoamMons callba Function105091 callba Function140ae - ld a, [wd4b5] - cp $1 - jr z, .asm_5dd7 + ld a, [wSpawnAfterChampion] + cp SPAWN_LANCE + jr z, .SpawnAfterE4 ld a, $f2 - ld [$ff9f], a - jp Function5e5d + ld [hMapEntryMethod], a + jp FinishContinueFunction .FailToLoad ret -.asm_5dd7 +.SpawnAfterE4 ld a, SPAWN_NEW_BARK ld [wd001], a - call Function5de7 - jp Function5e5d + call PostCreditsSpawn + jp FinishContinueFunction ; 5de2 -Function5de2: ; 5de2 +SpawnAfterRed: ; 5de2 ld a, SPAWN_MT_SILVER ld [wd001], a ; 5de7 -Function5de7: ; 5de7 +PostCreditsSpawn: ; 5de7 xor a - ld [wd4b5], a + ld [wSpawnAfterChampion], a ld a, $f1 - ld [$ff9f], a + ld [hMapEntryMethod], a ret ; 5df0 @@ -506,40 +506,40 @@ Function5df0: ; 5df0 ret ; 5e34 -Function5e34: ; 5e34 -.asm_5e34 +ConfirmContinue: ; 5e34 +.loop call DelayFrame call GetJoypad ld hl, hJoyPressed bit 0, [hl] - jr nz, .asm_5e47 + jr nz, .PressA bit 1, [hl] - jr z, .asm_5e34 + jr z, .loop scf ret -.asm_5e47 +.PressA ret ; 5e48 Function5e48: ; 5e48 call Function6e3 and $80 - jr z, .asm_5e5b + jr z, .pass callba Function20021 ld a, c and a - jr z, .asm_5e5b + jr z, .pass scf ret -.asm_5e5b +.pass xor a ret ; 5e5d -Function5e5d: ; 5e5d -.asm_5e5d +FinishContinueFunction: ; 5e5d +.loop xor a ld [wc2c1], a ld [InLinkBattle], a @@ -549,14 +549,14 @@ Function5e5d: ; 5e5d ld hl, wd83e set 1, [hl] callba OverworldLoop - ld a, [wd4b5] - cp $2 - jr z, .asm_5e80 + ld a, [wSpawnAfterChampion] + cp SPAWN_RED + jr z, .AfterRed jp Reset -.asm_5e80 - call Function5de2 - jr .asm_5e5d +.AfterRed + call SpawnAfterRed + jr .loop ; 5e85 Function5e85: ; 5e85 @@ -2354,7 +2354,7 @@ CheckFacingObject:: ; 6fd9 .asm_6ff1 ld bc, ObjectStructs ; redundant ld a, 0 - ld [$ffaf], a + ld [hConnectionStripLength], a call Function7041 ret nc ld hl, OBJECT_DIRECTION_WALKING @@ -2382,7 +2382,7 @@ Function7009: ; 7009 ; 7015 Function7015: ; 7015 - ld a, [$ffaf] + ld a, [hConnectionStripLength] call GetObjectStruct call Function7021 call Function7041 @@ -2450,7 +2450,7 @@ Function7041: ; 7041 jr nz, .ok .ok2 - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld l, a ld a, [$ffb0] cp l @@ -2467,7 +2467,7 @@ Function7041: ; 7041 ld a, [hl] cp e jr nz, .nope - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld l, a ld a, [$ffb0] cp l @@ -2932,7 +2932,7 @@ SpecialGiveShuckle: ; 7305 ld a, 15 ld [CurPartyLevel], a - predef Functiond88c + predef TryAddMonToParty jr nc, .NotGiven ; Caught data. @@ -3205,7 +3205,7 @@ GetSpawnCoord: ; 8029 .ok ld [hl], e ld a, $0 - ld [$ffaf], a + ld [hConnectionStripLength], a ld bc, MapObjects ld a, $0 ld [$ffb0], a @@ -3262,7 +3262,7 @@ Function80a1:: ; 80a1 ld hl, OBJECT_MAP_Y add hl, bc ld e, [hl] - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld b, a call Function807e and a @@ -3343,7 +3343,7 @@ Function811d: ; 811d ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld [hl], a - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld [wc2f0], a ld hl, MAPOBJECT_SPRITE add hl, bc @@ -3391,7 +3391,7 @@ Function8177: ; 8177 ld bc, MapObjects + OBJECT_LENGTH ld a, 1 .loop - ld [$ffaf], a + ld [hConnectionStripLength], a ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] @@ -3432,7 +3432,7 @@ Function8177: ; 8177 add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECTS jr nz, .loop @@ -3476,7 +3476,7 @@ Function81ea: ; 81ea ld bc, MapObjects + OBJECT_LENGTH ld a, 1 .loop - ld [$ffaf], a + ld [hConnectionStripLength], a ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] @@ -3511,7 +3511,7 @@ Function81ea: ; 81ea add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECTS jr nz, .loop @@ -3534,7 +3534,7 @@ Function823e: ; 823e ld bc, MapObjects + OBJECT_LENGTH ld a, 1 .loop - ld [$ffaf], a + ld [hConnectionStripLength], a ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] @@ -3569,7 +3569,7 @@ Function823e: ; 823e add hl, bc ld b, h ld c, l - ld a, [$ffaf] + ld a, [hConnectionStripLength] inc a cp NUM_OBJECTS jr nz, .loop @@ -7915,40 +7915,47 @@ Functiond839: ; d839 ; d88c -Functiond88c: ; d88c +TryAddMonToParty: ; d88c + ; Whose is it? ld de, PartyCount ld a, [MonType] and $f - jr z, .asm_d899 + jr z, .getpartylocation ld de, OTPartyCount -.asm_d899 +.getpartylocation + ; Do we have room for it? ld a, [de] inc a cp PARTY_LENGTH + 1 ret nc + ; Increase the party count ld [de], a - ld a, [de] - ld [$ffae], a + ld a, [de] ; Why are we doing this? + ld [$ffae], a ; HRAM backup add e ld e, a - jr nc, .asm_d8a7 + jr nc, .loadspecies inc d -.asm_d8a7 +.loadspecies + ; Load the species of the Pokemon into the party list. + ; The terminator is usually here, but it'll be back. ld a, [CurPartySpecies] ld [de], a + ; Load the terminator into the next slot. inc de - ld a, $ff + ld a, -1 ld [de], a + ; Now let's load the OT name. ld hl, PartyMonOT ld a, [MonType] and $f - jr z, .asm_d8bc + jr z, .loadOTname ld hl, OTPartyMonOT -.asm_d8bc - ld a, [$ffae] +.loadOTname + ld a, [$ffae] ; Restore index from backup dec a call SkipNames ld d, h @@ -7958,7 +7965,7 @@ Functiond88c: ; d88c call CopyBytes ld a, [MonType] and a - jr nz, .asm_d8f0 + jr nz, .skipnickname ld a, [CurPartySpecies] ld [wd265], a call GetPokemonName @@ -7972,19 +7979,19 @@ Functiond88c: ; d88c ld bc, PKMN_NAME_LENGTH call CopyBytes -.asm_d8f0 +.skipnickname ld hl, PartyMon1Species ld a, [MonType] and $f - jr z, .asm_d8fd + jr z, .initializeStats ld hl, OTPartyMon1Species -.asm_d8fd +.initializeStats ld a, [$ffae] dec a ld bc, PartyMon2 - PartyMon1 call AddNTimes -Functiond906: ; d906 +GeneratePartyMonStats: ; d906 ld e, l ld d, h push hl @@ -7997,10 +8004,10 @@ Functiond906: ; d906 ld a, [IsInBattle] and a ld a, $0 - jr z, .asm_d922 + jr z, .skipitem ld a, [EnemyMonItem] -.asm_d922 +.skipitem ld [de], a inc de push de @@ -8008,10 +8015,10 @@ Functiond906: ; d906 ld l, e ld a, [IsInBattle] and a - jr z, .asm_d943 + jr z, .randomlygeneratemoves ld a, [MonType] and a - jr nz, .asm_d943 + jr nz, .randomlygeneratemoves ld de, EnemyMonMoves rept NUM_MOVES + -1 ld a, [de] @@ -8020,9 +8027,9 @@ Functiond906: ; d906 endr ld a, [de] ld [hl], a - jr .asm_d950 + jr .next -.asm_d943 +.randomlygeneratemoves xor a rept NUM_MOVES + -1 ld [hli], a @@ -8031,7 +8038,7 @@ Functiond906: ; d906 ld [Buffer1], a predef FillMoves -.asm_d950 +.next pop de rept 4 inc de @@ -8058,22 +8065,22 @@ endr inc de xor a ld b, $a -.asm_d97a +.loop ld [de], a inc de dec b - jr nz, .asm_d97a + jr nz, .loop pop hl push hl ld a, [MonType] and $f - jr z, .asm_d992 + jr z, .generateDVs push hl callba GetTrainerDVs pop hl - jr .asm_d9b5 + jr .initializetrainermonstats -.asm_d992 +.generateDVs ld a, [CurPartySpecies] ld [wd265], a dec a @@ -8087,13 +8094,13 @@ endr push hl ld a, [IsInBattle] and a - jr nz, .asm_d9f3 + jr nz, .copywildmonstats call Random ld b, a call Random ld c, a -.asm_d9b5 +.initializetrainermonstats ld a, b ld [de], a inc de @@ -8111,7 +8118,7 @@ endr rept 4 inc de endr - ld a, $46 + ld a, 70 ld [de], a inc de xor a @@ -8129,7 +8136,7 @@ endr inc de ld [de], a inc de - ld bc, $000a + ld bc, 10 add hl, bc ld a, $1 ld c, a @@ -8141,9 +8148,9 @@ endr ld a, [$ffb6] ld [de], a inc de - jr .asm_da29 + jr .next2 -.asm_d9f3 +.copywildmonstats ld a, [EnemyMonDVs] ld [de], a inc de @@ -8154,12 +8161,12 @@ endr push hl ld hl, EnemyMonPP ld b, NUM_MOVES -.asm_da03 +.wildmonpploop ld a, [hli] ld [de], a inc de dec b - jr nz, .asm_da03 + jr nz, .wildmonpploop pop hl ld a, BASE_HAPPINESS @@ -8189,30 +8196,30 @@ endr ld [de], a inc de -.asm_da29 +.next2 ld a, [IsInBattle] dec a - jr nz, .asm_da3b + jr nz, .generatestats ld hl, EnemyMonMaxHP - ld bc, $000c + ld bc, 12 call CopyBytes pop hl - jr .asm_da45 + jr .next3 -.asm_da3b +.generatestats pop hl ld bc, $000a add hl, bc ld b, $0 call Functione167 -.asm_da45 +.next3 ld a, [MonType] and $f - jr nz, .asm_da6b + jr nz, .done ld a, [CurPartySpecies] cp UNOWN - jr nz, .asm_da6b + jr nz, .done ld hl, PartyMon1DVs ld a, [PartyCount] dec a @@ -8221,8 +8228,8 @@ endr predef GetUnownLetter callab Functionfba18 -.asm_da6b - scf +.done + scf ; When this function returns, the carry flag indicates success vs failure. ret ; da6d @@ -8992,7 +8999,7 @@ GiveEgg:: ; df8c push bc call CheckSeenMon push bc - call Functiond88c + call TryAddMonToParty pop bc ld a, c and a @@ -9463,8 +9470,8 @@ GivePoke:: ; e277 push bc xor a ld [MonType], a - call Functiond88c - jr nc, .asm_e2b0 + call TryAddMonToParty + jr nc, .failed ld hl, PartyMonNicknames ld a, [PartyCount] dec a @@ -9489,7 +9496,7 @@ GivePoke:: ; e277 ld [hl], a jr .asm_e2e1 -.asm_e2b0 +.failed ld a, [CurPartySpecies] ld [TempEnemyMonSpecies], a callab LoadEnemyMon @@ -10113,43 +10120,43 @@ Functione6b3: ; e6b3 ; e6ce -Functione6ce: ; e6ce - ld a, [wdf9c] +BugContest_SetCaughtContestMon: ; e6ce + ld a, [wContestMon] and a - jr z, .asm_e6ea + jr z, .firstcatch ld [wd265], a - callba Functioncc0c7 - callba Functioncc000 + callba DisplayAlreadyCaughtText + callba DisplayCaughtContestMonStats lb bc, 14, 7 call PlaceYesNoBox ret c -.asm_e6ea - call Functione6fd +.firstcatch + call .generatestats ld a, [TempEnemyMonSpecies] ld [wd265], a call GetPokemonName - ld hl, UnknownText_0xe71d + ld hl, .caughttext call PrintText ret ; e6fd -Functione6fd: ; e6fd +.generatestats: ; e6fd ld a, [TempEnemyMonSpecies] ld [CurSpecies], a ld [CurPartySpecies], a call GetBaseData xor a ld bc, PartyMon2 - PartyMon1 - ld hl, wdf9c + ld hl, wContestMon call ByteFill xor a ld [MonType], a - ld hl, wdf9c - jp Functiond906 + ld hl, wContestMon + jp GeneratePartyMonStats ; e71d -UnknownText_0xe71d: ; 0xe71d +.caughttext: ; 0xe71d ; Caught @ ! text_jump UnknownText_0x1c10c0 db "@" @@ -14837,7 +14844,7 @@ endr Special_GiveParkBalls: ; 135db xor a - ld [wdf9c], a + ld [wContestMon], a ld a, 20 ld [wdc79], a callba Function11490 @@ -15230,7 +15237,7 @@ Function13819: ; 13819 ld hl, wd00e ld a, 1 ld [hli], a - ld a, [wdf9c] + ld a, [wContestMon] ld [hli], a ld a, [hProduct] ld [hli], a @@ -24671,7 +24678,7 @@ Function24be7: ; 24be7 hlcoord 1, 1 ld de, String24c4b call PlaceString - ld a, [wdf9c] + ld a, [wContestMon] and a ld de, String24c59 jr z, .asm_24c1e @@ -24681,7 +24688,7 @@ Function24be7: ; 24be7 .asm_24c1e hlcoord 8, 1 call PlaceString - ld a, [wdf9c] + ld a, [wContestMon] and a jr z, .asm_24c3e hlcoord 1, 3 @@ -35216,7 +35223,7 @@ TrainerType1: ; 397eb ld a, OTPARTYMON ld [MonType], a push hl - predef Functiond88c + predef TryAddMonToParty pop hl jr .loop ; 39806 @@ -35237,7 +35244,7 @@ TrainerType2: ; 39806 ld [MonType], a push hl - predef Functiond88c + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Moves @@ -35313,7 +35320,7 @@ TrainerType3: ; 39871 ld a, OTPARTYMON ld [MonType], a push hl - predef Functiond88c + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -35344,7 +35351,7 @@ TrainerType4: ; 3989d ld [MonType], a push hl - predef Functiond88c + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -44308,7 +44315,7 @@ Function4d9d3: ; 4d9d3 ; 4d9e5 CheckPartyFullAfterContest: ; 4d9e5 - ld a, [wdf9c] + ld a, [wContestMon] and a jp z, Function4db35 ld [CurPartySpecies], a @@ -44323,7 +44330,7 @@ CheckPartyFullAfterContest: ; 4d9e5 ld c, a ld b, $0 add hl, bc - ld a, [wdf9c] + ld a, [wContestMon] ld [hli], a ld [CurSpecies], a ld a, $ff @@ -44335,7 +44342,7 @@ CheckPartyFullAfterContest: ; 4d9e5 call AddNTimes ld d, h ld e, l - ld hl, wdf9c + ld hl, wContestMon ld bc, PartyMon2 - PartyMon1 call CopyBytes ld a, [PartyCount] @@ -44389,7 +44396,7 @@ CheckPartyFullAfterContest: ; 4d9e5 or b ld [hl], a xor a - ld [wdf9c], a + ld [wContestMon], a and a ld [ScriptVar], a ret @@ -44405,7 +44412,7 @@ Function4daa3: ; 4daa3 jr nc, .asm_4db08 xor a ld [CurPartyMon], a - ld hl, wdf9c + ld hl, wContestMon ld de, wd018 ld bc, sBoxMon2 - sBoxMon1 call CopyBytes @@ -44451,7 +44458,7 @@ Function4daa3: ; 4daa3 ld [hl], a call CloseSRAM xor a - ld [wdf9c], a + ld [wContestMon], a ld a, $1 ld [ScriptVar], a ret @@ -50505,7 +50512,7 @@ GetMovementAction: ; 802ec IsNPCInFront: ; 80341 ld a, 0 - ld [$ffaf], a + ld [hConnectionStripLength], a ld a, [MapX] ld d, a ld a, [WalkingX] @@ -53994,8 +54001,8 @@ HallOfFame:: ; 0x8640e ld a, 1 ld [wc2cd], a call Function2ed3 - ld a, 1 - ld [wd4b5], a + ld a, SPAWN_LANCE + ld [wSpawnAfterChampion], a ; Enable the Pokégear map to cycle through all of Kanto ld hl, StatusFlags @@ -54022,7 +54029,7 @@ HallOfFame:: ; 0x8640e ret ; 0x86455 -Function86455:: ; 86455 +RedCredits:: ; 86455 ld a, MUSIC_NONE % $100 ld [MusicFadeIDLo], a ld a, MUSIC_NONE / $100 @@ -54037,8 +54044,8 @@ Function86455:: ; 86455 ld c, $8 call DelayFrames call Function2ed3 - ld a, $2 - ld [wd4b5], a + ld a, SPAWN_RED + ld [wSpawnAfterChampion], a ld a, [StatusFlags] ld b, a callba Function109847 @@ -62349,8 +62356,8 @@ Function8c20f: ; 8c20f call DelayFrame xor a ld [hLCDStatCustom], a - ld [$ffc7], a - ld [$ffc8], a + ld [hLCDStatCustom + 1], a + ld [hLCDStatCustom + 2], a ld [hSCY], a ld a, $1 ld [rSVBK], a @@ -62600,9 +62607,9 @@ Function8c3e8: ; 8c3e8 (23:43e8) ld a, $43 ld [hLCDStatCustom], a ; $ff00+$c6 xor a - ld [$ffc7], a + ld [hLCDStatCustom + 1], a ld a, $90 - ld [$ffc8], a + ld [hLCDStatCustom + 2], a xor a ld [wcf64], a ld [wcf65], a @@ -63654,8 +63661,8 @@ Special_MagnetTrain: ; 8cc04 call WhiteBGMap xor a ld [hLCDStatCustom], a - ld [$ffc7], a - ld [$ffc8], a + ld [hLCDStatCustom + 1], a + ld [hLCDStatCustom + 2], a ld [hSCX], a ld [Requested2bppSource], a ld [Requested2bppSource + 1], a @@ -76437,7 +76444,7 @@ INCBIN "gfx/credits/theend.2bpp" SECTION "bank33", ROMX, BANK[$33] -Functioncc000: ; cc000 +DisplayCaughtContestMonStats: ; cc000 call WhiteBGMap call ClearTileMap @@ -76475,7 +76482,7 @@ Functioncc000: ; cc000 ld de, .Health call PlaceString - ld a, [wdf9c] + ld a, [wContestMon] ld [wd265], a call GetPokemonName ld de, StringBuffer1 @@ -76533,13 +76540,13 @@ SwitchMonText: ; cc0c2 db "@" ; cc0c7 -Functioncc0c7: ; cc0c7 +DisplayAlreadyCaughtText: ; cc0c7 call GetPokemonName - ld hl, AlreadyCaughtText + ld hl, .AlreadyCaughtText jp PrintText ; cc0d0 -AlreadyCaughtText: ; 0xcc0d0 +.AlreadyCaughtText: ; 0xcc0d0 ; You already caught a @ . text_jump UnknownText_0x1c10dd db "@" @@ -87300,7 +87307,7 @@ Functionfcc63: ; fcc63 ld [MonType], a ld [wd10b], a callab Functione039 - predef Functiond88c + predef TryAddMonToParty ld e, TRADE_DIALOG call GetTradeAttribute @@ -88399,10 +88406,10 @@ Function104263: ; 104263 (41:4263) ld c, $0 Function104265: ; 104265 (41:4265) - ld a, [$ffaf] + ld a, [hConnectionStripLength] push af ld a, c - ld [$ffaf], a + ld [hConnectionStripLength], a ld c, $12 .asm_10426d ld b, $14 @@ -88412,7 +88419,7 @@ Function104265: ; 104265 (41:4265) ld [hli], a dec b jr nz, .asm_10426f - ld a, [$ffaf] + ld a, [hConnectionStripLength] ld b, $c .asm_104279 ld [hli], a @@ -88421,7 +88428,7 @@ Function104265: ; 104265 (41:4265) dec c jr nz, .asm_10426d pop af - ld [$ffaf], a + ld [hConnectionStripLength], a ret diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index fa3490f82..3fcd0969a 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -407,10 +407,10 @@ Function1002c9: ; 1002c9 Function1002dc: ; 1002dc ld a, $f8 - ld [$ff9f], a + ld [hMapEntryMethod], a callba RunMapSetupScript xor a - ld [$ff9f], a + ld [hMapEntryMethod], a call Functione51 ret ; 1002ed diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 9c38fbb27..eb9231a18 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -2359,7 +2359,7 @@ Function17ded9: ; 17ded9 ld [MonType], a push hl push bc - predef Functiond88c + predef TryAddMonToParty callba Function4db49 pop bc pop hl diff --git a/wram.asm b/wram.asm index e862e3938..7850c2d5d 100644 --- a/wram.asm +++ b/wram.asm @@ -1842,7 +1842,7 @@ wd25e:: ds 4 wd262:: ds 1 wd263:: ds 1 wd264:: ds 1 -GetPokemonName_Parameter:: +wNamedObjectIndexBuffer:: wd265:: ds 1 wd266:: ds 1 wd267:: ds 1 @@ -1956,7 +1956,7 @@ RedsName:: ds NAME_LENGTH ; d49e GreensName:: ds NAME_LENGTH ; d4a9 wd4b4:: ds 1 -wd4b5:: ds 1 +wSpawnAfterChampion:: ds 1 ; init time set at newgame StartDay:: ; d4b6