Identify various flag labels and bit constants (#454)

This commit is contained in:
Sylvie 2024-07-16 13:02:54 -04:00 committed by GitHub
parent 70228c2c4a
commit 8fafca714c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
143 changed files with 1071 additions and 1081 deletions

View file

@ -37,9 +37,6 @@ DEF MOVE_ACC rb
DEF MOVE_PP rb DEF MOVE_PP rb
DEF MOVE_LENGTH EQU _RS DEF MOVE_LENGTH EQU _RS
; D733 flags
DEF BIT_TEST_BATTLE EQU 0
; battle type constants (wBattleType values) ; battle type constants (wBattleType values)
const_def const_def
const BATTLE_TYPE_NORMAL ; 0 const BATTLE_TYPE_NORMAL ; 0
@ -78,7 +75,7 @@ DEF SPDSPCDV_TRAINER EQU $88
; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
const_def const_def
const STORING_ENERGY ; 0 ; Bide const STORING_ENERGY ; 0 ; Bide
const THRASHING_ABOUT ; 1 ; e.g. Thrash const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance
const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack
const FLINCHED ; 3 const FLINCHED ; 3
const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly
@ -95,11 +92,11 @@ DEF SPDSPCDV_TRAINER EQU $88
const HAS_SUBSTITUTE_UP ; 4 const HAS_SUBSTITUTE_UP ; 4
const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam
const USING_RAGE ; 6 const USING_RAGE ; 6
const SEEDED ; 7 const SEEDED ; 7 ; Leech Seed
; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags ; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
const_def const_def
const BADLY_POISONED ; 0 const BADLY_POISONED ; 0 ; Toxic
const HAS_LIGHT_SCREEN_UP ; 1 const HAS_LIGHT_SCREEN_UP ; 1
const HAS_REFLECT_UP ; 2 const HAS_REFLECT_UP ; 2
const TRANSFORMED ; 3 const TRANSFORMED ; 3

View file

@ -1,13 +1,13 @@
; joypad buttons ; joypad buttons
const_def const_def
const BIT_A_BUTTON const BIT_A_BUTTON ; 0
const BIT_B_BUTTON const BIT_B_BUTTON ; 1
const BIT_SELECT const BIT_SELECT ; 2
const BIT_START const BIT_START ; 3
const BIT_D_RIGHT const BIT_D_RIGHT ; 4
const BIT_D_LEFT const BIT_D_LEFT ; 5
const BIT_D_UP const BIT_D_UP ; 6
const BIT_D_DOWN const BIT_D_DOWN ; 7
DEF NO_INPUT EQU 0 DEF NO_INPUT EQU 0
DEF A_BUTTON EQU 1 << BIT_A_BUTTON DEF A_BUTTON EQU 1 << BIT_A_BUTTON

View file

@ -7,15 +7,3 @@ DEF TRUE EQU 1
const FLAG_RESET ; 0 const FLAG_RESET ; 0
const FLAG_SET ; 1 const FLAG_SET ; 1
const FLAG_TEST ; 2 const FLAG_TEST ; 2
; wOptions
DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5
const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7
; wd732 flags
DEF BIT_DEBUG_MODE EQU 1

119
constants/ram_constants.asm Normal file
View file

@ -0,0 +1,119 @@
; wMiscFlags
const_def
const BIT_SEEN_BY_TRAINER ; 0
const BIT_BOULDER_DUST ; 1
const BIT_TURNING ; 2
const BIT_USING_GENERIC_PC ; 3
const BIT_NO_SPRITE_UPDATES ; 4
const BIT_NO_MENU_BUTTON_SOUND ; 5
const BIT_TRIED_PUSH_BOULDER ; 6
const BIT_PUSHED_BOULDER ; 7
; wOptions
DEF TEXT_DELAY_MASK EQU %111
const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7
DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5
; wLetterPrintingDelayFlags
const_def
const BIT_FAST_TEXT_DELAY ; 0
const BIT_TEXT_DELAY ; 1
; wObtainedBadges, wBeatGymFlags
const_def
const BIT_BOULDERBADGE ; 0
const BIT_CASCADEBADGE ; 1
const BIT_THUNDERBADGE ; 2
const BIT_RAINBOWBADGE ; 3
const BIT_SOULBADGE ; 4
const BIT_MARSHBADGE ; 5
const BIT_VOLCANOBADGE ; 6
const BIT_EARTHBADGE ; 7
DEF NUM_BADGES EQU const_value
; wStatusFlags1
const_def
const BIT_STRENGTH_ACTIVE ; 0
const BIT_SURF_ALLOWED ; 1
const_skip ; 2 ; unused
const BIT_GOT_OLD_ROD ; 3
const BIT_GOT_GOOD_ROD ; 4
const BIT_GOT_SUPER_ROD ; 5
const BIT_GAVE_SAFFRON_GUARDS_DRINK ; 6
const BIT_UNUSED_CARD_KEY ; 7
; wStatusFlags2
const_def
const BIT_WILD_ENCOUNTER_COOLDOWN ; 0
const BIT_NO_AUDIO_FADE_OUT ; 1
; wStatusFlags3
const_def
const BIT_INIT_TRADE_CENTER_FACING ; 0
const_skip 2 ; 1-2 ; unused
const BIT_WARP_FROM_CUR_SCRIPT ; 3
const BIT_ON_DUNGEON_WARP ; 4
const BIT_NO_NPC_FACE_PLAYER ; 5
const BIT_TALKED_TO_TRAINER ; 6
const BIT_PRINT_END_BATTLE_TEXT ; 7
; wStatusFlags4
const_def
const BIT_GOT_LAPRAS ; 0
const BIT_UNKNOWN_4_1 ; 1
const BIT_USED_POKECENTER ; 2
const BIT_GOT_STARTER ; 3
const BIT_NO_BATTLES ; 4
const BIT_BATTLE_OVER_OR_BLACKOUT ; 5
const BIT_LINK_CONNECTED ; 6
const BIT_INIT_SCRIPTED_MOVEMENT ; 7
; wStatusFlags5
const_def
const BIT_SCRIPTED_NPC_MOVEMENT ; 0
const BIT_UNKNOWN_5_1 ; 1
const BIT_UNKNOWN_5_2 ; 2
const_skip ; 3 ; unused
const BIT_UNKNOWN_5_4 ; 4
const BIT_DISABLE_JOYPAD ; 5
const BIT_NO_TEXT_DELAY ; 6
const BIT_SCRIPTED_MOVEMENT_STATE ; 7
; wStatusFlags6
const_def
const BIT_GAME_TIMER_COUNTING ; 0
const BIT_DEBUG_MODE ; 1
const BIT_FLY_OR_DUNGEON_WARP ; 2
const BIT_FLY_WARP ; 3
const BIT_DUNGEON_WARP ; 4
const BIT_ALWAYS_ON_BIKE ; 5
const BIT_ESCAPE_WARP ; 6
; wStatusFlags7
const_def
const BIT_TEST_BATTLE ; 0
const BIT_NO_MAP_MUSIC ; 1
const BIT_FORCED_WARP ; 2
const BIT_TRAINER_BATTLE ; 3
const BIT_USE_CUR_MAP_SCRIPT ; 4
const_skip 2 ; 5-6 ; unused
const BIT_USED_FLY ; 7
; wElite4Flags
const_def
const BIT_UNUSED_BEAT_ELITE_4 ; 0
const BIT_STARTED_ELITE_4 ; 1
; wMovementFlags
const_def
const BIT_STANDING_ON_DOOR ; 0
const BIT_EXITING_DOOR ; 1
const BIT_STANDING_ON_WARP ; 2
const_skip 3 ; 3-5 ; unused
const BIT_LEDGE_OR_FISHING ; 6
const BIT_SPINNING ; 7

View file

@ -39,19 +39,6 @@ DEF NUM_NPC_TRADES EQU const_value
const TRADE_DIALOGSET_EVOLUTION const TRADE_DIALOGSET_EVOLUTION
const TRADE_DIALOGSET_HAPPY const TRADE_DIALOGSET_HAPPY
; badges
; wObtainedBadges and wBeatGymFlags bits
const_def
const BIT_BOULDERBADGE ; 0
const BIT_CASCADEBADGE ; 1
const BIT_THUNDERBADGE ; 2
const BIT_RAINBOWBADGE ; 3
const BIT_SOULBADGE ; 4
const BIT_MARSHBADGE ; 5
const BIT_VOLCANOBADGE ; 6
const BIT_EARTHBADGE ; 7
DEF NUM_BADGES EQU const_value
; OaksAideScript results ; OaksAideScript results
DEF OAKS_AIDE_BAG_FULL EQU $00 DEF OAKS_AIDE_BAG_FULL EQU $00
DEF OAKS_AIDE_GOT_ITEM EQU $01 DEF OAKS_AIDE_GOT_ITEM EQU $01

View file

@ -101,7 +101,7 @@ PredefPointers::
add_predef EnterMapAnim, $1E ; wrong bank add_predef EnterMapAnim, $1E ; wrong bank
add_predef GetTileTwoStepsInFrontOfPlayer add_predef GetTileTwoStepsInFrontOfPlayer
add_predef CheckForCollisionWhenPushingBoulder add_predef CheckForCollisionWhenPushingBoulder
add_predef PrintStrengthTxt add_predef PrintStrengthText
add_predef PickUpItem add_predef PickUpItem
add_predef PrintMoveType add_predef PrintMoveType
add_predef LoadMovePPs add_predef LoadMovePPs

View file

@ -1229,7 +1229,7 @@ _GrewLevelText::
text_ram wcd6d text_ram wcd6d
text " grew" text " grew"
line "to level @" line "to level @"
text_decimal wCurEnemyLVL, 1, 3 text_decimal wCurEnemyLevel, 1, 3
text "!@" text "!@"
text_end text_end
@ -1435,7 +1435,7 @@ _RareCandyText::
text_ram wcd6d text_ram wcd6d
text " grew" text " grew"
line "to level @" line "to level @"
text_decimal wCurEnemyLVL, 1, 3 text_decimal wCurEnemyLevel, 1, 3
text "!@" text "!@"
text_end text_end

View file

@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels:
ld a, [hl] ld a, [hl]
add $3 add $3
ld e, a ld e, a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
sub e sub e
jr nc, .highLevelEnemy jr nc, .highLevelEnemy
res 1, c res 1, c

View file

@ -844,7 +844,7 @@ FaintEnemyPokemon:
; the player has exp all ; the player has exp all
; now, set the gain exp flag for every party member ; now, set the gain exp flag for every party member
; half of the total stat exp and normal exp will divided evenly amongst every party member ; half of the total stat exp and normal exp will divided evenly amongst every party member
ld a, $1 ld a, TRUE
ld [wBoostExpByExpAll], a ld [wBoostExpByExpAll], a
ld a, [wPartyCount] ld a, [wPartyCount]
ld b, 0 ld b, 0
@ -924,8 +924,8 @@ TrainerBattleVictory:
cp RIVAL3 ; final battle against rival cp RIVAL3 ; final battle against rival
jr nz, .notrival jr nz, .notrival
ld b, MUSIC_DEFEATED_GYM_LEADER ld b, MUSIC_DEFEATED_GYM_LEADER
ld hl, wFlags_D733 ld hl, wStatusFlags7
set 1, [hl] set BIT_NO_MAP_MUSIC, [hl]
.notrival .notrival
ld a, [wLinkState] ld a, [wLinkState]
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
@ -1157,9 +1157,9 @@ HandlePlayerBlackOut:
ld hl, LinkBattleLostText ld hl, LinkBattleLostText
.noLinkBattle .noLinkBattle
call PrintText call PrintText
ld a, [wd732] ld a, [wStatusFlags6]
res 5, a res BIT_ALWAYS_ON_BIKE, a
ld [wd732], a ld [wStatusFlags6], a
call ClearScreen call ClearScreen
scf scf
ret ret
@ -1179,10 +1179,10 @@ LinkBattleLostText:
; slides pic of fainted mon downwards until it disappears ; slides pic of fainted mon downwards until it disappears
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing ; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
SlideDownFaintedMonPic: SlideDownFaintedMonPic:
ld a, [wd730] ld a, [wStatusFlags5]
push af push af
set 6, a set BIT_NO_TEXT_DELAY, a
ld [wd730], a ld [wStatusFlags5], a
ld b, 7 ; number of times to slide ld b, 7 ; number of times to slide
.slideStepLoop ; each iteration, the mon is slid down one row .slideStepLoop ; each iteration, the mon is slid down one row
push bc push bc
@ -1221,7 +1221,7 @@ SlideDownFaintedMonPic:
dec b dec b
jr nz, .slideStepLoop jr nz, .slideStepLoop
pop af pop af
ld [wd730], a ld [wStatusFlags5], a
ret ret
SevenSpacesText: SevenSpacesText:
@ -1344,7 +1344,7 @@ EnemySendOutFirstMon:
ld bc, wEnemyMon2 - wEnemyMon1 ld bc, wEnemyMon2 - wEnemyMon1
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
inc a inc a
ld hl, wEnemyPartyCount ld hl, wEnemyPartyCount
@ -2558,7 +2558,7 @@ MoveSelectionMenu:
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
; Disable left, right, and START buttons in regular battles. ; Disable left, right, and START buttons in regular battles.
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a bit BIT_TEST_BATTLE, a
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
@ -2587,7 +2587,7 @@ SelectMenuItem:
jr .select jr .select
.battleselect .battleselect
; Hide move swap cursor in TestBattle. ; Hide move swap cursor in TestBattle.
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a bit BIT_TEST_BATTLE, a
; This causes PrintMenuItem to not run in TestBattle. ; This causes PrintMenuItem to not run in TestBattle.
; MoveSelectionMenu still draws part of its window, an issue ; MoveSelectionMenu still draws part of its window, an issue
@ -4404,7 +4404,7 @@ GetEnemyMonStat:
ret ret
.notLinkBattle .notLinkBattle
ld a, [wEnemyMonLevel] ld a, [wEnemyMonLevel]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, [wEnemyMonSpecies] ld a, [wEnemyMonSpecies]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
@ -6092,7 +6092,7 @@ GetCurrentMove:
.player .player
ld de, wPlayerMoveNum ld de, wPlayerMoveNum
; Apply InitBattleVariables to TestBattle. ; Apply InitBattleVariables to TestBattle.
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a bit BIT_TEST_BATTLE, a
ld a, [wTestBattlePlayerSelectedMove] ld a, [wTestBattlePlayerSelectedMove]
jr nz, .selected jr nz, .selected
@ -6143,7 +6143,7 @@ LoadEnemyMonData:
ld [hli], a ld [hli], a
ld [hl], b ld [hl], b
ld de, wEnemyMonLevel ld de, wEnemyMonLevel
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld [de], a ld [de], a
inc de inc de
ld b, $0 ld b, $0
@ -6776,7 +6776,7 @@ InitOpponent:
jr InitBattleCommon jr InitBattleCommon
DetermineWildOpponent: DetermineWildOpponent:
ld a, [wd732] ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a bit BIT_DEBUG_MODE, a
jr z, .notDebugMode jr z, .notDebugMode
ldh a, [hJoyHeld] ldh a, [hJoyHeld]
@ -6794,7 +6794,7 @@ InitBattleCommon:
ld hl, wLetterPrintingDelayFlags ld hl, wLetterPrintingDelayFlags
ld a, [hl] ld a, [hl]
push af push af
res 1, [hl] res BIT_TEXT_DELAY, [hl] ; no delay
callfar InitBattleVariables callfar InitBattleVariables
ld a, [wEnemyMonSpecies2] ld a, [wEnemyMonSpecies2]
sub OPP_ID_OFFSET sub OPP_ID_OFFSET

View file

@ -812,7 +812,7 @@ SwitchAndTeleportEffect:
ld a, [wIsInBattle] ld a, [wIsInBattle]
dec a dec a
jr nz, .notWildBattle1 jr nz, .notWildBattle1
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld b, a ld b, a
ld a, [wBattleMonLevel] ld a, [wBattleMonLevel]
cp b ; is the player's level greater than the enemy's level? cp b ; is the player's level greater than the enemy's level?
@ -856,7 +856,7 @@ SwitchAndTeleportEffect:
jr nz, .notWildBattle2 jr nz, .notWildBattle2
ld a, [wBattleMonLevel] ld a, [wBattleMonLevel]
ld b, a ld b, a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
cp b cp b
jr nc, .enemyMoveWasSuccessful jr nc, .enemyMoveWasSuccessful
add b add b

View file

@ -66,8 +66,8 @@ EndOfBattle:
ld [hli], a ld [hli], a
dec b dec b
jr nz, .loop jr nz, .loop
ld hl, wd72c ld hl, wStatusFlags2
set 0, [hl] set BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
call WaitForSoundToFinish call WaitForSoundToFinish
call GBPalWhiteOut call GBPalWhiteOut
ld a, $ff ld a, $ff

View file

@ -160,11 +160,11 @@ GainExperience:
ld a, [hl] ; current level ld a, [hl] ; current level
cp d cp d
jp z, .nextMon ; if level didn't change, go to next mon jp z, .nextMon ; if level didn't change, go to next mon
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
push af push af
push hl push hl
ld a, d ld a, d
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld [hl], a ld [hl], a
ld bc, wPartyMon1Species - wPartyMon1Level ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc add hl, bc
@ -261,7 +261,7 @@ GainExperience:
predef FlagActionPredef predef FlagActionPredef
pop hl pop hl
pop af pop af
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
.nextMon .nextMon
ld a, [wPartyCount] ld a, [wPartyCount]

View file

@ -49,7 +49,7 @@ ReadTrainer:
ld a, [hli] ld a, [hli]
cp $FF ; is the trainer special? cp $FF ; is the trainer special?
jr z, .SpecialTrainer ; if so, check for special moves jr z, .SpecialTrainer ; if so, check for special moves
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
.LoopTrainerData .LoopTrainerData
ld a, [hli] ld a, [hli]
and a ; have we reached the end of the trainer data? and a ; have we reached the end of the trainer data?
@ -69,7 +69,7 @@ ReadTrainer:
ld a, [hli] ld a, [hli]
and a ; have we reached the end of the trainer data? and a ; have we reached the end of the trainer data?
jr z, .AddLoneMove jr z, .AddLoneMove
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, [hli] ld a, [hli]
ld [wcf91], a ld [wcf91], a
ld a, ENEMY_PARTY_DATA ld a, ENEMY_PARTY_DATA
@ -150,7 +150,7 @@ ReadTrainer:
ld [de], a ld [de], a
inc de inc de
ld [de], a ld [de], a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld b, a ld b, a
.LastLoop .LastLoop
; update wAmountMoneyWon addresses (money to win) based on enemy's level ; update wAmountMoneyWon addresses (money to win) based on enemy's level
@ -162,5 +162,5 @@ ReadTrainer:
inc de inc de
inc de inc de
dec b dec b
jr nz, .LastLoop ; repeat wCurEnemyLVL times jr nz, .LastLoop ; repeat wCurEnemyLevel times
ret ret

View file

@ -4,8 +4,8 @@ TryDoWildEncounter:
ld a, [wNPCMovementScriptPointerTableNum] ld a, [wNPCMovementScriptPointerTableNum]
and a and a
ret nz ret nz
ld a, [wd736] ld a, [wMovementFlags]
and a and a ; is player exiting a door, jumping over a ledge, or fishing?
ret nz ret nz
callfar IsPlayerStandingOnDoorTileOrWarpTile callfar IsPlayerStandingOnDoorTileOrWarpTile
jr nc, .notStandingOnDoorOrWarpTile jr nc, .notStandingOnDoorOrWarpTile
@ -74,7 +74,7 @@ TryDoWildEncounter:
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, [hl] ld a, [hl]
ld [wcf91], a ld [wcf91], a
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
@ -83,7 +83,7 @@ TryDoWildEncounter:
jr z, .willEncounter jr z, .willEncounter
ld a, [wPartyMon1Level] ld a, [wPartyMon1Level]
ld b, a ld b, a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
cp b cp b
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
jr .willEncounter jr .willEncounter

View file

@ -55,7 +55,7 @@ IF DEF(_DEBUG)
jp z, TestBattle jp z, TestBattle
; DEBUG ; DEBUG
ld hl, wd732 ld hl, wStatusFlags6
set BIT_DEBUG_MODE, [hl] set BIT_DEBUG_MODE, [hl]
jp StartNewGameDebug jp StartNewGameDebug
@ -80,7 +80,7 @@ TestBattle: ; unreferenced except in _DEBUG
ld a, 1 << BIT_EARTHBADGE ld a, 1 << BIT_EARTHBADGE
ld [wObtainedBadges], a ld [wObtainedBadges], a
ld hl, wFlags_D733 ld hl, wStatusFlags7
set BIT_TEST_BATTLE, [hl] set BIT_TEST_BATTLE, [hl]
; wNumBagItems and wBagItems are not initialized here, ; wNumBagItems and wBagItems are not initialized here,
@ -100,7 +100,7 @@ TestBattle: ; unreferenced except in _DEBUG
ld a, RHYDON ld a, RHYDON
ld [wcf91], a ld [wcf91], a
ld a, 20 ld a, 20
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
xor a xor a
ld [wMonDataLocation], a ld [wMonDataLocation], a
ld [wCurMap], a ld [wCurMap], a

View file

@ -7,7 +7,7 @@ SetDebugNewGameParty: ; unreferenced except in _DEBUG
ld [wcf91], a ld [wcf91], a
inc de inc de
ld a, [de] ld a, [de]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
inc de inc de
call AddPartyMon call AddPartyMon
jr .loop jr .loop

View file

@ -8,7 +8,7 @@ ResetStatusAndHalveMoneyOnBlackout::
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ldh [hJoyHeld], a ldh [hJoyHeld], a
ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptPointerTableNum], a
ld [wFlags_0xcd60], a ld [wMiscFlags], a
ldh [hMoney], a ldh [hMoney], a
ldh [hMoney + 1], a ldh [hMoney + 1], a
@ -37,10 +37,10 @@ ResetStatusAndHalveMoneyOnBlackout::
ld [wPlayerMoney + 2], a ld [wPlayerMoney + 2], a
.lostmoney .lostmoney
ld hl, wd732 ld hl, wStatusFlags6
set 2, [hl] set BIT_FLY_OR_DUNGEON_WARP, [hl]
res 3, [hl] res BIT_FLY_WARP, [hl]
set 6, [hl] set BIT_ESCAPE_WARP, [hl]
ld a, %11111111 ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a ld [wJoyIgnore], a
predef_jump HealParty predef_jump HealParty

View file

@ -1,6 +1,6 @@
GiveFossilToCinnabarLab:: GiveFossilToCinnabarLab::
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld a, A_BUTTON | B_BUTTON ld a, A_BUTTON | B_BUTTON
@ -24,8 +24,8 @@ GiveFossilToCinnabarLab::
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
call PrintFossilsInBag call PrintFossilsInBag
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call HandleMenuInput call HandleMenuInput
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
jr nz, .cancelledGivingFossil jr nz, .cancelledGivingFossil

View file

@ -6,8 +6,8 @@ DisplayDiploma::
call ClearScreen call ClearScreen
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
call DisableLCD call DisableLCD
ld hl, CircleTile ld hl, CircleTile
ld de, vChars2 tile CIRCLE_TILE_ID ld de, vChars2 tile CIRCLE_TILE_ID
@ -65,8 +65,8 @@ DisplayDiploma::
ld a, $90 ld a, $90
ldh [rOBP0], a ldh [rOBP0], a
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns call RestoreScreenTilesAndReloadTilePatterns
call Delay3 call Delay3

View file

@ -1,9 +1,9 @@
_DisplayPokedex:: _DisplayPokedex::
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
predef ShowPokedexData predef ShowPokedexData
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call ReloadMapData call ReloadMapData
ld c, 10 ld c, 10
call DelayFrames call DelayFrames

View file

@ -82,8 +82,8 @@ BillsHousePokemonList::
ld a, 1 ld a, 1
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
.billsPokemonLoop .billsPokemonLoop
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0 hlcoord 0, 0
ld b, 10 ld b, 10
ld c, 9 ld c, 9
@ -113,8 +113,8 @@ BillsHousePokemonList::
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
jr .billsPokemonLoop jr .billsPokemonLoop
.cancel .cancel
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
jp TextScriptEnd jp TextScriptEnd

View file

@ -24,8 +24,8 @@ LinkCableHelp::
ld a, 1 ld a, 1
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
.linkHelpLoop .linkHelpLoop
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0 hlcoord 0, 0
ld b, 8 ld b, 8
ld c, 13 ld c, 13
@ -41,8 +41,8 @@ LinkCableHelp::
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
cp 3 ; pressed a on "STOP READING" cp 3 ; pressed a on "STOP READING"
jr z, .exit jr z, .exit
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld hl, LinkCableInfoTexts ld hl, LinkCableInfoTexts
add a add a
ld d, 0 ld d, 0
@ -54,8 +54,8 @@ LinkCableHelp::
call PrintText call PrintText
jp .linkHelpLoop jp .linkHelpLoop
.exit .exit
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
jp TextScriptEnd jp TextScriptEnd
@ -108,8 +108,8 @@ ViridianSchoolBlackboard::
ld a, 1 ld a, 1
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
.blackboardLoop .blackboardLoop
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0 hlcoord 0, 0
lb bc, 6, 10 lb bc, 6, 10
call TextBoxBorder call TextBoxBorder
@ -158,8 +158,8 @@ ViridianSchoolBlackboard::
jr z, .exitBlackboard jr z, .exitBlackboard
; we must have pressed a on a status condition ; we must have pressed a on a status condition
; so print the text ; so print the text
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld hl, ViridianBlackboardStatusPointers ld hl, ViridianBlackboardStatusPointers
add a add a
ld d, 0 ld d, 0
@ -171,8 +171,8 @@ ViridianSchoolBlackboard::
call PrintText call PrintText
jp .blackboardLoop jp .blackboardLoop
.exitBlackboard .exitBlackboard
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
jp TextScriptEnd jp TextScriptEnd

View file

@ -4,8 +4,8 @@ TownMapText::
text_asm text_asm
ld a, $1 ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
xor a xor a
ldh [hWY], a ldh [hWY], a
@ -13,8 +13,8 @@ TownMapText::
ldh [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call LoadFontTilePatterns call LoadFontTilePatterns
farcall DisplayTownMap farcall DisplayTownMap
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld de, TextScriptEnd ld de, TextScriptEnd
push de push de
ldh a, [hLoadedROMBank] ldh a, [hLoadedROMBank]

View file

@ -108,7 +108,7 @@ InGameTrade_DoTrade:
ld bc, wPartyMon2 - wPartyMon1 ld bc, wPartyMon2 - wPartyMon1
call AddNTimes call AddNTimes
ld a, [hl] ld a, [hl]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld hl, wCompletedInGameTradeFlags ld hl, wCompletedInGameTradeFlags
ld a, [wWhichTrade] ld a, [wWhichTrade]
ld c, a ld c, a
@ -118,13 +118,13 @@ InGameTrade_DoTrade:
call PrintText call PrintText
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
push af push af
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
push af push af
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
call InGameTrade_PrepareTradeData call InGameTrade_PrepareTradeData
predef InternalClockTradeAnim predef InternalClockTradeAnim
pop af pop af
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
pop af pop af
ld [wWhichPokemon], a ld [wWhichPokemon], a
ld a, [wInGameTradeReceiveMonSpecies] ld a, [wInGameTradeReceiveMonSpecies]

View file

@ -1,6 +1,7 @@
ApplyOutOfBattlePoisonDamage: ApplyOutOfBattlePoisonDamage:
ld a, [wd730] ld a, [wStatusFlags5]
add a assert BIT_SCRIPTED_MOVEMENT_STATE == 7
add a ; overflows bit 7 into carry flag
jp c, .noBlackOut ; no black out if joypad states are being simulated jp c, .noBlackOut ; no black out if joypad states are being simulated
ld a, [wPartyCount] ld a, [wPartyCount]
and a and a
@ -101,8 +102,8 @@ ApplyOutOfBattlePoisonDamage:
ld a, TEXT_BLACKED_OUT ld a, TEXT_BLACKED_OUT
ldh [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld hl, wd72e ld hl, wStatusFlags4
set 5, [hl] set BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, $ff ld a, $ff
jr .done jr .done
.noBlackOut .noBlackOut

View file

@ -2,10 +2,10 @@ DisplayPokemonCenterDialogue_::
call SaveScreenTilesToBuffer1 ; save screen call SaveScreenTilesToBuffer1 ; save screen
ld hl, PokemonCenterWelcomeText ld hl, PokemonCenterWelcomeText
call PrintText call PrintText
ld hl, wd72e ld hl, wStatusFlags4
bit 2, [hl] bit BIT_USED_POKECENTER, [hl]
set 1, [hl] set BIT_UNKNOWN_4_1, [hl]
set 2, [hl] set BIT_USED_POKECENTER, [hl]
jr nz, .skipShallWeHealYourPokemon jr nz, .skipShallWeHealYourPokemon
ld hl, ShallWeHealYourPokemonText ld hl, ShallWeHealYourPokemonText
call PrintText call PrintText

View file

@ -5,8 +5,8 @@ CeladonPrizeMenu::
ld hl, RequireCoinCaseTextPtr ld hl, RequireCoinCaseTextPtr
jp PrintText jp PrintText
.havingCoinCase .havingCoinCase
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] ; disable letter-printing delay set BIT_NO_TEXT_DELAY, [hl]
ld hl, ExchangeCoinsForPrizesTextPtr ld hl, ExchangeCoinsForPrizesTextPtr
call PrintText call PrintText
; the following are the menu settings ; the following are the menu settings
@ -38,8 +38,8 @@ CeladonPrizeMenu::
jr z, .noChoice jr z, .noChoice
call HandlePrizeChoice call HandlePrizeChoice
.noChoice .noChoice
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ret ret
RequireCoinCaseTextPtr: RequireCoinCaseTextPtr:
@ -298,7 +298,7 @@ GetPrizeMonLevel:
jr .loop jr .loop
.matchFound .matchFound
ld a, [hl] ld a, [hl]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ret ret
INCLUDE "data/events/prize_mon_levels.asm" INCLUDE "data/events/prize_mon_levels.asm"

View file

@ -15,8 +15,8 @@ VendingMachineMenu::
ld [wTopMenuItemY], a ld [wTopMenuItemY], a
ld a, 1 ld a, 1
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 3 hlcoord 0, 3
ld b, 8 ld b, 8
ld c, 12 ld c, 12
@ -28,8 +28,8 @@ VendingMachineMenu::
hlcoord 9, 6 hlcoord 9, 6
ld de, DrinkPriceText ld de, DrinkPriceText
call PlaceString call PlaceString
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call HandleMenuInput call HandleMenuInput
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
jr nz, .notThirsty jr nz, .notThirsty

View file

@ -150,8 +150,8 @@ PrepareOAMData::
ld h, HIGH(wShadowOAM) ld h, HIGH(wShadowOAM)
ld de, $4 ld de, $4
ld b, $a0 ld b, $a0
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; jumping down ledge or fishing animation? bit BIT_LEDGE_OR_FISHING, a
ld a, $a0 ld a, $a0
jr z, .clear jr z, .clear

View file

@ -495,7 +495,7 @@ ItemUseBall:
ld a, [wEnemyMonSpecies2] ld a, [wEnemyMonSpecies2]
ld [wcf91], a ld [wcf91], a
ld a, [wEnemyMonLevel] ld a, [wEnemyMonLevel]
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
callfar LoadEnemyMonData callfar LoadEnemyMonData
pop af pop af
ld [wcf91], a ld [wcf91], a
@ -679,8 +679,8 @@ ItemUseSurfboard:
jp c, SurfingAttemptFailed jp c, SurfingAttemptFailed
.surf .surf
call .makePlayerMoveForward call .makePlayerMoveForward
ld hl, wd730 ld hl, wStatusFlags5
set 7, [hl] set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, 2 ld a, 2
ld [wWalkBikeSurfState], a ; change player state to surfing ld [wWalkBikeSurfState], a ; change player state to surfing
call PlayDefaultMusic ; play surfing music call PlayDefaultMusic ; play surfing music
@ -715,8 +715,8 @@ ItemUseSurfboard:
jp PrintText jp PrintText
.stopSurfing .stopSurfing
call .makePlayerMoveForward call .makePlayerMoveForward
ld hl, wd730 ld hl, wStatusFlags5
set 7, [hl] set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
xor a xor a
ld [wWalkBikeSurfState], a ; change player state to walking ld [wWalkBikeSurfState], a ; change player state to walking
dec a dec a
@ -1259,7 +1259,7 @@ ItemUseMedicine:
ld bc, wPartyMon1Level - wPartyMon1 ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level add hl, bc ; hl now points to level
ld a, [hl] ; a = level ld a, [hl] ; a = level
ld [wCurEnemyLVL], a ; store level ld [wCurEnemyLevel], a ; store level
call GetMonHeader call GetMonHeader
push de push de
ld a, d ld a, d
@ -1338,7 +1338,7 @@ ItemUseMedicine:
jr z, .vitaminNoEffect ; can't raise level above 100 jr z, .vitaminNoEffect ; can't raise level above 100
inc a inc a
ld [hl], a ; store incremented level ld [hl], a ; store incremented level
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
push hl push hl
push de push de
ld d, a ld d, a
@ -1505,11 +1505,11 @@ ItemUseEscapeRope:
jr z, .notUsable jr z, .notUsable
cp b cp b
jr nz, .loop jr nz, .loop
ld hl, wd732 ld hl, wStatusFlags6
set 3, [hl] set BIT_FLY_WARP, [hl]
set 6, [hl] set BIT_ESCAPE_WARP, [hl]
ld hl, wd72e ld hl, wStatusFlags4
res 4, [hl] res BIT_NO_BATTLES, [hl]
ResetEvent EVENT_IN_SAFARI_ZONE ResetEvent EVENT_IN_SAFARI_ZONE
xor a xor a
ld [wNumSafariBalls], a ld [wNumSafariBalls], a
@ -1597,8 +1597,8 @@ ItemUseCardKey:
.done .done
ld hl, ItemUseText00 ld hl, ItemUseText00
call PrintText call PrintText
ld hl, wd728 ld hl, wStatusFlags1
set 7, [hl] set BIT_UNUSED_CARD_KEY, [hl] ; never checked
ret ret
INCLUDE "data/events/card_key_coords.asm" INCLUDE "data/events/card_key_coords.asm"
@ -1872,7 +1872,7 @@ RodResponse:
ld a, 1 ld a, 1
ld [wMoveMissed], a ld [wMoveMissed], a
ld a, b ; level ld a, b ; level
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, c ; species ld a, c ; species
ld [wCurOpponent], a ld [wCurOpponent], a
@ -2774,7 +2774,7 @@ SendNewMonToBox:
ld [de], a ld [de], a
inc de inc de
push de push de
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld d, a ld d, a
callfar CalcExperience callfar CalcExperience
pop de pop de

View file

@ -208,10 +208,11 @@ LoadTownMap_Fly::
call PlaySound call PlaySound
ld a, [hl] ld a, [hl]
ld [wDestinationMap], a ld [wDestinationMap], a
ld hl, wd732 ld hl, wStatusFlags6
set 3, [hl] set BIT_FLY_WARP, [hl]
assert wStatusFlags6 + 1 == wStatusFlags7
inc hl inc hl
set 7, [hl] set BIT_USED_FLY, [hl]
.pressedB .pressedB
xor a xor a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a

View file

@ -19,8 +19,8 @@ _Joypad::
ld a, b ld a, b
ldh [hJoyLast], a ldh [hJoyLast], a
ld a, [wd730] ld a, [wStatusFlags5]
bit 5, a bit BIT_DISABLE_JOYPAD, a
jr nz, DiscardButtonPresses jr nz, DiscardButtonPresses
ldh a, [hJoyLast] ldh a, [hJoyLast]

View file

@ -587,7 +587,7 @@ ReturnToCableClubRoom:
push hl push hl
res 0, [hl] res 0, [hl]
xor a xor a
ld [wd72d], a ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING
dec a dec a
ld [wDestinationWarpID], a ld [wDestinationWarpID], a
call LoadMapData call LoadMapData
@ -839,7 +839,7 @@ TradeCenter_Trade:
call ClearScreen call ClearScreen
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
xor a xor a
ld [wUnusedCC5B], a ld [wUnusedFlag], a
ldh a, [hSerialConnectionStatus] ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK cp USING_EXTERNAL_CLOCK
jr z, .usingExternalClock jr z, .usingExternalClock

View file

@ -110,8 +110,8 @@ CableClubNPC::
ld hl, wUnknownSerialCounter ld hl, wUnknownSerialCounter
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld hl, wd72e ld hl, wStatusFlags4
res 6, [hl] res BIT_LINK_CONNECTED, [hl]
xor a xor a
ld [wMenuJoypadPollCount], a ld [wMenuJoypadPollCount], a
ret ret

View file

@ -32,9 +32,9 @@ DisplayTextIDInit::
.skipDrawingTextBoxBorder .skipDrawingTextBoxBorder
ld hl, wFontLoaded ld hl, wFontLoaded
set 0, [hl] set 0, [hl]
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
bit 4, [hl] bit BIT_NO_SPRITE_UPDATES, [hl]
res 4, [hl] res BIT_NO_SPRITE_UPDATES, [hl]
jr nz, .skipMovingSprites jr nz, .skipMovingSprites
call UpdateSprites call UpdateSprites
.skipMovingSprites .skipMovingSprites

View file

@ -23,8 +23,8 @@ DrawStartMenu::
ld [wLastMenuItem], a ld [wLastMenuItem], a
xor a xor a
ld [wMenuWatchMovingOutOfBounds], a ld [wMenuWatchMovingOutOfBounds], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] ; no pauses between printing each letter set BIT_NO_TEXT_DELAY, [hl]
hlcoord 12, 2 hlcoord 12, 2
CheckEvent EVENT_GOT_POKEDEX CheckEvent EVENT_GOT_POKEDEX
; case for not having pokedex ; case for not having pokedex
@ -42,8 +42,8 @@ DrawStartMenu::
call PrintStartMenuItem call PrintStartMenuItem
ld de, wPlayerName ; player's name ld de, wPlayerName ; player's name
call PrintStartMenuItem call PrintStartMenuItem
ld a, [wd72e] ld a, [wStatusFlags4]
bit 6, a ; is the player using the link feature? bit BIT_LINK_CONNECTED, a
; case for not using link feature ; case for not using link feature
ld de, StartMenuSaveText ld de, StartMenuSaveText
jr z, .printSaveOrResetText jr z, .printSaveOrResetText
@ -55,8 +55,8 @@ DrawStartMenu::
call PrintStartMenuItem call PrintStartMenuItem
ld de, StartMenuExitText ld de, StartMenuExitText
call PlaceString call PlaceString
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] ; turn pauses between printing letters back on res BIT_NO_TEXT_DELAY, [hl]
ret ret
StartMenuPokedexText: StartMenuPokedexText:

View file

@ -1,8 +1,8 @@
PKMNLeaguePC: PKMNLeaguePC:
ld hl, AccessedHoFPCText ld hl, AccessedHoFPCText
call PrintText call PrintText
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
push hl push hl
ld a, [wUpdateSpritesEnabled] ld a, [wUpdateSpritesEnabled]
push af push af

View file

@ -21,14 +21,14 @@ MainMenu:
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld [wDefaultMap], a ld [wDefaultMap], a
ld hl, wd72e ld hl, wStatusFlags4
res 6, [hl] res BIT_LINK_CONNECTED, [hl]
call ClearScreen call ClearScreen
call RunDefaultPaletteCommand call RunDefaultPaletteCommand
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
call LoadFontTilePatterns call LoadFontTilePatterns
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
ld a, [wSaveFileStatus] ld a, [wSaveFileStatus]
cp 1 cp 1
jr z, .noSaveFile jr z, .noSaveFile
@ -50,8 +50,8 @@ MainMenu:
ld de, NewGameText ld de, NewGameText
call PlaceString call PlaceString
.next2 .next2
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call UpdateSprites call UpdateSprites
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
@ -85,7 +85,7 @@ MainMenu:
cp 1 cp 1
jp z, StartNewGame jp z, StartNewGame
call DisplayOptionMenu call DisplayOptionMenu
ld a, 1 ld a, TRUE
ld [wOptionsInitialized], a ld [wOptionsInitialized], a
jp .mainMenuLoop jp .mainMenuLoop
.choseContinue .choseContinue
@ -99,10 +99,10 @@ MainMenu:
ldh [hJoyHeld], a ldh [hJoyHeld], a
call Joypad call Joypad
ldh a, [hJoyHeld] ldh a, [hJoyHeld]
bit 0, a bit BIT_A_BUTTON, a
jr nz, .pressedA jr nz, .pressedA
bit 1, a bit BIT_B_BUTTON, a
jp nz, .mainMenuLoop ; pressed B jp nz, .mainMenuLoop
jr .inputLoop jr .inputLoop
.pressedA .pressedA
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -114,18 +114,18 @@ MainMenu:
ld a, [wNumHoFTeams] ld a, [wNumHoFTeams]
and a and a
jp z, SpecialEnterMap jp z, SpecialEnterMap
ld a, [wCurMap] ; map ID ld a, [wCurMap]
cp HALL_OF_FAME cp HALL_OF_FAME
jp nz, SpecialEnterMap jp nz, SpecialEnterMap
xor a xor a
ld [wDestinationMap], a ld [wDestinationMap], a
ld hl, wd732 ld hl, wStatusFlags6
set 2, [hl] ; fly warp or dungeon warp set BIT_FLY_OR_DUNGEON_WARP, [hl]
call PrepareForSpecialWarp call PrepareForSpecialWarp
jp SpecialEnterMap jp SpecialEnterMap
InitOptions: InitOptions:
ld a, TEXT_DELAY_FAST ld a, 1 << BIT_FAST_TEXT_DELAY
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld a, TEXT_DELAY_MEDIUM ld a, TEXT_DELAY_MEDIUM
ld [wOptions], a ld [wOptions], a
@ -134,8 +134,8 @@ InitOptions:
LinkMenu: LinkMenu:
xor a xor a
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld hl, wd72e ld hl, wStatusFlags4
set 6, [hl] set BIT_LINK_CONNECTED, [hl]
ld hl, LinkMenuEmptyText ld hl, LinkMenuEmptyText
call PrintText call PrintText
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
@ -151,20 +151,25 @@ LinkMenu:
call PlaceString call PlaceString
xor a xor a
ld [wUnusedLinkMenuByte], a ld [wUnusedLinkMenuByte], a
ld [wd72d], a ld [wCableClubDestinationMap], a
ld hl, wTopMenuItemY ld hl, wTopMenuItemY
ld a, $7 ld a, 7
ld [hli], a ld [hli], a
ld a, $6 assert wTopMenuItemY + 1 == wTopMenuItemX
ld a, 6
ld [hli], a ld [hli], a
assert wTopMenuItemX + 1 == wCurrentMenuItem
xor a xor a
ld [hli], a ld [hli], a
inc hl inc hl
ld a, $2 assert wCurrentMenuItem + 2 == wMaxMenuItem
ld a, 2
ld [hli], a ld [hli], a
assert wMaxMenuItem + 1 == wMenuWatchedKeys
assert 2 + 1 == A_BUTTON | B_BUTTON
inc a inc a
; ld a, A_BUTTON | B_BUTTON ld [hli], a
ld [hli], a ; wMenuWatchedKeys assert wMenuWatchedKeys + 1 == wLastMenuItem
xor a xor a
ld [hl], a ld [hl], a
.waitForInputLoop .waitForInputLoop
@ -262,12 +267,12 @@ LinkMenu:
jr nz, .next jr nz, .next
ld a, TRADE_CENTER ld a, TRADE_CENTER
.next .next
ld [wd72d], a ld [wCableClubDestinationMap], a
ld hl, PleaseWaitText ld hl, PleaseWaitText
call PrintText call PrintText
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld hl, wd732 ld hl, wStatusFlags6
res BIT_DEBUG_MODE, [hl] res BIT_DEBUG_MODE, [hl]
ld a, [wDefaultMap] ld a, [wDefaultMap]
ld [wDestinationMap], a ld [wDestinationMap], a
@ -290,8 +295,8 @@ LinkMenu:
ld hl, LinkCanceledText ld hl, LinkCanceledText
vc_hook Wireless_net_end vc_hook Wireless_net_end
call PrintText call PrintText
ld hl, wd72e ld hl, wStatusFlags4
res 6, [hl] res BIT_LINK_CONNECTED, [hl]
ret ret
WhereWouldYouLikeText: WhereWouldYouLikeText:
@ -307,11 +312,9 @@ LinkCanceledText:
text_end text_end
StartNewGame: StartNewGame:
ld hl, wd732 ld hl, wStatusFlags6
; Ensure debug mode is not used when ; Ensure debug mode is not used when starting a regular new game.
; starting a regular new game. ; Debug mode persists in saved games for both debug and non-debug builds, and is
; Debug mode persists in saved games for
; both debug and non-debug builds, and is
; only reset here by the main menu. ; only reset here by the main menu.
res BIT_DEBUG_MODE, [hl] res BIT_DEBUG_MODE, [hl]
; fallthrough ; fallthrough
@ -326,9 +329,9 @@ SpecialEnterMap::
ldh [hJoyPressed], a ldh [hJoyPressed], a
ldh [hJoyHeld], a ldh [hJoyHeld], a
ldh [hJoy5], a ldh [hJoy5], a
ld [wd72d], a ld [wCableClubDestinationMap], a
ld hl, wd732 ld hl, wStatusFlags6
set 0, [hl] ; count play time set BIT_GAME_TIMER_COUNTING, [hl]
call ResetPlayerSpriteData call ResetPlayerSpriteData
ld c, 20 ld c, 20
call DelayFrames call DelayFrames
@ -465,7 +468,8 @@ DisplayOptionMenu:
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wLastMenuItem], a ld [wLastMenuItem], a
inc a assert BIT_FAST_TEXT_DELAY == 0
inc a ; 1 << BIT_FAST_TEXT_DELAY
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld [wOptionsCancelCursorX], a ld [wOptionsCancelCursorX], a
ld a, 3 ; text speed cursor Y coordinate ld a, 3 ; text speed cursor Y coordinate
@ -556,12 +560,12 @@ DisplayOptionMenu:
jp .loop jp .loop
.cursorInBattleAnimation .cursorInBattleAnimation
ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate
xor $0b ; toggle between 1 and 10 xor 1 ^ 10 ; toggle between 1 and 10
ld [wOptionsBattleAnimCursorX], a ld [wOptionsBattleAnimCursorX], a
jp .eraseOldMenuCursor jp .eraseOldMenuCursor
.cursorInBattleStyle .cursorInBattleStyle
ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate
xor $0b ; toggle between 1 and 10 xor 1 ^ 10 ; toggle between 1 and 10
ld [wOptionsBattleStyleCursorX], a ld [wOptionsBattleStyleCursorX], a
jp .eraseOldMenuCursor jp .eraseOldMenuCursor
.pressedLeftInTextSpeed .pressedLeftInTextSpeed
@ -622,19 +626,19 @@ SetOptionsFromCursorPositions:
dec a dec a
jr z, .battleAnimationOn jr z, .battleAnimationOn
.battleAnimationOff .battleAnimationOff
set 7, d set BIT_BATTLE_ANIMATION, d
jr .checkBattleStyle jr .checkBattleStyle
.battleAnimationOn .battleAnimationOn
res 7, d res BIT_BATTLE_ANIMATION, d
.checkBattleStyle .checkBattleStyle
ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate
dec a dec a
jr z, .battleStyleShift jr z, .battleStyleShift
.battleStyleSet .battleStyleSet
set 6, d set BIT_BATTLE_SHIFT, d
jr .storeOptions jr .storeOptions
.battleStyleShift .battleStyleShift
res 6, d res BIT_BATTLE_SHIFT, d
.storeOptions .storeOptions
ld a, d ld a, d
ld [wOptions], a ld [wOptions], a

View file

@ -83,8 +83,8 @@ DisplayNameRaterScreen::
DisplayNamingScreen: DisplayNamingScreen:
push hl push hl
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call ClearScreen call ClearScreen
call UpdateSprites call UpdateSprites
@ -167,8 +167,8 @@ DisplayNamingScreen:
call GBPalNormal call GBPalNormal
xor a xor a
ld [wAnimCounter], a ld [wAnimCounter], a
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld a, [wIsInBattle] ld a, [wIsInBattle]
and a and a
jp z, LoadTextBoxTilePatterns jp z, LoadTextBoxTilePatterns

View file

@ -172,11 +172,11 @@ RedrawPartyMenu_::
ld b, SET_PAL_PARTY_MENU ld b, SET_PAL_PARTY_MENU
call RunPaletteCommand call RunPaletteCommand
.printMessage .printMessage
ld hl, wd730 ld hl, wStatusFlags5
ld a, [hl] ld a, [hl]
push af push af
push hl push hl
set 6, [hl] ; turn off letter printing delay set BIT_NO_TEXT_DELAY, [hl]
ld a, [wPartyMenuTypeOrMessageID] ; message ID ld a, [wPartyMenuTypeOrMessageID] ; message ID
cp FIRST_PARTY_MENU_TEXT_ID cp FIRST_PARTY_MENU_TEXT_ID
jr nc, .printItemUseMessage jr nc, .printItemUseMessage

View file

@ -5,14 +5,14 @@ ActivatePC::
ld hl, TurnedOnPC1Text ld hl, TurnedOnPC1Text
call PrintText call PrintText
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 3, [hl] set BIT_USING_GENERIC_PC, [hl]
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
call Delay3 call Delay3
PCMainMenu: PCMainMenu:
farcall DisplayPCMainMenu farcall DisplayPCMainMenu
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 5, [hl] set BIT_NO_MENU_BUTTON_SOUND, [hl]
call HandleMenuInput call HandleMenuInput
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
jp nz, LogOff jp nz, LogOff
@ -48,9 +48,9 @@ PCMainMenu:
jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague
jp LogOff ;otherwise, it's 4, and you're logging off jp LogOff ;otherwise, it's 4, and you're logging off
.playersPC .playersPC
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 5, [hl] res BIT_NO_MENU_BUTTON_SOUND, [hl]
set 3, [hl] set BIT_USING_GENERIC_PC, [hl]
ld a, SFX_ENTER_PC ld a, SFX_ENTER_PC
call PlaySound call PlaySound
call WaitForSoundToFinish call WaitForSoundToFinish
@ -93,9 +93,9 @@ LogOff:
ld a, SFX_TURN_OFF_PC ld a, SFX_TURN_OFF_PC
call PlaySound call PlaySound
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 3, [hl] res BIT_USING_GENERIC_PC, [hl]
res 5, [hl] res BIT_NO_MENU_BUTTON_SOUND, [hl]
ret ret
TurnedOnPC1Text: TurnedOnPC1Text:

View file

@ -1,14 +1,14 @@
PlayerPC:: PlayerPC::
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
ld a, ITEM_NAME ld a, ITEM_NAME
ld [wNameListType], a ld [wNameListType], a
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
xor a xor a
ld [wBagSavedMenuItem], a ld [wBagSavedMenuItem], a
ld [wParentMenuItem], a ld [wParentMenuItem], a
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 3, a ; accessing player's PC through another PC? bit BIT_USING_GENERIC_PC, a
jr nz, PlayerPCMenu jr nz, PlayerPCMenu
; accessing it directly ; accessing it directly
ld a, SFX_TURN_ON_PC ld a, SFX_TURN_ON_PC
@ -19,8 +19,8 @@ PlayerPC::
PlayerPCMenu: PlayerPCMenu:
ld a, [wParentMenuItem] ld a, [wParentMenuItem]
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 5, [hl] set BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
hlcoord 0, 0 hlcoord 0, 0
ld b, $8 ld b, $8
@ -63,22 +63,22 @@ PlayerPCMenu:
jp z, PlayerPCToss jp z, PlayerPCToss
ExitPlayerPC: ExitPlayerPC:
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 3, a ; accessing player's PC through another PC? bit BIT_USING_GENERIC_PC, a
jr nz, .next jr nz, .next
; accessing it directly ; accessing it directly
ld a, SFX_TURN_OFF_PC ld a, SFX_TURN_OFF_PC
call PlaySound call PlaySound
call WaitForSoundToFinish call WaitForSoundToFinish
.next .next
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 5, [hl] res BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
xor a xor a
ld [wListScrollOffset], a ld [wListScrollOffset], a
ld [wBagSavedMenuItem], a ld [wBagSavedMenuItem], a
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ret ret

View file

@ -397,8 +397,8 @@ ShowPokedexData:
; function to display pokedex data from inside the pokedex ; function to display pokedex data from inside the pokedex
ShowPokedexDataInternal: ShowPokedexDataInternal:
ld hl, wd72c ld hl, wStatusFlags2
set 1, [hl] set BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $33 ; 3/7 volume ld a, $33 ; 3/7 volume
ldh [rNR50], a ldh [rNR50], a
call GBPalWhiteOut ; zero all palettes call GBPalWhiteOut ; zero all palettes
@ -583,8 +583,8 @@ ShowPokedexDataInternal:
call RunDefaultPaletteCommand call RunDefaultPaletteCommand
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
call GBPalNormal call GBPalNormal
ld hl, wd72c ld hl, wStatusFlags2
res 1, [hl] res BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $77 ; max volume ld a, $77 ; max volume
ldh [rNR50], a ldh [rNR50], a
ret ret

View file

@ -1,6 +1,5 @@
LoadSAV: LoadSAV:
;(if carry -> write ; if carry, write "the file data is destroyed"
;"the file data is destroyed")
call ClearScreen call ClearScreen
call LoadFontTilePatterns call LoadFontTilePatterns
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
@ -13,15 +12,15 @@ LoadSAV:
ld a, $2 ; good checksum ld a, $2 ; good checksum
jr .goodsum jr .goodsum
.badsum .badsum
ld hl, wd730 ld hl, wStatusFlags5
push hl push hl
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
ld hl, FileDataDestroyedText ld hl, FileDataDestroyedText
call PrintText call PrintText
ld c, 100 ld c, 100
call DelayFrames call DelayFrames
pop hl pop hl
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld a, $1 ; bad checksum ld a, $1 ; bad checksum
.goodsum .goodsum
ld [wSaveFileStatus], a ld [wSaveFileStatus], a

View file

@ -142,12 +142,12 @@ StartMenu_Pokemon::
jp .loop jp .loop
.canFly .canFly
call ChooseFlyDestination call ChooseFlyDestination
ld a, [wd732] ld a, [wStatusFlags6]
bit 3, a ; did the player decide to fly? bit BIT_FLY_WARP, a
jp nz, .goBackToMap jp nz, .goBackToMap
call LoadFontTilePatterns call LoadFontTilePatterns
ld hl, wd72e ld hl, wStatusFlags4
set 1, [hl] set BIT_UNKNOWN_4_1, [hl]
jp StartMenu_Pokemon jp StartMenu_Pokemon
.cut .cut
bit BIT_CASCADEBADGE, a bit BIT_CASCADEBADGE, a
@ -161,9 +161,9 @@ StartMenu_Pokemon::
bit BIT_SOULBADGE, a bit BIT_SOULBADGE, a
jp z, .newBadgeRequired jp z, .newBadgeRequired
farcall IsSurfingAllowed farcall IsSurfingAllowed
ld hl, wd728 ld hl, wStatusFlags1
bit 1, [hl] bit BIT_SURF_ALLOWED, [hl]
res 1, [hl] res BIT_SURF_ALLOWED, [hl]
jp z, .loop jp z, .loop
ld a, SURFBOARD ld a, SURFBOARD
ld [wcf91], a ld [wcf91], a
@ -177,7 +177,7 @@ StartMenu_Pokemon::
.strength .strength
bit BIT_RAINBOWBADGE, a bit BIT_RAINBOWBADGE, a
jp z, .newBadgeRequired jp z, .newBadgeRequired
predef PrintStrengthTxt predef PrintStrengthText
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
jp .goBackToMap jp .goBackToMap
.flash .flash
@ -214,12 +214,12 @@ StartMenu_Pokemon::
.canTeleport .canTeleport
ld hl, .warpToLastPokemonCenterText ld hl, .warpToLastPokemonCenterText
call PrintText call PrintText
ld hl, wd732 ld hl, wStatusFlags6
set 3, [hl] set BIT_FLY_WARP, [hl]
set 6, [hl] set BIT_ESCAPE_WARP, [hl]
ld hl, wd72e ld hl, wStatusFlags4
set 1, [hl] set BIT_UNKNOWN_4_1, [hl]
res 4, [hl] res BIT_NO_BATTLES, [hl]
ld c, 60 ld c, 60
call DelayFrames call DelayFrames
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -371,8 +371,8 @@ StartMenu_Item::
ld a, [wcf91] ld a, [wcf91]
cp BICYCLE cp BICYCLE
jr nz, .notBicycle2 jr nz, .notBicycle2
ld a, [wd732] ld a, [wStatusFlags6]
bit 5, a bit BIT_ALWAYS_ON_BIKE, a
jr z, .useItem_closeMenu jr z, .useItem_closeMenu
ld hl, CannotGetOffHereText ld hl, CannotGetOffHereText
call PrintText call PrintText
@ -639,8 +639,8 @@ TrainerInfo_DrawVerticalLine:
ret ret
StartMenu_SaveReset:: StartMenu_SaveReset::
ld a, [wd72e] ld a, [wStatusFlags4]
bit 6, a ; is the player using the link feature? bit BIT_LINK_CONNECTED, a
jp nz, Init jp nz, Init
predef SaveSAV ; save the game predef SaveSAV ; save the game
call LoadScreenTilesFromBuffer2 ; restore saved screen call LoadScreenTilesFromBuffer2 ; restore saved screen

View file

@ -37,14 +37,14 @@ DisplayTextBoxID_::
call TextBoxBorder call TextBoxBorder
pop hl pop hl
call GetTextBoxIDText call GetTextBoxIDText
ld a, [wd730] ld a, [wStatusFlags5]
push af push af
ld a, [wd730] ld a, [wStatusFlags5]
set 6, a ; no pauses between printing each letter set BIT_NO_TEXT_DELAY, a
ld [wd730], a ld [wStatusFlags5], a
call PlaceString call PlaceString
pop af pop af
ld [wd730], a ld [wStatusFlags5], a
call UpdateSprites call UpdateSprites
ret ret
@ -128,8 +128,8 @@ GetAddressOfScreenCoords:
INCLUDE "data/text_boxes.asm" INCLUDE "data/text_boxes.asm"
DisplayMoneyBox: DisplayMoneyBox:
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
ld a, MONEY_BOX_TEMPLATE ld a, MONEY_BOX_TEMPLATE
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID call DisplayTextBoxID
@ -141,17 +141,17 @@ DisplayMoneyBox:
ld de, wPlayerMoney ld de, wPlayerMoney
ld c, $a3 ld c, $a3
call PrintBCDNumber call PrintBCDNumber
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ret ret
CurrencyString: CurrencyString:
db " ¥@" db " ¥@"
DoBuySellQuitMenu: DoBuySellQuitMenu:
ld a, [wd730] ld a, [wStatusFlags5]
set 6, a ; no printing delay set BIT_NO_TEXT_DELAY, a
ld [wd730], a ld [wStatusFlags5], a
xor a xor a
ld [wChosenMenuItem], a ld [wChosenMenuItem], a
ld a, BUY_SELL_QUIT_MENU_TEMPLATE ld a, BUY_SELL_QUIT_MENU_TEMPLATE
@ -169,9 +169,9 @@ DoBuySellQuitMenu:
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wLastMenuItem], a ld [wLastMenuItem], a
ld [wMenuWatchMovingOutOfBounds], a ld [wMenuWatchMovingOutOfBounds], a
ld a, [wd730] ld a, [wStatusFlags5]
res 6, a ; turn on the printing delay res BIT_NO_TEXT_DELAY, a
ld [wd730], a ld [wStatusFlags5], a
call HandleMenuInput call HandleMenuInput
call PlaceUnfilledArrowMenuCursor call PlaceUnfilledArrowMenuCursor
bit BIT_A_BUTTON, a bit BIT_A_BUTTON, a
@ -205,9 +205,9 @@ DoBuySellQuitMenu:
; hl = address where the text box border should be drawn ; hl = address where the text box border should be drawn
DisplayTwoOptionMenu: DisplayTwoOptionMenu:
push hl push hl
ld a, [wd730] ld a, [wStatusFlags5]
set 6, a ; no printing delay set BIT_NO_TEXT_DELAY, a
ld [wd730], a ld [wStatusFlags5], a
; pointless because both values are overwritten before they are read ; pointless because both values are overwritten before they are read
xor a xor a
@ -277,8 +277,8 @@ DisplayTwoOptionMenu:
pop hl pop hl
add hl, bc add hl, bc
call PlaceString call PlaceString
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] ; turn on the printing delay res BIT_NO_TEXT_DELAY, [hl]
ld a, [wTwoOptionMenuID] ld a, [wTwoOptionMenuID]
cp NO_YES_MENU cp NO_YES_MENU
jr nz, .notNoYesMenu jr nz, .notNoYesMenu
@ -287,12 +287,12 @@ DisplayTwoOptionMenu:
; it only seems to be used when confirming the deletion of a save file ; it only seems to be used when confirming the deletion of a save file
xor a xor a
ld [wTwoOptionMenuID], a ld [wTwoOptionMenuID], a
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
push af push af
push hl push hl
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
bit 5, [hl] bit BIT_NO_MENU_BUTTON_SOUND, [hl]
set 5, [hl] ; don't play sound when A or B is pressed in menu set BIT_NO_MENU_BUTTON_SOUND, [hl]
pop hl pop hl
.noYesMenuInputLoop .noYesMenuInputLoop
call HandleMenuInput call HandleMenuInput
@ -300,7 +300,7 @@ DisplayTwoOptionMenu:
jr nz, .noYesMenuInputLoop ; try again if B was not pressed jr nz, .noYesMenuInputLoop ; try again if B was not pressed
pop af pop af
pop hl pop hl
ld [wFlags_0xcd60], a ld [wMiscFlags], a
ld a, SFX_PRESS_AB ld a, SFX_PRESS_AB
call PlaySound call PlaySound
jr .pressedAButton jr .pressedAButton

View file

@ -8,7 +8,7 @@ PrepareOakSpeech:
; which causes CheckForceBikeOrSurf to not return. ; which causes CheckForceBikeOrSurf to not return.
; To fix this in debug builds, reset bit 5 here or in StartNewGame. ; To fix this in debug builds, reset bit 5 here or in StartNewGame.
; In non-debug builds, the instructions can be removed. ; In non-debug builds, the instructions can be removed.
ld a, [wd732] ld a, [wStatusFlags6]
push af push af
ld hl, wPlayerName ld hl, wPlayerName
ld bc, wBoxDataEnd - wPlayerName ld bc, wBoxDataEnd - wPlayerName
@ -19,7 +19,7 @@ PrepareOakSpeech:
xor a xor a
call FillMemory call FillMemory
pop af pop af
ld [wd732], a ld [wStatusFlags6], a
pop af pop af
ld [wOptions], a ld [wOptions], a
pop af pop af
@ -61,7 +61,7 @@ OakSpeech:
call PrepareForSpecialWarp call PrepareForSpecialWarp
xor a xor a
ldh [hTileAnimations], a ldh [hTileAnimations], a
ld a, [wd732] ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a bit BIT_DEBUG_MODE, a
jp nz, .skipSpeech jp nz, .skipSpeech
ld de, ProfOakPic ld de, ProfOakPic
@ -106,8 +106,8 @@ OakSpeech:
lb bc, BANK(RedPicFront), $00 lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight call IntroDisplayPicCenteredOrUpperRight
call GBFadeInFromWhite call GBFadeInFromWhite
ld a, [wd72d] ld a, [wStatusFlags3]
and a and a ; ???
jr nz, .next jr nz, .next
ld hl, OakSpeechText3 ld hl, OakSpeechText3
call PrintText call PrintText

View file

@ -15,9 +15,11 @@ PrepareTitleScreen::
xor a xor a
ldh [hWY], a ldh [hWY], a
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld hl, wd732 ld hl, wStatusFlags6
ld [hli], a ld [hli], a
assert wStatusFlags6 + 1 == wStatusFlags7
ld [hli], a ld [hli], a
assert wStatusFlags7 + 1 == wElite4Flags
ld [hl], a ld [hl], a
ld a, BANK(Music_TitleScreen) ld a, BANK(Music_TitleScreen)
ld [wAudioROMBank], a ld [wAudioROMBank], a
@ -218,7 +220,7 @@ ENDC
ld [wNewSoundID], a ld [wNewSoundID], a
call PlaySound call PlaySound
xor a xor a
ld [wUnusedCC5B], a ld [wUnusedFlag], a
; Keep scrolling in new mons indefinitely until the user performs input. ; Keep scrolling in new mons indefinitely until the user performs input.
.awaitUserInterruptionLoop .awaitUserInterruptionLoop

View file

@ -173,8 +173,8 @@ LoadTradingGFXAndMonNames:
call ClearSprites call ClearSprites
ld a, $ff ld a, $ff
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] ; turn on instant text printing set BIT_NO_TEXT_DELAY, [hl]
ld a, [wOnSGB] ld a, [wOnSGB]
and a and a
ld a, $e4 ; non-SGB OBP0 ld a, $e4 ; non-SGB OBP0
@ -218,8 +218,8 @@ Trade_SwapNames:
Trade_Cleanup: Trade_Cleanup:
xor a xor a
call LoadGBPal call LoadGBPal
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] ; turn off instant text printing res BIT_NO_TEXT_DELAY, [hl]
ret ret
Trade_ShowPlayerMon: Trade_ShowPlayerMon:

View file

@ -1,12 +1,12 @@
PlayerStepOutFromDoor:: PlayerStepOutFromDoor::
ld hl, wd730 ld hl, wStatusFlags5 ; should this be wMovementFlags?
res 1, [hl] res BIT_EXITING_DOOR, [hl]
call IsPlayerStandingOnDoorTile call IsPlayerStandingOnDoorTile
jr nc, .notStandingOnDoor jr nc, .notStandingOnDoor
ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld hl, wd736 ld hl, wMovementFlags
set 1, [hl] set BIT_EXITING_DOOR, [hl]
ld a, $1 ld a, $1
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
ld a, D_DOWN ld a, D_DOWN
@ -20,21 +20,21 @@ PlayerStepOutFromDoor::
ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wUnusedOverrideSimulatedJoypadStatesIndex], a
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
ld hl, wd736 ld hl, wMovementFlags
res 0, [hl] res BIT_STANDING_ON_DOOR, [hl]
res 1, [hl] res BIT_EXITING_DOOR, [hl]
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ret ret
_EndNPCMovementScript:: _EndNPCMovementScript::
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
ld hl, wd736 ld hl, wMovementFlags
res 0, [hl] res BIT_STANDING_ON_DOOR, [hl]
res 1, [hl] res BIT_EXITING_DOOR, [hl]
xor a xor a
ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptSpriteOffset], a
ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptPointerTableNum], a
@ -79,15 +79,15 @@ PalletMovementScript_OakMoveLeft:
ld a, $3 ld a, $3
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
.done .done
ld hl, wFlags_D733 ld hl, wStatusFlags7
set 1, [hl] set BIT_NO_MAP_MUSIC, [hl]
ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a ld [wJoyIgnore], a
ret ret
PalletMovementScript_PlayerMoveLeft: PalletMovementScript_PlayerMoveLeft:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a ; is an NPC being moved by a script? bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ; return if Oak is still moving ret nz ; return if Oak is still moving
ld a, [wNumStepsToTake] ld a, [wNumStepsToTake]
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
@ -119,10 +119,10 @@ PalletMovementScript_WalkToLab:
ld hl, wNPCMovementDirections2 ld hl, wNPCMovementDirections2
ld de, RLEList_ProfOakWalkToLab ld de, RLEList_ProfOakWalkToLab
call DecodeRLEList call DecodeRLEList
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
ld hl, wd730 ld hl, wStatusFlags5
set 7, [hl] set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, $4 ld a, $4
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ret ret
@ -151,10 +151,10 @@ PalletMovementScript_Done:
ld a, HS_PALLET_TOWN_OAK ld a, HS_PALLET_TOWN_OAK
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef HideObject predef HideObject
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
jp EndNPCMovementScript jp EndNPCMovementScript
PewterMuseumGuyMovementScriptPointerTable:: PewterMuseumGuyMovementScriptPointerTable::
@ -183,8 +183,8 @@ PewterMovementScript_WalkToMuseum:
ld hl, wNPCMovementDirections2 ld hl, wNPCMovementDirections2
ld de, RLEList_PewterMuseumGuy ld de, RLEList_PewterMuseumGuy
call DecodeRLEList call DecodeRLEList
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
ld a, $1 ld a, $1
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ret ret
@ -207,10 +207,10 @@ PewterMovementScript_Done:
ld a, [wSimulatedJoypadStatesIndex] ld a, [wSimulatedJoypadStatesIndex]
and a and a
ret nz ret nz
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
jp EndNPCMovementScript jp EndNPCMovementScript
PewterGymGuyMovementScriptPointerTable:: PewterGymGuyMovementScriptPointerTable::
@ -240,10 +240,10 @@ PewterMovementScript_WalkToGym:
ld hl, wNPCMovementDirections2 ld hl, wNPCMovementDirections2
ld de, RLEList_PewterGymGuy ld de, RLEList_PewterGymGuy
call DecodeRLEList call DecodeRLEList
ld hl, wd72e ld hl, wStatusFlags4
res 7, [hl] res BIT_INIT_SCRIPTED_MOVEMENT, [hl]
ld hl, wd730 ld hl, wStatusFlags5
set 7, [hl] set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, $1 ld a, $1
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ret ret

View file

@ -32,8 +32,8 @@ UsedCut:
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
call GetPartyMonName call GetPartyMonName
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call ClearSprites call ClearSprites
call RestoreScreenTilesAndReloadTilePatterns call RestoreScreenTilesAndReloadTilePatterns
@ -49,8 +49,8 @@ UsedCut:
ld hl, UsedCutText ld hl, UsedCutText
call PrintText call PrintText
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld a, $ff ld a, $ff
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
call InitCutAnimOAM call InitCutAnimOAM

View file

@ -15,8 +15,8 @@ EmotionBubble:
push af push af
ld a, $ff ld a, $ff
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? bit BIT_LEDGE_OR_FISHING, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
ld hl, wShadowOAMSprite35Attributes ld hl, wShadowOAMSprite35Attributes
ld de, wShadowOAMSprite39Attributes ld de, wShadowOAMSprite39Attributes
jr z, .next jr z, .next

View file

@ -1,6 +1,6 @@
PrintStrengthTxt: PrintStrengthText:
ld hl, wd728 ld hl, wStatusFlags1
set 0, [hl] set BIT_STRENGTH_ACTIVE, [hl]
ld hl, UsedStrengthText ld hl, UsedStrengthText
call PrintText call PrintText
ld hl, CanMoveBouldersText ld hl, CanMoveBouldersText
@ -19,13 +19,13 @@ CanMoveBouldersText:
text_end text_end
IsSurfingAllowed: IsSurfingAllowed:
; Returns whether surfing is allowed in bit 1 of wd728. ; Returns whether surfing is allowed in BIT_SURF_ALLOWED of wStatusFlags1.
; Surfing isn't allowed on the Cycling Road or in the lowest level of the ; Surfing isn't allowed on the Cycling Road or in the lowest level of the
; Seafoam Islands before the current has been slowed with boulders. ; Seafoam Islands before the current has been slowed with boulders.
ld hl, wd728 ld hl, wStatusFlags1
set 1, [hl] set BIT_SURF_ALLOWED, [hl]
ld a, [wd732] ld a, [wStatusFlags6]
bit 5, a bit BIT_ALWAYS_ON_BIKE, a
jr nz, .forcedToRideBike jr nz, .forcedToRideBike
ld a, [wCurMap] ld a, [wCurMap]
cp SEAFOAM_ISLANDS_B4F cp SEAFOAM_ISLANDS_B4F
@ -35,13 +35,13 @@ IsSurfingAllowed:
ld hl, SeafoamIslandsB4FStairsCoords ld hl, SeafoamIslandsB4FStairsCoords
call ArePlayerCoordsInArray call ArePlayerCoordsInArray
ret nc ret nc
ld hl, wd728 ld hl, wStatusFlags1
res 1, [hl] res BIT_SURF_ALLOWED, [hl]
ld hl, CurrentTooFastText ld hl, CurrentTooFastText
jp PrintText jp PrintText
.forcedToRideBike .forcedToRideBike
ld hl, wd728 ld hl, wStatusFlags1
res 1, [hl] res BIT_SURF_ALLOWED, [hl]
ld hl, CyclingIsFunText ld hl, CyclingIsFunText
jp PrintText jp PrintText

View file

@ -1,17 +1,17 @@
IsPlayerOnDungeonWarp:: IsPlayerOnDungeonWarp::
xor a xor a
ld [wWhichDungeonWarp], a ld [wWhichDungeonWarp], a
ld a, [wd72d] ld a, [wStatusFlags3]
bit 4, a bit BIT_ON_DUNGEON_WARP, a
ret nz ret nz
call ArePlayerCoordsInArray call ArePlayerCoordsInArray
ret nc ret nc
ld a, [wCoordIndex] ld a, [wCoordIndex]
ld [wWhichDungeonWarp], a ld [wWhichDungeonWarp], a
ld hl, wd72d ld hl, wStatusFlags3
set 4, [hl] set BIT_ON_DUNGEON_WARP, [hl]
ld hl, wd732 ld hl, wStatusFlags6
set 4, [hl] set BIT_DUNGEON_WARP, [hl]
ret ret
; if a hidden object was found, stores $00 in [hDidntFindAnyHiddenObject], else stores $ff ; if a hidden object was found, stores $00 in [hDidntFindAnyHiddenObject], else stores $ff

View file

@ -1,6 +1,6 @@
HandleLedges:: HandleLedges::
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; already jumping down ledge bit BIT_LEDGE_OR_FISHING, a
ret nz ret nz
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
and a ; OVERWORLD and a ; OVERWORLD
@ -41,8 +41,8 @@ HandleLedges::
ret z ret z
ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld hl, wd736 ld hl, wMovementFlags
set 6, [hl] ; jumping down ledge set BIT_LEDGE_OR_FISHING, [hl]
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, e ld a, e
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a

View file

@ -60,8 +60,8 @@ UpdatePlayerSprite:
bit 0, a bit 0, a
jr nz, .notMoving jr nz, .notMoving
.moving .moving
ld a, [wd736] ld a, [wMovementFlags]
bit 7, a ; is the player sprite spinning due to a spin tile? bit BIT_SPINNING, a
jr nz, .skipSpriteAnim jr nz, .skipSpriteAnim
ldh a, [hCurrentSpriteOffset] ldh a, [hCurrentSpriteOffset]
add $7 add $7
@ -175,8 +175,8 @@ UpdateNPCSprite:
jr nz, .next jr nz, .next
; reached end of wNPCMovementDirections list ; reached end of wNPCMovementDirections list
ld [hl], a ; store $ff in movement byte 1, disabling scripted movement ld [hl], a ; store $ff in movement byte 1, disabling scripted movement
ld hl, wd730 ld hl, wStatusFlags5
res 0, [hl] res BIT_SCRIPTED_NPC_MOVEMENT, [hl]
xor a xor a
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wUnusedOverrideSimulatedJoypadStatesIndex], a
@ -409,8 +409,8 @@ MakeNPCFacePlayer:
; Check if the behaviour of the NPC facing the player when spoken to is ; Check if the behaviour of the NPC facing the player when spoken to is
; disabled. This is only done when rubbing the S.S. Anne captain's back. ; disabled. This is only done when rubbing the S.S. Anne captain's back.
ld a, [wd72d] ld a, [wStatusFlags3]
bit 5, a bit BIT_NO_NPC_FACE_PLAYER, a
jr nz, notYetMoving jr nz, notYetMoving
res 7, [hl] res 7, [hl]
ld a, [wPlayerDirection] ld a, [wPlayerDirection]
@ -740,12 +740,12 @@ DoScriptedNPCMovement:
; a few times in the game. It is used when the NPC and player must walk together ; a few times in the game. It is used when the NPC and player must walk together
; in sync, such as when the player is following the NPC somewhere. An NPC can't ; in sync, such as when the player is following the NPC somewhere. An NPC can't
; be moved in sync with the player using the other method. ; be moved in sync with the player using the other method.
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a bit BIT_SCRIPTED_MOVEMENT_STATE, a
ret z ret z
ld hl, wd72e ld hl, wStatusFlags4
bit 7, [hl] bit BIT_INIT_SCRIPTED_MOVEMENT, [hl]
set 7, [hl] set BIT_INIT_SCRIPTED_MOVEMENT, [hl]
jp z, InitScriptedNPCMovement jp z, InitScriptedNPCMovement
ld hl, wNPCMovementDirections2 ld hl, wNPCMovementDirections2
ld a, [wNPCMovementDirections2Index] ld a, [wNPCMovementDirections2Index]

View file

@ -5,15 +5,15 @@ EnterMapAnim::
call Delay3 call Delay3
push hl push hl
call GBFadeInFromWhite call GBFadeInFromWhite
ld hl, wFlags_D733 ld hl, wStatusFlags7
bit 7, [hl] ; used fly out of battle? bit BIT_USED_FLY, [hl]
res 7, [hl] res BIT_USED_FLY, [hl]
jr nz, .flyAnimation jr nz, .flyAnimation
ld a, SFX_TELEPORT_ENTER_1 ld a, SFX_TELEPORT_ENTER_1
call PlaySound call PlaySound
ld hl, wd732 ld hl, wStatusFlags6
bit 4, [hl] ; used dungeon warp? bit BIT_DUNGEON_WARP, [hl]
res 4, [hl] res BIT_DUNGEON_WARP, [hl]
pop hl pop hl
jr nz, .dungeonWarpAnimation jr nz, .dungeonWarpAnimation
call PlayerSpinWhileMovingDown call PlayerSpinWhileMovingDown
@ -122,8 +122,8 @@ _LeaveMapAnim::
.playerNotStandingOnWarpPadOrHole .playerNotStandingOnWarpPadOrHole
ld a, $4 ld a, $4
call StopMusic call StopMusic
ld a, [wd732] ld a, [wStatusFlags6]
bit 6, a ; is the last used pokemon center the destination? bit BIT_ESCAPE_WARP, a
jr z, .flyAnimation jr z, .flyAnimation
; if going to the last used pokemon center ; if going to the last used pokemon center
ld hl, wPlayerSpinInPlaceAnimFrameDelay ld hl, wPlayerSpinInPlaceAnimFrameDelay
@ -378,8 +378,8 @@ INCLUDE "data/tilesets/warp_pad_hole_tile_ids.asm"
FishingAnim: FishingAnim:
ld c, 10 ld c, 10
call DelayFrames call DelayFrames
ld hl, wd736 ld hl, wMovementFlags
set 6, [hl] ; reserve the last 4 OAM entries set BIT_LEDGE_OR_FISHING, [hl]
ld de, RedSprite ld de, RedSprite
ld hl, vNPCSprites tile $00 ld hl, vNPCSprites tile $00
lb bc, BANK(RedSprite), 12 lb bc, BANK(RedSprite), 12
@ -445,8 +445,8 @@ FishingAnim:
.done .done
call PrintText call PrintText
ld hl, wd736 ld hl, wMovementFlags
res 6, [hl] ; unreserve the last 4 OAM entries res BIT_LEDGE_OR_FISHING, [hl]
call LoadFontTilePatterns call LoadFontTilePatterns
ret ret
@ -512,10 +512,10 @@ _HandleMidJump::
ldh [hJoyPressed], a ldh [hJoyPressed], a
ldh [hJoyReleased], a ldh [hJoyReleased], a
ld [wPlayerJumpingYScreenCoordsIndex], a ld [wPlayerJumpingYScreenCoordsIndex], a
ld hl, wd736 ld hl, wMovementFlags
res 6, [hl] ; not jumping down a ledge any more res BIT_LEDGE_OR_FISHING, [hl]
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] ; not simulating joypad states any more res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ret ret

View file

@ -1,4 +1,4 @@
; only used for setting bit 2 of wd736 upon entering a new map ; only used for setting BIT_STANDING_ON_WARP of wMovementFlags upon entering a new map
IsPlayerStandingOnWarp:: IsPlayerStandingOnWarp::
ld a, [wNumberOfWarps] ld a, [wNumberOfWarps]
and a and a
@ -18,8 +18,8 @@ IsPlayerStandingOnWarp::
ld [wDestinationWarpID], a ld [wDestinationWarpID], a
ld a, [hl] ; target map ld a, [hl] ; target map
ldh [hWarpDestinationMap], a ldh [hWarpDestinationMap], a
ld hl, wd736 ld hl, wMovementFlags
set 2, [hl] ; standing on warp flag set BIT_STANDING_ON_WARP, [hl]
ret ret
.nextWarp1 .nextWarp1
inc hl inc hl
@ -32,8 +32,8 @@ IsPlayerStandingOnWarp::
ret ret
CheckForceBikeOrSurf:: CheckForceBikeOrSurf::
ld hl, wd732 ld hl, wStatusFlags6
bit 5, [hl] bit BIT_ALWAYS_ON_BIKE, [hl]
ret nz ret nz
ld hl, ForcedBikeOrSurfMaps ld hl, ForcedBikeOrSurfMaps
ld a, [wYCoord] ld a, [wYCoord]
@ -45,14 +45,14 @@ CheckForceBikeOrSurf::
.loop .loop
ld a, [hli] ld a, [hli]
cp $ff cp $ff
ret z ;if we reach FF then it's not part of the list ret z ; if we reach FF then it's not part of the list
cp d ;compare to current map cp d ; compare to current map
jr nz, .incorrectMap jr nz, .incorrectMap
ld a, [hli] ld a, [hli]
cp b ;compare y-coord cp b ; compare y-coord
jr nz, .incorrectY jr nz, .incorrectY
ld a, [hli] ld a, [hli]
cp c ;compare x-coord cp c ; compare x-coord
jr nz, .loop ; incorrect x-coord, check next item jr nz, .loop ; incorrect x-coord, check next item
ld a, [wCurMap] ld a, [wCurMap]
cp SEAFOAM_ISLANDS_B3F cp SEAFOAM_ISLANDS_B3F
@ -64,9 +64,8 @@ CheckForceBikeOrSurf::
ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT
ld [wSeafoamIslandsB4FCurScript], a ld [wSeafoamIslandsB4FCurScript], a
jr z, .forceSurfing jr z, .forceSurfing
;force bike riding ld hl, wStatusFlags6
ld hl, wd732 set BIT_ALWAYS_ON_BIKE, [hl]
set 5, [hl]
ld a, $1 ld a, $1
ld [wWalkBikeSurfState], a ld [wWalkBikeSurfState], a
ld [wWalkBikeSurfStateCopy], a ld [wWalkBikeSurfStateCopy], a
@ -207,8 +206,8 @@ IsPlayerStandingOnDoorTileOrWarpTile::
lda_coord 8, 9 lda_coord 8, 9
call IsInArray call IsInArray
jr nc, .done jr nc, .done
ld hl, wd736 ld hl, wMovementFlags
res 2, [hl] res BIT_STANDING_ON_WARP, [hl]
.done .done
pop bc pop bc
pop de pop de

View file

@ -1,9 +1,9 @@
TryPushingBoulder:: TryPushingBoulder::
ld a, [wd728] ld a, [wStatusFlags1]
bit 0, a ; using Strength? bit BIT_STRENGTH_ACTIVE, a
ret z ret z
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 1, a ; has boulder dust animation from previous push played yet? bit BIT_BOULDER_DUST, a
ret nz ret nz
xor a xor a
ldh [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
@ -23,9 +23,9 @@ TryPushingBoulder::
ld a, [hl] ld a, [hl]
cp BOULDER_MOVEMENT_BYTE_2 cp BOULDER_MOVEMENT_BYTE_2
jp nz, ResetBoulderPushFlags jp nz, ResetBoulderPushFlags
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
bit 6, [hl] bit BIT_TRIED_PUSH_BOULDER, [hl]
set 6, [hl] ; indicate that the player has tried pushing set BIT_TRIED_PUSH_BOULDER, [hl]
ret z ; the player must try pushing twice before the boulder will move ret z ; the player must try pushing twice before the boulder will move
ldh a, [hJoyHeld] ldh a, [hJoyHeld]
and D_RIGHT | D_LEFT | D_UP | D_DOWN and D_RIGHT | D_LEFT | D_UP | D_DOWN
@ -44,30 +44,30 @@ TryPushingBoulder::
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
jr z, .pushBoulderRight jr z, .pushBoulderRight
.pushBoulderDown .pushBoulderDown
bit 7, b bit BIT_D_DOWN, b
ret z ret z
ld de, PushBoulderDownMovementData ld de, PushBoulderDownMovementData
jr .done jr .done
.pushBoulderUp .pushBoulderUp
bit 6, b bit BIT_D_UP, b
ret z ret z
ld de, PushBoulderUpMovementData ld de, PushBoulderUpMovementData
jr .done jr .done
.pushBoulderLeft .pushBoulderLeft
bit 5, b bit BIT_D_LEFT, b
ret z ret z
ld de, PushBoulderLeftMovementData ld de, PushBoulderLeftMovementData
jr .done jr .done
.pushBoulderRight .pushBoulderRight
bit 4, b bit BIT_D_RIGHT, b
ret z ret z
ld de, PushBoulderRightMovementData ld de, PushBoulderRightMovementData
.done .done
call MoveSprite call MoveSprite
ld a, SFX_PUSH_BOULDER ld a, SFX_PUSH_BOULDER
call PlaySound call PlaySound
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 1, [hl] set BIT_BOULDER_DUST, [hl]
ret ret
PushBoulderUpMovementData: PushBoulderUpMovementData:
@ -87,14 +87,14 @@ PushBoulderRightMovementData:
db -1 ; end db -1 ; end
DoBoulderDustAnimation:: DoBoulderDustAnimation::
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
callfar AnimateBoulderDust callfar AnimateBoulderDust
call DiscardButtonPresses call DiscardButtonPresses
ld [wJoyIgnore], a ld [wJoyIgnore], a
call ResetBoulderPushFlags call ResetBoulderPushFlags
set 7, [hl] ; [wFlags_0xcd60] set BIT_PUSHED_BOULDER, [hl]
ld a, [wBoulderSpriteIndex] ld a, [wBoulderSpriteIndex]
ldh [hSpriteIndex], a ldh [hSpriteIndex], a
call GetSpriteMovementByte2Pointer call GetSpriteMovementByte2Pointer
@ -103,7 +103,7 @@ DoBoulderDustAnimation::
jp PlaySound jp PlaySound
ResetBoulderPushFlags: ResetBoulderPushFlags:
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 1, [hl] res BIT_BOULDER_DUST, [hl]
res 6, [hl] res BIT_TRIED_PUSH_BOULDER, [hl]
ret ret

View file

@ -1,9 +1,9 @@
PrepareForSpecialWarp:: PrepareForSpecialWarp::
call LoadSpecialWarpData call LoadSpecialWarpData
predef LoadTilesetHeader predef LoadTilesetHeader
ld hl, wd732 ld hl, wStatusFlags6
bit 2, [hl] ; dungeon warp or fly warp? bit BIT_FLY_OR_DUNGEON_WARP, [hl]
res 2, [hl] res BIT_FLY_OR_DUNGEON_WARP, [hl]
jr z, .debugNewGameWarp jr z, .debugNewGameWarp
ld a, [wDestinationMap] ld a, [wDestinationMap]
jr .next jr .next
@ -17,19 +17,19 @@ PrepareForSpecialWarp::
ld a, PALLET_TOWN ld a, PALLET_TOWN
.next .next
ld b, a ld b, a
ld a, [wd72d] ld a, [wStatusFlags3]
and a and a ; ???
jr nz, .next2 jr nz, .next2
ld a, b ld a, b
.next2 .next2
ld hl, wd732 ld hl, wStatusFlags6
bit 4, [hl] ; dungeon warp bit BIT_DUNGEON_WARP, [hl]
ret nz ret nz
ld [wLastMap], a ld [wLastMap], a
ret ret
LoadSpecialWarpData: LoadSpecialWarpData:
ld a, [wd72d] ld a, [wCableClubDestinationMap]
cp TRADE_CENTER cp TRADE_CENTER
jr nz, .notTradeCenter jr nz, .notTradeCenter
ld hl, TradeCenterPlayerWarp ld hl, TradeCenterPlayerWarp
@ -48,7 +48,7 @@ LoadSpecialWarpData:
ld hl, ColosseumFriendWarp ld hl, ColosseumFriendWarp
jr .copyWarpData jr .copyWarpData
.notColosseum .notColosseum
ld a, [wd732] ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a bit BIT_DEBUG_MODE, a
; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug
jr nz, .notNewGameWarp jr nz, .notNewGameWarp
@ -70,17 +70,17 @@ LoadSpecialWarpData:
jr .done jr .done
.notNewGameWarp .notNewGameWarp
ld a, [wLastMap] ; this value is overwritten before it's ever read ld a, [wLastMap] ; this value is overwritten before it's ever read
ld hl, wd732 ld hl, wStatusFlags6
bit 4, [hl] ; dungeon warp bit BIT_DUNGEON_WARP, [hl]
jr nz, .usedDungeonWarp jr nz, .usedDungeonWarp
bit 6, [hl] ; blacked out bit BIT_ESCAPE_WARP, [hl]
res 6, [hl] res BIT_ESCAPE_WARP, [hl]
jr z, .otherDestination jr z, .otherDestination
ld a, [wLastBlackoutMap] ld a, [wLastBlackoutMap]
jr .usedFlyWarp jr .usedFlyWarp
.usedDungeonWarp .usedDungeonWarp
ld hl, wd72d ld hl, wStatusFlags3
res 4, [hl] res BIT_ON_DUNGEON_WARP, [hl]
ld a, [wDungeonWarpDestinationMap] ld a, [wDungeonWarpDestinationMap]
ld b, a ld b, a
ld [wCurMap], a ld [wCurMap], a

View file

@ -221,8 +221,8 @@ TrainerEngage:
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
and a and a
jr z, .noEngage jr z, .noEngage
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 0, [hl] set BIT_SEEN_BY_TRAINER, [hl]
call EngageMapTrainer call EngageMapTrainer
ld a, $ff ld a, $ff
.noEngage .noEngage

View file

@ -1,7 +1,7 @@
TrackPlayTime:: TrackPlayTime::
call CountDownIgnoreInputBitReset call CountDownIgnoreInputBitReset
ld a, [wd732] ld a, [wStatusFlags6]
bit 0, a bit BIT_GAME_TIMER_COUNTING, a
ret z ret z
ld a, [wPlayTimeMaxed] ld a, [wPlayTimeMaxed]
and a and a
@ -48,12 +48,12 @@ CountDownIgnoreInputBitReset:
ld [wIgnoreInputCounter], a ld [wIgnoreInputCounter], a
and a and a
ret nz ret nz
ld a, [wd730] ld a, [wStatusFlags5]
res 1, a res BIT_UNKNOWN_5_1, a
res 2, a res BIT_UNKNOWN_5_2, a
bit 5, a bit BIT_DISABLE_JOYPAD, a
res 5, a res BIT_DISABLE_JOYPAD, a
ld [wd730], a ld [wStatusFlags5], a
ret z ret z
xor a xor a
ldh [hJoyPressed], a ldh [hJoyPressed], a

View file

@ -199,7 +199,7 @@ _AddPartyMon::
inc de inc de
ld [de], a ld [de], a
push de push de
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld d, a ld d, a
callfar CalcExperience callfar CalcExperience
pop de pop de
@ -224,7 +224,7 @@ _AddPartyMon::
pop hl pop hl
call AddPartyMon_WriteMovePP call AddPartyMon_WriteMovePP
inc de inc de
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld [de], a ld [de], a
inc de inc de
ld a, [wIsInBattle] ld a, [wIsInBattle]
@ -500,7 +500,7 @@ _MoveMon::
call LoadMonData call LoadMonData
farcall CalcLevelFromExperience farcall CalcLevelFromExperience
ld a, d ld a, d
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
pop hl pop hl
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
add hl, bc add hl, bc

View file

@ -93,8 +93,8 @@ PKMNLeaguePCText: db "<PKMN>LEAGUE@"
LogOffPCText: db "LOG OFF@" LogOffPCText: db "LOG OFF@"
BillsPC_:: BillsPC_::
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wParentMenuItem], a ld [wParentMenuItem], a
inc a ; MONSTER_NAME inc a ; MONSTER_NAME
@ -102,8 +102,8 @@ BillsPC_::
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
ld a, [wListScrollOffset] ld a, [wListScrollOffset]
push af push af
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 3, a ; accessing Bill's PC through another PC? bit BIT_USING_GENERIC_PC, a
jr nz, BillsPCMenu jr nz, BillsPCMenu
; accessing it directly ; accessing it directly
ld a, SFX_TURN_ON_PC ld a, SFX_TURN_ON_PC
@ -186,8 +186,8 @@ BillsPCMenu:
jp z, BillsPCChangeBox ; change box jp z, BillsPCChangeBox ; change box
ExitBillsPC: ExitBillsPC:
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 3, a ; accessing Bill's PC through another PC? bit BIT_USING_GENERIC_PC, a
jr nz, .next jr nz, .next
; accessing it directly ; accessing it directly
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
@ -195,13 +195,13 @@ ExitBillsPC:
call PlaySound call PlaySound
call WaitForSoundToFinish call WaitForSoundToFinish
.next .next
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 5, [hl] res BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
pop af pop af
ld [wListScrollOffset], a ld [wListScrollOffset], a
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ret ret
BillsPCDeposit: BillsPCDeposit:

View file

@ -105,7 +105,7 @@ Evolution_PartyMonLoop: ; loop over party mons
cp b ; is the mon's level greater than the evolution requirement? cp b ; is the mon's level greater than the evolution requirement?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.doEvolution .doEvolution
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld a, 1 ld a, 1
ld [wEvolutionOccurred], a ld [wEvolutionOccurred], a
push hl push hl
@ -340,7 +340,7 @@ LearnMoveFromLevelUp:
and a ; have we reached the end of the learn set? and a ; have we reached the end of the learn set?
jr z, .done ; if we've reached the end of the learn set, jump jr z, .done ; if we've reached the end of the learn set, jump
ld b, a ; level the move is learnt at ld b, a ; level the move is learnt at
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
cp b ; is the move learnt at the mon's current level? cp b ; is the move learnt at the mon's current level?
ld a, [hli] ; move ID ld a, [hli] ; move ID
jr nz, .learnSetLoop jr nz, .learnSetLoop
@ -375,7 +375,7 @@ LearnMoveFromLevelUp:
ld [wd11e], a ld [wd11e], a
ret ret
; writes the moves a mon has at level [wCurEnemyLVL] to [de] ; writes the moves a mon has at level [wCurEnemyLevel] to [de]
; move slots are being filled up sequentially and shifted if all slots are full ; move slots are being filled up sequentially and shifted if all slots are full
WriteMonMoves: WriteMonMoves:
call GetPredefRegisters call GetPredefRegisters
@ -407,7 +407,7 @@ WriteMonMoves:
and a and a
jp z, .done ; end of list jp z, .done ; end of list
ld b, a ld b, a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
cp b cp b
jp c, .done ; mon level < move level (assumption: learnset is sorted by level) jp c, .done ; mon level < move level (assumption: learnset is sorted by level)
ld a, [wLearningMovesFromDayCare] ld a, [wLearningMovesFromDayCare]

View file

@ -71,14 +71,14 @@ StatusScreen:
; mon is in a box or daycare ; mon is in a box or daycare
ld a, [wLoadedMonBoxLevel] ld a, [wLoadedMonBoxLevel]
ld [wLoadedMonLevel], a ld [wLoadedMonLevel], a
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ld hl, wLoadedMonHPExp - 1 ld hl, wLoadedMonHPExp - 1
ld de, wLoadedMonStats ld de, wLoadedMonStats
ld b, $1 ld b, $1
call CalcStats ; Recalculate stats call CalcStats ; Recalculate stats
.DontRecalculate .DontRecalculate
ld hl, wd72c ld hl, wStatusFlags2
set 1, [hl] set BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $33 ld a, $33
ldh [rNR50], a ; Reduce the volume ldh [rNR50], a ; Reduce the volume
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -430,8 +430,8 @@ StatusScreen2:
call WaitForTextScrollButtonPress ; wait for button call WaitForTextScrollButtonPress ; wait for button
pop af pop af
ldh [hTileAnimations], a ldh [hTileAnimations], a
ld hl, wd72c ld hl, wStatusFlags2
res 1, [hl] res BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $77 ld a, $77
ldh [rNR50], a ldh [rNR50], a
call GBPalWhiteOut call GBPalWhiteOut

View file

@ -26,16 +26,16 @@ PromptUserToPlaySlots:
call GBPalNormal call GBPalNormal
ld a, $e4 ld a, $e4
ldh [rOBP0], a ldh [rOBP0], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wSlotMachineAllowMatchesCounter], a ld [wSlotMachineAllowMatchesCounter], a
ld hl, wStoppingWhichSlotMachineWheel ld hl, wStoppingWhichSlotMachineWheel
ld bc, $14 ld bc, $14
call FillMemory call FillMemory
call MainSlotMachineLoop call MainSlotMachineLoop
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wSlotMachineAllowMatchesCounter], a ld [wSlotMachineAllowMatchesCounter], a
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3

View file

@ -10,8 +10,8 @@ PlayDefaultMusicFadeOutCurrent::
; Fade out the current music and then play the default music. ; Fade out the current music and then play the default music.
ld c, 10 ld c, 10
ld d, 0 ld d, 0
ld a, [wd72e] ld a, [wStatusFlags4]
bit 5, a ; has a battle just ended? bit BIT_BATTLE_OVER_OR_BLACKOUT, a
jr z, PlayDefaultMusicCommon jr z, PlayDefaultMusicCommon
xor a xor a
ld [wLastMusicSoundID], a ld [wLastMusicSoundID], a

View file

@ -2,8 +2,8 @@ FadeOutAudio::
ld a, [wAudioFadeOutControl] ld a, [wAudioFadeOutControl]
and a ; currently fading out audio? and a ; currently fading out audio?
jr nz, .fadingOut jr nz, .fadingOut
ld a, [wd72c] ld a, [wStatusFlags2]
bit 1, a bit BIT_NO_AUDIO_FADE_OUT, a
ret nz ret nz
ld a, $77 ld a, $77
ldh [rNR50], a ldh [rNR50], a

View file

@ -20,7 +20,7 @@ GivePokemon::
ld a, b ld a, b
ld [wcf91], a ld [wcf91], a
ld a, c ld a, c
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
xor a ; PLAYER_PARTY_DATA xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a ld [wMonDataLocation], a
farjp _GivePokemon farjp _GivePokemon

View file

@ -15,8 +15,8 @@ DisplayListMenuID::
ld a, BANK(DisplayBattleMenu) ld a, BANK(DisplayBattleMenu)
.bankswitch .bankswitch
call BankswitchHome call BankswitchHome
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] ; turn off letter printing delay set BIT_NO_TEXT_DELAY, [hl]
xor a xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped
ld [wListCount], a ld [wListCount], a
@ -164,8 +164,8 @@ DisplayListMenuIDLoop::
ld [wChosenMenuItem], a ld [wChosenMenuItem], a
xor a xor a
ldh [hJoy7], a ; joypad state update flag ldh [hJoy7], a ; joypad state update flag
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] ; turn on letter printing delay res BIT_NO_TEXT_DELAY, [hl]
jp BankswitchBack jp BankswitchBack
.checkOtherKeys ; check B, SELECT, Up, and Down keys .checkOtherKeys ; check B, SELECT, Up, and Down keys
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
@ -325,8 +325,8 @@ ExitListMenu::
ld [wMenuWatchMovingOutOfBounds], a ld [wMenuWatchMovingOutOfBounds], a
xor a xor a
ldh [hJoy7], a ldh [hJoy7], a
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call BankswitchBack call BankswitchBack
xor a xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped

View file

@ -56,8 +56,8 @@ StartSimulatingJoypadStates::
xor a xor a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ld [wSpritePlayerStateData2MovementByte1], a ld [wSpritePlayerStateData2MovementByte1], a
ld hl, wd730 ld hl, wStatusFlags5
set 7, [hl] set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ret ret
IsItemInBag:: IsItemInBag::

View file

@ -172,7 +172,7 @@ CalcStat::
ldh [hMultiplicand+1], a ldh [hMultiplicand+1], a
xor a xor a
ldh [hMultiplicand], a ldh [hMultiplicand], a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ldh [hMultiplier], a ldh [hMultiplier], a
call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level
ldh a, [hMultiplicand] ldh a, [hMultiplicand]
@ -190,7 +190,7 @@ CalcStat::
cp $1 cp $1
ld a, 5 ; + 5 for non-HP stat ld a, 5 ; + 5 for non-HP stat
jr nz, .notHPStat jr nz, .notHPStat
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLevel]
ld b, a ld b, a
ldh a, [hMultiplicand+2] ldh a, [hMultiplicand+2]
add b add b

View file

@ -4,17 +4,17 @@ IsPlayerCharacterBeingControlledByGame::
ld a, [wNPCMovementScriptPointerTableNum] ld a, [wNPCMovementScriptPointerTableNum]
and a and a
ret nz ret nz
ld a, [wd736] ld a, [wMovementFlags]
bit 1, a ; currently stepping down from door bit bit BIT_EXITING_DOOR, a
ret nz ret nz
ld a, [wd730] ld a, [wStatusFlags5]
and $80 and 1 << BIT_SCRIPTED_MOVEMENT_STATE
ret ret
RunNPCMovementScript:: RunNPCMovementScript::
ld hl, wd736 ld hl, wMovementFlags
bit 0, [hl] bit BIT_STANDING_ON_DOOR, [hl]
res 0, [hl] res BIT_STANDING_ON_DOOR, [hl]
jr nz, .playerStepOutFromDoor jr nz, .playerStepOutFromDoor
ld a, [wNPCMovementScriptPointerTableNum] ld a, [wNPCMovementScriptPointerTableNum]
and a and a
@ -54,7 +54,7 @@ DebugPressedOrHeldB:: ; dummy except in _DEBUG
; This is used to skip Trainer battles, the ; This is used to skip Trainer battles, the
; Safari Game step counter, and some NPC scripts. ; Safari Game step counter, and some NPC scripts.
IF DEF(_DEBUG) IF DEF(_DEBUG)
ld a, [wd732] ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a bit BIT_DEBUG_MODE, a
ret z ret z
ldh a, [hJoyHeld] ldh a, [hJoyHeld]

View file

@ -9,28 +9,28 @@ EnterMap::
ld [wJoyIgnore], a ld [wJoyIgnore], a
call LoadMapData call LoadMapData
farcall ClearVariablesOnEnterMap farcall ClearVariablesOnEnterMap
ld hl, wd72c ld hl, wStatusFlags2
bit 0, [hl] ; has the player already made 3 steps since the last battle? bit BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
jr z, .skipGivingThreeStepsOfNoRandomBattles jr z, .skipGivingThreeStepsOfNoRandomBattles
ld a, 3 ; minimum number of steps between battles ld a, 3 ; minimum number of steps between battles
ld [wNumberOfNoRandomBattleStepsLeft], a ld [wNumberOfNoRandomBattleStepsLeft], a
.skipGivingThreeStepsOfNoRandomBattles .skipGivingThreeStepsOfNoRandomBattles
ld hl, wd72e ld hl, wStatusFlags4
bit 5, [hl] ; did a battle happen immediately before this? bit BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
res 5, [hl] ; unset the "battle just happened" flag res BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
call z, ResetUsingStrengthOutOfBattleBit call z, ResetUsingStrengthOutOfBattleBit
call nz, MapEntryAfterBattle call nz, MapEntryAfterBattle
ld hl, wd732 ld hl, wStatusFlags6
ld a, [hl] 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 jr z, .didNotEnterUsingFlyWarpOrDungeonWarp
res 3, [hl] res BIT_FLY_WARP, [hl]
farcall EnterMapAnim farcall EnterMapAnim
call UpdateSprites call UpdateSprites
.didNotEnterUsingFlyWarpOrDungeonWarp .didNotEnterUsingFlyWarpOrDungeonWarp
farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road
ld hl, wd72d ld hl, wStatusFlags3
res 5, [hl] res BIT_NO_NPC_FACE_PLAYER, [hl]
call UpdateSprites call UpdateSprites
ld hl, wCurrentMapScriptFlags ld hl, wCurrentMapScriptFlags
set 5, [hl] set 5, [hl]
@ -43,8 +43,8 @@ OverworldLoop::
OverworldLoopLessDelay:: OverworldLoopLessDelay::
call DelayFrame call DelayFrame
call LoadGBPal call LoadGBPal
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; jumping down a ledge? bit BIT_LEDGE_OR_FISHING, a
call nz, HandleMidJump call nz, HandleMidJump
ld a, [wWalkCounter] ld a, [wWalkCounter]
and a and a
@ -54,18 +54,18 @@ OverworldLoopLessDelay::
ld a, [wSafariZoneGameOver] ld a, [wSafariZoneGameOver]
and a and a
jp nz, WarpFound2 jp nz, WarpFound2
ld hl, wd72d ld hl, wStatusFlags3
bit 3, [hl] bit BIT_WARP_FROM_CUR_SCRIPT, [hl]
res 3, [hl] res BIT_WARP_FROM_CUR_SCRIPT, [hl]
jp nz, WarpFound2 jp nz, WarpFound2
ld a, [wd732] ld a, [wStatusFlags6]
and 1 << 4 | 1 << 3 ; fly warp or dungeon warp and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP)
jp nz, HandleFlyWarpOrDungeonWarp jp nz, HandleFlyWarpOrDungeonWarp
ld a, [wCurOpponent] ld a, [wCurOpponent]
and a and a
jp nz, .newBattle jp nz, .newBattle
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a ; are we simulating button presses? bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr z, .notSimulating jr z, .notSimulating
ldh a, [hJoyHeld] ldh a, [hJoyHeld]
jr .checkIfStartIsPressed jr .checkIfStartIsPressed
@ -82,8 +82,8 @@ OverworldLoopLessDelay::
bit BIT_A_BUTTON, a bit BIT_A_BUTTON, a
jp z, .checkIfDownButtonIsPressed jp z, .checkIfDownButtonIsPressed
; if A is pressed ; if A is pressed
ld a, [wd730] ld a, [wStatusFlags5]
bit 2, a bit BIT_UNKNOWN_5_2, a
jp nz, .noDirectionButtonsPressed jp nz, .noDirectionButtonsPressed
call IsPlayerCharacterBeingControlledByGame call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent jr nz, .checkForOpponent
@ -98,10 +98,10 @@ OverworldLoopLessDelay::
.displayDialogue .displayDialogue
predef GetTileAndCoordsInFrontOfPlayer predef GetTileAndCoordsInFrontOfPlayer
call UpdateSprites call UpdateSprites
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 2, a bit BIT_TURNING, a
jr nz, .checkForOpponent jr nz, .checkForOpponent
bit 0, a bit BIT_SEEN_BY_TRAINER, a
jr nz, .checkForOpponent jr nz, .checkForOpponent
lda_coord 8, 9 lda_coord 8, 9
ld [wTilePlayerStandingOn], a ; checked when using Surf for forbidden tile pairs ld [wTilePlayerStandingOn], a ; checked when using Surf for forbidden tile pairs
@ -130,8 +130,8 @@ OverworldLoopLessDelay::
jp nz, .newBattle jp nz, .newBattle
jp OverworldLoop jp OverworldLoop
.noDirectionButtonsPressed .noDirectionButtonsPressed
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 2, [hl] res BIT_TURNING, [hl]
call UpdateSprites call UpdateSprites
ld a, 1 ld a, 1
ld [wCheckFor180DegreeTurn], a ld [wCheckFor180DegreeTurn], a
@ -178,8 +178,8 @@ OverworldLoopLessDelay::
.handleDirectionButtonPress .handleDirectionButtonPress
ld [wPlayerDirection], a ; new direction ld [wPlayerDirection], a ; new direction
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a ; are we simulating button presses? bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr nz, .noDirectionChange ; ignore direction changes if we are jr nz, .noDirectionChange ; ignore direction changes if we are
ld a, [wCheckFor180DegreeTurn] ld a, [wCheckFor180DegreeTurn]
and a and a
@ -222,8 +222,8 @@ OverworldLoopLessDelay::
ld a, PLAYER_DIR_UP ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
.holdIntermediateDirectionLoop .holdIntermediateDirectionLoop
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
set 2, [hl] set BIT_TURNING, [hl]
ld hl, wCheckFor180DegreeTurn ld hl, wCheckFor180DegreeTurn
dec [hl] dec [hl]
jr nz, .holdIntermediateDirectionLoop jr nz, .holdIntermediateDirectionLoop
@ -245,8 +245,8 @@ OverworldLoopLessDelay::
jr nc, .noCollision jr nc, .noCollision
; collision occurred ; collision occurred
push hl push hl
ld hl, wd736 ld hl, wMovementFlags
bit 2, [hl] ; standing on warp flag bit BIT_STANDING_ON_WARP, [hl]
pop hl pop hl
jp z, OverworldLoop jp z, OverworldLoop
; collision occurred while standing on a warp ; collision occurred while standing on a warp
@ -266,21 +266,21 @@ OverworldLoopLessDelay::
jr .moveAhead2 jr .moveAhead2
.moveAhead .moveAhead
ld a, [wd736] ld a, [wMovementFlags]
bit 7, a bit BIT_SPINNING, a
jr z, .noSpinning jr z, .noSpinning
farcall LoadSpinnerArrowTiles farcall LoadSpinnerArrowTiles
.noSpinning .noSpinning
call UpdateSprites call UpdateSprites
.moveAhead2 .moveAhead2
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 2, [hl] res BIT_TURNING, [hl]
ld a, [wWalkBikeSurfState] ld a, [wWalkBikeSurfState]
dec a ; riding a bike? dec a ; riding a bike?
jr nz, .normalPlayerSpriteAdvancement jr nz, .normalPlayerSpriteAdvancement
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; jumping a ledge? bit BIT_LEDGE_OR_FISHING, a
jr nz, .normalPlayerSpriteAdvancement jr nz, .normalPlayerSpriteAdvancement
call DoBikeSpeedup call DoBikeSpeedup
.normalPlayerSpriteAdvancement .normalPlayerSpriteAdvancement
@ -289,20 +289,20 @@ OverworldLoopLessDelay::
and a and a
jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works) jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished ; walking animation finished
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a bit BIT_SCRIPTED_MOVEMENT_STATE, a
jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps
; step counting ; step counting
ld hl, wStepCounter ld hl, wStepCounter
dec [hl] dec [hl]
ld a, [wd72c] ld a, [wStatusFlags2]
bit 0, a bit BIT_WILD_ENCOUNTER_COOLDOWN, a
jr z, .doneStepCounting jr z, .doneStepCounting
ld hl, wNumberOfNoRandomBattleStepsLeft ld hl, wNumberOfNoRandomBattleStepsLeft
dec [hl] dec [hl]
jr nz, .doneStepCounting jr nz, .doneStepCounting
ld hl, wd72c ld hl, wStatusFlags2
res 0, [hl] ; indicate that the player has stepped thrice since the last battle res BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
.doneStepCounting .doneStepCounting
CheckEvent EVENT_IN_SAFARI_ZONE CheckEvent EVENT_IN_SAFARI_ZONE
jr z, .notSafariZone jr z, .notSafariZone
@ -320,14 +320,14 @@ OverworldLoopLessDelay::
jp nz, HandleBlackOut ; if all pokemon fainted jp nz, HandleBlackOut ; if all pokemon fainted
.newBattle .newBattle
call NewBattle call NewBattle
ld hl, wd736 ld hl, wMovementFlags
res 2, [hl] ; standing on warp flag res BIT_STANDING_ON_WARP, [hl]
jp nc, CheckWarpsNoCollision ; check for warps if there was no battle jp nc, CheckWarpsNoCollision ; check for warps if there was no battle
.battleOccurred .battleOccurred
ld hl, wd72d ld hl, wStatusFlags3
res 6, [hl] res BIT_TALKED_TO_TRAINER, [hl]
ld hl, wFlags_D733 ld hl, wStatusFlags7
res 3, [hl] res BIT_TRAINER_BATTLE, [hl]
ld hl, wCurrentMapScriptFlags ld hl, wCurrentMapScriptFlags
set 5, [hl] set 5, [hl]
set 6, [hl] set 6, [hl]
@ -338,8 +338,8 @@ OverworldLoopLessDelay::
jr nz, .notCinnabarGym jr nz, .notCinnabarGym
SetEvent EVENT_2A7 SetEvent EVENT_2A7
.notCinnabarGym .notCinnabarGym
ld hl, wd72e ld hl, wStatusFlags4
set 5, [hl] set BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, [wCurMap] ld a, [wCurMap]
cp OAKS_LAB cp OAKS_LAB
jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's 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) ; 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 ; sets carry if a battle occurred and unsets carry if not
NewBattle:: NewBattle::
ld a, [wd72d] ld a, [wStatusFlags3]
bit 4, a bit BIT_ON_DUNGEON_WARP, a
jr nz, .noBattle jr nz, .noBattle
call IsPlayerCharacterBeingControlledByGame call IsPlayerCharacterBeingControlledByGame
jr nz, .noBattle ; no battle if the player character is under the game's control jr nz, .noBattle ; no battle if the player character is under the game's control
ld a, [wd72e] ld a, [wStatusFlags4]
bit 4, a bit BIT_NO_BATTLES, a
jr nz, .noBattle jr nz, .noBattle
farjp InitBattle farjp InitBattle
.noBattle .noBattle
@ -410,8 +410,8 @@ CheckWarpsNoCollisionLoop::
; if a match was found ; if a match was found
push hl push hl
push bc push bc
ld hl, wd736 ld hl, wMovementFlags
set 2, [hl] ; standing on warp flag set BIT_STANDING_ON_WARP, [hl]
farcall IsPlayerStandingOnDoorTileOrWarpTile farcall IsPlayerStandingOnDoorTileOrWarpTile
pop bc pop bc
pop hl pop hl
@ -423,8 +423,8 @@ CheckWarpsNoCollisionLoop::
pop hl pop hl
jr nc, CheckWarpsNoCollisionRetry2 jr nc, CheckWarpsNoCollisionRetry2
; if the extra check passed ; if the extra check passed
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit 2, a bit BIT_FORCED_WARP, a
jr nz, WarpFound1 jr nz, WarpFound1
push de push de
push bc push bc
@ -516,16 +516,16 @@ WarpFound2::
dec a ; is the player on a warp pad? dec a ; is the player on a warp pad?
jr nz, .notWarpPad jr nz, .notWarpPad
; if the player is on a warp pad ; if the player is on a warp pad
ld hl, wd732 ld hl, wStatusFlags6
set 3, [hl] set BIT_FLY_WARP, [hl]
call LeaveMapAnim call LeaveMapAnim
jr .skipMapChangeSound jr .skipMapChangeSound
.notWarpPad .notWarpPad
call PlayMapChangeSound call PlayMapChangeSound
.skipMapChangeSound .skipMapChangeSound
ld hl, wd736 ld hl, wMovementFlags
res 0, [hl] res BIT_STANDING_ON_DOOR, [hl]
res 1, [hl] res BIT_EXITING_DOOR, [hl]
jr .done jr .done
.goBackOutside .goBackOutside
ld a, [wLastMap] ld a, [wLastMap]
@ -534,8 +534,8 @@ WarpFound2::
xor a xor a
ld [wMapPalOffset], a ld [wMapPalOffset], a
.done .done
ld hl, wd736 ld hl, wMovementFlags
set 0, [hl] ; have the player's sprite step out from the door (if there is one) set BIT_STANDING_ON_DOOR, [hl] ; have the player's sprite step out from the door (if there is one)
call IgnoreInputForHalfSecond call IgnoreInputForHalfSecond
jp EnterMap jp EnterMap
@ -756,12 +756,11 @@ MapEntryAfterBattle::
HandleBlackOut:: HandleBlackOut::
; For when all the player's pokemon faint. ; For when all the player's pokemon faint.
; Does not print the "blacked out" message. ; Does not print the "blacked out" message.
call GBFadeOutToBlack call GBFadeOutToBlack
ld a, $08 ld a, $08
call StopMusic call StopMusic
ld hl, wd72e ld hl, wStatusFlags4
res 5, [hl] res BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap) ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap)
ldh [hLoadedROMBank], a ldh [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
@ -789,9 +788,9 @@ HandleFlyWarpOrDungeonWarp::
ld [wWalkBikeSurfState], a ld [wWalkBikeSurfState], a
ld [wIsInBattle], a ld [wIsInBattle], a
ld [wMapPalOffset], a ld [wMapPalOffset], a
ld hl, wd732 ld hl, wStatusFlags6
set 2, [hl] ; fly warp or dungeon warp set BIT_FLY_OR_DUNGEON_WARP, [hl]
res 5, [hl] ; forced to ride bike res BIT_ALWAYS_ON_BIKE, [hl]
call LeaveMapAnim call LeaveMapAnim
ld a, BANK(PrepareForSpecialWarp) ld a, BANK(PrepareForSpecialWarp)
ldh [hLoadedROMBank], a 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) ; 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 ; sets the carry flag if there is a collision, and unsets it if there isn't a collision
CollisionCheckOnLand:: CollisionCheckOnLand::
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; is the player jumping? bit BIT_LEDGE_OR_FISHING, a
jr nz, .noCollision jr nz, .noCollision
; if not jumping a ledge ; if not jumping a ledge
ld a, [wSimulatedJoypadStatesIndex] ld a, [wSimulatedJoypadStatesIndex]
@ -1291,8 +1290,8 @@ CheckForJumpingAndTilePairCollisions::
pop de pop de
pop hl pop hl
and a and a
ld a, [wd736] ld a, [wMovementFlags]
bit 6, a ; is the player jumping? bit BIT_LEDGE_OR_FISHING, a
ret nz ret nz
; if not jumping ; if not jumping
@ -1826,8 +1825,8 @@ JoypadOverworld::
ld [wSpritePlayerStateData1XStepVector], a ld [wSpritePlayerStateData1XStepVector], a
call RunMapScript call RunMapScript
call Joypad call Joypad
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit 3, a ; check if a trainer wants a challenge bit BIT_TRAINER_BATTLE, a
jr nz, .notForcedDownwards jr nz, .notForcedDownwards
ld a, [wCurMap] ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road cp ROUTE_17 ; Cycling Road
@ -1838,8 +1837,8 @@ JoypadOverworld::
ld a, D_DOWN 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 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 .notForcedDownwards
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a bit BIT_SCRIPTED_MOVEMENT_STATE, a
ret z ret z
; if simulating button presses ; if simulating button presses
ldh a, [hJoyHeld] ldh a, [hJoyHeld]
@ -1874,12 +1873,12 @@ JoypadOverworld::
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ldh [hJoyHeld], a ldh [hJoyHeld], a
ld hl, wd736 ld hl, wMovementFlags
ld a, [hl] 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], a
ld hl, wd730 ld hl, wStatusFlags5
res 7, [hl] res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ret ret
; function to check the tile ahead to determine if the character should get on land or keep surfing ; 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 ; 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. ; is considered impassable and it is detected as a collision.
CollisionCheckOnWater:: CollisionCheckOnWater::
ld a, [wd730] ld a, [wStatusFlags5]
bit 7, a bit BIT_SCRIPTED_MOVEMENT_STATE, a
jp nz, .noCollision ; return and clear carry if button presses are being simulated 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 a, [wPlayerDirection] ; the direction that the player is trying to go in
ld d, a ld d, a
@ -1955,8 +1954,8 @@ RunMapScript::
push de push de
push bc push bc
farcall TryPushingBoulder farcall TryPushingBoulder
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 1, a ; play boulder dust animation bit BIT_BOULDER_DUST, a
jr z, .afterBoulderEffect jr z, .afterBoulderEffect
farcall DoBoulderDustAnimation farcall DoBoulderDustAnimation
.afterBoulderEffect .afterBoulderEffect
@ -2137,8 +2136,8 @@ LoadMapHeader::
dec c dec c
jr nz, .signLoop jr nz, .signLoop
.loadSpriteData .loadSpriteData
ld a, [wd72e] ld a, [wStatusFlags4]
bit 5, a ; did a battle happen immediately before this? bit BIT_BATTLE_OVER_OR_BLACKOUT, a
jp nz, .finishUp ; if so, skip this because battles don't destroy this data jp nz, .finishUp ; if so, skip this because battles don't destroy this data
ld a, [hli] ld a, [hli]
ld [wNumSprites], a ; save the number of sprites ld [wNumSprites], a ; save the number of sprites
@ -2343,11 +2342,11 @@ LoadMapData::
ld b, SET_PAL_OVERWORLD ld b, SET_PAL_OVERWORLD
call RunPaletteCommand call RunPaletteCommand
call LoadPlayerSpriteGraphics call LoadPlayerSpriteGraphics
ld a, [wd732] ld a, [wStatusFlags6]
and 1 << 4 | 1 << 3 ; fly warp or dungeon warp and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP)
jr nz, .restoreRomBank jr nz, .restoreRomBank
ld a, [wFlags_D733] ld a, [wStatusFlags7]
bit 1, a bit BIT_NO_MAP_MUSIC, a
jr nz, .restoreRomBank jr nz, .restoreRomBank
call UpdateMusic6Times call UpdateMusic6Times
call PlayDefaultMusicFadeOutCurrent call PlayDefaultMusicFadeOutCurrent
@ -2381,15 +2380,15 @@ SwitchToMapRomBank::
IgnoreInputForHalfSecond: IgnoreInputForHalfSecond:
ld a, 30 ld a, 30
ld [wIgnoreInputCounter], a ld [wIgnoreInputCounter], a
ld hl, wd730 ld hl, wStatusFlags5
ld a, [hl] 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 ld [hl], a ; set ignore input bit
ret ret
ResetUsingStrengthOutOfBattleBit: ResetUsingStrengthOutOfBattleBit:
ld hl, wd728 ld hl, wStatusFlags1
res 0, [hl] res BIT_STRENGTH_ACTIVE, [hl]
ret ret
ForceBikeOrSurf:: ForceBikeOrSurf::

View file

@ -32,8 +32,8 @@ MoveSprite_::
ld [wNPCNumScriptedSteps], a ; number of steps taken ld [wNPCNumScriptedSteps], a ; number of steps taken
pop bc pop bc
ld hl, wd730 ld hl, wStatusFlags5
set 0, [hl] set BIT_SCRIPTED_NPC_MOVEMENT, [hl]
pop hl pop hl
xor a xor a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a

View file

@ -198,8 +198,8 @@ PartyMenuInit::
ld a, 1 ; hardcoded bank ld a, 1 ; hardcoded bank
call BankswitchHome call BankswitchHome
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] ; turn off letter printing delay set BIT_NO_TEXT_DELAY, [hl]
xor a ; PLAYER_PARTY_DATA xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a ld [wMonDataLocation], a
ld [wMenuWatchMovingOutOfBounds], a ld [wMenuWatchMovingOutOfBounds], a
@ -245,8 +245,8 @@ HandlePartyMenuInput::
ld [wPartyMenuAnimMonEnabled], a ld [wPartyMenuAnimMonEnabled], a
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wPartyAndBillsPCSavedMenuItem], a ld [wPartyAndBillsPCSavedMenuItem], a
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] ; turn on letter printing delay res BIT_NO_TEXT_DELAY, [hl]
ld a, [wMenuItemToSwap] ld a, [wMenuItemToSwap]
and a and a
jp nz, .swappingPokemon jp nz, .swappingPokemon

View file

@ -1,18 +1,18 @@
; This function is used to wait a short period after printing a letter to the ; 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 ; 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:: PrintLetterDelay::
ld a, [wd730] ld a, [wStatusFlags5]
bit 6, a bit BIT_NO_TEXT_DELAY, a
ret nz ret nz
ld a, [wLetterPrintingDelayFlags] ld a, [wLetterPrintingDelayFlags]
bit 1, a bit BIT_TEXT_DELAY, a
ret z ret z
push hl push hl
push de push de
push bc push bc
ld a, [wLetterPrintingDelayFlags] ld a, [wLetterPrintingDelayFlags]
bit 0, a bit BIT_FAST_TEXT_DELAY, a
jr z, .waitOneFrame jr z, .waitOneFrame
ld a, [wOptions] ld a, [wOptions]
and $f and $f

View file

@ -30,8 +30,8 @@ ReloadTilesetTilePatterns::
; shows the town map and lets the player choose a destination to fly to ; shows the town map and lets the player choose a destination to fly to
ChooseFlyDestination:: ChooseFlyDestination::
ld hl, wd72e ld hl, wStatusFlags4
res 4, [hl] res BIT_NO_BATTLES, [hl]
farjp LoadTownMap_Fly farjp LoadTownMap_Fly
; causes the text box to close without waiting for a button press after displaying text ; causes the text box to close without waiting for a button press after displaying text

View file

@ -315,7 +315,7 @@ ProtectedDelay3::
TextCommandProcessor:: TextCommandProcessor::
ld a, [wLetterPrintingDelayFlags] ld a, [wLetterPrintingDelayFlags]
push af push af
set 1, a set BIT_TEXT_DELAY, a
ld e, a ld e, a
ldh a, [hClearLetterPrintingDelayFlags] ldh a, [hClearLetterPrintingDelayFlags]
xor e xor e

View file

@ -128,8 +128,8 @@ CloseTextDisplay::
call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
ld hl, wFontLoaded ld hl, wFontLoaded
res 0, [hl] res 0, [hl]
ld a, [wd732] ld a, [wStatusFlags6]
bit 3, a ; used fly warp bit BIT_FLY_WARP, a
call z, LoadPlayerSpriteGraphics call z, LoadPlayerSpriteGraphics
call LoadCurrentMapView call LoadCurrentMapView
pop af pop af
@ -196,9 +196,9 @@ PokemonFaintedText::
DisplayPlayerBlackedOutText:: DisplayPlayerBlackedOutText::
ld hl, PlayerBlackedOutText ld hl, PlayerBlackedOutText
call PrintText call PrintText
ld a, [wd732] ld a, [wStatusFlags6]
res 5, a ; reset forced to use bike bit res BIT_ALWAYS_ON_BIKE, a
ld [wd732], a ld [wStatusFlags6], a
jp HoldTextDisplayOpen jp HoldTextDisplayOpen
PlayerBlackedOutText:: PlayerBlackedOutText::

View file

@ -16,9 +16,9 @@ ExecuteCurMapScriptInTable::
pop hl pop hl
pop af pop af
push hl push hl
ld hl, wFlags_D733 ld hl, wStatusFlags7
bit 4, [hl] bit BIT_USE_CUR_MAP_SCRIPT, [hl]
res 4, [hl] res BIT_USE_CUR_MAP_SCRIPT, [hl]
jr z, .useProvidedIndex ; test if map script index was overridden manually jr z, .useProvidedIndex ; test if map script index was overridden manually
ld a, [wCurMapScript] ld a, [wCurMapScript]
.useProvidedIndex .useProvidedIndex
@ -114,10 +114,10 @@ TalkToTrainer::
call ReadTrainerHeaderInfo ; read end battle text call ReadTrainerHeaderInfo ; read end battle text
pop de pop de
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
ld hl, wFlags_D733 ld hl, wStatusFlags7
set 4, [hl] ; activate map script index override (index is set below) set BIT_USE_CUR_MAP_SCRIPT, [hl] ; activate map script index override (index is set below)
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) bit BIT_SEEN_BY_TRAINER, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
ret nz ret nz
; if the player talked to the trainer of his own volition ; if the player talked to the trainer of his own volition
call EngageMapTrainer call EngageMapTrainer
@ -143,8 +143,8 @@ ENDC
ld [wTrainerHeaderFlagBit], a ld [wTrainerHeaderFlagBit], a
ret ret
.trainerEngaging .trainerEngaging
ld hl, wFlags_D733 ld hl, wStatusFlags7
set 3, [hl] set BIT_TRAINER_BATTLE, [hl]
ld [wEmotionBubbleSpriteIndex], a ld [wEmotionBubbleSpriteIndex], a
xor a ; EXCLAMATION_BUBBLE xor a ; EXCLAMATION_BUBBLE
ld [wWhichEmotionBubble], a 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 ; display the before battle text after the enemy trainer has walked up to the player's sprite
DisplayEnemyTrainerTextAndStartBattle:: DisplayEnemyTrainerTextAndStartBattle::
ld a, [wd730] ld a, [wStatusFlags5]
and $1 and 1 << BIT_SCRIPTED_NPC_MOVEMENT
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
@ -173,11 +173,11 @@ StartTrainerBattle::
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, wd72e ld hl, wStatusFlags4
set 1, [hl] set BIT_UNKNOWN_4_1, [hl]
ld hl, wCurMapScript ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) inc [hl] ; increment map script index (next script function is usually EndTrainerBattle)
ret ret
@ -186,10 +186,10 @@ EndTrainerBattle::
ld hl, wCurrentMapScriptFlags ld hl, wCurrentMapScriptFlags
set 5, [hl] set 5, [hl]
set 6, [hl] set 6, [hl]
ld hl, wd72d ld hl, wStatusFlags3
res 7, [hl] res BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
res 0, [hl] ; player is no longer engaged by any trainer res BIT_SEEN_BY_TRAINER, [hl] ; player is no longer engaged by any trainer
ld a, [wIsInBattle] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, ResetButtonPressedAndMapScript jp z, ResetButtonPressedAndMapScript
@ -211,9 +211,9 @@ EndTrainerBattle::
ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it
predef HideObject predef HideObject
.skipRemoveSprite .skipRemoveSprite
ld hl, wd730 ld hl, wStatusFlags5
bit 4, [hl] bit BIT_UNKNOWN_5_4, [hl]
res 4, [hl] res BIT_UNKNOWN_5_4, [hl]
ret nz ret nz
ResetButtonPressedAndMapScript:: ResetButtonPressedAndMapScript::
@ -240,7 +240,7 @@ InitBattleEnemyParameters::
ld [wTrainerNo], a ld [wTrainerNo], a
ret ret
.noTrainer .noTrainer
ld [wCurEnemyLVL], a ld [wCurEnemyLevel], a
ret ret
GetSpritePosition1:: GetSpritePosition1::
@ -340,9 +340,9 @@ EngageMapTrainer::
PrintEndBattleText:: PrintEndBattleText::
push hl push hl
ld hl, wd72d ld hl, wStatusFlags3
bit 7, [hl] bit BIT_PRINT_END_BATTLE_TEXT, [hl]
res 7, [hl] res BIT_PRINT_END_BATTLE_TEXT, [hl]
pop hl pop hl
ret z ret z
ldh a, [hLoadedROMBank] ldh a, [hLoadedROMBank]
@ -389,8 +389,8 @@ TrainerEndBattleText::
; engaged with another trainer ; engaged with another trainer
; XXX unused? ; XXX unused?
CheckIfAlreadyEngaged:: CheckIfAlreadyEngaged::
ld a, [wFlags_0xcd60] ld a, [wMiscFlags]
bit 0, a bit BIT_SEEN_BY_TRAINER, a
ret nz ret nz
call EngageMapTrainer call EngageMapTrainer
xor a xor a

View file

@ -95,8 +95,8 @@ HandleMenuInput_::
jr z, .skipPlayingSound jr z, .skipPlayingSound
.AButtonOrBButtonPressed .AButtonOrBButtonPressed
push hl push hl
ld hl, wFlags_0xcd60 ld hl, wMiscFlags
bit 5, [hl] bit BIT_NO_MENU_BUTTON_SOUND, [hl]
pop hl pop hl
jr nz, .skipPlayingSound jr nz, .skipPlayingSound
ld a, SFX_PRESS_AB ld a, SFX_PRESS_AB

View file

@ -16,6 +16,7 @@ INCLUDE "macros/scripts/text.asm"
INCLUDE "constants/charmap.asm" INCLUDE "constants/charmap.asm"
INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/oam_constants.asm" INCLUDE "constants/oam_constants.asm"
INCLUDE "constants/ram_constants.asm"
INCLUDE "constants/misc_constants.asm" INCLUDE "constants/misc_constants.asm"
INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/input_constants.asm" INCLUDE "constants/input_constants.asm"

View file

@ -399,8 +399,8 @@ NEXTU
wSimulatedJoypadStatesEnd:: wSimulatedJoypadStatesEnd::
NEXTU NEXTU
wBoostExpByExpAll:: wUnusedFlag::
wUnusedCC5B:: db wBoostExpByExpAll:: db
ds 59 ds 59
@ -850,12 +850,7 @@ wLeftGBMonSpecies:: db
; in the trade animation, the mon that leaves the right gameboy ; in the trade animation, the mon that leaves the right gameboy
wRightGBMonSpecies:: db wRightGBMonSpecies:: db
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously) wMiscFlags:: db
; bit 1: boulder dust animation (from using Strength) pending
; bit 3: using generic PC
; bit 5: don't play sound when A or B is pressed in menu
; bit 6: tried pushing against boulder once (you need to push twice before it will move)
wFlags_0xcd60:: db
ds 9 ds 9
@ -1243,38 +1238,15 @@ wMoveMissed:: db
; always 0 ; always 0
wPlayerStatsToDouble:: db wPlayerStatsToDouble:: db
; always 0 ; always 0
wPlayerStatsToHalve:: db wPlayerStatsToHalve:: db
; bit 0 - bide
; bit 1 - thrash / petal dance
; bit 2 - attacking multiple times (e.g. double kick)
; bit 3 - flinch
; bit 4 - charging up for attack
; bit 5 - using multi-turn move (e.g. wrap)
; bit 6 - invulnerable to normal attack (using fly/dig)
; bit 7 - confusion
wPlayerBattleStatus1:: db wPlayerBattleStatus1:: db
; bit 0 - X Accuracy effect
; bit 1 - protected by "mist"
; bit 2 - focus energy effect
; bit 4 - has a substitute
; bit 5 - need to recharge
; bit 6 - rage
; bit 7 - leech seeded
wPlayerBattleStatus2:: db wPlayerBattleStatus2:: db
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
; bit 3 - transformed
wPlayerBattleStatus3:: db wPlayerBattleStatus3:: db
; always 0 ; always 0
wEnemyStatsToDouble:: db wEnemyStatsToDouble:: db
; always 0 ; always 0
wEnemyStatsToHalve:: db wEnemyStatsToHalve:: db
@ -1602,7 +1574,7 @@ wTextBoxID:: db
wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value
wCurEnemyLVL:: db wCurEnemyLevel:: db
; pointer to list of items terminated by $FF ; pointer to list of items terminated by $FF
wItemListPointer:: dw wItemListPointer:: dw
@ -1648,7 +1620,7 @@ wSavedSpriteMapX:: db
wWhichPrize:: db wWhichPrize:: db
; counts downward each frame ; counts downward each frame
; when it hits 0, bit 5 (ignore input bit) of wd730 is reset ; when it hits 0, BIT_DISABLE_JOYPAD of wStatusFlags5 is reset
wIgnoreInputCounter:: db wIgnoreInputCounter:: db
; counts down once every step ; counts down once every step
@ -1743,26 +1715,12 @@ wPlayerMoney:: ds 3 ; BCD
wRivalName:: ds NAME_LENGTH wRivalName:: ds NAME_LENGTH
; bit 7 = battle animation
; 0: On
; 1: Off
; bit 6 = battle style
; 0: Shift
; 1: Set
; bits 0-3 = text speed (number of frames to delay after printing a letter)
; 1: Fast
; 3: Medium
; 5: Slow
wOptions:: db wOptions:: db
wObtainedBadges:: flag_array NUM_BADGES wObtainedBadges:: flag_array NUM_BADGES
ds 1 ds 1
; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if
; the delay has been disabled entirely through bit 1 of this variable
; or bit 6 of wd730.
; bit 1: If 0, no delay.
wLetterPrintingDelayFlags:: db wLetterPrintingDelayFlags:: db
wPlayerID:: dw wPlayerID:: dw
@ -2097,88 +2055,22 @@ wUnusedCardKeyGateID:: db
ds 8 ds 8
; bit 0: using Strength outside of battle wStatusFlags1:: db
; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result
; bit 3: received Old Rod
; bit 4: received Good Rod
; bit 5: received Super Rod
; bit 6: gave one of the Saffron guards a drink
; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key
wd728:: db
ds 1 ds 1
wBeatGymFlags:: db ; redundant because it matches wObtainedBadges
; redundant because it matches wObtainedBadges
; used to determine whether to show name on statue and in two NPC text scripts
wBeatGymFlags:: db
ds 1 ds 1
wStatusFlags2:: db
; bit 0: if not set, the 3 minimum steps between random battles have passed wCableClubDestinationMap::
; bit 1: prevent audio fade out wStatusFlags3:: db
wd72c:: db wStatusFlags4:: db
; This variable is used for temporary flags and as the destination map when
; warping to the Trade Center or Colosseum.
; bit 0: sprite facing directions have been initialised in the Trade Center
; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower)
; bit 4: on a dungeon warp
; bit 5: don't make NPCs face the player when spoken to
; Bits 6 and 7 are set by scripts when starting major battles in the storyline,
; but they do not appear to affect anything. Bit 6 is reset after all battles
; and bit 7 is reset after trainer battles (but it's only set before trainer
; battles anyway).
wd72d:: db
; bit 0: the player has received Lapras in the Silph Co. building
; bit 1: set in various places, but doesn't appear to have an effect
; bit 2: the player has healed pokemon at a pokemon center at least once
; bit 3: the player has a received a pokemon from Prof. Oak
; bit 4: disable battles
; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison
; bit 6: using the link feature
; bit 7: set if scripted NPC movement has been initialised
wd72e:: db
ds 1 ds 1
wStatusFlags5:: db
; bit 0: NPC sprite being moved by script
; bit 5: ignore joypad input
; bit 6: print text with no delay between each letter
; bit 7: set if joypad states are being simulated in the overworld or an NPC's movement is being scripted
wd730:: db
ds 1 ds 1
wStatusFlags6:: db
; bit 0: play time being counted wStatusFlags7:: db
; bit 1: debug mode (unused and incomplete in non-debug builds) wElite4Flags:: db
; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set)
; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp"
; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp"
; bit 5: currently being forced to ride bike (cycling road)
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
wd732:: db
; bit 0: running a test battle (unused in non-debug builds)
; bit 1: prevent music from changing when entering new map
; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands)
; bit 3: trainer wants to battle
; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
; bit 7: used fly out of battle
wFlags_D733:: db
; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby
; the game uses this to tell when Elite 4 events need to be reset
wBeatLorelei:: db
ds 1 ds 1
wMovementFlags:: db
; bit 0: check if the player is standing on a door and make him walk down a step if so
; bit 1: the player is currently stepping down from a door
; bit 2: standing on a warp
; bit 6: jumping down a ledge / fishing animation
; bit 7: player sprite spinning due to spin tiles (Rocket hideout / Viridian Gym)
wd736:: db
wCompletedInGameTradeFlags:: dw wCompletedInGameTradeFlags:: dw

View file

@ -48,8 +48,8 @@ BikeShopClerkText:
ld [wTopMenuItemY], a ld [wTopMenuItemY], a
ld a, $1 ld a, $1
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0 hlcoord 0, 0
ld b, 4 ld b, 4
ld c, 15 ld c, 15
@ -66,8 +66,8 @@ BikeShopClerkText:
call HandleMenuInput call HandleMenuInput
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
jr nz, .cancel jr nz, .cancel
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jr nz, .cancel jr nz, .cancel

View file

@ -46,8 +46,8 @@ BillsHousePokemonWalkToMachineScript:
db -1 ; end db -1 ; end
BillsHousePokemonEntersMachineScript: BillsHousePokemonEntersMachineScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
ld a, HS_BILL_POKEMON ld a, HS_BILL_POKEMON
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
@ -97,8 +97,8 @@ BillExitMachineMovement:
db -1 ; end db -1 ; end
BillsHouseCleanupScript: BillsHouseCleanupScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a

View file

@ -119,9 +119,9 @@ CeladonGymErikaText:
.beforeBeat .beforeBeat
ld hl, .PreBattleText ld hl, .PreBattleText
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .ReceivedRainbowBadgeText ld hl, .ReceivedRainbowBadgeText
ld de, .ReceivedRainbowBadgeText ld de, .ReceivedRainbowBadgeText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers

View file

@ -41,8 +41,8 @@ CeladonMartRoofDrinkList:
db 0 ; end db 0 ; end
CeladonMartRoofScript_GiveDrinkToGirl: CeladonMartRoofScript_GiveDrinkToGirl:
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText
call PrintText call PrintText
xor a xor a
@ -68,8 +68,8 @@ CeladonMartRoofScript_GiveDrinkToGirl:
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
call CeladonMartRoofScript_PrintDrinksInBag call CeladonMartRoofScript_PrintDrinksInBag
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
call HandleMenuInput call HandleMenuInput
bit BIT_B_BUTTON, a bit BIT_B_BUTTON, a
ret nz ret nz

View file

@ -125,17 +125,17 @@ CeruleanCityFaceRivalScript:
jp SetSpriteFacingDirectionAndDelay ; face object jp SetSpriteFacingDirectionAndDelay ; face object
CeruleanCityRivalBattleScript: CeruleanCityRivalBattleScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, TEXT_CERULEANCITY_RIVAL ld a, TEXT_CERULEANCITY_RIVAL
ldh [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, CeruleanCityRivalDefeatedText ld hl, CeruleanCityRivalDefeatedText
ld de, CeruleanCityRivalVictoryText ld de, CeruleanCityRivalVictoryText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
@ -219,8 +219,8 @@ CeruleanCityMovement4:
db -1 ; end db -1 ; end
CeruleanCityRivalCleanupScript: CeruleanCityRivalCleanupScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
ld a, HS_CERULEAN_RIVAL ld a, HS_CERULEAN_RIVAL
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
@ -289,9 +289,9 @@ CeruleanCityRocketText:
jr nz, .beatRocketThief jr nz, .beatRocketThief
ld hl, .Text ld hl, .Text
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .IGiveUpText ld hl, .IGiveUpText
ld de, .IGiveUpText ld de, .IGiveUpText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers

View file

@ -105,9 +105,9 @@ CeruleanGymMistyText:
.beforeBeat .beforeBeat
ld hl, .PreBattleText ld hl, .PreBattleText
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, CeruleanGymMistyReceivedCascadeBadgeText ld hl, CeruleanGymMistyReceivedCascadeBadgeText
ld de, CeruleanGymMistyReceivedCascadeBadgeText ld de, CeruleanGymMistyReceivedCascadeBadgeText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers

View file

@ -54,14 +54,14 @@ ChampionsRoomRivalReadyToBattleScript:
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld hl, wOptions ld hl, wOptions
res 7, [hl] ; Turn on battle animations to make the battle feel more epic. res BIT_BATTLE_ANIMATION, [hl]
ld a, TEXT_CHAMPIONSROOM_RIVAL ld a, TEXT_CHAMPIONSROOM_RIVAL
ldh [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
call Delay3 call Delay3
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, RivalDefeatedText ld hl, RivalDefeatedText
ld de, RivalVictoryText ld de, RivalVictoryText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
@ -136,8 +136,8 @@ OakEntranceAfterVictoryMovement:
db -1 ; end db -1 ; end
ChampionsRoomOakCongratulatesPlayerScript: ChampionsRoomOakCongratulatesPlayerScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
ld a, PLAYER_DIR_LEFT ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
@ -194,8 +194,8 @@ OakExitChampionsRoomMovement:
db -1 ; end db -1 ; end
ChampionsRoomOakExitsScript: ChampionsRoomOakExitsScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
ld a, HS_CHAMPIONS_ROOM_OAK ld a, HS_CHAMPIONS_ROOM_OAK
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a

View file

@ -81,8 +81,8 @@ MovementNpcToLeft:
db -1 ; end db -1 ; end
CinnabarGymGetOpponentTextScript: CinnabarGymGetOpponentTextScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
@ -194,9 +194,9 @@ CinnabarGymStartBattleScript:
ld [wSpriteIndex], a ld [wSpriteIndex], a
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
cp CINNABARGYM_BLAINE cp CINNABARGYM_BLAINE
jr z, .blaine jr z, .blaine

View file

@ -111,9 +111,9 @@ FightingDojoKarateMasterText:
jp nz, .defeated_master jp nz, .defeated_master
ld hl, .Text ld hl, .Text
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .DefeatedText ld hl, .DefeatedText
ld de, .DefeatedText ld de, .DefeatedText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers

View file

@ -7,8 +7,8 @@ FuchsiaGoodRodHouse_TextPointers:
FuchsiaGoodRodHouseFishingGuruText: FuchsiaGoodRodHouseFishingGuruText:
text_asm text_asm
ld a, [wd728] ld a, [wStatusFlags1]
bit 4, a ; got good rod? bit BIT_GOT_GOOD_ROD, a
jr nz, .got_item jr nz, .got_item
ld hl, .Text ld hl, .Text
call PrintText call PrintText
@ -19,8 +19,8 @@ FuchsiaGoodRodHouseFishingGuruText:
lb bc, GOOD_ROD, 1 lb bc, GOOD_ROD, 1
call GiveItem call GiveItem
jr nc, .bag_full jr nc, .bag_full
ld hl, wd728 ld hl, wStatusFlags1
set 4, [hl] ; got good rod set BIT_GOT_GOOD_ROD, [hl]
ld hl, .ReceivedGoodRodText ld hl, .ReceivedGoodRodText
jr .done jr .done
.bag_full .bag_full

View file

@ -119,9 +119,9 @@ FuchsiaGymKogaText:
.beforeBeat .beforeBeat
ld hl, .BeforeBattleText ld hl, .BeforeBattleText
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .ReceivedSoulBadgeText ld hl, .ReceivedSoulBadgeText
ld de, .ReceivedSoulBadgeText ld de, .ReceivedSoulBadgeText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers

View file

@ -102,8 +102,8 @@ GameCornerMovement_Rocket_WalkDirect:
db -1 ; end db -1 ; end
GameCornerRocketExitScript: GameCornerRocketExitScript:
ld a, [wd730] ld a, [wStatusFlags5]
bit 0, a bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz ret nz
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
@ -422,9 +422,9 @@ GameCornerRocketText:
text_asm text_asm
ld hl, .ImGuardingThisPosterText ld hl, .ImGuardingThisPosterText
call PrintText call PrintText
ld hl, wd72d ld hl, wStatusFlags3
set 6, [hl] set BIT_TALKED_TO_TRAINER, [hl]
set 7, [hl] set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, .BattleEndText ld hl, .BattleEndText
ld de, .BattleEndText ld de, .BattleEndText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
@ -482,8 +482,8 @@ GameCornerOopsForgotCoinCaseText:
text_end text_end
GameCornerDrawCoinBox: GameCornerDrawCoinBox:
ld hl, wd730 ld hl, wStatusFlags5
set 6, [hl] set BIT_NO_TEXT_DELAY, [hl]
hlcoord 11, 0 hlcoord 11, 0
ld b, 5 ld b, 5
ld c, 7 ld c, 7
@ -513,8 +513,8 @@ GameCornerDrawCoinBox:
ld de, wPlayerCoins ld de, wPlayerCoins
ld c, $82 ld c, $82
call PrintBCDNumber call PrintBCDNumber
ld hl, wd730 ld hl, wStatusFlags5
res 6, [hl] res BIT_NO_TEXT_DELAY, [hl]
ret ret
GameCornerMoneyText: GameCornerMoneyText:

View file

@ -29,10 +29,11 @@ HallOfFameResetEventsAndSaveScript:
predef HallOfFamePC predef HallOfFamePC
pop af pop af
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld hl, wFlags_D733 ld hl, wStatusFlags7
res 1, [hl] res BIT_NO_MAP_MUSIC, [hl]
assert wStatusFlags7 + 1 == wElite4Flags
inc hl inc hl
set BIT_TEST_BATTLE, [hl] ; debug, unused? set BIT_UNUSED_BEAT_ELITE_4, [hl] ; debug, unused?
xor a ; SCRIPT_*_DEFAULT xor a ; SCRIPT_*_DEFAULT
ld hl, wLoreleisRoomCurScript ld hl, wLoreleisRoomCurScript
ld [hli], a ; wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript

View file

@ -6,11 +6,11 @@ IndigoPlateauLobby_Script:
res 6, [hl] res 6, [hl]
ret z ret z
ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH
ld hl, wBeatLorelei ; Reset Elite Four events if the player started challenging them before
bit 1, [hl] ld hl, wElite4Flags
res 1, [hl] bit BIT_STARTED_ELITE_4, [hl]
res BIT_STARTED_ELITE_4, [hl]
ret z ret z
; Elite 4 events
ResetEventRange INDIGO_PLATEAU_EVENTS_START, EVENT_LANCES_ROOM_LOCK_DOOR ResetEventRange INDIGO_PLATEAU_EVENTS_START, EVENT_LANCES_ROOM_LOCK_DOOR
ret ret

View file

@ -14,8 +14,8 @@ LoreleiShowOrHideExitBlock:
bit 5, [hl] bit 5, [hl]
res 5, [hl] res 5, [hl]
ret z ret z
ld hl, wBeatLorelei ld hl, wElite4Flags
set 1, [hl] set BIT_STARTED_ELITE_4, [hl]
CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0 CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0
jr z, .blockExitToNextRoom jr z, .blockExitToNextRoom
ld a, $5 ld a, $5

Some files were not shown because too many files have changed in this diff Show more