aboutsummaryrefslogtreecommitdiffstats
path: root/home/overworld.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2024-09-25 00:45:00 -0500
committerdannye <33dannye@gmail.com>2024-09-25 00:45:00 -0500
commita02a98ee7ada1a658e28698484058be2796dc0df (patch)
tree945986054565bd8b5212fc755415096050d1d3a8 /home/overworld.asm
parentUse long option flags for rgbgfx, same as tools/gfx (diff)
parentUse `const_skip` (diff)
downloadpokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.gz
pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.xz
pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'home/overworld.asm')
-rw-r--r--home/overworld.asm277
1 files changed, 139 insertions, 138 deletions
diff --git a/home/overworld.asm b/home/overworld.asm
index 819f1b72..f9aaa089 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -4,39 +4,39 @@ EnterMap::
ld [wJoyIgnore], a
call LoadMapData
farcall ClearVariablesOnEnterMap
- ld hl, wd72c
- bit 0, [hl] ; has the player already made 3 steps since the last battle?
+ ld hl, wStatusFlags2
+ bit BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
jr z, .skipGivingThreeStepsOfNoRandomBattles
ld a, 3 ; minimum number of steps between battles
ld [wNumberOfNoRandomBattleStepsLeft], a
.skipGivingThreeStepsOfNoRandomBattles
- ld hl, wd72e
- bit 5, [hl] ; did a battle happen immediately before this?
- res 5, [hl] ; unset the "battle just happened" flag
+ ld hl, wStatusFlags4
+ bit BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
+ res BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
call z, ResetUsingStrengthOutOfBattleBit
call nz, MapEntryAfterBattle
- ld hl, wd732
+ ld hl, wStatusFlags6
ld a, [hl]
- and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
+ and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP)
jr z, .didNotEnterUsingFlyWarpOrDungeonWarp
farcall EnterMapAnim
call UpdateSprites
- ld hl, wd732
- res 3, [hl]
- ld hl, wd72e
- res 4, [hl]
+ ld hl, wStatusFlags6
+ res BIT_FLY_WARP, [hl]
+ ld hl, wStatusFlags4
+ res BIT_NO_BATTLES, [hl]
.didNotEnterUsingFlyWarpOrDungeonWarp
call IsSurfingPikachuInParty
farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road
- ld hl, wd732
- bit 4, [hl]
- res 4, [hl]
- ld hl, wd72d
- res 5, [hl]
+ ld hl, wStatusFlags6
+ bit BIT_DUNGEON_WARP, [hl]
+ res BIT_DUNGEON_WARP, [hl]
+ ld hl, wStatusFlags3
+ res BIT_NO_NPC_FACE_PLAYER, [hl]
call UpdateSprites
ld hl, wCurrentMapScriptFlags
- set 5, [hl]
- set 6, [hl]
+ set BIT_CUR_MAP_LOADED_1, [hl]
+ set BIT_CUR_MAP_LOADED_2, [hl]
xor a
ld [wJoyIgnore], a
@@ -55,18 +55,18 @@ OverworldLoopLessDelay::
ld a, [wSafariZoneGameOver]
and a
jp nz, WarpFound2
- ld hl, wd72d
- bit 3, [hl]
- res 3, [hl]
+ ld hl, wStatusFlags3
+ bit BIT_WARP_FROM_CUR_SCRIPT, [hl]
+ res BIT_WARP_FROM_CUR_SCRIPT, [hl]
jp nz, WarpFound2
- ld a, [wd732]
- and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
+ ld a, [wStatusFlags6]
+ and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP)
jp nz, HandleFlyWarpOrDungeonWarp
ld a, [wCurOpponent]
and a
jp nz, .newBattle
- ld a, [wd730]
- bit 7, a ; are we simulating button presses?
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr z, .notSimulating
ldh a, [hJoyHeld]
jr .checkIfStartIsPressed
@@ -77,14 +77,14 @@ OverworldLoopLessDelay::
jr z, .startButtonNotPressed
; if START is pressed
xor a ; TEXT_START_MENU
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
jp .displayDialogue
.startButtonNotPressed
bit BIT_A_BUTTON, a
jp z, .checkIfDownButtonIsPressed
; if A is pressed
- ld a, [wd730]
- bit 2, a
+ ld a, [wStatusFlags5]
+ bit BIT_UNKNOWN_5_2, a
jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
@@ -96,16 +96,16 @@ OverworldLoopLessDelay::
ld [wd436], a ; new yellow address
call IsSpriteOrSignInFrontOfPlayer
call Func_0ffe
- ldh a, [hSpriteIndexOrTextID]
+ ldh a, [hTextID]
and a
jp z, OverworldLoop
.displayDialogue
predef GetTileAndCoordsInFrontOfPlayer
call UpdateSprites
- ld a, [wFlags_0xcd60]
- bit 2, a
+ ld a, [wMiscFlags]
+ bit BIT_TURNING, a
jr nz, .checkForOpponent
- bit 0, a
+ bit BIT_SEEN_BY_TRAINER, a
jr nz, .checkForOpponent
lda_coord 8, 9
ld [wTilePlayerStandingOn], a ; checked when using Surf for forbidden tile pairs
@@ -124,8 +124,8 @@ OverworldLoopLessDelay::
.noDirectionButtonsPressed
call UpdateSprites
- ld hl, wFlags_0xcd60
- res 2, [hl]
+ ld hl, wMiscFlags
+ res BIT_TURNING, [hl]
xor a
ld [wd435], a
ld a, 1
@@ -174,8 +174,8 @@ OverworldLoopLessDelay::
.handleDirectionButtonPress
ld [wPlayerDirection], a ; new direction
- ld a, [wd730]
- bit 7, a ; are we simulating button presses?
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr nz, .noDirectionChange ; ignore direction changes if we are
ld a, [wCheckFor180DegreeTurn]
and a
@@ -188,8 +188,8 @@ OverworldLoopLessDelay::
ld a, $8
ld [wd435], a
; unlike in red/blue, yellow does not have the 180 degrees odd code
- ld hl, wFlags_0xcd60
- set 2, [hl]
+ ld hl, wMiscFlags
+ set BIT_TURNING, [hl]
xor a
ld [wCheckFor180DegreeTurn], a
ld a, [wPlayerDirection]
@@ -210,8 +210,8 @@ OverworldLoopLessDelay::
jr nc, .noCollision
; collision occurred
push hl
- ld hl, wd736
- bit 2, [hl] ; standing on warp flag
+ ld hl, wMovementFlags
+ bit BIT_STANDING_ON_WARP, [hl]
pop hl
jp z, OverworldLoop
; collision occurred while standing on a warp
@@ -236,8 +236,8 @@ OverworldLoopLessDelay::
call UpdateSprites
.moveAhead2
- ld hl, wFlags_0xcd60
- res 2, [hl]
+ ld hl, wMiscFlags
+ res BIT_TURNING, [hl]
xor a
ld [wd435], a
call DoBikeSpeedup
@@ -247,7 +247,7 @@ OverworldLoopLessDelay::
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
call StepCountCheck
- CheckEvent EVENT_IN_SAFARI_ZONE ; in the safari zone?
+ CheckEvent EVENT_IN_SAFARI_ZONE
jr z, .notSafariZone
farcall SafariZoneCheckSteps
ld a, [wSafariZoneGameOver]
@@ -263,17 +263,17 @@ OverworldLoopLessDelay::
jp nz, HandleBlackOut ; if all pokemon fainted
.newBattle
call NewBattle
- ld hl, wd736
- res 2, [hl] ; standing on warp flag
+ ld hl, wMovementFlags
+ res BIT_STANDING_ON_WARP, [hl]
jp nc, CheckWarpsNoCollision ; check for warps if there was no battle
.battleOccurred
- ld hl, wd72d
- res 6, [hl]
- ld hl, wFlags_D733
- res 3, [hl]
+ ld hl, wStatusFlags3
+ res BIT_TALKED_TO_TRAINER, [hl]
+ ld hl, wStatusFlags7
+ res BIT_TRAINER_BATTLE, [hl]
ld hl, wCurrentMapScriptFlags
- set 5, [hl]
- set 6, [hl]
+ set BIT_CUR_MAP_LOADED_1, [hl]
+ set BIT_CUR_MAP_LOADED_2, [hl]
xor a
ldh [hJoyHeld], a
ld a, [wCurMap]
@@ -281,8 +281,8 @@ OverworldLoopLessDelay::
jr nz, .notCinnabarGym
SetEvent EVENT_2A7
.notCinnabarGym
- ld hl, wd72e
- set 5, [hl]
+ ld hl, wStatusFlags4
+ set BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, [wCurMap]
cp OAKS_LAB
jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
@@ -296,20 +296,20 @@ OverworldLoopLessDelay::
jp EnterMap
StepCountCheck::
- ld a, [wd730]
- bit 7, a
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps
; step counting
ld hl, wStepCounter
dec [hl]
- ld a, [wd72c]
- bit 0, a
+ ld a, [wStatusFlags2]
+ bit BIT_WILD_ENCOUNTER_COOLDOWN, a
jr z, .doneStepCounting
ld hl, wNumberOfNoRandomBattleStepsLeft
dec [hl]
jr nz, .doneStepCounting
- ld hl, wd72c
- res 0, [hl] ; indicate that the player has stepped thrice since the last battle
+ ld hl, wStatusFlags2
+ res BIT_WILD_ENCOUNTER_COOLDOWN, [hl] ; indicate that the player has stepped thrice since the last battle
.doneStepCounting
ret
@@ -322,13 +322,13 @@ AllPokemonFainted::
; function to determine if there will be a battle and execute it (either a trainer battle or wild battle)
; sets carry if a battle occurred and unsets carry if not
NewBattle::
- ld a, [wd72d]
- bit 4, a
+ ld a, [wStatusFlags3]
+ bit BIT_ON_DUNGEON_WARP, a
jr nz, .noBattle
call IsPlayerCharacterBeingControlledByGame
jr nz, .noBattle ; no battle if the player character is under the game's control
- ld a, [wd72e]
- bit 4, a
+ ld a, [wStatusFlags4]
+ bit BIT_NO_BATTLES, a
jr nz, .noBattle
farjp InitBattle
.noBattle
@@ -340,8 +340,8 @@ DoBikeSpeedup::
ld a, [wWalkBikeSurfState]
dec a ; riding a bike?
ret nz
- ld a, [wd736]
- bit 6, a
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
ret nz
ld a, [wNPCMovementScriptPointerTableNum]
and a
@@ -379,8 +379,8 @@ CheckWarpsNoCollisionLoop::
; if a match was found
push hl
push bc
- ld hl, wd736
- set 2, [hl] ; standing on warp flag
+ ld hl, wMovementFlags
+ set BIT_STANDING_ON_WARP, [hl]
farcall IsPlayerStandingOnDoorTileOrWarpTile
pop bc
pop hl
@@ -392,8 +392,8 @@ CheckWarpsNoCollisionLoop::
pop hl
jr nc, CheckWarpsNoCollisionRetry2
; if the extra check passed
- ld a, [wFlags_D733]
- bit 2, a
+ ld a, [wStatusFlags7]
+ bit BIT_FORCED_WARP, a
jr nz, WarpFound1
push de
push bc
@@ -464,7 +464,7 @@ WarpFound2::
ld a, [wCurMap]
ld [wLastMap], a
ld a, [wCurMapWidth]
- ld [wUnusedD366], a ; not read
+ ld [wUnusedLastMapWidth], a
ldh a, [hWarpDestinationMap]
ld [wCurMap], a
cp ROCK_TUNNEL_1F
@@ -491,15 +491,15 @@ WarpFound2::
jr nz, .notWarpPad
; if the player is on a warp pad
call LeaveMapAnim
- ld hl, wd732
- set 3, [hl]
+ ld hl, wStatusFlags6
+ set BIT_FLY_WARP, [hl]
jr .skipMapChangeSound
.notWarpPad
call PlayMapChangeSound
.skipMapChangeSound
- ld hl, wd736
- res 0, [hl]
- res 1, [hl]
+ ld hl, wMovementFlags
+ res BIT_STANDING_ON_DOOR, [hl]
+ res BIT_EXITING_DOOR, [hl]
callfar SetPikachuSpawnWarpPad
jr .done
@@ -511,8 +511,8 @@ WarpFound2::
xor a
ld [wMapPalOffset], a
.done
- ld hl, wd736
- set 0, [hl] ; have the player's sprite step out from the door (if there is one)
+ ld hl, wMovementFlags
+ set BIT_STANDING_ON_DOOR, [hl] ; have the player's sprite step out from the door (if there is one)
call IgnoreInputForHalfSecond
jp EnterMap
@@ -737,12 +737,11 @@ MapEntryAfterBattle::
HandleBlackOut::
; For when all the player's pokemon faint.
; Does not print the "blacked out" message.
-
call GBFadeOutToBlack
ld a, $08
call StopMusic
- ld hl, wd72e
- res 5, [hl]
+ ld hl, wStatusFlags4
+ res BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, BANK(PrepareForSpecialWarp) ; also BANK(SpecialEnterMap)
call BankswitchCommon
callfar ResetStatusAndHalveMoneyOnBlackout
@@ -766,9 +765,9 @@ HandleFlyWarpOrDungeonWarp::
ld [wBattleResult], a
ld [wIsInBattle], a
ld [wMapPalOffset], a
- ld hl, wd732
- set 2, [hl] ; fly warp or dungeon warp
- res 5, [hl] ; forced to ride bike
+ ld hl, wStatusFlags6
+ set BIT_FLY_OR_DUNGEON_WARP, [hl]
+ res BIT_ALWAYS_ON_BIKE, [hl]
call LeaveMapAnim
call Func_07c4
ld a, BANK(PrepareForSpecialWarp)
@@ -785,8 +784,8 @@ Func_07c4::
ret z
xor a
ld [wWalkBikeSurfState], a
- ld hl, wd732
- bit 4, [hl]
+ ld hl, wStatusFlags6
+ bit BIT_DUNGEON_WARP, [hl]
ret z
call PlayDefaultMusic
ret
@@ -869,10 +868,10 @@ LoadTilesetTilePatternData::
ld a, [wTilesetBank]
jp FarCopyData
-; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
+; this loads the current map's complete tile map (which references blocks, not individual tiles) to wOverworldMap
; it can also load partial tile maps of connected maps into a border of length 3 around the current map
LoadTileBlockMap::
-; fill C6E8-CBFB with the background tile
+; fill wOverworldMap-wOverworldMapEnd with the background tile
ld hl, wOverworldMap
ld bc, wOverworldMapEnd - wOverworldMap
ld a, [wMapBackgroundTile] ; background tile number
@@ -1055,10 +1054,11 @@ LoadEastWestConnectionsTileMap::
ret
; function to check if there is a sign or sprite in front of the player
-; if so, carry is set. otherwise, carry is cleared
+; if so, it is stored in [hTextID]
+; if not, [hTextID] is set to 0
IsSpriteOrSignInFrontOfPlayer::
xor a
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
ld a, [wNumSigns]
and a
jr z, .extendRangeOverCounter
@@ -1079,7 +1079,8 @@ IsSpriteOrSignInFrontOfPlayer::
dec b
jr nz, .counterTilesLoop
-; sets carry flag if a sprite is in front of the player, resets if not
+; part of the above function, but sometimes its called on its own, when signs are irrelevant
+; the caller must zero [hTextID]
IsSpriteInFrontOfPlayer::
ld d, $10 ; talking range in pixels (normal range)
IsSpriteInFrontOfPlayer2::
@@ -1161,10 +1162,10 @@ IsSpriteInFrontOfPlayer2::
and $f0
inc a
ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS
- set 7, [hl] ; set flag to make the sprite face the player
+ set BIT_FACE_PLAYER, [hl]
ld a, e
- ldh [hSpriteIndexOrTextID], a
- ldh a, [hSpriteIndexOrTextID] ; possible useless read because a already has the value of the read address
+ ldh [hSpriteIndex], a
+ ldh a, [hSpriteIndex] ; possible useless read because a already has the value of the read address
cp $f
jr nz, .dontwritetowd436
ld a, $FF
@@ -1200,7 +1201,7 @@ SignLoop::
dec c
add hl, bc
ld a, [hl]
- ldh [hSpriteIndexOrTextID], a ; store sign text ID
+ ldh [hTextID], a ; store sign text ID
pop bc
pop hl
scf
@@ -1215,8 +1216,8 @@ SignLoop::
; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing)
; sets the carry flag if there is a collision, and unsets it if there isn't a collision
CollisionCheckOnLand::
- ld a, [wd736]
- bit 6, a ; is the player jumping?
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
jr nz, .noCollision
; if not jumping a ledge
ld a, [wSimulatedJoypadStatesIndex]
@@ -1229,11 +1230,11 @@ CollisionCheckOnLand::
nop ; ??? why is this in the code
jr nz, .collision
xor a
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
jr nc, .asm_0a5c
res 7, [hl]
- ldh a, [hSpriteIndexOrTextID]
+ ldh a, [hTextID]
and a ; was there a sprite collision?
jr z, .asm_0a5c
; if no sprite collision
@@ -1292,8 +1293,8 @@ CheckForJumpingAndTilePairCollisions::
pop de
pop hl
and a
- ld a, [wd736]
- bit 6, a ; is the player jumping?
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
ret nz
; if not jumping
@@ -1305,7 +1306,7 @@ CheckForTilePairCollisions::
ld a, [wTileInFrontOfPlayer]
ld c, a
.tilePairCollisionLoop
- ld a, [wCurMapTileset] ; tileset number
+ ld a, [wCurMapTileset]
ld b, a
ld a, [hli]
cp $ff
@@ -1594,8 +1595,8 @@ JoypadOverworld::
ret
ForceBikeDown::
- ld a, [wFlags_D733]
- bit 3, a ; check if a trainer wants a challenge
+ ld a, [wStatusFlags7]
+ bit BIT_TRAINER_BATTLE, a
ret nz
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
@@ -1608,8 +1609,8 @@ ForceBikeDown::
ret
AreInputsSimulated::
- ld a, [wd730]
- bit 7, a
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
ret z
; if simulating button presses
ldh a, [hJoyHeld]
@@ -1629,17 +1630,17 @@ AreInputsSimulated::
; if done simulating button presses
.doneSimulating
xor a
- ld [wUnusedCD3A], a
+ ld [wUnusedOverrideSimulatedJoypadStatesIndex], a
ld [wSimulatedJoypadStatesIndex], a
ld [wSimulatedJoypadStatesEnd], a
ld [wJoyIgnore], a
ldh [hJoyHeld], a
- ld hl, wd736
+ ld hl, wMovementFlags
ld a, [hl]
- and $f8
+ and (1 << BIT_SPINNING) | (1 << BIT_LEDGE_OR_FISHING) | (1 << 5) | (1 << 4) | (1 << 3)
ld [hl], a
- ld hl, wd730
- res 7, [hl]
+ ld hl, wStatusFlags5
+ res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ret
GetSimulatedInput::
@@ -1667,8 +1668,8 @@ GetSimulatedInput::
; sets carry if there is a collision and clears carry otherwise
; This function had a bug in Red/Blue, but it was fixed in Yellow.
CollisionCheckOnWater::
- ld a, [wd730]
- bit 7, a
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
jp nz, .noCollision ; return and clear carry if button presses are being simulated
ld a, [wPlayerDirection] ; the direction that the player is trying to go in
ld d, a
@@ -1695,7 +1696,7 @@ CollisionCheckOnWater::
scf
jr .done
.checkIfVermilionDockTileset
- ld a, [wCurMapTileset] ; tileset
+ ld a, [wCurMapTileset]
cp SHIP_PORT ; Vermilion Dock tileset
jr nz, .noCollision ; keep surfing if it's not the boarding platform tile
jr .stopSurfing ; if it is the boarding platform tile, stop surfing
@@ -1721,8 +1722,8 @@ RunMapScript::
push de
push bc
farcall TryPushingBoulder
- ld a, [wFlags_0xcd60]
- bit 1, a ; play boulder dust animation
+ ld a, [wMiscFlags]
+ bit BIT_BOULDER_DUST, a
jr z, .afterBoulderEffect
farcall DoBoulderDustAnimation
.afterBoulderEffect
@@ -1792,7 +1793,7 @@ LoadPlayerSpriteGraphicsCommon::
jr nc, .noCarry
inc d
.noCarry
- set 3, h
+ set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8)
ld c, $c
jp CopyVideoData
@@ -1805,15 +1806,15 @@ Func_0db5:: ; XXX
farcall LoadMissableObjectData
asm_0dbd:
ld a, [wCurMapTileset]
- ld [wUnusedD119], a
+ ld [wUnusedCurMapTilesetCopy], a
ld a, [wCurMap]
call SwitchToMapRomBank
ld a, [wCurMapTileset]
ld b, a
- res 7, a
+ res BIT_NO_PREVIOUS_MAP, a
ld [wCurMapTileset], a
ldh [hPreviousTileset], a
- bit 7, b
+ bit BIT_NO_PREVIOUS_MAP, b
ret nz
call GetMapHeaderPointer
ld de, wCurMapHeader
@@ -1890,14 +1891,14 @@ asm_0dbd:
jr z, .loadSpriteData ; if not, skip this
call CopySignData
.loadSpriteData
- ld a, [wd72e]
- bit 5, a ; did a battle happen immediately before this?
+ ld a, [wStatusFlags4]
+ bit BIT_BATTLE_OVER_OR_BLACKOUT, a
jr nz, .finishUp ; if so, skip this because battles don't destroy this data
call InitSprites
.finishUp
predef LoadTilesetHeader
- ld a, [wd72e]
- bit 5, a ; did a battle happen immediately before this?
+ ld a, [wStatusFlags4]
+ bit BIT_BATTLE_OVER_OR_BLACKOUT, a ; did a battle happen immediately before this?
jr nz, .skip_pika_spawn
callfar SchedulePikachuSpawnForAfterText
.skip_pika_spawn
@@ -1976,11 +1977,11 @@ LoadMapData::
ld b, SET_PAL_OVERWORLD
call RunPaletteCommand
call LoadPlayerSpriteGraphics
- ld a, [wd732]
- and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
+ ld a, [wStatusFlags6]
+ and 1 << BIT_DUNGEON_WARP | 1 << BIT_FLY_WARP
jr nz, .restoreRomBank
- ld a, [wFlags_D733]
- bit 1, a
+ ld a, [wStatusFlags7]
+ bit BIT_NO_MAP_MUSIC, a
jr nz, .restoreRomBank
call UpdateMusic6Times ; music related
call PlayDefaultMusicFadeOutCurrent ; music related
@@ -2032,7 +2033,7 @@ ResetMapVariables::
ldh [hSCY], a
ldh [hSCX], a
ld [wWalkCounter], a
- ld [wUnusedD119], a
+ ld [wUnusedCurMapTilesetCopy], a
ld [wSpriteSetID], a
ld [wWalkBikeSurfStateCopy], a
ret
@@ -2103,15 +2104,15 @@ GetMapHeaderPointer::
IgnoreInputForHalfSecond:
ld a, 30
ld [wIgnoreInputCounter], a
- ld hl, wd730
+ ld hl, wStatusFlags5
ld a, [hl]
- or %00100110
+ or (1 << BIT_DISABLE_JOYPAD) | (1 << BIT_UNKNOWN_5_2) | (1 << BIT_UNKNOWN_5_1)
ld [hl], a ; set ignore input bit
ret
ResetUsingStrengthOutOfBattleBit:
- ld hl, wd728
- res 0, [hl]
+ ld hl, wStatusFlags1
+ res BIT_STRENGTH_ACTIVE, [hl]
ret
ForceBikeOrSurf::
@@ -2123,15 +2124,15 @@ ForceBikeOrSurf::
; Handle the player jumping down
; a ledge in the overworld.
HandleMidJump::
- ld a, [wd736]
- bit 6, a ; jumping down a ledge?
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
ret z
farcall _HandleMidJump
ret
IsSpinning::
- ld a, [wd736]
- bit 7, a
+ ld a, [wMovementFlags]
+ bit BIT_SPINNING, a
ret z ; no spinning
farjp LoadSpinnerArrowTiles ; spin while moving
@@ -2234,9 +2235,9 @@ LoadSprite::
ld [hl], a ; store text ID in byte 1 of sprite entry
pop hl
ldh a, [hLoadSpriteTemp1]
- bit 6, a
+ bit BIT_TRAINER, a
jr nz, .trainerSprite
- bit 7, a
+ bit BIT_ITEM, a
jr nz, .itemBallSprite
; for regular sprites
push hl