mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Add new map setup script MAPSETUP_ENTERLEVEL (#4), and integrate overworld HUD setup in the corresponding setup scripts (#15)
This commit is contained in:
parent
7bd940aeac
commit
74f2a55332
@ -13,6 +13,7 @@
|
|||||||
const MAPSETUP_SUBMENU ; fa
|
const MAPSETUP_SUBMENU ; fa
|
||||||
const MAPSETUP_BADWARP ; fb
|
const MAPSETUP_BADWARP ; fb
|
||||||
const MAPSETUP_FLY ; fc
|
const MAPSETUP_FLY ; fc
|
||||||
|
const MAPSETUP_ENTERLEVEL ; fd
|
||||||
DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
|
DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
|
||||||
|
|
||||||
; callback types
|
; callback types
|
||||||
|
@ -49,3 +49,5 @@ MapSetupCommands:
|
|||||||
add_mapsetup SuspendMapAnims ; 2a
|
add_mapsetup SuspendMapAnims ; 2a
|
||||||
add_mapsetup ApplyMapPalettes ; 2b
|
add_mapsetup ApplyMapPalettes ; 2b
|
||||||
add_mapsetup EnableTextAcceleration ; 2c
|
add_mapsetup EnableTextAcceleration ; 2c
|
||||||
|
add_mapsetup ConstructAndEnableOverworldHUD ; 2d
|
||||||
|
add_mapsetup EnableOverworldHUD ; 2e
|
||||||
|
@ -13,6 +13,7 @@ MapSetupScripts:
|
|||||||
dw MapSetupScript_Submenu
|
dw MapSetupScript_Submenu
|
||||||
dw MapSetupScript_BadWarp
|
dw MapSetupScript_BadWarp
|
||||||
dw MapSetupScript_Fly
|
dw MapSetupScript_Fly
|
||||||
|
dw MapSetupScript_EnterLevel
|
||||||
assert_table_length NUM_MAPSETUP_SCRIPTS
|
assert_table_length NUM_MAPSETUP_SCRIPTS
|
||||||
|
|
||||||
; valid commands are listed in MapSetupCommands (see data/maps/setup_script_pointers.asm)
|
; valid commands are listed in MapSetupCommands (see data/maps/setup_script_pointers.asm)
|
||||||
@ -20,6 +21,33 @@ MACRO mapsetup
|
|||||||
db (\1_MapSetupCmd - MapSetupCommands) / 3
|
db (\1_MapSetupCmd - MapSetupCommands) / 3
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
MapSetupScript_EnterLevel:
|
||||||
|
; same as MapSetupScript_Warp, but includes ConstructAndEnableOverworldHUD
|
||||||
|
mapsetup DisableLCD
|
||||||
|
mapsetup InitSound
|
||||||
|
mapsetup EnterMapSpawnPoint
|
||||||
|
mapsetup LoadMapAttributes
|
||||||
|
mapsetup HandleNewMap
|
||||||
|
mapsetup SpawnPlayer
|
||||||
|
mapsetup RefreshPlayerCoords
|
||||||
|
mapsetup GetMapScreenCoords
|
||||||
|
mapsetup LoadBlockData
|
||||||
|
mapsetup BufferScreen
|
||||||
|
mapsetup LoadMapGraphics
|
||||||
|
mapsetup LoadMapTimeOfDay
|
||||||
|
mapsetup ConstructAndEnableOverworldHUD
|
||||||
|
mapsetup LoadMapObjects
|
||||||
|
mapsetup EnableLCD
|
||||||
|
mapsetup LoadMapPalettes
|
||||||
|
mapsetup SpawnInFacingDown
|
||||||
|
mapsetup RefreshMapSprites
|
||||||
|
mapsetup PlayMapMusicBike
|
||||||
|
mapsetup FadeInToMusic
|
||||||
|
mapsetup FadeInPalettesFromWhite
|
||||||
|
mapsetup ActivateMapAnims
|
||||||
|
mapsetup LoadWildMonData
|
||||||
|
db -1 ; end
|
||||||
|
|
||||||
MapSetupScript_Teleport:
|
MapSetupScript_Teleport:
|
||||||
mapsetup ResetPlayerObjectAction
|
mapsetup ResetPlayerObjectAction
|
||||||
MapSetupScript_Fly:
|
MapSetupScript_Fly:
|
||||||
@ -128,6 +156,7 @@ MapSetupScript_ReloadMap:
|
|||||||
mapsetup LoadConnectionBlockData
|
mapsetup LoadConnectionBlockData
|
||||||
mapsetup LoadMapGraphics
|
mapsetup LoadMapGraphics
|
||||||
mapsetup LoadMapTimeOfDay
|
mapsetup LoadMapTimeOfDay
|
||||||
|
mapsetup EnableOverworldHUD
|
||||||
mapsetup EnableLCD
|
mapsetup EnableLCD
|
||||||
mapsetup LoadMapPalettes
|
mapsetup LoadMapPalettes
|
||||||
mapsetup RefreshMapSprites
|
mapsetup RefreshMapSprites
|
||||||
@ -167,6 +196,7 @@ MapSetupScript_Continue:
|
|||||||
mapsetup BufferScreen
|
mapsetup BufferScreen
|
||||||
mapsetup LoadMapGraphics
|
mapsetup LoadMapGraphics
|
||||||
mapsetup LoadMapTimeOfDay
|
mapsetup LoadMapTimeOfDay
|
||||||
|
mapsetup ConstructAndEnableOverworldHUD
|
||||||
mapsetup EnableLCD
|
mapsetup EnableLCD
|
||||||
mapsetup LoadMapPalettes
|
mapsetup LoadMapPalettes
|
||||||
mapsetup RefreshMapSprites
|
mapsetup RefreshMapSprites
|
||||||
|
@ -327,7 +327,7 @@ Continue:
|
|||||||
call DelayFrames
|
call DelayFrames
|
||||||
farcall JumpRoamMons
|
farcall JumpRoamMons
|
||||||
ld a, [wSpawnAfterChampion]
|
ld a, [wSpawnAfterChampion]
|
||||||
cp SPAWN_LEVEL_1
|
cp SPAWN_N_A
|
||||||
jr z, .SpawnAfterE4
|
jr z, .SpawnAfterE4
|
||||||
ld a, MAPSETUP_CONTINUE
|
ld a, MAPSETUP_CONTINUE
|
||||||
ldh [hMapEntryMethod], a
|
ldh [hMapEntryMethod], a
|
||||||
@ -378,7 +378,7 @@ FinishContinueFunction:
|
|||||||
res GAME_TIMER_MOBILE_F, [hl]
|
res GAME_TIMER_MOBILE_F, [hl]
|
||||||
farcall OverworldLoop
|
farcall OverworldLoop
|
||||||
ld a, [wSpawnAfterChampion]
|
ld a, [wSpawnAfterChampion]
|
||||||
cp SPAWN_LEVEL_1
|
cp SPAWN_N_A
|
||||||
jr z, .AfterRed
|
jr z, .AfterRed
|
||||||
jp Reset
|
jp Reset
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ LevelSelectionMenu::
|
|||||||
ld a, [wLevelSelectionMenuCurrentLandmark]
|
ld a, [wLevelSelectionMenuCurrentLandmark]
|
||||||
call LevelSelectionMenu_GetLandmarkSpawnPoint
|
call LevelSelectionMenu_GetLandmarkSpawnPoint
|
||||||
ld [wDefaultSpawnpoint], a
|
ld [wDefaultSpawnpoint], a
|
||||||
ld a, MAPSETUP_WARP
|
ld a, MAPSETUP_ENTERLEVEL
|
||||||
ld [hMapEntryMethod], a
|
ld [hMapEntryMethod], a
|
||||||
xor a
|
xor a
|
||||||
ld [wDontPlayMapMusicOnReload], a ; play map music
|
ld [wDontPlayMapMusicOnReload], a ; play map music
|
||||||
|
@ -110,8 +110,6 @@ EnterMap:
|
|||||||
ld [wXYComparePointer], a
|
ld [wXYComparePointer], a
|
||||||
ld [wXYComparePointer + 1], a
|
ld [wXYComparePointer + 1], a
|
||||||
call SetUpFiveStepWildEncounterCooldown
|
call SetUpFiveStepWildEncounterCooldown
|
||||||
ld hl, wTextboxFlags
|
|
||||||
set TEXT_2BPP_F, [hl]
|
|
||||||
farcall RunMapSetupScript
|
farcall RunMapSetupScript
|
||||||
call DisableEvents
|
call DisableEvents
|
||||||
|
|
||||||
@ -128,9 +126,6 @@ EnterMap:
|
|||||||
ld [wPoisonStepCount], a
|
ld [wPoisonStepCount], a
|
||||||
.dontresetpoison
|
.dontresetpoison
|
||||||
|
|
||||||
call ConstructOverworldHUDTilemap
|
|
||||||
call EnableOverworldHUD
|
|
||||||
|
|
||||||
xor a ; end map entry
|
xor a ; end map entry
|
||||||
ldh [hMapEntryMethod], a
|
ldh [hMapEntryMethod], a
|
||||||
ld a, MAPSTATUS_HANDLE
|
ld a, MAPSTATUS_HANDLE
|
||||||
|
@ -117,3 +117,10 @@ endr
|
|||||||
pop af
|
pop af
|
||||||
ld [rVBK], a
|
ld [rVBK], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
ConstructAndEnableOverworldHUD::
|
||||||
|
; map setup command used by MAPSETUP_ENTERLEVEL and MAPSETUP_CONTINUE
|
||||||
|
ld hl, wTextboxFlags
|
||||||
|
set TEXT_2BPP_F, [hl]
|
||||||
|
call ConstructOverworldHUDTilemap
|
||||||
|
jp EnableOverworldHUD
|
||||||
|
@ -67,6 +67,7 @@ OpenText1bpp::
|
|||||||
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; aka BANK(LoadFont_NoOAMUpdate)
|
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; aka BANK(LoadFont_NoOAMUpdate)
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
|
; note: 1bpp text is NOT compatible with the overworld HUD enabled because it uses 2bpp font tiles.
|
||||||
ld hl, wTextboxFlags
|
ld hl, wTextboxFlags
|
||||||
res TEXT_2BPP_F, [hl]
|
res TEXT_2BPP_F, [hl]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user