From 8fafca714c07500d1d87bba224f12cf9cc2c8789 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:02:54 -0400 Subject: Identify various flag labels and bit constants (#454) --- home/map_objects.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'home/map_objects.asm') diff --git a/home/map_objects.asm b/home/map_objects.asm index 27a69965..01dd8b6a 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -56,8 +56,8 @@ StartSimulatingJoypadStates:: xor a ld [wOverrideSimulatedJoypadStatesMask], a ld [wSpritePlayerStateData2MovementByte1], a - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret IsItemInBag:: -- cgit v1.3.1-sl0p From 5a622f628de6908210091a05956b0d8ce3620237 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:41:58 -0400 Subject: Identify remaining uses of `wd0b5` and `wd11e` (#463) --- engine/battle/animations.asm | 6 +-- engine/battle/core.asm | 44 ++++++++++----------- engine/battle/effects.asm | 6 +-- engine/battle/experience.asm | 18 ++++----- engine/battle/get_trainer_name.asm | 2 +- engine/battle/misc.asm | 2 +- engine/battle/move_effects/transform.asm | 2 +- engine/battle/print_type.asm | 2 +- engine/battle/safari_zone.asm | 2 +- engine/battle/trainer_ai.asm | 2 +- engine/events/cinnabar_lab.asm | 6 +-- engine/events/display_pokedex.asm | 2 +- engine/events/give_pokemon.asm | 6 +-- engine/events/heal_party.asm | 2 +- engine/events/hidden_items.asm | 2 +- engine/events/hidden_objects/museum_fossils.asm | 2 +- engine/events/in_game_trades.asm | 2 +- engine/events/poison.asm | 2 +- engine/events/pokemart.asm | 2 +- engine/events/prize_menu.asm | 20 +++++----- engine/gfx/mon_icons.asm | 4 +- engine/gfx/palettes.asm | 4 +- engine/items/item_effects.asm | 34 ++++++++-------- engine/items/tms.asm | 8 ++-- engine/link/cable_club.asm | 6 +-- engine/menus/league_pc.asm | 2 +- engine/menus/naming_screen.asm | 4 +- engine/menus/pokedex.asm | 52 ++++++++++++------------- engine/menus/start_sub_menus.asm | 2 +- engine/movie/credits.asm | 2 +- engine/movie/evolution.asm | 8 ++-- engine/movie/hall_of_fame.asm | 4 +- engine/movie/oak_speech/oak_speech.asm | 2 +- engine/movie/title.asm | 2 +- engine/movie/trade.asm | 6 +-- engine/movie/trade2.asm | 8 ++-- engine/pokemon/add_mon.asm | 12 +++--- engine/pokemon/evos_moves.asm | 33 ++++++++-------- engine/pokemon/experience.asm | 2 +- engine/pokemon/learn_move.asm | 2 +- engine/pokemon/load_mon_data.asm | 2 +- engine/pokemon/set_types.asm | 6 +-- engine/pokemon/status_screen.asm | 8 ++-- home/give.asm | 2 +- home/list_menu.asm | 16 ++++---- home/map_objects.asm | 2 +- home/names.asm | 22 +++++------ home/names2.asm | 8 ++-- home/pokemon.asm | 26 ++++++------- ram/wram.asm | 27 +++++++------ scripts/CeladonMartRoof.asm | 9 +++-- scripts/ChampionsRoom.asm | 2 +- scripts/CinnabarLabFossilRoom.asm | 7 ++-- scripts/OaksLab.asm | 8 ++-- scripts/Route11Gate2F.asm | 2 +- scripts/Route15Gate2F.asm | 2 +- scripts/Route2Gate.asm | 2 +- 57 files changed, 243 insertions(+), 237 deletions(-) (limited to 'home/map_objects.asm') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 31851a91..3e077d2b 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -701,7 +701,7 @@ DoBallTossSpecialEffects: ld a, [wIsInBattle] cp 2 ; is it a trainer battle? jr z, .isTrainerBattle - ld a, [wd11e] + ld a, [wPokeBallAnimData] cp $10 ; is the enemy pokemon the Ghost Marowak? ret nz ; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames @@ -2032,7 +2032,7 @@ ChangeMonPic: jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a xor a ld [wSpriteFlipped], a call GetMonHeader @@ -2044,7 +2044,7 @@ ChangeMonPic: push af ld a, [wChangeMonPicPlayerTurnSpecies] ld [wBattleMonSpecies2], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader predef LoadMonBackPic xor a ; TILEMAP_MON_PIC diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 01faa890..428bc78a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1421,7 +1421,7 @@ EnemySendOutFirstMon: call PrintText ld a, [wEnemyMonSpecies2] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -1642,7 +1642,7 @@ LoadBattleMonFromParty: ld bc, wBattleMonPP - wBattleMonLevel call CopyData ld a, [wBattleMonSpecies2] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMonNicks ld a, [wPlayerMonNumber] @@ -1686,7 +1686,7 @@ LoadEnemyMonFromParty: ld bc, wEnemyMonPP - wEnemyMonLevel call CopyData ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonNicks ld a, [wWhichPokemon] @@ -2237,7 +2237,7 @@ DisplayBagMenu: UseBagItem: ; either use an item from the bag or use a safari zone item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer xor a @@ -2380,7 +2380,7 @@ PartyMenuOrRockOrRun: ; enemy mon is not minimised ld a, [wEnemyMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -3564,7 +3564,7 @@ CheckPlayerStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkPlayerStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -3654,7 +3654,7 @@ PrintMoveIsDisabledText: res CHARGING_UP, a ; end the pokemon's ld [de], a ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, MoveIsDisabledText jp PrintText @@ -3728,13 +3728,13 @@ MonName1Text: ld hl, wEnemyUsedMove .playerTurn ld [hl], a - ld [wd11e], a + ld [wMoveGrammar], a call DetermineExclamationPointTextNum ld a, [wMonIsDisobedient] and a ld hl, Used2Text ret nz - ld a, [wd11e] + ld a, [wMoveGrammar] cp 3 ld hl, Used2Text ret c @@ -3771,7 +3771,7 @@ _PrintMoveName: text_far _MoveNameText text_asm ld hl, ExclamationPointPointerTable - ld a, [wd11e] ; exclamation point num + ld a, [wMoveGrammar] add a push bc ld b, $0 @@ -3819,7 +3819,7 @@ ExclamationPoint5Text: ; but the functionality didn't get removed DetermineExclamationPointTextNum: push bc - ld a, [wd11e] ; move ID + ld a, [wMoveGrammar] ; move ID ld c, a ld b, $0 ld hl, ExclamationPointMoveSets @@ -3835,7 +3835,7 @@ DetermineExclamationPointTextNum: jr .loop .done ld a, b - ld [wd11e], a ; exclamation point num + ld [wMoveGrammar], a pop bc ret @@ -4406,7 +4406,7 @@ GetEnemyMonStat: ld a, [wEnemyMonLevel] ld [wCurEnemyLevel], a ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonDVs ld de, wLoadedMonSpeedExp @@ -4610,7 +4610,7 @@ CriticalHitTest: jr nz, .handleEnemy ld a, [wBattleMonSpecies] .handleEnemy - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHBaseSpeed] ld b, a @@ -5120,7 +5120,7 @@ MirrorMoveFailedText: ; function used to reload move data for moves like Mirror Move and Metronome ReloadMoveData: - ld [wd11e], a + ld [wNamedObjectIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -5625,7 +5625,7 @@ EnemyCanExecuteChargingMove: res CHARGING_UP, [hl] ; no longer charging up for attack res INVULNERABLE, [hl] ; no longer invulnerable to typical attacks ld a, [wEnemyMoveNum] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME @@ -6067,7 +6067,7 @@ CheckEnemyStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkEnemyStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -6098,7 +6098,7 @@ GetCurrentMove: jr nz, .selected ld a, [wPlayerSelectedMove] .selected - ld [wd0b5], a + ld [wNameListIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -6120,7 +6120,7 @@ LoadEnemyMonData: jp z, LoadEnemyMonFromParty ld a, [wEnemyMonSpecies2] ld [wEnemyMonSpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wEnemyBattleStatus3] bit TRANSFORMED, a ; is enemy mon transformed? @@ -6245,16 +6245,16 @@ LoadEnemyMonData: ld a, [hl] ; base exp ld [de], a ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wEnemyMonNick ld bc, NAME_LENGTH call CopyData ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 643afeb2..6fba347f 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1262,7 +1262,7 @@ MimicEffect: add hl, bc ld a, d ld [hl], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText @@ -1309,7 +1309,7 @@ DisableEffect: pop hl and a jr z, .pickMoveToDisable ; loop until a non-00 move slot is found - ld [wd11e], a ; store move number + ld [wNamedObjectIndex], a ; store move number push hl ldh a, [hWhoseTurn] and a @@ -1354,7 +1354,7 @@ DisableEffect: jr nz, .printDisableText inc hl ; wEnemyDisabledMoveNumber .printDisableText - ld a, [wd11e] ; move number + ld a, [wNamedObjectIndex] ; move number ld [hl], a call GetMoveName ld hl, MoveWasDisabledText diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 798d7ce1..57d37f01 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -113,8 +113,8 @@ GainExperience: ld b, 0 ld hl, wPartySpecies add hl, bc - ld a, [hl] ; species - ld [wd0b5], a + ld a, [hl] + ld [wCurSpecies], a call GetMonHeader ld d, MAX_LEVEL callfar CalcExperience ; get max exp @@ -168,9 +168,9 @@ GainExperience: ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc - ld a, [hl] ; species - ld [wd0b5], a - ld [wd11e], a + ld a, [hl] + ld [wCurSpecies], a + ld [wPokedexNum], a call GetMonHeader ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species add hl, bc @@ -251,8 +251,8 @@ GainExperience: call LoadScreenTilesFromBuffer1 xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef LearnMoveFromLevelUp ld hl, wCanEvolveFlags ld a, [wWhichPokemon] @@ -306,7 +306,7 @@ DivideExpDataByNumMonsGainingExp: jr nz, .countSetBitsLoop cp $2 ret c ; return if only one mon is gaining exp - ld [wd11e], a ; store number of mons gaining exp + ld [wTempByteValue], a ; store number of mons gaining exp ld hl, wEnemyMonBaseStats ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats .divideLoop @@ -314,7 +314,7 @@ DivideExpDataByNumMonsGainingExp: ldh [hDividend], a ld a, [hl] ldh [hDividend + 1], a - ld a, [wd11e] + ld a, [wTempByteValue] ldh [hDivisor], a ld b, $2 call Divide ; divide value by number of mons gaining exp diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index beed3291..a0e869fc 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -11,7 +11,7 @@ GetTrainerName_:: jr z, .foundName cp RIVAL3 jr z, .foundName - ld [wd0b5], a + ld [wNameListIndex], a ld a, TRAINER_NAME ld [wNameListType], a ld a, BANK(TrainerNames) diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 1fa84e15..66675dbf 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -8,7 +8,7 @@ FormatMovesString: and a ; end of move list? jr z, .printDashLoop ; print dashes when no moves are left push hl - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 56dda7f4..6f2e705c 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -116,7 +116,7 @@ TransformEffect_: ; original (unmodified) stats and stat mods pop hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wEnemyMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack diff --git a/engine/battle/print_type.asm b/engine/battle/print_type.asm index 7da0dc8c..e7c6729c 100644 --- a/engine/battle/print_type.asm +++ b/engine/battle/print_type.asm @@ -1,4 +1,4 @@ -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID ; hl = dest addr PrintMonType: call GetPredefRegisters diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index a61f402f..ca3ff8a2 100644 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -16,7 +16,7 @@ PrintSafariZoneBattleText: jr nz, .done push hl ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHCatchRate] ld [wEnemyMonActualCatchRate], a diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index e21a3492..5eed1ae5 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -732,7 +732,7 @@ AIPrintItemUse: AIPrintItemUse_: ; print "x used [wAIItem] on z!" ld a, [wAIItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, AIBattleUseItemText jp PrintText diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 171fa99a..d8066fb8 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -98,7 +98,7 @@ PrintFossilsInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] @@ -114,10 +114,10 @@ PrintFossilsInBag: ; loads the names of the fossil item and the resulting mon LoadFossilItemAndMonName:: ld a, [wFossilMon] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName call CopyToStringBuffer ld a, [wFossilItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ret diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index 68d48bb3..46b45d77 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -8,7 +8,7 @@ _DisplayPokedex:: ld c, 10 call DelayFrames predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm index 9472f49f..9e80bdfc 100644 --- a/engine/events/give_pokemon.asm +++ b/engine/events/give_pokemon.asm @@ -54,16 +54,16 @@ _GivePokemon:: SetPokedexOwnedFlag: ld a, [wCurPartySpecies] push af - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld hl, wPokedexOwned ld b, FLAG_SET predef FlagActionPredef pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, GotMonText jp PrintText diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm index 0c6ec1ea..8bf162a7 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -84,7 +84,7 @@ HealParty: .done xor a ld [wWhichPokemon], a - ld [wd11e], a + ld [wUsingPPUp], a ld a, [wPartyCount] ld b, a diff --git a/engine/events/hidden_items.asm b/engine/events/hidden_items.asm index 97bb0b71..e42f60f9 100644 --- a/engine/events/hidden_items.asm +++ b/engine/events/hidden_items.asm @@ -14,7 +14,7 @@ HiddenItems: ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, [wHiddenObjectFunctionArgument] ; item ID - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName tx_pre_jump FoundHiddenItemText diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index e996e471..df74293f 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -35,7 +35,7 @@ DisplayMonFrontSpriteInBox: call DisplayTextBoxID call UpdateSprites ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vChars1 tile $31 call LoadMonFrontSprite diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index d3575689..ce4ffe3c 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -77,7 +77,7 @@ DoInGameTradeDialogue: ; copies name of species a to hl InGameTrade_GetMonName: push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer pop de diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 121bdc19..752899f7 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -44,7 +44,7 @@ ApplyOutOfBattlePoisonDamage: inc hl ld [hl], a ld a, [de] - ld [wd11e], a + ld [wPokedexNum], a push de ld a, [wWhichPokemon] ld hl, wPartyMonNicks diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index 10b6dba2..b280c711 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -157,7 +157,7 @@ DisplayPokemartDialogue_:: inc a jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button ld a, [wCurItem] - ld [wd11e], a ; store item ID for GetItemName + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, PokemartTellBuyPriceText diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index f99cdaaa..816637bf 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -88,34 +88,34 @@ GetPrizeMenuId: cp 2 ; is TM_menu? jr nz, .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 8 call PlaceString jr .putNoThanksText .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 8 call PlaceString @@ -189,7 +189,7 @@ HandlePrizeChoice: ld hl, wPrize1 add hl, de ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a ld a, [wWhichPrizeWindow] cp 2 ; is prize a TM? jr nz, .getMonName @@ -208,9 +208,9 @@ HandlePrizeChoice: call HasEnoughCoins jr c, .notEnoughCoins ld a, [wWhichPrizeWindow] - cp $02 + cp 2 ; is prize a TM? jr nz, .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld b, a ld a, 1 ld c, a @@ -218,7 +218,7 @@ HandlePrizeChoice: jr nc, .bagFull jr .subtractCoins .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurPartySpecies], a push af call GetPrizeMonLevel diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 53fabc6d..e7016a1d 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -258,9 +258,9 @@ WriteMonPartySpriteOAM: jp CopyData GetPartyMonSpriteID: - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] ld c, a dec a srl a diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index f59b37ea..47af5c29 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -275,13 +275,13 @@ DeterminePaletteID: ret nz ld a, [hl] DeterminePaletteIDOutOfBattle: - ld [wd11e], a + ld [wPokedexNum], a and a ; is the mon index 0? jr z, .skipDexNumConversion push bc predef IndexToPokedex pop bc - ld a, [wd11e] + ld a, [wPokedexNum] .skipDexNumConversion ld e, a ld d, 0 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index df050b03..91462478 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -510,7 +510,7 @@ ItemUseBall: ld a, [wEnemyMonSpecies] ld [wCapturedMonSpecies], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, [wBattleType] dec a ; is this the old man battle? jr z, .oldManCaughtMon ; if so, don't give the player the caught Pokémon @@ -520,7 +520,7 @@ ItemUseBall: ; Add the caught Pokémon to the Pokédex. predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -528,7 +528,7 @@ ItemUseBall: predef FlagActionPredef ld a, c push af - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -542,7 +542,7 @@ ItemUseBall: call PrintText call ClearSprites ld a, [wEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef ShowPokedexData .skipShowingPokedexData @@ -842,7 +842,7 @@ ItemUseMedicine: ld d, a ld a, [wCurPartySpecies] ld e, a - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurItem], a pop af @@ -1254,8 +1254,8 @@ ItemUseMedicine: .useVitamin push hl ld a, [hl] - ld [wd0b5], a - ld [wd11e], a + ld [wCurSpecies], a + ld [wPokedexNum], a ld bc, wPartyMon1Level - wPartyMon1 add hl, bc ; hl now points to level ld a, [hl] ; a = level @@ -1396,7 +1396,7 @@ ItemUseMedicine: ld a, d ld [wWhichPokemon], a ld a, e - ld [wd11e], a + ld [wPokedexNum], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData @@ -1988,7 +1988,7 @@ ItemUsePPRestore: call GetSelectedMoveOffset push hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer pop hl @@ -2009,7 +2009,7 @@ ItemUsePPRestore: add 1 << 6 ; increase PP Up count by 1 ld [hl], a ld a, 1 ; 1 PP Up used - ld [wd11e], a + ld [wUsingPPUp], a call RestoreBonusPP ; add the bonus PP to current PP ld hl, PPIncreasedText call PrintText @@ -2162,9 +2162,9 @@ ItemUseTMHM: add NUM_TMS + NUM_HMS ; adjust HM IDs to come after TM IDs .skipAdding inc a - ld [wd11e], a + ld [wTempTMHM], a predef TMToMove ; get move ID from TM/HM ID - ld a, [wd11e] + ld a, [wTempTMHM] ld [wMoveNum], a call GetMoveName call CopyToStringBuffer @@ -2558,7 +2558,7 @@ TossItem_:: jr nz, .tooImportantToToss push hl ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, IsItOKToTossItemText @@ -2578,7 +2578,7 @@ TossItem_:: ld a, [wWhichPokemon] call RemoveItemFromInventory ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, ThrewAwayItemText @@ -2651,7 +2651,7 @@ SendNewMonToBox: inc a ld [de], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a ld c, a .loop inc de @@ -2893,7 +2893,7 @@ ItemUseReloadOverworldData: call LoadCurrentMapView jp UpdateSprites -; creates a list at wBuffer of maps where the mon in [wd11e] can be found. +; creates a list at wBuffer of maps where the mon in [wPokedexNum] can be found. ; this is used by the pokedex to display locations the mon can be found on the map. FindWildLocationsOfMon: ld hl, WildDataPointers @@ -2928,7 +2928,7 @@ CheckMapForMon: inc hl ld b, NUM_WILDMONS .loop - ld a, [wd11e] + ld a, [wPokedexNum] cp [hl] jr nz, .nextEntry ld a, c diff --git a/engine/items/tms.asm b/engine/items/tms.asm index f3c6db98..2da15fab 100644 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -1,7 +1,7 @@ ; tests if mon [wCurPartySpecies] can learn move [wMoveNum] CanLearnTM: ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHLearnset push hl @@ -20,17 +20,17 @@ CanLearnTM: ld b, FLAG_TEST predef_jump FlagActionPredef -; converts TM/HM number in wd11e into move number +; converts TM/HM number in [wTempTMHM] into move number ; HMs start at 51 TMToMove: - ld a, [wd11e] + ld a, [wTempTMHM] dec a ld hl, TechnicalMachines ld b, $0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wTempTMHM], a ret INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 4ade66e3..cbb8a358 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -660,7 +660,7 @@ TradeCenter_PrintPartyListNames: ld a, [de] cp $ff ret z - ld [wd11e], a + ld [wNamedObjectIndex], a push bc push hl push de @@ -697,7 +697,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wNameOfPlayerMonToBeTraded @@ -709,7 +709,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, WillBeTradedText bccoord 1, 14 diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 849c6e03..17d58c55 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -84,7 +84,7 @@ LeaguePCShowMon: ld a, [hli] ld [wHoFMonSpecies], a ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [hli] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 25d69ca9..33556e26 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -9,7 +9,7 @@ AskName: ld c, 11 call z, ClearScreenArea ; only if in wild battle ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, DoYouWantToNicknameText call PrintText @@ -462,7 +462,7 @@ PrintNamingText: push af farcall WriteMonPartySpriteOAMBySpecies pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 4, 1 call PlaceString diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index f746c809..7710815b 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -9,7 +9,7 @@ ShowPokedexMenu: ld [wListScrollOffset], a ld [wLastMenuItem], a inc a - ld [wd11e], a + ld [wPokedexNum], a ldh [hJoy7], a .setUpGraphics ld b, SET_PAL_GENERIC @@ -68,8 +68,8 @@ HandlePokedexSideMenu: push af add b inc a - ld [wd11e], a - ld a, [wd11e] + ld [wPokedexNum], a + ld a, [wPokedexNum] push af ld a, [wDexMaxSeenMon] push af ; this doesn't need to be preserved @@ -111,7 +111,7 @@ HandlePokedexSideMenu: pop af ld [wDexMaxSeenMon], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop af ld [wListScrollOffset], a pop af @@ -142,7 +142,7 @@ HandlePokedexSideMenu: ; play pokemon cry .choseCry - ld a, [wd11e] + ld a, [wPokedexNum] call GetCryData call PlaySound jr .handleMenuInput @@ -222,7 +222,7 @@ HandlePokedexListMenu: call ClearScreenArea hlcoord 1, 3 ld a, [wListScrollOffset] - ld [wd11e], a + ld [wPokedexNum], a ld d, 7 ld a, [wDexMaxSeenMon] cp 7 @@ -233,17 +233,17 @@ HandlePokedexListMenu: ; loop to print pokemon pokedex numbers and names ; if the player has owned the pokemon, it puts a pokeball beside the name .printPokemonLoop - ld a, [wd11e] + ld a, [wPokedexNum] inc a - ld [wd11e], a + ld [wPokedexNum], a push af push de push hl ld de, -SCREEN_WIDTH add hl, de - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 - call PrintNumber ; print the pokedex number + call PrintNumber ld de, SCREEN_WIDTH add hl, de dec hl @@ -276,7 +276,7 @@ HandlePokedexListMenu: add hl, bc pop de pop af - ld [wd11e], a + ld [wPokedexNum], a dec d jr nz, .printPokemonLoop ld a, 01 @@ -376,10 +376,10 @@ PokedexMenuItemsText: ; tests if a pokemon's bit is set in the seen or owned pokemon bit fields ; INPUT: -; [wd11e] = pokedex number +; [wPokedexNum] = pokedex number ; hl = address of bit field IsPokemonBitSet: - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -403,13 +403,13 @@ ShowPokedexDataInternal: ldh [rNR50], a call GBPalWhiteOut ; zero all palettes call ClearScreen - ld a, [wd11e] ; pokemon ID + ld a, [wPokedexNum] ld [wCurPartySpecies], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand pop af - ld [wd11e], a + ld [wPokedexNum], a ldh a, [hTileAnimations] push af xor a @@ -455,7 +455,7 @@ ShowPokedexDataInternal: call PlaceString ld hl, PokedexEntryPointers - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld e, a ld d, 0 @@ -471,7 +471,7 @@ ShowPokedexDataInternal: ld h, b ld l, c push de - ld a, [wd11e] + ld a, [wPokedexNum] push af call IndexToPokedex @@ -480,16 +480,16 @@ ShowPokedexDataInternal: ld [hli], a ld a, "" ld [hli], a - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number ld hl, wPokedexOwned call IsPokemonBitSet pop af - ld [wd11e], a + ld [wPokedexNum], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a pop de push af @@ -624,10 +624,10 @@ DrawTileLine: INCLUDE "data/pokemon/dex_entries.asm" PokedexToIndex: - ; converts the Pokédex number at wd11e to an index + ; converts the Pokédex number at [wPokedexNum] to an index push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] ld b, a ld c, 0 ld hl, PokedexOrder @@ -639,23 +639,23 @@ PokedexToIndex: jr nz, .loop ld a, c - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret IndexToPokedex: - ; converts the index number at wd11e to a Pokédex number + ; converts the index number at [wPokedexNum] to a Pokédex number push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, PokedexOrder ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 5417e3e0..7b0455d0 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -365,7 +365,7 @@ StartMenu_Item:: jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld a, [wCurItem] diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index a9b6efbd..bdd66e8e 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -60,7 +60,7 @@ DisplayCreditsMon: add hl, bc ; go that far in the list of monsters and get the next one ld a, [hl] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 8, 6 call GetMonHeader call LoadFrontSpriteByMonIndex diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index d7a47885..69463bfa 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -4,7 +4,7 @@ EvolveMon: push bc ld a, [wCurPartySpecies] push af - ld a, [wd0b5] + ld a, [wCurSpecies] push af xor a ld [wLowHealthAlarm], a @@ -26,7 +26,7 @@ EvolveMon: call EvolutionSetWholeScreenPalette ld a, [wEvoNewSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld de, vFrontPic ld hl, vBackPic @@ -34,7 +34,7 @@ EvolveMon: call CopyVideoData ld a, [wEvoOldSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld a, $1 ldh [hAutoBGTransferEnabled], a @@ -75,7 +75,7 @@ EvolveMon: ld c, 0 call EvolutionSetWholeScreenPalette pop af - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurPartySpecies], a pop bc diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 2344dce3..a43ec5da 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -102,7 +102,7 @@ HoFShowMonOrPlayer: ldh [hSCX], a ld a, [wHoFMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [wHoFMonOrPlayer] @@ -171,7 +171,7 @@ HoFDisplayMonInfo: hlcoord 8, 7 call PrintLevelCommon ld a, [wHoFMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 3, 9 predef PrintMonType ld a, [wHoFMonSpecies] diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index ded8a7c3..44b236c8 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -73,7 +73,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld a, NIDORINO - ld [wd0b5], a + ld [wCurSpecies], a ld [wCurPartySpecies], a call GetMonHeader hlcoord 6, 4 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index b515a984..3c7ca27d 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -362,7 +362,7 @@ ClearBothBGMaps: LoadTitleMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 5, 10 call GetMonHeader jp LoadFrontSpriteByMonIndex diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index a7ccb6b8..14a53a24 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -186,14 +186,14 @@ LoadTradingGFXAndMonNames: xor a ldh [hAutoBGTransferEnabled], a ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wStringBuffer ld bc, NAME_LENGTH call CopyData ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a jp GetMonName Trade_LoadMonPartySpriteGfx: @@ -728,7 +728,7 @@ Trade_CircleOAM3: ; a = species Trade_LoadMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wWholeScreenPaletteMonSpecies], a ld b, SET_PAL_POKEMON_WHOLE_SCREEN ld c, 0 diff --git a/engine/movie/trade2.asm b/engine/movie/trade2.asm index a564862b..d4a4b635 100644 --- a/engine/movie/trade2.asm +++ b/engine/movie/trade2.asm @@ -3,10 +3,10 @@ Trade_PrintPlayerMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 0 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 2 @@ -25,10 +25,10 @@ Trade_PrintEnemyMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 10 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 12 diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index ab167a24..7eaca222 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -65,7 +65,7 @@ _AddPartyMon:: ld d, h push hl ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHeader ld a, [hli] @@ -81,11 +81,11 @@ _AddPartyMon:: ; If the mon is being added to the player's party, update the pokedex. ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a push de predef IndexToPokedex pop de - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -93,7 +93,7 @@ _AddPartyMon:: call FlagAction ld a, c ; whether the mon was already flagged as owned ld [wUnusedAlreadyOwnedFlag], a - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -323,9 +323,9 @@ _AddEnemyMonToPlayerParty:: ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index aae6cb87..268e522a 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -135,7 +135,7 @@ Evolution_PartyMonLoop: ; loop over party mons call PrintText pop hl ld a, [hl] - ld [wd0b5], a + ld [wCurSpecies], a ld [wLoadedMonSpecies], a ld [wEvoNewSpecies], a ld a, MONSTER_NAME @@ -153,22 +153,22 @@ Evolution_PartyMonLoop: ; loop over party mons call DelayFrames call ClearScreen call RenameEvolvedMon - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, BaseStats ld bc, BASE_DATA_SIZE call AddNTimes ld de, wMonHeader call CopyData - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 @@ -203,8 +203,8 @@ Evolution_PartyMonLoop: ; loop over party mons dec hl pop bc call CopyData - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a xor a ld [wMonDataLocation], a call LearnMoveFromLevelUp @@ -214,7 +214,7 @@ Evolution_PartyMonLoop: ; loop over party mons and a call z, Evolution_ReloadTilesetTilePatterns predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -260,13 +260,14 @@ Evolution_PartyMonLoop: ; loop over party mons RenameEvolvedMon: ; Renames the mon to its new, evolved form's standard name unless it had a ; nickname, in which case the nickname is kept. - ld a, [wd0b5] + assert wCurSpecies == wNameListIndex ; save+restore wCurSpecies while using wNameListIndex + ld a, [wCurSpecies] push af ld a, [wMonHIndex] - ld [wd0b5], a + ld [wNameListIndex], a call GetName pop af - ld [wd0b5], a + ld [wCurSpecies], a ld hl, wNameBuffer ld de, wStringBuffer .compareNamesLoop @@ -319,7 +320,7 @@ Evolution_ReloadTilesetTilePatterns: LearnMoveFromLevelUp: ld hl, EvosMovesPointerTable - ld a, [wd11e] ; species + ld a, [wPokedexNum] ; species ld [wCurPartySpecies], a dec a ld bc, 0 @@ -366,13 +367,13 @@ LearnMoveFromLevelUp: jr nz, .checkCurrentMovesLoop ld a, d ld [wMoveNum], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer predef LearnMove .done ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a ret ; writes the moves a mon has at level [wCurEnemyLevel] to [de] diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 427d2a7f..d651321a 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -1,7 +1,7 @@ ; calculates the level a mon should be based on its current exp CalcLevelFromExperience:: ld a, [wLoadedMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld d, $1 ; init level to 1 .loop diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 981fe13a..2df9964e 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -29,7 +29,7 @@ DontAbandonLearning: jp c, AbandonLearning push hl push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, OneTwoAndText call PrintText diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index 3d0548e0..7a39f083 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -19,7 +19,7 @@ LoadMonData_:: .GetMonHeader ld a, [wCurPartySpecies] - ld [wd0b5], a ; input for GetMonHeader + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMons diff --git a/engine/pokemon/set_types.asm b/engine/pokemon/set_types.asm index e9235f13..2cf8f14c 100644 --- a/engine/pokemon/set_types.asm +++ b/engine/pokemon/set_types.asm @@ -1,10 +1,10 @@ -; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in wd11e +; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in [wPokedexNum] SetPartyMonTypes: call GetPredefRegisters ld bc, wPartyMon1Type - wPartyMon1 ; $5 add hl, bc - ld a, [wd11e] - ld [wd0b5], a + ld a, [wPokedexNum] + ld [wCurSpecies], a push hl call GetMonHeader pop hl diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 4ae4327a..8d377f79 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -139,11 +139,11 @@ StatusScreen: hlcoord 14, 2 call PrintLevel ; Pokémon level ld a, [wMonHIndex] - ld [wd11e], a - ld [wd0b5], a + ld [wPokedexNum], a + ld [wCurSpecies], a predef IndexToPokedex hlcoord 3, 7 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; Pokémon no. hlcoord 11, 10 @@ -420,7 +420,7 @@ StatusScreen2: hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 9, 1 call PlaceString diff --git a/home/give.asm b/home/give.asm index 8ede4ea4..9f51450a 100644 --- a/home/give.asm +++ b/home/give.asm @@ -3,7 +3,7 @@ GiveItem:: ; and copy the item's name to wStringBuffer. ; Return carry on success. ld a, b - ld [wd11e], a + ld [wNamedObjectIndex], a ld [wCurItem], a ld a, c ld [wItemQuantity], a diff --git a/home/list_menu.asm b/home/list_menu.asm index ca369a82..f04684a3 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -141,7 +141,7 @@ DisplayListMenuIDLoop:: ld [wMaxItemQuantity], a .skipGettingQuantity ld a, [wCurItem] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(ItemNames) ld [wPredefBank], a call GetName @@ -367,7 +367,7 @@ PrintListMenuEntries:: ld a, b ld [wWhichPokemon], a ld a, [de] - ld [wd11e], a + ld [wNamedObjectIndex], a cp $ff jp z, .printCancelMenuItem push bc @@ -427,7 +427,7 @@ PrintListMenuEntries:: and a ; PCPOKEMONLISTMENU? jr nz, .skipPrintingPokemonLevel .printPokemonLevel - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af push hl ld hl, wPartyCount @@ -460,7 +460,7 @@ PrintListMenuEntries:: add hl, bc call PrintLevel pop af - ld [wd11e], a + ld [wNamedObjectIndex], a .skipPrintingPokemonLevel pop hl pop de @@ -469,7 +469,7 @@ PrintListMenuEntries:: cp ITEMLISTMENU jr nz, .nextListEntry .printItemQuantity - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurItem], a call IsKeyItem ; check if item is unsellable ld a, [wIsKeyItem] @@ -480,18 +480,18 @@ PrintListMenuEntries:: add hl, bc ld a, "×" ld [hli], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af ld a, [de] ld [wMaxItemQuantity], a push de - ld de, wd11e + ld de, wTempByteValue ld [de], a lb bc, 1, 2 call PrintNumber pop de pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop hl .skipPrintingItemQuantity inc de diff --git a/home/map_objects.asm b/home/map_objects.asm index 01dd8b6a..342139dd 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -71,7 +71,7 @@ IsItemInBag:: ret DisplayPokedex:: - ld [wd11e], a + ld [wPokedexNum], a farjp _DisplayPokedex SetSpriteFacingDirectionAndDelay:: diff --git a/home/names.asm b/home/names.asm index 2e5e1501..7330a065 100644 --- a/home/names.asm +++ b/home/names.asm @@ -5,7 +5,7 @@ GetMonName:: ld a, BANK(MonsterNames) ldh [hLoadedROMBank], a ld [MBC1RomBank], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] dec a ld hl, MonsterNames ld c, NAME_LENGTH - 1 @@ -25,14 +25,14 @@ GetMonName:: ret GetItemName:: -; given an item ID at [wd11e], store the name of the item in wNameBuffer +; given an item ID at [wNamedObjectIndex], store the name of the item in wNameBuffer push hl push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] cp HM01 ; is this a TM/HM? jr nc, .Machine - ld [wd0b5], a + ld [wNameListIndex], a ld a, ITEM_NAME ld [wNameListType], a ld a, BANK(ItemNames) @@ -49,18 +49,18 @@ GetItemName:: ret GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wNameBuffer +; copies the name of the TM/HM in [wNamedObjectIndex] to wNameBuffer push hl push de push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af cp TM01 ; is this a TM? [not HM] jr nc, .WriteTM ; if HM, then write "HM" and add NUM_HMS to the item ID, so we can reuse the ; TM printing code add NUM_HMS - ld [wd11e], a + ld [wNamedObjectIndex], a ld hl, HiddenPrefix ; points to "HM" ld bc, 2 jr .WriteMachinePrefix @@ -72,7 +72,7 @@ GetMachineName:: call CopyData ; now get the machine number and convert it to text - ld a, [wd11e] + ld a, [wNamedObjectIndex] sub TM01 - 1 ld b, "0" .FirstDigit @@ -94,7 +94,7 @@ GetMachineName:: ld a, "@" ld [de], a pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop bc pop de pop hl @@ -130,8 +130,8 @@ GetMoveName:: push hl ld a, MOVE_NAME ld [wNameListType], a - ld a, [wd11e] - ld [wd0b5], a + ld a, [wNamedObjectIndex] + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a call GetName diff --git a/home/names2.asm b/home/names2.asm index cd3823fd..3bb6980c 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -10,13 +10,13 @@ NamePointers:: GetName:: ; arguments: -; [wd0b5] = which name +; [wNameListIndex] = which name ; [wNameListType] = which list ; [wPredefBank] = bank of list ; ; returns pointer to name in de - ld a, [wd0b5] - ld [wd11e], a + ld a, [wNameListIndex] + ld [wNamedObjectIndex], a ; TM names are separate from item names. ; BUG: This applies to all names instead of just items. @@ -67,7 +67,7 @@ GetName:: ld h, a ldh a, [hSwapTemp + 1] ld l, a - ld a, [wd0b5] + ld a, [wNameListIndex] ld b, a ; wanted entry ld c, 0 ; entry counter .nextName diff --git a/home/pokemon.asm b/home/pokemon.asm index 9fcf5622..54d69bba 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -99,12 +99,12 @@ LoadFlippedFrontSpriteByMonIndex:: LoadFrontSpriteByMonIndex:: push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld hl, wd11e + ld hl, wPokedexNum ld a, [hl] pop bc ld [hl], b @@ -355,8 +355,8 @@ PrintLevelFull:: ld a, [wLoadedMonLevel] ; level PrintLevelCommon:: - ld [wd11e], a - ld de, wd11e + ld [wTempByteValue], a + ld de, wTempByteValue ld b, LEFT_ALIGN | 1 ; 1 byte jp PrintNumber @@ -371,7 +371,7 @@ GetwMoves:: ; copies the base stat data of a pokemon to wMonHeader ; INPUT: -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID GetMonHeader:: ldh a, [hLoadedROMBank] push af @@ -381,10 +381,10 @@ GetMonHeader:: push bc push de push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a ld de, FossilKabutopsPic ld b, $66 ; size of Kabutops fossil and Ghost sprites cp FOSSIL_KABUTOPS ; Kabutops fossil @@ -398,8 +398,8 @@ GetMonHeader:: jr z, .specialID cp MEW jr z, .mew - predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a, [wd11e] + predef IndexToPokedex + ld a, [wPokedexNum] dec a ld bc, BASE_DATA_SIZE ld hl, BaseStats @@ -423,10 +423,10 @@ GetMonHeader:: ld a, BANK(MewBaseStats) call FarCopyData .done - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop hl pop de pop bc diff --git a/ram/wram.asm b/ram/wram.asm index a4d75707..48616226 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1490,8 +1490,10 @@ wSpriteDecodeTable0Ptr:: dw ; pointer to differential decoding table (assuming initial value 1) wSpriteDecodeTable1Ptr:: dw -wd0b5:: db ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things - +; input for GetMonHeader +wCurSpecies:: +; input for GetName +wNameListIndex:: db wNameListType:: db wPredefBank:: db @@ -1556,19 +1558,22 @@ wCapturedMonSpecies:: db ; which will be the first mon sent out. wFirstMonsNotOutYet:: db -wPokeBallCaptureCalcTemp:: -; lower nybble: number of shakes -; upper nybble: number of animations to play -wPokeBallAnimData:: +wNamedObjectIndex:: +wTempByteValue:: +wNumSetBits:: +wTypeEffectiveness:: +wMoveType:: +wPokedexNum:: +wTempTMHM:: wUsingPPUp:: wMaxPP:: +wMoveGrammar:: ; 0 for player, non-zero for enemy wCalculateWhoseStats:: -wTypeEffectiveness:: -wMoveType:: -wNumSetBits:: -; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wd11e:: +wPokeBallCaptureCalcTemp:: +; lower nybble: number of shakes +; upper nybble: number of animations to play +wPokeBallAnimData:: db ; When this value is non-zero, the player isn't allowed to exit the party menu diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index b5960c81..d06fc4a2 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -13,15 +13,16 @@ CeladonMartRoofScript_GetDrinksInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de pop hl ld a, b and a - jr z, .loop ; if the item isn't in the bag - ld a, [wd11e] + jr z, .loop + ; A drink is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl @@ -192,7 +193,7 @@ CeladonMartRoofScript_PrintDrinksInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index efa66680..46814138 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -281,7 +281,7 @@ ChampionsRoomOakText: ChampionsRoomOakCongratulatesPlayerText: text_asm ld a, [wPlayerStarter] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, .Text call PrintText diff --git a/scripts/CinnabarLabFossilRoom.asm b/scripts/CinnabarLabFossilRoom.asm index 4a2ff51f..e5928144 100644 --- a/scripts/CinnabarLabFossilRoom.asm +++ b/scripts/CinnabarLabFossilRoom.asm @@ -18,7 +18,7 @@ Lab4Script_GetFossilsInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de @@ -26,9 +26,8 @@ Lab4Script_GetFossilsInBag: ld a, b and a jr z, .loop - - ; A fossil's in the bag - ld a, [wd11e] + ; A fossil is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index e89e0ee8..89d6ef80 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -322,7 +322,7 @@ OaksLabRivalChoosesStarterScript: ld a, [wRivalStarterTemp] ld [wRivalStarter], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, OAKSLAB_RIVAL ldh [hSpriteIndex], a @@ -825,7 +825,7 @@ OaksLabBulbasaurPokeBallText: OaksLabSelectedPokeBallScript: ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, b ld [wSpriteIndex], a CheckEvent EVENT_GOT_STARTER @@ -899,7 +899,7 @@ OaksLabMonChoiceMenu: jr nz, OaksLabMonChoiceEnd ld a, [wCurPartySpecies] ld [wPlayerStarter], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, [wSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL @@ -927,7 +927,7 @@ OaksLabMonChoiceMenu: ld a, 5 ld [wCurEnemyLevel], a ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a call AddPartyMon ld hl, wStatusFlags4 set BIT_GOT_STARTER, [hl] diff --git a/scripts/Route11Gate2F.asm b/scripts/Route11Gate2F.asm index 9c223c87..bc1e2e90 100644 --- a/scripts/Route11Gate2F.asm +++ b/scripts/Route11Gate2F.asm @@ -24,7 +24,7 @@ Route11Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, ITEMFINDER ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld h, d ld l, e diff --git a/scripts/Route15Gate2F.asm b/scripts/Route15Gate2F.asm index ad1434dc..831b66e6 100644 --- a/scripts/Route15Gate2F.asm +++ b/scripts/Route15Gate2F.asm @@ -14,7 +14,7 @@ Route15Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, EXP_ALL ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName diff --git a/scripts/Route2Gate.asm b/scripts/Route2Gate.asm index 8522a149..795b210e 100644 --- a/scripts/Route2Gate.asm +++ b/scripts/Route2Gate.asm @@ -14,7 +14,7 @@ Route2GateOaksAideText: ldh [hOaksAideRequirement], a ld a, HM_FLASH ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName -- cgit v1.3.1-sl0p From 8f1dcf07e598c6e3d34b5d255f04faff1667d83b Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:51:44 -0400 Subject: Identify more flag bits (#464) --- audio/engine_1.asm | 10 ++++---- audio/engine_2.asm | 16 ++++++------ audio/engine_3.asm | 10 ++++---- audio/low_health_alarm.asm | 14 +++++------ constants/audio_constants.asm | 8 ++++++ constants/battle_constants.asm | 4 +++ constants/gfx_constants.asm | 6 +++++ constants/map_object_constants.asm | 11 +++++++-- constants/menu_constants.asm | 3 +++ constants/oam_constants.asm | 24 +++++++++++------- constants/ram_constants.asm | 30 +++++++++++++++++++++++ data/sprites/facings.asm | 8 +++--- engine/battle/animations.asm | 6 ++--- engine/battle/battle_transitions.asm | 20 ++++++++++----- engine/battle/core.asm | 34 +++++++++++++------------- engine/battle/effects.asm | 2 +- engine/battle/experience.asm | 2 +- engine/battle/trainer_ai.asm | 8 +++--- engine/events/hidden_objects/pokecenter_pc.asm | 2 +- engine/events/poison.asm | 2 +- engine/gfx/hp_bar.asm | 2 +- engine/gfx/sprite_oam.asm | 4 +-- engine/items/item_effects.asm | 10 ++++---- engine/items/town_map.asm | 10 ++++---- engine/link/cable_club.asm | 14 +++++------ engine/menus/display_text_id_init.asm | 4 +-- engine/menus/league_pc.asm | 4 +-- engine/menus/party_menu.asm | 4 +-- engine/menus/players_pc.asm | 2 +- engine/menus/save.asm | 14 +++++------ engine/menus/text_box.asm | 4 +-- engine/overworld/map_sprites.asm | 6 ++--- engine/overworld/movement.asm | 8 +++--- engine/overworld/pathfinding.asm | 26 ++++++++++---------- engine/overworld/push_boulder.asm | 2 +- engine/overworld/special_warps.asm | 2 +- engine/pokemon/learn_move.asm | 8 +++--- engine/pokemon/status_screen.asm | 2 +- engine/slots/slot_machine.asm | 27 ++++++++++---------- home/map_objects.asm | 2 +- home/overworld.asm | 20 +++++++-------- home/predef_text.asm | 2 +- home/print_bcd.asm | 28 ++++++++++----------- home/reload_sprites.asm | 2 +- home/text.asm | 2 +- home/text_script.asm | 6 ++--- home/window.asm | 14 +++++------ ram/hram.asm | 1 + scripts/CeruleanBadgeHouse.asm | 2 +- scripts/Museum1F.asm | 2 +- scripts/OaksLab.asm | 2 +- scripts/PewterMart.asm | 2 +- scripts/SSAnne2FRooms.asm | 2 +- 53 files changed, 267 insertions(+), 193 deletions(-) (limited to 'home/map_objects.asm') diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 99d47f37..e9642b32 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -15,9 +15,9 @@ Audio1_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio1_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio1_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio1_sound_ret Audio1_vibrato: diff --git a/audio/engine_2.asm b/audio/engine_2.asm index bcaab694..2f11c027 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -17,9 +17,9 @@ Audio2_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -163,8 +163,8 @@ Audio2_PlayNextNote: ld a, c cp CHAN5 jr nz, .beginChecks - ld a, [wLowHealthAlarm] ; low health alarm enabled? - bit 7, a + ld a, [wLowHealthAlarm] + bit BIT_LOW_HEALTH_ALARM, a ret nz .beginChecks ; --- @@ -208,7 +208,7 @@ Audio2_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -388,8 +388,8 @@ Audio2_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio2_sound_ret Audio2_vibrato: @@ -978,7 +978,7 @@ Audio2_ResetCryModifiers: cp CHAN5 jr nz, .skip ld a, [wLowHealthAlarm] - bit 7, a + bit BIT_LOW_HEALTH_ALARM, a jr z, .skip xor a ld [wFrequencyModifier], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index e5d285a3..f524875f 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -15,9 +15,9 @@ Audio3_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio3_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio3_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio3_sound_ret Audio3_vibrato: diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index 35fe1815..728f5f65 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -1,12 +1,12 @@ Music_DoLowHealthAlarm:: ld a, [wLowHealthAlarm] - cp $ff + cp DISABLE_LOW_HEALTH_ALARM jr z, .disableAlarm - bit 7, a ;alarm enabled? - ret z ;nope + bit BIT_LOW_HEALTH_ALARM, a + ret z - and $7f ;low 7 bits are the timer. + and LOW_HEALTH_TIMER_MASK jr nz, .notToneHi ;if timer > 0, play low tone. call .playToneHi @@ -19,15 +19,15 @@ Music_DoLowHealthAlarm:: call .playToneLo ;actually set the sound registers. .noTone - ld a, $86 + ld a, CRY_SFX_END ld [wChannelSoundIDs + CHAN5], a ;disable sound channel? ld a, [wLowHealthAlarm] - and $7f ;decrement alarm timer. + and LOW_HEALTH_TIMER_MASK dec a .resetTimer ; reset the timer and enable flag. - set 7, a + set BIT_LOW_HEALTH_ALARM, a ld [wLowHealthAlarm], a ret diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index a8903052..99b899d1 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -66,3 +66,11 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) ; wChannelFlags2 constant (only has one flag) DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music + +; wMuteAudioAndPauseMusic +DEF BIT_MUTE_AUDIO EQU 7 + +; wLowHealthAlarm +DEF BIT_LOW_HEALTH_ALARM EQU 7 +DEF LOW_HEALTH_TIMER_MASK EQU %01111111 +DEF DISABLE_LOW_HEALTH_ALARM EQU $ff diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 9349bb75..cde50b4d 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -72,6 +72,10 @@ DEF MAX_STAT_VALUE EQU 999 DEF ATKDEFDV_TRAINER EQU $98 DEF SPDSPCDV_TRAINER EQU $88 +; wDamageMultipliers +DEF BIT_STAB_DAMAGE EQU 7 +DEF EFFECTIVENESS_MASK EQU %01111111 + ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def const STORING_ENERGY ; 0 ; Bide diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index c6268208..79d9647f 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -29,6 +29,12 @@ DEF TRANSFERBOTTOM EQU 2 DEF REDRAW_COL EQU 1 DEF REDRAW_ROW EQU 2 +; hUILayoutFlags + const_def + const BIT_PARTY_MENU_HP_BAR ; 0 + const BIT_DOUBLE_SPACED_MENU ; 1 + const BIT_SINGLE_SPACED_LINES ; 2 + ; tile list ids ; TileIDListPointerTable indexes (see data/tilemaps.asm) const_def diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 377edcea..3b17c6ae 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -40,9 +40,16 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16 + const_def 6 + const BIT_TRAINER ; 6 + const BIT_ITEM ; 7 + ; different kinds of people events -DEF ITEM EQU $80 -DEF TRAINER EQU $40 +DEF TRAINER EQU 1 << BIT_TRAINER +DEF ITEM EQU 1 << BIT_ITEM + +; movement status +DEF BIT_FACE_PLAYER EQU 7 DEF WALK EQU $FE DEF STAY EQU $FF diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index f1f0d417..a6e035e7 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -44,6 +44,9 @@ DEF PC_ITEM_CAPACITY EQU 50 const NO_YES_MENU ; 7 DEF NUM_TWO_OPTION_MENUS EQU const_value +; wTwoOptionMenuID +DEF BIT_SECOND_MENU_OPTION_DEFAULT EQU 7 + ; menu exit method constants for list menus and the buy/sell/quit menu DEF CHOSE_MENU_ITEM EQU 1 ; pressed A DEF CANCELLED_MENU EQU 2 ; pressed B diff --git a/constants/oam_constants.asm b/constants/oam_constants.asm index 8c5e6be8..e87e54a0 100644 --- a/constants/oam_constants.asm +++ b/constants/oam_constants.asm @@ -1,14 +1,20 @@ -; OAM flags used by this game -DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic -DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic +; Pseudo-OAM flags used by game logic + const_def + const BIT_END_OF_OAM_DATA ; 0 + const BIT_SPRITE_UNDER_GRASS ; 1 + +; Used in SpriteFacingAndAnimationTable (see data/sprites/facings.asm) +DEF FACING_END EQU 1 << BIT_END_OF_OAM_DATA +DEF UNDER_GRASS EQU 1 << BIT_SPRITE_UNDER_GRASS ; OAM attribute flags -DEF OAM_PALETTE EQU %111 -DEF OAM_TILE_BANK EQU 3 -DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only -DEF OAM_X_FLIP EQU 5 -DEF OAM_Y_FLIP EQU 6 -DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +DEF OAM_PALETTE EQU %111 + const_def 3 + const OAM_TILE_BANK ; 3 + const OAM_OBP_NUM ; 4 ; Non CGB Mode Only + const OAM_X_FLIP ; 5 + const OAM_Y_FLIP ; 6 + const OAM_PRIORITY ; 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; OAM attribute masks DEF OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1 diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm index 42956cc6..8102cc7e 100644 --- a/constants/ram_constants.asm +++ b/constants/ram_constants.asm @@ -1,3 +1,8 @@ +; wSlotMachineFlags + const_def 6 + const BIT_SLOTS_CAN_WIN ; 6 + const BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR ; 7 + ; wMiscFlags const_def const BIT_SEEN_BY_TRAINER ; 0 @@ -9,6 +14,15 @@ const BIT_TRIED_PUSH_BOULDER ; 6 const BIT_PUSHED_BOULDER ; 7 +; wAutoTextBoxDrawingControl +DEF BIT_NO_AUTO_TEXT_BOX EQU 0 + +; wTextPredefFlag +DEF BIT_TEXT_PREDEF EQU 0 + +; wFontLoaded +DEF BIT_FONT_LOADED EQU 0 + ; wOptions DEF TEXT_DELAY_MASK EQU %111 const_def 6 @@ -24,6 +38,12 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5 const BIT_FAST_TEXT_DELAY ; 0 const BIT_TEXT_DELAY ; 1 +; wCurMapTileset +DEF BIT_NO_PREVIOUS_MAP EQU 7 + +; wCurrentBoxNum +DEF BIT_HAS_CHANGED_BOXES EQU 7 + ; wObtainedBadges, wBeatGymFlags const_def const BIT_BOULDERBADGE ; 0 @@ -117,3 +137,13 @@ DEF NUM_BADGES EQU const_value const_skip 3 ; 3-5 ; unused const BIT_LEDGE_OR_FISHING ; 6 const BIT_SPINNING ; 7 + +; hFindPathFlags + const_def + const BIT_PATH_FOUND_Y ; 0 + const BIT_PATH_FOUND_X ; 1 + +; hNPCPlayerRelativePosFlags + const_def + const BIT_PLAYER_LOWER_Y ; 0 + const BIT_PLAYER_LOWER_X ; 1 diff --git a/data/sprites/facings.asm b/data/sprites/facings.asm index eb583d53..54fd7ed0 100644 --- a/data/sprites/facings.asm +++ b/data/sprites/facings.asm @@ -48,12 +48,12 @@ SpriteFacingAndAnimationTable: ; y, x, attributes db 0, 0, $00 ; top left db 0, 8, $00 ; top right - db 8, 0, OAMFLAG_CANBEMASKED ; bottom left - db 8, 8, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 0, UNDER_GRASS ; bottom left + db 8, 8, UNDER_GRASS | FACING_END ; bottom right .FlippedOAM: ; y, x, attributes db 0, 8, OAM_HFLIP ; top left db 0, 0, OAM_HFLIP ; top right - db 8, 8, OAM_HFLIP | OAMFLAG_CANBEMASKED ; bottom left - db 8, 0, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 8, OAM_HFLIP | UNDER_GRASS ; bottom left + db 8, 0, OAM_HFLIP | UNDER_GRASS | FACING_END ; bottom right diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 3e077d2b..3ccbf7c4 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -114,13 +114,13 @@ DrawFrameBlock: ld [de], a ; store tile ID inc de ld a, [hli] - bit 5, a ; is horizontal flip enabled? + bit OAM_X_FLIP, a jr nz, .disableHorizontalFlip .enableHorizontalFlip - set 5, a + set OAM_X_FLIP, a jr .storeFlags2 .disableHorizontalFlip - res 5, a + res OAM_X_FLIP, a .storeFlags2 ld [de], a inc de diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 5956d875..85d2177e 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -64,6 +64,12 @@ BattleTransition: ld l, a jp hl + const_def + const BIT_TRAINER_BATTLE_TRANSITION ; 0 + const BIT_STRONGER_BATTLE_TRANSITION ; 1 + const BIT_DUNGEON_BATTLE_TRANSITION ; 2 +DEF NUM_BATTLE_TRANSITION_BITS EQU const_value + ; the three GetBattleTransitionID functions set the first ; three bits of c, which determines what transition animation ; to play at the beginning of a battle @@ -71,6 +77,7 @@ BattleTransition: ; bit 1: set if enemy is at least 3 levels higher than player ; bit 2: set if dungeon map BattleTransitions: + table_width 2, BattleTransitions dw BattleTransition_DoubleCircle ; %000 dw BattleTransition_Spiral ; %001 dw BattleTransition_Circle ; %010 @@ -79,15 +86,16 @@ BattleTransitions: dw BattleTransition_Shrink ; %101 dw BattleTransition_VerticalStripes ; %110 dw BattleTransition_Split ; %111 + assert_table_length 1 << NUM_BATTLE_TRANSITION_BITS GetBattleTransitionID_WildOrTrainer: ld a, [wCurOpponent] cp OPP_ID_OFFSET jr nc, .trainer - res 0, c + res BIT_TRAINER_BATTLE_TRANSITION, c ret .trainer - set 0, c + set BIT_TRAINER_BATTLE_TRANSITION, c ret GetBattleTransitionID_CompareLevels: @@ -108,12 +116,12 @@ GetBattleTransitionID_CompareLevels: ld a, [wCurEnemyLevel] sub e jr nc, .highLevelEnemy - res 1, c + res BIT_STRONGER_BATTLE_TRANSITION, c ld a, 1 ld [wBattleTransitionSpiralDirection], a ret .highLevelEnemy - set 1, c + set BIT_STRONGER_BATTLE_TRANSITION, c xor a ld [wBattleTransitionSpiralDirection], a ret @@ -129,7 +137,7 @@ GetBattleTransitionID_IsDungeonMap: cp e jr nz, .loop1 .match - set 2, c + set BIT_DUNGEON_BATTLE_TRANSITION, c ret .noMatch1 ld hl, DungeonMaps2 @@ -145,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap: cp d jr nc, .match .noMatch2 - res 2, c + res BIT_DUNGEON_BATTLE_TRANSITION, c ret INCLUDE "data/maps/dungeon_maps.asm" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 428bc78a..5e93393c 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1007,12 +1007,12 @@ RemoveFaintedPlayerMon: ld b, FLAG_RESET predef FlagActionPredef ; clear gain exp flag for fainted mon ld hl, wEnemyBattleStatus1 - res 2, [hl] ; reset "attacking multiple times" flag + res ATTACKING_MULTIPLE_TIMES, [hl] ld a, [wLowHealthAlarm] - bit 7, a ; skip sound flag (red bar (?)) + bit BIT_LOW_HEALTH_ALARM, a jr z, .skipWaitForSound - ld a, $ff - ld [wLowHealthAlarm], a ;disable low health alarm + ld a, DISABLE_LOW_HEALTH_ALARM + ld [wLowHealthAlarm], a call WaitForSoundToFinish .skipWaitForSound ; a is 0, so this zeroes the enemy's accumulated damage. @@ -1305,7 +1305,7 @@ EnemySendOutFirstMon: dec a ld [wAICount], a ld hl, wPlayerBattleStatus1 - res 5, [hl] + res USING_TRAPPING_MOVE, [hl] hlcoord 18, 0 ld a, 8 call SlideTrainerPicOffScreen @@ -1860,15 +1860,15 @@ DrawPlayerHUDAndHPBar: jr z, .setLowHealthAlarm .fainted ld hl, wLowHealthAlarm - bit 7, [hl] ;low health alarm enabled? - ld [hl], $0 + bit BIT_LOW_HEALTH_ALARM, [hl] + ld [hl], 0 ret z xor a ld [wChannelSoundIDs + CHAN5], a ret .setLowHealthAlarm ld hl, wLowHealthAlarm - set 7, [hl] ;enable low health alarm + set BIT_LOW_HEALTH_ALARM, [hl] ret DrawEnemyHUDAndHPBar: @@ -2121,7 +2121,7 @@ DisplayBattleMenu:: ld a, D_LEFT | A_BUTTON ld [hli], a ; wMenuWatchedKeys call HandleMenuInput - bit 5, a ; check if left was pressed + bit BIT_D_LEFT, a jr nz, .leftColumn ; if left was pressed, jump ld a, [wCurrentMenuItem] add $2 ; if we're in the right column, the actual id is +2 @@ -2473,11 +2473,11 @@ MoveSelectionMenu: .writemoves ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ret @@ -2604,10 +2604,10 @@ SelectMenuItem: ld [hl], "▷" .select ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_D_UP, a jp nz, SelectMenuItem_CursorUp bit BIT_D_DOWN, a @@ -2652,7 +2652,7 @@ SelectMenuItem: cp c jr z, .disabled ld a, [wPlayerBattleStatus3] - bit 3, a ; transformed + bit TRANSFORMED, a jr nz, .transformedMoveSelected .transformedMoveSelected ; pointless ; Allow moves copied by Transform to be used. @@ -3850,7 +3850,7 @@ PrintMoveFailureText: .playersTurn ld hl, DoesntAffectMonText ld a, [wDamageMultipliers] - and $7f + and EFFECTIVENESS_MASK jr z, .gotTextToPrint ld hl, AttackMissedText ld a, [wCriticalHitOrOHKO] @@ -5248,7 +5248,7 @@ AdjustDamageForMoveType: ld a, l ld [wDamage + 1], a ld hl, wDamageMultipliers - set 7, [hl] + set BIT_STAB_DAMAGE, [hl] .skipSameTypeAttackBonus ld a, [wMoveType] ld b, a @@ -5271,7 +5271,7 @@ AdjustDamageForMoveType: push bc inc hl ld a, [wDamageMultipliers] - and $80 + and 1 << BIT_STAB_DAMAGE ld b, a ld a, [hl] ; a = damage multiplier ldh [hMultiplier], a diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 6fba347f..95c8706f 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -194,7 +194,7 @@ ExplodeEffect: FreezeBurnParalyzeEffect: xor a ld [wAnimationType], a - call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] + call CheckTargetSubstitute ret nz ; return if they have a substitute, can't effect them ldh a, [hWhoseTurn] and a diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 57d37f01..a8ee6747 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -224,7 +224,7 @@ GainExperience: call CopyData pop hl ld a, [wPlayerBattleStatus3] - bit 3, a ; is the mon transformed? + bit TRANSFORMED, a jr nz, .recalcStatChanges ; the mon is not transformed, so update the unmodified stats ld de, wPlayerMonUnmodifiedLevel diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 5eed1ae5..ccd4e804 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -632,27 +632,27 @@ AICureStatus: ld [hl], a ; clear status in enemy team roster ld [wEnemyMonStatus], a ; clear status of active enemy ld hl, wEnemyBattleStatus3 - res 0, [hl] + res BADLY_POISONED, [hl] ret AIUseXAccuracy: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 0, [hl] + set USING_X_ACCURACY, [hl] ld a, X_ACCURACY jp AIPrintItemUse AIUseGuardSpec: call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 1, [hl] + set PROTECTED_BY_MIST, [hl] ld a, GUARD_SPEC jp AIPrintItemUse AIUseDireHit: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 2, [hl] + set GETTING_PUMPED, [hl] ld a, DIRE_HIT jp AIPrintItemUse diff --git a/engine/events/hidden_objects/pokecenter_pc.asm b/engine/events/hidden_objects/pokecenter_pc.asm index f20f40ed..59867d1a 100644 --- a/engine/events/hidden_objects/pokecenter_pc.asm +++ b/engine/events/hidden_objects/pokecenter_pc.asm @@ -3,7 +3,7 @@ OpenPokemonCenterPC: cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a tx_pre_jump PokemonCenterPCText diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 752899f7..5a7bed7c 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,7 +1,7 @@ ApplyOutOfBattlePoisonDamage: ld a, [wStatusFlags5] assert BIT_SCRIPTED_MOVEMENT_STATE == 7 - add a ; overflows bit 7 into carry flag + add a ; overflows scripted movement state bit into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wPartyCount] and a diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index d848a337..c1ae598e 100644 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -214,7 +214,7 @@ UpdateHPBar_PrintHPNumber: ld [wHPBarTempHP], a push hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .hpBelowBar ld de, $9 jr .next diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 3916c0db..737443a6 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -124,7 +124,7 @@ PrepareOAMData:: inc hl inc e ld a, [hl] - bit 1, a ; is the tile allowed to set the sprite priority bit? + bit BIT_SPRITE_UNDER_GRASS, a jr z, .skipPriority ldh a, [hSpritePriority] or [hl] @@ -132,7 +132,7 @@ PrepareOAMData:: inc hl ld [de], a inc e - bit 0, a ; OAMFLAG_ENDOFDATA + bit BIT_END_OF_OAM_DATA, a jr z, .tileLoop ld a, e diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 91462478..9643412c 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -691,7 +691,7 @@ ItemUseSurfboard: ldh [hSpriteIndex], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ldh a, [hSpriteIndex] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing @@ -1052,13 +1052,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a pop af ld b, a ; store heal amount (1/5 of max HP) @@ -1202,13 +1202,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index a9840268..6f2c050c 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -75,9 +75,9 @@ DisplayTownMap: jr z, .inputLoop ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown xor a ld [wTownMapSpriteBlinkingEnabled], a @@ -196,13 +196,13 @@ LoadTownMap_Fly:: pop hl and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - bit 0, b + bit BIT_A_BUTTON, b jr nz, .pressedA ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown jr .pressedB .pressedA diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index cbb8a358..8ae192b8 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -282,7 +282,7 @@ CableClub_DoBattleOrTradeAgain: call ClearScreen call Delay3 ld hl, wOptions - res 7, [hl] + res BIT_BATTLE_ANIMATION, [hl] predef InitOpponent predef HealParty jp ReturnToCableClubRoom @@ -342,10 +342,10 @@ TradeCenter_SelectMon: ld [wTopMenuItemX], a .enemyMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a jp z, .getNewInput bit BIT_A_BUTTON, a @@ -407,10 +407,10 @@ TradeCenter_SelectMon: call ClearScreenArea .playerMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed jp .getNewInput @@ -489,7 +489,7 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a call HandleMenuInput - bit 4, a ; Right pressed? + bit BIT_D_RIGHT, a jr nz, .selectTradeMenuItem bit BIT_B_BUTTON, a jr z, .displayPlayerMonStats @@ -585,7 +585,7 @@ ReturnToCableClubRoom: ld a, [hl] push af push hl - res 0, [hl] + res BIT_FONT_LOADED, [hl] xor a ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING dec a diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index a89696fb..2ef1cfb1 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -3,7 +3,7 @@ DisplayTextIDInit:: xor a ld [wListMenuID], a ld a, [wAutoTextBoxDrawingControl] - bit 0, a + bit BIT_NO_AUTO_TEXT_BOX, a jr nz, .skipDrawingTextBoxBorder ldh a, [hTextID] and a @@ -31,7 +31,7 @@ DisplayTextIDInit:: call TextBoxBorder .skipDrawingTextBoxBorder ld hl, wFontLoaded - set 0, [hl] + set BIT_FONT_LOADED, [hl] ld hl, wMiscFlags bit BIT_NO_SPRITE_UPDATES, [hl] res BIT_NO_SPRITE_UPDATES, [hl] diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 17d58c55..03b1de6d 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -44,7 +44,7 @@ PKMNLeaguePC: pop af ld [wUpdateSpritesEnabled], a pop hl - res 6, [hl] + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearScreen call RunDefaultPaletteCommand @@ -57,7 +57,7 @@ LeaguePCShowTeam: call LeaguePCShowMon call WaitForTextScrollButtonPress ldh a, [hJoyHeld] - bit 1, a + bit BIT_B_BUTTON, a jr nz, .exit ld hl, wHallOfFame + HOF_MON ld de, wHallOfFame diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 6c8cd6eb..e6388b5f 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -70,12 +70,12 @@ RedrawPartyMenu_:: push hl ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a add hl, bc predef DrawHP2 ; draw HP bar and prints current / max HP ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index 9e1553dd..402275b5 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -50,7 +50,7 @@ PlayerPCMenu: ld hl, WhatDoYouWantText call PrintText call HandleMenuInput - bit 1, a + bit BIT_B_BUTTON, a jp nz, ExitPlayerPC call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 2f61b678..eeb4b9e8 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -66,7 +66,7 @@ LoadSAV0: ld bc, wMainDataEnd - wMainDataStart call CopyData ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] ld hl, sSpriteData ld de, wSpriteDataStart ld bc, wSpriteDataEnd - wSpriteDataStart @@ -349,15 +349,15 @@ ChangeBox:: and a ret nz ; return if No was chosen ld hl, wCurrentBoxNum - bit 7, [hl] ; is it the first time player is changing the box? + bit BIT_HAS_CHANGED_BOXES, [hl] ; is it the first time player is changing the box? call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_B_BUTTON, a ret nz call GetBoxSRAMLocation @@ -366,7 +366,7 @@ ChangeBox:: ld hl, wBoxDataStart call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] - set 7, a + set BIT_HAS_CHANGED_BOXES, a ld [wCurrentBoxNum], a call GetBoxSRAMLocation ld de, wBoxDataStart @@ -448,12 +448,12 @@ DisplayChangeBoxMenu: ld c, 7 call TextBoxBorder ld hl, hUILayoutFlags - set 2, [hl] + set BIT_SINGLE_SPACED_LINES, [hl] ld de, BoxNames hlcoord 13, 1 call PlaceString ld hl, hUILayoutFlags - res 2, [hl] + res BIT_SINGLE_SPACED_LINES, [hl] ld a, [wCurrentBoxNum] and $7f cp 9 diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index 3c1b5233..1c078693 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -227,8 +227,8 @@ DisplayTwoOptionMenu: ld [wMenuWatchMovingOutOfBounds], a push hl ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] + bit BIT_SECOND_MENU_OPTION_DEFAULT, [hl] + res BIT_SECOND_MENU_OPTION_DEFAULT, [hl] jr z, .storeCurrentMenuItem inc a .storeCurrentMenuItem diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 8acbb04f..75c46474 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -162,7 +162,7 @@ LoadMapSpriteTilePatterns: pop de ld b, a ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .skipFirstLoad ; if so, skip loading data into the lower half ld a, b ld b, 0 @@ -183,7 +183,7 @@ LoadMapSpriteTilePatterns: inc d .noCarry3 ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadWhileLCDOn pop af pop hl @@ -268,7 +268,7 @@ InitOutsideMapSprites: call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b, a ; b = spriteSetID ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set ld a, [wSpriteSetID] cp b ; has the sprite set ID changed? diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 1ca24f6a..5f95cf6c 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -57,7 +57,7 @@ UpdatePlayerSprite: .next ld [wSpritePlayerStateData1FacingDirection], a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jr nz, .notMoving .moving ld a, [wMovementFlags] @@ -135,11 +135,11 @@ UpdateNPCSprite: ld l, a inc l ld a, [hl] ; x#SPRITESTATEDATA1_MOVEMENTSTATUS - bit 7, a ; is the face player flag set? + bit BIT_FACE_PLAYER, a jp nz, MakeNPCFacePlayer ld b, a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jp nz, notYetMoving ld a, b cp $2 @@ -412,7 +412,7 @@ MakeNPCFacePlayer: ld a, [wStatusFlags3] bit BIT_NO_NPC_FACE_PLAYER, a jr nz, notYetMoving - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a jr z, .notFacingDown diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index d067345e..58fa1da9 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -16,7 +16,7 @@ FindPathToPlayer: and a jr nz, .stillHasYProgress ldh a, [hFindPathFlags] - set 0, a ; current end of path matches the player's Y coordinate + set BIT_PATH_FOUND_Y, a ldh [hFindPathFlags], a .stillHasYProgress ldh a, [hFindPathXProgress] @@ -27,11 +27,11 @@ FindPathToPlayer: and a jr nz, .stillHasXProgress ldh a, [hFindPathFlags] - set 1, a ; current end of path matches the player's X coordinate + set BIT_PATH_FOUND_X, a ldh [hFindPathFlags], a .stillHasXProgress ldh a, [hFindPathFlags] - cp $3 ; has the end of the path reached the player's position? + cp (1 << BIT_PATH_FOUND_X) | (1 << BIT_PATH_FOUND_Y) jr z, .done ; Compare whether the X distance between the player and the current of the path ; is greater or if the Y distance is. Then, try to reduce whichever is greater. @@ -40,7 +40,7 @@ FindPathToPlayer: jr c, .yDistanceGreater ; x distance is greater ldh a, [hNPCPlayerRelativePosFlags] - bit 1, a + bit BIT_PLAYER_LOWER_X, a jr nz, .playerIsLeftOfNPC ld d, NPC_MOVEMENT_RIGHT jr .next1 @@ -53,7 +53,7 @@ FindPathToPlayer: jr .storeDirection .yDistanceGreater ldh a, [hNPCPlayerRelativePosFlags] - bit 0, a + bit BIT_PLAYER_LOWER_Y, a jr nz, .playerIsAboveNPC ld d, NPC_MOVEMENT_DOWN jr .next2 @@ -97,15 +97,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCNorthOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - set 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + set BIT_PLAYER_LOWER_Y, [hl] pop hl jr .divideYDistance .NPCSouthOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - res 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + res BIT_PLAYER_LOWER_Y, [hl] pop hl .divideYDistance push hl @@ -125,15 +125,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCWestOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - set 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + set BIT_PLAYER_LOWER_X, [hl] pop hl jr .divideXDistance .NPCEastOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - res 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + res BIT_PLAYER_LOWER_X, [hl] pop hl .divideXDistance ldh [hDividend2], a diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index ff481439..1773e818 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -18,7 +18,7 @@ TryPushingBoulder:: swap a ld e, a add hl, de - res 7, [hl] + res BIT_FACE_PLAYER, [hl] call GetSpriteMovementByte2Pointer ld a, [hl] cp BOULDER_MOVEMENT_BYTE_2 diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 303415c1..b20d490e 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -52,7 +52,7 @@ LoadSpecialWarpData: bit BIT_DEBUG_MODE, a ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug jr nz, .notNewGameWarp - bit 2, a + bit BIT_FLY_OR_DUNGEON_WARP, a jr nz, .notNewGameWarp ld hl, NewGameWarp .copyWarpData diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 2df9964e..819466a5 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -127,11 +127,11 @@ TryingToLearn: hlcoord 6, 8 ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ld hl, wTopMenuItemY ld a, 8 @@ -147,10 +147,10 @@ TryingToLearn: ld [hli], a ; wMenuWatchedKeys ld [hl], 0 ; wLastMenuItem ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] push af call LoadScreenTilesFromBuffer1 pop af diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 8d377f79..447db8fd 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -41,7 +41,7 @@ DrawHP_: call DrawHPBar pop hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar jr .printFraction diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 649f634c..1ed24a1a 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -1,8 +1,9 @@ PromptUserToPlaySlots: call SaveScreenTilesToBuffer2 - ld a, BANK(DisplayTextIDInit) ; TRUE - ld [wAutoTextBoxDrawingControl], a - ld b, a + ld a, BANK(DisplayTextIDInit) + assert BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX + ld [wAutoTextBoxDrawingControl], a ; 1 << BIT_NO_AUTO_TEXT_BOX + ld b, a ; BANK(DisplayTextIDInit) ld hl, DisplayTextIDInit call Bankswitch ld hl, PlaySlotMachineText @@ -173,7 +174,7 @@ OneMoreGoSlotMachineText: SlotMachine_SetFlags: ld hl, wSlotMachineFlags - bit 7, [hl] + bit BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret nz ld a, [wSlotMachineAllowMatchesCounter] and a @@ -191,14 +192,14 @@ SlotMachine_SetFlags: ld [hl], 0 ret .allowMatches - set 6, [hl] + set BIT_SLOTS_CAN_WIN, [hl] ret .setAllowMatchesCounter ld a, 60 ld [wSlotMachineAllowMatchesCounter], a ret .allowSevenAndBarMatches - set 7, [hl] + set BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret SlotMachine_SpinWheels: @@ -289,7 +290,7 @@ SlotMachine_StopWheel1Early: call SlotMachine_GetWheel1Tiles ld hl, wSlotMachineWheel1BottomTile ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if the middle symbol is not a cherry. inc hl @@ -317,7 +318,7 @@ SlotMachine_StopWheel1Early: SlotMachine_StopWheel2Early: call SlotMachine_GetWheel2Tiles ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if any symbols are lined up in the first two wheels. call SlotMachine_FindWheel1Wheel2Matches @@ -401,7 +402,7 @@ SlotMachine_CheckForMatches: call SlotMachine_CheckForMatch jr z, .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .noMatch ld hl, wSlotMachineRerollCounter dec [hl] @@ -421,9 +422,9 @@ SlotMachine_CheckForMatches: jp SlotMachine_CheckForMatches .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .acceptMatch ; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel ld a, [hl] @@ -599,7 +600,7 @@ SlotReward300Func: call PlaySound call Random cp $80 - ld a, $0 + ld a, 0 jr c, .skip ld [wSlotMachineFlags], a .skip @@ -654,7 +655,7 @@ SlotMachine_PrintPayoutCoins: jp PrintNumber SlotMachine_PayCoinsToPlayer: - ld a, $1 + ld a, TRUE ld [wMuteAudioAndPauseMusic], a call WaitForSoundToFinish diff --git a/home/map_objects.asm b/home/map_objects.asm index 342139dd..e200238a 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -227,7 +227,7 @@ SetSpriteMovementBytesToFF:: ; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl GetSpriteMovementByte1Pointer:: - ld h, $C2 + ld h, HIGH(wSpriteStateData2) ldh a, [hSpriteIndex] swap a add 6 diff --git a/home/overworld.asm b/home/overworld.asm index 1595fdf0..e43ebc81 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -121,7 +121,7 @@ OverworldLoopLessDelay:: ld a, [wCurMap] call SwitchToMapRomBank ; switch to the ROM bank of the current map ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] .changeMap jp EnterMap .checkForOpponent @@ -879,10 +879,10 @@ LoadTilesetTilePatternData:: ld a, [wTilesetBank] jp FarCopyData2 -; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 +; this loads the current map's complete tile map (which references blocks, not individual tiles) to wOverworldMap ; it can also load partial tile maps of connected maps into a border of length 3 around the current map LoadTileBlockMap:: -; fill C6E8-CBFB with the background tile +; fill wOverworldMap-wOverworldMapEnd with the background tile ld hl, wOverworldMap ld a, [wMapBackgroundTile] ld d, a @@ -1210,7 +1210,7 @@ IsSpriteInFrontOfPlayer2:: and $f0 inc a ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS - set 7, [hl] ; set flag to make the sprite face the player + set BIT_FACE_PLAYER, [hl] ld a, e ldh [hTextID], a ret @@ -1303,7 +1303,7 @@ CheckForTilePairCollisions:: ld a, [wTileInFrontOfPlayer] ld c, a .tilePairCollisionLoop - ld a, [wCurMapTileset] ; tileset number + ld a, [wCurMapTileset] ld b, a ld a, [hli] cp $ff @@ -1943,7 +1943,7 @@ CollisionCheckOnWater:: call PlayDefaultMusic jr .noCollision .checkIfVermilionDockTileset - ld a, [wCurMapTileset] ; tileset + ld a, [wCurMapTileset] cp SHIP_PORT ; Vermilion Dock tileset jr nz, .noCollision ; keep surfing if it's not the boarding platform tile jr .stopSurfing ; if it is the boarding platform tile, stop surfing @@ -2015,10 +2015,10 @@ LoadMapHeader:: call SwitchToMapRomBank ld a, [wCurMapTileset] ld b, a - res 7, a + res BIT_NO_PREVIOUS_MAP, a ld [wCurMapTileset], a ldh [hPreviousTileset], a - bit 7, b + bit BIT_NO_PREVIOUS_MAP, b ret nz ld hl, MapHeaderPointers ld a, [wCurMap] @@ -2203,9 +2203,9 @@ LoadMapHeader:: ld [hl], a ; store text ID in byte 1 of sprite entry pop hl ldh a, [hLoadSpriteTemp1] - bit 6, a + bit BIT_TRAINER, a jr nz, .trainerSprite - bit 7, a + bit BIT_ITEM, a jr nz, .itemBallSprite jr .regularSprite .trainerSprite diff --git a/home/predef_text.asm b/home/predef_text.asm index bdecd3cf..61e22fce 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -3,7 +3,7 @@ PrintPredefTextID:: ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag - set 0, [hl] + set BIT_TEXT_PREDEF, [hl] call DisplayTextID RestoreMapTextPointer:: diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 38aedd3c..57ec12a8 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -13,12 +13,12 @@ ; their meaning at the beginning of the functions's execution. PrintBCDNumber:: ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b + res BIT_LEADING_ZEROES, c + res BIT_LEFT_ALIGN, c + res BIT_MONEY_SIGN, c ; c now holds the length + bit BIT_MONEY_SIGN, b jr z, .loop - bit 7, b + bit BIT_LEADING_ZEROES, b jr nz, .loop ld [hl], "¥" inc hl @@ -31,14 +31,14 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit 7, b ; were any non-zero digits printed? + bit BIT_LEADING_ZEROES, b jr z, .done ; if so, we are done .numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space .skipRightAlignmentAdjustment - bit 5, b + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl @@ -54,24 +54,24 @@ PrintBCDDigit:: and a jr z, .zeroDigit .nonzeroDigit - bit 7, b ; have any non-space characters been printed? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl - res 5, b + res BIT_MONEY_SIGN, b .skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached + res BIT_LEADING_ZEROES, b .outputDigit add "0" ld [hli], a jp PrintLetterDelay .zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b ret nz inc hl ; if right-aligned, "print" a space by advancing the pointer ret diff --git a/home/reload_sprites.asm b/home/reload_sprites.asm index 8a08d64d..5cf5d458 100644 --- a/home/reload_sprites.asm +++ b/home/reload_sprites.asm @@ -4,7 +4,7 @@ ReloadMapSpriteTilePatterns:: ld hl, wFontLoaded ld a, [hl] push af - res 0, [hl] + res BIT_FONT_LOADED, [hl] push hl xor a ld [wSpriteSetID], a diff --git a/home/text.asm b/home/text.asm index dc78b982..da884125 100644 --- a/home/text.asm +++ b/home/text.asm @@ -63,7 +63,7 @@ PlaceNextChar:: jr nz, .NotNext ld bc, 2 * SCREEN_WIDTH ldh a, [hUILayoutFlags] - bit 2, a + bit BIT_SINGLE_SPACED_LINES, a jr z, .ok ld bc, SCREEN_WIDTH .ok diff --git a/home/text_script.asm b/home/text_script.asm index d367683d..c1606371 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -6,8 +6,8 @@ DisplayTextID:: push af farcall DisplayTextIDInit ; initialization ld hl, wTextPredefFlag - bit 0, [hl] - res 0, [hl] + bit BIT_TEXT_PREDEF, [hl] + res BIT_TEXT_PREDEF, [hl] jr nz, .skipSwitchToMapBank ld a, [wCurMap] call SwitchToMapRomBank @@ -128,7 +128,7 @@ CloseTextDisplay:: ld [MBC1RomBank], a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded - res 0, [hl] + res BIT_FONT_LOADED, [hl] ld a, [wStatusFlags6] bit BIT_FLY_WARP, a call z, LoadPlayerSpriteGraphics diff --git a/home/window.asm b/home/window.asm index 01b52d41..48ab1d0e 100644 --- a/home/window.asm +++ b/home/window.asm @@ -137,12 +137,12 @@ PlaceMenuCursor:: jr z, .checkForArrow1 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced1 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getOldMenuItemScreenPosition .doubleSpaced1 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getOldMenuItemScreenPosition pop af .oldMenuItemLoop @@ -163,12 +163,12 @@ PlaceMenuCursor:: jr z, .checkForArrow2 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced2 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getCurrentMenuItemScreenPosition .doubleSpaced2 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getCurrentMenuItemScreenPosition pop af .currentMenuItemLoop @@ -272,7 +272,7 @@ EnableAutoTextBoxDrawing:: jr AutoTextBoxDrawingCommon DisableAutoTextBoxDrawing:: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX AutoTextBoxDrawingCommon:: ld [wAutoTextBoxDrawingControl], a diff --git a/ram/hram.asm b/ram/hram.asm index e7c3ef3c..1be1dab6 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -388,6 +388,7 @@ hClearLetterPrintingDelayFlags:: db ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced +; bit 2: text is single spaced hUILayoutFlags:: db hFieldMoveMonMenuTopMenuItemX:: db diff --git a/scripts/CeruleanBadgeHouse.asm b/scripts/CeruleanBadgeHouse.asm index b1f6db7f..54186523 100644 --- a/scripts/CeruleanBadgeHouse.asm +++ b/scripts/CeruleanBadgeHouse.asm @@ -1,5 +1,5 @@ CeruleanBadgeHouse_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a dec a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 600c03c7..465c72f8 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -1,5 +1,5 @@ Museum1F_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 89d6ef80..71704c5b 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -1,7 +1,7 @@ OaksLab_Script: CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2 call nz, OaksLabLoadTextPointers2Script - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/PewterMart.asm b/scripts/PewterMart.asm index 0a5baac2..49a91977 100644 --- a/scripts/PewterMart.asm +++ b/scripts/PewterMart.asm @@ -1,6 +1,6 @@ PewterMart_Script: call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a ret diff --git a/scripts/SSAnne2FRooms.asm b/scripts/SSAnne2FRooms.asm index e7b88b3f..3358759d 100644 --- a/scripts/SSAnne2FRooms.asm +++ b/scripts/SSAnne2FRooms.asm @@ -1,5 +1,5 @@ SSAnne2FRooms_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a -- cgit v1.3.1-sl0p