mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Implement Flash technique through a map callback of type MAPCALLBACK_ENDMAPSETUP (#34)
This callback type is executed in a new map setup command at the very end of every map setup script. Maps that should trigger the use of Flash automatically should use an instance of this callback with fixed functionality
This commit is contained in:
parent
c5e3179059
commit
ce4ca85494
@ -24,3 +24,4 @@ DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
|
||||
const MAPCALLBACK_CMDQUEUE
|
||||
const MAPCALLBACK_SPRITES
|
||||
const MAPCALLBACK_NEWMAP
|
||||
const MAPCALLBACK_ENDMAPSETUP
|
||||
|
@ -49,8 +49,8 @@ MapGroup_DebugLevel1:
|
||||
|
||||
MapGroup_DebugLevel2:
|
||||
table_width MAP_LENGTH, MapGroup_DebugLevel2
|
||||
map DebugLevel2_Map1, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE, 2
|
||||
map DebugLevel2_Map2, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE, 2
|
||||
map DebugLevel2_Map1, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE | IN_DARKNESS, FISHGROUP_SHORE, 2
|
||||
map DebugLevel2_Map2, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE | IN_DARKNESS, FISHGROUP_SHORE, 2
|
||||
assert_table_length NUM_DEBUGLEVEL_2_MAPS
|
||||
|
||||
MapGroup_DebugLevel3:
|
||||
|
@ -56,3 +56,4 @@ MapSetupCommands:
|
||||
add_mapsetup AnchorPointAfterWarp ; 31
|
||||
add_mapsetup BackupMapObjects ; 32
|
||||
add_mapsetup LoadDisabledSpaces ; 33
|
||||
add_mapsetup MapCallbackAtEndMapSetup ; 34
|
||||
|
@ -48,6 +48,7 @@ MapSetupScript_EnterLevel:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Teleport:
|
||||
@ -81,6 +82,7 @@ MapSetupScript_Warp:
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup AnchorPointAfterWarp
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_BadWarp:
|
||||
@ -108,6 +110,7 @@ MapSetupScript_BadWarp:
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup AnchorPointAfterWarp
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Connection:
|
||||
@ -128,6 +131,7 @@ MapSetupScript_Connection:
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup UpdateRoamMons
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Fall:
|
||||
@ -158,6 +162,7 @@ MapSetupScript_Train:
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup UpdateRoamMons
|
||||
mapsetup AnchorPointAfterWarp
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_ReloadMap:
|
||||
@ -178,6 +183,7 @@ MapSetupScript_ReloadMap:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_ExitViewMap:
|
||||
@ -202,6 +208,7 @@ MapSetupScript_ExitViewMap:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_LinkReturn:
|
||||
@ -222,6 +229,7 @@ MapSetupScript_LinkReturn:
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup EnableTextAcceleration
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Continue:
|
||||
@ -244,6 +252,7 @@ MapSetupScript_Continue:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup MapCallbackAtEndMapSetup
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Submenu:
|
||||
|
@ -9,6 +9,23 @@ PlayWhirlpoolSound:
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
UseFlashAuto::
|
||||
; ReplaceTimeOfDayPals in map setup command LoadMapTimeOfDay sets wTimeOfDayPalset to DARKNESS_PALSET
|
||||
; only if wStatusFlags[STATUSFLAGS_FLASH_F] has not been set.
|
||||
ld a, [wTimeOfDayPalset]
|
||||
cp DARKNESS_PALSET
|
||||
ret nz
|
||||
ld c, 30 ; 500 ms
|
||||
call DelayFrames
|
||||
call WaitSFX
|
||||
ld de, SFX_FLASH
|
||||
call PlaySFX
|
||||
call BlindingFlash
|
||||
ld c, 30 ; 500 ms
|
||||
call DelayFrames
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
BlindingFlash:
|
||||
farcall FadeOutPalettesToWhite
|
||||
ld hl, wStatusFlags
|
||||
|
@ -202,3 +202,6 @@ ResetLevelScopedEventFlags:
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
MapCallbackAtEndMapSetup:
|
||||
ld a, MAPCALLBACK_ENDMAPSETUP
|
||||
jp RunMapCallback
|
||||
|
@ -4,6 +4,11 @@ DebugLevel2_Map1_MapScripts:
|
||||
def_scene_scripts
|
||||
|
||||
def_callbacks
|
||||
callback MAPCALLBACK_ENDMAPSETUP, .FlashAutoScript
|
||||
|
||||
.FlashAutoScript:
|
||||
callasm UseFlashAuto
|
||||
endcallback
|
||||
|
||||
DebugLevel2_Map1_MapEvents:
|
||||
db 0, 0 ; filler
|
||||
|
Loading…
Reference in New Issue
Block a user