diff options
Diffstat (limited to 'engine/routines')
-rw-r--r-- | engine/routines/checknickerrors.asm | 10 | ||||
-rw-r--r-- | engine/routines/correcterrorsinplayerparty.asm | 4 | ||||
-rw-r--r-- | engine/routines/drawkrispackgfx.asm | 8 | ||||
-rw-r--r-- | engine/routines/emptyallsrambanks.asm | 8 | ||||
-rw-r--r-- | engine/routines/flagpredef.asm | 4 | ||||
-rw-r--r-- | engine/routines/getsquareroot.asm | 14 | ||||
-rw-r--r-- | engine/routines/initlist.asm | 2 | ||||
-rw-r--r-- | engine/routines/loadoverworldfont.asm | 17 | ||||
-rw-r--r-- | engine/routines/loadpushoam.asm | 2 | ||||
-rw-r--r-- | engine/routines/newpokedexentry.asm | 52 | ||||
-rw-r--r-- | engine/routines/placegraphic.asm | 1 | ||||
-rw-r--r-- | engine/routines/placewaitingtext.asm | 2 | ||||
-rw-r--r-- | engine/routines/playslowcry.asm | 6 | ||||
-rw-r--r-- | engine/routines/printhoursmins.asm | 3 | ||||
-rw-r--r-- | engine/routines/printitemdescription.asm | 31 | ||||
-rwxr-xr-x | engine/routines/sine.asm | 4 | ||||
-rw-r--r-- | engine/routines/switchpartymons.asm | 10 | ||||
-rw-r--r-- | engine/routines/trademonfrontpic.asm | 2 | ||||
-rw-r--r-- | engine/routines/unreferenced_getgen1trainerclassname.asm | 21 |
19 files changed, 108 insertions, 93 deletions
diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm index 1cedca420..87ebd6bb3 100644 --- a/engine/routines/checknickerrors.asm +++ b/engine/routines/checknickerrors.asm @@ -6,7 +6,7 @@ CheckNickErrors:: ; 669f push bc push de - ld b, PKMN_NAME_LENGTH + ld b, MON_NAME_LENGTH .checkchar ; end of nick? @@ -64,10 +64,10 @@ CheckNickErrors:: ; 669f ; table defining which characters are actually text commands ; format: ; ≥ < - db "<START>", TX_BOX + 1 - db "<PLAY_G>", $18 + 1 - db $1d, "%" + 1 - db $35, "<GREEN>" + 1 + db TX_START, TX_BOX + 1 + db "<PLAY_G>", "<JP_18>" + 1 + db "<NI>", "<NO>" + 1 + db "<ROUTE>", "<GREEN>" + 1 db "<ENEMY>", "<ENEMY>" + 1 db "<MOM>", "<TM>" + 1 db "<ROCKET>", "┘" + 1 diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index 2fa98a545..42e550900 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -1,4 +1,4 @@ -CorrectErrorsInPlayerParty: ; unreferenced +Unreferenced_CorrectErrorsInPlayerParty: ld hl, PartyCount ld a, [hl] and a @@ -128,7 +128,7 @@ CorrectErrorsInPlayerParty: ; unreferenced ld hl, StringBuffer1 .got_nickname pop de - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes pop bc diff --git a/engine/routines/drawkrispackgfx.asm b/engine/routines/drawkrispackgfx.asm index 457dd7110..54a21e447 100644 --- a/engine/routines/drawkrispackgfx.asm +++ b/engine/routines/drawkrispackgfx.asm @@ -11,10 +11,10 @@ DrawKrisPackGFX: ; 48e81 ret PackFGFXPointers: ; 48e93 - dw PackFGFX + (15 tiles) * 1 - dw PackFGFX + (15 tiles) * 3 - dw PackFGFX + (15 tiles) * 0 - dw PackFGFX + (15 tiles) * 2 + dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET + dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET + dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET + dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET PackFGFX: ; 48e9b INCBIN "gfx/pack/pack_f.2bpp" diff --git a/engine/routines/emptyallsrambanks.asm b/engine/routines/emptyallsrambanks.asm index aa4b28e0d..8b060f3ef 100644 --- a/engine/routines/emptyallsrambanks.asm +++ b/engine/routines/emptyallsrambanks.asm @@ -1,11 +1,11 @@ EmptyAllSRAMBanks: ; 4cf1f - ld a, $0 + ld a, 0 call .EmptyBank - ld a, $1 + ld a, 1 call .EmptyBank - ld a, $2 + ld a, 2 call .EmptyBank - ld a, $3 + ld a, 3 call .EmptyBank ret diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm index bd4f37882..2a6d91ee1 100644 --- a/engine/routines/flagpredef.asm +++ b/engine/routines/flagpredef.asm @@ -1,5 +1,5 @@ -FlagPredef: ; 4d7c1 -; Perform action b on flag c in flag array hl. +SmallFarFlagAction: ; 4d7c1 +; Perform action b on bit c in flag array hl. ; If checking a flag, check flag array d:hl unless d is 0. ; For longer flag arrays, see FlagAction. diff --git a/engine/routines/getsquareroot.asm b/engine/routines/getsquareroot.asm index 0ba2e50a5..412fd04ff 100644 --- a/engine/routines/getsquareroot.asm +++ b/engine/routines/getsquareroot.asm @@ -1,3 +1,5 @@ +NUM_SQUARE_ROOTS EQU 255 + GetSquareRoot: ; 13b87 ; Return the square root of de in b. @@ -10,7 +12,7 @@ GetSquareRoot: ; 13b87 ; Make sure we don't go past the end of the table. inc b ld a, b - cp $ff + cp NUM_SQUARE_ROOTS ret z ; Iterate over the table until b**2 >= de. @@ -23,8 +25,8 @@ GetSquareRoot: ; 13b87 ret .Squares: ; 13b98 -root = 1 - rept $ff - dw root * root -root = root + 1 - endr +x = 1 +rept NUM_SQUARE_ROOTS + dw x * x +x = x + 1 +endr diff --git a/engine/routines/initlist.asm b/engine/routines/initlist.asm index e2b7235ab..b7260e552 100644 --- a/engine/routines/initlist.asm +++ b/engine/routines/initlist.asm @@ -21,7 +21,7 @@ InitList: ; 50db9 jr nz, .check_item_name ld hl, CurMart ld de, PokemonNames - ld a, PKMN_NAME + ld a, MON_NAME jr .done .check_item_name diff --git a/engine/routines/loadoverworldfont.asm b/engine/routines/loadoverworldfont.asm new file mode 100644 index 000000000..f23f01c4e --- /dev/null +++ b/engine/routines/loadoverworldfont.asm @@ -0,0 +1,17 @@ +LoadOverworldFont:: ; 106594 + ld de, .OverworldFontGFX + ld hl, vTiles1 + lb bc, BANK(.OverworldFontGFX), $80 + call Get2bpp + ld de, .OverworldFontSpaceGFX + ld hl, vTiles2 tile " " + lb bc, BANK(.OverworldFontSpaceGFX), 1 + call Get2bpp + ret +; 1065ad + +.OverworldFontGFX: +INCBIN "gfx/font/overworld.2bpp" + +.OverworldFontSpaceGFX: +INCBIN "gfx/font/overworld_space.2bpp" diff --git a/engine/routines/loadpushoam.asm b/engine/routines/loadpushoam.asm index 6af0ddf6d..c07c06d0f 100644 --- a/engine/routines/loadpushoam.asm +++ b/engine/routines/loadpushoam.asm @@ -13,7 +13,7 @@ LoadPushOAM:: ; 4031 .PushOAM: ; 403f ld a, HIGH(Sprites) ld [rDMA], a - ld a, (SpritesEnd - Sprites) / 4 ; 40 + ld a, NUM_SPRITE_OAM_STRUCTS .pushoam_loop dec a jr nz, .pushoam_loop diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm deleted file mode 100644 index acf9fca7b..000000000 --- a/engine/routines/newpokedexentry.asm +++ /dev/null @@ -1,52 +0,0 @@ -NewPokedexEntry: ; fb877 - ld a, [hMapAnims] - push af - xor a - ld [hMapAnims], a - call LowVolume - call ClearBGPalettes - call ClearTileMap - call UpdateSprites - call ClearSprites - ld a, [wPokedexStatus] - push af - ld a, [hSCX] - add $5 - ld [hSCX], a - xor a - ld [wPokedexStatus], a - farcall _NewPokedexEntry - call WaitPressAorB_BlinkCursor - ld a, $1 - ld [wPokedexStatus], a - farcall DisplayDexEntry - call WaitPressAorB_BlinkCursor - pop af - ld [wPokedexStatus], a - call MaxVolume - call RotateThreePalettesRight - ld a, [hSCX] - add -5 ; 251 ; NUM_POKEMON - ld [hSCX], a - call .ReturnFromDexRegistration - pop af - ld [hMapAnims], a - ret -; fb8c8 - -.ReturnFromDexRegistration: ; fb8c8 - call ClearTileMap - call LoadFontsExtra - call LoadStandardFont - farcall Pokedex_PlaceFrontpicTopLeftCorner - call WaitBGMap2 - farcall GetEnemyMonDVs - ld a, [hli] - ld [TempMonDVs], a - ld a, [hl] - ld [TempMonDVs + 1], a - ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS - call GetSGBLayout - call SetPalettes - ret -; fb8f1 diff --git a/engine/routines/placegraphic.asm b/engine/routines/placegraphic.asm index d72364776..21b914950 100644 --- a/engine/routines/placegraphic.asm +++ b/engine/routines/placegraphic.asm @@ -1,7 +1,6 @@ PlaceGraphic: ; 2ef6e ; Fill wBoxAlignment-aligned box width b height c ; with iterating tile starting from hGraphicStartTile at hl. -; Predef $13 ld de, SCREEN_WIDTH diff --git a/engine/routines/placewaitingtext.asm b/engine/routines/placewaitingtext.asm index 37fc2a056..9b2260722 100644 --- a/engine/routines/placewaitingtext.asm +++ b/engine/routines/placewaitingtext.asm @@ -11,7 +11,7 @@ PlaceWaitingText:: ; 4000 jr .proceed .notinbattle - predef Predef_LinkTextbox + predef LinkTextboxAtHL .proceed hlcoord 4, 11 diff --git a/engine/routines/playslowcry.asm b/engine/routines/playslowcry.asm index 3cc347a55..545629e51 100644 --- a/engine/routines/playslowcry.asm +++ b/engine/routines/playslowcry.asm @@ -1,6 +1,6 @@ -PlaySlowCry: ; fb841 +Special_PlaySlowCry: ; fb841 ld a, [ScriptVar] - call LoadCryHeader + call LoadCry jr c, .done ld hl, CryPitch @@ -23,7 +23,7 @@ PlaySlowCry: ; fb841 ld [CryLength], a ld a, h ld [CryLength + 1], a - farcall _PlayCryHeader + farcall _PlayCry call WaitSFX .done diff --git a/engine/routines/printhoursmins.asm b/engine/routines/printhoursmins.asm index 50117188c..eb7dc1619 100644 --- a/engine/routines/printhoursmins.asm +++ b/engine/routines/printhoursmins.asm @@ -1,5 +1,4 @@ -Function1dd6a9: ; 1dd6a9 -; XXX +Unreferenced_Function1dd6a9: ; 1dd6a9 ld a, b ld b, c ld c, a diff --git a/engine/routines/printitemdescription.asm b/engine/routines/printitemdescription.asm new file mode 100644 index 000000000..e6d087dae --- /dev/null +++ b/engine/routines/printitemdescription.asm @@ -0,0 +1,31 @@ +PrintItemDescription: ; 0x1c8955 +; Print the description for item [CurSpecies] at de. + + ld a, [CurSpecies] + cp TM01 + jr c, .not_a_tm + + ld [CurItem], a + push de + farcall GetTMHMItemMove + pop hl + ld a, [wd265] + ld [CurSpecies], a + predef PrintMoveDesc + ret + +.not_a_tm + push de + ld hl, ItemDescriptions + ld a, [CurSpecies] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + pop hl + jp PlaceString +; 0x1c8987 diff --git a/engine/routines/sine.asm b/engine/routines/sine.asm index 89a905d2e..5f56a10a8 100755 --- a/engine/routines/sine.asm +++ b/engine/routines/sine.asm @@ -7,7 +7,6 @@ _Sine:: ; 84d9 and %111111 cp %100000 jr nc, .negative - call .ApplySineWave ld a, h ret @@ -16,7 +15,7 @@ _Sine:: ; 84d9 and %011111 call .ApplySineWave ld a, h - xor -1 + xor $ff inc a ret @@ -31,7 +30,6 @@ _Sine:: ; 84d9 inc hl ld d, [hl] ld hl, 0 - ; Factor amplitude .multiply srl a diff --git a/engine/routines/switchpartymons.asm b/engine/routines/switchpartymons.asm index cde9c82b2..1379dff9c 100644 --- a/engine/routines/switchpartymons.asm +++ b/engine/routines/switchpartymons.asm @@ -25,13 +25,13 @@ _SwitchPartyMons: ld a, " " call ByteFill pop af - ld hl, Sprites - ld bc, $10 + ld hl, Sprite01 + ld bc, 4 * SPRITEOAMSTRUCT_LENGTH call AddNTimes - ld de, $4 - ld c, $4 + ld de, SPRITEOAMSTRUCT_LENGTH + ld c, 4 .gfx_loop - ld [hl], $a0 + ld [hl], SCREEN_WIDTH_PX ; y (off-screen) add hl, de dec c jr nz, .gfx_loop diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm index e312042ff..e9611553b 100644 --- a/engine/routines/trademonfrontpic.asm +++ b/engine/routines/trademonfrontpic.asm @@ -10,7 +10,7 @@ GetTrademonFrontpic: ; 4d7fd ld [CurSpecies], a call GetBaseData pop de - predef GetAnimatedFrontpicPredef + predef GetAnimatedFrontpic ret AnimateTrademonFrontpic: ; 4d81e diff --git a/engine/routines/unreferenced_getgen1trainerclassname.asm b/engine/routines/unreferenced_getgen1trainerclassname.asm new file mode 100644 index 000000000..64c55ed84 --- /dev/null +++ b/engine/routines/unreferenced_getgen1trainerclassname.asm @@ -0,0 +1,21 @@ +Unreferenced_GetGen1TrainerClassName: ; 50a28 + ld hl, Gen1TrainerClassNames + ld a, [TrainerClass] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + ld de, StringBuffer1 +.copy + ld a, [hli] + ld [de], a + inc de + cp "@" + jr nz, .copy + ret + +INCLUDE "data/unused/gen_1_trainer_names.asm" |