diff --git a/battle/anim_objects.asm b/battle/anim_objects.asm index bdb5c222c..786a035bf 100644 --- a/battle/anim_objects.asm +++ b/battle/anim_objects.asm @@ -3,7 +3,7 @@ INCLUDE "battle/objects/engine.asm" INCLUDE "battle/objects/data.asm" INCLUDE "battle/objects/functions.asm" -INCLUDE "battle/objects/library.asm" +INCLUDE "battle/objects/helpers.asm" INCLUDE "battle/objects/framesets.asm" INCLUDE "battle/objects/oam.asm" INCLUDE "battle/objects/gfx_headers.asm" diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm index b84c26ab1..188a3e43d 100644 --- a/battle/bg_effects.asm +++ b/battle/bg_effects.asm @@ -70,9 +70,8 @@ DoBattleBGEffectFunction: ; c804a (32:404a) ld e, [hl] ld d, 0 ld hl, BattleBGEffects -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -227,55 +226,63 @@ BattleBGEffect_FlashContinue: ; c80fb (32:40fb) ret BattleBGEffect_WhiteHues: ; c812d (32:412d) - ld de, Unknown_c813d - call Functionc8d57 - jr c, .asm_c8139 + ld de, .Pals + call BattleBGEffect_GetNthDMGPal + jr c, .quit ld [wBGP], a ret -.asm_c8139 +.quit call EndBattleBGEffect ret -; c813d (32:413d) - -Unknown_c813d: - db $e4, $e0, $d0, $ff +.Pals + db %11100100 + db %11100000 + db %11010000 + db -1 ; c8141 BattleBGEffect_BlackHues: ; c8141 (32:4141) - ld de, Unknown_c8151 - call Functionc8d57 - jr c, .asm_c814d + ld de, .Pals + call BattleBGEffect_GetNthDMGPal + jr c, .quit ld [wBGP], a ret -.asm_c814d +.quit call EndBattleBGEffect ret -; c8151 (32:4151) - -Unknown_c8151: - db $e4, $f4, $f8, $ff +.Pals + db %11100100 + db %11110100 + db %11111000 + db -1 ; c8155 BattleBGEffect_AlternateHues: ; c8155 (32:4155) - ld de, Unknown_c8168 - call Functionc8d57 - jr c, .asm_c8164 + ld de, .Pals + call BattleBGEffect_GetNthDMGPal + jr c, .quit ld [wBGP], a ld [wOBP1], a ret -.asm_c8164 +.quit call EndBattleBGEffect ret -; c8168 (32:4168) - -Unknown_c8168: - db $e4, $f8, $fc, $f8, $e4, $90, $40, $90, $fe +.Pals + db %11100100 + db %11111000 + db %11111100 + db %11111000 + db %11100100 + db %10010000 + db %01000000 + db %10010000 + db -2 ; c8171 BattleBGEffect_06: ; c8171 (32:4171) @@ -287,14 +294,19 @@ BattleBGEffect_06: ; c8171 (32:4171) .sgb ld de, .PalsSGB .okay - call Functionc8d57 + call BattleBGEffect_GetNthDMGPal ld [wOBP0], a ret .PalsCGB - db $e4, $90, $fe + db %11100100 + db %10010000 + db -2 + .PalsSGB - db $f0, $c0, $fe + db %11110000 + db %11000000 + db -2 ; c818b BattleBGEffect_07: ; c818b (32:418b) @@ -306,29 +318,37 @@ BattleBGEffect_07: ; c818b (32:418b) .sgb ld de, .PalsSGB .okay - call Functionc8d57 + call BattleBGEffect_GetNthDMGPal ld [wOBP0], a ret .PalsCGB - db $e4, $d8, $fe + db %11100100 + db %11011000 + db -2 + .PalsSGB - db $f0, $cc, $fe + db %11110000 + db %11001100 + db -2 ; c81a5 BattleBGEffect_08: ; c81a5 (32:41a5) ld de, .Pals - call Functionc8d57 + call BattleBGEffect_GetNthDMGPal ld [wBGP], a ret .Pals - db $1b, $63, $87, $fe + db %00011011 + db %01100011 + db %10000111 + db -2 ; c81b3 BattleBGEffect_HideMon: ; c81b3 (32:41b3) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw BattleBGEffects_IncrementJumptable dw BattleBGEffects_IncrementJumptable @@ -395,7 +415,7 @@ BattleBGEffect_ShowMon: ; c81ea (32:41ea) BattleBGEffect_FeetFollow: ; c8214 (32:4214) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw BattleBGEffects_IncrementJumptable @@ -417,13 +437,13 @@ BattleBGEffect_FeetFollow: ; c8214 (32:4214) push bc call BGEffect_CheckBattleTurn jr nz, .player_turn - ld a, ANIM_OBJ_B8 + ld a, ANIM_OBJ_PLAYERFEETFOLLOW ld [wBattleAnimTemp0], a ld a, 16 * 8 + 4 jr .okay .player_turn - ld a, ANIM_OBJ_B9 + ld a, ANIM_OBJ_ENEMYFEETFOLLOW ld [wBattleAnimTemp0], a ld a, 6 * 8 .okay @@ -463,7 +483,7 @@ BattleBGEffect_FeetFollow: ; c8214 (32:4214) BattleBGEffect_HeadFollow: ; c8281 (32:4281) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw BattleBGEffects_IncrementJumptable @@ -535,7 +555,7 @@ _QueueBattleAnimation: ; c82ee (32:42ee) BattleBGEffect_27: ; c82f5 (32:42f5) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw BattleBGEffects_IncrementJumptable @@ -700,7 +720,7 @@ BattleBGEffect_ReturnMon: ; c83a8 (32:43a8) BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw BattleBGEffects_IncrementJumptable dw BattleBGEffects_IncrementJumptable @@ -769,9 +789,8 @@ endr ld e, [hl] ld d, 0 ld hl, .Coords -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -811,9 +830,8 @@ endr ld e, [hl] ld d, 0 ld hl, .Coords -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -903,7 +921,7 @@ endm BattleBGEffect_Surf: ; c8545 (32:4545) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -915,7 +933,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545) call InitSurfWaves .one - ld a, [hLCDStatCustom] + ld a, [hFFC6] and a ret z push bc @@ -945,7 +963,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545) ld hl, wSurfWaveBGEffect ld bc, $0 .loop2 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] cp e jr nc, .load_zero push hl @@ -970,7 +988,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545) BattleBGEffect_Whirlpool: ; c8599 (32:4599) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -980,11 +998,11 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - ld [hLCDStatCustom], a + ld [hFFC6], a xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $5e - ld [hLCDStatCustom + 2], a + ld [hFFC8], a lb de, 2, 2 call Functionc8f2e ret @@ -1000,7 +1018,7 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599) BattleBGEffect_30: ; c85c2 (32:45c2) call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 call EndBattleBGEffect ret @@ -1028,9 +1046,8 @@ BattleBGEffect_31: ; c85ce (32:45ce) ld a, [hl] cp $20 jr nc, .done -rept 2 inc [hl] -endr + inc [hl] call Functionc8f9a ret @@ -1045,7 +1062,7 @@ BattleBGEffect_32: ; c8603 (32:4603) BattleBGEffect_Psychic: ; c8607 (32:4607) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1055,11 +1072,11 @@ BattleBGEffect_Psychic: ; c8607 (32:4607) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - ld [hLCDStatCustom], a + ld [hFFC6], a xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $5f - ld [hLCDStatCustom + 2], a + ld [hFFC8], a lb de, 6, 5 call Functionc8f2e ld hl, BG_EFFECT_STRUCT_03 @@ -1083,7 +1100,7 @@ BattleBGEffect_Psychic: ; c8607 (32:4607) BattleBGEffect_Teleport: ; c863f (32:463f) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1093,7 +1110,7 @@ BattleBGEffect_Teleport: ; c863f (32:463f) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 lb de, 6, 5 call Functionc8f2e ret @@ -1108,7 +1125,7 @@ BattleBGEffect_Teleport: ; c863f (32:463f) BattleBGEffect_NightShade: ; c8662 (32:4662) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1118,7 +1135,7 @@ BattleBGEffect_NightShade: ; c8662 (32:4662) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld e, [hl] @@ -1136,7 +1153,7 @@ BattleBGEffect_NightShade: ; c8662 (32:4662) BattleBGEffect_DoubleTeam: ; c8689 (32:4689) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1149,10 +1166,10 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $0 @@ -1207,9 +1224,9 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) inc a ld d, a ld h, LYOverridesBackup / $100 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l srl a push af @@ -1231,7 +1248,7 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) BattleBGEffect_AcidArmor: ; c8709 (32:4709) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1241,14 +1258,14 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld e, [hl] ld d, 2 call Functionc8f2e ld h, $d2 - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] ld l, a ld [hl], $0 dec l @@ -1256,7 +1273,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) ret .one - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] ld l, a ld h, $d2 ld e, l @@ -1266,11 +1283,11 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) ld a, [de] dec de ld [hld], a - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] cp l jr nz, .loop ld [hl], $90 - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] ld l, a ld a, [hl] cp $1 @@ -1294,7 +1311,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) BattleBGEffect_21: ; c8761 (32:4761) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1304,10 +1321,10 @@ BattleBGEffect_21: ; c8761 (32:4761) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $1 @@ -1343,7 +1360,7 @@ BattleBGEffect_21: ; c8761 (32:4761) BattleBGEffect_Dig: ; c87a7 (32:47a7) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1354,10 +1371,10 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $2 @@ -1379,9 +1396,9 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7) ld [hl], $10 call BattleBGEffects_IncrementJumptable .two - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l dec a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN @@ -1400,9 +1417,8 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7) call Functionc901b ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc -rept 2 inc [hl] -endr + inc [hl] ret .three @@ -1411,7 +1427,7 @@ endr BattleBGEffect_Tackle: ; c8805 (32:4805) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw Tackle_BGEffect25_2d_one dw Tackle_BGEffect25_2d_two @@ -1422,10 +1438,10 @@ BattleBGEffect_Tackle: ; c8805 (32:4805) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 @@ -1446,7 +1462,7 @@ BattleBGEffect_Tackle: ; c8805 (32:4805) BattleBGEffect_25: ; c8837 (32:4837) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw Tackle_BGEffect25_2d_one dw Tackle_BGEffect25_2d_two @@ -1457,10 +1473,10 @@ BattleBGEffect_25: ; c8837 (32:4837) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ef4 - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms2 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 @@ -1533,16 +1549,16 @@ Functionc88a5: ; c88a5 (32:48a5) jp Functionc900b .rollout - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld d, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub d ld d, a ld h, LYOverridesBackup / $100 ld a, [hSCY] or a jr nz, .skip1 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] or a jr z, .skip2 dec a @@ -1551,14 +1567,14 @@ Functionc88a5: ; c88a5 (32:48a5) jr .skip2 .skip1 - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] dec a ld l, a ld [hl], $0 .skip2 ld a, [hSCY] ld l, a - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] sub l jr nc, .skip3 xor a @@ -1574,7 +1590,7 @@ Functionc88a5: ; c88a5 (32:48a5) BattleBGEffect_2d: ; c88e7 (32:48e7) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw BGEffect2d_2f_zero dw Tackle_BGEffect25_2d_one dw Tackle_BGEffect25_2d_two @@ -1589,10 +1605,10 @@ BGEffect2d_2f_zero: call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 @@ -1609,7 +1625,7 @@ BGEffect2d_2f_zero: BattleBGEffect_2f: ; c8919 (32:4919) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw BGEffect2d_2f_zero dw Tackle_BGEffect25_2d_one dw .two @@ -1623,7 +1639,7 @@ BattleBGEffect_2f: ; c8919 (32:4919) BattleBGEffect_26: ; c892a (32:492a) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1633,10 +1649,10 @@ BattleBGEffect_26: ; c892a (32:492a) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 @@ -1662,7 +1678,7 @@ BattleBGEffect_26: ; c892a (32:492a) BattleBGEffect_2c: ; c8964 (32:4964) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1672,10 +1688,10 @@ BattleBGEffect_2c: ; c8964 (32:4964) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a xor a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc @@ -1717,7 +1733,7 @@ BattleBGEffect_2c: ; c8964 (32:4964) BattleBGEffect_28: ; c89b5 (32:49b5) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1727,7 +1743,7 @@ BattleBGEffect_28: ; c89b5 (32:49b5) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 ret .one @@ -1760,7 +1776,7 @@ BattleBGEffect_28: ; c89b5 (32:49b5) BattleBGEffect_BounceDown: ; c89ee (32:49ee) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1770,10 +1786,10 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $42 - call Functionc8ef4 - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms2 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $1 @@ -1801,9 +1817,8 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee) call Functionc901b ld hl, BG_EFFECT_STRUCT_03 add hl, bc -rept 2 inc [hl] -endr + inc [hl] ret .two @@ -1812,7 +1827,7 @@ endr BattleBGEffect_2a: ; c8a3a (32:4a3a) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1825,15 +1840,15 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, $47 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a - ld a, [hLCDStatCustom + 1] + ld [hFFC8], a + ld a, [hFFC7] ld l, a ld h, $d2 .loop - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] cp l jr z, .done xor a @@ -1858,9 +1873,9 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] inc a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a call BattleBGEffects_IncrementJumptable ret @@ -1868,7 +1883,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) call .GetLYOverride jr nc, .finish call .SetLYOverridesBackup - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] dec a ld l, a ld [hl], e @@ -1880,23 +1895,22 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) .SetLYOverridesBackup ld e, a - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l srl a ld h, LYOverridesBackup / $100 .loop2 ld [hl], e -rept 2 inc hl -endr + inc hl dec a jr nz, .loop2 ret .five - call Functionc8f19 + call BattleBGEffects_ResetVideoHRAM ret .GetLYOverride @@ -1922,7 +1936,7 @@ endr BattleBGEffect_2b: ; c8acc (32:4acc) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one @@ -1931,7 +1945,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede + call BattleBGEffect_SetLCDStatCustoms1 ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $40 @@ -1942,7 +1956,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc) add hl, bc ld a, [hl] and a - jr z, .asm_c8afc + jr z, .done dec [hl] srl a srl a @@ -1953,7 +1967,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc) call Functionc8f2e ret -.asm_c8afc +.done call BattleAnim_ResetLCDStatCustom ret @@ -1962,7 +1976,7 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) and a jr nz, .cgb call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -1973,11 +1987,11 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, $47 - ld [hLCDStatCustom], a + ld [hFFC6], a xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $60 - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ret .one @@ -2022,7 +2036,7 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) ret .two - call Functionc8f19 + call BattleBGEffects_ResetVideoHRAM ld a, $e4 ld [wBGP], a ld [wOBP1], a @@ -2199,7 +2213,7 @@ BattleBGEffect_1e: ; c8c55 (32:4c55) BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one @@ -2208,10 +2222,10 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_BATTLE_TURN add hl, bc ld [hl], $1 @@ -2244,7 +2258,7 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61) BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2) call BattleBGEffects_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -2254,11 +2268,11 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2) call BattleBGEffects_IncrementJumptable call BattleBGEffects_ClearLYOverrides ld a, $43 - ld [hLCDStatCustom], a + ld [hFFC6], a xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $37 - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 @@ -2376,18 +2390,17 @@ BattleBGEffect_35: ; c8d3a (32:4d3a) ld [hSCX], a ret -Functionc8d57: ; c8d57 (32:4d57) +BattleBGEffect_GetNthDMGPal: ; c8d57 (32:4d57) ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc ld a, [hl] and a jr z, .zero - dec [hl] ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] - call Functionc8eb2 + call BattleBGEffect_GetNextDMGPal ret .zero @@ -2397,7 +2410,7 @@ Functionc8d57: ; c8d57 (32:4d57) ld hl, BG_EFFECT_STRUCT_JT_INDEX add hl, bc ld [hl], a - call Functionc8eac + call BattleBGEffect_GetFirstDMGPal ret BGEffect_RapidCyclePals: ; c8d77 (32:4d77) @@ -2421,10 +2434,10 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, $47 - call Functionc8ede - ld a, [hLCDStatCustom + 2] + call BattleBGEffect_SetLCDStatCustoms1 + ld a, [hFFC8] inc a - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] @@ -2448,7 +2461,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) swap a or [hl] ld [hl], a - call Functionc8eac + call BattleBGEffect_GetFirstDMGPal jr c, .okay_2_dmg call Functionc900b ret @@ -2460,8 +2473,8 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) ret .two_dmg: ; c8dc9 (32:4dc9) - call Functionc8f19 - ld a, $e4 + call BattleBGEffects_ResetVideoHRAM + ld a, %11100100 ld [rBGP], a call EndBattleBGEffect ret @@ -2511,7 +2524,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) swap a or [hl] ld [hl], a - call Functionc8eac + call BattleBGEffect_GetFirstDMGPal jr c, .okay_2_cgb call BGEffects_LoadBGPal0_OBPal1 ret @@ -2542,7 +2555,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77) swap a or [hl] ld [hl], a - call Functionc8eac + call BattleBGEffect_GetFirstDMGPal jr c, .okay_4_cgb call BGEffects_LoadBGPal1_OBPal0 ret @@ -2613,30 +2626,29 @@ BGEffects_LoadBGPal1_OBPal0: ; c8e7f (32:4e7f) ld [hCGBPalUpdate], a ret -Functionc8eac: ; c8eac (32:4eac) +BattleBGEffect_GetFirstDMGPal: ; c8eac (32:4eac) ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld a, [hl] inc [hl] - -Functionc8eb2: ; c8eb2 (32:4eb2) +BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2) ld l, a ld h, $0 add hl, de ld a, [hl] - cp $ff - jr z, .asm_c8ec8 - cp $fe - jr nz, .asm_c8ec6 + cp -1 + jr z, .quit + cp -2 + jr nz, .repeat ld a, [de] ld hl, BG_EFFECT_STRUCT_03 add hl, bc ld [hl], $0 -.asm_c8ec6 +.repeat and a ret -.asm_c8ec8 +.quit scf ret @@ -2657,57 +2669,57 @@ BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb) jr nz, .loop2 ret -Functionc8ede: ; c8ede (32:4ede) - ld [hLCDStatCustom], a +BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede) + ld [hFFC6], a call BGEffect_CheckBattleTurn - jr nz, .asm_c8eea - ld de, $36 + jr nz, .player_turn + lb de, $00, $36 jr .okay -.asm_c8eea - ld de, $2f5e +.player_turn + lb de, $2f, $5e .okay ld a, d - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, e - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ret -Functionc8ef4: ; c8ef4 (32:4ef4) - ld [hLCDStatCustom], a +BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4) + ld [hFFC6], a call BGEffect_CheckBattleTurn - jr nz, .asm_c8f00 - ld de, $36 - jr .asm_c8f03 + jr nz, .player_turn + lb de, $00, $36 + jr .okay -.asm_c8f00 - ld de, $2d5e -.asm_c8f03 +.player_turn + lb de, $2d, $5e +.okay ld a, d - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, e - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ret BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a) xor a - ld [hLCDStatCustom + 1], a - ld [hLCDStatCustom + 2], a + ld [hFFC7], a + ld [hFFC8], a call BattleBGEffects_ClearLYOverrides xor a - ld [hLCDStatCustom], a + ld [hFFC6], a call EndBattleBGEffect ret -Functionc8f19: ; c8f19 (32:4f19) +BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19) xor a - ld [hLCDStatCustom], a - ld a, $e4 + ld [hFFC6], a + ld a, %11100100 ld [rBGP], a ld [wBGP], a ld [wOBP1], a - ld [hLCDStatCustom + 1], a - ld [hLCDStatCustom + 2], a + ld [hFFC7], a + ld [hFFC8], a call BattleBGEffects_ClearLYOverrides ret @@ -2723,10 +2735,10 @@ Functionc8f2e: ; c8f2e (32:4f2e) ld [wBattleAnimTemp3], a ld bc, LYOverridesBackup .loop - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] cp c jr nc, .next - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] cp c jr c, .next ld a, [wBattleAnimTemp2] @@ -2800,14 +2812,14 @@ Functionc8f9a: ; c8f9a (32:4f9a) call BattleBGEffects_Sine ld e, a pop hl - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] cp c jr c, .skip1 ld a, e ld [bc], a inc bc .skip1 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] cp l jr nc, .skip2 ld [hl], e @@ -2825,7 +2837,7 @@ Functionc8f9a: ; c8f9a (32:4f9a) ret .GetLYOverrideBackupAddrOffset - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld e, a ld a, [wBattleAnimTemp0] add e @@ -2835,13 +2847,13 @@ Functionc8f9a: ; c8f9a (32:4f9a) BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) push bc - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a inc a ld e, a ld h, $d2 ld d, h - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l and a jr z, .done @@ -2863,9 +2875,9 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) Functionc900b: ; c900b (32:500b) push af ld h, $d2 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l ld d, a pop af @@ -2878,14 +2890,14 @@ Functionc900b: ; c900b (32:500b) Functionc901b: ; c901b (32:501b) push af ld e, a - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a - ld a, [hLCDStatCustom + 2] + ld a, [hFFC8] sub l sub e ld d, a ld h, $d2 - ld a, [hLCDStatCustom + 1] + ld a, [hFFC7] ld l, a ld a, $90 .asm_c902c diff --git a/battle/core.asm b/battle/core.asm index 7bc7d54f1..3abf99872 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -1849,9 +1849,8 @@ HandleWeather: ; 3cb9e dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -2575,9 +2574,8 @@ Function3d02b: ; 3d02b dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -2615,9 +2613,8 @@ endr rl [hl] ret nc ld a, $ff -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ret ; 3d0ab @@ -4747,18 +4744,16 @@ HandleStatBoostingHeldItems: ; 3de97 ld a, [hli] cp $ff jr z, .finish -rept 2 inc hl -endr + inc hl cp b jr nz, .loop pop bc ld a, [bc] ld [wd265], a push bc -rept 2 dec hl -endr + dec hl ld a, [hli] ld h, [hl] ld l, a @@ -5822,9 +5817,8 @@ MoveSelectionScreen: ; 3e4bc ld a, [wMenuCursorY] ld b, a ld a, [wNumMoves] -rept 2 inc a -endr + inc a cp b jp nz, .menu_loop ld a, $1 @@ -6008,9 +6002,8 @@ MoveInfoBox: ; 3e6c8 lb bc, 1, 2 call PrintNum pop hl -rept 2 inc hl -endr + inc hl ld [hl], "/" inc hl ld de, wNamedObjectIndexBuffer @@ -6818,9 +6811,8 @@ CheckUnownLetter: ; 3eb75 .next ; Make sure we haven't gone past the end of the table -rept 2 inc e -endr + inc e ld a, e cp a, .Set1 - .LetterSets jr c, .loop @@ -7176,9 +7168,8 @@ BadgeStatBoosts: ; 3ed45 ; Swap badges 3 (PlainBadge) and 5 (MineralBadge). ld d, a and (1 << PLAINBADGE) -rept 2 add a -endr + add a ld b, a ld a, d and (1 << MINERALBADGE) @@ -7197,9 +7188,8 @@ endr ld a, b srl b call c, BoostStat -rept 2 inc hl -endr + inc hl ; Check every other badge. srl b dec c @@ -7328,9 +7318,8 @@ _BattleRandom:: ; 3edd8 ; a * 5 + 1 ld c, a -rept 2 add a -endr + add a add c inc a @@ -7467,9 +7456,8 @@ GiveExperiencePoints: ; 3ee3b ld [de], a .skip -rept 2 inc de -endr + inc de dec c jr nz, .loop1 xor a @@ -7544,9 +7532,8 @@ endr inc [hl] jr nz, .skip2 ld a, $ff -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a .skip2 @@ -7881,9 +7868,8 @@ Function3f136: ; 3f136 inc [hl] jr nz, .asm_3f186 ld a, $ff -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a .asm_3f186 @@ -8800,9 +8786,8 @@ CheckPayDay: ; 3f71d rl [hl] jr nc, .okay ld a, $ff -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a .okay @@ -9202,13 +9187,11 @@ Function3fa42: ; 3fa42 ld d, 5 .loop push hl -rept 2 inc hl -endr + inc hl ld a, [hl] -rept 2 dec hl -endr + dec hl and a jr z, .copy push de @@ -9308,18 +9291,16 @@ Function3fac8: ; 3fac8 ld c, $1 .loop2 ld a, b -rept 2 add b -endr + add b ld e, a ld d, $0 ld hl, wd002 add hl, de push hl ld a, c -rept 2 add c -endr + add c ld e, a ld d, $0 ld hl, wd002 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 2a482a8ce..ad89448da 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -51,9 +51,8 @@ DoMove: ; 3402c ld c, a ld b, 0 ld hl, MoveEffectsPointers -rept 2 add hl, bc -endr + add hl, bc ld a, BANK(MoveEffectsPointers) call GetFarHalfword @@ -102,9 +101,8 @@ endr ld c, a ld b, 0 ld hl, BattleCommandPointers -rept 2 add hl, bc -endr + add hl, bc pop bc ld a, BANK(BattleCommandPointers) @@ -1076,9 +1074,8 @@ BattleCommand_DoTurn: ; 34555 jp nz, EndMoveEffect ; SubStatus5 -rept 2 inc de -endr + inc de ld a, [de] bit SUBSTATUS_TRANSFORMED, a @@ -1276,9 +1273,8 @@ BattleCommand_Critical: ; 34631 jr nc, .ScopeLens ; +2 critical level -rept 2 inc c -endr + inc c .ScopeLens push bc @@ -1522,9 +1518,8 @@ BattleCommand_Stab: ; 346d2 pop hl .SkipType -rept 2 inc hl -endr + inc hl jr .TypesLoop .end @@ -2741,9 +2736,8 @@ EndMoveEffect: ; 352a3 ld a, [BattleScriptBufferLoc + 1] ld h, a ld a, $ff -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ret @@ -3457,9 +3451,8 @@ BattleCommand_DamageCalc: ; 35612 xor a ld hl, hDividend -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ; Level * 2 @@ -3480,9 +3473,8 @@ endr pop bc ; + 2 -rept 2 inc [hl] -endr + inc [hl] ; * bp inc hl @@ -4075,9 +4067,8 @@ BattleCommand_PainSplit: ; 35926 ld [Buffer3], a ld a, [hl] ld [Buffer4], a -rept 2 dec de -endr + dec de ld a, [de] dec de add b @@ -4587,9 +4578,8 @@ BattleCommand_Spite: ; 35c0f call GetMoveName call BattleRandom and 3 -rept 2 inc a -endr + inc a ld b, a ld a, [hl] and $3f @@ -6380,9 +6370,8 @@ CalcStats: ; 3661d dec c ld b, 0 ld hl, StatLevelMultipliers -rept 2 add hl, bc -endr + add hl, bc xor a ld [hMultiplicand + 0], a @@ -6538,9 +6527,8 @@ BattleCommand_UnleashEnergy: ; 366e5 ld [wEnemyMoveStruct + MOVE_EFFECT], a call BattleRandom and 1 -rept 2 inc a -endr + inc a ld [bc], a ld a, 1 ld [wKickCounter], a @@ -6579,9 +6567,8 @@ BattleCommand_CheckRampage: ; 3671a set SUBSTATUS_CONFUSED, [hl] call BattleRandom and %00000001 -rept 2 inc a -endr + inc a inc de ; ConfuseCount ld [de], a .continue_rampage @@ -7464,9 +7451,8 @@ endr ld a, [hli] cp b jr z, .found_trap_text -rept 2 inc hl -endr + inc hl jr .find_trap_text .found_trap_text @@ -7552,9 +7538,8 @@ BattleCommand_Recoil: ; 36cb2 ld [Buffer2], a ld a, [hl] ld [Buffer1], a -rept 2 dec hl -endr + dec hl ld a, [hl] ld [Buffer3], a sub c @@ -7651,9 +7636,8 @@ BattleCommand_FinishConfusingTarget: ; 36d70 set SUBSTATUS_CONFUSED, [hl] call BattleRandom and 3 -rept 2 inc a -endr + inc a ld [bc], a ld a, BATTLE_VARS_MOVE_EFFECT @@ -7844,9 +7828,8 @@ BattleCommand_Substitute: ; 36e7c rr b srl a rr b -rept 2 dec hl -endr + dec hl ld a, b ld [de], a ld a, [hld] @@ -8457,9 +8440,8 @@ BattleCommand_Transform: ; 371cd ld a, [hli] ld [de], a inc hl -rept 2 inc de -endr + inc de ld bc, NUM_MOVES call CopyBytes ld a, [hBattleTurn] @@ -9125,9 +9107,8 @@ BattleCommand_GetMagnitude: ; 37991 ld a, [hli] cp b jr nc, .ok -rept 2 inc hl -endr + inc hl jr .loop .ok @@ -9528,16 +9509,14 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e inc c cp WEATHER_SUN jr z, .Heal -rept 2 dec c -endr + dec c .Heal ld b, 0 ld hl, .Multipliers -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] diff --git a/battle/objects/data.asm b/battle/objects/data.asm index cd4a6fb60..7ae0dc371 100755 --- a/battle/objects/data.asm +++ b/battle/objects/data.asm @@ -558,10 +558,10 @@ endm ; ANIM_OBJ_COTTON battleanimobj $01, $ff, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_4F, $04, $1f -; ANIM_OBJ_B8 +; ANIM_OBJ_PLAYERFEETFOLLOW battleanimobj $00, $00, BATTLEANIMFRAMESET_B5, BATTLEANIMFUNC_00, $00, $28 -; ANIM_OBJ_B9 +; ANIM_OBJ_ENEMYFEETFOLLOW battleanimobj $00, $00, BATTLEANIMFRAMESET_B6, BATTLEANIMFUNC_00, $01, $29 ; ANIM_OBJ_BA diff --git a/battle/objects/functions.asm b/battle/objects/functions.asm index 13e78b0b3..7c1aa3764 100755 --- a/battle/objects/functions.asm +++ b/battle/objects/functions.asm @@ -96,13 +96,11 @@ DoBattleAnimFrame: ; ccfbe BattleAnimFunction_00: ; cd06e (33:506e) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one - .one call DeinitBattleAnimation - .zero ret @@ -179,10 +177,9 @@ endr BattleAnimFunction_03: ; cd0e3 (33:50e3) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one - .zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -200,7 +197,6 @@ BattleAnimFunction_03: ; cd0e3 (33:50e3) ld a, [hl] and $7f ld [hl], a - .one ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -227,10 +223,9 @@ BattleAnimFunction_03: ; cd0e3 (33:50e3) BattleAnimFunction_01: ; cd12a (33:512a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one - .one call DeinitBattleAnimation ret @@ -265,7 +260,7 @@ BattleAnimFunction_02: ; cd146 (33:5146) BattleAnimFunction_12: ; cd15c (33:515c) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -278,7 +273,6 @@ BattleAnimFunction_12: ; cd15c (33:515c) dw .nine dw .ten dw .eleven - .zero call GetBallAnimFunction call BattleAnim_IncAnonJumptableIndex @@ -308,7 +302,6 @@ BattleAnimFunction_12: ; cd15c (33:515c) ld [hl], $0 inc hl ld [hl], $10 - .four ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -384,11 +377,10 @@ BattleAnimFunction_12: ; cd15c (33:515c) BattleAnimFunction_13: ; cd212 (33:5212) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two - .zero call GetBallAnimFunction call BattleAnim_IncAnonJumptableIndex @@ -448,8 +440,8 @@ GetBallAnimFunction: ; cd249 (33:5249) add hl, bc ld [hl], a ret -; cd26c (33:526c) +; cd26c (33:526c) .balls db MASTER_BALL, 5 db ULTRA_BALL, 3 @@ -464,16 +456,14 @@ GetBallAnimFunction: ; cd249 (33:5249) db LOVE_BALL, 4 db -1, 2 ; cd284 - BattleAnimFunction_10: ; cd284 (33:5284) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two dw .three dw .four - .zero ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -510,10 +500,9 @@ BattleAnimFunction_10: ; cd284 (33:5284) BattleAnimFunction_07: ; cd2be (33:52be) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one - .zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -558,12 +547,11 @@ BattleAnimFunction_07: ; cd2be (33:52be) BattleAnimFunction_08: ; cd306 (33:5306) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two dw .three - .zero ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -633,7 +621,6 @@ BattleAnimFunction_08: ; cd306 (33:5306) .finish call BattleAnim_IncAnonJumptableIndex - .three ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -672,11 +659,10 @@ BattleAnimFunction_08: ; cd306 (33:5306) BattleAnimFunction_09: ; cd3ae (33:53ae) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two - .zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -689,7 +675,6 @@ BattleAnimFunction_09: ; cd3ae (33:53ae) ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc ld [hl], a - .one ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -722,7 +707,7 @@ BattleAnimFunction_09: ; cd3ae (33:53ae) BattleAnimFunction_0A: ; cd3f2 (33:53f2) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -733,7 +718,6 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2) dw .seven dw .eight dw .nine - .zero ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -800,7 +784,6 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc inc [hl] - .two ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc @@ -811,18 +794,16 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc inc [hl] - .three ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc inc [hl] - .six ret BattleAnimFunction_0B: ; cd478 (33:5478) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two @@ -832,13 +813,11 @@ BattleAnimFunction_0B: ; cd478 (33:5478) dw .six dw .seven dw .eight - .zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $40 - .one ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -952,7 +931,6 @@ BattleAnimFunction_0B: ; cd478 (33:5478) ld hl, BATTLEANIMSTRUCT_01 add hl, bc res 5, [hl] - .four .five .six @@ -1010,10 +988,9 @@ Functioncd557: ; cd557 (33:5557) BattleAnimFunction_4E: ; cd58a (33:558a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one - .zero ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -1073,11 +1050,10 @@ BattleAnimFunction_4E: ; cd58a (33:558a) BattleAnimFunction_0C: ; cd5e9 (33:55e9) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two - .zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -1103,7 +1079,6 @@ BattleAnimFunction_0C: ; cd5e9 (33:55e9) ld [hl], $0 ld a, $22 call ReinitBattleAnimFrameset - .two ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -1159,21 +1134,20 @@ BattleAnimFunction_0C: ; cd5e9 (33:55e9) BattleAnimFunction_0D: ; cd66a (33:566a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw .zero dw .one dw .two dw .three dw .four - .zero call BattleAnim_IncAnonJumptableIndex ld a, $42 - ld [hLCDStatCustom], a + ld [hFFC6], a ld a, $58 - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $5e - ld [hLCDStatCustom + 2], a + ld [hFFC8], a ret .one @@ -1187,7 +1161,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a) jr nc, .asm_cd69b call BattleAnim_IncAnonJumptableIndex xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ret .asm_cd69b @@ -1206,7 +1180,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a) add [hl] sub $10 ret c - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] @@ -1227,10 +1201,9 @@ BattleAnimFunction_0D: ; cd66a (33:566a) cp $70 jr c, asm_cd6da xor a - ld [hLCDStatCustom], a - ld [hLCDStatCustom + 1], a - ld [hLCDStatCustom + 2], a - + ld [hFFC6], a + ld [hFFC7], a + ld [hFFC8], a .four call DeinitBattleAnimation ret @@ -1241,15 +1214,14 @@ asm_cd6da: ; cd6da (33:56da) ld [hl], a sub $10 ret c - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ret BattleAnimFunction_0E: ; cd6e3 (33:56e3) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd6ea dw Functioncd6f7 - Functioncd6ea: ; cd6ea (33:56ea) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -1257,7 +1229,6 @@ Functioncd6ea: ; cd6ea (33:56ea) ld a, $24 add [hl] call ReinitBattleAnimFrameset - Functioncd6f7: ; cd6f7 (33:56f7) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -1283,15 +1254,13 @@ Functioncd6f7: ; cd6f7 (33:56f7) BattleAnimFunction_0F: ; cd71a (33:571a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd725 dw Functioncd728 dw Functioncd763 dw Functioncd776 - Functioncd725: ; cd725 (33:5725) call BattleAnim_IncAnonJumptableIndex - Functioncd728: ; cd728 (33:5728) ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc @@ -1326,7 +1295,6 @@ Functioncd728: ; cd728 (33:5728) ld a, [hl] and $1 ld [hl], a - Functioncd763: ; cd763 (33:5763) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -1340,7 +1308,6 @@ Functioncd763: ; cd763 (33:5763) call BattleAnim_IncAnonJumptableIndex ld a, $29 call ReinitBattleAnimFrameset - Functioncd776: ; cd776 (33:5776) ret @@ -1378,10 +1345,9 @@ BattleAnimFunction_11: ; cd777 (33:5777) BattleAnimFunction_14: ; cd7a4 (33:57a4) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd7ab dw Functioncd7d2 - Functioncd7ab: ; cd7ab (33:57ab) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -1404,7 +1370,6 @@ Functioncd7ab: ; cd7ab (33:57ab) ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld [hl], $1 - Functioncd7d2: ; cd7d2 (33:57d2) ld hl, BATTLEANIMSTRUCT_10 add hl, bc @@ -1447,17 +1412,15 @@ Functioncd7d2: ; cd7d2 (33:57d2) BattleAnimFunction_15: ; cd80c (33:580c) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd81f dw Functioncd817 dw Functioncd81f dw Functioncd820 - Functioncd817: ; cd817 (33:5817) call BattleAnim_IncAnonJumptableIndex ld a, $35 call ReinitBattleAnimFrameset - Functioncd81f: ; cd81f (33:581f) ret @@ -1467,7 +1430,7 @@ Functioncd820: ; cd820 (33:5820) BattleAnimFunction_16: ; cd824 (33:5824) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd835 dw Functioncd860 dw Functioncd88f @@ -1475,7 +1438,6 @@ BattleAnimFunction_16: ; cd824 (33:5824) dw Functioncd88f dw Functioncd88f dw Functioncd893 - Functioncd835: ; cd835 (33:5835) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID @@ -1503,7 +1465,6 @@ Functioncd835: ; cd835 (33:5835) ld a, [hl] and $7f ld [hl], a - Functioncd860: ; cd860 (33:5860) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -1535,7 +1496,6 @@ Functioncd860: ; cd860 (33:5860) ld a, [hl] and $1f ret nz - Functioncd88f: ; cd88f (33:588f) call BattleAnim_IncAnonJumptableIndex ret @@ -1548,7 +1508,7 @@ Functioncd893: ; cd893 (33:5893) BattleAnimFunction_17: ; cd89a (33:589a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd8ab dw Functioncd8cc dw Functioncd8f5 @@ -1556,7 +1516,6 @@ BattleAnimFunction_17: ; cd89a (33:589a) dw Functioncd8f5 dw Functioncd8f5 dw Functioncd8f9 - Functioncd8ab: ; cd8ab (33:58ab) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -1578,7 +1537,6 @@ Functioncd8ab: ; cd8ab (33:58ab) ld a, [hl] and $7f ld [hl], a - Functioncd8cc: ; cd8cc (33:58cc) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -1606,7 +1564,6 @@ Functioncd8cc: ; cd8cc (33:58cc) ld a, [hl] and $1f ret nz - Functioncd8f5: ; cd8f5 (33:58f5) call BattleAnim_IncAnonJumptableIndex ret @@ -1619,10 +1576,9 @@ Functioncd8f9: ; cd8f9 (33:58f9) BattleAnimFunction_18: ; cd900 (33:5900) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd907 dw Functioncd913 - Functioncd907: ; cd907 (33:5907) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -1630,7 +1586,6 @@ Functioncd907: ; cd907 (33:5907) ld [hl], $28 inc hl ld [hl], $0 - Functioncd913: ; cd913 (33:5913) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -1677,19 +1632,17 @@ Functioncd913: ; cd913 (33:5913) BattleAnimFunction_19: ; cd954 (33:5954) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncd961 dw Functioncd96a dw Functioncd96e dw Functioncd96a dw Functioncd97b - Functioncd961: ; cd961 (33:5961) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B add hl, bc ld [hl], $0 - Functioncd96a: ; cd96a (33:596a) call Functioncd99a ret @@ -1794,12 +1747,11 @@ Functioncd9f4: ; cd9f4 (33:59f4) add hl, de ld d, [hl] ret -; cda01 (33:5a01) +; cda01 (33:5a01) Unknown_cda01: ; cda01 db 8, 6, 5, 4, 5, 6, 8, 12, 16 ; cda0a - BattleAnimFunction_1C: ; cda0a (33:5a0a) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -1831,11 +1783,10 @@ BattleAnimFunction_1C: ; cda0a (33:5a0a) BattleAnimFunction_1F: ; cda31 (33:5a31) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncda4c dw Functioncda3a dw Functioncda4c - Functioncda3a: ; cda3a (33:5a3a) ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -1846,18 +1797,16 @@ Functioncda3a: ; cda3a (33:5a3a) ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $8 - Functioncda4c: ; cda4c (33:5a4c) ret BattleAnimFunction_20: ; cda4d (33:5a4d) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncda58 dw Functioncda62 dw Functioncda7a dw Functioncda8c - Functioncda58: ; cda58 (33:5a58) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_10 @@ -1894,7 +1843,6 @@ Functioncda7a: ; cda7a (33:5a7a) call BattleAnim_IncAnonJumptableIndex ld a, $58 call ReinitBattleAnimFrameset - Functioncda8c: ; cda8c (33:5a8c) ret @@ -1948,11 +1896,10 @@ Functioncda8d: ; cda8d (33:5a8d) BattleAnimFunction_3F: ; cdad6 (33:5ad6) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdadf dw Functioncdae9 dw Functioncdaf9 - Functioncdadf: ; cdadf (33:5adf) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_10 @@ -1971,7 +1918,6 @@ Functioncdae9: ; cdae9 (33:5ae9) .asm_cdaf6 call BattleAnim_IncAnonJumptableIndex - Functioncdaf9: ; cdaf9 (33:5af9) ret @@ -1986,13 +1932,12 @@ BattleAnimFunction_1A: ; cdafa (33:5afa) BattleAnimFunction_1B: ; cdb06 (33:5b06) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdb13 dw Functioncdb14 dw Functioncdb28 dw Functioncdb50 dw Functioncdb65 - Functioncdb13: ; cdb13 (33:5b13) ret @@ -2048,7 +1993,6 @@ Functioncdb50: ; cdb50 (33:5b50) ld hl, BATTLEANIMSTRUCT_DURATION add hl, bc ld [hl], $80 - Functioncdb65: ; cdb65 (33:5b65) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -2070,7 +2014,7 @@ Functioncdb65: ; cdb65 (33:5b65) BattleAnimFunction_1D: ; cdb80 (33:5b80) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdb9f dw Functioncdbb3 dw Functioncdbcf @@ -2085,7 +2029,6 @@ BattleAnimFunction_1D: ; cdb80 (33:5b80) dw Functioncdc48 dw Functioncdc57 dw Functioncdc74 - Functioncdb9f: ; cdb9f (33:5b9f) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -2236,7 +2179,6 @@ Functioncdc57: ; cdc57 (33:5c57) .asm_cdc71 call BattleAnim_IncAnonJumptableIndex - Functioncdc74: ; cdc74 (33:5c74) ret @@ -2296,10 +2238,9 @@ BattleAnimFunction_1E: ; cdca6 (33:5ca6) BattleAnimFunction_21: ; cdcc3 (33:5cc3) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdcca dw Functioncdced - Functioncdcca: ; cdcca (33:5cca) ld a, [hBattleTurn] and a @@ -2371,10 +2312,9 @@ Functioncdcfe: ; cdcfe (33:5cfe) BattleAnimFunction_22: ; cdd2a (33:5d2a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdd31 dw Functioncdd4f - Functioncdd31: ; cdd31 (33:5d31) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -2439,10 +2379,9 @@ Functioncdd4f: ; cdd4f (33:5d4f) BattleAnimFunction_23: ; cdd90 (33:5d90) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdd97 dw Functioncddbc - Functioncdd97: ; cdd97 (33:5d97) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID @@ -2465,7 +2404,6 @@ Functioncdd97: ; cdd97 (33:5d97) ld a, [hl] and $7f ld [hl], a - Functioncddbc: ; cddbc (33:5dbc) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -2509,11 +2447,10 @@ Functioncddbc: ; cddbc (33:5dbc) BattleAnimFunction_24: ; cddf9 (33:5df9) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncde02 dw Functioncde20 dw Functioncde21 - Functioncde02: ; cde02 (33:5e02) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -2531,19 +2468,17 @@ Functioncde02: ; cde02 (33:5e02) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a - Functioncde20: ; cde20 (33:5e20) ret Functioncde21: ; cde21 (33:5e21) call DeinitBattleAnimation ret -; cde25 (33:5e25) +; cde25 (33:5e25) Unknown_cde25: ; cde25 db $ec, $f8, $00 ; cde28 - BattleAnimFunction_25: ; cde28 (33:5e28) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -2591,10 +2526,9 @@ BattleAnimFunction_26: ; cde54 (33:5e54) BattleAnimFunction_27: ; cde6b (33:5e6b) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncde72 dw Functioncde88 - Functioncde72: ; cde72 (33:5e72) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -2608,16 +2542,14 @@ Functioncde72: ; cde72 (33:5e72) .asm_cde83 add $6a call ReinitBattleAnimFrameset - Functioncde88: ; cde88 (33:5e88) ret BattleAnimFunction_28: ; cde89 (33:5e89) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncde90 dw Functioncdebf - Functioncde90: ; cde90 (33:5e90) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -2758,10 +2690,9 @@ BattleAnimFunction_2D: ; cdf1b (33:5f1b) BattleAnimFunction_2A: ; cdf59 (33:5f59) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functioncdf60 dw BattleAnimFunction_29 - Functioncdf60: ; cdf60 (33:5f60) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -2879,11 +2810,10 @@ BattleAnimFunction_3C: ; cdfcb (33:5fcb) BattleAnimFunction_35: ; ce00b (33:600b) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce014 dw Functionce023 dw Functionce05f - Functionce014: ; ce014 (33:6014) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -2892,7 +2822,6 @@ Functionce014: ; ce014 (33:6014) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $10 - Functionce023: ; ce023 (33:6023) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -2938,12 +2867,11 @@ Functionce05f: ; ce05f (33:605f) BattleAnimFunction_2B: ; ce063 (33:6063) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce06e dw Functionce083 dw Functionce091 dw Functionce09e - Functionce06e: ; ce06e (33:606e) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3005,11 +2933,10 @@ Functionce09e: ; ce09e (33:609e) BattleAnimFunction_2C: ; ce0c5 (33:60c5) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce0ce dw Functionce0f8 dw Functionce0dd - Functionce0ce: ; ce0ce (33:60ce) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3038,7 +2965,6 @@ Functionce0dd: ; ce0dd (33:60dd) ld a, [hl] sub $4 ld [hl], a - Functionce0f8: ; ce0f8 (33:60f8) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -3057,10 +2983,9 @@ Functionce0f8: ; ce0f8 (33:60f8) BattleAnimFunction_2E: ; ce10e (33:610e) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce115 dw Functionce12a - Functionce115: ; ce115 (33:6115) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -3073,7 +2998,6 @@ Functionce115: ; ce115 (33:6115) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], a - Functionce12a: ; ce12a (33:612a) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3207,10 +3131,9 @@ BattleAnimFunction_42: ; ce1b0 (33:61b0) BattleAnimFunction_30: ; ce1e7 (33:61e7) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce1ee dw Functionce1fb - Functionce1ee: ; ce1ee (33:61ee) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_YCOORD @@ -3219,7 +3142,6 @@ Functionce1ee: ; ce1ee (33:61ee) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], a - Functionce1fb: ; ce1fb (33:61fb) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3248,10 +3170,9 @@ Functionce1fb: ; ce1fb (33:61fb) BattleAnimFunction_31: ; ce226 (33:6226) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce22d dw Functionce254 - Functionce22d: ; ce22d (33:622d) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -3273,18 +3194,16 @@ Functionce22d: ; ce22d (33:622d) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld [hl], $f - Functionce254: ; ce254 (33:6254) ret BattleAnimFunction_32: ; ce255 (33:6255) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce260 dw Functionce274 dw Functionce278 dw Functionce289 - Functionce260: ; ce260 (33:6260) call BattleAnim_IncAnonJumptableIndex ld a, [hBattleTurn] @@ -3356,14 +3275,13 @@ Functionce29f: ; ce29f (33:629f) and [hl] ld [wOBP0], a ret -; ce2c4 (33:62c4) +; ce2c4 (33:62c4) Unknown_ce2c4: ; ce2c4 db $ff, $aa, $55, $aa Unknown_ce2c8: ; ce2c8 db $ff, $ff, $00, $00 ; ce2cc - BattleAnimFunction_33: ; ce2cc (33:62cc) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3396,11 +3314,10 @@ BattleAnimFunction_33: ; ce2cc (33:62cc) BattleAnimFunction_36: ; ce2fd (33:62fd) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce306 dw Functionce330 dw Functionce34c - Functionce306: ; ce306 (33:6306) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -3469,10 +3386,9 @@ Functionce34c: ; ce34c (33:634c) BattleAnimFunction_37: ; ce35f (33:635f) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce366 dw Functionce375 - Functionce366: ; ce366 (33:6366) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -3481,7 +3397,6 @@ Functionce366: ; ce366 (33:6366) and $7f add $81 call ReinitBattleAnimFrameset - Functionce375: ; ce375 (33:6375) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3500,11 +3415,10 @@ Functionce375: ; ce375 (33:6375) BattleAnimFunction_38: ; ce389 (33:6389) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce392 dw Functionce39c dw Functionce3ae - Functionce392: ; ce392 (33:6392) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -3525,7 +3439,6 @@ Functionce39c: ; ce39c (33:639c) call BattleAnim_IncAnonJumptableIndex ld a, $20 call ReinitBattleAnimFrameset - Functionce3ae: ; ce3ae (33:63ae) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -3584,10 +3497,9 @@ BattleAnimFunction_3A: ; ce3d2 (33:63d2) BattleAnimFunction_3B: ; ce3ff (33:63ff) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce406 dw Functionce412 - Functionce406: ; ce406 (33:6406) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3628,11 +3540,10 @@ BattleAnimFunction_3D: ; ce416 (33:6416) BattleAnimFunction_3E: ; ce43a (33:643a) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce443 dw Functionce465 dw Functionce490 - Functionce443: ; ce443 (33:6443) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0F @@ -3652,7 +3563,6 @@ Functionce443: ; ce443 (33:6443) and $f0 or $8 ld [hl], a - Functionce465: ; ce465 (33:6465) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3682,7 +3592,6 @@ Functionce465: ; ce465 (33:6465) .asm_ce48b ld [hl], $10 call BattleAnim_IncAnonJumptableIndex - Functionce490: ; ce490 (33:6490) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3695,10 +3604,9 @@ Functionce490: ; ce490 (33:6490) BattleAnimFunction_40: ; ce49c (33:649c) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce4a3 dw Functionce4b0 - Functionce4a3: ; ce4a3 (33:64a3) call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_0B @@ -3706,7 +3614,6 @@ Functionce4a3: ; ce4a3 (33:64a3) ld a, $24 add [hl] call ReinitBattleAnimFrameset - Functionce4b0: ; ce4b0 (33:64b0) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -3828,11 +3735,10 @@ BattleAnimFunction_44: ; ce532 (33:6532) BattleAnimFunction_45: ; ce55b (33:655b) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce564 dw Functionce56e dw Functionce577 - Functionce564: ; ce564 (33:6564) ld d, $18 ld hl, BATTLEANIMSTRUCT_0B @@ -3846,7 +3752,6 @@ Functionce56e: ; ce56e (33:656e) ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld [hl], $18 - Functionce577: ; ce577 (33:6577) ld hl, BATTLEANIMSTRUCT_0F add hl, bc @@ -3871,10 +3776,9 @@ asm_ce58f: ; ce58f (33:658f) BattleAnimFunction_46: ; ce593 (33:6593) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce5b3 dw Functionce59a - Functionce59a: ; ce59a (33:659a) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -3893,7 +3797,6 @@ Functionce59a: ; ce59a (33:659a) .asm_ce5b0 call DeinitBattleAnimation - Functionce5b3: ; ce5b3 (33:65b3) ret @@ -3941,12 +3844,11 @@ endr BattleAnimFunction_49: ; ce5ee (33:65ee) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce5f9 dw Functionce60a dw Functionce622 dw Functionce618 - Functionce5f9: ; ce5f9 (33:65f9) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -3957,7 +3859,6 @@ Functionce5f9: ; ce5f9 (33:65f9) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], $ec - Functionce60a: ; ce60a (33:660a) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -3976,7 +3877,6 @@ Functionce618: ; ce618 (33:6618) asm_ce61c: ; ce61c (33:661c) call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex - Functionce622: ; ce622 (33:6622) ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -3990,12 +3890,11 @@ endr BattleAnimFunction_4A: ; ce62f (33:662f) call BattleAnim_AnonJumptable -.anon_jumptable +.anon_dw dw Functionce63a dw Functionce648 dw Functionce65c dw Functionce672 - Functionce63a: ; ce63a (33:663a) ld hl, BATTLEANIMSTRUCT_0B add hl, bc @@ -4234,24 +4133,24 @@ BattleAnim_Cosine_e: ; ce76b (33:676b) call BattleAnim_Cosine ld e, a ret -; ce771 (33:6771) +; ce771 (33:6771) BattleAnim_AbsSinePrecise: ; ce771 ld a, e call BattleAnim_Sine ld e, l ld d, h ret -; ce778 +; ce778 BattleAnim_AbsCosinePrecise: ; ce778 ld a, e call BattleAnim_Cosine ld e, l ld d, h ret -; ce77f +; ce77f BattleAnimSineWave: ; ce77f sine_wave $100 ; ce7bf diff --git a/battle/objects/library.asm b/battle/objects/helpers.asm similarity index 100% rename from battle/objects/library.asm rename to battle/objects/helpers.asm diff --git a/battle/sliding_intro.asm b/battle/sliding_intro.asm index 0611c91d9..6361f7fa7 100755 --- a/battle/sliding_intro.asm +++ b/battle/sliding_intro.asm @@ -5,10 +5,10 @@ BattleIntroSlidingPics: ; 4e980 ld [rSVBK], a call .subfunction1 ld a, rSCX - $ff00 - ld [hLCDStatCustom], a + ld [hFFC6], a call .subfunction2 xor a - ld [hLCDStatCustom], a + ld [hFFC6], a pop af ld [rSVBK], a ret diff --git a/constants/animation_constants.asm b/constants/animation_constants.asm index 7aa09b6d0..5ae2f324f 100644 --- a/constants/animation_constants.asm +++ b/constants/animation_constants.asm @@ -210,8 +210,8 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value const ANIM_OBJ_B5 const ANIM_OBJ_FLOWER const ANIM_OBJ_COTTON - const ANIM_OBJ_B8 - const ANIM_OBJ_B9 + const ANIM_OBJ_PLAYERFEETFOLLOW + const ANIM_OBJ_ENEMYFEETFOLLOW const ANIM_OBJ_BA const ANIM_OBJ_BB diff --git a/constants/battle_tower_constants.asm b/constants/battle_tower_constants.asm index a3240e299..1e5b0d625 100755 --- a/constants/battle_tower_constants.asm +++ b/constants/battle_tower_constants.asm @@ -15,7 +15,7 @@ const BATTLETOWERACTION_0D ; more time stuff in SRAM bank 5 const BATTLETOWERACTION_EGGTICKET ; egg ticket const BATTLETOWERACTION_0F ; check w3_d090 - const BATTLETOWERACTION_10 ; jumptable based on 5:a800 + const BATTLETOWERACTION_10 ; dw based on 5:a800 const BATTLETOWERACTION_11 ; store 0 in 5:aa8d const BATTLETOWERACTION_12 ; store 1 in 5:aa8d const BATTLETOWERACTION_13 ; check 5:aa8d diff --git a/engine/battle_start.asm b/engine/battle_start.asm index 929ac04c1..bd8b6cc28 100644 --- a/engine/battle_start.asm +++ b/engine/battle_start.asm @@ -39,9 +39,9 @@ Predef_StartBattle: ; 8c20f call DmgToCgbBGPals call DelayFrame xor a - ld [hLCDStatCustom], a - ld [hLCDStatCustom + 1], a - ld [hLCDStatCustom + 2], a + ld [hFFC6], a + ld [hFFC7], a + ld [hFFC8], a ld [hSCY], a ld a, $1 @@ -74,9 +74,8 @@ Function8c26d: ; 8c26d ld [hBGMapMode], a ld hl, wJumptableIndex xor a -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a call WipeLYOverrides ret @@ -146,20 +145,10 @@ INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp" FlashyTransitionToBattle: ; 8c314 - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, .jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .dw, wJumptableIndex ; 8c323 -.jumptable: ; 8c323 (23:4323) +.dw: ; 8c323 (23:4323) dw StartTrainerBattle_DetermineWhichAnimation ; 00 ; Animation 1: cave @@ -314,11 +303,11 @@ StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) call StartTrainerBattle_NextScene ld a, $43 - ld [hLCDStatCustom], a + ld [hFFC6], a xor a - ld [hLCDStatCustom + 1], a + ld [hFFC7], a ld a, $90 - ld [hLCDStatCustom + 2], a + ld [hFFC8], a xor a ld [wcf64], a ld [wcf65], a @@ -784,9 +773,8 @@ StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) ld a, d ld d, 0 ld hl, .sinewave -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] diff --git a/engine/billspc.asm b/engine/billspc.asm index d77836061..3090ca0c2 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -42,12 +42,12 @@ _DepositPKMN: ; e2391 (38:6391) jp [hl] .Jumptable: ; e23df (38:63df) - jumptable_start - jumptable .Init - jumptable .HandleJoypad - jumptable .WhatsUp - jumptable .Submenu - jumptable BillsPC_EndJumptableLoop + + dw .Init + dw .HandleJoypad + dw .WhatsUp + dw .Submenu + dw BillsPC_EndJumptableLoop .Init: ; e23e9 (38:63e9) @@ -151,11 +151,11 @@ endr jp [hl] BillsPCDepositJumptable: ; e24a1 (38:64a1) - jumptable_start - jumptable BillsPCDepositFuncDeposit ; Deposit Pokemon - jumptable BillsPCDepositFuncStats ; Pokemon Stats - jumptable BillsPCDepositFuncRelease ; Release Pokemon - jumptable BillsPCDepositFuncCancel ; Cancel + + dw BillsPCDepositFuncDeposit ; Deposit Pokemon + dw BillsPCDepositFuncStats ; Pokemon Stats + dw BillsPCDepositFuncRelease ; Release Pokemon + dw BillsPCDepositFuncCancel ; Cancel BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) @@ -310,12 +310,12 @@ _WithdrawPKMN: ; e2583 (38:6583) jp [hl] .Jumptable: ; e25d2 (38:65d2) - jumptable_start - jumptable .Init - jumptable .Joypad - jumptable .PrepSubmenu - jumptable BillsPC_Withdraw - jumptable BillsPC_EndJumptableLoop + + dw .Init + dw .Joypad + dw .PrepSubmenu + dw BillsPC_Withdraw + dw BillsPC_EndJumptableLoop .Init: ; e25dc (38:65dc) @@ -410,7 +410,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) and 3 ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -419,7 +419,7 @@ endr ld l, a jp [hl] -.jumptable: ; e2699 (38:6699) #mark +.dw: ; e2699 (38:6699) #mark dw .withdraw ; Withdraw dw .stats ; Stats dw .release ; Release @@ -562,14 +562,14 @@ _MovePKMNWithoutMail: ; e2759 ; e27ac .Jumptable: ; e27ac - jumptable_start - jumptable .Init - jumptable .Joypad - jumptable .PrepSubmenu - jumptable .MoveMonWOMailSubmenu - jumptable .PrepInsertCursor - jumptable .Joypad2 - jumptable BillsPC_EndJumptableLoop + + dw .Init + dw .Joypad + dw .PrepSubmenu + dw .MoveMonWOMailSubmenu + dw .PrepInsertCursor + dw .Joypad2 + dw BillsPC_EndJumptableLoop ; e27ba .Init: ; e27ba @@ -2016,12 +2016,12 @@ endr ld a, [hli] ld h, [hl] ld l, a - ld de, .jumptable_return + ld de, .dw_return push de jp [hl] ; e322a -.jumptable_return: ; e322a +.dw_return: ; e322a pop af ld e, a callba Function14ad5 @@ -2033,11 +2033,11 @@ endr ; e3245 .Jumptable: ; e3245 - jumptable_start - jumptable .BoxToBox - jumptable .PartyToBox - jumptable .BoxToParty - jumptable .PartyToParty + + dw .BoxToBox + dw .PartyToBox + dw .BoxToParty + dw .PartyToParty ; e324d .BoxToBox: ; e324d diff --git a/engine/card_flip.asm b/engine/card_flip.asm index fd55ff06b..9aeb94aec 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -81,15 +81,15 @@ endr ; e01a0 (38:41a0) .Jumptable: ; e01a0 - jumptable_start - jumptable .AskPlayWithThree - jumptable .DeductCoins - jumptable .ChooseACard - jumptable .PlaceYourBet - jumptable .CheckTheCard - jumptable .TabulateTheResult - jumptable .PlayAgain - jumptable .Quit + + dw .AskPlayWithThree + dw .DeductCoins + dw .ChooseACard + dw .PlaceYourBet + dw .CheckTheCard + dw .TabulateTheResult + dw .PlayAgain + dw .Quit ; e01b0 .Increment: ; e01b0 @@ -108,7 +108,7 @@ endr ret .SaidNo - ld a, 7 ; .QuitTableIndex + ld a, 7 ld [wJumptableIndex], a ret ; e01cd @@ -132,7 +132,7 @@ endr jr nc, .deduct ; You have at least 3 coins. ld hl, .NotEnoughCoinsText call CardFlip_UpdateCoinBalanceDisplay - ld a, 7 ; .QuitTableIndex + ld a, 7 ld [wJumptableIndex], a ret @@ -329,7 +329,7 @@ endr call CardFlip_BlankDiscardedCardSlot .LoopAround - ld a, 1 ; .DeductCoinsTableIndex + ld a, 1 ld [wJumptableIndex], a ret ; e0356 @@ -659,13 +659,13 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 ; e0553 .Jumptable: ; e0553 - jumptable_start - jumptable .Level1 - jumptable .Level2 - jumptable .Level3 - jumptable .Level4 - jumptable .Level5 - jumptable .Level6 + + dw .Level1 + dw .Level2 + dw .Level3 + dw .Level4 + dw .Level5 + dw .Level6 ; e055f .Level1: ; e055f @@ -848,62 +848,62 @@ CardFlip_CheckWinCondition: ; e0637 ; e0643 .Jumptable: ; e0643 - jumptable_start - jumptable .Impossible - jumptable .Impossible - jumptable .PikaJiggly - jumptable .PikaJiggly - jumptable .PoliOddish - jumptable .PoliOddish + + dw .Impossible + dw .Impossible + dw .PikaJiggly + dw .PikaJiggly + dw .PoliOddish + dw .PoliOddish - jumptable .Impossible - jumptable .Impossible - jumptable .Pikachu - jumptable .Jigglypuff - jumptable .Poliwag - jumptable .Oddish + dw .Impossible + dw .Impossible + dw .Pikachu + dw .Jigglypuff + dw .Poliwag + dw .Oddish - jumptable .OneTwo - jumptable .One - jumptable .PikaOne - jumptable .JigglyOne - jumptable .PoliOne - jumptable .OddOne + dw .OneTwo + dw .One + dw .PikaOne + dw .JigglyOne + dw .PoliOne + dw .OddOne - jumptable .OneTwo - jumptable .Two - jumptable .PikaTwo - jumptable .JigglyTwo - jumptable .PoliTwo - jumptable .OddTwo + dw .OneTwo + dw .Two + dw .PikaTwo + dw .JigglyTwo + dw .PoliTwo + dw .OddTwo - jumptable .ThreeFour - jumptable .Three - jumptable .PikaThree - jumptable .JigglyThree - jumptable .PoliThree - jumptable .OddThree + dw .ThreeFour + dw .Three + dw .PikaThree + dw .JigglyThree + dw .PoliThree + dw .OddThree - jumptable .ThreeFour - jumptable .Four - jumptable .PikaFour - jumptable .JigglyFour - jumptable .PoliFour - jumptable .OddFour + dw .ThreeFour + dw .Four + dw .PikaFour + dw .JigglyFour + dw .PoliFour + dw .OddFour - jumptable .FiveSix - jumptable .Five - jumptable .PikaFive - jumptable .JigglyFive - jumptable .PoliFive - jumptable .OddFive + dw .FiveSix + dw .Five + dw .PikaFive + dw .JigglyFive + dw .PoliFive + dw .OddFive - jumptable .FiveSix - jumptable .Six - jumptable .PikaSix - jumptable .JigglySix - jumptable .PoliSix - jumptable .OddSix + dw .FiveSix + dw .Six + dw .PikaSix + dw .JigglySix + dw .PoliSix + dw .OddSix ; e06a3 .Impossible: ; e06a3 diff --git a/engine/color.asm b/engine/color.asm index 1571bbb36..627063c82 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -367,9 +367,8 @@ ApplyHPBarPals: ; 8c43 .okay ld l, c ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld bc, Palettes_a8be add hl, bc ld bc, 4 @@ -405,9 +404,8 @@ LoadStatsScreenPals: ; 8c8a ld hl, StatsScreenPals ld b, 0 dec c -rept 2 add hl, bc -endr + add hl, bc ld a, [rSVBK] push af ld a, $5 @@ -441,9 +439,8 @@ endr ld bc, PALPACKET_LENGTH call CopyBytes pop hl -rept 2 inc hl -endr + inc hl ld a, [hli] ld [wSGBPals + 3], a ld a, [hli] @@ -818,9 +815,8 @@ GetFrontpicPalettePointer: ; 9764 GetTrainerPalettePointer: ; 976b ld l, a ld h, 0 -rept 2 add hl,hl -endr + add hl,hl ld bc, TrainerPalettes add hl, bc ret @@ -1152,9 +1148,8 @@ Function994a: ; 994a jr nz, .asm_99a6 ld a, $20 ld [rJOYP], a -rept 2 ld a, [rJOYP] -endr + ld a, [rJOYP] call SGBDelayCycles call SGBDelayCycles ld a, $30 @@ -1962,9 +1957,8 @@ LoadMapPals: ; b1de ld e, a ld d, 0 ld hl, .TilesetColorsPointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/credits.asm b/engine/credits.asm index 77080b8b4..fc5fb8818 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -183,7 +183,7 @@ Credits:: ; 109847 call ByteFill ld a, rSCX - $ff00 - ld [hLCDStatCustom], a + ld [hFFC6], a call GetCreditsPalette call SetPalettes @@ -211,7 +211,7 @@ Credits:: ; 109847 .exit_credits call ClearBGPalettes xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ld [hBGMapAddress], a pop af ld [hVBlank], a @@ -269,20 +269,20 @@ endr .Jumptable: ; 109937 (42:5937) - jumptable_start - jumptable ParseCredits - jumptable Credits_Next - jumptable Credits_Next - jumptable Credits_PrepBGMapUpdate - jumptable Credits_UpdateGFXRequestPath - jumptable Credits_RequestGFX - jumptable Credits_LYOverride - jumptable Credits_Next - jumptable Credits_Next - jumptable Credits_Next - jumptable Credits_UpdateGFXRequestPath - jumptable Credits_RequestGFX - jumptable Credits_LoopBack + + dw ParseCredits + dw Credits_Next + dw Credits_Next + dw Credits_PrepBGMapUpdate + dw Credits_UpdateGFXRequestPath + dw Credits_RequestGFX + dw Credits_LYOverride + dw Credits_Next + dw Credits_Next + dw Credits_Next + dw Credits_UpdateGFXRequestPath + dw Credits_RequestGFX + dw Credits_LoopBack Credits_Next: ; 109951 (42:5951) diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 3f238550d..df3b297a3 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -119,7 +119,7 @@ PlaceGameFreakPresents: ; e4670 ld a, [wJumptableIndex] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -129,7 +129,7 @@ endr jp [hl] ; e467f -.jumptable: ; e467f +.dw: ; e467f dw PlaceGameFreakPresents_0 dw PlaceGameFreakPresents_1 dw PlaceGameFreakPresents_2 @@ -625,7 +625,7 @@ IntroScene5: ; e4a7a (39:4a7a) call ClearTileMap xor a ld [hBGMapMode], a - ld [hLCDStatCustom], a + ld [hFFC6], a ld a, $1 ld [rVBK], a ld hl, IntroTilemap005 @@ -819,7 +819,7 @@ IntroScene8: ; e4bd3 (39:4bd3) IntroScene9: ; e4c04 (39:4c04) ; Set up the next scene (same bg). xor a - ld [hLCDStatCustom], a + ld [hFFC6], a call ClearSprites hlcoord 0, 0, AttrMap ; first 12 rows have palette 1 @@ -893,7 +893,7 @@ IntroScene11: ; e4c86 (39:4c86) call ClearTileMap xor a ld [hBGMapMode], a - ld [hLCDStatCustom], a + ld [hFFC6], a ld a, $1 ld [rVBK], a ld hl, IntroTilemap007 @@ -2103,7 +2103,7 @@ Intro_ResetLYOverrides: ; e5516 (39:5516) pop af ld [rSVBK], a ld a, $43 - ld [hLCDStatCustom], a + ld [hFFC6], a ret Intro_PerspectiveScrollBG: ; e552f (39:552f) diff --git a/engine/debug.asm b/engine/debug.asm index 10e446b75..df5dbee56 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -1355,7 +1355,7 @@ Function822f0: ; 822f0 and 3 ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -1365,7 +1365,7 @@ endr jp [hl] ; 82301 -.jumptable: ; 82301 +.dw: ; 82301 dw Function82309 dw Function82339 dw Function8234b diff --git a/engine/decorations.asm b/engine/decorations.asm index 22b6272a7..7ab4c65c9 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -104,7 +104,7 @@ _KrisDecorationMenu: ; 0x2675c ret .FindOwndDecos: ; 2683a (9:683a) - ld hl, .jumptable + ld hl, .dw .loop ld a, [hli] ld e, a @@ -127,7 +127,7 @@ _KrisDecorationMenu: ; 0x2675c ret ; 26855 (9:6855) -.jumptable: ; 26855 +.dw: ; 26855 dwb FindOwnedBeds, 0 ; bed dwb FindOwnedCarpets, 1 ; carpet dwb FindOwnedPlants, 2 ; plant diff --git a/engine/engine_flags.asm b/engine/engine_flags.asm index ff521bc4b..d8be9c494 100644 --- a/engine/engine_flags.asm +++ b/engine/engine_flags.asm @@ -37,9 +37,8 @@ EngineFlagAction:: ; 80430 .read ld hl, EngineFlags ; location -rept 2 add hl, de -endr + add hl, de ; bit add hl, de diff --git a/engine/events.asm b/engine/events.asm index fcab94ef3..0d708cdde 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -771,9 +771,8 @@ TryReadSign: ; 96a38 push hl call PlayTalkObject pop hl -rept 2 inc hl -endr + inc hl call GetMapScriptHeaderBank call GetFarHalfword call GetMapScriptHeaderBank diff --git a/engine/events_2.asm b/engine/events_2.asm index eaabef9aa..9d2763ac8 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -514,7 +514,7 @@ CmdQueue_Null2: ; 97eb8 CmdQueue_Type4: ; 97ebc call CmdQueueAnonymousJumptable - ; anonymous jumptable + ; anonymous dw dw .zero dw .one ; 97ec3 @@ -560,7 +560,7 @@ CmdQueue_Type4: ; 97ebc CmdQueue_Type3: ; 97ef9 call CmdQueueAnonymousJumptable - ; anonymous jumptable + ; anonymous dw dw .zero dw .one dw .two diff --git a/engine/events_3.asm b/engine/events_3.asm index 686a794b7..57554d3f1 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -55,7 +55,7 @@ ReturnFromMapSetupScript:: ; b8000 ld [rWY], a ld [hWY], a xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ret ; b8064 @@ -126,7 +126,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098) ld [rWY], a ld [hWY], a xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ret diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 9081c1461..46c573483 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1041,7 +1041,7 @@ StartTitleScreen: ; 6219 call ClearScreen call WaitBGMap2 xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ld [hSCX], a ld [hSCY], a ld a, $7 @@ -1058,17 +1058,16 @@ StartTitleScreen: ; 6219 .ok ld e, a ld d, 0 - ld hl, .jumptable -rept 2 + ld hl, .dw + add hl, de add hl, de -endr ld a, [hli] ld h, [hl] ld l, a jp [hl] ; 626a -.jumptable +.dw dw _MainMenu dw DeleteSaveData dw CrystalIntroSequence @@ -1113,9 +1112,8 @@ TitleScreenScene: ; 62a3 ld e, a ld d, 0 ld hl, .scenes -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1174,7 +1172,7 @@ TitleScreenEntrance: ; 62bc ld hl, wJumptableIndex inc [hl] xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ; Play the title screen music. ld de, MUSIC_TITLE @@ -1343,22 +1341,19 @@ Function639b: ; unreferenced add hl, bc ; over-the-top compicated way to load wc3ae into hl ld l, [hl] ld h, 0 -rept 2 add hl, hl -endr + add hl, hl ld de, Data63ca add hl, de ; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw ld a, [wcf65] and %00000100 -rept 2 srl a -endr + srl a ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] and a ret z diff --git a/engine/main_menu.asm b/engine/main_menu.asm index 8d56d9fe0..637253c12 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -54,13 +54,13 @@ MainMenu: ; 49cdc db "MOBILE STUDIUM@" .Jumptable: ; 0x49d60 - jumptable_start - jumptable MainMenu_Continue - jumptable MainMenu_NewGame - jumptable MainMenu_Options - jumptable MainMenu_MysteryGift - jumptable MainMenu_Mobile - jumptable MainMenu_MobileStudium + + dw MainMenu_Continue + dw MainMenu_NewGame + dw MainMenu_Options + dw MainMenu_MysteryGift + dw MainMenu_Mobile + dw MainMenu_MobileStudium ; 0x49d6c CONTINUE EQU 0 diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 21e601cdf..cd272bdc9 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -233,9 +233,8 @@ Function444d: ; 444d ld a, [hl] ld l, a ld h, 0 -rept 2 add hl,hl -endr + add hl,hl add hl, de ld a, [hli] ld h, [hl] @@ -676,9 +675,8 @@ InitStep: ; 4690 add hl, bc bit FIXED_FACING, [hl] jr nz, GetNextTile -rept 2 add a -endr + add a and %00001100 ld hl, OBJECT_FACING add hl, bc @@ -746,9 +744,8 @@ GetStepVector: ; 46e9 add hl, bc ld a, [hl] and %00001111 -rept 2 add a -endr + add a ld l, a ld h, 0 ld de, StepVectors @@ -888,7 +885,7 @@ IncrementObjectStructField28: ; 47a2 ; 47a8 Object28AnonymousJumptable: ; 47a8 -; anonymous jumptable +; anonymous dw ld hl, OBJECT_28 add hl, bc ld a, [hl] @@ -942,35 +939,35 @@ MapObjectMovementPattern: ; 47dd ; 47e9 .Pointers ; 47e9 - jumptable_start - jumptable .Null_00 ; 00 - jumptable .RandomWalkY ; 01 - jumptable .RandomWalkX ; 02 - jumptable .RandomWalkXY ; 03 - jumptable .RandomSpin1 ; 04 - jumptable .RandomSpin2 ; 05 - jumptable .Standing ; 06 - jumptable .ObeyDPad ; 07 - jumptable .Movement08 ; 08 - jumptable .Movement09 ; 09 - jumptable .Movement0a ; 0a - jumptable .Movement0b ; 0b - jumptable .Movement0c ; 0c - jumptable .Movement0d ; 0d - jumptable .Movement0e ; 0e - jumptable .Follow ; 0f - jumptable .Script ; 10 - jumptable .Strength ; 11 - jumptable .FollowNotExact ; 12 - jumptable .MovementShadow ; 13 - jumptable .MovementEmote ; 14 - jumptable .MovementBigStanding ; 15 - jumptable .MovementBouncing ; 16 - jumptable .MovementScreenShake ; 17 - jumptable .MovementSpinClockwise ; 18 - jumptable .MovementSpinCounterclockwise ; 19 - jumptable .MovementBoulderDust ; 1a - jumptable .MovementShakingGrass ; 1b + + dw .Null_00 ; 00 + dw .RandomWalkY ; 01 + dw .RandomWalkX ; 02 + dw .RandomWalkXY ; 03 + dw .RandomSpin1 ; 04 + dw .RandomSpin2 ; 05 + dw .Standing ; 06 + dw .ObeyDPad ; 07 + dw .Movement08 ; 08 + dw .Movement09 ; 09 + dw .Movement0a ; 0a + dw .Movement0b ; 0b + dw .Movement0c ; 0c + dw .Movement0d ; 0d + dw .Movement0e ; 0e + dw .Follow ; 0f + dw .Script ; 10 + dw .Strength ; 11 + dw .FollowNotExact ; 12 + dw .MovementShadow ; 13 + dw .MovementEmote ; 14 + dw .MovementBigStanding ; 15 + dw .MovementBouncing ; 16 + dw .MovementScreenShake ; 17 + dw .MovementSpinClockwise ; 18 + dw .MovementSpinCounterclockwise ; 19 + dw .MovementBoulderDust ; 1a + dw .MovementShakingGrass ; 1b ; 4821 .Null_00: ; 4821 @@ -1390,9 +1387,8 @@ MapObjectMovementPattern: ; 47dd ld e, a ld d, 0 ld hl, .data_4a81 -rept 2 add hl,de -endr + add hl,de ld d, [hl] inc hl ld e, [hl] @@ -1549,33 +1545,33 @@ SetRandomStepDuration: ; 4b2d Pointers4b45: ; 4b45 ; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm - jumptable_start - jumptable ObjectMovementReset ; 00 - jumptable MapObjectMovementPattern ; 01 - jumptable NPCStep ; 02 npc walk - jumptable Function4ddd ; 03 - jumptable Function4e21 ; 04 - jumptable Function4e0c ; 05 - jumptable PlayerStep ; 06 player walk - jumptable Function4e47 ; 07 - jumptable NPCJump ; 08 npc jump step - jumptable PlayerJump ; 09 player jump step - jumptable PlayerOrNPCHalfStep ; 0a half step - jumptable Function4dff ; 0b - jumptable TeleportFrom ; 0c teleport from - jumptable TeleportTo ; 0d teleport to - jumptable Skyfall ; 0e skyfall - jumptable Function4ecd ; 0f - jumptable GotBiteStep ; 10 - jumptable RockSmashStep ; 11 - jumptable ReturnDigStep ; 12 - jumptable Function4f04 ; 13 - jumptable Function4f33 ; 14 - jumptable Function4f33 ; 15 - jumptable Function4f77 ; 16 - jumptable Function4f7a ; 17 - jumptable Function4df0 ; 18 - jumptable SkyfallTop ; 19 + + dw ObjectMovementReset ; 00 + dw MapObjectMovementPattern ; 01 + dw NPCStep ; 02 npc walk + dw Function4ddd ; 03 + dw Function4e21 ; 04 + dw Function4e0c ; 05 + dw PlayerStep ; 06 player walk + dw Function4e47 ; 07 + dw NPCJump ; 08 npc jump step + dw PlayerJump ; 09 player jump step + dw PlayerOrNPCHalfStep ; 0a half step + dw Function4dff ; 0b + dw TeleportFrom ; 0c teleport from + dw TeleportTo ; 0d teleport to + dw Skyfall ; 0e skyfall + dw Function4ecd ; 0f + dw GotBiteStep ; 10 + dw RockSmashStep ; 11 + dw ReturnDigStep ; 12 + dw Function4f04 ; 13 + dw Function4f33 ; 14 + dw Function4f33 ; 15 + dw Function4f77 ; 16 + dw Function4f7a ; 17 + dw Function4df0 ; 18 + dw SkyfallTop ; 19 ; 4b79 Function4b79: ; 4b79 @@ -1591,7 +1587,7 @@ Function4b79: ; 4b79 NPCJump: ; 4b86 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4b8d dw Function4ba9 ; 4b8d @@ -1628,7 +1624,7 @@ Function4ba9: ; 4ba9 PlayerJump: ; 4bbf call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw .initjump dw .stepjump dw .initland @@ -1680,7 +1676,7 @@ PlayerJump: ; 4bbf TeleportFrom: ; 4c18 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4c23 dw Function4c32 dw Function4c42 @@ -1751,7 +1747,7 @@ Function4c5d: ; 4c5d TeleportTo: ; 4c89 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4c9a dw Function4caa dw Function4cb3 @@ -1843,7 +1839,7 @@ Function4d01: ; 4d01 Skyfall: ; 4d14 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4d1f dw Function4d2e dw Function4d4f @@ -1908,7 +1904,7 @@ Function4d6b: ; 4d6b GotBiteStep: ; 4d7e call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4d85 dw Function4d94 ; 4d85 @@ -2015,7 +2011,7 @@ Function4dff: ; 4dff Function4e0c: ; 4e0c call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4e13 dw Function4e21 ; 4e13 @@ -2065,7 +2061,7 @@ Function4e47: ; 4e47 PlayerStep: ; 4e56 ; AnimateStep? call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw .init dw .step ; 4e5d @@ -2095,7 +2091,7 @@ PlayerStep: ; 4e56 PlayerOrNPCHalfStep: ; 4e83 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw .init1 dw .step1 dw .init2 @@ -2211,7 +2207,7 @@ Function4f04: ; 4f04 Function4f33: ; 4f33 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4f3a dw Function4f43 ; 4f3a @@ -2266,7 +2262,7 @@ Function4f77: ; 4f77 Function4f7a: ; 4f7a call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw SkyfallTop dw SkyfallTop dw SkyfallTop @@ -2274,7 +2270,7 @@ Function4f7a: ; 4f7a SkyfallTop: ; 4f83 call Object28AnonymousJumptable -; anonymous jumptable +; anonymous dw dw Function4f8a dw Function4f99 ; 4f8a @@ -3060,9 +3056,8 @@ SpawnInCustomFacing: ; 57ca ret z ld a, [wPlayerSpriteSetupFlags] and 3 -rept 2 add a -endr + add a jr ContinueSpawnFacing ; 57d9 @@ -3650,9 +3645,8 @@ PRIORITY_HIGH EQU $30 ld c, a ld b, 0 ld hl, .Addresses -rept 2 add hl,bc -endr + add hl,bc ld c, [hl] inc hl ld b, [hl] diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 8f7b0e333..c2900665f 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -6,9 +6,8 @@ RunMapSetupScript:: ; 15363 ld c, a ld b, 0 ld hl, MapSetupScripts -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a diff --git a/engine/mart.asm b/engine/mart.asm index b4e655573..143ba38cd 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -841,12 +841,12 @@ SellMenu: ; 15eb3 .TryToSellItem: ; 15ee0 callba CheckItemMenu ld a, [wItemAttributeParamBuffer] - ld hl, .jumptable + ld hl, .dw rst JumpTable ret ; 15eee -.jumptable: ; 15eee +.dw: ; 15eee dw .try_sell dw .cant_buy dw .cant_buy diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index 8d998408c..ea3614ae5 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -27,7 +27,7 @@ Function8e83f: ; 8e83f Function8e849: ; 8e849 ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -38,7 +38,7 @@ endr ; 8e854 -.jumptable: ; 8e854 (23:6854) +.dw: ; 8e854 (23:6854) dw Function8e8d5 ; init dw Function8e961 dw Function8e97d diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 43fe9dbb3..e9a50ad4d 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -193,9 +193,8 @@ endr inc de push hl push de -rept 2 inc hl -endr + inc hl call FillPP pop de pop hl @@ -636,9 +635,8 @@ SentGetPkmnIntoFromBox: ; db3f ld a, [CurPartySpecies] cp EGG jr z, .egg -rept 2 inc hl -endr + inc hl ld a, [hli] ld [de], a ld a, [hl] @@ -1423,9 +1421,8 @@ CalcPkmnStatC: ; e17b ld a, c cp STAT_SDEF jr nz, .not_spdef -rept 2 dec hl -endr + dec hl .not_spdef sla c @@ -1469,9 +1466,8 @@ endr ld b, a ld a, [hli] and $1 -rept 2 add a -endr + add a add b ld b, a ld a, [hl] @@ -1673,9 +1669,8 @@ GivePoke:: ; e277 ld a, [ScriptBank] call FarCopyBytes pop hl -rept 2 inc hl -endr + inc hl ld a, [ScriptBank] call GetFarHalfword pop bc diff --git a/engine/mysterygift.asm b/engine/mysterygift.asm index 68c13ea2f..0360bc74f 100755 --- a/engine/mysterygift.asm +++ b/engine/mysterygift.asm @@ -211,9 +211,8 @@ DoMysteryGift: ; 1048ba (41:48ba) ld hl, sDailyMysteryGiftPartnerIDs ; inc hl ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [wMysteryGiftPartnerID] ld [hli], a ld a, [wMysteryGiftPartnerID + 1] @@ -1062,9 +1061,8 @@ Function105033: ; 105033 (41:5033) Function105038: ; 105038 (41:5038) ld a, $20 ld [rJOYP], a -rept 2 ld a, [rJOYP] -endr + ld a, [rJOYP] cpl and $f swap a diff --git a/engine/pack.asm b/engine/pack.asm index 17ace5959..8d1b63232 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -28,18 +28,18 @@ Pack: ; 10000 ; 10030 .Jumptable: ; 10030 (4:4030) - jumptable_start - jumptable .InitGFX ; 0 - jumptable .InitItemsPocket ; 1 - jumptable .ItemsPocketMenu ; 2 - jumptable .InitBallsPocket ; 3 - jumptable .BallsPocketMenu ; 4 - jumptable .InitKeyItemsPocket ; 5 - jumptable .KeyItemsPocketMenu ; 6 - jumptable .InitTMHMPocket ; 7 - jumptable .TMHMPocketMenu ; 8 - jumptable Pack_QuitNoScript ; 9 - jumptable Pack_QuitRunScript ; 10 + + dw .InitGFX ; 0 + dw .InitItemsPocket ; 1 + dw .ItemsPocketMenu ; 2 + dw .InitBallsPocket ; 3 + dw .BallsPocketMenu ; 4 + dw .InitKeyItemsPocket ; 5 + dw .KeyItemsPocketMenu ; 6 + dw .InitTMHMPocket ; 7 + dw .TMHMPocketMenu ; 8 + dw Pack_QuitNoScript ; 9 + dw Pack_QuitRunScript ; 10 .InitGFX: ; 10046 (4:4046) xor a @@ -163,9 +163,9 @@ Pack: ; 10000 ; 0x10137 .Jumptable1: ; 10137 - jumptable_start - jumptable .UseItem - jumptable QuitItemSubmenu + + dw .UseItem + dw QuitItemSubmenu ; 1013b @@ -328,12 +328,12 @@ MenuDataHeader_UsableKeyItem: ; 0x10249 ; 0x1026a Jumptable_UseGiveTossRegisterQuit: ; 1026a - jumptable_start - jumptable UseItem - jumptable GiveItem - jumptable TossMenu - jumptable RegisterItem - jumptable QuitItemSubmenu + + dw UseItem + dw GiveItem + dw TossMenu + dw RegisterItem + dw QuitItemSubmenu ; 10274 MenuDataHeader_UsableItem: ; 0x10274 @@ -354,11 +354,11 @@ MenuDataHeader_UsableItem: ; 0x10274 ; 0x10291 Jumptable_UseGiveTossQuit: ; 10291 - jumptable_start - jumptable UseItem - jumptable GiveItem - jumptable TossMenu - jumptable QuitItemSubmenu + + dw UseItem + dw GiveItem + dw TossMenu + dw QuitItemSubmenu ; 10299 MenuDataHeader_UnusableItem: ; 0x10299 @@ -377,9 +377,9 @@ MenuDataHeader_UnusableItem: ; 0x10299 ; 0x102ac Jumptable_UseQuit: ; 102ac - jumptable_start - jumptable UseItem - jumptable QuitItemSubmenu + + dw UseItem + dw QuitItemSubmenu ; 102b0 MenuDataHeader_UnusableKeyItem: ; 0x102b0 @@ -399,10 +399,10 @@ MenuDataHeader_UnusableKeyItem: ; 0x102b0 ; 0x102c7 Jumptable_UseRegisterQuit: ; 102c7 - jumptable_start - jumptable UseItem - jumptable RegisterItem - jumptable QuitItemSubmenu + + dw UseItem + dw RegisterItem + dw QuitItemSubmenu ; 102cd MenuDataHeader_HoldableKeyItem: ; 0x102cd @@ -423,11 +423,11 @@ MenuDataHeader_HoldableKeyItem: ; 0x102cd ; 0x102ea Jumptable_GiveTossRegisterQuit: ; 102ea - jumptable_start - jumptable GiveItem - jumptable TossMenu - jumptable RegisterItem - jumptable QuitItemSubmenu + + dw GiveItem + dw TossMenu + dw RegisterItem + dw QuitItemSubmenu ; 102f2 MenuDataHeader_HoldableItem: ; 0x102f2 @@ -447,30 +447,30 @@ MenuDataHeader_HoldableItem: ; 0x102f2 ; 0x1030b Jumptable_GiveTossQuit: ; 1030b - jumptable_start - jumptable GiveItem - jumptable TossMenu - jumptable QuitItemSubmenu + + dw GiveItem + dw TossMenu + dw QuitItemSubmenu ; 10311 UseItem: ; 10311 callba CheckItemMenu ld a, [wItemAttributeParamBuffer] - ld hl, .jumptable + ld hl, .dw rst JumpTable ret ; 1031f -.jumptable: ; 1031f (4:431f) - jumptable_start - jumptable .Oak - jumptable .Oak - jumptable .Oak - jumptable .Oak - jumptable .Current - jumptable .Party - jumptable .Field +.dw: ; 1031f (4:431f) + + dw .Oak + dw .Oak + dw .Oak + dw .Oak + dw .Current + dw .Party + dw .Field ; 1035c .Oak: ; 1032d (4:432d) @@ -694,18 +694,18 @@ BattlePack: ; 10493 ; 104c3 .Jumptable: ; 104c3 (4:44c3) - jumptable_start - jumptable .InitGFX ; 0 - jumptable .InitItemsPocket ; 1 - jumptable .ItemsPocketMenu ; 2 - jumptable .InitBallsPocket ; 3 - jumptable .BallsPocketMenu ; 4 - jumptable .InitKeyItemsPocket ; 5 - jumptable .KeyItemsPocketMenu ; 6 - jumptable .InitTMHMPocket ; 7 - jumptable .TMHMPocketMenu ; 8 - jumptable Pack_QuitNoScript ; 9 - jumptable Pack_QuitRunScript ; 10 + + dw .InitGFX ; 0 + dw .InitItemsPocket ; 1 + dw .ItemsPocketMenu ; 2 + dw .InitBallsPocket ; 3 + dw .BallsPocketMenu ; 4 + dw .InitKeyItemsPocket ; 5 + dw .KeyItemsPocketMenu ; 6 + dw .InitTMHMPocket ; 7 + dw .TMHMPocketMenu ; 8 + dw Pack_QuitNoScript ; 9 + dw Pack_QuitRunScript ; 10 .InitGFX: ; 104d9 (4:44d9) xor a @@ -865,9 +865,9 @@ TMHMSubmenu: ; 105dc (4:45dc) ; 0x10614 .UsableJumptable: ; 10614 - jumptable_start - jumptable .Use - jumptable .Quit + + dw .Use + dw .Quit ; 10618 .UnusableMenuDataHeader: ; 0x10618 @@ -885,8 +885,8 @@ TMHMSubmenu: ; 105dc (4:45dc) ; 0x10627 .UnusableJumptable: ; 10627 - jumptable_start - jumptable .Quit + + dw .Quit ; 10629 .Use: ; 10629 @@ -897,14 +897,14 @@ TMHMSubmenu: ; 105dc (4:45dc) ret .ItemFunctionJumptable: ; 10637 (4:4637) - jumptable_start - jumptable .Oak - jumptable .Oak - jumptable .Oak - jumptable .Oak - jumptable .Unused - jumptable .BattleField - jumptable .BattleOnly + + dw .Oak + dw .Oak + dw .Oak + dw .Oak + dw .Unused + dw .BattleField + dw .BattleOnly .Oak: ; 10645 (4:4645) ld hl, Text_ThisIsntTheTime @@ -942,7 +942,7 @@ TMHMSubmenu: ; 105dc (4:45dc) cp $2 jr z, .didnt_use_item .quit_run_script: ; 1067e (4:467e) - ld a, Pack_QuitRunScriptTableIndex + ld a, 10 ld [wJumptableIndex], a ret @@ -1002,11 +1002,11 @@ DepositSellPack: ; 106be ; 106d1 .Jumptable: ; 106d1 (4:46d1) - jumptable_start - jumptable .ItemsPocket - jumptable .BallsPocket - jumptable .KeyItemsPocket - jumptable .TMHMPocket + + dw .ItemsPocket + dw .BallsPocket + dw .KeyItemsPocket + dw .TMHMPocket .ItemsPocket: ; 106d9 (4:46d9) xor a call InitPocket @@ -1142,18 +1142,18 @@ TutorialPack: ; 107bb .RunJumptable: ; 107d7 ld a, [wJumptableIndex] - ld hl, .jumptable + ld hl, .dw call Pack_GetJumptablePointer jp [hl] ; 107e1 -.jumptable: ; 107e1 (4:47e1) - jumptable_start - jumptable .Items - jumptable .Balls - jumptable .KeyItems - jumptable .TMHM +.dw: ; 107e1 (4:47e1) + + dw .Items + dw .Balls + dw .KeyItems + dw .TMHM .Items: ; 107e9 (4:47e9) xor a @@ -1351,7 +1351,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) ret .b_button - ld a, Pack_QuitNoScriptTableIndex + ld a, 9 ld [wJumptableIndex], a scf ret diff --git a/engine/player_step.asm b/engine/player_step.asm index 2a789d1cb..d0ae42451 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -59,19 +59,19 @@ HandlePlayerStep: ; d4e5 (3:54e5) ret .Jumptable: ; d4f2 (3:54f2) - jumptable_start - jumptable GetMovementPermissions - jumptable BufferScreen - jumptable .mobile - jumptable .fail2 + + dw GetMovementPermissions + dw BufferScreen + dw .mobile + dw .fail2 ; The rest are never used. Ever. - jumptable .fail1 - jumptable .fail1 - jumptable .fail1 - jumptable .fail1 - jumptable .fail1 - jumptable .fail1 - jumptable .fail1 + dw .fail1 + dw .fail1 + dw .fail1 + dw .fail1 + dw .fail1 + dw .fail1 + dw .fail1 .fail1: ; d508 (3:5508) ret diff --git a/engine/pokecenter_pc.asm b/engine/pokecenter_pc.asm index 431ad8a43..a75798709 100755 --- a/engine/pokecenter_pc.asm +++ b/engine/pokecenter_pc.asm @@ -472,14 +472,14 @@ Function158cc: ; 0x158cc ld [wSpriteUpdatesEnabled], a callba CheckItemMenu ld a, [wItemAttributeParamBuffer] - ld hl, .jumptable + ld hl, .dw rst JumpTable pop af ld [wSpriteUpdatesEnabled], a ret ; 0x158e7 -.jumptable: ; 0x158e7 +.dw: ; 0x158e7 dw .tossable dw .no_toss dw .no_toss diff --git a/engine/printer.asm b/engine/printer.asm index 53eefc1aa..ae1edd9d2 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -32,27 +32,27 @@ endr .Jumptable: ; 84031 (21:4031) - jumptable_start - jumptable Function84077 - jumptable Function84143 - jumptable Function84120 - jumptable Function84099 - jumptable Function84180 - jumptable Function8412e - jumptable Function840c5 - jumptable Function84180 - jumptable Function84120 - jumptable Function840de - jumptable Function84180 - jumptable Function84120 - jumptable Function841a1 - jumptable Function84063 - jumptable Function8406d - jumptable Function84120 - jumptable Function84103 - jumptable Function84071 - jumptable Function841b0 - jumptable Function841b3 + + dw Function84077 + dw Function84143 + dw Function84120 + dw Function84099 + dw Function84180 + dw Function8412e + dw Function840c5 + dw Function84180 + dw Function84120 + dw Function840de + dw Function84180 + dw Function84120 + dw Function841a1 + dw Function84063 + dw Function8406d + dw Function84120 + dw Function84103 + dw Function84071 + dw Function841b0 + dw Function841b3 Function84059: ; 84059 (21:4059) @@ -443,39 +443,39 @@ _PrinterReceive:: ; 842db .Jumptable: ; 842ea (21:42ea) - jumptable_start - jumptable Function8432f - jumptable Function84330 - jumptable Function84339 - jumptable Function84343 - jumptable Function8434d - jumptable Function84357 - jumptable Function84361 - jumptable Function8438b - jumptable Function84395 - jumptable Function8439f - jumptable Function843a8 - jumptable Function843b6 - jumptable Function84330 - jumptable Function843c0 - jumptable Function843c9 - jumptable Function843c9 - jumptable Function843c9 - jumptable Function843c0 - jumptable Function843c9 - jumptable Function8439f - jumptable Function843a8 - jumptable Function843e6 - jumptable Function84330 - jumptable Function843d2 - jumptable Function843c9 - jumptable Function843c9 - jumptable Function843c9 - jumptable Function843d2 - jumptable Function843c9 - jumptable Function8439f - jumptable Function843a8 - jumptable Function843b6 + + dw Function8432f + dw Function84330 + dw Function84339 + dw Function84343 + dw Function8434d + dw Function84357 + dw Function84361 + dw Function8438b + dw Function84395 + dw Function8439f + dw Function843a8 + dw Function843b6 + dw Function84330 + dw Function843c0 + dw Function843c9 + dw Function843c9 + dw Function843c9 + dw Function843c0 + dw Function843c9 + dw Function8439f + dw Function843a8 + dw Function843e6 + dw Function84330 + dw Function843d2 + dw Function843c9 + dw Function843c9 + dw Function843c9 + dw Function843d2 + dw Function843c9 + dw Function8439f + dw Function843a8 + dw Function843b6 Function8432a: ; 8432a (21:432a) diff --git a/engine/scripting.asm b/engine/scripting.asm index de6644fbe..1111b0872 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -862,9 +862,8 @@ Script_trainertext: ; 9710f ld c, a ld b, 0 ld hl, WalkingX -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -1127,9 +1126,8 @@ Script_faceplayer: ; 9722e ld e, a callba GetRelativeFacing ld a, d -rept 2 add a -endr + add a ld e, a ld a, [hLastTalked] ld d, a @@ -1162,9 +1160,8 @@ Script_faceperson: ; 97248 pop bc ret c ld a, d -rept 2 add a -endr + add a ld e, a ld d, c call ApplyPersonFacing @@ -1185,9 +1182,8 @@ Script_spriteface: ; 97274 .ok ld d, a call GetScriptByte -rept 2 add a -endr + add a ld e, a call ApplyPersonFacing ret diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 0bb2cb53c..6ca93fab6 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -211,42 +211,28 @@ endr ; 92844 SlotsJumptable: ; 92844 (24:6844) - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wJumptableIndex -; 92853 (24:6853) - - -.Jumptable: ; 92853 (24:6853) - jumptable_start - jumptable Slots_Init ; 00 - jumptable Slots_BetAndStart ; 01 - jumptable Slots_WaitStart ; 02 - jumptable Slots_WaitReel1 ; 03 - jumptable Slots_WaitStopReel1 ; 04 - jumptable Slots_WaitReel2 ; 05 - jumptable Slots_WaitStopReel2 ; 06 - jumptable Slots_WaitReel3 ; 07 - jumptable Slots_WaitStopReel3 ; 08 - jumptable Slots_Next ; 09 - jumptable Slots_Next ; 0a - jumptable Slots_Next ; 0b - jumptable Slots_FlashIfWin ; 0c - jumptable Slots_FlashScreen ; 0d - jumptable Slots_GiveEarnedCoins ; 0e - jumptable Slots_PayoutTextAndAnim ; 0f - jumptable Slots_PayoutAnim ; 10 - jumptable Slots_RestartOrQuit ; 11 - jumptable Slots_Quit ; 12 +.Jumptable + dw Slots_Init ; 00 + dw Slots_BetAndStart ; 01 + dw Slots_WaitStart ; 02 + dw Slots_WaitReel1 ; 03 + dw Slots_WaitStopReel1 ; 04 + dw Slots_WaitReel2 ; 05 + dw Slots_WaitStopReel2 ; 06 + dw Slots_WaitReel3 ; 07 + dw Slots_WaitStopReel3 ; 08 + dw Slots_Next ; 09 + dw Slots_Next ; 0a + dw Slots_Next ; 0b + dw Slots_FlashIfWin ; 0c + dw Slots_FlashScreen ; 0d + dw Slots_GiveEarnedCoins ; 0e + dw Slots_PayoutTextAndAnim ; 0f + dw Slots_PayoutAnim ; 10 + dw Slots_RestartOrQuit ; 11 + dw Slots_Quit ; 12 Slots_Next: ; 92879 (24:6879) ld hl, wJumptableIndex @@ -265,7 +251,7 @@ Slots_Init: ; 9287e (24:687e) Slots_BetAndStart: ; 9288e (24:688e) call Slots_AskBet jr nc, .proceed - ld a, Slots_QuitTableIndex + ld a, 18 ld [wJumptableIndex], a ret @@ -275,7 +261,7 @@ Slots_BetAndStart: ; 9288e (24:688e) call Slots_InitBias ld a, 32 ld [wcf64], a - ld a, 4 ; ReelAction_NormalRateTableIndex + ld a, 4 ld [wReel1ReelAction], a ld [wReel2ReelAction], a ld [wReel3ReelAction], a @@ -455,12 +441,12 @@ Slots_RestartOrQuit: ; 929d9 (24:69d9) call WaitPressAorB_BlinkCursor call Slots_AskPlayAgain jr c, .exit_slots - ld a, Slots_InitTableIndex + ld a, 0 ld [wJumptableIndex], a ret .exit_slots - ld a, Slots_QuitTableIndex + ld a, 18 ld [wJumptableIndex], a ret @@ -804,10 +790,9 @@ Function92bd4: ; 92bd4 (24:6bd4) add hl, bc ld e, [hl] ld d, 0 - ld hl, .jumptable -rept 2 + ld hl, .dw + add hl, de add hl, de -endr ld a, [hli] ld h, [hl] ld l, a @@ -815,40 +800,33 @@ endr ; 92be4 (24:6be4) -.jumptable: ; 92be4 - jumptable_start - jumptable ReelAction_DoNothing ; 00 - jumptable Slots_StopReelIgnoreJoypad ; 01 - - jumptable ReelAction_QuadrupleRate ; 02 - jumptable ReelAction_DoubleRate ; 03 - jumptable ReelAction_NormalRate ; 04 - jumptable ReelAction_HalfRate ; 05 - jumptable ReelAction_QuarterRate ; 06 - - jumptable ReelAction_StopReel1 ; 07 - jumptable ReelAction_StopReel2 ; 08 - jumptable ReelAction_StopReel3 ; 09 - - jumptable ReelAction_SetUpReel2SkipTo7 ; 0a - jumptable ReelAction_WaitReel2SkipTo7 ; 0b - jumptable ReelAction_FastSpinReel2UntilLinedUp7s ; 0c - - jumptable ReelAction_BoringReelDrops ; 0d - jumptable ReelAction_CheckDropReel ; 0e - jumptable ReelAction_WaitDropReel ; 0f - - jumptable ReelAction_StartSlowAdvanceReel3 ; 10 - jumptable ReelAction_WaitSlowAdvanceReel3 ; 11 - - jumptable ReelAction_InitGolem ; 12 - jumptable ReelAction_WaitGolem ; 13 - jumptable ReelAction_EndGolem ; 14 - - jumptable Slots_InitChansey ; 15 - jumptable ReelAction_WaitChansey ; 16 - jumptable ReelAction_WaitEgg ; 17 - jumptable ReelAction_DropReel ; 18 +.dw: ; 92be4 + + dw ReelAction_DoNothing ; 00 + dw Slots_StopReelIgnoreJoypad ; 01 + dw ReelAction_QuadrupleRate ; 02 + dw ReelAction_DoubleRate ; 03 + dw ReelAction_NormalRate ; 04 + dw ReelAction_HalfRate ; 05 + dw ReelAction_QuarterRate ; 06 + dw ReelAction_StopReel1 ; 07 + dw ReelAction_StopReel2 ; 08 + dw ReelAction_StopReel3 ; 09 + dw ReelAction_SetUpReel2SkipTo7 ; 0a + dw ReelAction_WaitReel2SkipTo7 ; 0b + dw ReelAction_FastSpinReel2UntilLinedUp7s ; 0c + dw ReelAction_BoringReelDrops ; 0d + dw ReelAction_CheckDropReel ; 0e + dw ReelAction_WaitDropReel ; 0f + dw ReelAction_StartSlowAdvanceReel3 ; 10 + dw ReelAction_WaitSlowAdvanceReel3 ; 11 + dw ReelAction_InitGolem ; 12 + dw ReelAction_WaitGolem ; 13 + dw ReelAction_EndGolem ; 14 + dw Slots_InitChansey ; 15 + dw ReelAction_WaitChansey ; 16 + dw ReelAction_WaitEgg ; 17 + dw ReelAction_DropReel ; 18 ; 92c16 ReelAction_DoNothing: ; 92c16 @@ -1205,9 +1183,8 @@ ReelAction_DropReel: ; 92dca ld [hl], $0 ld hl, wReel1ReelAction - wReel1 add hl, bc -rept 2 dec [hl] -endr + dec [hl] ld a, $1 ld [wcf64], a ret @@ -1327,9 +1304,8 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1347,11 +1323,11 @@ endr ; 92ebd .Jumptable: ; 92ebd - jumptable_start - jumptable .zero - jumptable .one - jumptable .two - jumptable .three + + dw .zero + dw .one + dw .two + dw .three ; 92ec5 .three: ; 92ec5 @@ -1439,9 +1415,8 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d ld e, a ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -1463,11 +1438,11 @@ endr ; 92f48 .Jumptable: ; 92f48 - jumptable_start - jumptable .zero - jumptable .one - jumptable .two - jumptable .three + + dw .zero + dw .one + dw .two + dw .three ; 92f50 .three: ; 92f50 @@ -1978,19 +1953,18 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d) ld e, [hl] ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a jp [hl] .Jumptable: ; 9322d (24:722d) - jumptable_start - jumptable .init - jumptable .fall - jumptable .roll + + dw .init + dw .fall + dw .roll .init: ; 93233 (24:7233) @@ -2051,9 +2025,8 @@ endr ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] -rept 2 inc [hl] -endr + inc [hl] cp 9 * 8 jr nc, .restart and $3 @@ -2081,19 +2054,18 @@ Slots_AnimateChansey: ; 932ac (24:72ac) ld e, [hl] ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a jp [hl] .Jumptable: ; 932bc (24:72bc) - jumptable_start - jumptable .walk - jumptable .one - jumptable .two + + dw .walk + dw .one + dw .two .walk: ; 932c2 (24:72c2) diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 27c9fb9c9..790027bd6 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -4,53 +4,51 @@ DoAnimFrame: ; 8d24b ld e, [hl] ld d, 0 ld hl, .Jumptable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a jp [hl] ; 8d25b - .Jumptable: ; 8d25b (23:525b) - jumptable_start - jumptable .Null ; null - jumptable .one ; bouncing mon icon - jumptable .two ; bouncing mon icon, selected - jumptable .three ; bouncing mon icon, menu open - jumptable .four - jumptable .five - jumptable .GameFreakLogo ; Game Freak logo - jumptable .seven - jumptable .eight - jumptable .SlotsGolem ; Something to do with slots - jumptable .SlotsChansey ; Something to do with slots - jumptable .SlotsChanseyEgg ; Something to do with slots - jumptable .twelve ; blinking cursor - jumptable .thirteen - jumptable .fourteen - jumptable .fifteen - jumptable .sixteen - jumptable .seventeen - jumptable .eighteen - jumptable .EggShell ; finish egg hatching animation - jumptable .RadioTuningKnob ; radio tuning knob - jumptable .twentyone ; cut grass leaves - jumptable .FlyFrom ; flying sprite - jumptable .FlyLeaf ; flying leaves - jumptable .FlyTo ; fly to - jumptable .twentyfive - jumptable .twentysix - jumptable .twentyseven - jumptable .twentyeight - jumptable .twentynine ; intro suicune - jumptable .thirty ; intro pichu wooper - jumptable .thirtyone ; celebi - jumptable .thirtytwo ; intro unown - jumptable .thirtythree ; intro unown F with suicune leaping up - jumptable .thirtyfour ; intro suicune facing away from us + + dw .Null ; null + dw .one ; bouncing mon icon + dw .two ; bouncing mon icon, selected + dw .three ; bouncing mon icon, menu open + dw .four + dw .five + dw .GameFreakLogo ; Game Freak logo + dw .seven + dw .eight + dw .SlotsGolem ; Something to do with slots + dw .SlotsChansey ; Something to do with slots + dw .SlotsChanseyEgg ; Something to do with slots + dw .twelve ; blinking cursor + dw .thirteen + dw .fourteen + dw .fifteen + dw .sixteen + dw .seventeen + dw .eighteen + dw .EggShell ; finish egg hatching animation + dw .RadioTuningKnob ; radio tuning knob + dw .twentyone ; cut grass leaves + dw .FlyFrom ; flying sprite + dw .FlyLeaf ; flying leaves + dw .FlyTo ; fly to + dw .twentyfive + dw .twentysix + dw .twentyseven + dw .twentyeight + dw .twentynine ; intro suicune + dw .thirty ; intro pichu wooper + dw .thirtyone ; celebi + dw .thirtytwo ; intro unown + dw .thirtythree ; intro unown F with suicune leaping up + dw .thirtyfour ; intro suicune facing away from us .Null: ; 8d2a1 (23:52a1) @@ -135,11 +133,11 @@ endr ret .four: ; 8d302 (23:5302) - call .anonymous_jumptable + call .anonymous_dw jp [hl] ; 8d306 (23:5306) -; Anonymous jumptable (see .anonymous_jumptable) +; Anonymous dw (see .anonymous_dw) dw .four_zero dw .four_one ; 8d30a @@ -237,9 +235,8 @@ endr ld a, [hl] and a jr z, .asm_8d3ba -rept 2 dec [hl] -endr + dec [hl] ld d, a and $1f jr nz, .asm_8d395 @@ -420,11 +417,11 @@ endr ret .sixteen: ; 8d483 (23:5483) - call .anonymous_jumptable + call .anonymous_dw jp [hl] ; 8d487 (23:5487) -; Anonymous jumptable (see .anonymous_jumptable) +; Anonymous dw (see .anonymous_dw) dw .sixteen_zero dw .sixteen_one dw .sixteen_two @@ -554,9 +551,8 @@ endr ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] -rept 2 inc [hl] -endr + inc [hl] cp $b0 jr nc, .asm_8d53f and $3 @@ -669,9 +665,8 @@ endr ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc -rept 2 dec [hl] -endr + dec [hl] ld hl, SPRITEANIMSTRUCT_0F add hl, bc @@ -699,9 +694,8 @@ endr ld a, [hl] cp -9 * 8 jr nc, .delete_leaf -rept 2 inc [hl] -endr + inc [hl] ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc @@ -732,9 +726,8 @@ endr ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc -rept 2 inc [hl] -endr + inc [hl] ld hl, SPRITEANIMSTRUCT_0F add hl, bc @@ -861,7 +854,7 @@ endr callba UpdateCelebiPosition ret -.anonymous_jumptable: ; 8d6c5 (23:56c5) +.anonymous_dw: ; 8d6c5 (23:56c5) ld hl, [sp+$0] ld e, [hl] inc hl diff --git a/engine/sprites.asm b/engine/sprites.asm index 744ef8f6f..666ac992d 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -46,7 +46,7 @@ DoNextFrameForAllSprites: ; 8cf7a ld b, h push hl push de - call DoAnimFrame ; Uses a massive jumptable + call DoAnimFrame ; Uses a massive dw call UpdateAnimFrame pop de pop hl @@ -86,7 +86,7 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) ld b, h push hl push de - call DoAnimFrame ; Uses a massive jumptable + call DoAnimFrame ; Uses a massive dw call UpdateAnimFrame pop de pop hl @@ -188,13 +188,11 @@ endr ld [hli], a ; load 0 into the next four fields xor a -rept 2 ld [hli], a -endr + ld [hli], a xor a -rept 2 ld [hli], a -endr + ld [hli], a ; load -1 into the next field dec a ld [hli], a @@ -478,9 +476,8 @@ GetSpriteAnimFrame: ; 8d132 ld hl, SPRITEANIMSTRUCT_FRAME add hl, bc -rept 2 dec [hl] -endr + dec [hl] jr .loop .restart @@ -505,9 +502,8 @@ endr ld e, [hl] ld d, 0 ld hl, SpriteAnimFrameData -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -536,9 +532,8 @@ BrokenGetStdGraphics: ; 8d1ac push hl ld l, a ld h, 0 -rept 2 add hl, hl -endr + add hl, hl ld de, BrokenStdGFXPointers ; broken 2bpp pointers add hl, de ld c, [hl] @@ -635,9 +630,8 @@ Sprites_Sine: ; 8e72c ld a, d ld d, 0 ld hl, .sinewave -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -677,9 +671,8 @@ AnimateEndOfExpBar: ; 8e79d call .AnimateFrame call DelayFrame pop bc -rept 2 inc d -endr + inc d dec c jr nz, .loop call ClearSprites diff --git a/engine/startmenu.asm b/engine/startmenu.asm index b5bd3140f..58b7ca5ec 100755 --- a/engine/startmenu.asm +++ b/engine/startmenu.asm @@ -50,9 +50,8 @@ StartMenu:: ; 125cd ld hl, .MenuReturns ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -235,9 +234,8 @@ endr push de ld a, [MenuSelection] call .GetMenuAccountTextPointer -rept 2 inc hl -endr + inc hl ld a, [hli] ld d, [hl] ld e, a diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index 302f29ba4..7b61f0272 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -100,15 +100,15 @@ StatsScreenBattle: ; 4dcf7 ; 4dd2a StatsScreenPointerTable: ; 4dd2a - jumptable_start - jumptable MonStatsInit ; regular pokémon - jumptable EggStatsInit ; egg - jumptable StatsScreenWaitCry - jumptable EggStatsJoypad - jumptable StatsScreen_LoadPage - jumptable StatsScreenWaitCry - jumptable MonStatsJoypad - jumptable StatsScreen_Exit + + dw MonStatsInit ; regular pokémon + dw EggStatsInit ; egg + dw StatsScreenWaitCry + dw EggStatsJoypad + dw StatsScreen_LoadPage + dw StatsScreenWaitCry + dw MonStatsJoypad + dw StatsScreen_Exit ; 4dd3a @@ -157,12 +157,12 @@ MonStatsInit: ; 4dd72 (13:5d72) call StatsScreen_InitUpperHalf ld hl, wcf64 set 4, [hl] - ld h, StatsScreen_LoadPageTableIndex + ld h, 4 call StatsScreen_SetJumptableIndex ret .egg - ld h, EggStatsInitTableIndex + ld h, 1 call StatsScreen_SetJumptableIndex ret @@ -178,7 +178,7 @@ EggStatsInit: ; 4dda1 EggStatsJoypad: ; 4ddac (13:5dac) call StatsScreen_GetJoypad jr nc, .check - ld h, MonStatsInitTableIndex + ld h, 0 call StatsScreen_SetJumptableIndex ret @@ -189,7 +189,7 @@ EggStatsJoypad: ; 4ddac (13:5dac) jp StatsScreen_JoypadAction .quit - ld h, StatsScreen_ExitTableIndex + ld h, 7 call StatsScreen_SetJumptableIndex ret @@ -205,7 +205,7 @@ StatsScreen_LoadPage: ; 4ddc6 (13:5dc6) MonStatsJoypad: ; 4ddd6 (13:5dd6) call StatsScreen_GetJoypad jr nc, .next - ld h, MonStatsInitTableIndex + ld h, 0 call StatsScreen_SetJumptableIndex ret @@ -360,17 +360,17 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) and %11111100 or c ld [wcf64], a - ld h, StatsScreen_LoadPageTableIndex + ld h, 4 call StatsScreen_SetJumptableIndex ret .load_mon - ld h, MonStatsInitTableIndex + ld h, 0 call StatsScreen_SetJumptableIndex ret .b_button: ; 4dee4 (13:5ee4) - ld h, StatsScreen_ExitTableIndex + ld h, 7 call StatsScreen_SetJumptableIndex ret @@ -535,10 +535,10 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ret .Jumptable: ; 4e00d (13:600d) - jumptable_start - jumptable .PinkPage - jumptable .GreenPage - jumptable .BluePage + + dw .PinkPage + dw .GreenPage + dw .BluePage .PinkPage: ; 4e013 (13:6013) diff --git a/engine/title.asm b/engine/title.asm index 0812ec0ec..ab82b77b2 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -189,7 +189,7 @@ _TitleScreen: ; 10ed67 ; Let LCD Stat know we're messing around with SCX ld a, rSCX - rJOYP - ld [hLCDStatCustom], a + ld [hFFC6], a pop af ld [rSVBK], a diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 22f6d3d22..cf8b78618 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -188,8 +188,8 @@ endr ; e12d9 .Jumptable: ; e12d9 - jumptable_start - jumptable .Function + + dw .Function ; e12db .Function: ; e12db diff --git a/event/daycare.asm b/event/daycare.asm index 1be6c68a5..c83701e28 100755 --- a/event/daycare.asm +++ b/event/daycare.asm @@ -273,9 +273,8 @@ PrintDayCareText: ; 1689b ld e, a ld d, 0 ld hl, .TextTable -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -780,9 +779,8 @@ DayCare_InitBreeding: ; 16a3b ld hl, wEggMonHappiness ld [hli], a xor a -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ld a, [CurPartyLevel] ld [wEggMonLevel], a diff --git a/event/field_moves.asm b/event/field_moves.asm index 38a6a1c29..d2125b16e 100755 --- a/event/field_moves.asm +++ b/event/field_moves.asm @@ -163,7 +163,7 @@ OWCutJumptable: ; 8ca0c ld a, [wJumptableIndex] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -174,7 +174,7 @@ endr ; 8ca1b -.jumptable: ; 8ca1b (23:4a1b) +.dw: ; 8ca1b (23:4a1b) dw Cut_SpawnAnimateTree dw Cut_SpawnAnimateLeaves dw Cut_StartWaiting diff --git a/event/magnet_train.asm b/event/magnet_train.asm index fbb5238c4..eb29fd296 100755 --- a/event/magnet_train.asm +++ b/event/magnet_train.asm @@ -61,9 +61,9 @@ Special_MagnetTrain: ; 8cc04 ld [hVBlank], a call ClearBGPalettes xor a - ld [hLCDStatCustom], a - ld [hLCDStatCustom + 1], a - ld [hLCDStatCustom + 2], a + ld [hFFC6], a + ld [hFFC7], a + ld [hFFC8], a ld [hSCX], a ld [Requested2bppSource], a ld [Requested2bppSource + 1], a @@ -254,7 +254,7 @@ MagnetTrain_InitLYOverrides: ; 8cda6 ld a, [wMagnetTrainInitPosition] call ByteFill ld a, $43 - ld [hLCDStatCustom], a + ld [hFFC6], a ret ; 8cdc3 @@ -306,14 +306,14 @@ endr ; 8ce06 .Jumptable: ; 8ce06 - jumptable_start - jumptable .InitPlayerSpriteAnim - jumptable .WaitScene - jumptable .MoveTrain1 - jumptable .WaitScene - jumptable .MoveTrain2 - jumptable .WaitScene - jumptable .TrainArrived + + dw .InitPlayerSpriteAnim + dw .WaitScene + dw .MoveTrain1 + dw .WaitScene + dw .MoveTrain2 + dw .WaitScene + dw .TrainArrived ; 8ce14 .Next: ; 8ce14 diff --git a/event/mom.asm b/event/mom.asm index 4f57aec7f..ab405a27c 100644 --- a/event/mom.asm +++ b/event/mom.asm @@ -22,7 +22,7 @@ Special_BankOfMom: ; 16218 ld a, [wJumptableIndex] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -32,17 +32,17 @@ endr jp [hl] ; 16242 -.jumptable: ; 16242 - jumptable_start - jumptable .CheckIfBankInitialized - jumptable .InitializeBank - jumptable .IsThisAboutYourMoney - jumptable .AccessBankOfMom - jumptable .StoreMoney - jumptable .TakeMoney - jumptable .StopOrStartSavingMoney - jumptable .AskDST - jumptable .JustDoWhatYouCan +.dw: ; 16242 + + dw .CheckIfBankInitialized + dw .InitializeBank + dw .IsThisAboutYourMoney + dw .AccessBankOfMom + dw .StoreMoney + dw .TakeMoney + dw .StopOrStartSavingMoney + dw .AskDST + dw .JustDoWhatYouCan ; 16254 .CheckIfBankInitialized: ; 16254 diff --git a/home.asm b/home.asm index 1955a50a5..9e35cd11c 100644 --- a/home.asm +++ b/home.asm @@ -926,9 +926,8 @@ GetPokemonName:: ; 343b ld e, a ld h, 0 ld l, a -rept 2 add hl, hl ; hl = hl * 4 -endr + add hl, hl ; hl = hl * 4 add hl, de ; hl = (hl*4) + de add hl, hl ; hl = (5*hl) + (5*hl) ld de, PokemonNames @@ -1295,9 +1294,8 @@ HandleStoneQueue:: ; 3567 inc hl .next_inc2 -rept 2 inc hl -endr + inc hl jr .loop2 .nope3 @@ -1929,7 +1927,7 @@ INCLUDE "home/battle.asm" Function3b0c:: ; 3b0c - ld a, [hLCDStatCustom] + ld a, [hFFC6] and a ret z @@ -1992,12 +1990,10 @@ Function3eea:: ; 3eea push bc ld de, AttrMap - TileMap add hl, de -rept 2 inc b -endr -rept 2 + inc b + inc c inc c -endr call Function3f35 pop bc pop hl @@ -2021,12 +2017,10 @@ Function3f0d:: ; 3f0d push bc ld de, AttrMap - TileMap add hl, de -rept 2 inc b -endr -rept 2 + inc b + inc c inc c -endr call Function3f35 pop bc pop hl @@ -2147,9 +2141,8 @@ Function3f9f:: ; 3f9f ld c, $8 .asm_3fa5 ld a, [de] -rept 2 inc de -endr + inc de cpl ld [hl], $0 inc hl diff --git a/home/lcd.asm b/home/lcd.asm index ad95b3c66..875043bc0 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -3,7 +3,7 @@ Function547:: ; 547 ; Unreferenced - ld a, [hLCDStatCustom] + ld a, [hFFC6] cp rSCX - $ff00 ret nz ld c, a @@ -15,7 +15,7 @@ Function547:: ; 547 LCD:: ; 552 push af - ld a, [hLCDStatCustom] + ld a, [hFFC6] and a jr z, .done @@ -26,7 +26,7 @@ LCD:: ; 552 ld b, LYOverrides >> 8 ld a, [bc] ld b, a - ld a, [hLCDStatCustom] + ld a, [hFFC6] ld c, a ld a, b ld [$ff00+c], a diff --git a/home/tilemap.asm b/home/tilemap.asm index 115efb3e5..152f75686 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -214,13 +214,11 @@ Coord2Tile:: ; 1d05 ld a, c ld b, h ld c, l -rept 2 add hl, hl -endr + add hl, hl add hl, bc -rept 2 add hl, hl -endr + add hl, hl ld c, a xor a ld b, a @@ -244,13 +242,11 @@ Coord2Attr:: ; 1d21 ld a, c ld b, h ld c, l -rept 2 add hl, hl -endr + add hl, hl add hl, bc -rept 2 add hl, hl -endr + add hl, hl ld c, a xor a ld b, a diff --git a/home/video.asm b/home/video.asm index 96a449071..c88e0e555 100644 --- a/home/video.asm +++ b/home/video.asm @@ -77,9 +77,8 @@ endr ; We've done 2 16x8 blocks ld a, [hFFDC] -rept 2 dec a -endr + dec a ld [hFFDC], a jr nz, .next diff --git a/hram.asm b/hram.asm index f04b28d3b..2032a74cc 100644 --- a/hram.asm +++ b/hram.asm @@ -76,8 +76,9 @@ hFFC1 EQU $ffc1 hFFC2 EQU $ffc2 hMoneyTemp EQU $ffc3 -hLCDStatCustom EQU $ffc6 - +hFFC6 EQU $ffc6 +hFFC7 EQU $ffc7 +hFFC8 EQU $ffc8 hMobileReceive EQU $ffc9 hFFCA EQU $ffca hLinkPlayerNumber EQU $ffcb diff --git a/items/item_effects.asm b/items/item_effects.asm index 2c554cea2..e68e81d4f 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -1614,11 +1614,11 @@ GetItemHealingAction: ; f058 (3:7058) ; f09e StatusHealer_Jumptable: ; f09e (3:709e) - ld hl, .jumptable + ld hl, .dw rst JumpTable ret -.jumptable: ; f0a3 (3:70a3) +.dw: ; f0a3 (3:70a3) dw StatusHealer_ClearPalettes dw StatusHealer_NoEffect dw StatusHealer_ExitMenu diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index 753a858a4..3c7066938 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -74,7 +74,7 @@ Function110029: ; 110029 (44:4029) Function110030:: ; 110030 (44:4030) ; Use the byte at $c988 as a parameter -; for a jumptable. +; for a dw. ; If [$c988] in {12, 14, 16}, ; clear [$c835]. push de @@ -91,7 +91,7 @@ Function110030:: ; 110030 (44:4030) .noreset ld d, $0 ld e, a - ld hl, .jumptable + ld hl, .dw add hl, de ld a, [hli] ld [$c988], a @@ -114,10 +114,10 @@ Function110030:: ; 110030 (44:4030) ld a, [hli] ld h, [hl] ld l, a - ret ; indirectly jump to the function loaded from the jumptable, which returns to Function3e60. + ret ; indirectly jump to the function loaded from the dw, which returns to Function3e60. ; 110070 (44:4070) -.jumptable: ; 110070 +.dw: ; 110070 dw Function110115 dw Function110236 dw Function110291 diff --git a/macros.asm b/macros.asm index 4572d0c90..812873584 100644 --- a/macros.asm +++ b/macros.asm @@ -257,25 +257,15 @@ else endc endm -jumptable_start: MACRO -; Use the declare opname you want to use, -; either "dw", "dba", or "dab". -if def(__far) - purge __far -endc -if _NARG == 0 -__far EQUS "dw" -else -__far EQUS "\1" -endc - enum_start -endm - jumptable: MACRO -if DEF(\1TableIndex) -__enum__ = __enum__ + 1 -else - enum \1TableIndex -endc - __far \1 + ld a, [\2] + ld e, a + ld d, 0 + ld hl, \1 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] endm diff --git a/main.asm b/main.asm index a8bcb97b8..d7c88db4d 100644 --- a/main.asm +++ b/main.asm @@ -81,7 +81,7 @@ Function6454:: ; 6454 .Function6473 xor a - ld [hLCDStatCustom], a + ld [hFFC6], a ld [hBGMapMode], a ld a, $90 ld [hWY], a @@ -1045,12 +1045,12 @@ CheckObjectEnteringVisibleRange:: ; 81ca ld a, [wPlayerStepDirection] cp STANDING ret z - ld hl, .jumptable + ld hl, .dw rst JumpTable ret ; 81d6 -.jumptable: ; 81d6 +.dw: ; 81d6 dw .Down dw .Up dw .Left @@ -1657,9 +1657,8 @@ _Sine:: ; 84d9 ld a, d ld d, 0 ld hl, .sinewave -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -2061,9 +2060,8 @@ HealPartyMon: ; c677 ; bc = MON_HP ld b, h ld c, l -rept 2 dec bc -endr + dec bc ld a, [hli] ld [bc], a @@ -2274,10 +2272,10 @@ CutFunction: ; c785 ; c796 .Jumptable: ; c796 (3:4796) - jumptable_start - jumptable .CheckAble - jumptable .DoCut - jumptable .FailCut + + dw .CheckAble + dw .DoCut + dw .FailCut .CheckAble: ; c79c (3:479c) ld de, ENGINE_HIVEBADGE @@ -4457,9 +4455,8 @@ RemoveItemFromPocket: ; d2ff jr nc, .ok ; memory ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld a, [CurItem] cp [hl] inc hl @@ -4493,9 +4490,8 @@ endr dec hl ld b, h ld c, l -rept 2 inc hl -endr + inc hl .loop2 ld a, [hli] ld [bc], a @@ -6115,9 +6111,8 @@ FindApricornsInBag: ; 24c64 ld a, [hl] call .addtobuffer .nope -rept 2 inc hl -endr + inc hl jr .loop .done @@ -7397,9 +7392,8 @@ DisplayDexEntry: ; 4424d ld d, l ld e, h pop hl -rept 2 inc hl -endr + inc hl ld a, d or e jr z, .skip_height @@ -7505,9 +7499,8 @@ GetDexEntryPointer: ; 44333 dec a ld d, 0 ld e, a -rept 2 add hl, de -endr + add hl, de ld e, [hl] inc hl ld d, [hl] @@ -7583,9 +7576,8 @@ INCLUDE "engine/init_gender.asm" DrawKrisPackGFX: ; 48e81 ld hl, PackFGFXPointers -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld d, [hl] @@ -8068,9 +8060,8 @@ _LoadMapPart:: ; 4d15b ld a, [wMetatileStandingX] and a jr z, .left_column -rept 2 inc hl -endr + inc hl .left_column decoord 0, 0 @@ -8221,12 +8212,10 @@ LinkTextbox2: ; 4d35b pop bc ld de, AttrMap - TileMap add hl, de -rept 2 inc b -endr -rept 2 + inc b + inc c inc c -endr ld a, $7 .row push bc @@ -9384,18 +9373,17 @@ CatchTutorial:: ; 4e554 ld a, [BattleType] dec a ld c, a - ld hl, .jumptable + ld hl, .dw ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a jp [hl] ; 4e564 -.jumptable: ; 4e564 (13:6564) +.dw: ; 4e564 (13:6564) dw .DudeTutorial dw .DudeTutorial dw .DudeTutorial @@ -9453,9 +9441,8 @@ endr ld a, 1 ld [hli], a ld a, POKE_BALL ; 5 -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], -1 ret ; 4e5da (13:65da) @@ -9881,9 +9868,8 @@ Function50a28: ; 50a28 dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -9899,7 +9885,6 @@ endr Strings50a42: ; 50a42 ; Untranslated trainer class names from Red. - dw .Youngster dw .BugCatcher dw .Lass @@ -10346,9 +10331,8 @@ Function50cdb: ; unreferenced predef PlaceStatusString: ; 50d0a push de -rept 2 inc de -endr + inc de ld a, [de] ld b, a inc de @@ -10565,9 +10549,8 @@ CalcLevel: ; 50e1b CalcExpAtLevel: ; 50e47 ; (a/b)*n**3 + c*n**2 + d*n - e ld a, [BaseGrowthRate] -rept 2 add a -endr + add a ld c, a ld b, 0 ld hl, GrowthRates @@ -11991,9 +11974,8 @@ DoStep: ; 8025f ld e, a ld d, 0 ld hl, .Steps -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -13088,9 +13070,8 @@ Functione0000: ; e0000 call .Decompress ld hl, Unknown_e008b pop bc -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld e, a ld d, [hl] diff --git a/misc/battle_tower_5c.asm b/misc/battle_tower_5c.asm index ea6ef9865..a7eb38eb4 100755 --- a/misc/battle_tower_5c.asm +++ b/misc/battle_tower_5c.asm @@ -203,7 +203,7 @@ InitBattleTowerChallengeRAM: ; 17021e _BattleTowerBattle: ; 17022c .loop - call .do_jumptable + call .do_dw call DelayFrame ld a, [wBattleTowerBattleEnded] cp $1 @@ -211,11 +211,11 @@ _BattleTowerBattle: ; 17022c ret ; 17023a -.do_jumptable: ; 17023a +.do_dw: ; 17023a ld a, [wBattleTowerBattleEnded] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -225,7 +225,7 @@ endr jp [hl] ; 170249 -.jumptable: ; 170249 +.dw: ; 170249 dw RunBattleTowerTrainer dw SkipBattleTowerTrainer ; 17024d @@ -688,7 +688,7 @@ Function1704e1: ; 1704e1 ld a, [wJumptableIndex] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -698,7 +698,7 @@ endr jp [hl] ; 17051f -.jumptable: ; 17051f +.dw: ; 17051f dw .Jumptable_0 dw .Jumptable_1 dw .Jumptable_2 @@ -945,7 +945,7 @@ BattleTowerAction: ; 170687 ld a, [ScriptVar] ld e, a ld d, 0 - ld hl, .jumptable + ld hl, .dw rept 2 add hl, de endr @@ -956,7 +956,7 @@ endr ; 170696 -.jumptable: ; 170696 (5c:4696) +.dw: ; 170696 (5c:4696) dw Function17075f ; 0x00 dw Function170788 ; 0x01 dw Function170778 ; 0x02 diff --git a/misc/fixed_words.asm b/misc/fixed_words.asm index d1706778a..c82c0d3e3 100755 --- a/misc/fixed_words.asm +++ b/misc/fixed_words.asm @@ -281,9 +281,9 @@ Function11c1ca: ; 11c1ca ld [wcf65], a ld [wcf66], a ld [wcd23], a - ld [BGMapBuffer], a + ld [wcd20], a ld [wcd21], a - ld [CreditsTimer], a + ld [wcd22], a ld [wcd35], a ld [wcd2b], a ld a, $ff @@ -373,17 +373,7 @@ Function11c283: ; 11c283 ; 11c2ac .DoJumptableFunction: ; 11c2ac - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wJumptableIndex ; 11c2bb @@ -470,12 +460,10 @@ Function11c346: ; 11c346 (47:4346) Function11c35f: ; 11c35f (47:435f) ld hl, wcd2f -rept 2 inc [hl] -endr -rept 2 + inc [hl] + dec hl dec hl -endr dec [hl] push af ld de, wcd2d @@ -486,12 +474,10 @@ endr Function11c373: ; 11c373 (47:4373) ld hl, wcd30 -rept 2 inc [hl] -endr -rept 2 + inc [hl] + dec hl dec hl -endr dec [hl] push af ld de, wcd2d @@ -563,7 +549,7 @@ Function11c3c2: ; 11c3c2 (47:43c2) call Function11cfb5 Function11c3ed: ; 11c3ed (47:43ed) - ld hl, BGMapBuffer ; wcd20 (aliases: CreditsPos) + ld hl, wcd20 ; wcd20 (aliases: CreditsPos) ld de, hJoypadPressed ; $ffa3 ld a, [de] and $8 @@ -597,10 +583,10 @@ Function11c3ed: ; 11c3ed (47:43ed) jr .asm_11c475 .asm_11c426 ld a, $8 - ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos) + ld [wcd20], a ; wcd20 (aliases: CreditsPos) ret .asm_11c42c - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) cp $6 jr c, .asm_11c472 sub $6 @@ -689,7 +675,7 @@ Function11c4a5: ; 11c4a5 (47:44a5) ret .asm_11c4b7 xor a - ld [CreditsTimer], a + ld [wcd22], a ld a, $15 ret @@ -780,7 +766,7 @@ Function11c53d: ; 11c53d (47:453d) ld hl, wcd24 set 0, [hl] ld a, $8 - ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos) + ld [wcd20], a ; wcd20 (aliases: CreditsPos) .b ld a, $4 @@ -808,7 +794,7 @@ Function11c53d: ; 11c53d (47:453d) ret .asm_11c5ab - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) call Function11ca6a call PlayClickSFX ret @@ -1131,12 +1117,11 @@ Function11c770: ; 11c770 (47:4770) jr .asm_11c795 .asm_11c7ab ld hl, $c68a + 30 - ld a, [CreditsTimer] + ld a, [wcd22] ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hl] ld [wcd28], a jr .asm_11c79f @@ -1211,9 +1196,8 @@ Function11c7bc: ; 11c7bc (47:47bc) ld a, [wcd22] ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld a, [hl] @@ -1223,9 +1207,8 @@ endr ld a, [wcd26] ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [wcd26] ld e, a .asm_11c831 @@ -1368,7 +1351,7 @@ MobileString_Next: ; 11c8f3 ; 11c8f6 Function11c8f6: ; 11c8f6 (47:48f6) - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) call Function11c95d push hl ld a, [wcd2b] @@ -1388,13 +1371,12 @@ Function11c8f6: ; 11c8f6 (47:48f6) push de call Function11c05d pop de - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) ld c, a ld b, $0 ld hl, wcd36 -rept 2 add hl, bc -endr + add hl, bc ld [hl], e inc hl ld [hl], d @@ -1414,9 +1396,8 @@ endr ld a, [wcd22] ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld a, [hl] @@ -1426,14 +1407,12 @@ endr ld a, [wcd26] ld e, a ld d, $0 -rept 2 add hl, de -endr + add hl, de ld a, [wcd25] ld e, a -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld a, [hl] @@ -1534,7 +1513,7 @@ Function11c9c3: ; 11c9c3 (47:49c3) jr nz, .asm_11c9e9 call Function11ca5e xor a - ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos) + ld [wcd20], a ; wcd20 (aliases: CreditsPos) .asm_11c9e9 ld hl, wcd24 set 4, [hl] @@ -1621,9 +1600,8 @@ Function11ca6a: ; 11ca6a (47:4a6a) ld hl, wcd36 ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld [hl], b inc hl ld [hl], b @@ -1737,9 +1715,8 @@ Function11cb52: ; 11cb52 (47:4b52) .asm_11cb58 dec a jr z, .asm_11cb5f -rept 2 inc hl -endr + inc hl jr .asm_11cb58 .asm_11cb5f ld a, [hli] @@ -1798,9 +1775,8 @@ Function11cb66: ; 11cb66 (47:4b66) .asm_11cbba dec a jr z, .asm_11cbc1 -rept 2 inc hl -endr + inc hl jr .asm_11cbba .asm_11cbc1 ld a, [hli] @@ -2044,7 +2020,7 @@ Function11ce0b: ; 11ce0b (47:4e0b) call Function11cfb5 Function11ce2b: ; 11ce2b (47:4e2b) - ld a, [CreditsTimer] + ld a, [wcd22] sla a sla a ld c, a @@ -2083,7 +2059,7 @@ Function11ce2b: ; 11ce2b (47:4e2b) ret .a - ld a, [CreditsTimer] + ld a, [wcd22] cp NUM_KANA jr c, .place sub NUM_KANA @@ -2096,7 +2072,7 @@ Function11ce2b: ; 11ce2b (47:4e2b) ld hl, wcd24 set 0, [hl] ld a, $8 - ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos) + ld [wcd20], a ; wcd20 (aliases: CreditsPos) .b ld a, $4 jr .load @@ -2122,7 +2098,7 @@ Function11ce2b: ; 11ce2b (47:4e2b) ret .asm_11cea4 - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) call Function11ca6a call PlayClickSFX ret @@ -2137,7 +2113,7 @@ Function11ce2b: ; 11ce2b (47:4e2b) ld a, [hl] cp $ff ret z - ld [CreditsTimer], a + ld [wcd22], a ret ; 11ceb9 (47:4eb9) @@ -2253,9 +2229,8 @@ Function11cfce: ; 11cfce (47:4fce) ld [hli], a ld a, [de] inc de -rept 2 dec a -endr + dec a jr z, .asm_11cff6 ld c, a ld a, $7a @@ -2271,9 +2246,8 @@ endr add hl, bc ld a, [de] dec de -rept 2 dec a -endr + dec a jr z, .asm_11d022 ld b, a .asm_11d005 @@ -2281,9 +2255,8 @@ endr ld a, $7c ld [hli], a ld a, [de] -rept 2 dec a -endr + dec a jr z, .asm_11d015 ld c, a ld a, $7f @@ -2305,9 +2278,8 @@ endr ld a, $7d ld [hli], a ld a, [de] -rept 2 dec a -endr + dec a jr z, .asm_11d031 ld c, a ld a, $7a @@ -2369,9 +2341,8 @@ Function11d035: ; 11d035 (47:5035) ld a, [de] cp $2 jr z, .asm_11d082 -rept 2 dec a -endr + dec a .asm_11d078 push af ld a, $7a @@ -2397,9 +2368,8 @@ endr cp $2 ret z push bc -rept 2 dec a -endr + dec a ld c, a ld b, a ld de, $14 @@ -2429,78 +2399,76 @@ Function11d0ac: ; 11d0ac (47:50ac) ret Function11d0b6: ; 11d0b6 (47:50b6) - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] ld e, a ld d, 0 - ld hl, Jumptable_11d0c7 -rept 2 + ld hl, .Jumptable + add hl, de add hl, de -endr ld a, [hli] ld h, [hl] ld l, a jp [hl] -Jumptable_11d0c7: ; 11d0c7 (47:50c7) - dw Function11d0dd - dw Function11d0e9 - dw Function11d0f5 - dw Function11d10f - dw Function11d134 - dw Function11d145 - dw Function11d156 - dw Function11d175 - dw Function11d1d7 - dw Function11d1d1 - dw Function11d1fc +.Jumptable + dw .zero + dw .one + dw .two + dw .three + dw .four + dw .five + dw .six + dw .seven + dw .eight + dw .nine + dw .ten -Function11d0dd: ; 11d0dd (47:50dd) - ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos) +.zero: ; 11d0dd (47:50dd) + ld a, [wcd20] ; wcd20 (aliases: CreditsPos) sla a ld hl, Unknown_11d208 ld e, $1 - jr asm_11d11e + jr .load -Function11d0e9: ; 11d0e9 (47:50e9) +.one: ; 11d0e9 (47:50e9) ld a, [wcd21] sla a ld hl, Unknown_11d21a ld e, $2 - jr asm_11d11e + jr .load -Function11d0f5: ; 11d0f5 (47:50f5) +.two: ; 11d0f5 (47:50f5) ld hl, Unknown_11d2be - ld a, [CreditsTimer] + ld a, [wcd22] ld e, a ld d, $0 add hl, de ld a, [hl] call ReinitSpriteAnimFrame - ld a, [CreditsTimer] + ld a, [wcd22] sla a ld hl, Unknown_11d23e ld e, $4 - jr asm_11d11e + jr .load -Function11d10f: ; 11d10f (47:510f) - ld a, $27 +.three: ; 11d10f (47:510f) + ld a, SPRITE_ANIM_FRAMESET_27 call ReinitSpriteAnimFrame ld a, [wcd25] sla a ld hl, Unknown_11d29e ld e, $8 - -asm_11d11e: ; 11d11e (47:511e) +.load: ; 11d11e (47:511e) push de ld e, a ld d, $0 add hl, de push hl pop de - ld hl, $4 + ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [de] inc de @@ -2512,26 +2480,26 @@ asm_11d11e: ; 11d11e (47:511e) call Function11d2ee ret -Function11d134: ; 11d134 (47:5134) - ld a, $27 +.four: ; 11d134 (47:5134) + ld a, SPRITE_ANIM_FRAMESET_27 call ReinitSpriteAnimFrame ld a, [wcd2a] sla a ld hl, Unknown_11d2b6 ld e, $10 - jr asm_11d11e + jr .load -Function11d145: ; 11d145 (47:5145) - ld a, $27 +.five: ; 11d145 (47:5145) + ld a, SPRITE_ANIM_FRAMESET_27 call ReinitSpriteAnimFrame ld a, [wcd2c] sla a ld hl, Unknown_11d2ba ld e, $20 - jr asm_11d11e + jr .load -Function11d156: ; 11d156 (47:5156) - ld a, $2a +.six: ; 11d156 (47:5156) + ld a, SPRITE_ANIM_FRAMESET_2A call ReinitSpriteAnimFrame ld a, [wcd4a] sla a @@ -2548,14 +2516,14 @@ Function11d156: ; 11d156 (47:5156) call Function11d2ee ret -Function11d175: ; 11d175 (47:5175) +.seven: ; 11d175 (47:5175) ld a, [wcd4d] cp $4 jr z, .asm_11d180 - ld a, $28 + ld a, SPRITE_ANIM_FRAMESET_28 jr .asm_11d182 .asm_11d180 - ld a, $26 + ld a, SPRITE_ANIM_FRAMESET_26 .asm_11d182 call ReinitSpriteAnimFrame ld a, [wcd4d] @@ -2566,7 +2534,7 @@ Function11d175: ; 11d175 (47:5175) sla a sla a add $20 - ld hl, $4 + ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld [hli], a ld a, [wcd4d] @@ -2590,7 +2558,7 @@ Function11d175: ; 11d175 (47:5175) sla a add e add $18 - ld hl, $4 + ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld [hli], a ld a, $8a @@ -2600,16 +2568,15 @@ Function11d175: ; 11d175 (47:5175) call Function11d2ee ret -Function11d1d1: ; 11d1d1 (47:51d1) - ld d, $98 - ld a, $2c - jr asm_11d1db +.nine: ; 11d1d1 (47:51d1) + ld d, -13 * 8 + ld a, SPRITE_ANIM_FRAMESET_2C + jr .eight_nine_load -Function11d1d7: ; 11d1d7 (47:51d7) - ld d, $10 - ld a, $2b - -asm_11d1db: ; 11d1db (47:51db) +.eight: ; 11d1d7 (47:51d7) + ld d, 2 * 8 + ld a, SPRITE_ANIM_FRAMESET_2B +.eight_nine_load: ; 11d1db (47:51db) push de call ReinitSpriteAnimFrame ld a, [wcd4a] @@ -2619,8 +2586,8 @@ asm_11d1db: ; 11d1db (47:51db) ld e, a sla a add e - add $40 - ld hl, $5 + add 8 * 8 + ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld [hld], a pop af @@ -2630,8 +2597,8 @@ asm_11d1db: ; 11d1db (47:51db) call Function11d2ee ret -Function11d1fc: ; 11d1fc (47:51fc) - ld a, $26 +.ten: ; 11d1fc (47:51fc) + ld a, SPRITE_ANIM_FRAMESET_26 call ReinitSpriteAnimFrame ld a, $8 ld e, a @@ -3119,9 +3086,8 @@ Function11d4aa: ; 11d4aa ld hl, $0005 add hl, de ld a, [bc] -rept 2 inc bc -endr + inc bc push bc .asm_11d4cf push af @@ -3162,7 +3128,6 @@ endr SortedPokemon: ; Pokemon sorted by kana. ; Notably, Rhydon is missing. - dw .a dw .i dw .u diff --git a/misc/mobile_12.asm b/misc/mobile_12.asm index f6e0e00e1..48e740681 100755 --- a/misc/mobile_12.asm +++ b/misc/mobile_12.asm @@ -519,9 +519,8 @@ Mobile12_Bin2Dec: ; 48444 (12:4444) .loop and a jr z, .got_string -rept 2 inc hl -endr + inc hl dec a jr .loop .got_string @@ -746,9 +745,8 @@ Function486bf: ; 486bf (12:46bf) pop af ld [hli], a ld a, $1 -rept 2 ld [hli], a -endr + ld [hli], a xor a rept 3 ld [hli], a @@ -1673,12 +1671,10 @@ Function48cdc: ; 48cdc (12:4cdc) pop bc ld de, AttrMap - TileMap add hl, de -rept 2 inc b -endr -rept 2 + inc b + inc c inc c -endr ld a, $0 .asm_48ced push bc diff --git a/misc/mobile_22_2.asm b/misc/mobile_22_2.asm index 299c6643c..b14660d05 100644 --- a/misc/mobile_22_2.asm +++ b/misc/mobile_22_2.asm @@ -1,6 +1,6 @@ Function8b342:: ; 8b342 ; Loads the secondary map header pointer, then runs through a -; jumptable with three dummy functions. Spends a lot of energy +; dw with three dummy functions. Spends a lot of energy ; doing pretty much nothing. call GetSecondaryMapHeaderPointer ld d, h @@ -10,7 +10,7 @@ Function8b342:: ; 8b342 xor a .loop push af - ld hl, .jumptable + ld hl, .dw rst JumpTable pop af inc a @@ -19,7 +19,7 @@ Function8b342:: ; 8b342 ret ; 8b354 -.jumptable: ; 8b354 +.dw: ; 8b354 dw .zero dw .one dw .two diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 5d2799f0f..5e933b7fc 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -67,7 +67,7 @@ Function100063: ; 100063 ld [BGMapBuffer], a xor a ld [hMapAnims], a - ld [hLCDStatCustom], a + ld [hFFC6], a ret ; 100082 @@ -84,7 +84,7 @@ Function100082: ; 100082 ld [rIE], a xor a ld [hMapAnims], a - ld [hLCDStatCustom], a + ld [hFFC6], a ld a, $1 ld [hMobileReceive], a ld [hMobile], a @@ -118,9 +118,8 @@ Function1000ba: ; 1000ba ld a, [wcd25] ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [wcd22] call GetFarHalfword ld a, [wcd22] @@ -1912,9 +1911,8 @@ Function100bc2: ; 100bc2 ld a, [wMenuCursorY] ld b, a ld a, [wNumMoves] -rept 2 inc a -endr + inc a cp b jp nz, .asm_100bcb ld a, $1 @@ -4746,9 +4744,8 @@ Function101ee2: ; 101ee2 Function101ee4: ; 101ee4 ld d, 0 ld hl, Unknown_101ef5 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld d, [hl] ld e, a @@ -7228,9 +7225,8 @@ endr inc hl push hl -rept 2 add a -endr + add a add Unknown_10327a % $100 ld l, a @@ -7693,9 +7689,8 @@ Function1035c6: ; 1035c6 callba Function10138b ld b, 0 ld hl, Unknown_1035d7 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -7708,7 +7703,6 @@ Unknown_1035d7: ; 1035d7 dw Unknown_103608 dw Unknown_103608 dw Unknown_1035fe - dw AskMobileOrCable dw AskMobileOrCable dw AskMobileOrCable @@ -8096,9 +8090,8 @@ Function10383c: ; 10383c ld [wdc60], a xor a ld hl, wdc5c -rept 2 ld [hli], a -endr + ld [hli], a ld [hl], a ld hl, UnknownText_0x103876 call PrintText diff --git a/misc/mobile_42.asm b/misc/mobile_42.asm index a4a41d439..f5ed53c81 100644 --- a/misc/mobile_42.asm +++ b/misc/mobile_42.asm @@ -382,27 +382,27 @@ endr ; 10828a .Jumptable: ; 10828a - jumptable_start - jumptable GetMobileTradeAnimByte ; 00 - jumptable MobileTradeAnim_ShowPlayerMonToBeSent ; 01 - jumptable MobileTradeAnim_02 ; 02 - jumptable MobileTradeAnim_GiveTrademon1 ; 03 - jumptable MobileTradeAnim_GiveTrademon2 ; 04 - jumptable MobileTradeAnim_05 ; 05 - jumptable MobileTradeAnim_06 ; 06 - jumptable MobileTradeAnim_07 ; 07 - jumptable MobileTradeAnim_GetTrademon1 ; 08 - jumptable MobileTradeAnim_GetTrademon2 ; 09 - jumptable MobileTradeAnim_GetTrademon3 ; 0a - jumptable MobileTradeAnim_ShowOTMonFromTrade ; 0b - jumptable EndMobileTradeAnim ; 0c - jumptable MobileTradeAnim_ShowPlayerMonForGTS ; 0d - jumptable MobileTradeAnim_ShowOTMonFromGTS ; 0e - jumptable MobileTradeAnim_0f ; 0f - jumptable MobileTradeAnim_10 ; 10 - jumptable MobileTradeAnim_11 ; 11 - jumptable MobileTradeAnim_FadeToBlack ; 12 - jumptable MobileTradeAnim_GetOddEgg ; 13 get odd egg + + dw GetMobileTradeAnimByte ; 00 + dw MobileTradeAnim_ShowPlayerMonToBeSent ; 01 + dw MobileTradeAnim_02 ; 02 + dw MobileTradeAnim_GiveTrademon1 ; 03 + dw MobileTradeAnim_GiveTrademon2 ; 04 + dw MobileTradeAnim_05 ; 05 + dw MobileTradeAnim_06 ; 06 + dw MobileTradeAnim_07 ; 07 + dw MobileTradeAnim_GetTrademon1 ; 08 + dw MobileTradeAnim_GetTrademon2 ; 09 + dw MobileTradeAnim_GetTrademon3 ; 0a + dw MobileTradeAnim_ShowOTMonFromTrade ; 0b + dw EndMobileTradeAnim ; 0c + dw MobileTradeAnim_ShowPlayerMonForGTS ; 0d + dw MobileTradeAnim_ShowOTMonFromGTS ; 0e + dw MobileTradeAnim_0f ; 0f + dw MobileTradeAnim_10 ; 10 + dw MobileTradeAnim_11 ; 11 + dw MobileTradeAnim_FadeToBlack ; 12 + dw MobileTradeAnim_GetOddEgg ; 13 get odd egg ; 1082b2 MobileTradeAnim_Next: ; 1082b2 diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm index a40829250..fd9b85e4f 100755 --- a/misc/mobile_46.asm +++ b/misc/mobile_46.asm @@ -564,17 +564,7 @@ Function118473: ; 118473 ; 1184a5 Function1184a5: ; 1184a5 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 1184b4 .Jumptable: ; 1184b4 @@ -609,17 +599,7 @@ endr ; 1184ec Function1184ec: ; 1184ec - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 1184fb .Jumptable: ; 1184fb @@ -667,17 +647,7 @@ endr ; 11854d Function11854d: ; 11854d - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 11855c .Jumptable: ; 11855c @@ -700,17 +670,7 @@ endr ; 11857c Function11857c: ; 11857c - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 11858b .Jumptable: ; 11858b @@ -745,17 +705,7 @@ endr ; 1185c3 Function1185c3: ; 1185c3 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 1185d2 .Jumptable: ; 1185d2 @@ -803,17 +753,7 @@ endr ; 118624 Function118624: ; 118624 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 118633 .Jumptable: ; 118633 @@ -851,17 +791,7 @@ endr ; 118671 Function118671: ; 118671 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 118680 .Jumptable: ; 118680 @@ -893,17 +823,7 @@ endr ; 1186b2 Function1186b2: ; 1186b2 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 1186c1 .Jumptable: ; 1186c1 @@ -936,17 +856,7 @@ endr ; 1186f5 Function1186f5: ; 1186f5 (46:46f5) - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 118704 (46:4704) .Jumptable: ; 118704 (46:4704) @@ -986,17 +896,7 @@ endr ; 118746 (46:4746) Function118746: ; 118746 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, wcf66 ; 118755 .Jumptable: ; 118755 @@ -1627,9 +1527,8 @@ Function118b8c: ; 118b8c jr nz, .asm_118b8c dec hl xor a -rept 2 ld [hli], a -endr + ld [hli], a ret ; 118b9a @@ -1830,9 +1729,8 @@ asm_118e3e ld a, [hld] cp $2f jr nz, .asm_118e3e -rept 2 inc hl -endr + inc hl ld de, wcd85 ld c, $4 .asm_118e4a @@ -2691,9 +2589,8 @@ Function119413: ; 119413 ld c, a ld a, [w3_d000 + 1] ld b, a -rept 2 dec bc -endr + dec bc ld hl, wd002 ld a, [hli] ld e, a @@ -2883,9 +2780,8 @@ endr .asm_119552 inc hl .asm_119553 -rept 2 inc hl -endr + inc hl jr .asm_11955b .asm_119557 ld de, $14 @@ -3230,9 +3126,8 @@ Function1196f2: ; 1196f2 ld a, [hld] cp $58 jr z, .asm_11975b -rept 2 inc hl -endr + inc hl ld a, d dec a jr z, .asm_11978e @@ -3815,9 +3710,8 @@ Function119b6b: ; 119b6b ld a, [de] cp $d jr nz, .asm_119b85 -rept 2 inc de -endr + inc de .asm_119b93 ld a, [de] inc de @@ -4349,28 +4243,19 @@ Function119ed8: ; 119ed8 (46:5ed8) ld [wcd8c], a ld a, $1 ld [rSVBK], a - call Function119eee + + call .RunJumptable + ld a, [wcd8c] ld [rSVBK], a ld a, $1 ld [hBGMapMode], a ret -Function119eee: ; 119eee (46:5eee) - ld a, [wcd3c] - ld e, a - ld d, 0 - ld hl, Jumptable_119efd -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 119efd (46:5efd) +.RunJumptable + jumptable .Jumptable, wcd3c -Jumptable_119efd: ; 119efd +.Jumptable dw Function119f3f dw Function119f45 dw Function119f56 @@ -5553,17 +5438,7 @@ endr ; 11a8fa Function11a8fa: ; 11a8fa - ld a, [$c31a] - ld e, a - ld d, 0 - ld hl, .Jumptable -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable .Jumptable, $c31a ; 11a909 .Jumptable: ; 11a909 @@ -6328,9 +6203,8 @@ asm_11afbd: dec a ld c, a ld b, 0 -rept 2 add hl, bc -endr + add hl, bc ld a, e ld e, [hl] inc hl @@ -6803,9 +6677,8 @@ Function11b236: ; 11b236 Function11b239: ; 11b239 ld e, a ld d, 0 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -7210,20 +7083,9 @@ Function11b45c: ; 11b45c ; 11b46a Function11b46a: ; 11b46a - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_11b479 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11b479 + jumptable .Jumptable, wJumptableIndex -Jumptable_11b479: ; 11b479 +.Jumptable dw Function11b483 dw Function11b570 dw Function11b5c0 @@ -7232,7 +7094,7 @@ Jumptable_11b479: ; 11b479 ; 11b483 Function11b483: ; 11b483 - call Function11b538 + call .InitRAM ld hl, PlayerName ld a, $5 ; Japanese Name Length .loop1 @@ -7291,9 +7153,8 @@ Function11b483: ; 11b483 pop de ld h, d ld l, e -rept 2 dec hl -endr + dec hl ld a, [de] ld [hli], a inc de @@ -7369,9 +7230,8 @@ endr jr nz, .loop9 call CloseSRAM jp Function11ad8a -; 11b538 -Function11b538: ; 11b538 +.InitRAM ld bc, wc626 ld a, [PlayerID] ld [wcd2a], a @@ -7416,26 +7276,28 @@ Function11b570: ; 11b570 ld a, [ScriptVar] and a jr nz, .exit - call Function11b585 + call .SaveData jp Function11ad8a .exit ld a, $4 ld [wJumptableIndex], a ret -; 11b585 -Function11b585: ; 11b585 +.SaveData ld a, $3 ld [rSVBK], a + ld hl, w3_d800 ld de, $c608 ld bc, w3_d88f - w3_d800 call CopyBytes + ld a, $1 ld [rSVBK], a ld a, $5 call GetSRAMBank + ld de, $a800 ld a, $1 ld [de], a @@ -7443,8 +7305,10 @@ Function11b585: ; 11b585 ld hl, $c608 ld bc, w3_d88f - w3_d800 call CopyBytes + push de pop hl + ld a, [hRTCMinutes] ld [hli], a ld a, [hRTCHours] @@ -7453,6 +7317,7 @@ Function11b585: ; 11b585 ld [hli], a ld a, [hRTCDayHi] ld [hl], a + call CloseSRAM ret ; 11b5c0 @@ -7484,14 +7349,14 @@ Function11b5e8: ; 11b5e8 call GetSRAMBank ld hl, wRTC ld de, $c608 - ld bc, $0004 + ld bc, 4 call CopyBytes call CloseSRAM ld a, $5 call GetSRAMBank ld hl, $c608 ld de, $b08c - ld bc, $0004 + ld bc, 4 call CopyBytes ld a, $2 ld [$a800], a @@ -7513,35 +7378,20 @@ Function11b5e8: ; 11b5e8 ld [wcd31], a call CloseSRAM call Function11b44b - call Function11b64c + call .loop ret -; 11b64c -Function11b64c: ; 11b64c -.asm_11b64c - call Function11b65a +.loop + call .RunJumptable call DelayFrame ld a, [wJumptableIndex] cp $1 - jr nz, .asm_11b64c + jr nz, .loop ret -; 11b65a -Function11b65a: ; 11b65a - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_11b669 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11b669 - -Jumptable_11b669: ; 11b669 +.RunJumptable + jumptable .Jumptable, wJumptableIndex +.Jumptable dw Function11b66d dw Function11b6b3 ; 11b66d diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 74be85b47..204ea7371 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -733,17 +733,7 @@ Function17d45a: ; 17d45a ; 17d474 Function17d474: ; 17d474 - ld a, [wcd77] - ld e, a - ld d, 0 - ld hl, Jumptable_17d483 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable Jumptable_17d483, wcd77 ; 17d483 Jumptable_17d483: ; 17d483 @@ -920,16 +910,14 @@ Function17d48d: ; 17d48d ld a, [wcd42] ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld a, l ld [wcd4b], a ld a, h ld [wcd4c], a -rept 2 add hl, bc -endr + add hl, bc ld a, l ld [wcd4d], a ld a, h @@ -955,9 +943,8 @@ Function17d5c4: .loop srl a jr c, .got_button -rept 2 inc c -endr + inc c jr .loop .got_button @@ -1044,12 +1031,10 @@ Function17d60b: ; 17d60b ld [wcd4c], a pop de pop hl -rept 2 inc b -endr -rept 2 + inc b + dec c dec c -endr jr z, .asm_17d684 push bc push de @@ -1095,17 +1080,15 @@ Function17d6a1: ; 17d6a1 ld a, $5 call GetSRAMBank ld hl, $b1d3 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld [wcd47], a ld a, [hl] ld [BGMapPalBuffer], a ld hl, $b1b3 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld c, a ld a, [hl] @@ -1121,9 +1104,8 @@ endr ld de, wcd60 ld bc, $0004 call CopyBytes -rept 2 inc hl -endr + inc hl ld de, wcd64 ld bc, $0004 call CopyBytes @@ -1159,9 +1141,8 @@ Function17d711: ld e, a ld d, 0 ld hl, Jumptable17d72a -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -2015,9 +1996,8 @@ Function17dccf: ; 17dccf ld a, [wcd2e] ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld c, a ld a, [hl] @@ -2432,9 +2412,8 @@ Function17ded9: ; 17ded9 jr .asm_17df7b .asm_17df79 -rept 2 inc hl -endr + inc hl .asm_17df7b bit 4, b @@ -2487,9 +2466,8 @@ endr jr .asm_17dfd2 .asm_17dfd0 -rept 2 inc hl -endr + inc hl .asm_17dfd2 bit 5, b @@ -2614,9 +2592,8 @@ Function17e026: ; 17e026 jr .asm_17e0a4 .asm_17e0a2 -rept 2 inc hl -endr + inc hl .asm_17e0a4 bit 4, b @@ -2632,9 +2609,8 @@ endr jr .asm_17e0b6 .asm_17e0b4 -rept 2 inc hl -endr + inc hl .asm_17e0b6 bit 5, b @@ -2656,9 +2632,8 @@ endr call CloseSRAM pop hl pop bc -rept 2 inc hl -endr + inc hl jr asm_17e0ee .asm_17e0e1 @@ -2703,9 +2678,8 @@ Function17e0fd: ; 17e0fd call ReceiveItem pop hl jr c, .asm_17e127 -rept 2 inc hl -endr + inc hl .asm_17e127 ld a, [hli] @@ -2735,9 +2709,8 @@ Function17e133: ; 17e133 callba MobileCheckOwnMonAnywhere pop hl jr c, .asm_17e159 -rept 2 inc hl -endr + inc hl .asm_17e159 ld a, [hli] @@ -2773,9 +2746,8 @@ Function17e165: ; 17e165 call CheckItem pop hl jr c, .asm_17e195 -rept 2 inc hl -endr + inc hl .asm_17e195 ld a, [hli] @@ -3240,9 +3212,8 @@ Function17e451: ; 17e451 ld [wcd2e], a ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc push hl hlcoord 0, 0 ld bc, $0014 @@ -3467,9 +3438,8 @@ Function17e5af: ; 17e5af ld l, a ld a, [wcd4e] ld h, a -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld e, a ld a, [hli] @@ -3534,9 +3504,8 @@ Function17e613: ; 17e613 ld [hli], a ld a, [de] inc de -rept 2 dec a -endr + dec a jr z, .asm_17e63f ld c, a ld a, [wcd53] @@ -3555,9 +3524,8 @@ endr add hl, bc ld a, [de] dec de -rept 2 dec a -endr + dec a jr z, .asm_17e674 ld b, a .asm_17e651 @@ -3566,9 +3534,8 @@ endr add $3 ld [hli], a ld a, [de] -rept 2 dec a -endr + dec a jr z, .asm_17e664 ld c, a ld a, $7f @@ -3594,9 +3561,8 @@ endr add $5 ld [hli], a ld a, [de] -rept 2 dec a -endr + dec a jr z, .asm_17e689 ld c, a ld a, [wcd53] @@ -3622,9 +3588,8 @@ Function17e691: ; 17e691 inc de push af ld a, [de] -rept 2 inc de -endr + inc de and a .asm_17e69f jr z, .asm_17e6a5 @@ -3776,9 +3741,8 @@ Function17f047: ; 17f047 ld e, a ld d, 0 ld hl, Jumptable_17f061 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld h, [hl] ld l, a @@ -3815,9 +3779,8 @@ Function17f081: ; 17f081 ld de, $0004 add hl, de ld a, [hli] -rept 2 inc hl -endr + inc hl ld e, l ld d, h ld l, c @@ -3960,9 +3923,8 @@ Function17f154: ; 17f154 pop hl call Function17f524 jr c, .asm_17f167 -rept 2 inc hl -endr + inc hl ld e, l ld d, h ld a, [de] @@ -4150,9 +4112,8 @@ Function17f220: ; 17f220 ld e, a ld d, 0 ld hl, .Genders -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld a, [hl] @@ -4414,9 +4375,8 @@ Function17f3f0: ; 17f3f0 ld a, [de] ld c, a ld b, $0 -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld e, a ld a, [hli] @@ -4431,9 +4391,8 @@ endr ld e, a ld d, $0 pop hl -rept 2 add hl, de -endr + add hl, de rept 3 inc hl endr @@ -4497,9 +4456,8 @@ Function17f44f: ; 17f44f ld de, $0005 add hl, de ld a, [hli] -rept 2 inc hl -endr + inc hl ld e, l ld d, h ld l, c @@ -4738,17 +4696,7 @@ Function17f56e: ; 17f56e ; 17f5ae Function17f5ae: ; 17f5ae - ld a, [wc303] - ld e, a - ld d, 0 - ld hl, Table17f5bd -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] + jumptable Table17f5bd, wc303 ; 17f5bd Table17f5bd: ; 17f5bd @@ -4818,9 +4766,8 @@ Function17f5e4: ; 17f5e4 ld e, a ld d, $0 ld hl, Table_17f706 -rept 2 add hl, de -endr + add hl, de ld a, [wc301] ld e, a ld a, [wc302] @@ -4858,9 +4805,8 @@ endr jr .asm_17f67d .asm_17f674 -rept 2 inc hl -endr + inc hl dec c jr nz, .asm_17f65d @@ -4878,9 +4824,8 @@ endr ld e, a ld d, 0 ld hl, Table_17f699 -rept 2 add hl, de -endr + add hl, de ld a, [hli] ld e, a ld a, [hl] diff --git a/misc/mobile_menu.asm b/misc/mobile_menu.asm index 6291960e5..8975a5151 100755 --- a/misc/mobile_menu.asm +++ b/misc/mobile_menu.asm @@ -162,9 +162,8 @@ MobileMenu_InitMenuBuffers: ; 4a071 (12:6071) add B_BUTTON ld [hli], a ; wMenuJoypadFilter ld a, 1 -rept 2 ld [hli], a ; wMenuCursorY, wMenuCursorX -endr + ld [hli], a ; wMenuCursorY, wMenuCursorX ret Function4a098: ; 4a098 (12:6098) @@ -246,9 +245,8 @@ Function4a118: ; 4a118 (12:6118) add $2 ld [hli], a ld a, $1 -rept 2 ld [hli], a -endr + ld [hli], a ret Function4a13b: ; 4a13b (12:613b) @@ -523,9 +521,8 @@ Function4a373: ; 4a373 (12:6373) add $2 ld [hli], a ld a, $1 -rept 2 ld [hli], a -endr + ld [hli], a ret ; 4a39a (12:639a) @@ -836,9 +833,8 @@ Function4a680: ; 4a680 (12:6680) add $2 ld [hli], a ld a, $1 -rept 2 ld [hli], a -endr + ld [hli], a xor a rept 3 ld [hli], a diff --git a/predef/cgb.asm b/predef/cgb.asm index c929c975c..61be93ad4 100644 --- a/predef/cgb.asm +++ b/predef/cgb.asm @@ -18,7 +18,7 @@ Predef_LoadSGBLayoutCGB: ; 8d59 ld l, a ld h, 0 add hl, hl - ld de, .jumptable + ld de, .dw add hl, de ld a, [hli] ld h, [hl] @@ -32,7 +32,7 @@ Predef_LoadSGBLayoutCGB: ; 8d59 ret ; 8d7a -.jumptable: ; 8d7a +.dw: ; 8d7a dw _CGB00 dw _CGB01 dw _CGB02 @@ -92,18 +92,16 @@ _CGB01: ; 8ddb ld a, [EnemyHPPal] ld l, a ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld bc, Palettes_a8be add hl, bc call LoadPalette_White_Col1_Col2_Black ld a, [PlayerHPPal] ld l, a ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld bc, Palettes_a8be add hl, bc call LoadPalette_White_Col1_Col2_Black @@ -209,9 +207,8 @@ _CGB03: ; 8edb ld a, [wcda1] ld l, a ld h, $0 -rept 2 add hl, hl -endr + add hl, hl ld bc, Palettes_a8be add hl, bc call LoadPalette_White_Col1_Col2_Black @@ -489,9 +486,8 @@ _CGB06: ; 90f8 _CGB07: ; 9122 ld b, 0 ld hl, Jumptable_912d -rept 2 add hl, bc -endr + add hl, bc ld a, [hli] ld h, [hl] ld l, a @@ -797,9 +793,8 @@ _CGB0e: ; 9373 ld a, [PlayerHPPal] ld l, a ld h, 0 -rept 2 add hl, hl -endr + add hl, hl ld bc, Palettes_a8be add hl, bc call LoadPalette_White_Col1_Col2_Black diff --git a/predef/crystal.asm b/predef/crystal.asm index eea3c3cec..083a5a522 100755 --- a/predef/crystal.asm +++ b/predef/crystal.asm @@ -10,7 +10,7 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) ld l, a ld h, 0 add hl, hl - ld de, .jumptable + ld de, .dw add hl, de ld a, [hli] ld h, [hl] @@ -22,11 +22,11 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) ret ; 49330 (12:5330) -.jumptable: ; 49330 - jumptable_start - jumptable MG_Mobile_Layout00 - jumptable MG_Mobile_Layout01 - jumptable MG_Mobile_Layout02 +.dw: ; 49330 + + dw MG_Mobile_Layout00 + dw MG_Mobile_Layout01 + dw MG_Mobile_Layout02 ; 49336 MG_Mobile_Layout_FillBox: ; 49336