diff options
author | PikalaxALT <PikalaxALT@gmail.com> | 2015-12-26 21:59:03 -0500 |
---|---|---|
committer | PikalaxALT <PikalaxALT@gmail.com> | 2015-12-26 21:59:03 -0500 |
commit | f030315b1fd797aa6765ac8cd8c35c0cd9b600a0 (patch) | |
tree | da461ae6040d2a2f0e0b3a95e837a6c5e99e2fd6 /engine | |
parent | 2bd45ca574aab251b91c24837b102c9c2a5e76a0 (diff) |
jumptable macro repurposed
Diffstat (limited to 'engine')
32 files changed, 584 insertions, 671 deletions
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 - - jumptable .Impossible - jumptable .Impossible - jumptable .Pikachu - jumptable .Jigglypuff - jumptable .Poliwag - jumptable .Oddish - - jumptable .OneTwo - jumptable .One - jumptable .PikaOne - jumptable .JigglyOne - jumptable .PoliOne - jumptable .OddOne - - jumptable .OneTwo - jumptable .Two - jumptable .PikaTwo - jumptable .JigglyTwo - jumptable .PoliTwo - jumptable .OddTwo - - jumptable .ThreeFour - jumptable .Three - jumptable .PikaThree - jumptable .JigglyThree - jumptable .PoliThree - jumptable .OddThree - - jumptable .ThreeFour - jumptable .Four - jumptable .PikaFour - jumptable .JigglyFour - jumptable .PoliFour - jumptable .OddFour - - jumptable .FiveSix - jumptable .Five - jumptable .PikaFive - jumptable .JigglyFive - jumptable .PoliFive - jumptable .OddFive - - jumptable .FiveSix - jumptable .Six - jumptable .PikaSix - jumptable .JigglySix - jumptable .PoliSix - jumptable .OddSix + + dw .Impossible + dw .Impossible + dw .PikaJiggly + dw .PikaJiggly + dw .PoliOddish + dw .PoliOddish + + dw .Impossible + dw .Impossible + dw .Pikachu + dw .Jigglypuff + dw .Poliwag + dw .Oddish + + dw .OneTwo + dw .One + dw .PikaOne + dw .JigglyOne + dw .PoliOne + dw .OddOne + + dw .OneTwo + dw .Two + dw .PikaTwo + dw .JigglyTwo + dw .PoliTwo + dw .OddTwo + + dw .ThreeFour + dw .Three + dw .PikaThree + dw .JigglyThree + dw .PoliThree + dw .OddThree + + dw .ThreeFour + dw .Four + dw .PikaFour + dw .JigglyFour + dw .PoliFour + dw .OddFour + + dw .FiveSix + dw .Five + dw .PikaFive + dw .JigglyFive + dw .PoliFive + dw .OddFive + + 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] - -; 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 .Jumptable, wJumptableIndex + +.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 |