aboutsummaryrefslogtreecommitdiffstats
path: root/home
diff options
context:
space:
mode:
authorSylvie <35663410+Rangi42@users.noreply.github.com>2024-07-16 13:02:54 -0400
committerGitHub <noreply@github.com>2024-07-16 13:02:54 -0400
commit8fafca714c07500d1d87bba224f12cf9cc2c8789 (patch)
tree273ca88fcfcd80df9c318c9cb8d17a1f7aa240cb /home
parentBuild with RGBDS 0.8.0, though it is not yet required (diff)
downloadpokeyellow-8fafca714c07500d1d87bba224f12cf9cc2c8789.tar.gz
pokeyellow-8fafca714c07500d1d87bba224f12cf9cc2c8789.tar.xz
pokeyellow-8fafca714c07500d1d87bba224f12cf9cc2c8789.zip
Identify various flag labels and bit constants (#454)
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm4
-rw-r--r--home/fade_audio.asm4
-rw-r--r--home/give.asm2
-rw-r--r--home/list_menu.asm12
-rw-r--r--home/map_objects.asm4
-rw-r--r--home/move_mon.asm4
-rw-r--r--home/npc_movement.asm16
-rw-r--r--home/overworld.asm197
-rw-r--r--home/pathfinding.asm4
-rw-r--r--home/pokemon.asm8
-rw-r--r--home/print_text.asm10
-rw-r--r--home/reload_tiles.asm4
-rw-r--r--home/text.asm2
-rw-r--r--home/text_script.asm10
-rw-r--r--home/trainers.asm58
-rw-r--r--home/window.asm4
16 files changed, 171 insertions, 172 deletions
diff --git a/home/audio.asm b/home/audio.asm
index 1da6453c..c9d8b983 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -10,8 +10,8 @@ PlayDefaultMusicFadeOutCurrent::
; Fade out the current music and then play the default music.
ld c, 10
ld d, 0
- ld a, [wd72e]
- bit 5, a ; has a battle just ended?
+ ld a, [wStatusFlags4]
+ bit BIT_BATTLE_OVER_OR_BLACKOUT, a
jr z, PlayDefaultMusicCommon
xor a
ld [wLastMusicSoundID], a
diff --git a/home/fade_audio.asm b/home/fade_audio.asm
index 4ad2607d..b09d0036 100644
--- a/home/fade_audio.asm
+++ b/home/fade_audio.asm
@@ -2,8 +2,8 @@ FadeOutAudio::
ld a, [wAudioFadeOutControl]
and a ; currently fading out audio?
jr nz, .fadingOut
- ld a, [wd72c]
- bit 1, a
+ ld a, [wStatusFlags2]
+ bit BIT_NO_AUDIO_FADE_OUT, a
ret nz
ld a, $77
ldh [rNR50], a
diff --git a/home/give.asm b/home/give.asm
index f446cf36..128367ec 100644
--- a/home/give.asm
+++ b/home/give.asm
@@ -20,7 +20,7 @@ GivePokemon::
ld a, b
ld [wcf91], a
ld a, c
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
farjp _GivePokemon
diff --git a/home/list_menu.asm b/home/list_menu.asm
index 77e75012..1629b188 100644
--- a/home/list_menu.asm
+++ b/home/list_menu.asm
@@ -15,8 +15,8 @@ DisplayListMenuID::
ld a, BANK(DisplayBattleMenu)
.bankswitch
call BankswitchHome
- ld hl, wd730
- set 6, [hl] ; turn off letter printing delay
+ ld hl, wStatusFlags5
+ set BIT_NO_TEXT_DELAY, [hl]
xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped
ld [wListCount], a
@@ -164,8 +164,8 @@ DisplayListMenuIDLoop::
ld [wChosenMenuItem], a
xor a
ldh [hJoy7], a ; joypad state update flag
- ld hl, wd730
- res 6, [hl] ; turn on letter printing delay
+ ld hl, wStatusFlags5
+ res BIT_NO_TEXT_DELAY, [hl]
jp BankswitchBack
.checkOtherKeys ; check B, SELECT, Up, and Down keys
bit BIT_B_BUTTON, a
@@ -325,8 +325,8 @@ ExitListMenu::
ld [wMenuWatchMovingOutOfBounds], a
xor a
ldh [hJoy7], a
- ld hl, wd730
- res 6, [hl]
+ ld hl, wStatusFlags5
+ res BIT_NO_TEXT_DELAY, [hl]
call BankswitchBack
xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped
diff --git a/home/map_objects.asm b/home/map_objects.asm
index 27a69965..01dd8b6a 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -56,8 +56,8 @@ StartSimulatingJoypadStates::
xor a
ld [wOverrideSimulatedJoypadStatesMask], a
ld [wSpritePlayerStateData2MovementByte1], a
- ld hl, wd730
- set 7, [hl]
+ ld hl, wStatusFlags5
+ set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ret
IsItemInBag::
diff --git a/home/move_mon.asm b/home/move_mon.asm
index c766fbd5..45b10322 100644
--- a/home/move_mon.asm
+++ b/home/move_mon.asm
@@ -172,7 +172,7 @@ CalcStat::
ldh [hMultiplicand+1], a
xor a
ldh [hMultiplicand], a
- ld a, [wCurEnemyLVL]
+ ld a, [wCurEnemyLevel]
ldh [hMultiplier], a
call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level
ldh a, [hMultiplicand]
@@ -190,7 +190,7 @@ CalcStat::
cp $1
ld a, 5 ; + 5 for non-HP stat
jr nz, .notHPStat
- ld a, [wCurEnemyLVL]
+ ld a, [wCurEnemyLevel]
ld b, a
ldh a, [hMultiplicand+2]
add b
diff --git a/home/npc_movement.asm b/home/npc_movement.asm
index 23a85427..96804fdf 100644
--- a/home/npc_movement.asm
+++ b/home/npc_movement.asm
@@ -4,17 +4,17 @@ IsPlayerCharacterBeingControlledByGame::
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
- ld a, [wd736]
- bit 1, a ; currently stepping down from door bit
+ ld a, [wMovementFlags]
+ bit BIT_EXITING_DOOR, a
ret nz
- ld a, [wd730]
- and $80
+ ld a, [wStatusFlags5]
+ and 1 << BIT_SCRIPTED_MOVEMENT_STATE
ret
RunNPCMovementScript::
- ld hl, wd736
- bit 0, [hl]
- res 0, [hl]
+ ld hl, wMovementFlags
+ bit BIT_STANDING_ON_DOOR, [hl]
+ res BIT_STANDING_ON_DOOR, [hl]
jr nz, .playerStepOutFromDoor
ld a, [wNPCMovementScriptPointerTableNum]
and a
@@ -54,7 +54,7 @@ DebugPressedOrHeldB:: ; dummy except in _DEBUG
; This is used to skip Trainer battles, the
; Safari Game step counter, and some NPC scripts.
IF DEF(_DEBUG)
- ld a, [wd732]
+ ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a
ret z
ldh a, [hJoyHeld]
diff --git a/home/overworld.asm b/home/overworld.asm
index eda5428a..805a1b60 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -9,28 +9,28 @@ 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
- res 3, [hl]
+ res BIT_FLY_WARP, [hl]
farcall EnterMapAnim
call UpdateSprites
.didNotEnterUsingFlyWarpOrDungeonWarp
farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road
- ld hl, wd72d
- res 5, [hl]
+ ld hl, wStatusFlags3
+ res BIT_NO_NPC_FACE_PLAYER, [hl]
call UpdateSprites
ld hl, wCurrentMapScriptFlags
set 5, [hl]
@@ -43,8 +43,8 @@ OverworldLoop::
OverworldLoopLessDelay::
call DelayFrame
call LoadGBPal
- ld a, [wd736]
- bit 6, a ; jumping down a ledge?
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
call nz, HandleMidJump
ld a, [wWalkCounter]
and a
@@ -54,18 +54,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
@@ -82,8 +82,8 @@ OverworldLoopLessDelay::
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
@@ -98,10 +98,10 @@ OverworldLoopLessDelay::
.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
@@ -130,8 +130,8 @@ OverworldLoopLessDelay::
jp nz, .newBattle
jp OverworldLoop
.noDirectionButtonsPressed
- ld hl, wFlags_0xcd60
- res 2, [hl]
+ ld hl, wMiscFlags
+ res BIT_TURNING, [hl]
call UpdateSprites
ld a, 1
ld [wCheckFor180DegreeTurn], a
@@ -178,8 +178,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
@@ -222,8 +222,8 @@ OverworldLoopLessDelay::
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
.holdIntermediateDirectionLoop
- ld hl, wFlags_0xcd60
- set 2, [hl]
+ ld hl, wMiscFlags
+ set BIT_TURNING, [hl]
ld hl, wCheckFor180DegreeTurn
dec [hl]
jr nz, .holdIntermediateDirectionLoop
@@ -245,8 +245,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
@@ -266,21 +266,21 @@ OverworldLoopLessDelay::
jr .moveAhead2
.moveAhead
- ld a, [wd736]
- bit 7, a
+ ld a, [wMovementFlags]
+ bit BIT_SPINNING, a
jr z, .noSpinning
farcall LoadSpinnerArrowTiles
.noSpinning
call UpdateSprites
.moveAhead2
- ld hl, wFlags_0xcd60
- res 2, [hl]
+ ld hl, wMiscFlags
+ res BIT_TURNING, [hl]
ld a, [wWalkBikeSurfState]
dec a ; riding a bike?
jr nz, .normalPlayerSpriteAdvancement
- ld a, [wd736]
- bit 6, a ; jumping a ledge?
+ ld a, [wMovementFlags]
+ bit BIT_LEDGE_OR_FISHING, a
jr nz, .normalPlayerSpriteAdvancement
call DoBikeSpeedup
.normalPlayerSpriteAdvancement
@@ -289,20 +289,20 @@ OverworldLoopLessDelay::
and a
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
- 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]
.doneStepCounting
CheckEvent EVENT_IN_SAFARI_ZONE
jr z, .notSafariZone
@@ -320,14 +320,14 @@ 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]
@@ -338,8 +338,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
@@ -360,13 +360,13 @@ OverworldLoopLessDelay::
; 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
@@ -410,8 +410,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
@@ -423,8 +423,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
@@ -516,16 +516,16 @@ WarpFound2::
dec a ; is the player on a warp pad?
jr nz, .notWarpPad
; if the player is on a warp pad
- ld hl, wd732
- set 3, [hl]
+ ld hl, wStatusFlags6
+ set BIT_FLY_WARP, [hl]
call LeaveMapAnim
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]
jr .done
.goBackOutside
ld a, [wLastMap]
@@ -534,8 +534,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
@@ -756,12 +756,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(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap)
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
@@ -789,9 +788,9 @@ HandleFlyWarpOrDungeonWarp::
ld [wWalkBikeSurfState], 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
ld a, BANK(PrepareForSpecialWarp)
ldh [hLoadedROMBank], a
@@ -1219,8 +1218,8 @@ IsSpriteInFrontOfPlayer2::
; 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]
@@ -1291,8 +1290,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
@@ -1826,8 +1825,8 @@ JoypadOverworld::
ld [wSpritePlayerStateData1XStepVector], a
call RunMapScript
call Joypad
- ld a, [wFlags_D733]
- bit 3, a ; check if a trainer wants a challenge
+ ld a, [wStatusFlags7]
+ bit BIT_TRAINER_BATTLE, a
jr nz, .notForcedDownwards
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
@@ -1838,8 +1837,8 @@ JoypadOverworld::
ld a, D_DOWN
ldh [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
.notForcedDownwards
- ld a, [wd730]
- bit 7, a
+ ld a, [wStatusFlags5]
+ bit BIT_SCRIPTED_MOVEMENT_STATE, a
ret z
; if simulating button presses
ldh a, [hJoyHeld]
@@ -1874,12 +1873,12 @@ JoypadOverworld::
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
; function to check the tile ahead to determine if the character should get on land or keep surfing
@@ -1892,8 +1891,8 @@ JoypadOverworld::
; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it
; is considered impassable and it is detected as a collision.
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
@@ -1955,8 +1954,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
@@ -2137,8 +2136,8 @@ LoadMapHeader::
dec c
jr nz, .signLoop
.loadSpriteData
- ld a, [wd72e]
- bit 5, a ; did a battle happen immediately before this?
+ ld a, [wStatusFlags4]
+ bit BIT_BATTLE_OVER_OR_BLACKOUT, a
jp nz, .finishUp ; if so, skip this because battles don't destroy this data
ld a, [hli]
ld [wNumSprites], a ; save the number of sprites
@@ -2343,11 +2342,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_FLY_WARP) | (1 << BIT_DUNGEON_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
call PlayDefaultMusicFadeOutCurrent
@@ -2381,15 +2380,15 @@ SwitchToMapRomBank::
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::
diff --git a/home/pathfinding.asm b/home/pathfinding.asm
index 766e7b37..12128f68 100644
--- a/home/pathfinding.asm
+++ b/home/pathfinding.asm
@@ -32,8 +32,8 @@ MoveSprite_::
ld [wNPCNumScriptedSteps], a ; number of steps taken
pop bc
- ld hl, wd730
- set 0, [hl]
+ ld hl, wStatusFlags5
+ set BIT_SCRIPTED_NPC_MOVEMENT, [hl]
pop hl
xor a
ld [wOverrideSimulatedJoypadStatesMask], a
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 3e63de35..131fbd85 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -198,8 +198,8 @@ PartyMenuInit::
ld a, 1 ; hardcoded bank
call BankswitchHome
call LoadHpBarAndStatusTilePatterns
- ld hl, wd730
- set 6, [hl] ; turn off letter printing delay
+ ld hl, wStatusFlags5
+ set BIT_NO_TEXT_DELAY, [hl]
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
ld [wMenuWatchMovingOutOfBounds], a
@@ -245,8 +245,8 @@ HandlePartyMenuInput::
ld [wPartyMenuAnimMonEnabled], a
ld a, [wCurrentMenuItem]
ld [wPartyAndBillsPCSavedMenuItem], a
- ld hl, wd730
- res 6, [hl] ; turn on letter printing delay
+ ld hl, wStatusFlags5
+ res BIT_NO_TEXT_DELAY, [hl]
ld a, [wMenuItemToSwap]
and a
jp nz, .swappingPokemon
diff --git a/home/print_text.asm b/home/print_text.asm
index 962ae519..65d418a3 100644
--- a/home/print_text.asm
+++ b/home/print_text.asm
@@ -1,18 +1,18 @@
; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
-; through the [wd730] or [wLetterPrintingDelayFlags] flags.
+; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags.
PrintLetterDelay::
- ld a, [wd730]
- bit 6, a
+ ld a, [wStatusFlags5]
+ bit BIT_NO_TEXT_DELAY, a
ret nz
ld a, [wLetterPrintingDelayFlags]
- bit 1, a
+ bit BIT_TEXT_DELAY, a
ret z
push hl
push de
push bc
ld a, [wLetterPrintingDelayFlags]
- bit 0, a
+ bit BIT_FAST_TEXT_DELAY, a
jr z, .waitOneFrame
ld a, [wOptions]
and $f
diff --git a/home/reload_tiles.asm b/home/reload_tiles.asm
index 6228395c..76110dbe 100644
--- a/home/reload_tiles.asm
+++ b/home/reload_tiles.asm
@@ -30,8 +30,8 @@ ReloadTilesetTilePatterns::
; shows the town map and lets the player choose a destination to fly to
ChooseFlyDestination::
- ld hl, wd72e
- res 4, [hl]
+ ld hl, wStatusFlags4
+ res BIT_NO_BATTLES, [hl]
farjp LoadTownMap_Fly
; causes the text box to close without waiting for a button press after displaying text
diff --git a/home/text.asm b/home/text.asm
index 9462c749..e815fbf7 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -315,7 +315,7 @@ ProtectedDelay3::
TextCommandProcessor::
ld a, [wLetterPrintingDelayFlags]
push af
- set 1, a
+ set BIT_TEXT_DELAY, a
ld e, a
ldh a, [hClearLetterPrintingDelayFlags]
xor e
diff --git a/home/text_script.asm b/home/text_script.asm
index ceae1a0a..5c90a981 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -128,8 +128,8 @@ CloseTextDisplay::
call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
ld hl, wFontLoaded
res 0, [hl]
- ld a, [wd732]
- bit 3, a ; used fly warp
+ ld a, [wStatusFlags6]
+ bit BIT_FLY_WARP, a
call z, LoadPlayerSpriteGraphics
call LoadCurrentMapView
pop af
@@ -196,9 +196,9 @@ PokemonFaintedText::
DisplayPlayerBlackedOutText::
ld hl, PlayerBlackedOutText
call PrintText
- ld a, [wd732]
- res 5, a ; reset forced to use bike bit
- ld [wd732], a
+ ld a, [wStatusFlags6]
+ res BIT_ALWAYS_ON_BIKE, a
+ ld [wStatusFlags6], a
jp HoldTextDisplayOpen
PlayerBlackedOutText::
diff --git a/home/trainers.asm b/home/trainers.asm
index 011c1d6d..0038d48c 100644
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -16,9 +16,9 @@ ExecuteCurMapScriptInTable::
pop hl
pop af
push hl
- ld hl, wFlags_D733
- bit 4, [hl]
- res 4, [hl]
+ ld hl, wStatusFlags7
+ bit BIT_USE_CUR_MAP_SCRIPT, [hl]
+ res BIT_USE_CUR_MAP_SCRIPT, [hl]
jr z, .useProvidedIndex ; test if map script index was overridden manually
ld a, [wCurMapScript]
.useProvidedIndex
@@ -114,10 +114,10 @@ TalkToTrainer::
call ReadTrainerHeaderInfo ; read end battle text
pop de
call SaveEndBattleTextPointers
- ld hl, wFlags_D733
- set 4, [hl] ; activate map script index override (index is set below)
- ld hl, wFlags_0xcd60
- bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
+ ld hl, wStatusFlags7
+ set BIT_USE_CUR_MAP_SCRIPT, [hl] ; activate map script index override (index is set below)
+ ld hl, wMiscFlags
+ bit BIT_SEEN_BY_TRAINER, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
ret nz
; if the player talked to the trainer of his own volition
call EngageMapTrainer
@@ -143,8 +143,8 @@ ENDC
ld [wTrainerHeaderFlagBit], a
ret
.trainerEngaging
- ld hl, wFlags_D733
- set 3, [hl]
+ ld hl, wStatusFlags7
+ set BIT_TRAINER_BATTLE, [hl]
ld [wEmotionBubbleSpriteIndex], a
xor a ; EXCLAMATION_BUBBLE
ld [wWhichEmotionBubble], a
@@ -160,8 +160,8 @@ ENDC
; display the before battle text after the enemy trainer has walked up to the player's sprite
DisplayEnemyTrainerTextAndStartBattle::
- ld a, [wd730]
- and $1
+ ld a, [wStatusFlags5]
+ and 1 << BIT_SCRIPTED_NPC_MOVEMENT
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
@@ -173,11 +173,11 @@ StartTrainerBattle::
xor a
ld [wJoyIgnore], a
call InitBattleEnemyParameters
- ld hl, wd72d
- set 6, [hl]
- set 7, [hl]
- ld hl, wd72e
- set 1, [hl]
+ ld hl, wStatusFlags3
+ set BIT_TALKED_TO_TRAINER, [hl]
+ set BIT_PRINT_END_BATTLE_TEXT, [hl]
+ ld hl, wStatusFlags4
+ set BIT_UNKNOWN_4_1, [hl]
ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually EndTrainerBattle)
ret
@@ -186,10 +186,10 @@ EndTrainerBattle::
ld hl, wCurrentMapScriptFlags
set 5, [hl]
set 6, [hl]
- ld hl, wd72d
- res 7, [hl]
- ld hl, wFlags_0xcd60
- res 0, [hl] ; player is no longer engaged by any trainer
+ ld hl, wStatusFlags3
+ res BIT_PRINT_END_BATTLE_TEXT, [hl]
+ ld hl, wMiscFlags
+ res BIT_SEEN_BY_TRAINER, [hl] ; player is no longer engaged by any trainer
ld a, [wIsInBattle]
cp $ff
jp z, ResetButtonPressedAndMapScript
@@ -211,9 +211,9 @@ EndTrainerBattle::
ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it
predef HideObject
.skipRemoveSprite
- ld hl, wd730
- bit 4, [hl]
- res 4, [hl]
+ ld hl, wStatusFlags5
+ bit BIT_UNKNOWN_5_4, [hl]
+ res BIT_UNKNOWN_5_4, [hl]
ret nz
ResetButtonPressedAndMapScript::
@@ -240,7 +240,7 @@ InitBattleEnemyParameters::
ld [wTrainerNo], a
ret
.noTrainer
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
ret
GetSpritePosition1::
@@ -340,9 +340,9 @@ EngageMapTrainer::
PrintEndBattleText::
push hl
- ld hl, wd72d
- bit 7, [hl]
- res 7, [hl]
+ ld hl, wStatusFlags3
+ bit BIT_PRINT_END_BATTLE_TEXT, [hl]
+ res BIT_PRINT_END_BATTLE_TEXT, [hl]
pop hl
ret z
ldh a, [hLoadedROMBank]
@@ -389,8 +389,8 @@ TrainerEndBattleText::
; engaged with another trainer
; XXX unused?
CheckIfAlreadyEngaged::
- ld a, [wFlags_0xcd60]
- bit 0, a
+ ld a, [wMiscFlags]
+ bit BIT_SEEN_BY_TRAINER, a
ret nz
call EngageMapTrainer
xor a
diff --git a/home/window.asm b/home/window.asm
index 0abe366d..01b52d41 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -95,8 +95,8 @@ HandleMenuInput_::
jr z, .skipPlayingSound
.AButtonOrBButtonPressed
push hl
- ld hl, wFlags_0xcd60
- bit 5, [hl]
+ ld hl, wMiscFlags
+ bit BIT_NO_MENU_BUTTON_SOUND, [hl]
pop hl
jr nz, .skipPlayingSound
ld a, SFX_PRESS_AB