mirror of
https://github.com/pret/pokegold.git
synced 2026-09-08 16:45:21 -05:00
Add engine/overworld/map_setup.asm.
This commit is contained in:
@@ -1,71 +1,72 @@
|
||||
const_value SET $f1
|
||||
const MAPSETUP_WARP
|
||||
const MAPSETUP_CONTINUE
|
||||
const MAPSETUP_RELOADMAP
|
||||
const MAPSETUP_TELEPORT
|
||||
const MAPSETUP_DOOR
|
||||
const MAPSETUP_FALL
|
||||
const MAPSETUP_CONNECTION
|
||||
const MAPSETUP_LINKRETURN
|
||||
const MAPSETUP_TRAIN
|
||||
const MAPSETUP_SUBMENU
|
||||
const MAPSETUP_BADWARP
|
||||
const MAPSETUP_FLY
|
||||
; hMapEntryMethod values
|
||||
; MapSetupScripts indexes (see data/maps/setup_scripts.asm)
|
||||
const_def $f1
|
||||
const MAPSETUP_WARP ; f1
|
||||
const MAPSETUP_CONTINUE ; f2
|
||||
const MAPSETUP_RELOADMAP ; f3
|
||||
const MAPSETUP_TELEPORT ; f4
|
||||
const MAPSETUP_DOOR ; f5
|
||||
const MAPSETUP_FALL ; f6
|
||||
const MAPSETUP_CONNECTION ; f7
|
||||
const MAPSETUP_LINKRETURN ; f8
|
||||
const MAPSETUP_TRAIN ; f9
|
||||
const MAPSETUP_SUBMENU ; fa
|
||||
const MAPSETUP_BADWARP ; fb
|
||||
const MAPSETUP_FLY ; fc
|
||||
|
||||
const_value SET 1
|
||||
; MapSetupCommands indexes (see engine/overworld/map_setup.asm)
|
||||
const_def
|
||||
const map_enable_lcd ; 00
|
||||
const map_disable_lcd ; 01
|
||||
const map_init_sound ; 02
|
||||
const map_play_music ; 03
|
||||
const map_restart_music ; 04
|
||||
const map_fade_to_music ; 05
|
||||
const map_fade_music_and_palettes ; 06
|
||||
const map_play_music_bike ; 07
|
||||
const map_force_music ; 08
|
||||
const map_fade_in_music ; 09
|
||||
const map_load_block_data ; 0a
|
||||
const map_load_connection_block_data ; 0b
|
||||
const map_save_screen ; 0c
|
||||
const map_buffer_screen ; 0d
|
||||
const map_load_graphics ; 0e
|
||||
const map_load_tileset ; 0f
|
||||
const map_load_time_of_day ; 10
|
||||
const map_load_palettes ; 11
|
||||
const map_load_wild_mon_data ; 12
|
||||
const map_refresh_sprites ; 13
|
||||
const map_handle_new ; 14
|
||||
const map_handle_continue ; 15
|
||||
const map_load_objects ; 16
|
||||
const map_enter_spawn_point ; 17
|
||||
const map_enter_connection ; 18
|
||||
const map_enter_warp ; 19
|
||||
const map_load_attributes ; 1a
|
||||
const map_load_attributes_no_objects ; 1b
|
||||
const map_clear_bg_palettes ; 1c
|
||||
const map_fade_out_palettes ; 1d
|
||||
const map_fade_in_palettes ; 1e
|
||||
const map_get_screen_coords ; 1f
|
||||
const map_get_warp_dest_coords ; 20
|
||||
const map_spawn_in_facing_down ; 21
|
||||
const map_spawn_player ; 22
|
||||
const map_refresh_player_coords ; 23
|
||||
const map_reset_player_object_action ; 24
|
||||
const map_skip_update_sprites ; 25
|
||||
const map_update_roam_mons ; 26
|
||||
const map_jump_roam_mons ; 27
|
||||
const map_fade_out_music ; 28
|
||||
const map_activate_anims ; 29
|
||||
const map_suspend_anims ; 2a
|
||||
const map_apply_palettes ; 2b
|
||||
const map_enable_text_acceleration ; 2c
|
||||
map_end EQU -1
|
||||
|
||||
; callback types
|
||||
const_def 1
|
||||
const MAPCALLBACK_TILES
|
||||
const MAPCALLBACK_OBJECTS
|
||||
const MAPCALLBACK_CMDQUEUE
|
||||
const MAPCALLBACK_SPRITES
|
||||
const MAPCALLBACK_NEWMAP
|
||||
|
||||
; Command descriptions from Condensation water's scripting compendium.
|
||||
const_def
|
||||
|
||||
const map_lcd_on ; 00
|
||||
const map_lcd_off ; 01
|
||||
const map_sound_off ; 02
|
||||
const map_music ; 03
|
||||
const map_start_music ; 04
|
||||
const map_fade_music ; 05
|
||||
const map_fade ; 06
|
||||
const map_bike_music ; 07
|
||||
const map_music_force ; 08
|
||||
const map_max_volume ; 09
|
||||
const map_load_blocks ; 0a
|
||||
const map_connection_blocks ; 0b
|
||||
const map_save_screen ; 0c
|
||||
const map_buffer_screen ; 0d
|
||||
const map_load_graphics ; 0e
|
||||
const map_load_tileset_header ; 0f
|
||||
const map_time_of_day ; 10
|
||||
const map_palettes ; 11
|
||||
const map_wildmons ; 12
|
||||
const map_sprites ; 13
|
||||
const map_change_callback ; 14
|
||||
const map_start_callback ; 15
|
||||
const map_load_objects ; 16
|
||||
const map_load_spawn ; 17
|
||||
const map_load_connection ; 18
|
||||
const map_load_warp ; 19
|
||||
const map_attributes_1 ; 1a
|
||||
const map_attributes_2 ; 1b
|
||||
const map_clear_bg_palettes ; 1c
|
||||
const map_fade_out_palettes ; 1d
|
||||
const map_fade_in_palettes ; 1e
|
||||
const map_anchor_screen ; 1f
|
||||
const map_warp_face ; 20
|
||||
const map_face_down ; 21
|
||||
const map_spawn_coord ; 22
|
||||
const map_player_coord ; 23
|
||||
const map_prolong_sprites ; 24
|
||||
const map_delay_sprites ; 25
|
||||
const map_update_roam ; 26
|
||||
const map_keep_roam ; 27
|
||||
const map_fade_out_music ; 28
|
||||
const map_animations_on ; 29
|
||||
const map_animations_off ; 2a
|
||||
const map_keep_palettes ; 2b
|
||||
const map_text_scroll_off ; 2c
|
||||
const map_stop_script ; 2d
|
||||
map_end EQU -1
|
||||
|
||||
@@ -105,6 +105,13 @@ DAY EQU 1 << DAY_F
|
||||
NITE EQU 1 << NITE_F
|
||||
DARKNESS EQU 1 << DARKNESS_F
|
||||
|
||||
; wPlayerSpriteSetupFlags::
|
||||
PLAYERSPRITESETUP_FACING_MASK EQU %11
|
||||
PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2
|
||||
PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5
|
||||
PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6
|
||||
PLAYERSPRITESETUP_RESET_ACTION_F EQU 7
|
||||
|
||||
; wScriptFlags::
|
||||
SCRIPT_RUNNING EQU 2
|
||||
|
||||
@@ -193,6 +200,12 @@ PLAYER_SKATE EQU 2
|
||||
PLAYER_SURF EQU 4
|
||||
PLAYER_SURF_PIKA EQU 8
|
||||
|
||||
; wBikeFlags::
|
||||
const_def
|
||||
const BIKEFLAGS_STRENGTH_ACTIVE_F ; 0
|
||||
const BIKEFLAGS_ALWAYS_ON_BIKE_F ; 1
|
||||
const BIKEFLAGS_DOWNHILL_F ; 2
|
||||
|
||||
; wDayCareMan:: ; dc40
|
||||
DAYCAREMAN_HAS_MON_F EQU 0
|
||||
DAYCAREMAN_MONS_COMPATIBLE_F EQU 5
|
||||
|
||||
173
data/maps/setup_scripts.asm
Normal file
173
data/maps/setup_scripts.asm
Normal file
@@ -0,0 +1,173 @@
|
||||
MapSetupScripts:
|
||||
; entries correspond to MAPSETUP_* constants (see constants/map_setup_constants.asm)
|
||||
dw MapSetupScript_Warp
|
||||
dw MapSetupScript_Continue
|
||||
dw MapSetupScript_ReloadMap
|
||||
dw MapSetupScript_Teleport
|
||||
dw MapSetupScript_Door
|
||||
dw MapSetupScript_Fall
|
||||
dw MapSetupScript_Connection
|
||||
dw MapSetupScript_LinkReturn
|
||||
dw MapSetupScript_Train
|
||||
dw MapSetupScript_Submenu
|
||||
dw MapSetupScript_BadWarp
|
||||
|
||||
MapSetupScript_Teleport:
|
||||
db map_fade_out_palettes
|
||||
db map_reset_player_object_action
|
||||
db map_jump_roam_mons
|
||||
MapSetupScript_Warp:
|
||||
db map_disable_lcd
|
||||
db map_init_sound
|
||||
db map_enter_spawn_point
|
||||
db map_load_attributes
|
||||
db map_handle_new
|
||||
db map_spawn_player
|
||||
db map_refresh_player_coords
|
||||
db map_get_screen_coords
|
||||
db map_load_block_data
|
||||
db map_buffer_screen
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_load_objects
|
||||
db map_enable_lcd
|
||||
db map_load_palettes
|
||||
db map_spawn_in_facing_down
|
||||
db map_refresh_sprites
|
||||
db map_play_music_bike
|
||||
db map_fade_in_music
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_end
|
||||
|
||||
MapSetupScript_BadWarp:
|
||||
db map_enter_spawn_point
|
||||
db map_load_attributes
|
||||
db map_handle_new
|
||||
db map_spawn_player
|
||||
db map_refresh_player_coords
|
||||
db map_get_screen_coords
|
||||
db map_load_block_data
|
||||
db map_buffer_screen
|
||||
db map_disable_lcd
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_fade_out_music
|
||||
db map_enable_lcd
|
||||
db map_load_objects
|
||||
db map_load_palettes
|
||||
db map_spawn_in_facing_down
|
||||
db map_refresh_sprites
|
||||
db map_fade_to_music
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_end
|
||||
|
||||
MapSetupScript_Connection:
|
||||
db map_suspend_anims
|
||||
db map_enter_connection
|
||||
db map_load_attributes
|
||||
db map_handle_new
|
||||
db map_refresh_player_coords
|
||||
db map_load_block_data
|
||||
db map_load_tileset
|
||||
db map_save_screen
|
||||
db map_load_objects
|
||||
db map_fade_to_music
|
||||
db map_load_palettes
|
||||
db map_apply_palettes
|
||||
db map_load_wild_mon_data
|
||||
db map_update_roam_mons
|
||||
db map_activate_anims
|
||||
db map_end
|
||||
|
||||
MapSetupScript_Fall:
|
||||
db map_reset_player_object_action
|
||||
MapSetupScript_Door:
|
||||
db map_fade_out_palettes
|
||||
MapSetupScript_Train:
|
||||
db map_enter_warp
|
||||
db map_load_attributes
|
||||
db map_get_warp_dest_coords
|
||||
db map_handle_new
|
||||
db map_refresh_player_coords
|
||||
db map_load_block_data
|
||||
db map_buffer_screen
|
||||
db map_disable_lcd
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_fade_out_music
|
||||
db map_enable_lcd
|
||||
db map_load_objects
|
||||
db map_load_palettes
|
||||
db map_refresh_sprites
|
||||
db map_fade_to_music
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_update_roam_mons
|
||||
db map_end
|
||||
|
||||
MapSetupScript_ReloadMap:
|
||||
db map_fade_music_and_palettes
|
||||
db map_clear_bg_palettes
|
||||
db map_disable_lcd
|
||||
db map_init_sound
|
||||
db map_load_block_data
|
||||
db map_load_connection_block_data
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_enable_lcd
|
||||
db map_load_palettes
|
||||
db map_refresh_sprites
|
||||
db map_force_music
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_end
|
||||
|
||||
MapSetupScript_LinkReturn:
|
||||
db map_fade_music_and_palettes
|
||||
db map_disable_lcd
|
||||
db map_init_sound
|
||||
db map_handle_new
|
||||
db map_load_block_data
|
||||
db map_buffer_screen
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_enable_lcd
|
||||
db map_load_palettes
|
||||
db map_refresh_sprites
|
||||
db map_play_music_bike
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_enable_text_acceleration
|
||||
db map_end
|
||||
|
||||
MapSetupScript_Continue:
|
||||
db map_disable_lcd
|
||||
db map_init_sound
|
||||
db map_load_attributes_no_objects
|
||||
db map_get_screen_coords
|
||||
db map_handle_continue
|
||||
db map_load_block_data
|
||||
db map_load_connection_block_data
|
||||
db map_buffer_screen
|
||||
db map_load_graphics
|
||||
db map_load_time_of_day
|
||||
db map_enable_lcd
|
||||
db map_load_palettes
|
||||
db map_refresh_sprites
|
||||
db map_play_music_bike
|
||||
db map_fade_in_palettes
|
||||
db map_activate_anims
|
||||
db map_load_wild_mon_data
|
||||
db map_end
|
||||
|
||||
MapSetupScript_Submenu:
|
||||
db map_load_block_data
|
||||
db map_load_connection_block_data
|
||||
db map_end
|
||||
@@ -555,7 +555,7 @@ TryToFly:
|
||||
jr z, .asm_caaa
|
||||
cp $1c
|
||||
jr nc, .asm_caaa
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
call CloseWindow
|
||||
ld a, $1
|
||||
ret
|
||||
@@ -592,7 +592,7 @@ FlyScript:
|
||||
callasm FlyFromAnimation
|
||||
farscall Script_AbortBugContest
|
||||
special WarpToSpawnPoint
|
||||
callasm DelayLoadingNewSprites ; 1560c
|
||||
callasm SkipUpdateMapSprites
|
||||
loadvar VAR_MOVEMENT, PLAYER_NORMAL
|
||||
newloadmap MAPSETUP_TELEPORT
|
||||
callasm FlyToAnimation
|
||||
@@ -868,7 +868,7 @@ TryTeleport:
|
||||
rst FarCall
|
||||
jr nc, .asm_cc9c
|
||||
ld a, c
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
ld a, $1
|
||||
ret
|
||||
|
||||
|
||||
@@ -71,5 +71,5 @@ GetWhiteoutSpawn:
|
||||
xor a ; SPAWN_HOME
|
||||
|
||||
.yes
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
ret
|
||||
|
||||
@@ -254,7 +254,7 @@ MainMenu_NewGame:
|
||||
call OakSpeech
|
||||
call InitializeWorld
|
||||
ld a, $0
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
ld a, $f1
|
||||
ldh [hMapEntryMethod], a
|
||||
jp FinishContinueFunction
|
||||
@@ -522,13 +522,13 @@ MainMenu_Continue:
|
||||
|
||||
.asm_5e42
|
||||
ld a, $e
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
call PostCreditsSpawn
|
||||
jp FinishContinueFunction
|
||||
|
||||
SpawnAfterRed: ; 5e4d (1:5e4d)
|
||||
ld a, $1a
|
||||
ld [wceec], a
|
||||
ld [wDefaultSpawnpoint], a
|
||||
PostCreditsSpawn: ; 5e52 (1:5e52)
|
||||
xor a
|
||||
ld [wd1db], a
|
||||
|
||||
@@ -933,12 +933,12 @@ Function5730:: ; 5730 (1:5730)
|
||||
ld [wPlayerObjectStepFrame], a
|
||||
call Function574f
|
||||
farcall CheckWarpFacingDown
|
||||
call c, Function5770
|
||||
call c, SpawnInFacingDown
|
||||
call Function5761
|
||||
ret
|
||||
|
||||
Function574f: ; 574f (1:574f)
|
||||
ld hl, wd182
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
bit 7, [hl]
|
||||
jr nz, .asm_575b
|
||||
bit 6, [hl]
|
||||
@@ -951,16 +951,16 @@ Function574f: ; 574f (1:574f)
|
||||
ret
|
||||
|
||||
Function5761: ; 5761 (1:5761)
|
||||
ld hl, wd182
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
bit 5, [hl]
|
||||
ret z
|
||||
ld a, [wd182]
|
||||
ld a, [wPlayerSpriteSetupFlags]
|
||||
and $3
|
||||
add a
|
||||
add a
|
||||
jr asm_5772
|
||||
|
||||
Function5770: ; 5770 (1:5770)
|
||||
SpawnInFacingDown:
|
||||
ld a, $0
|
||||
asm_5772:
|
||||
ld bc, wObjectStructs
|
||||
|
||||
256
engine/overworld/map_setup.asm
Normal file
256
engine/overworld/map_setup.asm
Normal file
@@ -0,0 +1,256 @@
|
||||
RunMapSetupScript::
|
||||
ldh a, [hMapEntryMethod]
|
||||
and $f
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, MapSetupScripts
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
call ReadMapSetupScript
|
||||
ret
|
||||
|
||||
INCLUDE "data/maps/setup_scripts.asm"
|
||||
|
||||
ReadMapSetupScript:
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp map_end
|
||||
ret z
|
||||
|
||||
push hl
|
||||
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, MapSetupCommands
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
|
||||
; bank
|
||||
ld b, [hl]
|
||||
inc hl
|
||||
|
||||
; address
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
|
||||
; Bit 7 of the bank indicates a parameter.
|
||||
; This is left unused.
|
||||
bit 7, b
|
||||
jr z, .go
|
||||
|
||||
pop de
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
inc de
|
||||
push de
|
||||
|
||||
.go
|
||||
ld a, b
|
||||
and $7f
|
||||
rst FarCall
|
||||
|
||||
pop hl
|
||||
jr .loop
|
||||
|
||||
MapSetupCommands:
|
||||
; entries correspond to command indexes in constants/map_setup_constants.asm
|
||||
dba EnableLCD ; 00
|
||||
dba DisableLCD ; 01
|
||||
dba InitSound ; 02
|
||||
dba PlayMapMusic ; 03
|
||||
dba RestartMapMusic ; 04
|
||||
dba FadeToMapMusic ; 05
|
||||
dba FadeMapMusicAndPalettes ; 06
|
||||
dba PlayMapMusicBike ; 07
|
||||
dba ForceMapMusic ; 08
|
||||
dba FadeInMusic ; 09
|
||||
dba LoadBlockData ; 0a (callback 1)
|
||||
dba LoadConnectionBlockData ; 0b
|
||||
dba SaveScreen ; 0c
|
||||
dba BufferScreen ; 0d
|
||||
dba LoadMapGraphics ; 0e
|
||||
dba LoadMapTileset ; 0f
|
||||
dba LoadMapTimeOfDay ; 10
|
||||
dba LoadMapPalettes ; 11
|
||||
dba LoadWildMonData ; 12
|
||||
dba RefreshMapSprites ; 13
|
||||
dba HandleNewMap ; 14
|
||||
dba HandleContinueMap ; 15
|
||||
dba LoadMapObjects ; 16
|
||||
dba EnterMapSpawnPoint ; 17
|
||||
dba EnterMapConnection ; 18
|
||||
dba EnterMapWarp ; 19
|
||||
dba LoadMapAttributes ; 1a
|
||||
dba LoadMapAttributes_SkipObjects ; 1b
|
||||
dba ClearBGPalettes ; 1c
|
||||
dba FadeOutPalettes ; 1d
|
||||
dba FadeInPalettes ; 1e
|
||||
dba GetMapScreenCoords ; 1f
|
||||
dba GetWarpDestCoords ; 20
|
||||
dba SpawnInFacingDown ; 21
|
||||
dba SpawnPlayer ; 22
|
||||
dba RefreshPlayerCoords ; 23
|
||||
dba ResetPlayerObjectAction ; 24
|
||||
dba SkipUpdateMapSprites ; 25
|
||||
dba UpdateRoamMons ; 26
|
||||
dba JumpRoamMons ; 27
|
||||
dba FadeOutMapMusic ; 28
|
||||
dba ActivateMapAnims ; 29
|
||||
dba SuspendMapAnims ; 2a
|
||||
dba ApplyMapPalettes ; 2b
|
||||
dba EnableTextAcceleration ; 2c
|
||||
|
||||
EnableTextAcceleration:
|
||||
xor a
|
||||
ld [wDisableTextAcceleration], a
|
||||
ret
|
||||
|
||||
UnusedActivateMapAnims:
|
||||
ld a, $1
|
||||
ldh [hMapAnims], a
|
||||
ret
|
||||
|
||||
UnusedSuspendMapAnims:
|
||||
xor a
|
||||
ldh [hMapAnims], a
|
||||
ret
|
||||
|
||||
LoadMapObjects:
|
||||
ld a, MAPCALLBACK_OBJECTS
|
||||
call RunMapCallback
|
||||
farcall LoadObjectMasks
|
||||
farcall InitializeVisibleSprites
|
||||
ret
|
||||
|
||||
; unused
|
||||
ret
|
||||
|
||||
ResetPlayerObjectAction:
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
|
||||
ret
|
||||
|
||||
SkipUpdateMapSprites:
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
|
||||
ret
|
||||
|
||||
CheckReplaceChrisSprite::
|
||||
nop
|
||||
call .CheckBiking
|
||||
jr c, .ok
|
||||
call .CheckSurfing
|
||||
jr c, .ok
|
||||
call .CheckSurfing2
|
||||
jr c, .ok
|
||||
ret
|
||||
|
||||
.ok
|
||||
call ReplaceChrisSprite
|
||||
ret
|
||||
|
||||
.CheckBiking:
|
||||
and a
|
||||
ld hl, wBikeFlags
|
||||
bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl]
|
||||
ret z
|
||||
ld a, PLAYER_BIKE
|
||||
ld [wPlayerState], a
|
||||
scf
|
||||
ret
|
||||
|
||||
.CheckSurfing2:
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_NORMAL
|
||||
jr z, .nope
|
||||
cp PLAYER_SKATE
|
||||
jr z, .nope
|
||||
cp PLAYER_SURF
|
||||
jr z, .surfing
|
||||
cp PLAYER_SURF_PIKA
|
||||
jr z, .surfing
|
||||
call GetMapEnvironment
|
||||
cp INDOOR
|
||||
jr z, .no_biking
|
||||
cp ENVIRONMENT_5
|
||||
jr z, .no_biking
|
||||
cp DUNGEON
|
||||
jr z, .no_biking
|
||||
jr .nope
|
||||
.no_biking
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_BIKE
|
||||
jr nz, .nope
|
||||
.surfing
|
||||
ld a, PLAYER_NORMAL
|
||||
ld [wPlayerState], a
|
||||
scf
|
||||
ret
|
||||
|
||||
.nope
|
||||
and a
|
||||
ret
|
||||
|
||||
.CheckSurfing:
|
||||
call CheckOnWater
|
||||
jr nz, .nope2
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_SURF
|
||||
jr z, .is_surfing
|
||||
cp PLAYER_SURF_PIKA
|
||||
jr z, .is_surfing
|
||||
ld a, PLAYER_SURF
|
||||
ld [wPlayerState], a
|
||||
.is_surfing
|
||||
scf
|
||||
ret
|
||||
|
||||
.nope2
|
||||
and a
|
||||
ret
|
||||
|
||||
FadeOutMapMusic:
|
||||
ld a, 6
|
||||
call SkipMusic
|
||||
ret
|
||||
|
||||
ActivateMapAnims:
|
||||
ld a, $1
|
||||
ldh [hMapAnims], a
|
||||
ret
|
||||
|
||||
SuspendMapAnims:
|
||||
xor a
|
||||
ldh [hMapAnims], a
|
||||
ret
|
||||
|
||||
ApplyMapPalettes:
|
||||
farcall _UpdateTimePals
|
||||
ret
|
||||
|
||||
FadeMapMusicAndPalettes:
|
||||
ld e, 0
|
||||
ld a, [wMusicFadeID]
|
||||
ld d, 0
|
||||
ld a, [wMusicFadeID + 1]
|
||||
ld a, $4
|
||||
ld [wMusicFade], a
|
||||
call RotateThreePalettesRight
|
||||
ret
|
||||
|
||||
ForceMapMusic:
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_BIKE
|
||||
jr nz, .notbiking
|
||||
call MinVolume
|
||||
ld a, $88
|
||||
ld [wMusicFade], a
|
||||
.notbiking
|
||||
call TryRestartMapMusic
|
||||
ret
|
||||
@@ -206,7 +206,7 @@ CopyMapObjectToTempObject: ; 870d (2:470d)
|
||||
ld [wcea1], a
|
||||
ret
|
||||
|
||||
InitializeVariableSprites:
|
||||
InitializeVisibleSprites:
|
||||
ld bc, wMap2Object
|
||||
ld a, $2
|
||||
.asm_876c
|
||||
|
||||
56
engine/overworld/spawn_points.asm
Normal file
56
engine/overworld/spawn_points.asm
Normal file
@@ -0,0 +1,56 @@
|
||||
EnterMapSpawnPoint:
|
||||
; loads the spawn point in wDefaultSpawnpoint
|
||||
push hl
|
||||
push de
|
||||
ld a, [wDefaultSpawnpoint]
|
||||
cp SPAWN_N_A
|
||||
jr z, .spawn_n_a
|
||||
ld l, a
|
||||
ld h, 0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld de, SpawnPoints
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld [wMapGroup], a
|
||||
ld a, [hli]
|
||||
ld [wMapNumber], a
|
||||
ld a, [hli]
|
||||
ld [wXCoord], a
|
||||
ld a, [hli]
|
||||
ld [wYCoord], a
|
||||
.spawn_n_a
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
IsSpawnPoint:
|
||||
; Checks if the map loaded in de is a spawn point. Returns carry if it's a spawn point.
|
||||
ld hl, SpawnPoints
|
||||
ld c, 0
|
||||
.loop
|
||||
ld a, [hl]
|
||||
cp SPAWN_N_A
|
||||
jr z, .nope
|
||||
cp d
|
||||
jr nz, .next
|
||||
inc hl
|
||||
ld a, [hld]
|
||||
cp e
|
||||
jr z, .yes
|
||||
|
||||
.next
|
||||
push bc
|
||||
ld bc, 4 ; length of a spawn table entry
|
||||
add hl, bc
|
||||
pop bc
|
||||
inc c
|
||||
jr .loop
|
||||
|
||||
.nope
|
||||
and a
|
||||
ret
|
||||
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
@@ -254,7 +254,7 @@ LowVolume::
|
||||
ld [wVolume], a
|
||||
ret
|
||||
|
||||
VolumeOff::
|
||||
MinVolume::
|
||||
xor a
|
||||
ld [wVolume], a
|
||||
ret
|
||||
@@ -332,7 +332,7 @@ PlayMapMusic::
|
||||
pop hl
|
||||
ret
|
||||
|
||||
EnterMapMusic::
|
||||
PlayMapMusicBike::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
||||
35
home/map.asm
35
home/map.asm
@@ -192,7 +192,7 @@ ReturnToMapFromSubmenu::
|
||||
ldh [hMapEntryMethod], a
|
||||
ret
|
||||
|
||||
Function2086::
|
||||
HandleNewMap::
|
||||
call Clear_wc6e8
|
||||
call ResetMapBufferEventFlags
|
||||
call ResetFlashIfOutOfCave
|
||||
@@ -200,6 +200,7 @@ Function2086::
|
||||
call ResetBikeFlags
|
||||
ld a, $5
|
||||
call RunMapCallback
|
||||
HandleContinueMap::
|
||||
farcall Function97c2a
|
||||
ld a, $3
|
||||
call RunMapCallback
|
||||
@@ -207,7 +208,7 @@ Function2086::
|
||||
ld [wMapTimeOfDay], a
|
||||
ret
|
||||
|
||||
Function20ac::
|
||||
LoadMapTimeOfDay::
|
||||
ld a, $1
|
||||
ld [wSpriteUpdatesEnabled], a
|
||||
farcall Function8c3e9
|
||||
@@ -261,8 +262,8 @@ Function20f7:: ; 20f7 (0:20f7)
|
||||
ldh [rVBK], a
|
||||
ret
|
||||
|
||||
Function2112::
|
||||
call LoadTilesetHeader
|
||||
LoadMapGraphics::
|
||||
call LoadMapTileset
|
||||
call LoadTileset
|
||||
xor a
|
||||
ldh [hMapAnims], a
|
||||
@@ -272,17 +273,17 @@ Function2112::
|
||||
call LoadFontsExtra
|
||||
ret
|
||||
|
||||
Function2128::
|
||||
LoadMapPalettes::
|
||||
ld b, $9
|
||||
jp GetSGBLayout
|
||||
|
||||
Function212d::
|
||||
RefreshMapSprites::
|
||||
call ClearSprites
|
||||
call ResetBGWindow
|
||||
call GetMovementPermissions
|
||||
farcall Function5730
|
||||
farcall Function15612
|
||||
ld hl, wd182
|
||||
farcall CheckReplaceChrisSprite
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
bit 6, [hl]
|
||||
jr nz, .asm_2151
|
||||
ld hl, wVramState
|
||||
@@ -290,7 +291,7 @@ Function212d::
|
||||
call SafeUpdateSprites
|
||||
.asm_2151
|
||||
xor a
|
||||
ld [wd182], a
|
||||
ld [wPlayerSpriteSetupFlags], a
|
||||
ret
|
||||
|
||||
Function2156::
|
||||
@@ -350,7 +351,7 @@ Function2156::
|
||||
scf
|
||||
ret
|
||||
|
||||
Function21a3::
|
||||
EnterMapConnection::
|
||||
ld a, [wPlayerStepDirection]
|
||||
and a
|
||||
jp z, Function2263
|
||||
@@ -607,7 +608,7 @@ Function230f:: ; 230f (0:230f)
|
||||
scf
|
||||
ret
|
||||
|
||||
Function2349::
|
||||
EnterMapWarp::
|
||||
call Function2362
|
||||
call Function239b
|
||||
ld a, [wNextWarpNumber]
|
||||
@@ -703,7 +704,7 @@ LoadMapAttributes::
|
||||
call ReadMapEventHeader
|
||||
ret
|
||||
|
||||
LoadMapAttributes_SkipPeople::
|
||||
LoadMapAttributes_SkipObjects::
|
||||
call CopyMapHeaders
|
||||
call SwitchToMapScriptsBank
|
||||
call ReadMapScripts
|
||||
@@ -946,7 +947,7 @@ ClearObjectStructs:: ; 2550 (0:2550)
|
||||
jr nz, .asm_2563
|
||||
ret
|
||||
|
||||
RestoreFacingAfterWarp::
|
||||
GetWarpDestCoords::
|
||||
call GetMapScriptsBank
|
||||
rst Bankswitch
|
||||
ld hl, wd08f
|
||||
@@ -971,7 +972,7 @@ RestoreFacingAfterWarp::
|
||||
jr nz, .asm_2592
|
||||
call BackUpWarp
|
||||
.asm_2592
|
||||
call GetCoordOfUpperLeftCorner
|
||||
call GetMapScreenCoords
|
||||
ret
|
||||
|
||||
BackUpWarp:: ; 2596 (0:2596)
|
||||
@@ -983,7 +984,7 @@ BackUpWarp:: ; 2596 (0:2596)
|
||||
ld [wBackupMapNumber], a
|
||||
ret
|
||||
|
||||
GetCoordOfUpperLeftCorner:: ; 25a9 (0:25a9)
|
||||
GetMapScreenCoords::
|
||||
ld hl, wc700
|
||||
ld a, [wXCoord]
|
||||
bit 0, a
|
||||
@@ -1697,7 +1698,7 @@ SaveScreen::
|
||||
ld c, $5
|
||||
jr SaveScreen_LoadNeighbor
|
||||
|
||||
LoadNeighboringBlockData::
|
||||
LoadConnectionBlockData::
|
||||
ld hl, wOverworldMapAnchor
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@@ -2413,7 +2414,7 @@ GetFishingGroup::
|
||||
pop de
|
||||
ret
|
||||
|
||||
LoadTilesetHeader:: ; 2dfa (0:2dfa)
|
||||
LoadMapTileset::
|
||||
push hl
|
||||
push bc
|
||||
ld hl, $56be
|
||||
|
||||
23
main.asm
23
main.asm
@@ -79,13 +79,10 @@ INCLUDE "engine/menus/empty_sram.asm"
|
||||
INCLUDE "engine/menus/save.asm"
|
||||
INCLUDE "data/maps/spawn_points.asm"
|
||||
INCLUDE "engine/overworld/load_map_part.asm"
|
||||
dr $153ba, $15484
|
||||
RunMapSetupScript::
|
||||
dr $15484, $1560c
|
||||
DelayLoadingNewSprites:
|
||||
dr $1560c, $15612
|
||||
Function15612::
|
||||
dr $15612, $15871
|
||||
dr $153ba, $15440 ; random slots stuff?
|
||||
INCLUDE "engine/overworld/spawn_points.asm"
|
||||
INCLUDE "engine/overworld/map_setup.asm"
|
||||
dr $156be, $15871
|
||||
PokemonCenterPC:
|
||||
dr $15871, $159b0
|
||||
Function159b0:
|
||||
@@ -140,7 +137,9 @@ _ExitMenu::
|
||||
_InitVerticalMenuCursor::
|
||||
dr $24395, $243eb
|
||||
UpdateItemDescription:
|
||||
dr $243eb, $244d7
|
||||
dr $243eb, $24477
|
||||
LoadObjectMasks:
|
||||
dr $24477, $244d7
|
||||
_InitScrollingMenu::
|
||||
dr $244d7, $244f3
|
||||
_ScrollingMenu::
|
||||
@@ -240,9 +239,13 @@ Function2a4f6:
|
||||
BackupMysteryGift:
|
||||
dr $2a507, $2a518
|
||||
RestoreMysteryGift:
|
||||
dr $2a518, $2a7d7
|
||||
dr $2a518, $2a539
|
||||
LoadWildMonData:
|
||||
dr $2a539, $2a7d7
|
||||
InitRoamMons:
|
||||
dr $2a7d7, $2a8e0
|
||||
dr $2a7d7, $2a859
|
||||
UpdateRoamMons:
|
||||
dr $2a859, $2a8e0
|
||||
JumpRoamMons:
|
||||
dr $2a8e0, $2a9f7
|
||||
RandomUnseenWildMon:
|
||||
|
||||
4
wram.asm
4
wram.asm
@@ -2293,7 +2293,7 @@ wTextDelayFrames:: ds 1 ; cee9
|
||||
wVBlankOccurred:: ds 1 ; ceea
|
||||
|
||||
wceeb:: ds 1 ; ceeb
|
||||
wceec:: ds 1 ; ceec
|
||||
wDefaultSpawnpoint:: db
|
||||
|
||||
UNION ; ceed
|
||||
; mail temp storage
|
||||
@@ -2939,7 +2939,7 @@ wd17e:: ds 1 ; d17e
|
||||
wd17f:: ds 1 ; d17f
|
||||
wd180:: ds 1 ; d180
|
||||
wd181:: ds 1 ; d181
|
||||
wd182:: ds 1 ; d182
|
||||
wPlayerSpriteSetupFlags:: db ; d182
|
||||
wd183:: ds 1 ; d183
|
||||
wd184:: ds 1 ; d184
|
||||
wd185:: ds 1 ; d185
|
||||
|
||||
Reference in New Issue
Block a user