Apply most of pokecrystal PR 1105

This commit is contained in:
xCrystal 2024-02-11 00:16:00 +01:00
parent 971c4aa2c7
commit 5c4d982702
74 changed files with 276 additions and 276 deletions

View File

@ -53,10 +53,10 @@ SpecialsPointers::
add_special CardFlip
add_special UnusedMemoryGame ; unused
add_special ClearBGPalettesBufferScreen ; unused
add_special FadeOutPalettesToWhite
add_special FadeOutPalettesToBlack
add_special FadeInPalettesFromWhite
add_special FadeInPalettesFromBlack
add_special FadeOutToWhite
add_special FadeOutToBlack
add_special FadeInFromWhite
add_special FadeInFromBlack
add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0

View File

@ -33,8 +33,8 @@ MapSetupCommands:
add_mapsetup LoadMapAttributes ; 1a
add_mapsetup LoadMapAttributes_SkipObjects ; 1b
add_mapsetup ClearBGPalettes ; 1c
add_mapsetup FadeOutPalettesToWhite ; 1d
add_mapsetup FadeInPalettesFromWhite ; 1e
add_mapsetup FadeOutToWhite ; 1d
add_mapsetup FadeInFromWhite ; 1e
add_mapsetup GetMapScreenCoords ; 1f
add_mapsetup GetWarpDestCoords ; 20
add_mapsetup SpawnInFacingDown ; 21

View File

@ -44,7 +44,7 @@ MapSetupScript_EnterLevel:
mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike
mapsetup FadeInToMusic
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ConstructAndEnableOverworldHUD
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
@ -54,7 +54,7 @@ MapSetupScript_EnterLevel:
MapSetupScript_Teleport:
mapsetup ResetPlayerObjectAction
MapSetupScript_Fly:
mapsetup FadeOutPalettesToWhite
mapsetup FadeOutToWhite
mapsetup JumpRoamMons
MapSetupScript_Warp:
mapsetup DisableLCD
@ -78,7 +78,7 @@ MapSetupScript_Warp:
mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike
mapsetup FadeInToMusic
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
mapsetup AnchorPointAfterWarp
@ -106,7 +106,7 @@ MapSetupScript_BadWarp:
mapsetup SpawnInFacingDown
mapsetup RefreshMapSprites
mapsetup FadeToMapMusic
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
mapsetup AnchorPointAfterWarp
@ -138,7 +138,7 @@ MapSetupScript_Connection:
MapSetupScript_Fall:
mapsetup ResetPlayerObjectAction
MapSetupScript_Door:
mapsetup FadeOutPalettesToWhite
mapsetup FadeOutToWhite
MapSetupScript_Train:
mapsetup BackupMapObjects
mapsetup EnterMapWarp
@ -158,7 +158,7 @@ MapSetupScript_Train:
mapsetup LoadMapPalettes
mapsetup RefreshMapSprites
mapsetup FadeToMapMusic
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
mapsetup UpdateRoamMons
@ -180,7 +180,7 @@ MapSetupScript_ReloadMap:
mapsetup LoadMapPalettes
mapsetup RefreshMapSprites
mapsetup ForceMapMusic
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup EnableOverworldHUD
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
@ -205,7 +205,7 @@ MapSetupScript_ExitViewMap:
mapsetup LoadMapPalettes
mapsetup SpawnInCustomFacing ; restore player's facing if in branch space
mapsetup RefreshMapSprites
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup EnableOverworldHUD
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
@ -226,7 +226,7 @@ MapSetupScript_LinkReturn:
mapsetup LoadMapPalettes
mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData
mapsetup EnableTextAcceleration
@ -249,7 +249,7 @@ MapSetupScript_Continue:
mapsetup LoadMapPalettes
mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike
mapsetup FadeInPalettesFromWhite
mapsetup FadeInFromWhite
mapsetup ConstructAndEnableOverworldHUD
mapsetup ActivateMapAnims
mapsetup LoadWildMonData

View File

@ -35,14 +35,14 @@
#### Overworld map scrolling
- **LoadScreenTilemap**: From the metatile-based 24x20 map in wSurroundingTiles, load the corresponding 20x18 tiles to wTilemap. Later, BackupBGMap* from ScrollMap* copies new row/column from wTilemap to wBGMapBuffer. _ScrollBGMapPalettes populates wBGMapPalBuffer based on the tiles at wBGMapBuffer. These are read during vblank by UpdateBGMapBuffer.
- **LoadScreenAttrmapPals**: Load wAttrmap palette numbers based on the tileset palettes of the current map. Called only by LoadScreenTilemapAndAttrmapPals.
- **LoadScreenTilemapAndAttrmapPals**: LoadScreenTilemap + LoadScreenAttrmapPals. Often used to reload screen after closing a text box.
- **LoadOverworldTilemap**: From the metatile-based 24x20 map in wSurroundingTiles, load the corresponding 20x18 tiles to wTilemap. Later, BackupBGMap* from ScrollMap* copies new row/column from wTilemap to wBGMapBuffer. _ScrollBGMapPalettes populates wBGMapPalBuffer based on the tiles at wBGMapBuffer. These are read during vblank by UpdateBGMapBuffer.
- **LoadOverworldAttrmapPals**: Load wAttrmap palette numbers based on the tileset palettes of the current map. Called only by LoadOverworldTilemapAndAttrmapPals.
- **LoadOverworldTilemapAndAttrmapPals**: LoadOverworldTilemap + LoadOverworldAttrmapPals. Often used to reload screen after closing a text box.
#### Overworld map anchoring
- **ReanchorBGMap_NoOAMUpdate**: LoadScreenTilemapAndAttrmapPals + HDMATransferTilemapAndAttrmap_OpenAndCloseMenu, then fill BG map with all black while Window is displayed, finally anchor map and objects. Shall by followed by CopyTilemapAtOnce or by a HDMATransferTilemapAndAttrmap_* to redraw the screen.
- **OpenText1bpp**, **OpenText2bpp**: ClearMenuAndWindowData + ReanchorBGMap_NoOAMUpdate + SpeechTextbox1bpp + HDMATransferTilemapAndAttrmap_OpenAndCloseMenu + hide Window
- **ReanchorBGMap_NoOAMUpdate**: LoadOverworldTilemapAndAttrmapPals + HDMATransferTilemapAndAttrmap_Menu, then fill BG map with all black while Window is displayed, finally anchor map and objects. Shall by followed by CopyTilemapAtOnce or by a HDMATransferTilemapAndAttrmap_* to redraw the screen.
- **OpenText1bpp**, **OpenText2bpp**: ClearMenuAndWindowData + ReanchorBGMap_NoOAMUpdate + SpeechTextbox1bpp + HDMATransferTilemapAndAttrmap_Menu + hide Window
- **OpenText1bpp**: Loads 1bpp font (LoadFont_NoOAMUpdate)
- **OpenText2bpp**: Doesn't load 2bpp font
- **RefreshScreen**: Same as OpenText functions but doesn't call any SpeechTextbox
@ -55,7 +55,7 @@
- **HDMATransfer1bpp**: Copy 1bpp tiles via HDMA. Maximum 16 tiles per frame
- **HDMATransfer2bpp**: Copy 2bpp tiles via HDMA. No hardcoded limit. Timing considers 1 tile per hblank
- **Get1bppViaHDMA**, **Get2bppViaHDMA**: Call Copy1bpp or Copy2bpp if LCD disabled. HDMATransfer1bpp or HDMATransfer2bpp otherwise
- **HDMATransferTilemapAndAttrmap_OpenAndCloseMenu**, **HDMATransferTilemapAndAttrmap_OverworldEffect**: Similar, but with slightly different scanline timing. So they're essentially like RefreshScreen minus the anchoring part.
- **HDMATransferTilemapAndAttrmap_Menu**, **HDMATransferTilemapAndAttrmap_Overworld**: Similar, but with slightly different scanline timing. So they're essentially like RefreshScreen minus the anchoring part.
#### HUD
@ -69,8 +69,8 @@
## Scripts
- **refreshscreen**: RefreshScreen
- **reloadmappart**: LoadScreenTilemapAndAttrmapPals + GetMovementPermissions + HDMATransferTilemapAndAttrmap_OverworldEffect + UpdateSprites. Similar to refreshscreen, but does not reanchor. On the other hand, it refreshes movement permissions. Often used after a block change or field move, which can affect collisions.
- **reanchormap**: RefreshScreen
- **refreshmap**: LoadOverworldTilemapAndAttrmapPals + GetMovementPermissions + HDMATransferTilemapAndAttrmap_Overworld + UpdateSprites. Similar to reanchormap, but does not reanchor. On the other hand, it refreshes movement permissions. Often used after a block change or field move, which can affect collisions.
## Changes
@ -130,19 +130,19 @@
### Overworld workflow
1) ``OverworldLoop`` is called from ``GameMenu_WorldMap`` with either ``hMapEntryMethod`` = ``MAPSETUP_ENTERLEVEL`` or ``hMapEntryMethod`` = ``MAPSETUP_CONTINUE``.
2) ``StartMap`` resets ``wCurTurn`` and ``wCurSpace`` if ``MAPSETUP_ENTERLEVEL``. ``StartMap`` sets ``hCurBoardEvent`` to ``BOARDEVENT_DISPLAY_MENU``. ``wScriptFlags2`` is cleared. ``wMapStatus`` is set to ``MAPSTATUS_HANDLE`` causing ``HandleMap`` to be called.
2) ``StartMap`` resets ``wCurTurn`` and ``wCurSpace`` if ``MAPSETUP_ENTERLEVEL``. ``StartMap`` sets ``hCurBoardEvent`` to ``BOARDEVENT_DISPLAY_MENU``. ``wEnabledPlayerEvents`` is cleared. ``wMapStatus`` is set to ``MAPSTATUS_HANDLE`` causing ``HandleMap`` to be called.
3) ``MapEvents`` (from ``HandleMap``) calls ``PlayerEvents``. ``CheckBoardEvent`` queues ``BoardMenuScript`` which is executed by ``ScriptEvents``.
4) ``BoardMenuScript.Upkeep`` saves the game, clears ``wTurnData[]``, increases ``wCurTurn``, and loads current space to ``wCurSpaceStruct[]``.
- If player exits, the ``exitoverworld`` script sets ``wMapStatus`` to ``MAPSTATUS_DONE``. This causes ``OverworldLoop`` to return back to the game menu. **Exit this workflow**.
5) Player rolls die and the animation plays. After the animation, ``wDisplaySecondarySprites.SECONDARYSPRITES_SPACES_LEFT_F`` is set and ``hCurBoardEvent`` is set to ``BOARDEVENT_HANDLE_BOARD``. At the end of this ``HandleMap`` iteration, ``CheckPlayerState`` sets ``wMapEventStatus`` to ``MAPEVENTS_ON`` (``wScriptFlags2`` is not touched so it remains cleared).
6) In the next ``HandleMap`` iteration, ``CheckBoardEvent`` from ``PlayerEvents`` jumps to ``.board`` and then to ``.no_space_effect`` due to ``wScriptFlags2[4]`` not being set.
5) Player rolls die and the animation plays. After the animation, ``wDisplaySecondarySprites.SECONDARYSPRITES_SPACES_LEFT_F`` is set and ``hCurBoardEvent`` is set to ``BOARDEVENT_HANDLE_BOARD``. At the end of this ``HandleMap`` iteration, ``CheckPlayerState`` sets ``wMapEventStatus`` to ``MAPEVENTS_ON`` (``wEnabledPlayerEvents`` is not touched so it remains cleared).
6) In the next ``HandleMap`` iteration, ``CheckBoardEvent`` from ``PlayerEvents`` jumps to ``.board`` and then to ``.no_space_effect`` due to ``wEnabledPlayerEvents[4]`` not being set.
7) Execution continues in ``PlayerEvents``; ``OWPlayerInput`` is eventually called, and thus ``DoPlayerMovement``. Here, ``StepTowardsNextSpace`` computes based on ``wCurSpaceNextSpace`` what direction key to write to ``wCurInput``, causing the player to begin a movement in that direction.
8) The player may need to turn to a different direction through the ``ChangeDirectionScript`` (when ``DoPlayerMovement`` returns with ``PLAYERMOVEMENT_TURN``). Otherwise or after that, ``CheckPlayerState`` sets ``wMapEventStatus`` to ``MAPEVENTS_OFF``,
9) When the step finishes (i.e. ``PLAYERSTEP_STOP_F`` becomes set) in some ``HandleMap`` iteration, ``CheckPlayerState`` sets ``wScriptFlags2`` to $ff and ``wMapEventStatus`` to ``MAPEVENTS_ON``.
10) In the next ``HandleMap`` iteration, ``CheckBoardEvent.board`` is called with ``wScriptFlags2[4]`` set.
- If ``wCurSpaceNextSpace`` matches ``NEXT_SPACE_IS_ANCHOR_POINT``: If player is at a tile with an anchor event, ``wCurSpaceNextSpace`` is updated with the next space byte of salid anchor event. ``wScriptFlags2[4]`` is reset. **Go back to 7**.
- If player is not above a tile (``wPlayerTile``) with a space collision: ``wScriptFlags2[4]`` is reset. **Go back to 7**.
- If player is above a tile, the corresponding space script is queued to be executed by ``ScriptEvents`` in the current ``HandleMap`` iteration. ``wScriptFlags2[4]`` is reset. **Continue to 11**.
9) When the step finishes (i.e. ``PLAYERSTEP_STOP_F`` becomes set) in some ``HandleMap`` iteration, ``CheckPlayerState`` sets ``wEnabledPlayerEvents`` to $ff and ``wMapEventStatus`` to ``MAPEVENTS_ON``.
10) In the next ``HandleMap`` iteration, ``CheckBoardEvent.board`` is called with ``wEnabledPlayerEvents[4]`` set.
- If ``wCurSpaceNextSpace`` matches ``NEXT_SPACE_IS_ANCHOR_POINT``: If player is at a tile with an anchor event, ``wCurSpaceNextSpace`` is updated with the next space byte of salid anchor event. ``wEnabledPlayerEvents[4]`` is reset. **Go back to 7**.
- If player is not above a tile (``wPlayerTile``) with a space collision: ``wEnabledPlayerEvents[4]`` is reset. **Go back to 7**.
- If player is above a tile, the corresponding space script is queued to be executed by ``ScriptEvents`` in the current ``HandleMap`` iteration. ``wEnabledPlayerEvents[4]`` is reset. **Continue to 11**.
11) The space script loads the value of ``wCurSpaceNextSpace`` into ``wCurSpace``, and loads the new space data to ``wCurSpaceStruct[]``. Unless the space is a Branch Space or a Union Space, ``wSpacesLeft`` is decreased.
- If the space is a Branch Space, the branch data is loaded to ``wTempSpaceBranchStruct``. Then the player is prompted to choose a valid direction. ``wCurSpaceNextSpace`` is populated with the next space that corresponds to the chosen direction. **Go back to 6**.
- If the space is an End Space, a fading out animation plays and then the ``exitoverworld`` script sets ``wMapStatus`` to ``MAPSTATUS_DONE``. This causes ``OverworldLoop`` to return back to the game menu. **Exit this workflow**.

View File

@ -257,7 +257,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[hScriptVar]` i
## `$47`: `opentext`
## `$48`: <code>refreshscreen [<i>dummy</i>=0]</code>
## `$48`: <code>reanchormap [<i>dummy</i>=0]</code>
## `$49`: `closetext`
@ -419,7 +419,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[hScriptVar]` i
## `$7B`: `reloadmap`
## `$7C`: `reloadmappart`
## `$7C`: `refreshmap`
## `$7D`: <code>writecmdqueue <i>queue_pointer</i></code>

View File

@ -2655,7 +2655,7 @@ ForcePlayerMonChoice:
call LoadTilemapToTempTilemap
call WaitBGMap
call GetMemCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ld c, a
ret
@ -2674,7 +2674,7 @@ ForcePlayerMonChoice:
call _LoadHPBar
call CloseWindow
call GetMemCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call SendOutMonText
call NewBattleMonStatus
call BreakAttraction
@ -2718,7 +2718,7 @@ JumpToPartyMenuAndPrintText:
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
ret
@ -2817,7 +2817,7 @@ LostBattle:
; Grayscale
ld b, CGB_BATTLE_GRAYSCALE
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
jr .end
.LostLinkBattle:
@ -4845,7 +4845,7 @@ BattleMenu_Pack:
and BATTLERESULT_BITMASK
ld [wBattleResult], a ; WIN
call ClearMenuAndWindowData
call SetPalettes
call SetDefaultBGPAndOBP
scf
ret
@ -4891,7 +4891,7 @@ BattleMenuPKMN_Loop:
call CloseWindow
call LoadTilemapToTempTilemap
call GetMemCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
jp BattleMenu
.GetMenu:
@ -4971,7 +4971,7 @@ TryPlayerSwitch:
call _LoadHPBar
call CloseWindow
call GetMemCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, [wCurPartyMon]
ld [wCurBattleMon], a
PlayerSwitch:
@ -6797,7 +6797,7 @@ FinishBattleAnim:
push hl
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
pop hl
pop de
@ -8238,7 +8238,7 @@ _DisplayLinkRecord:
call WaitBGMap2
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld c, 8
call DelayFrames
call WaitPressAorB_BlinkCursor
@ -8718,7 +8718,7 @@ InitBattleDisplay:
call HideSprites
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, $90
ldh [hWY], a
xor a
@ -8854,7 +8854,7 @@ BattleStartMessage:
farcall Battle_GetTrainerName
ld hl, WantsToBattleText
jr .PlaceBattleStartText
jr .PrintBattleStartText
.wild
call BattleCheckEnemyShininess
@ -8894,18 +8894,18 @@ BattleStartMessage:
jr nz, .NotFishing
ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText
jr .PrintBattleStartText
.NotFishing:
ld hl, PokemonFellFromTreeText
cp BATTLETYPE_TREE
jr z, .PlaceBattleStartText
jr z, .PrintBattleStartText
ld hl, WildCelebiAppearedText
cp BATTLETYPE_CELEBI
jr z, .PlaceBattleStartText
jr z, .PrintBattleStartText
ld hl, WildPokemonAppearedText
.PlaceBattleStartText:
.PrintBattleStartText:
push hl
farcall BattleStart_TrainerHuds
pop hl

View File

@ -29,7 +29,7 @@ BattleCommand_BatonPass:
call ClearBox
ld b, CGB_BATTLE_COLORS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call BatonPass_LinkPlayerSwitch
ld hl, PassedBattleMonEntrance

View File

@ -16,4 +16,4 @@ _ReturnToBattle_UseBall:
call CloseWindow
call LoadStandardMenuHeader
call WaitBGMap
jp SetPalettes
jp SetDefaultBGPAndOBP

View File

@ -252,7 +252,7 @@ _ShowLinkBattleParticipants:
farcall LinkBattle_TrainerHuds ; no need to farcall
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, $e4
ldh [rOBP0], a
ret

View File

@ -271,7 +271,7 @@ DEF DIE_MAX_NUMBER EQU 6
set SECONDARYSPRITES_DIE_ROLL_F, [hl]
ld a, 1
ld [wDieRoll], a
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ;
call HDMATransferTilemapAndAttrmap_Menu ;
call CloseText ; closetext
.rotate_die_loop
@ -454,7 +454,7 @@ BoardMenu_OpenSubmenu:
ld [wMenuReturn], a
ldh [hBGMapMode], a
call LoadStandardMenuHeader
farcall FadeOutPalettesToWhite
farcall FadeOutToWhite
call DisableOverworldHUD
ld a, FALSE
ld [wText2bpp], a
@ -477,6 +477,6 @@ BoardMenu_CloseSubmenu:
ld b, CGB_MAPPALS
call GetCGBLayout
call WaitBGMap2
farcall FadeInPalettesFromWhite
farcall FadeInFromWhite
call EnableSpriteUpdates
ret

View File

@ -1023,7 +1023,7 @@ TilesetColorPicker: ; unreferenced
ld [wDebugTilesetCurColor], a
ldh [hMapAnims], a
call ClearSprites
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call WaitBGMap2
xor a
ldh [hBGMapMode], a

View File

@ -606,7 +606,7 @@ DebugRoom_EditPagedValues:
call WaitBGMap
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
.resume
call DelayFrame
call JoyTextDelay

View File

@ -76,7 +76,7 @@ DisplayCaughtContestMonStats:
call WaitBGMap
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ret
.Health:

View File

@ -31,7 +31,7 @@ PlaceDiplomaOnScreen:
call WaitBGMap
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
ret

View File

@ -27,14 +27,14 @@ UseFlashAuto::
ret
BlindingFlash:
farcall FadeOutPalettesToWhite
farcall FadeOutToWhite
ld hl, wStatusFlags
set STATUSFLAGS_FLASH_F, [hl]
farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal
ld b, CGB_MAPPALS
call GetCGBLayout
farcall FadeInPalettesFromWhite
farcall FadeInFromWhite
ret
ShakeHeadbuttTree:
@ -75,7 +75,7 @@ ShakeHeadbuttTree:
jr .loop
.done
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call WaitBGMap
xor a
ldh [hBGMapMode], a

View File

@ -39,7 +39,7 @@ RedCredits::
ld [wMusicFadeID + 1], a
ld a, 10
ld [wMusicFade], a
farcall FadeOutPalettesToWhite
farcall FadeOutToWhite
xor a
ld [wVramState], a
ldh [hMapAnims], a
@ -59,7 +59,7 @@ HallOfFame_FadeOutMusic:
ld [wMusicFadeID + 1], a
ld a, 10
ld [wMusicFade], a
farcall FadeOutPalettesToWhite
farcall FadeOutToWhite
xor a
ld [wVramState], a
ldh [hMapAnims], a
@ -252,7 +252,7 @@ AnimateHOFMonEntrance:
ldh [hBGMapMode], a
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call HOF_SlideBackpic
xor a
ld [wBoxAlignment], a
@ -385,7 +385,7 @@ _HallOfFamePC:
call WaitBGMap
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
decoord 6, 5
ld c, ANIM_MON_HOF
predef HOF_AnimateFrontpic
@ -535,7 +535,7 @@ HOF_AnimatePlayerPic:
ld [wCurPartySpecies], a
ld b, CGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call HOF_SlideBackpic
xor a
ld [wBoxAlignment], a

View File

@ -27,7 +27,7 @@ ItemFinder:
ret
.Script_FoundSomething:
reloadmappart
refreshmap
special UpdateTimePals
callasm .ItemfinderSound
writetext .ItemfinderItemNearbyText
@ -35,7 +35,7 @@ ItemFinder:
end
.Script_FoundNothing:
reloadmappart
refreshmap
special UpdateTimePals
writetext .ItemfinderNopeText
closetext

View File

@ -200,13 +200,13 @@ CheckMapForSomethingToCut:
ret
Script_CutFromMenu:
reloadmappart
refreshmap
special UpdateTimePals
Script_Cut:
callasm GetPartyNickname
writetext UseCutText
reloadmappart
refreshmap
callasm CutDownTreeOrGrass
closetext
end
@ -220,7 +220,7 @@ CutDownTreeOrGrass:
ld [hl], a
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call UpdateSprites
call DelayFrame
ld a, [wCutWhirlpoolAnimationType]
@ -234,11 +234,11 @@ CutDownTreeOrGrass:
ret
Script_CutAuto::
refreshscreen
reanchormap
callasm CutDownTreeObject
disappear LAST_TALKED
special SetObjectToRemainHidden
reloadmappart
refreshmap
end
CutDownTreeObject:
@ -319,7 +319,7 @@ UseFlash:
jp QueueScript
Script_UseFlash:
reloadmappart
refreshmap
special UpdateTimePals
writetext UseFlashTextScript
callasm BlindingFlash
@ -624,7 +624,7 @@ FlyFunction:
ret
.FlyScript:
reloadmappart
refreshmap
callasm HideSprites
special UpdateTimePals
callasm FlyFromAnim
@ -696,7 +696,7 @@ Script_WaterfallAuto::
step_end
Script_WaterfallFromMenu:
reloadmappart
refreshmap
special UpdateTimePals
Script_UsedWaterfall:
@ -865,13 +865,13 @@ EscapeRopeOrDig:
text_end
.UsedEscapeRopeScript:
reloadmappart
refreshmap
special UpdateTimePals
writetext .UseEscapeRopeText
sjump .UsedDigOrEscapeRopeScript
.UsedDigScript:
reloadmappart
refreshmap
special UpdateTimePals
writetext .UseDigText
@ -957,11 +957,11 @@ TeleportFunction:
text_end
.TeleportScript:
reloadmappart
refreshmap
special UpdateTimePals
writetext .TeleportReturnText
pause 60
reloadmappart
refreshmap
closetext
playsound SFX_WARP_TO
applymovement PLAYER, .TeleportFrom
@ -1027,7 +1027,7 @@ SetStrengthFlag:
ret
Script_StrengthFromMenu:
reloadmappart
refreshmap
special UpdateTimePals
Script_UsedStrength:
@ -1186,13 +1186,13 @@ TryWhirlpoolMenu:
ret
Script_WhirlpoolFromMenu:
reloadmappart
refreshmap
special UpdateTimePals
Script_UsedWhirlpool:
callasm GetPartyNickname
writetext UseWhirlpoolText
reloadmappart
refreshmap
callasm DisappearWhirlpool
closetext
end
@ -1206,7 +1206,7 @@ DisappearWhirlpool:
ld [hl], a
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
ld a, [wCutWhirlpoolAnimationType]
ld e, a
farcall PlayWhirlpoolSound
@ -1285,14 +1285,14 @@ HeadbuttNothingText:
text_end
HeadbuttFromMenuScript:
reloadmappart
refreshmap
special UpdateTimePals
HeadbuttScript:
callasm GetPartyNickname
writetext UseHeadbuttText
reloadmappart
refreshmap
callasm ShakeHeadbuttTree
callasm TreeMonEncounter
@ -1382,7 +1382,7 @@ GetFacingObject:
ret
RockSmashFromMenuScript:
reloadmappart
refreshmap
special UpdateTimePals
RockSmashScript:
@ -1618,7 +1618,7 @@ Fishing_CheckFacingUp:
ret
Script_FishCastRod:
reloadmappart
refreshmap
loadmem hBGMapMode, $0
special UpdateTimePals
loademote EMOTE_ROD
@ -1735,7 +1735,7 @@ BikeFunction:
ret
Script_GetOnBike:
reloadmappart
refreshmap
special UpdateTimePals
loadvar VAR_MOVEMENT, PLAYER_BIKE
writetext GotOnBikeText
@ -1751,7 +1751,7 @@ Script_GetOnBike_Register:
end
Script_GetOffBike:
reloadmappart
refreshmap
special UpdateTimePals
loadvar VAR_MOVEMENT, PLAYER_NORMAL
writetext GotOffBikeText

View File

@ -212,7 +212,7 @@ _PlayersHousePC:
call _PlayersPC
and a
jr nz, .changed_deco_tiles
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call ApplyTilemap
call UpdateSprites
call PC_PlayShutdownSound

View File

@ -35,7 +35,7 @@ ClosePokepic::
call GetMemCGBLayout
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call ApplyTilemap
call UpdateSprites
call LoadStandardFont

View File

@ -64,7 +64,7 @@ _UnownPrinter:
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
.joy_loop
call JoyTextDelay

View File

@ -47,14 +47,14 @@ CheckAnyFaintedMon:
SacredAshScript:
special HealParty
reloadmappart
refreshmap
playsound SFX_WARP_TO
special FadeOutPalettesToWhite
special FadeInPalettesFromWhite
special FadeOutPalettesToWhite
special FadeInPalettesFromWhite
special FadeOutPalettesToWhite
special FadeInPalettesFromWhite
special FadeOutToWhite
special FadeInFromWhite
special FadeOutToWhite
special FadeInFromWhite
special FadeOutToWhite
special FadeInFromWhite
waitsfx
writetext .UseSacredAshText
playsound SFX_CAUGHT_MON

View File

@ -6,7 +6,7 @@ SweetScentFromMenu:
ret
.SweetScent:
reloadmappart
refreshmap
special UpdateTimePals
callasm GetPartyNickname
writetext UseSweetScentText
@ -30,7 +30,7 @@ SweetScentNothing:
end
SweetScentEncounter:
farcall CanEncounterWildMonInThisTile
farcall CanEncounterWildMon
jr nc, .no_battle
ld hl, wStatusFlags2
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]

View File

@ -3,13 +3,13 @@ Script_BattleWhiteout::
sjump Script_Whiteout
OverworldWhiteoutScript::
refreshscreen
reanchormap
callasm OverworldBGMap
Script_Whiteout:
writetext .WhitedOutText
waitbutton
special FadeOutPalettesToWhite
special FadeOutToWhite
pause 40
special HealParty
checkflag ENGINE_BUG_CONTEST_TIMER
@ -45,7 +45,7 @@ OverworldBGMap:
BattleBGMap:
ld b, CGB_BATTLE_GRAYSCALE
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ret
HalveCoins:

View File

@ -26,7 +26,7 @@ HDMATransferAttrmapToWRAMBank3:
call HDMATransferToWRAMBank3
ret
HDMATransferTilemapAndAttrmap_OverworldEffect::
HDMATransferTilemapAndAttrmap_Overworld::
ld hl, .Function
jp CallInSafeGFXMode
@ -60,18 +60,18 @@ HDMATransferTilemapAndAttrmap_OverworldEffect::
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
call HDMATransfer_EndBeforeScanline128_toBGMap
call HDMATransfer_WaitForScanline128_toBGMap
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
call HDMATransfer_EndBeforeScanline128_toBGMap
call HDMATransfer_WaitForScanline128_toBGMap
pop af
ldh [rVBK], a
ei
ret
_HDMATransferTilemapAndAttrmap_OpenAndCloseMenu::
_HDMATransferTilemapAndAttrmap_Menu::
ld hl, .Function
jp CallInSafeGFXMode
@ -105,11 +105,11 @@ _HDMATransferTilemapAndAttrmap_OpenAndCloseMenu::
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
call HDMATransfer_EndBeforeScanline124_toBGMap
call HDMATransfer_WaitForScanline124_toBGMap
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
call HDMATransfer_EndBeforeScanline124_toBGMap
call HDMATransfer_WaitForScanline124_toBGMap
pop af
ldh [rVBK], a
ei
@ -158,7 +158,7 @@ WaitDMATransfer:
jr nz, .loop
ret
HDMATransfer_EndBeforeScanline128_toBGMap:
HDMATransfer_WaitForScanline128_toBGMap:
; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
; 2 * SCREEN_HEIGHT -> c
@ -167,9 +167,9 @@ HDMATransfer_EndBeforeScanline128_toBGMap:
ldh a, [hBGMapAddress]
ld e, a
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_EndBeforeScanline128
jr HDMATransfer_WaitForScanline128
HDMATransfer_EndBeforeScanline124_toBGMap:
HDMATransfer_WaitForScanline124_toBGMap:
; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
; 2 * SCREEN_HEIGHT -> c
@ -179,7 +179,7 @@ HDMATransfer_EndBeforeScanline124_toBGMap:
ldh a, [hBGMapAddress]
ld e, a
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_EndBeforeScanline124
jr HDMATransfer_WaitForScanline124
HDMATransfer_NoDI:
; HDMA transfer from hl to [hBGMapAddress]
@ -240,11 +240,11 @@ HDMATransfer_NoDI:
res 7, [hl]
ret
HDMATransfer_EndBeforeScanline124:
HDMATransfer_WaitForScanline124:
ld b, 124 - 1
jr _continue_HDMATransfer
HDMATransfer_EndBeforeScanline128:
HDMATransfer_WaitForScanline128:
ld b, 128 - 1
_continue_HDMATransfer:
; a lot of waiting around for hardware registers
@ -411,7 +411,7 @@ HDMATransfer2bpp::
ld d, h
ld e, l
ld hl, wScratchTilemap
call HDMATransfer_EndBeforeScanline128
call HDMATransfer_WaitForScanline128
; restore the previous bank
pop af
@ -476,7 +476,7 @@ HDMATransfer1bpp::
ld d, h
ld e, l
ld hl, wScratchTilemap
call HDMATransfer_EndBeforeScanline128
call HDMATransfer_WaitForScanline128
pop af
ldh [rSVBK], a
@ -498,13 +498,13 @@ HDMATransfer_OnlyTopFourRows:
ld c, $8
ld hl, wScratchTilemap + $80
debgcoord 0, 0, vBGMap1
call HDMATransfer_EndBeforeScanline128
call HDMATransfer_WaitForScanline128
ld a, $0
ldh [rVBK], a
ld c, $8
ld hl, wScratchTilemap
debgcoord 0, 0, vBGMap1
call HDMATransfer_EndBeforeScanline128
call HDMATransfer_WaitForScanline128
ret
.Copy:

View File

@ -1724,7 +1724,7 @@ ChooseMonToUseItemOn:
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
ret
@ -1741,7 +1741,7 @@ ItemActionText:
farcall WritePartyMenuTilemap
farcall PrintPartyMenuActionText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
pop bc
pop de

View File

@ -574,7 +574,7 @@ GiveItem:
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
jr c, .finish
@ -1437,7 +1437,7 @@ Pack_InitColors:
call WaitBGMap
ld b, CGB_PACKPALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
ret

View File

@ -82,7 +82,7 @@ ChooseMonToLearnTMHM_NoRefresh:
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
push af

View File

@ -522,7 +522,7 @@ LinkTimeout:
pop de
pop hl
bccoord 1, 14
call PrintHLTextAtBC
call PrintTextboxTextAt
call RotateThreePalettesRight
call ClearScreen
ld b, CGB_DIPLOMA
@ -1443,7 +1443,7 @@ LinkTrade_TradeStatsMenu:
dec a
ld [wCurTradePartyMon], a
ld [wPlayerLinkAction], a
farcall PrintWaitingTextAndSyncAndExchangeNybble
farcall PlaceWaitingTextAndSyncAndExchangeNybble
ld a, [wOtherPlayerLinkMode]
cp $f
jp z, InitTradeMenuDisplay
@ -1465,7 +1465,7 @@ LinkTrade_TradeStatsMenu:
farcall Link_WaitBGMap
ld hl, .LinkTradeCantBattleText
bccoord 1, 14
call PrintHLTextAtBC
call PrintTextboxTextAt
jr .cancel_trade
.abnormal
@ -1487,7 +1487,7 @@ LinkTrade_TradeStatsMenu:
farcall Link_WaitBGMap
ld hl, .LinkAbnormalMonText
bccoord 1, 14
call PrintHLTextAtBC
call PrintTextboxTextAt
.cancel_trade
hlcoord 0, 12
@ -1499,7 +1499,7 @@ LinkTrade_TradeStatsMenu:
call PlaceString
ld a, $1
ld [wPlayerLinkAction], a
farcall PrintWaitingTextAndSyncAndExchangeNybble
farcall PlaceWaitingTextAndSyncAndExchangeNybble
ld c, 100
call DelayFrames
jp InitTradeMenuDisplay
@ -1561,7 +1561,7 @@ LinkTradePartymonMenuCheckCancel:
ldcoord_a 9, 17
ld a, $f
ld [wPlayerLinkAction], a
farcall PrintWaitingTextAndSyncAndExchangeNybble
farcall PlaceWaitingTextAndSyncAndExchangeNybble
ld a, [wOtherPlayerLinkMode]
cp $f
jr nz, .loop1
@ -1658,7 +1658,7 @@ LinkTrade:
call GetPokemonName
ld hl, LinkAskTradeForText
bccoord 1, 14
call PrintHLTextAtBC
call PrintTextboxTextAt
call LoadStandardMenuHeader
hlcoord 10, 7
ld b, 3
@ -1707,13 +1707,13 @@ LinkTrade:
hlcoord 1, 14
ld de, String_TooBadTheTradeWasCanceled
call PlaceString
farcall PrintWaitingTextAndSyncAndExchangeNybble
farcall PlaceWaitingTextAndSyncAndExchangeNybble
jp InitTradeMenuDisplay_Delay
.try_trade
ld a, $2
ld [wPlayerLinkAction], a
farcall PrintWaitingTextAndSyncAndExchangeNybble
farcall PlaceWaitingTextAndSyncAndExchangeNybble
ld a, [wOtherPlayerLinkMode]
dec a
jr nz, .do_trade
@ -1956,7 +1956,7 @@ LinkTrade:
ld a, b
ld [wPlayerLinkAction], a
push bc
call Serial_PrintWaitingTextAndSyncAndExchangeNybble
call Serial_PlaceWaitingTextAndSyncAndExchangeNybble
pop bc
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
@ -2020,7 +2020,7 @@ LoadTradeScreenBorderGFX:
SetTradeRoomBGPals:
farcall LoadTradeRoomBGPals ; just a nested farcall; so wasteful
call SetPalettes
call SetDefaultBGPAndOBP
ret
PlaceTradeScreenTextbox: ; unreferenced

View File

@ -27,7 +27,7 @@ TestMobileTradeBorderTilemap: ; unreferenced
farcall LoadMobileTradeBorderTilemap ; useless to farcall
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call WaitBGMap
call JoyWaitAorB
call Call_ExitMenu
@ -156,15 +156,15 @@ LinkTextbox:
call _LinkTextbox
ret
PrintWaitingTextAndSyncAndExchangeNybble:
PlaceWaitingTextAndSyncAndExchangeNybble:
call LoadStandardMenuHeader
call .PrintWaitingText
call .PlaceWaitingText
farcall WaitLinkTransfer
call Call_ExitMenu
call WaitBGMap2
ret
.PrintWaitingText:
.PlaceWaitingText:
hlcoord 4, 10
ld b, 1
ld c, 10

View File

@ -12,14 +12,14 @@ ClearedLevelScreen:
call ClearMenuAndWindowData
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call EnableLCD
ld hl, .LevelCleared1Text
bccoord 3, 1
call PrintHLTextAtBC
call PrintTextboxTextAt
ld hl, .LevelCleared2Text
bccoord 3, 3
call PrintHLTextAtBC
call PrintTextboxTextAt
.loop
call DelayFrame
call GetJoypad

View File

@ -23,7 +23,7 @@ GameMenu_KeepMusic:
call ClearMenuAndWindowData
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ld [wWhichIndexSet], a
ld hl, .MenuHeader

View File

@ -3,7 +3,7 @@ InitGender:
call LoadGenderScreenPal
call LoadGenderScreenLightBlueTile
call WaitBGMap2
call SetPalettes
call SetDefaultBGPAndOBP
ld hl, AreYouABoyOrAreYouAGirlText
call PrintText1bpp
ld hl, .MenuHeader

View File

@ -58,7 +58,7 @@ LevelSelectionMenu::
call LevelSelectionMenu_DrawTimeOfDaySymbol
ld b, CGB_LEVEL_SELECTION_MENU
call GetCGBLayout ; apply and commit pals
call SetPalettes
call SetDefaultBGPAndOBP
ld c, 20 ;
call DelayFrames ; page shown --> page and textbox shown
@ -105,7 +105,7 @@ LevelSelectionMenu::
call LevelSelectionMenu_DrawTimeOfDaySymbol
ld b, CGB_LEVEL_SELECTION_MENU
call GetCGBLayout ; apply and commit pals
call SetPalettes
call SetDefaultBGPAndOBP
ld de, MUSIC_GAME_CORNER
call PlayMusic

View File

@ -20,7 +20,7 @@ MainMenu:
call ClearMenuAndWindowData
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call MainMenu_GetWhichMenu
ld [wWhichIndexSet], a
call MainMenu_PrintCurrentTimeAndDay

View File

@ -624,7 +624,7 @@ RestoreOverworldMapTiles: ; unreferenced
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
call CloseSRAM
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
xor a ; sScratch
call OpenSRAM
ld hl, sScratch

View File

@ -55,7 +55,7 @@ NamingScreen:
call .GetNamingScreenSetup
call WaitBGMap
call WaitTop
call SetPalettes
call SetDefaultBGPAndOBP
call NamingScreen_InitNameEntry
ret

View File

@ -48,7 +48,7 @@ _Option:
call WaitBGMap
ld b, CGB_DIPLOMA
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
.joypad_loop
call JoyTextDelay

View File

@ -36,7 +36,7 @@ StartMenu::
call DrawVariableLengthMenuBox
call .DrawBugContestStatusBox
call SafeUpdateSprites
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call HDMATransferTilemapAndAttrmap_Menu
farcall LoadFont_NoOAMUpdate
call .DrawBugContestStatus
call UpdateTimePals

View File

@ -67,7 +67,7 @@ TrainerCard:
call WaitBGMap
ld b, CGB_TRAINER_CARD
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call WaitBGMap
ld hl, wJumptableIndex
xor a ; TRAINERCARDSTATE_PAGE1_LOADGFX

View File

@ -72,7 +72,7 @@ Credits::
ldh [hLCDCPointer], a
call GetCreditsPalette
call SetPalettes
call SetDefaultBGPAndOBP
ldh a, [hVBlank]
push af
@ -325,7 +325,7 @@ ParseCredits:
xor a
ld [wCreditsBorderFrame], a ; frame
call GetCreditsPalette
call SetPalettes ; update hw pal registers
call SetDefaultBGPAndOBP ; update hw pal registers
jr .loop
.clear

View File

@ -17,7 +17,7 @@ InitDisplayForHallOfFame:
ld hl, .SavingRecordText
call PrintText1bpp
call WaitBGMap2
call SetPalettes
call SetDefaultBGPAndOBP
ret
.SavingRecordText:
@ -50,7 +50,7 @@ InitDisplayForRedCredits:
ldh [hSCX], a
call EnableLCD
call WaitBGMap2
call SetPalettes
call SetDefaultBGPAndOBP
ret
ResetDisplayBetweenHallOfFameMons:

View File

@ -19,7 +19,7 @@ SplashScreen:
call WaitBGMap
ld b, CGB_GAMEFREAK_LOGO
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld c, 10
call DelayFrames

View File

@ -27,111 +27,111 @@ OverworldLoop::
DisableEvents:
xor a
ld [wScriptFlags2], a
ld [wEnabledPlayerEvents], a
ret
EnableEvents::
ld a, $ff
ld [wScriptFlags2], a
ld [wEnabledPlayerEvents], a
ret
DisableTileEvents:
; DisableWarpsConnxns + DisableCoordEvents + DisableStepCount + DisableWildEncounters
; DisableWarpsConnections + DisableCoordEvents + DisableStepCount + DisableWildEncounters
push af
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
ld a, [hl]
and ~((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3))
ld [hl], a
pop af
ret
DisableWarpsConnxns: ; unreferenced
ld hl, wScriptFlags2
DisableWarpsConnections: ; unreferenced
ld hl, wEnabledPlayerEvents
res 2, [hl]
ret
DisableCoordEvents: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
res 1, [hl]
ret
DisableStepCount: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
res 0, [hl]
ret
DisableWildEncounters: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
res 3, [hl]
ret
DisableSpaceEffects:
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
res 4, [hl]
ret
DisableTrainerAndTalkerEvents: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
res 5, [hl]
ret
EnableWarpsConnxns: ; unreferenced
ld hl, wScriptFlags2
EnableWarpsConnections: ; unreferenced
ld hl, wEnabledPlayerEvents
set 2, [hl]
ret
EnableCoordEvents: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
set 1, [hl]
ret
EnableStepCount: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
set 0, [hl]
ret
EnableWildEncounters:
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
set 3, [hl]
ret
EnableSpaceEffects: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
set 4, [hl]
ret
EnableTrainerAndTalkerEvents: ; unreferenced
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
set 5, [hl]
ret
CheckWarpConnxnScriptFlag:
ld hl, wScriptFlags2
CheckWarpConnectionsEnabled:
ld hl, wEnabledPlayerEvents
bit 2, [hl]
ret
CheckCoordEventScriptFlag:
ld hl, wScriptFlags2
CheckCoordEventsEnabled:
ld hl, wEnabledPlayerEvents
bit 1, [hl]
ret
CheckStepCountScriptFlag:
ld hl, wScriptFlags2
CheckStepCountEnabled:
ld hl, wEnabledPlayerEvents
bit 0, [hl]
ret
CheckWildEncountersScriptFlag:
ld hl, wScriptFlags2
CheckWildEncountersEnabled:
ld hl, wEnabledPlayerEvents
bit 3, [hl]
ret
CheckSpaceEffectsScriptFlag:
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
bit 4, [hl]
ret
CheckTrainerAndTalkerEvents:
ld hl, wScriptFlags2
ld hl, wEnabledPlayerEvents
bit 5, [hl]
ret
@ -550,7 +550,7 @@ CheckTrainerOrTalkerEvent:
CheckTileEvent:
; Check for warps, coord events, or wild battles.
call CheckWarpConnxnScriptFlag
call CheckWarpConnectionsEnabled
jr z, .connections_disabled
farcall CheckMovingOffEdgeOfMap
@ -568,21 +568,21 @@ CheckTileEvent:
cp BOARDEVENT_VIEW_MAP_MODE
ret z ; nc
call CheckCoordEventScriptFlag
call CheckCoordEventsEnabled
jr z, .coord_events_disabled
call CheckCurrentMapCoordEvents
jr c, .coord_event
.coord_events_disabled
call CheckStepCountScriptFlag
call CheckStepCountEnabled
jr z, .step_count_disabled
call CountStep
ret c
.step_count_disabled
call CheckWildEncountersScriptFlag
call CheckWildEncountersEnabled
jr z, .ok
call RandomEncounter
@ -1536,7 +1536,7 @@ RandomEncounter::
call CheckWildEncounterCooldown
jr c, .nope
call CanEncounterWildMonInThisTile
call CanEncounterWildMon
jr nc, .nope
ld hl, wStatusFlags2
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
@ -1576,7 +1576,7 @@ WildBattleScript:
reloadmapafterbattle
end
CanEncounterWildMonInThisTile::
CanEncounterWildMon::
ld hl, wStatusFlags
bit STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
jr nz, .no

View File

@ -29,11 +29,11 @@ ReanchorBGMap_NoOAMUpdate::
; draw screen at wTilemap and wAttrmap and then transfer it.
ld a, $90
ldh [hWY], a
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call LoadWindowHUD
ld a, HIGH(vBGMap1)
call .LoadBGMapAddrIntoHRAM
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call HDMATransferTilemapAndAttrmap_Menu
farcall ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a

View File

@ -1,4 +1,4 @@
_LoadScreenTilemap::
_LoadOverworldTilemap::
ld hl, wSurroundingTiles
ld a, [wPlayerMetatileY]
and a

View File

@ -13,7 +13,7 @@ BlankScreen:
ld a, $7
call ByteFill
call WaitBGMap2
call SetPalettes
call SetDefaultBGPAndOBP
ret
SpawnPlayer:

View File

@ -144,25 +144,25 @@ UpdateOverworldMap:
.step_down
call .ScrollOverworldMapDown
call LoadScreenTilemap
call LoadOverworldTilemap
call ScrollMapDown
ret
.step_up
call .ScrollOverworldMapUp
call LoadScreenTilemap
call LoadOverworldTilemap
call ScrollMapUp
ret
.step_left
call .ScrollOverworldMapLeft
call LoadScreenTilemap
call LoadOverworldTilemap
call ScrollMapLeft
ret
.step_right
call .ScrollOverworldMapRight
call LoadScreenTilemap
call LoadOverworldTilemap
call ScrollMapRight
ret

View File

@ -136,7 +136,7 @@ ScriptCommandTable:
dw Script_itemnotify ; 45
dw Script_pocketisfull ; 46
dw Script_opentext ; 47
dw Script_refreshscreen ; 48
dw Script_reanchormap ; 48
dw Script_closetext ; 49
dw Script_writeunusedbyte ; 4a
dw Script_farwritetext ; 4b
@ -188,7 +188,7 @@ ScriptCommandTable:
dw Script_changemapblocks ; 79
dw Script_changeblock ; 7a
dw Script_reloadmap ; 7b
dw Script_reloadmappart ; 7c
dw Script_refreshmap ; 7c
dw Script_writecmdqueue ; 7d
dw Script_delcmdqueue ; 7e
dw Script_playmusic ; 7f
@ -953,7 +953,7 @@ ApplyObjectFacing:
ret
.DisableTextTiles:
call LoadScreenTilemap
call LoadOverworldTilemap
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
.loop
@ -2287,12 +2287,12 @@ Script_changeblock:
call BufferScreen
ret
Script_reloadmappart::
Script_refreshmap::
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call GetMovementPermissions
farcall HDMATransferTilemapAndAttrmap_OverworldEffect
farcall HDMATransferTilemapAndAttrmap_Overworld
call UpdateSprites
ret
@ -2322,7 +2322,7 @@ Script_opentext:
call OpenText2bpp
ret
Script_refreshscreen:
Script_reanchormap:
call RefreshScreen
call GetScriptByte
ret
@ -2332,7 +2332,7 @@ Script_writeunusedbyte:
ret
Script_closetext:
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call HDMATransferTilemapAndAttrmap_Menu
call CloseText
ret

View File

@ -219,7 +219,7 @@ LoadMapTimeOfDay:
ld [wSpriteUpdatesEnabled], a
farcall ReplaceTimeOfDayPals
farcall UpdateTimeOfDayPal
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call .ClearBGMap
call .PushAttrmap
ret

View File

@ -407,7 +407,7 @@ WrongNumber:
text_end
Script_ReceivePhoneCall:
refreshscreen
reanchormap
callasm RingTwice_StartCall
memcall wCallerContact + PHONE_CONTACT_SCRIPT2_BANK
waitbutton

View File

@ -46,5 +46,5 @@ NewPokedexEntry:
ld [wTempMonDVs + 1], a
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ret

View File

@ -102,7 +102,7 @@ PokeGear:
call InitPokegearTilemap
ld b, CGB_POKEGEAR_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, %11100100
call DmgToCgbObjPal0
ret
@ -1621,7 +1621,7 @@ _TownMap:
ld [wTownMapCursorObjectPointer + 1], a
ld b, CGB_POKEGEAR_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, %11100100
call DmgToCgbObjPal0
call DelayFrame
@ -1840,7 +1840,7 @@ _FlyMap:
call Pokegear_DummyFunction
ld b, CGB_POKEGEAR_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
.loop
call JoyTextDelay
ld hl, hJoyPressed
@ -2110,7 +2110,7 @@ Pokedex_GetArea:
call TownMapBGUpdate
ld b, CGB_POKEGEAR_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ldh [hBGMapMode], a
xor a ; JOHTO_REGION
@ -2537,7 +2537,7 @@ EntireFlyMap: ; unreferenced
ld [wTownMapCursorCoordinates + 1], a
ld b, CGB_POKEGEAR_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
.loop
call JoyTextDelay
ld hl, hJoyPressed

View File

@ -129,7 +129,7 @@ PrintRadioLine:
cp 2
jr nz, .print
bccoord 1, 16
call PrintHLTextAtBC
call PrintTextboxTextAt
jr .skip
.print
call PrintTextboxText

View File

@ -48,7 +48,7 @@ _BillsPC:
ld a, $1
.loop
ld [wMenuCursorPosition], a
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ld [wWhichIndexSet], a
ldh [hBGMapMode], a
@ -245,7 +245,7 @@ ClearPCItemScreen:
lb bc, 4, 18
call Textbox1bpp
call WaitBGMap2
call SetPalettes ; load regular palettes?
call SetDefaultBGPAndOBP
ret
CopyBoxmonToTempMon:

View File

@ -649,7 +649,7 @@ Hatch_UpdateFrontpicBGMapCenter:
predef PlaceGraphic
pop af
call Hatch_LoadFrontpicPal
call SetPalettes
call SetDefaultBGPAndOBP
jp WaitBGMap
EggHatch_DoSpriteAnimFrame:

View File

@ -490,7 +490,7 @@ MailboxPC:
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
jr c, .exit2

View File

@ -40,7 +40,7 @@ ReadAnyMail:
ld a, [wCurMailIndex]
ld e, a
farcall LoadMailPalettes
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ldh [hJoyPressed], a
call .loop

View File

@ -119,7 +119,7 @@ Party::
farcall WritePartyMenuTilemap
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
ret c ; if cancelled or pressed B
@ -204,7 +204,7 @@ SwitchPartyMons:
call AddNTimes
ld [hl], "▷"
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
farcall PartyMenuSelect
@ -1181,7 +1181,7 @@ SetUpMoveList:
hlcoord 10, 4
predef ListMovePP
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
ld a, [wNumMoves]
inc a
ld [w2DMenuNumRows], a

View File

@ -5,7 +5,7 @@ SelectMonFromParty:
call ClearBGPalettes
call InitPartyMenuLayout
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
call PartyMenuSelect
call ReturnToMapWithSpeechTextbox
@ -20,7 +20,7 @@ SelectTradeOrDayCareMon:
call WaitBGMap
ld b, CGB_PARTY_MENU
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
call PartyMenuSelect
call ReturnToMapWithSpeechTextbox

View File

@ -494,7 +494,7 @@ StatsScreen_LoadGFX:
ld hl, wStatsScreenFlags
bit 4, [hl]
jr nz, .place_frontpic
call SetPalettes
call SetDefaultBGPAndOBP
ret
.place_frontpic
@ -795,16 +795,16 @@ StatsScreen_PlaceFrontpic:
.egg
call .AnimateEgg
call SetPalettes
call SetDefaultBGPAndOBP
ret
.no_cry
call .AnimateMon
call SetPalettes
call SetDefaultBGPAndOBP
ret
.cry
call SetPalettes
call SetDefaultBGPAndOBP
call .AnimateMon
ld a, [wCurPartySpecies]
call PlayMonCry2
@ -995,7 +995,7 @@ endc
call PlaceString
ld hl, wStatsScreenFlags
set 5, [hl]
call SetPalettes ; pals
call SetDefaultBGPAndOBP
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic

View File

@ -225,7 +225,7 @@ PrintPartyMonPage1:
call WaitBGMap
ld b, CGB_STATS_SCREEN_HP_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ret
PrintPartyMonPage2:
@ -276,7 +276,7 @@ PrintPartyMonPage2:
call WaitBGMap
ld b, CGB_STATS_SCREEN_HP_PALS
call GetCGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ret
.PrintTempMonStats:

View File

@ -1,4 +1,4 @@
_LoadScreenAttrmapPals::
_LoadOverworldAttrmapPals::
hlcoord 0, 0
decoord 0, 0, wAttrmap
ld b, SCREEN_HEIGHT

View File

@ -111,7 +111,7 @@ _UpdateTimePals::
call DmgToCgbTimePals
ret
FadeInPalettesFromWhite::
FadeInFromWhite::
; fades from white to normal palettes in four steps
; all palettes use white color of Pal0 before step 3
call BackupWhiteColorFromBGPals1
@ -127,7 +127,7 @@ FadeInPalettesFromWhite::
call ConvertTimePalsDecHL
ret
FadeOutPalettesToWhite::
FadeOutToWhite::
; fades from normal palettes to white in four steps
; all palettes use white color of Pal0 after step 2
ld c, $9
@ -141,14 +141,14 @@ FadeOutPalettesToWhite::
call ConvertTimePalsIncHL
ret
FadeInPalettesFromBlack:
FadeInFromBlack:
ld c, $0
call GetTimePalFade
ld b, $4
call ConvertTimePalsIncHL
ret
FadeOutPalettesToBlack:
FadeOutToBlack:
ld c, $9
call GetTimePalFade
ld b, $4

View File

@ -84,12 +84,12 @@ GetMapSceneID::
pop bc
ret
LoadScreenTilemapAndAttrmapPals::
call LoadScreenTilemap
call LoadScreenAttrmapPals
LoadOverworldTilemapAndAttrmapPals::
call LoadOverworldTilemap
call LoadOverworldAttrmapPals
ret
LoadScreenTilemap::
LoadOverworldTilemap::
ldh a, [hROMBank]
push af
@ -102,9 +102,9 @@ LoadScreenTilemap::
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
ld a, BANK(_LoadScreenTilemap)
ld a, BANK(_LoadOverworldTilemap)
rst Bankswitch
call _LoadScreenTilemap
call _LoadOverworldTilemap
pop af
rst Bankswitch
@ -2170,7 +2170,7 @@ FadeToMenu::
xor a
ldh [hBGMapMode], a
call LoadStandardMenuHeader
farcall FadeOutPalettesToWhite
farcall FadeOutToWhite
call ClearSprites
call DisableSpriteUpdates
ret
@ -2191,7 +2191,7 @@ FinishExitMenu::
ld b, CGB_MAPPALS
call GetCGBLayout
call WaitBGMap2
farcall FadeInPalettesFromWhite
farcall FadeInFromWhite
call EnableSpriteUpdates
ret
@ -2237,7 +2237,7 @@ ReloadTilesetAndPalettes::
ld c, a
call SwitchToAnyMapAttributesBank
farcall UpdateTimeOfDayPal
call LoadScreenTilemapAndAttrmapPals
call LoadOverworldTilemapAndAttrmapPals
call LoadTilesetGFX
ld a, 9
call SkipMusic

View File

@ -288,8 +288,8 @@ ReloadSpritesNoPalettes::
call DelayFrame
ret
LoadScreenAttrmapPals::
homecall _LoadScreenAttrmapPals
LoadOverworldAttrmapPals::
homecall _LoadOverworldAttrmapPals
ret
ScrollBGMapPalettes::

View File

@ -20,7 +20,7 @@ ScrollingMenu::
ld hl, wVramState
bit 0, [hl]
jp nz, UpdateTimePals
jp SetPalettes
jp SetDefaultBGPAndOBP
InitScrollingMenu::
ld a, [wMenuBorderTopCoord]

View File

@ -270,7 +270,7 @@ Serial_ExchangeSyncBytes::
jr nz, .exchange
ret
Serial_PrintWaitingTextAndSyncAndExchangeNybble::
Serial_PlaceWaitingTextAndSyncAndExchangeNybble::
call LoadTilemapToTempTilemap
callfar PlaceWaitingText
call WaitLinkTransfer

View File

@ -208,7 +208,7 @@ BuenaPrintText::
PrintTextboxText::
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
call PrintHLTextAtBC
call PrintTextboxTextAt
ret
PlaceString::
@ -624,7 +624,7 @@ PokeFluteTerminator::
.stop:
text_end
PrintHLTextAtBC::
PrintTextboxTextAt::
ld a, [wTextboxFlags]
push af
set TEXT_DELAY_F, a

View File

@ -129,12 +129,12 @@ endr
ld sp, hl
ret
SetPalettes::
SetDefaultBGPAndOBP::
; Inits the Palettes
; depending on the system the monochromes palettes or color palettes
ldh a, [hCGB]
and a
jr nz, .SetPalettesForGameBoyColor
jr nz, .SetDefaultBGPAndOBPForGameBoyColor
ld a, %11100100
ldh [rBGP], a
ld a, %11010000
@ -142,7 +142,7 @@ SetPalettes::
ldh [rOBP1], a
ret
.SetPalettesForGameBoyColor:
.SetDefaultBGPAndOBPForGameBoyColor:
push de
ld a, %11100100
call DmgToCgbBGPals

View File

@ -6,7 +6,7 @@ RefreshScreen::
rst Bankswitch
call ReanchorBGMap_NoOAMUpdate
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call HDMATransferTilemapAndAttrmap_Menu
call HideWindow_EnableLCDInt
pop af
@ -22,8 +22,8 @@ CloseText::
call ClearMenuAndWindowData
xor a
ldh [hBGMapMode], a
call LoadScreenTilemapAndAttrmapPals
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
call LoadOverworldTilemapAndAttrmapPals
call HDMATransferTilemapAndAttrmap_Menu
xor a
ldh [hBGMapMode], a
call SafeUpdateSprites
@ -52,7 +52,7 @@ OpenText2bpp::
; assumes that the overworld 2bpp font and frame are loaded when calling this
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox2bpp
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ; transfer bgmap
call HDMATransferTilemapAndAttrmap_Menu ; transfer bgmap
call HideWindow_EnableLCDInt
pop af
@ -73,7 +73,7 @@ OpenText1bpp::
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox1bpp
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ; transfer bgmap
call HDMATransferTilemapAndAttrmap_Menu ; transfer bgmap
call LoadFont_NoOAMUpdate ; load 1bpp font and frame, hide window
pop af
@ -81,13 +81,13 @@ OpenText1bpp::
ret
HDMATransferTilemapAndAttrmap_OpenAndCloseMenu::
HDMATransferTilemapAndAttrmap_Menu::
ldh a, [hOAMUpdate]
push af
ld a, $1
ldh [hOAMUpdate], a
farcall _HDMATransferTilemapAndAttrmap_OpenAndCloseMenu
farcall _HDMATransferTilemapAndAttrmap_Menu
pop af
ldh [hOAMUpdate], a

View File

@ -476,12 +476,12 @@ MACRO opentext
db opentext_command
ENDM
const refreshscreen_command ; $48
MACRO refreshscreen
const reanchormap_command ; $48
MACRO reanchormap
if _NARG == 0
refreshscreen 0
reanchormap 0
else
db refreshscreen_command
db reanchormap_command
db \1 ; dummy
endc
ENDM
@ -789,9 +789,9 @@ MACRO reloadmap
db reloadmap_command
ENDM
const reloadmappart_command ; $7c
MACRO reloadmappart
db reloadmappart_command
const refreshmap_command ; $7c
MACRO refreshmap
db refreshmap_command
ENDM
const writecmdqueue_command ; $7d

View File

@ -191,7 +191,7 @@ INCLUDE "data/collision/collision_permissions.asm"
INCLUDE "engine/menus/empty_sram.asm"
INCLUDE "engine/events/checksave.asm"
INCLUDE "data/maps/scenes.asm"
INCLUDE "engine/overworld/load_screen_tilemap.asm"
INCLUDE "engine/overworld/load_overworld_tilemap.asm"
INCLUDE "engine/gfx/hud.asm"

View File

@ -2250,7 +2250,7 @@ wMapEventStatus:: db
wScriptFlags::
; bit 3: run deferred script
db
wScriptFlags2::
wEnabledPlayerEvents::
; bit 0: count steps
; bit 1: coord events
; bit 2: warps and connections
@ -2773,7 +2773,7 @@ wMagnetTrainHoldPosition:: db
wMagnetTrainFinalPosition:: db
wMagnetTrainPlayerSpriteInitX:: db
; Used by FadeInPalettesFromWhite
; Used by FadeInFromWhite
wBGPalsRegularWhiteColors:: ds 8 * PAL_COLOR_SIZE
ds 91