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_LENGTH EQU _RS
; D733 flags
DEF BIT_TEST_BATTLE EQU 0
; battle type constants (wBattleType values)
const_def
const BATTLE_TYPE_NORMAL ; 0
@ -78,7 +75,7 @@ DEF SPDSPCDV_TRAINER EQU $88
; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
const_def
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 FLINCHED ; 3
const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly
@ -95,11 +92,11 @@ DEF SPDSPCDV_TRAINER EQU $88
const HAS_SUBSTITUTE_UP ; 4
const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam
const USING_RAGE ; 6
const SEEDED ; 7
const SEEDED ; 7 ; Leech Seed
; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
const_def
const BADLY_POISONED ; 0
const BADLY_POISONED ; 0 ; Toxic
const HAS_LIGHT_SCREEN_UP ; 1
const HAS_REFLECT_UP ; 2
const TRANSFORMED ; 3

View file

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

View file

@ -7,15 +7,3 @@ DEF TRUE EQU 1
const FLAG_RESET ; 0
const FLAG_SET ; 1
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_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
DEF OAKS_AIDE_BAG_FULL EQU $00
DEF OAKS_AIDE_GOT_ITEM EQU $01

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
ApplyOutOfBattlePoisonDamage:
ld a, [wd730]
add a
ld a, [wStatusFlags5]
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
ld a, [wPartyCount]
and a
@ -101,8 +102,8 @@ ApplyOutOfBattlePoisonDamage:
ld a, TEXT_BLACKED_OUT
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72e
set 5, [hl]
ld hl, wStatusFlags4
set BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, $ff
jr .done
.noBlackOut

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
PrintStrengthTxt:
ld hl, wd728
set 0, [hl]
PrintStrengthText:
ld hl, wStatusFlags1
set BIT_STRENGTH_ACTIVE, [hl]
ld hl, UsedStrengthText
call PrintText
ld hl, CanMoveBouldersText
@ -19,13 +19,13 @@ CanMoveBouldersText:
text_end
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
; Seafoam Islands before the current has been slowed with boulders.
ld hl, wd728
set 1, [hl]
ld a, [wd732]
bit 5, a
ld hl, wStatusFlags1
set BIT_SURF_ALLOWED, [hl]
ld a, [wStatusFlags6]
bit BIT_ALWAYS_ON_BIKE, a
jr nz, .forcedToRideBike
ld a, [wCurMap]
cp SEAFOAM_ISLANDS_B4F
@ -35,13 +35,13 @@ IsSurfingAllowed:
ld hl, SeafoamIslandsB4FStairsCoords
call ArePlayerCoordsInArray
ret nc
ld hl, wd728
res 1, [hl]
ld hl, wStatusFlags1
res BIT_SURF_ALLOWED, [hl]
ld hl, CurrentTooFastText
jp PrintText
.forcedToRideBike
ld hl, wd728
res 1, [hl]
ld hl, wStatusFlags1
res BIT_SURF_ALLOWED, [hl]
ld hl, CyclingIsFunText
jp PrintText

View file

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

View file

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

View file

@ -60,8 +60,8 @@ UpdatePlayerSprite:
bit 0, a
jr nz, .notMoving
.moving
ld a, [wd736]
bit 7, a ; is the player sprite spinning due to a spin tile?
ld a, [wMovementFlags]
bit BIT_SPINNING, a
jr nz, .skipSpriteAnim
ldh a, [hCurrentSpriteOffset]
add $7
@ -175,8 +175,8 @@ UpdateNPCSprite:
jr nz, .next
; reached end of wNPCMovementDirections list
ld [hl], a ; store $ff in movement byte 1, disabling scripted movement
ld hl, wd730
res 0, [hl]
ld hl, wStatusFlags5
res BIT_SCRIPTED_NPC_MOVEMENT, [hl]
xor a
ld [wSimulatedJoypadStatesIndex], a
ld [wUnusedOverrideSimulatedJoypadStatesIndex], a
@ -409,8 +409,8 @@ MakeNPCFacePlayer:
; 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.
ld a, [wd72d]
bit 5, a
ld a, [wStatusFlags3]
bit BIT_NO_NPC_FACE_PLAYER, a
jr nz, notYetMoving
res 7, [hl]
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
; 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.
ld a, [wd730]
bit 7, a
ld a, [wStatusFlags5]
bit BIT_SCRIPTED_MOVEMENT_STATE, a
ret z
ld hl, wd72e
bit 7, [hl]
set 7, [hl]
ld hl, wStatusFlags4
bit BIT_INIT_SCRIPTED_MOVEMENT, [hl]
set BIT_INIT_SCRIPTED_MOVEMENT, [hl]
jp z, InitScriptedNPCMovement
ld hl, wNPCMovementDirections2
ld a, [wNPCMovementDirections2Index]

View file

@ -5,15 +5,15 @@ EnterMapAnim::
call Delay3
push hl
call GBFadeInFromWhite
ld hl, wFlags_D733
bit 7, [hl] ; used fly out of battle?
res 7, [hl]
ld hl, wStatusFlags7
bit BIT_USED_FLY, [hl]
res BIT_USED_FLY, [hl]
jr nz, .flyAnimation
ld a, SFX_TELEPORT_ENTER_1
call PlaySound
ld hl, wd732
bit 4, [hl] ; used dungeon warp?
res 4, [hl]
ld hl, wStatusFlags6
bit BIT_DUNGEON_WARP, [hl]
res BIT_DUNGEON_WARP, [hl]
pop hl
jr nz, .dungeonWarpAnimation
call PlayerSpinWhileMovingDown
@ -122,8 +122,8 @@ _LeaveMapAnim::
.playerNotStandingOnWarpPadOrHole
ld a, $4
call StopMusic
ld a, [wd732]
bit 6, a ; is the last used pokemon center the destination?
ld a, [wStatusFlags6]
bit BIT_ESCAPE_WARP, a
jr z, .flyAnimation
; if going to the last used pokemon center
ld hl, wPlayerSpinInPlaceAnimFrameDelay
@ -378,8 +378,8 @@ INCLUDE "data/tilesets/warp_pad_hole_tile_ids.asm"
FishingAnim:
ld c, 10
call DelayFrames
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
ld hl, wMovementFlags
set BIT_LEDGE_OR_FISHING, [hl]
ld de, RedSprite
ld hl, vNPCSprites tile $00
lb bc, BANK(RedSprite), 12
@ -445,8 +445,8 @@ FishingAnim:
.done
call PrintText
ld hl, wd736
res 6, [hl] ; unreserve the last 4 OAM entries
ld hl, wMovementFlags
res BIT_LEDGE_OR_FISHING, [hl]
call LoadFontTilePatterns
ret
@ -512,10 +512,10 @@ _HandleMidJump::
ldh [hJoyPressed], a
ldh [hJoyReleased], a
ld [wPlayerJumpingYScreenCoordsIndex], a
ld hl, wd736
res 6, [hl] ; not jumping down a ledge any more
ld hl, wd730
res 7, [hl] ; not simulating joypad states any more
ld hl, wMovementFlags
res BIT_LEDGE_OR_FISHING, [hl]
ld hl, wStatusFlags5
res BIT_SCRIPTED_MOVEMENT_STATE, [hl]
xor a
ld [wJoyIgnore], a
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::
ld a, [wNumberOfWarps]
and a
@ -18,8 +18,8 @@ IsPlayerStandingOnWarp::
ld [wDestinationWarpID], a
ld a, [hl] ; target map
ldh [hWarpDestinationMap], a
ld hl, wd736
set 2, [hl] ; standing on warp flag
ld hl, wMovementFlags
set BIT_STANDING_ON_WARP, [hl]
ret
.nextWarp1
inc hl
@ -32,8 +32,8 @@ IsPlayerStandingOnWarp::
ret
CheckForceBikeOrSurf::
ld hl, wd732
bit 5, [hl]
ld hl, wStatusFlags6
bit BIT_ALWAYS_ON_BIKE, [hl]
ret nz
ld hl, ForcedBikeOrSurfMaps
ld a, [wYCoord]
@ -45,14 +45,14 @@ CheckForceBikeOrSurf::
.loop
ld a, [hli]
cp $ff
ret z ;if we reach FF then it's not part of the list
cp d ;compare to current map
ret z ; if we reach FF then it's not part of the list
cp d ; compare to current map
jr nz, .incorrectMap
ld a, [hli]
cp b ;compare y-coord
cp b ; compare y-coord
jr nz, .incorrectY
ld a, [hli]
cp c ;compare x-coord
cp c ; compare x-coord
jr nz, .loop ; incorrect x-coord, check next item
ld a, [wCurMap]
cp SEAFOAM_ISLANDS_B3F
@ -64,9 +64,8 @@ CheckForceBikeOrSurf::
ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT
ld [wSeafoamIslandsB4FCurScript], a
jr z, .forceSurfing
;force bike riding
ld hl, wd732
set 5, [hl]
ld hl, wStatusFlags6
set BIT_ALWAYS_ON_BIKE, [hl]
ld a, $1
ld [wWalkBikeSurfState], a
ld [wWalkBikeSurfStateCopy], a
@ -207,8 +206,8 @@ IsPlayerStandingOnDoorTileOrWarpTile::
lda_coord 8, 9
call IsInArray
jr nc, .done
ld hl, wd736
res 2, [hl]
ld hl, wMovementFlags
res BIT_STANDING_ON_WARP, [hl]
.done
pop bc
pop de

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -93,8 +93,8 @@ PKMNLeaguePCText: db "<PKMN>LEAGUE@"
LogOffPCText: db "LOG OFF@"
BillsPC_::
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
xor a
ld [wParentMenuItem], a
inc a ; MONSTER_NAME
@ -102,8 +102,8 @@ BillsPC_::
call LoadHpBarAndStatusTilePatterns
ld a, [wListScrollOffset]
push af
ld a, [wFlags_0xcd60]
bit 3, a ; accessing Bill's PC through another PC?
ld a, [wMiscFlags]
bit BIT_USING_GENERIC_PC, a
jr nz, BillsPCMenu
; accessing it directly
ld a, SFX_TURN_ON_PC
@ -186,8 +186,8 @@ BillsPCMenu:
jp z, BillsPCChangeBox ; change box
ExitBillsPC:
ld a, [wFlags_0xcd60]
bit 3, a ; accessing Bill's PC through another PC?
ld a, [wMiscFlags]
bit BIT_USING_GENERIC_PC, a
jr nz, .next
; accessing it directly
call LoadTextBoxTilePatterns
@ -195,13 +195,13 @@ ExitBillsPC:
call PlaySound
call WaitForSoundToFinish
.next
ld hl, wFlags_0xcd60
res 5, [hl]
ld hl, wMiscFlags
res BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2
pop af
ld [wListScrollOffset], a
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ret
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?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.doEvolution
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, 1
ld [wEvolutionOccurred], a
push hl
@ -340,7 +340,7 @@ LearnMoveFromLevelUp:
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
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?
ld a, [hli] ; move ID
jr nz, .learnSetLoop
@ -375,7 +375,7 @@ LearnMoveFromLevelUp:
ld [wd11e], a
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
WriteMonMoves:
call GetPredefRegisters
@ -407,7 +407,7 @@ WriteMonMoves:
and a
jp z, .done ; end of list
ld b, a
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
cp b
jp c, .done ; mon level < move level (assumption: learnset is sorted by level)
ld a, [wLearningMovesFromDayCare]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,18 +1,18 @@
; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
; through the [wd730] or [wLetterPrintingDelayFlags] flags.
; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags.
PrintLetterDelay::
ld a, [wd730]
bit 6, a
ld a, [wStatusFlags5]
bit BIT_NO_TEXT_DELAY, a
ret nz
ld a, [wLetterPrintingDelayFlags]
bit 1, a
bit BIT_TEXT_DELAY, a
ret z
push hl
push de
push bc
ld a, [wLetterPrintingDelayFlags]
bit 0, a
bit BIT_FAST_TEXT_DELAY, a
jr z, .waitOneFrame
ld a, [wOptions]
and $f

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -399,8 +399,8 @@ NEXTU
wSimulatedJoypadStatesEnd::
NEXTU
wBoostExpByExpAll::
wUnusedCC5B:: db
wUnusedFlag::
wBoostExpByExpAll:: db
ds 59
@ -850,12 +850,7 @@ wLeftGBMonSpecies:: db
; in the trade animation, the mon that leaves the right gameboy
wRightGBMonSpecies:: db
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously)
; 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
wMiscFlags:: db
ds 9
@ -1243,38 +1238,15 @@ wMoveMissed:: db
; always 0
wPlayerStatsToDouble:: db
; always 0
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
; 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
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
; bit 3 - transformed
wPlayerBattleStatus3:: db
; always 0
wEnemyStatsToDouble:: db
; always 0
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
wCurEnemyLVL:: db
wCurEnemyLevel:: db
; pointer to list of items terminated by $FF
wItemListPointer:: dw
@ -1648,7 +1620,7 @@ wSavedSpriteMapX:: db
wWhichPrize:: db
; 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
; counts down once every step
@ -1743,26 +1715,12 @@ wPlayerMoney:: ds 3 ; BCD
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
wObtainedBadges:: flag_array NUM_BADGES
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
wPlayerID:: dw
@ -2097,88 +2055,22 @@ wUnusedCardKeyGateID:: db
ds 8
; bit 0: using Strength outside of battle
; 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
wStatusFlags1:: db
ds 1
; redundant because it matches wObtainedBadges
; used to determine whether to show name on statue and in two NPC text scripts
wBeatGymFlags:: db
wBeatGymFlags:: db ; redundant because it matches wObtainedBadges
ds 1
; bit 0: if not set, the 3 minimum steps between random battles have passed
; bit 1: prevent audio fade out
wd72c:: 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
wStatusFlags2:: db
wCableClubDestinationMap::
wStatusFlags3:: db
wStatusFlags4:: db
ds 1
; 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
wStatusFlags5:: db
ds 1
; bit 0: play time being counted
; bit 1: debug mode (unused and incomplete in non-debug builds)
; 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
wStatusFlags6:: db
wStatusFlags7:: db
wElite4Flags:: db
ds 1
; 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
wMovementFlags:: db
wCompletedInGameTradeFlags:: dw

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -54,14 +54,14 @@ ChampionsRoomRivalReadyToBattleScript:
xor a
ld [wJoyIgnore], a
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
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld hl, wd72d
set 6, [hl]
set 7, [hl]
ld hl, wStatusFlags3
set BIT_TALKED_TO_TRAINER, [hl]
set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, RivalDefeatedText
ld de, RivalVictoryText
call SaveEndBattleTextPointers
@ -136,8 +136,8 @@ OakEntranceAfterVictoryMovement:
db -1 ; end
ChampionsRoomOakCongratulatesPlayerScript:
ld a, [wd730]
bit 0, a
ld a, [wStatusFlags5]
bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
@ -194,8 +194,8 @@ OakExitChampionsRoomMovement:
db -1 ; end
ChampionsRoomOakExitsScript:
ld a, [wd730]
bit 0, a
ld a, [wStatusFlags5]
bit BIT_SCRIPTED_NPC_MOVEMENT, a
ret nz
ld a, HS_CHAMPIONS_ROOM_OAK
ld [wMissableObjectIndex], a

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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