diff --git a/engine/link.asm b/engine/link.asm index 9d21104f8..8ba1702e9 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1378,7 +1378,7 @@ Function28926: ; 28926 hlcoord 0, 15 ld b, $1 ld c, $12 - call Function28eef + call Predef_LinkTextbox hlcoord 2, 16 ld de, String28ab4 call PlaceString @@ -1487,7 +1487,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, $4 ld c, $12 - call Function28eef + call Predef_LinkTextbox callba Function4d354 ld hl, UnknownText_0x28aaf bccoord 1, 14 @@ -1509,7 +1509,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, $4 ld c, $12 - call Function28eef + call Predef_LinkTextbox callba Function4d354 ld hl, UnknownText_0x28ac4 bccoord 1, 14 @@ -1519,7 +1519,7 @@ Function28926: ; 28926 hlcoord 0, 12 ld b, $4 ld c, $12 - call Function28eef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ece call PlaceString @@ -1666,7 +1666,7 @@ Function28b87: ; 28b87 hlcoord 0, 12 ld b, $4 ld c, $12 - call Function28eef + call Predef_LinkTextbox callba Function4d354 ld a, [wd002] ld hl, PartySpecies @@ -1695,7 +1695,7 @@ Function28b87: ; 28b87 hlcoord 10, 7 ld b, $3 ld c, $7 - call Function28eef + call Predef_LinkTextbox ld de, String28eab hlcoord 12, 8 call PlaceString @@ -1735,7 +1735,7 @@ Function28b87: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Function28eef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ece call PlaceString @@ -1752,7 +1752,7 @@ Function28b87: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Function28eef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ece call PlaceString @@ -1982,7 +1982,7 @@ Function28b87: ; 28b87 hlcoord 0, 12 ld b, 4 ld c, 18 - call Function28eef + call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ebd call PlaceString @@ -2019,10 +2019,10 @@ String28ece: ; 28ece next "was canceled!@" -Function28eef: ; 28eef +Predef_LinkTextbox: ; 28eef ld d, h ld e, l - callba Function16d6ca + callba LinkTextbox ret ; 28ef8 @@ -2041,11 +2041,11 @@ Function28f09: ; 28f09 hlcoord 0, 0 ld b, 6 ld c, 18 - call Function28eef + call Predef_LinkTextbox hlcoord 0, 8 ld b, 6 ld c, 18 - call Function28eef + call Predef_LinkTextbox callba Functionfb60d ret ; 28f24 diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 168c5389c..13e4f73bf 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -2736,7 +2736,7 @@ Function5602: ; 5602, called at battle start ld a, PLAYER call Function5629 ; respawn player - ld a, [wd459] + ld a, [wBattleScriptFlags] bit 7, a jr z, .ok diff --git a/engine/menu.asm b/engine/menu.asm index a1ec30b7a..6978a0e54 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -4,7 +4,7 @@ Function2400e:: ; 2400e rst FarCall call Function24085 call UpdateSprites - call Function321c + call ApplyTilemap call Function2408f ret ; 24022 @@ -16,7 +16,7 @@ Function24022:: ; 24022 call Function24085 callba MobileTextBorder call UpdateSprites - call Function321c + call ApplyTilemap call Function2408f ret ; 2403c @@ -28,7 +28,7 @@ Function2403c:: ; 2403c call Function24085 callba MobileTextBorder call UpdateSprites - call Function321c + call ApplyTilemap call Function2411a ld hl, wcfa5 set 7, [hl] diff --git a/engine/pokecenter_pc.asm b/engine/pokecenter_pc.asm index 4d296aab2..064b35a6c 100755 --- a/engine/pokecenter_pc.asm +++ b/engine/pokecenter_pc.asm @@ -188,7 +188,7 @@ _KrissHousePC: ; 156d9 and a jr nz, .asm_156f9 call OverworldTextModeSwitch - call Function321c + call ApplyTilemap call UpdateSprites call PC_PlayShutdownSound ld c, $0 @@ -466,16 +466,16 @@ UnknownText_0x158c7: ; 0x158c7 Function158cc: ; 0x158cc - ld a, [wc2ce] + ld a, [wSpriteUpdatesEnabled] push af ld a, $0 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a callba CheckItemMenu ld a, [wItemAttributeParamBuffer] ld hl, .jumptable rst JumpTable pop af - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ret ; 0x158e7 @@ -577,10 +577,10 @@ Function15985: ; 0x15985 xor a ld [wd0e3], a .asm_15989 - ld a, [wc2ce] + ld a, [wSpriteUpdatesEnabled] push af ld a, $0 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ld hl, MenuData15a08 call CopyMenuDataHeader hlcoord 0, 0 @@ -597,7 +597,7 @@ Function15985: ; 0x15985 ld a, [MenuSelection2] ld [wd0d7], a pop af - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ld a, [wd0e3] and a jr nz, .asm_159d8 diff --git a/engine/predef.asm b/engine/predef.asm index c089215a6..680a6b4a0 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -46,7 +46,7 @@ PredefPointers:: ; 856b add_predef CalcPkmnStatC add_predef CanLearnTMHMMove add_predef GetTMHMMove - add_predef Function28eef ; $ 10 + add_predef Predef_LinkTextbox ; $ 10 add_predef PrintMoveDesc add_predef UpdatePlayerHUD add_predef FillBox diff --git a/engine/scripting.asm b/engine/scripting.asm index 945368e2b..c80343a4c 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -929,7 +929,7 @@ Script_winlosstext: ; 9714c Script_talkaftercancel: ; 97163 ; script command 0x66 - ld a, [wd04d] + ld a, [wRunningTrainerBattleScript] and a ret z jp Script_end @@ -940,7 +940,7 @@ Script_talkaftercheck: ; 9716b ld a, 1 ld [ScriptVar], a - ld a, [wd04d] + ld a, [wRunningTrainerBattleScript] and a ret nz xor a @@ -1485,7 +1485,7 @@ Script_battlecheck: ; 973fb ; script command 0x5b xor a - ld [wd459], a + ld [wBattleScriptFlags], a ret ; 97400 @@ -1493,7 +1493,7 @@ Script_loadtrainerdata: ; 97400 ; script command 0x5c ld a, (1 << 7) | 1 - ld [wd459], a + ld [wBattleScriptFlags], a ld a, [WalkingDirection] ld [OtherTrainerClass], a ld a, [FacingDirection] @@ -1508,7 +1508,7 @@ Script_loadpokedata: ; 97412 ; level (DecimalParam) ld a, (1 << 7) - ld [wd459], a + ld [wBattleScriptFlags], a call GetScriptByte ld [TempWildMonSpecies], a call GetScriptByte @@ -1523,7 +1523,7 @@ Script_loadtrainer: ; 97424 ; trainer_id (TrainerIdParam) ld a, (1 << 7) | 1 - ld [wd459], a + ld [wBattleScriptFlags], a call GetScriptByte ld [OtherTrainerClass], a call GetScriptByte @@ -1557,7 +1557,7 @@ Script_catchtutorial: ; 97447 Script_returnafterbattle: ; 97459 ; script command 0x60 - ld hl, wd459 + ld hl, wBattleScriptFlags ld d, [hl] ld [hl], $0 ld a, [wBattleResult] @@ -1589,7 +1589,7 @@ Script_reloadmap: ; 97491 ; script command 0x7b xor a - ld [wd459], a + ld [wBattleScriptFlags], a ld a, MAPSETUP_RELOADMAP ld [hMapEntryMethod], a ld a, $1 diff --git a/engine/timeset.asm b/engine/timeset.asm index 0b0f12718..1f82da884 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -6,7 +6,7 @@ InitClock: ; 90672 (24:4672) ld [hInMenu], a ld a, $0 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ld a, $10 ld [MusicFade], a ld a, MUSIC_NONE % $100 @@ -436,7 +436,7 @@ Special_SetDayOfWeek: ; 90913 ld [hl], $f5 hlcoord 10, 5 call Function909de - call Function321c + call ApplyTilemap ld c, 10 call DelayFrames .asm_9096a diff --git a/event/kurt.asm b/event/kurt.asm index 272a96ca8..bb24f26ab 100644 --- a/event/kurt.asm +++ b/event/kurt.asm @@ -139,7 +139,7 @@ Kurt_SelectQuantity: ; 880c2 call UpdateSprites call .PlaceApricornName call PlaceApricornQuantity - call Function321c + call ApplyTilemap callba Function27a28 jr nc, .loop diff --git a/event/unown.asm b/event/unown.asm index 2d48dc695..789629ae0 100644 --- a/event/unown.asm +++ b/event/unown.asm @@ -124,7 +124,7 @@ Special_DisplayUnownWords: ; 8ae68 ld [hBGMapMode], a call MenuBox call UpdateSprites - call Function321c + call ApplyTilemap call MenuBoxCoord2Tile inc hl ld d, $0 diff --git a/home.asm b/home.asm index c5c8187df..2808df8fb 100644 --- a/home.asm +++ b/home.asm @@ -104,13 +104,13 @@ DisableSpriteUpdates:: ; 0x2ed3 res 0, a ld [VramState], a ld a, $0 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ret ; 0x2ee4 EnableSpriteUpdates:: ; 2ee4 ld a, $1 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ld a, [VramState] set 0, a ld [VramState], a @@ -568,12 +568,12 @@ IsCGB:: ; 3218 ; 321c -Function321c:: ; 321c +ApplyTilemap:: ; 321c ld a, [hCGB] and a jr z, .dmg - ld a, [wc2ce] + ld a, [wSpriteUpdatesEnabled] cp 0 jr z, .dmg @@ -1488,7 +1488,7 @@ LoadTrainer_continue:: ; 367e ld a, [EngineBuffer1] call FarCopyBytes xor a - ld [wd04d], a + ld [wRunningTrainerBattleScript], a scf ret ; 36a5 diff --git a/home/battle.asm b/home/battle.asm index 57bab4083..4786cc4d3 100644 --- a/home/battle.asm +++ b/home/battle.asm @@ -285,7 +285,7 @@ BattleTextBox:: ; 3ac3 call SpeechTextBox call MobileTextBorder call UpdateSprites - call Function321c + call ApplyTilemap pop hl call PrintTextBoxText ret diff --git a/home/map.asm b/home/map.asm index a93f208a4..d50c99349 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1091,7 +1091,7 @@ MapTextbox:: ; 269a call Function2e31 ld a, 1 ld [hOAMUpdate], a - call Function321c + call ApplyTilemap pop hl call PrintTextBoxText xor a @@ -2043,7 +2043,7 @@ Function2b5c:: ; 2b5c Function2b74:: ; 0x2b74 push af ld a, $1 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a call ClearBGPalettes call ClearSprites call Function2bae diff --git a/home/menu.asm b/home/menu.asm index 64f7e4d8c..4e7b7772b 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -77,7 +77,7 @@ InterpretMenu2:: call MenuBox call UpdateSprites call Function1c89 - call Function321c + call ApplyTilemap call CopyMenuData2 ld a, [wMenuData2Flags] bit 7, a @@ -262,7 +262,7 @@ MenuWriteText:: push af ld a, $1 ld [hOAMUpdate], a - call Function321c + call ApplyTilemap pop af ld [hOAMUpdate], a ret diff --git a/home/rtc.asm b/home/rtc.asm index 7070c0dad..9fb71c0be 100644 --- a/home/rtc.asm +++ b/home/rtc.asm @@ -2,7 +2,7 @@ RTC:: ; 46f ; update time and time-sensitive palettes ; rtc enabled? - ld a, [wc2ce] + ld a, [wSpriteUpdatesEnabled] cp 0 ret z diff --git a/home/text.asm b/home/text.asm index 2877f88dd..37208af9d 100644 --- a/home/text.asm +++ b/home/text.asm @@ -192,7 +192,7 @@ SetUpTextBox:: ; 106c push hl call SpeechTextBox call UpdateSprites - call Function321c + call ApplyTilemap pop hl ret ; 1078 diff --git a/home/tilemap.asm b/home/tilemap.asm index 3153cea2c..74ec17cee 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -16,7 +16,7 @@ Function1c10:: ; 0x1c10 WriteBackup:: ; 0x1c17 push af call ExitMenu - call Function321c + call ApplyTilemap call UpdateSprites pop af ret diff --git a/main.asm b/main.asm index dfff0d855..0117e41c3 100644 --- a/main.asm +++ b/main.asm @@ -17,7 +17,7 @@ PlaceWaitingText:: ; 4000 jr .proceed .notinbattle - predef Function28eef + predef Predef_LinkTextbox .proceed hlcoord 4, 11 @@ -9921,7 +9921,7 @@ Pokepic:: ; 244e3 call CopyMenuDataHeader call MenuBox call UpdateSprites - call Function321c + call ApplyTilemap ld b, SCGB_12 call GetSGBLayout xor a @@ -9955,7 +9955,7 @@ PokepicYesOrNo:: ; 24528 xor a ld [hBGMapMode], a call OverworldTextModeSwitch - call Function321c + call ApplyTilemap call UpdateSprites call LoadStandardFont ret @@ -10051,7 +10051,7 @@ Function245af:: ; 245af call Function24764 call Function247dd call Function245f1 - call Function321c + call ApplyTilemap xor a ld [hBGMapMode], a ret @@ -17539,7 +17539,7 @@ Buena_ExitMenu: ; 4ae5e call DelayFrame ld a, $1 ld [hOAMUpdate], a - call Function321c + call ApplyTilemap pop af ld [hOAMUpdate], a ret @@ -17856,7 +17856,7 @@ PhoneRing_LoadEDTile: ; 4d188 ld a, [hCGB] and a jp z, WaitBGMap - ld a, [wc2ce] + ld a, [wSpriteUpdatesEnabled] cp $0 jp z, WaitBGMap @@ -22713,7 +22713,7 @@ StartBattleWithMapTrainerScript: ; 0xbe68a startbattle returnafterbattle trainerstatus SET_FLAG - loadvar wd04d, -1 + loadvar wRunningTrainerBattleScript, -1 AlreadyBeatenTrainerScript: scripttalkafter @@ -24096,7 +24096,7 @@ LoadMapTimeOfDay: ; 104750 ld hl, VramState res 6, [hl] ld a, $1 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a callba Function8c0e5 callba Function8c001 call OverworldTextModeSwitch diff --git a/misc/mobile_22.asm b/misc/mobile_22.asm index 3e21f1365..061e67117 100644 --- a/misc/mobile_22.asm +++ b/misc/mobile_22.asm @@ -150,13 +150,13 @@ Function891fe: ; 891fe Function89209: ; 89209 ld a, 1 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ret ; 8920f Function8920f: ; 8920f ld a, 0 - ld [wc2ce], a + ld [wSpriteUpdatesEnabled], a ret ; 89215 diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 51fbcbd65..00581de06 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -838,7 +838,7 @@ Jumptable_10052a: ; 10052a Function100534: ; 100534 call Function100513 call UpdateSprites - call Function321c + call ApplyTilemap ld a, [wcd28] inc a ld [wcd28], a @@ -1847,7 +1847,7 @@ Function100b7a: ; 100b7a callba Function24085 callba MobileTextBorder call UpdateSprites - call Function321c + call ApplyTilemap callba Function2411a ld hl, wcfa5 set 7, [hl] diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm index ac44da8cd..836da4fa0 100755 --- a/misc/mobile_46.asm +++ b/misc/mobile_46.asm @@ -1290,7 +1290,7 @@ Function118936: call LoadMenuDataHeader call MenuBox call MenuBoxCoord2Tile - call Function321c + call ApplyTilemap hlcoord 16, 8, AttrMap ld a, $40 or [hl] @@ -4745,7 +4745,7 @@ Function11a207: ; 11a207 call LoadMenuDataHeader call MenuBox call MenuBoxCoord2Tile - call Function321c + call ApplyTilemap hlcoord 16, 8 ld de, String_11a2cf call PlaceString diff --git a/misc/mobile_5b.asm b/misc/mobile_5b.asm index f4956bff9..19d192aeb 100755 --- a/misc/mobile_5b.asm +++ b/misc/mobile_5b.asm @@ -1028,7 +1028,7 @@ Function16d6ae: ; 16d6ae ret ; 16d6ca -Function16d6ca: ; 16d6ca +LinkTextbox: ; 16d6ca call Function16d61d ret ; 16d6ce @@ -1046,7 +1046,7 @@ Function16d6e1: ; 16d6e1 hlcoord 4, 10 ld b, 1 ld c, 10 - predef Function28eef + predef Predef_LinkTextbox hlcoord 5, 11 ld de, .Waiting call PlaceString diff --git a/wram.asm b/wram.asm index 00b4956b2..30b02eac4 100644 --- a/wram.asm +++ b/wram.asm @@ -311,7 +311,7 @@ AutoInputLength:: ; c2cb wc2cc:: ds 1 wc2cd:: ds 1 -wc2ce:: ds 1 +wSpriteUpdatesEnabled:: ds 1 wc2cf:: ds 1 wc2d0:: ds 4 wc2d4:: ds 1 @@ -1679,7 +1679,7 @@ wd048:: ds 1 wLossTextPointer:: ds 2 wScriptAfterPointer:: wd04b:: ds 2 -wd04d:: ds 1 +wRunningTrainerBattleScript:: ds 1 MenuItemsListEnd:: wTempTrainerHeaderEnd:: wd04e:: ds 2 @@ -2221,7 +2221,7 @@ wd453:: ds 1 wd454:: ds 1 ds 4 -wd459:: ds 2 +wBattleScriptFlags:: ds 2 wPlayerSpriteSetupFlags:: ds 1 wMapReentryScriptQueueFlag:: ds 1 ; MemScriptFlag wMapReentryScriptBank:: ds 1 ; MemScriptBank