shithub: pokecrystal

Download patch

ref: 94ebdab6d350fd6ebfd43c5a84710ed14dade8ca
parent: 9aeb0ab522ad36796b2ace55cca17e7314a3bc9a
parent: 739a60b33c54021c975f22d627e4b5e40206fe37
author: Rangi <35663410+Rangi42@users.noreply.github.com>
date: Sat Jan 4 15:08:43 EST 2020

Merge pull request #660 from mid-kid/master

Make the map setup commands match the actual function names better

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -6,7 +6,7 @@
 ; 	FadeMusic
 ; 	PlayStereoSFX
 
-_MapSetup_Sound_Off::
+_InitSound::
 ; restart sound operation
 ; clear all relevant hardware registers & wram
 	push hl
@@ -62,7 +62,7 @@
 	push af
 	ld a, [wMusicFadeID]
 	push af
-	call _MapSetup_Sound_Off
+	call _InitSound
 	pop af
 	ld [wMusicFadeID], a
 	pop af
@@ -2797,7 +2797,7 @@
 
 ClearChannels::
 ; runs ClearChannel for all 4 channels
-; doesn't seem to be used, but functionally identical to MapSetup_Sound_Off
+; doesn't seem to be used, but functionally identical to InitSound
 	ld hl, rNR50
 	xor a
 	ld [hli], a
--- a/constants/map_setup_constants.asm
+++ b/constants/map_setup_constants.asm
@@ -15,55 +15,53 @@
 	const MAPSETUP_FLY        ; fc
 
 ; MapSetupCommands indexes (see engine/overworld/map_setup.asm)
-; Names taken from Condensation water's scripting compendium
-; https://hax.iimarck.us/files/scriptingcodes_eng.htm
 	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        ; 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_load_attributes     ; 1a
-	const map_load_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
+	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
+	const map_init_name_sign             ; 2d
 map_end EQU -1
 
 ; callback types
--- a/constants/serial_constants.asm
+++ b/constants/serial_constants.asm
@@ -1,4 +1,4 @@
-; link types
+; wLinkMode
 	const_def
 	const LINK_NULL        ; 0
 	const LINK_TIMECAPSULE ; 1
--- a/data/maps/setup_scripts.asm
+++ b/data/maps/setup_scripts.asm
@@ -14,163 +14,163 @@
 	dw MapSetupScript_Fly
 
 MapSetupScript_Teleport:
-	db map_prolong_sprites
+	db map_reset_player_object_action
 MapSetupScript_Fly:
 	db map_fade_out_palettes
-	db map_keep_roam
+	db map_jump_roam_mons
 MapSetupScript_Warp:
-	db map_lcd_off
-	db map_sound_off
-	db map_load_spawn
+	db map_disable_lcd
+	db map_init_sound
+	db map_enter_spawn_point
 	db map_load_attributes
-	db map_change_callback
-	db map_spawn_coord
-	db map_player_coord
-	db map_anchor_screen
-	db map_load_blocks
+	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_time_of_day
+	db map_load_time_of_day
 	db map_load_objects
-	db map_lcd_on
-	db map_palettes
-	db map_face_down
-	db map_sprites
-	db map_bike_music
-	db map_max_volume
+	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_animations_on
-	db map_wildmons
+	db map_activate_anims
+	db map_load_wild_mon_data
 	db map_end
 
 MapSetupScript_BadWarp:
-	db map_load_spawn
+	db map_enter_spawn_point
 	db map_load_attributes
-	db map_change_callback
-	db map_spawn_coord
-	db map_player_coord
-	db map_anchor_screen
-	db map_load_blocks
+	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_lcd_off
+	db map_disable_lcd
 	db map_load_graphics
-	db map_time_of_day
+	db map_load_time_of_day
 	db map_fade_out_music
-	db map_lcd_on
+	db map_enable_lcd
 	db map_load_objects
-	db map_palettes
-	db map_face_down
-	db map_sprites
-	db map_fade_music
+	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_animations_on
-	db map_wildmons
+	db map_activate_anims
+	db map_load_wild_mon_data
 	db map_end
 
 MapSetupScript_Connection:
-	db map_animations_off
-	db map_load_connection
+	db map_suspend_anims
+	db map_enter_connection
 	db map_load_attributes
-	db map_change_callback
-	db map_player_coord
-	db map_load_blocks
+	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_music
-	db map_palettes
-	db map_stop_script
-	db map_keep_palettes
-	db map_wildmons
-	db map_update_roam
-	db map_animations_on
+	db map_fade_to_music
+	db map_load_palettes
+	db map_init_name_sign
+	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_prolong_sprites
+	db map_reset_player_object_action
 MapSetupScript_Door:
 	db map_fade_out_palettes
 MapSetupScript_Train:
-	db map_load_warp
+	db map_enter_warp
 	db map_load_attributes
-	db map_warp_face
-	db map_change_callback
-	db map_player_coord
-	db map_load_blocks
+	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_lcd_off
+	db map_disable_lcd
 	db map_load_graphics
-	db map_time_of_day
+	db map_load_time_of_day
 	db map_fade_out_music
-	db map_lcd_on
+	db map_enable_lcd
 	db map_load_objects
-	db map_palettes
-	db map_sprites
-	db map_fade_music
+	db map_load_palettes
+	db map_refresh_sprites
+	db map_fade_to_music
 	db map_fade_in_palettes
-	db map_animations_on
-	db map_wildmons
-	db map_update_roam
+	db map_activate_anims
+	db map_load_wild_mon_data
+	db map_update_roam_mons
 	db map_end
 
 MapSetupScript_ReloadMap:
-	db map_fade
+	db map_fade_music_and_palettes
 	db map_clear_bg_palettes
-	db map_lcd_off
-	db map_sound_off
-	db map_load_blocks
-	db map_connection_blocks
+	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_time_of_day
-	db map_lcd_on
-	db map_palettes
-	db map_sprites
-	db map_music_force
+	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_animations_on
-	db map_wildmons
+	db map_activate_anims
+	db map_load_wild_mon_data
 	db map_end
 
 MapSetupScript_LinkReturn:
-	db map_fade
-	db map_lcd_off
-	db map_sound_off
-	db map_change_callback
-	db map_load_blocks
+	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_time_of_day
-	db map_lcd_on
-	db map_palettes
-	db map_sprites
-	db map_bike_music
+	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_animations_on
-	db map_wildmons
-	db map_text_scroll_off
+	db map_activate_anims
+	db map_load_wild_mon_data
+	db map_enable_text_acceleration
 	db map_end
 
 MapSetupScript_Continue:
-	db map_lcd_off
-	db map_sound_off
-	db map_load_attributes_2
-	db map_anchor_screen
-	db map_start_callback
-	db map_load_blocks
-	db map_connection_blocks
+	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_time_of_day
-	db map_lcd_on
-	db map_palettes
-	db map_sprites
-	db map_bike_music
+	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_animations_on
-	db map_wildmons
+	db map_activate_anims
+	db map_load_wild_mon_data
 	db map_end
 
 MapSetupScript_Submenu:
-	db map_load_blocks
-	db map_connection_blocks
+	db map_load_block_data
+	db map_load_connection_block_data
 	db map_end
--- a/engine/events/map_name_sign.asm
+++ b/engine/events/map_name_sign.asm
@@ -1,6 +1,6 @@
 MAP_NAME_SIGN_START EQU $60
 
-ReturnFromMapSetupScript::
+InitMapNameSign::
 	xor a
 	ldh [hBGMapMode], a
 	farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -617,7 +617,7 @@
 	callasm FlyFromAnim
 	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
-	callasm DelayLoadingNewSprites
+	callasm SkipUpdateMapSprites
 	loadvar VAR_MOVEMENT, PLAYER_NORMAL
 	newloadmap MAPSETUP_FLY
 	callasm FlyToAnim
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -2088,7 +2088,7 @@
 	call DelayFrames
 	xor a
 	ldh [hVBlank], a
-	inc a
+	inc a ; LINK_TIMECAPSULE
 	ld [wLinkMode], a
 	ret
 
--- a/engine/overworld/map_setup.asm
+++ b/engine/overworld/map_setup.asm
@@ -18,7 +18,7 @@
 ReadMapSetupScript:
 .loop
 	ld a, [hli]
-	cp -1
+	cp map_end
 	ret z
 
 	push hl
@@ -62,52 +62,52 @@
 ; entries correspond to command indexes in constants/map_setup_constants.asm
 	dba EnableLCD ; 00
 	dba DisableLCD ; 01
-	dba MapSetup_Sound_Off ; 02
+	dba InitSound ; 02
 	dba PlayMapMusic ; 03
 	dba RestartMapMusic ; 04
 	dba FadeToMapMusic ; 05
-	dba RotatePalettesRightMapAndMusic ; 06
-	dba EnterMapMusic ; 07
+	dba FadeMapMusicAndPalettes ; 06
+	dba PlayMapMusicBike ; 07
 	dba ForceMapMusic ; 08
 	dba FadeInMusic ; 09
 	dba LoadBlockData ; 0a (callback 1)
-	dba LoadNeighboringBlockData ; 0b
+	dba LoadConnectionBlockData ; 0b
 	dba SaveScreen ; 0c
 	dba BufferScreen ; 0d
-	dba LoadGraphics ; 0e
-	dba LoadTileset ; 0f
+	dba LoadMapGraphics ; 0e
+	dba LoadMapTileset ; 0f
 	dba LoadMapTimeOfDay ; 10
 	dba LoadMapPalettes ; 11
 	dba LoadWildMonData ; 12
 	dba RefreshMapSprites ; 13
 	dba HandleNewMap ; 14
-	dba InitCommandQueue ; 15
-	dba LoadObjectsRunCallback_02 ; 16
-	dba LoadSpawnPoint ; 17
+	dba HandleContinueMap ; 15
+	dba LoadMapObjects ; 16
+	dba EnterMapSpawnPoint ; 17
 	dba EnterMapConnection ; 18
-	dba LoadWarpData ; 19
+	dba EnterMapWarp ; 19
 	dba LoadMapAttributes ; 1a
-	dba LoadMapAttributes_SkipPeople ; 1b
+	dba LoadMapAttributes_SkipObjects ; 1b
 	dba ClearBGPalettes ; 1c
 	dba FadeOutPalettes ; 1d
 	dba FadeInPalettes ; 1e
-	dba GetCoordOfUpperLeftCorner ; 1f
-	dba RestoreFacingAfterWarp ; 20
+	dba GetMapScreenCoords ; 1f
+	dba GetWarpDestCoords ; 20
 	dba SpawnInFacingDown ; 21
 	dba SpawnPlayer ; 22
 	dba RefreshPlayerCoords ; 23
-	dba DelayClearingOldSprites ; 24
-	dba DelayLoadingNewSprites ; 25
+	dba ResetPlayerObjectAction ; 24
+	dba SkipUpdateMapSprites ; 25
 	dba UpdateRoamMons ; 26
 	dba JumpRoamMons ; 27
-	dba FadeOldMapMusic ; 28
+	dba FadeOutMapMusic ; 28
 	dba ActivateMapAnims ; 29
 	dba SuspendMapAnims ; 2a
-	dba RetainOldPalettes ; 2b
-	dba DontScrollText ; 2c
-	dba ReturnFromMapSetupScript ; 2d
+	dba ApplyMapPalettes ; 2b
+	dba EnableTextAcceleration ; 2c
+	dba InitMapNameSign ; 2d
 
-DontScrollText:
+EnableTextAcceleration:
 	xor a
 	ld [wDisableTextAcceleration], a
 	ret
@@ -122,7 +122,7 @@
 	ldh [hMapAnims], a
 	ret
 
-LoadObjectsRunCallback_02:
+LoadMapObjects:
 	ld a, MAPCALLBACK_OBJECTS
 	call RunMapCallback
 	farcall LoadObjectMasks
@@ -132,12 +132,12 @@
 ; unused
 	ret
 
-DelayClearingOldSprites:
+ResetPlayerObjectAction:
 	ld hl, wPlayerSpriteSetupFlags
 	set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
 	ret
 
-DelayLoadingNewSprites:
+SkipUpdateMapSprites:
 	ld hl, wPlayerSpriteSetupFlags
 	set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
 	ret
@@ -216,16 +216,16 @@
 	and a
 	ret
 
-FadeOldMapMusic:
+FadeOutMapMusic:
 	ld a, 6
 	call SkipMusic
 	ret
 
-RetainOldPalettes:
+ApplyMapPalettes:
 	farcall _UpdateTimePals
 	ret
 
-RotatePalettesRightMapAndMusic:
+FadeMapMusicAndPalettes:
 	ld e, 0
 	ld a, [wMusicFadeID]
 	ld d, 0
--- a/engine/overworld/spawn_points.asm
+++ b/engine/overworld/spawn_points.asm
@@ -1,6 +1,6 @@
 INCLUDE "data/maps/spawn_points.asm"
 
-LoadSpawnPoint:
+EnterMapSpawnPoint:
 	; loads the spawn point in wDefaultSpawnpoint
 	push hl
 	push de
--- a/engine/overworld/warp_connection.asm
+++ b/engine/overworld/warp_connection.asm
@@ -6,7 +6,7 @@
 	call ResetBikeFlags
 	ld a, MAPCALLBACK_NEWMAP
 	call RunMapCallback
-InitCommandQueue:
+HandleContinueMap:
 	farcall ClearCmdQueue
 	ld a, MAPCALLBACK_CMDQUEUE
 	call RunMapCallback
@@ -149,7 +149,7 @@
 	scf
 	ret
 
-LoadWarpData:
+EnterMapWarp:
 	call .SaveDigWarp
 	call .SetSpawn
 	ld a, [wNextWarp]
@@ -295,8 +295,8 @@
 	ldh [rVBK], a
 	ret
 
-LoadGraphics:
-	call LoadTileset
+LoadMapGraphics:
+	call LoadMapTileset
 	call LoadTilesetGFX
 	xor a
 	ldh [hMapAnims], a
@@ -313,7 +313,7 @@
 
 RefreshMapSprites:
 	call ClearSprites
-	farcall ReturnFromMapSetupScript
+	farcall InitMapNameSign
 	call GetMovementPermissions
 	farcall RefreshPlayerSprite
 	farcall CheckReplaceKrisSprite
@@ -325,7 +325,7 @@
 	call SafeUpdateSprites
 .skip
 	ld a, [wPlayerSpriteSetupFlags]
-	and %00011100
+	and (1 << PLAYERSPRITESETUP_FEMALE_TO_MALE_F) | (1 << 3) | (1 << 4)
 	ld [wPlayerSpriteSetupFlags], a
 	ret
 
@@ -386,7 +386,7 @@
 	scf
 	ret
 
-GetCoordOfUpperLeftCorner::
+GetMapScreenCoords::
 	ld hl, wOverworldMapBlocks
 	ld a, [wXCoord]
 	bit 0, a
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -1309,7 +1309,7 @@
 	cp RESTART_MAP_MUSIC
 	jr z, .restart_map_music
 	cp ENTER_MAP_MUSIC
-	call z, EnterMapMusic
+	call z, PlayMapMusicBike
 	xor a
 	ld [wPokegearRadioMusicPlaying], a
 	ret
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -1,6 +1,6 @@
 ; Audio interfaces.
 
-MapSetup_Sound_Off::
+InitSound::
 	push hl
 	push de
 	push bc
@@ -8,11 +8,11 @@
 
 	ldh a, [hROMBank]
 	push af
-	ld a, BANK(_MapSetup_Sound_Off)
+	ld a, BANK(_InitSound)
 	ldh [hROMBank], a
 	ld [MBC3RomBank], a
 
-	call _MapSetup_Sound_Off
+	call _InitSound
 
 	pop af
 	ldh [hROMBank], a
@@ -71,7 +71,7 @@
 
 	ldh a, [hROMBank]
 	push af
-	ld a, BANK(_PlayMusic) ; aka BANK(_MapSetup_Sound_Off)
+	ld a, BANK(_PlayMusic) ; aka BANK(_InitSound)
 	ldh [hROMBank], a
 	ld [MBC3RomBank], a
 
@@ -83,7 +83,7 @@
 	jr .end
 
 .nomusic
-	call _MapSetup_Sound_Off
+	call _InitSound
 
 .end
 	pop af
@@ -359,7 +359,8 @@
 	pop hl
 	ret
 
-EnterMapMusic::
+PlayMapMusicBike::
+; If the player's on a bike, play the bike music instead of the map music
 	push hl
 	push de
 	push bc
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -272,9 +272,9 @@
 
 	ldh a, [hTilesPerCycle]
 	push af
-
 	ld a, $8
 	ldh [hTilesPerCycle], a
+
 	ld a, [wLinkMode]
 	cp LINK_MOBILE
 	jr nz, .NotMobile
--- a/home/init.asm
+++ b/home/init.asm
@@ -1,6 +1,6 @@
 Reset::
 	di
-	call MapSetup_Sound_Off
+	call InitSound
 	xor a
 	ldh [hMapAnims], a
 	call ClearPalettes
@@ -162,7 +162,7 @@
 
 	predef InitSGBBorder ; SGB init
 
-	call MapSetup_Sound_Off
+	call InitSound
 	xor a
 	ld [wMapMusic], a
 	jp GameInit
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -338,6 +338,12 @@
 	ret
 
 WaitPressAorB_BlinkCursor::
+; Show a blinking cursor in the lower right-hand
+; corner of a textbox and wait until A or B is
+; pressed.
+;
+; NOTE: The cursor has to be shown before calling
+; this function or no cursor will be shown at all.
 	ldh a, [hMapObjectIndexBuffer]
 	push af
 	ldh a, [hObjectStructIndexBuffer]
@@ -373,6 +379,9 @@
 	ret
 
 PromptButton::
+; Show a blinking cursor in the lower right-hand
+; corner of a textbox and wait until A or B is
+; pressed, afterwards, play a sound.
 	ld a, [wLinkMode]
 	and a
 	jr nz, .link
--- a/home/map.asm
+++ b/home/map.asm
@@ -381,11 +381,11 @@
 	call CopyMapPartialAndAttributes
 	call SwitchToMapScriptsBank
 	call ReadMapScripts
-	xor a ; do not skip object_events
+	xor a ; do not skip object events
 	call ReadMapEvents
 	ret
 
-LoadMapAttributes_SkipPeople::
+LoadMapAttributes_SkipObjects::
 	call CopyMapPartialAndAttributes
 	call SwitchToMapScriptsBank
 	call ReadMapScripts
@@ -657,7 +657,7 @@
 	jr nz, .loop
 	ret
 
-RestoreFacingAfterWarp::
+GetWarpDestCoords::
 	call GetMapScriptsBank
 	rst Bankswitch
 
@@ -685,7 +685,7 @@
 	call .backup
 
 .skip
-	farcall GetCoordOfUpperLeftCorner
+	farcall GetMapScreenCoords
 	ret
 
 .backup
@@ -1438,7 +1438,7 @@
 .vertical
 	ld b, SCREEN_META_WIDTH
 	ld c, SCREEN_META_HEIGHT - 1
-	jr SaveScreen_LoadNeighbor
+	jr SaveScreen_LoadConnection
 
 .left
 	ld de, wScreenSave + 1
@@ -1450,9 +1450,9 @@
 .horizontal
 	ld b, SCREEN_META_WIDTH - 1
 	ld c, SCREEN_META_HEIGHT
-	jr SaveScreen_LoadNeighbor
+	jr SaveScreen_LoadConnection
 
-LoadNeighboringBlockData::
+LoadConnectionBlockData::
 	ld hl, wOverworldMapAnchor
 	ld a, [hli]
 	ld h, [hl]
@@ -1464,7 +1464,7 @@
 	ld b, SCREEN_META_WIDTH
 	ld c, SCREEN_META_HEIGHT
 
-SaveScreen_LoadNeighbor::
+SaveScreen_LoadConnection::
 .row
 	push bc
 	push hl
@@ -1481,7 +1481,6 @@
 	ld e, a
 	jr nc, .okay
 	inc d
-
 .okay
 	pop hl
 	ldh a, [hConnectionStripLength]
@@ -2260,7 +2259,7 @@
 	pop de
 	ret
 
-LoadTileset::
+LoadMapTileset::
 	push hl
 	push bc
 
--- a/home/window.asm
+++ b/home/window.asm
@@ -39,7 +39,7 @@
 	ld a, $90
 	ldh [hWY], a
 	call ReplaceKrisSprite
-	farcall ReturnFromMapSetupScript
+	farcall InitMapNameSign
 	farcall LoadOverworldFont
 	ret
 
--- a/maps/PlayersHouse2F.asm
+++ b/maps/PlayersHouse2F.asm
@@ -44,7 +44,7 @@
 GameConsoleScript:
 	describedecoration DECODESC_CONSOLE
 
-PlayersHousePosterScript:
+PosterScript:
 	conditional_event EVENT_PLAYERS_ROOM_POSTER, .Script
 
 .Script:
@@ -125,7 +125,7 @@
 	bg_event  2,  1, BGEVENT_UP, PlayersHousePCScript
 	bg_event  3,  1, BGEVENT_READ, PlayersHouseRadioScript
 	bg_event  5,  1, BGEVENT_READ, PlayersHouseBookshelfScript
-	bg_event  6,  0, BGEVENT_IFSET, PlayersHousePosterScript
+	bg_event  6,  0, BGEVENT_IFSET, PosterScript
 
 	db 4 ; object events
 	object_event  4,  2, SPRITE_CONSOLE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GameConsoleScript, EVENT_PLAYERS_HOUSE_2F_CONSOLE
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -1089,9 +1089,9 @@
 	ld [de], a
 	ret
 
-Function1006fd:
-	ld a, $04
-	ld hl, $a800
+MobileBattleResetTimer:
+	ld a, BANK(sMobileBattleTimer)
+	ld hl, sMobileBattleTimer
 	call GetSRAMBank
 	xor a
 	ld [hli], a
@@ -1272,7 +1272,7 @@
 .asm_100830
 	ld [hld], a
 	ccf
-	ld a, [wBGMapBufferPtrs]
+	ld a, [wcd70]
 	adc [hl]
 	sub $3c
 	jr nc, .asm_10083c
@@ -7543,7 +7543,7 @@
 	ld a, c
 	and a
 	ret z
-	farcall Function1006fd
+	farcall MobileBattleResetTimer
 	ret
 
 .failed_to_save
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -691,7 +691,7 @@
 	ldh [rSVBK], a
 	farcall ReloadMapPart
 	ld a, [wLinkMode]
-	cp $4
+	cp LINK_MOBILE
 	jr z, .asm_11642a
 	ld a, $8
 	ld [wMusicFade], a
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -7324,7 +7324,7 @@
 	farcall Function17d1f1
 	ld a, $1
 	ld [wForceEvolution], a
-	ld a, $2
+	ld a, LINK_TRADECENTER
 	ld [wLinkMode], a
 	farcall EvolvePokemon
 	xor a
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -295,7 +295,7 @@
 	farcall Function17d1f1
 	ld a, $1
 	ld [wForceEvolution], a
-	ld a, $2
+	ld a, LINK_TRADECENTER
 	ld [wLinkMode], a
 	farcall EvolvePokemon
 	xor a
--- a/sram.asm
+++ b/sram.asm
@@ -260,7 +260,7 @@
 
 	ds $1f0
 
-sMobileBattleTimer:: ds 3
+sMobileBattleTimer:: ds 3 ; a800
 
 
 SECTION "SRAM Mobile 2", SRAM
--- a/wram.asm
+++ b/wram.asm
@@ -1288,7 +1288,8 @@
 wcd6c:: ds 1
 wcd6d:: ds 1
 wcd6e:: ds 1
-wcd6f:: ds 2
+wcd6f:: ds 1
+wcd70:: ds 1
 wcd71:: ds 1
 wcd72:: ds 1
 wcd73:: ds 1