Finished labelling overworld loop states

This commit is contained in:
DrippingYellow 2025-12-12 20:22:47 -06:00
parent c13ff726a7
commit b23ebba34a
26 changed files with 402 additions and 366 deletions

View File

@ -241,11 +241,11 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const BATTLEACTION_STRUGGLE
const BATTLEACTION_FORFEIT
; wBattleResult
; wBattleEnded
const_def
const DRAW
const LOSE
const WIN
const LOSE
const DRAW
DEF BATTLERESULT_BOX_FULL EQU 7
DEF BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_BOX_FULL)

View File

@ -122,9 +122,8 @@ DEF PLAYER_SURF_PIKA EQU 8
const CONTINUED_F
const SAVE_FILE_EXISTS_F ; Set but not read anywhere.
const_skip 2
; These two are reset by Function2b39, but otherwise unreferenced.
const UNK_DEBUG_FLAG_6_F
const UNK_DEBUG_FLAG_7_F
const UNK_DEBUG_FLAG_6_F ; Only set in Unreferenced_CheckInlineTrainers, not read anywhere
const SKIP_MAP_SCRIPT_F
; wSaveFileFlags::
const_def
@ -160,3 +159,24 @@ const BATTLEANIM_STOP_F ; 0
const BATTLEANIM_IN_SUBROUTINE_F ; 1
const BATTLEANIM_IN_LOOP_F ; 2
const BATTLEANIM_KEEPSPRITES_F ; 3
; wOverworldFlags::
const_def 6
const OVERWORLD_DISABLE_MAP_CONNECTIONS_F
const OVERWORLD_PAUSE_MAP_PROCESSES_F
; wMapStatus::
const_def
const MAPSTATUS_MAIN
const MAPSTATUS_EVENT_RUNNING
const MAPSTATUS_02
const MAPSTATUS_START_WILD_BATTLE
const MAPSTATUS_RETURN_TO_MAIN
const MAPSTATUS_05
const MAPSTATUS_06
const MAPSTATUS_07
const MAPSTATUS_START_TRAINER_BATTLE
const MAPSTATUS_DEBUG_MAP_VIEWER
const MAPSTATUS_UNUSED
const MAPSTATUS_EXIT_BATTLE
const MAPSTATUS_RETURN_FROM_BATTLE

View File

@ -35,8 +35,8 @@ FieldDebug_OpenMapViewer:
done
.MapViewScript:
ld a, 9
call WriteIntod637
ld a, MAPSTATUS_DEBUG_MAP_VIEWER
call SetMapStatus
xor a
ldh [hJoypadSum], a
ld a, DEBUGMAPVIEWER_INIT
@ -55,14 +55,14 @@ DebugMapViewer::
call GetJoypad
call .do_jumptable
jr c, .continue
call Function2c4a
call HandleMapObjects
jr nc, .loop
callfar CheckObjectEnteringVisibleRange
jr .loop
.continue
ld a, 4
call WriteIntod637
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
pop bc
ld a, b
ld [wd153], a
@ -361,7 +361,7 @@ DebugMapViewer_LoadCursorSprite:
SECTION "engine/debug/field/map_viewer.inc@DisplayBGEventDetails", ROMX
DisplayBGEventDetails:
call GetSignpost
call GetBGEvent
ret nc
call .Functionfd0cc
call RefreshScreen
@ -384,7 +384,7 @@ DisplayBGEventDetails:
ld [wHPBarOldHP], a
ld a, b
ld [wReplacementBlock], a
ld a, [wCurrMapSignCount]
ld a, [wCurMapBGEventCount]
sub c
inc a
ld [wHPBarNewHP], a

View File

@ -54,7 +54,7 @@ DoTeleportAnimation:
set SCRIPTED_MOVEMENT_STATE_F, [hl]
.loop
call Function2c4a
call HandleMapObjects
ld a, [wStateFlags]
bit SCRIPTED_MOVEMENT_STATE_F, a
jr nz, .loop

View File

@ -185,10 +185,10 @@ Unreferenced_TestTrainerWalkToPlayer:
ld d, 0
add hl, de
call LoadMovementDataPointer
ld hl, wc5ed
set 7, [hl]
ld a, 1
call WriteIntod637
ld hl, wOverworldFlags
set OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
.MovementData:

View File

@ -5788,8 +5788,8 @@ BattleCommand_TryEscape:
call CallFromBank0F
xor a
ld [wNumHits], a
inc a ; LOSE
ld [wBattleResult], a
inc a ; TRUE
ld [wBattleEnded], a
ld a, [wPlayerMoveStruct]
jr .run_away
@ -5842,8 +5842,8 @@ BattleCommand_TryEscape:
call CallFromBank0F
xor a
ld [wNumHits], a
inc a
ld [wBattleResult], a
inc a ; TRUE
ld [wBattleEnded], a
ld a, [wEnemyMoveStruct]
jr .run_away

View File

@ -147,13 +147,13 @@ SafariZonePAText:
asm_3c132:
call ReloadTilesFromBuffer
ld a, 2
ld [wcd5d], a
ld [wBattleResult], a
ld a, [wLinkMode]
and a
ld hl, WildPokemonFledText
jr z, asm_3c14a
xor a
ld [wcd5d], a
ld [wBattleResult], a
ld hl, EnemyPokemonFledText
asm_3c14a:
@ -231,7 +231,7 @@ asm_3c1c4:
asm_3c200:
call DisplayBattleMenu
ret c
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
ld hl, wPlayerSubStatus5
@ -473,7 +473,7 @@ asm_3c3c7:
jr c, asm_3c3eb
callfar DoEnemyTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c492
@ -485,7 +485,7 @@ asm_3c3eb:
call DrawHUDsAndHPBars
callfar DoPlayerTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c48d
@ -501,7 +501,7 @@ asm_3c3eb:
asm_3c41d:
callfar DoPlayerTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c48d
@ -515,7 +515,7 @@ asm_3c41d:
jr c, asm_3c460
callfar DoEnemyTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c492
@ -1248,7 +1248,7 @@ asm_3c94d:
call PrintEmptyString
call BackUpTilesToBuffer
xor a
ld [wcd5d], a
ld [wBattleResult], a
ld b, $4b
call Function32c8
push af
@ -1504,7 +1504,7 @@ asm_3cb56:
ld de, $c37d
call sub_3ccef
ld a, 1
ld [wcd5d], a
ld [wBattleResult], a
ld a, [wcad5]
and a
ret z
@ -2354,7 +2354,7 @@ TryRunningFromBattle:
jr z, .play_sound
dec a
.play_sound
ld [wcd5d], a
ld [wBattleResult], a
push de
ld de, SFX_RUN
call WaitPlaySFX
@ -3191,7 +3191,7 @@ BattleMenu_Pack:
xor a
ld [wWildMon], a
ld a, 2
ld [wcd5d], a
ld [wBattleResult], a
call ClearWindowData
call SetPalettes
scf
@ -6091,7 +6091,7 @@ _InitBattleCommon:
cp 1
call z, UpdateEnemyHUD
call StartBattle
call sub_3f13e
call ExitBattle
pop af
ld [wTextboxFlags], a
pop af
@ -6312,7 +6312,7 @@ Data3f0d0:
InitBattleVariables:
xor a
ld [wFieldMoveSucceeded], a
ld [wcd5d], a
ld [wBattleResult], a
ld hl, wcd3c
ld [hli], a
ld [hli], a
@ -6323,7 +6323,7 @@ InitBattleVariables:
ld [wBattleMonSpecies], a
ld [wBattleParticipantsNotFainted], a
ld [wCurBattleMon], a
ld [wBattleResult], a
ld [wBattleEnded], a
ld [wTimeOfDayPal], a
ld [wEnemyTurnsTaken], a
ld hl, wPlayerHPPal
@ -6356,24 +6356,25 @@ InitBattleVariables:
.return
ret
sub_3f13e:
ExitBattle:
call IsLinkBattle
jr nz, asm_3f148
call sub_3f1f3
jr asm_3f151
jr nz, .HandleEndOfBattle
call ShowLinkBattleParticipantsAfterEnd
jr .CheckEvolution
asm_3f148:
ld a, [wcd5d]
.HandleEndOfBattle
ld a, [wBattleResult]
and a
jr nz, asm_3f15a
call sub_3f19e
jr nz, .CleanUpBattleRAM
; WIN
call CheckPayDay
asm_3f151:
.CheckEvolution
xor a
ld [wForceEvolution], a
predef EvolveAfterBattle
asm_3f15a:
.CleanUpBattleRAM:
xor a
ld [wLowHealthAlarmBuffer], a
ld [wBattleMode], a
@ -6383,7 +6384,7 @@ asm_3f15a:
ld [wOtherTrainerClass], a
ld [wce38], a
ld [wce39], a
ld [wBattleResult], a
ld [wBattleEnded], a
ld hl, wcd3c
ld [hli], a
ld [hli], a
@ -6391,14 +6392,15 @@ asm_3f15a:
ld [hl], a
ld [wMenuScrollPosition], a
ld hl, wPlayerSubStatus1
ld b, $18
.clear
ld b, wEnemyFuryCutterCount - wPlayerSubStatus1
.loop
ld [hli], a
dec b
jr nz, .clear
jr nz, .loop
ld hl, wd4a7
set 0, [hl]
call WaitSFX
ld a, $e3
ldh [rLCDC], a
ld hl, wd14f
@ -6406,19 +6408,21 @@ asm_3f15a:
call ClearPalettes
ret
sub_3f19e:
CheckPayDay:
ld hl, wPayDayMoney
ld a, [hli]
or [hl]
inc hl
or [hl]
ret z
ld a, [wBattleMonItem]
ld b, a
callfar GetItemHeldEffect
ld a, b
cp $4c
cp HELD_AMULET_COIN
jr nz, AddBattleMoneyToAccount
ld hl, wPayDayMoney + 2
sla [hl]
dec hl
@ -6426,6 +6430,7 @@ sub_3f19e:
dec hl
rl [hl]
jr nc, AddBattleMoneyToAccount
ld a, $ff
ld [hli], a
ld [hli], a
@ -6455,27 +6460,27 @@ BattleText_PlayerPickedUpPayDayMoney:
line "ひろった!"
prompt
sub_3f1f3:
ShowLinkBattleParticipantsAfterEnd:
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
ld bc, $30
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [wEnemyMonStatus]
ld [hl], a
call ClearTileMap
call sub_3f60c
ld a, [wcd5d]
cp 1
call _ShowLinkBattleParticipants
ld a, [wBattleResult]
cp LOSE
ld de, WonAgainstText
jr c, .print_text
jr c, .store_result
ld de, LostAgainstText
jr z, .print_text
jr z, .store_result
ld de, TiedAgainstText
.print_text
ld hl, $c346
.store_result
hlcoord 6, 8
call PlaceString
ld c, $c8
ld c, 200
call DelayFrames
ret
@ -6732,7 +6737,7 @@ WantsToBattleText:
ShowLinkBattleParticipants:
call IsLinkBattle
jr nz, .ok
call sub_3f60c
call _ShowLinkBattleParticipants
call ClearTileMap
.ok
call DelayFrame
@ -6749,22 +6754,22 @@ ShowLinkBattleParticipants:
ldh [hMapAnims], a
ret
sub_3f60c:
_ShowLinkBattleParticipants:
call LoadFontExtra
ld hl, $c2f3
hlcoord 3, 4
ld b, 7
ld c, $c
ld c, 12
call DrawTextBox
ld hl, $c31c
hlcoord 4, 6
ld de, wPlayerName
call PlaceString
ld hl, $c36c
hlcoord 4, 10
ld de, wOTPlayerName
call PlaceString
ld hl, $c349
ld a, $69
hlcoord 9, 8
ld a, ""
ld [hli], a
ld [hl], $6a
ld [hl], ""
callfar LinkBattle_TrainerHuds
ld c, 150
jp DelayFrames

View File

@ -1611,8 +1611,8 @@ PokeDollEffect:
dec a ; WILD_BATTLE?
jp nz, IsntTheTimeMessage
ld a, LOSE
ld [wBattleResult], a
ld a, TRUE
ld [wBattleEnded], a
jp UseItemText
GuardSpecEffect:
@ -1763,7 +1763,7 @@ ENDM
.PlayedTheFlute:
text "<PLAYER>は"
line "#のふえを ふいてみた!@"
; BUG: No text_asm.
; BUG: No start_asm.
ld b, 8
ld a, [wBattleMode]
and a

View File

@ -413,7 +413,7 @@ UnknownMapBufferPointers:
db $02, $11, $A6, $D2, $8F, $47, $A6, $D3 ; OLD_CITY_POKECENTER_2F
db -1
Function14777:
ld a, $00
call WriteIntod637
OverworldLoop_ReturnFromBattle:
ld a, MAPSTATUS_MAIN
call SetMapStatus
ret

View File

@ -974,7 +974,7 @@ PartyCheckLessThanTwo:
PartyHeldItem:
callfar FreezeMonIcons
ld hl, .HoldItemMenu
ld hl, GiveTakeItemMenuData
call LoadMenuHeader
call VerticalMenu
jp c, .close
@ -1019,7 +1019,7 @@ PartyHeldItem:
jr z, .NoItem
ld [wce37], a
call GetItemName
ld hl, ItemPrompt6753
ld hl, PokemonAskSwapItemText
call MenuTextBox
call YesNoBox
call ExitMenu
@ -1034,11 +1034,11 @@ PartyHeldItem:
ld [wce37], a
ld a, b
ld [wCurItem], a
call PartyRecieveItem
call ReceiveItemFromPokemon
jp nc, .GiveItem
ld a, [wce37]
ld [wCurItem], a
ld hl, ItemWasEquippedText
ld hl, PokemonSwapItemText
call MenuTextBoxBackup
jr .CheckMail
@ -1047,7 +1047,7 @@ PartyHeldItem:
ld [wItemQuantity], a
ld hl, wNumBagItems
call TossItem
ld hl, ItemPrompt66FA
ld hl, PokemonHoldItemText
call MenuTextBoxBackup
.CheckMail
call GetPartyItemOffset
@ -1061,13 +1061,13 @@ PartyHeldItem:
.GiveItem
ld a, [wce37]
ld [wCurItem], a
call PartyRecieveItem
ld hl, PartyItemRecieveBagFullText
call ReceiveItemFromPokemon
ld hl, ItemStorageFullText
call MenuTextBoxBackup
jr .ExitGiveItem
.CantGive
ld hl, .CantBeEquippedText
ld hl, ItemCantHeldText
call MenuTextBoxBackup
.ExitGiveItem
call ClearPalettes
@ -1082,102 +1082,86 @@ PartyHeldItem:
and a
jr z, .NoItemToRecieve
ld [wCurItem], a
call PartyRecieveItem
call ReceiveItemFromPokemon
jr nc, .jump2
call GetPartyItemOffset
ld a, [hl]
ld [wce37], a
ld [hl], 0
ld [wNamedObjectIndexBuffer], a
ld [hl], ITEM_NONE
call GetItemName
ld hl, ItemPrompt673D
ld hl, PokemonTookItemText
call MenuTextBoxBackup
jr .escape
.NoItemToRecieve
ld hl, PartyNoItemToRecieveText
ld hl, PokemonNotHoldingText
call MenuTextBoxBackup
jr .escape
.jump2
ld hl, PartyItemRecieveBagFullText
ld hl, ItemStorageFullText
call MenuTextBoxBackup
.escape
ret
.HoldItemMenu ; verticalmenu
GiveTakeItemMenuData:
db STATICMENU_NO_TOP_SPACING | STATICMENU_PLACE_TITLE
menu_coords 4, 4, $e, 9
dw .HoldItemMenuText
db 1
dw .Items
db 1 ; default option
.HoldItemMenuText
db $80
db 2
.Items:
db STATICMENU_CURSOR ; flags
db 2 ; # items
db "そうびを する@"
db "そうびを はずす@"
.CantBeEquippedText
db 1
dw wStringBuffer1
ItemCantHeldText:
text_from_ram wStringBuffer1
text "を そうびすることは"
line "できません<PROMPT>"
line "できません"
prompt
ItemWasEquippedText:
db 1
dw wMonOrItemNameBuffer
PokemonSwapItemText:
text_from_ram wMonOrItemNameBuffer
text "は そうび していた"
line "@"
.UnusedText1
db 1
dw wStringBuffer1
text_from_ram wStringBuffer1
text "を はずして"
para "@"
text_from_ram wStringBuffer2
text "を そうびした!"
prompt
.UnusedText2
db 1
dw wStringBuffer2
text "を そうびした!<PROMPT>"
ItemPrompt66FA:
db 1
dw wMonOrItemNameBuffer
PokemonHoldItemText:
text_from_ram wMonOrItemNameBuffer
text "は @"
.UnusedText3
db 1
dw wStringBuffer2
text_from_ram wStringBuffer2
text "を"
line "そうびした!<PROMPT>"
line "そうびした!"
prompt
PartyNoItemToRecieveText:
db 1
dw wMonOrItemNameBuffer
PokemonNotHoldingText:
text_from_ram wMonOrItemNameBuffer
text "は なにも"
line "そうび していません!<PROMPT>"
line "そうび していません!"
prompt
PartyItemRecieveBagFullText:
ItemStorageFullText:
text "どうぐが いっぱいで"
line "そうびを はずせません!<PROMPT>"
line "そうびを はずせません!"
prompt
ItemPrompt673D:
db 1
dw wMonOrItemNameBuffer
PokemonTookItemText:
text_from_ram wMonOrItemNameBuffer
text "から @"
.UnusedText4
db 1
dw wStringBuffer1
text_from_ram wStringBuffer1
text "を"
line "はずしました!<PROMPT>"
line "はずしました!"
prompt
ItemPrompt6753:
db 1
dw wMonOrItemNameBuffer
PokemonAskSwapItemText:
text_from_ram wMonOrItemNameBuffer
text "は @"
.UnusedText5:
db 1
dw wStringBuffer1
text_from_ram wStringBuffer1
text "を"
line "すでに そうび しています"
para "そうびしている どうぐを"
@ -1191,7 +1175,7 @@ GetPartyItemOffset:
pop af
ret
PartyRecieveItem:
ReceiveItemFromPokemon:
ld a, 1
ld [wItemQuantity], a
ld hl, wNumBagItems

View File

@ -99,29 +99,29 @@ IntroCleanup::
ld de, ShrinkPic1
lb bc, BANK(ShrinkPic1), $00
call IntroDisplayPicCenteredOrUpperRight
ld c, $04
ld c, 4
call DelayFrames
ld de, ShrinkPic2
lb bc, BANK(ShrinkPic2), $00
call IntroDisplayPicCenteredOrUpperRight
ld c, $14
ld c, 20
call DelayFrames
hlcoord 6, 5
ld b, $07
ld c, $07
ld b, 7
ld c, 7
call ClearBox
ld c, $14
ld c, 20
call DelayFrames
call LoadStartingSprites
call LoadFontExtra
ld c, $32
ld c, 50
call DelayFrames
call GBFadeOutToWhite
call ClearTileMap
call Function0502
ld a, $00
ld [wd638], a
ld [wd637], a
ld a, MAPSTATUS_MAIN
ld [wLastMapStatus], a
ld [wMapStatus], a
OverworldStart::
call SetUpGameEntry
@ -130,7 +130,7 @@ OverworldStart::
call z, SpawnPlayer
ld hl, wd4a9
set 0, [hl]
jp Function2a85
jp OverworldLoop
SetUpGameEntry::
ld a, $04

View File

@ -87,7 +87,7 @@ CheckFacingObject:
ld bc, wPlayerSprite
ld a, PLAYER_OBJECT_INDEX
ldh [hMapObjectIndex], a
call _CheckObjectCollision
call IsNPCAtCoord
ret nc
ld hl, OBJECT_WALKING
add hl, bc
@ -107,13 +107,13 @@ WillObjectBumpIntoSomeoneElse:
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
jr _CheckObjectCollision
jr IsNPCAtCoord
IsObjectFacingSomeoneElse:
ldh a, [hMapObjectIndex]
call GetObjectStruct
call .GetFacingCoords
call _CheckObjectCollision
call IsNPCAtCoord
ret
.GetFacingCoords
ld hl, OBJECT_MAP_X
@ -148,7 +148,7 @@ IsObjectFacingSomeoneElse:
; returns the carry flag if a sprite is at coords d, e
; will not collide with sprite index stored in hEventCollisionException
_CheckObjectCollision:
IsNPCAtCoord:
ld bc, wObjectStructs
xor a
.loop
@ -158,22 +158,25 @@ _CheckObjectCollision:
ld a, [hl]
and a
jr z, .next
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .check_last_position
jr nz, .check_current_coords
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .check_last_position
jr nz, .check_current_coords
ldh a, [hEventCollisionException]
ld l, a
ldh a, [hObjectStructIndex]
cp l
jr nz, .collision
.check_last_position
jr nz, .yes
.check_current_coords
ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
@ -188,7 +191,8 @@ _CheckObjectCollision:
ld l, a
ldh a, [hObjectStructIndex]
cp l
jr nz, .collision
jr nz, .yes
.next
ld hl, OBJECT_LENGTH
add hl, bc
@ -201,7 +205,7 @@ _CheckObjectCollision:
and a
ret
.collision
.yes
scf
ret

View File

@ -1040,7 +1040,7 @@ CheckObjectCollision::
ld a, [wPlayerMapY]
add e
ld e, a
callfar _CheckObjectCollision
callfar IsNPCAtCoord
ret nc
jp CheckCompanionObjectCollision

View File

@ -2,8 +2,7 @@ INCLUDE "constants.asm"
SECTION "engine/overworld/player_step.asm", ROMX
; TODO: How does this differ from _HandlePlayerStep, aside from where it's called from?
_HandlePlayerStep_Limited:
_HandlePlayerStep:
ld a, [wPlayerStepFlags]
and a
ret z
@ -28,11 +27,11 @@ _HandlePlayerStep_Limited:
ldh a, [hOverworldFlashlightEffect]
and a
jr nz, .update_overworld_map
call UpdateOverworldMap_Old
call UpdateOverworldMap
jr HandlePlayerStep_Finish
.update_overworld_map
call UpdateOverworldMap
call UpdateOverworldMap_Flashlight
jr HandlePlayerStep_Finish
.update_player_coords
@ -190,7 +189,7 @@ CheckTrainerBattle:
callfar _CheckTrainerBattle
ret
UpdateOverworldMap_Old:
UpdateOverworldMap:
ld a, [wPlayerStepDirection]
and a ; DOWN
jr z, .step_down
@ -348,7 +347,8 @@ ScrollOverworldMapRight:
inc [hl]
ret
_HandlePlayerStep:
; Duplicate of _HandlePlayerStep that only gets run when wMapStatus is 10
_HandlePlayerStep_Unused::
ld a, [wPlayerStepFlags]
and a
ret z
@ -363,14 +363,14 @@ _HandlePlayerStep:
.update_overworld_map
ld a, 4
ld [wHandlePlayerStep], a
call UpdateOverworldMap
call UpdateOverworldMap_Flashlight
jp HandlePlayerStep_Finish
.update_player_coords
call UpdatePlayerCoords
jp HandlePlayerStep_Finish
UpdateOverworldMap:
UpdateOverworldMap_Flashlight:
ld a, [wPlayerStepDirection]
and a
jr z, .step_down

View File

@ -26,13 +26,12 @@ RunMapScript::
pop hl
ret
WriteIntod637::
SetMapStatus::
push af
; TODO: figure out what variables are concerned here
ld a, [wd637]
ld [wd638], a
ld a, [wMapStatus]
ld [wLastMapStatus], a
pop af
ld [wd637], a
ld [wMapStatus], a
ret
ClearMapBuffer::
@ -769,7 +768,7 @@ CopyAndReadHeaders::
inc hl
inc hl
call ReadWarps
call ReadSigns
call ReadBGEvents
ret
GetMapConnections::
@ -840,13 +839,13 @@ ReadWarps::
ret
ReadSigns::
ReadBGEvents::
ld a, [hli]
ld [wCurrMapSignCount], a
ld [wCurMapBGEventCount], a
and a
ret z
ld c, a
ld de, wCurrMapSigns
ld de, wCurrMapBGEvents
.next
ld b, 4
.copy
@ -1540,19 +1539,19 @@ FillEastConnectionStrip::
jr nz, .loop
ret
Function2a85::
.asm_2a85:
OverworldLoop::
.loop
call LoadMap
call Function2a8d
jr .asm_2a85
call _OverworldLoop
jr .loop
Function2a8d::
_OverworldLoop::
push hl
push de
push bc
push af
ld a, [wd637]
ld a, [wMapStatus]
and $f
add a
ld e, a
@ -1579,22 +1578,29 @@ Function2a8d::
pop hl
ret
.Pointers:
dbbw $00, $55, Function2ae5
dbbw $00, $55, Function2b52
dbbw $00, $55, Function2b77
dbbw $0e, $33, Function3904
dbbw $00, $55, Function2b39
dbbw $0e, $33, Function391f
dbbw $00, $33, Function2b78
dbbw $00, $33, Function2b78
dbbw $0e, $33, Function3904
dbbw $00, $55, Function2b79
dbbw $00, $55, Function2b87
dbbw $0e, $33, Function3920
dbbw $05, $33, Function14777
; TODO: Maybe make these a macro?
; Byte 1: Bank
; Byte 2: Unused?
; Bytes 3-4: Pointer to function
Function2ae5::
; Battle-related functions are run in bank $0e, even though they're in bank $f now.
; This doesn't change anything in practice because we still call a predef to go to that bank.
.Pointers:
dbbw $00, $55, OverworldLoop_Main
dbbw $00, $55, OverworldLoop_EventRunning
dbbw $00, $55, OverworldLoop_02
dbbw $0e, $33, OverworldLoop_StartBattle
dbbw $00, $55, OverworldLoop_ReturnToMain
dbbw $0e, $33, OverworldLoop_05
dbbw $00, $33, OverworldLoop_06
dbbw $00, $33, OverworldLoop_07
dbbw $0e, $33, OverworldLoop_StartBattle
dbbw $00, $55, OverworldLoop_DebugMapViewer
dbbw $00, $55, OverworldLoop_Unused
dbbw $0e, $33, OverworldLoop_ExitBattle
dbbw BANK(OverworldLoop_ReturnFromBattle), $33, OverworldLoop_ReturnFromBattle
OverworldLoop_Main::
.loop:
ld hl, wJoypadFlags
set 4, [hl]
@ -1605,96 +1611,109 @@ Function2ae5::
res 4, [hl]
res 6, [hl]
call GetJoypad
call Function2be5
ld hl, wc5ed
bit 7, [hl]
res 7, [hl]
call RunMapTextSubroutine
ld hl, wOverworldFlags
bit OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
res OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
ret nz
call TestWildBattleStart
ret nz
call OverworldStartButtonCheck
ret nz
callfar OverworldMovementCheck
ldh a, [hMapEntryMethod]
and a
ret nz
call Function2c4a
call HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
ld a, [wc5ed]
bit 6, a
ld a, [wOverworldFlags]
bit OVERWORLD_DISABLE_MAP_CONNECTIONS_F, a
jr nz, .loop
call CheckMovingOffEdgeOfMap
ret c
call WarpCheck
ret c
jr .loop
Function2b39::
OverworldLoop_ReturnToMain::
ld hl, wJoypadFlags
res 4, [hl]
res 6, [hl]
ld hl, wDebugFlags
res UNK_DEBUG_FLAG_6_F, [hl]
res UNK_DEBUG_FLAG_7_F, [hl]
res SKIP_MAP_SCRIPT_F, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ld a, $0
call WriteIntod637
ld a, MAPSTATUS_MAIN
call SetMapStatus
ret
Function2b52::
.asm_2b52:
OverworldLoop_EventRunning::
.loop
call UpdateTime
ld a, [wStateFlags]
bit SCRIPTED_MOVEMENT_STATE_F, a
jr z, Function2b39
jr z, OverworldLoop_ReturnToMain
ldh a, [hMapEntryMethod]
and a
ret nz
call Function2c4a
jr nc, .asm_2b52
call HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
call CheckMovingOffEdgeOfMap
ret c
call WarpCheck
ret c
jr .asm_2b52
jr .loop
Function2b77::
OverworldLoop_02::
ret
Function2b78::
OverworldLoop_06::
OverworldLoop_07::
ret
Function2b79::
OverworldLoop_DebugMapViewer::
callfar DebugMapViewer
ld a, $4
call WriteIntod637
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
ret
Function2b87::
.asm_2b87:
; A pared-down version of the standard overworld loop.
; TODO: Figure out how this actually works.
OverworldLoop_Unused::
.loop
call UpdateTime
call GetJoypad
call OverworldStartButtonCheck
ret nz
callfar OverworldMovementCheck
call Function2ba8
jr nc, .asm_2b87
call .HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
jr .asm_2b87
jr .loop
Function2ba8::
.HandleMapObjects:
.loop2
ldh a, [hROMBank]
push af
ld a, BANK(HandleNPCStep)
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(_HandlePlayerStep)
ld a, BANK(_HandlePlayerStep_Unused)
call Bankswitch
call _HandlePlayerStep
call _HandlePlayerStep_Unused
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites
@ -1710,13 +1729,13 @@ Function2ba8::
bit PLAYERSTEP_CONTINUE_F, a
ret z
bit PLAYERSTEP_STOP_F, a
jr z, Function2ba8
jr z, .loop2
scf
ret
Function2be5:: ; TODO
RunMapTextSubroutine::
ld a, [wDebugFlags]
bit UNK_DEBUG_FLAG_7_F, a
bit SKIP_MAP_SCRIPT_F, a
ret nz
ld a, [wMapGroup]
ld b, a

View File

@ -37,11 +37,10 @@ CheckStartmenuSelectHook:
dec a
ret
Function2c4a:
; copy of Function2ba8
; calling _HandlePlayerStep_Limited instead of _HandlePlayerStep
; Runs the code for all map objects that move, and stays in a loop as long as the player is moving.
HandleMapObjects::
.loop
call Function2c5a
call .HandleMapObjects
and a
ld a, [wPlayerStepFlags]
bit PLAYERSTEP_CONTINUE_F, a
@ -51,16 +50,16 @@ Function2c4a:
scf
ret
Function2c5a:
.HandleMapObjects:
ldh a, [hROMBank]
push af
ld a, BANK(HandleNPCStep)
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(_HandlePlayerStep_Limited)
ld a, BANK(_HandlePlayerStep)
call Bankswitch
call _HandlePlayerStep_Limited
call _HandlePlayerStep
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites
@ -77,7 +76,7 @@ UpdateAndTransferToolgear:
call DelayFrame
call UpdateToolgear
ld hl, wToolgearFlags
set 2, [hl] ; ; transfer toolgear to window
set 2, [hl] ; transfer toolgear to window
call DelayFrame
ret

View File

@ -107,7 +107,7 @@ QueueMapTextSubroutine::
bit A_BUTTON_F, a
jp z, xor_a ; if we didn't press a
call GetFacingPersonText
jp nc, Function30e8 ; if not talking to a person
jp nc, .CheckBGEvent ; if not talking to a person
ld d, $0
ld e, a
ld a, [wDebugFlags]
@ -130,8 +130,8 @@ QueueMapTextSubroutine::
call xor_a_dec_a
ret
Function30e8::
call GetFacingSignpost
.CheckBGEvent:
call CheckFacingBGEvent
jp nc, xor_a ; if not facing person or sign
ld a, e
ldh [hFFEB], a

View File

@ -354,43 +354,48 @@ GetBlockLocation::
add hl, bc
ret
GetFacingSignpost::
CheckFacingBGEvent::
call GetFacingTileCoord
; Load facing into b.
ld b, a
GetSignpost::
; Convert the coordinates at de to within-boundaries coordinates.
GetBGEvent::
ld a, d
sub $4
sub 4
ld d, a
ld a, e
sub $4
sub 4
ld e, a
ld a, [wCurrMapSignCount]
; If there are no BG events, we don't need to be here.
ld a, [wCurMapBGEventCount]
and a
ret z
; Checks to see if you are facing a BG event. If so, sets carry.
ld c, a
ld hl, wCurrMapSigns
.asm_2f32:
ld hl, wCurrMapBGEvents
.loop
ld a, [hli]
cp e
jr nz, .asm_2f3e
jr nz, .y_next
ld a, [hli]
cp d
jr nz, .asm_2f3f
jr nz, .x_next
ld a, [hli]
cp b ; useless comparison
jr .asm_2f46
jr .set_carry
.asm_2f3e:
.y_next
inc hl
.asm_2f3f:
.x_next
inc hl
inc hl
dec c
jr nz, .asm_2f32
jr nz, .loop
xor a
ret
.asm_2f46:
.set_carry
scf
ret

View File

@ -2,10 +2,10 @@ INCLUDE "constants.asm"
SECTION "home/unknown_388f.asm", ROM0
Function388f::
EmptyFunction388f::
ret
Function3890::
Unreferenced_PokemonNewsScript::
farcall _Unreferenced_PokemonNewsScript
ret
@ -37,11 +37,11 @@ RivalHouseWindowScript::
farcall _RivalHouseWindowScript
ret
Function38d8::
ld hl, wc5ed
InitTrainerBattle::
ld hl, wOverworldFlags
set 7, [hl]
ld a, $8
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ret
TestWildBattleStart::
@ -54,12 +54,12 @@ TestWildBattleStart::
ld a, [wBattleMode]
and a
ret z ; if no battle, return
ld a, $3
call WriteIntod637
ld a, MAPSTATUS_START_WILD_BATTLE
call SetMapStatus
call xor_a_dec_a
ret
Function3904::
OverworldLoop_StartBattle::
predef Function3ef19
ld a, $f3
ldh [hMapEntryMethod], a
@ -68,22 +68,22 @@ Function3904::
ld hl, wJoypadFlags
set 4, [hl]
set 6, [hl]
ld a, $b
call WriteIntod637
ld a, MAPSTATUS_EXIT_BATTLE
call SetMapStatus
ret
Function391f::
OverworldLoop_05::
ret
Function3920::
ld a, [wcd5d]
cp $1
jr z, .asm_392d
ld a, $4
call WriteIntod637
OverworldLoop_ExitBattle::
ld a, [wBattleResult]
cp LOSE
jr z, .DemoGameOver
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
ret
.asm_392d:
.DemoGameOver:
ld hl, wJoypadFlags
res 4, [hl]
ld hl, .text

View File

@ -299,7 +299,8 @@ wMapScriptNumber:: db
wMapScriptNumberLocation:: dw
wMapScriptPointerLocation:: dw ; TODO
; setting bit 7 seems to disable overworld updates and player control?
wc5ed:: db
; setting bit 6 disables map connections
wOverworldFlags:: db
ds 18
wMapBufferEnd::
@ -1128,7 +1129,8 @@ wBattlePlayerAction:: db
wStateFlags:: db
ds 3
wcd5d:: db
wBattleResult:: db
ds 1
@ -1285,7 +1287,7 @@ wOtherTrainerClass:: ds 1
wBattleType:: db
wce04:: ds 1
wOtherTrainerID:: ds 1
wBattleResult:: ds 1
wBattleEnded:: ds 1
wMonHeader::
@ -1655,10 +1657,10 @@ REPT 32 ; TODO: confirm this
ENDR
wCurrMapSignCount::
wCurMapBGEventCount::
db
wCurrMapSigns::
wCurrMapBGEvents::
REPT 16 ; TODO: confirm this
ds 4
ENDR
@ -1672,16 +1674,15 @@ REPT NUM_OBJECTS
ENDR
ds 32
wd637:: db ;OW battle state? $3 wild battle, $8 is trainer battle $4 is left battle, $B is load overworld? $0 is in overworld
wd638:: db ;wd637's last written-to value
wMapStatus:: db ;OW battle state? $3 wild battle, $8 is trainer battle $4 is left battle, $B is load overworld? $0 is in overworld
wLastMapStatus:: db ;wMapStatus's last written-to value
wGameDataEnd::
; Sort of redundant to separate data like this when they're right next to each other.
wGameData2::
wd639:: db ; ???
ds 8
ds 9
wUnusedAddOutdoorSpritesReturnValue:: db
wBGMapAnchor::

View File

@ -66,15 +66,15 @@ PlayerHouse2PositionCheck:
PlayerHouse2FMovePlayer:
ld a, 0
ld hl, Movement
ld hl, .Movement
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
Movement:
.Movement:
step DOWN
slow_step DOWN
step_end
@ -191,8 +191,7 @@ PlayerHouse2FTextString5:
line "メールが とどいている ようだ"
cont "よんでみる?@"
db $08
start_asm
call PlayerHouse2FCheckEmail
call Function3036
ret

View File

@ -59,14 +59,14 @@ Route1P2Text2:
call OpenTextbox
ld hl, $D3A2
set 1, [hl]
ld a, $3C
ld a, TRAINER_KIMONO_GIRL
ld [wOtherTrainerClass], a
ld a, $02
ld a, KIMONO_GIRL_KOUME
ld [wOtherTrainerID], a
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $08
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ret
.Text2Jump

View File

@ -56,7 +56,7 @@ ShizukanaOkaTrainer2:
ld [wOtherTrainerClass], a
ld a, SCHOOLBOY_TETSUYA
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer2Won ;Already won
ld hl, ShizukanaOkaTrainer2WonString
@ -75,7 +75,7 @@ ShizukanaOkaTrainer3:
ld [wOtherTrainerClass], a
ld a, BUG_CATCHER_BOY_JUNICHI
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer3Won ;Already won
ld hl, ShizukanaOkaTrainer3WonString
@ -94,7 +94,7 @@ ShizukanaOkaTrainer4:
ld [wOtherTrainerClass], a
ld a, FIREBREATHER_AKITO
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer4Won ;Already won
ld hl, ShizukanaOkaTrainer4WonString
@ -113,7 +113,7 @@ ShizukanaOkaTrainer5:
ld [wOtherTrainerClass], a
ld a, BEAUTY_MEGUMI
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer5Won ;Already won
ld hl, ShizukanaOkaTrainer5WonString
@ -132,7 +132,7 @@ ShizukanaOkaTrainer6:
ld [wOtherTrainerClass], a
ld a, BUG_CATCHER_BOY_SOUSUKE
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer6Won ;Already won
ld hl, ShizukanaOkaTrainer6WonString

View File

@ -67,12 +67,12 @@ SilentHillScript1:
ld a, 02
ld hl, SilentHillMovement1
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillMovement1:
@ -97,10 +97,10 @@ SilentHillScript2:
ld a, 2
ld hl, SilentHillMovement2
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 2
ld [wMapScriptNumber], a
ret
@ -150,10 +150,10 @@ SilentHillScript4:
.skip
ld a, 03
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 4
ld [wMapScriptNumber], a
ret
@ -216,10 +216,10 @@ SilentHillScript5:
.skip
ld a, 3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 5
ld [wMapScriptNumber], a
ret
@ -317,10 +317,10 @@ LabClosed:
ld a, 0
ld hl, SilentHillMovement7
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillTextString1:

View File

@ -50,12 +50,12 @@ SilentHillLabBackScript1:
call LoadMovementDataPointer
ld hl, wd41b
set 1, [hl]
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabBackMovement1:
@ -65,7 +65,7 @@ SilentHillLabBackMovement1:
step_end
SilentHillLabBackScript2:
ld hl, wc5ed
ld hl, wOverworldFlags
set 6, [hl]
call Function20f8
ld a, 3
@ -103,12 +103,12 @@ SilentHillLabBackRivalChoosePokemon:
ld l, a
ld a, 3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 4
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabBackMovementPointers:
@ -138,7 +138,7 @@ SilentHillLabBackScript5:
SilentHillLabBackScript6:
call Function20f8
ld hl, wc5ed
ld hl, wOverworldFlags
res 6, [hl]
ld a, 6
ld[wMapScriptNumber], a

View File

@ -169,10 +169,10 @@ SilentHillLabFrontMoveDown:
ld a, 0
ld hl, SilentHillLabFrontMovement1
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret
@ -196,12 +196,12 @@ SilentHillLabFrontScript3:
ld hl, SilentHillLabFrontMovement2
ld a, 6
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 3
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement2:
@ -258,12 +258,12 @@ SilentHillLabFrontScript5:
ld a, 2
ld hl, SilentHillLabFrontMovement3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 5
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement3:
@ -279,12 +279,12 @@ SilentHillLabFrontScript6:
ld a, 4
ld hl, SilentHillLabFrontMovement4
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 6
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement4:
@ -303,12 +303,12 @@ SilentHillLabFrontScript7:
ld a, 0
ld hl, SilentHillLabFrontMovement5
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 7
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement5:
@ -330,12 +330,12 @@ SilentHillLabFrontScript8:
ld a, 0
ld hl, SilentHillLabFrontMovement6
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 8
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement6:
@ -356,12 +356,12 @@ SilentHillLabFrontScript9:
ld a, 5
ld hl, SilentHillLabFrontMovement7
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 9
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement7:
@ -394,12 +394,12 @@ SilentHillLabFrontScript10:
ld a, 3
ld hl, SilentHillLabFrontMovement8
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0A
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement8:
@ -458,12 +458,12 @@ SilentHillLabFrontRivalMovePokemon:
pop hl
ld a, 5
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0C
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret
@ -488,10 +488,10 @@ SilentHillLabFrontScript13:
ld hl, SilentHillLabFrontTextString17
call OpenTextbox
call GetLabPokemon
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 8
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ld a, $0D
ld [wMapScriptNumber], a
call InitObjectMasks
@ -524,7 +524,7 @@ LabPokemon:
SilentHillLabFrontScript14:
ld hl, SilentHillLabFrontTextString19
ld a, [wcd5d]
ld a, [wBattleResult]
and a
jr nz, .skip
ld hl, SilentHillLabFrontTextString18
@ -537,12 +537,12 @@ SilentHillLabFrontScript14:
ld a, 5
ld hl, SilentHillLabFrontMovement11
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0E
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement11:
@ -589,12 +589,12 @@ SilentHillLabFrontMoveRivalLeave:
pop hl
ld a, 8
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $10
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret