diff options
| author | dannye <33dannye@gmail.com> | 2024-09-25 00:45:00 -0500 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2024-09-25 00:45:00 -0500 |
| commit | a02a98ee7ada1a658e28698484058be2796dc0df (patch) | |
| tree | 945986054565bd8b5212fc755415096050d1d3a8 /engine/events | |
| parent | Use long option flags for rgbgfx, same as tools/gfx (diff) | |
| parent | Use `const_skip` (diff) | |
| download | pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.gz pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.xz pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.zip | |
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/events')
28 files changed, 127 insertions, 130 deletions
diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm index 6d3d91b8..2a74125a 100644 --- a/engine/events/black_out.asm +++ b/engine/events/black_out.asm @@ -10,7 +10,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wNPCMovementScriptFunctionNum], a ldh [hJoyHeld], a ld [wNPCMovementScriptPointerTableNum], a - ld [wFlags_0xcd60], a + ld [wMiscFlags], a ldh [hMoney], a ldh [hMoney + 1], a @@ -39,10 +39,10 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wPlayerMoney + 2], a .lostmoney - ld hl, wd732 - set 2, [hl] - res 3, [hl] - set 6, [hl] - ld a, %11111111 + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a predef_jump HealParty diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index 10de5ed2..d8f4e773 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -28,7 +28,7 @@ PrintCardKeyText: xor a ld [wPlayerMovingDirection], a tx_pre_id CardKeySuccessText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call PrintPredefTextID call GetCoordsInFrontOfPlayer srl d @@ -50,12 +50,12 @@ PrintCardKeyText: ld [wNewTileBlockID], a predef ReplaceTileBlock ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SFX_GO_INSIDE jp PlaySound .noCardKey tx_pre_id CardKeyFailText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp PrintPredefTextID INCLUDE "data/events/card_key_maps.asm" diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 545baf13..d8066fb8 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -1,6 +1,6 @@ GiveFossilToCinnabarLab:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wCurrentMenuItem], a ld a, A_BUTTON | B_BUTTON @@ -24,8 +24,8 @@ GiveFossilToCinnabarLab:: call TextBoxBorder call UpdateSprites call PrintFossilsInBag - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .cancelledGivingFossil @@ -98,13 +98,13 @@ PrintFossilsInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] ld bc, SCREEN_WIDTH * 2 call AddNTimes - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld hl, hItemCounter inc [hl] @@ -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/diploma.asm b/engine/events/diploma.asm index a5a007fa..67837475 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -4,12 +4,12 @@ DisplayDiploma:: call ClearScreen xor a ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] callfar _DisplayDiploma call WaitForTextScrollButtonPress - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ReloadTilesetTilePatterns call RestoreScreenTilesAndReloadTilePatterns diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index d657ea85..46b45d77 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -1,14 +1,14 @@ _DisplayPokedex:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] predef ShowPokedexData - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call ReloadMapData ld c, 10 call DelayFrames predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 004893a0..1c7221bc 100644 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -1,12 +1,12 @@ DisplayElevatorFloorMenu: - ld hl, wd730 + ld hl, wStatusFlags5 ld a, [hl] push af - set 6, [hl] + set BIT_NO_TEXT_DELAY, [hl] ld hl, WhichFloorText call PrintText pop af - ld [wd730], a + ld [wStatusFlags5], a ld hl, wItemList ld a, l ld [wListPointer], a @@ -26,7 +26,7 @@ DisplayElevatorFloorMenu: ld [wListScrollOffset], a ret c ld hl, wCurrentMapScriptFlags - set 7, [hl] + set BIT_CUR_MAP_USED_ELEVATOR, [hl] ld hl, wElevatorWarpMaps ld a, [wWhichPokemon] add a diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm index 00c642bb..e33d5165 100644 --- a/engine/events/give_pokemon.asm +++ b/engine/events/give_pokemon.asm @@ -13,7 +13,7 @@ _GivePokemon:: ; add to box xor a ld [wEnemyBattleStatus3], a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wEnemyMonSpecies2], a callfar LoadEnemyMonData call SetPokedexOwnedFlag @@ -54,18 +54,18 @@ _GivePokemon:: ret SetPokedexOwnedFlag: - ld a, [wcf91] + 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 b26bc90f..8bf162a7 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -37,10 +37,10 @@ HealParty: ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, wcd6d + ld de, wMoveData ld a, BANK(Moves) call FarCopyData - ld a, [wcd6d + 5] ; PP is byte 5 of move data + ld a, [wMoveData + MOVE_PP] pop bc pop de @@ -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 63b95bcf..62c40ce4 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/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index 1299ac23..cd3827ea 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -80,8 +80,8 @@ BillsHousePokemonList:: ld a, 1 ld [wTopMenuItemX], a .billsPokemonLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 lb bc, 10, 9 call TextBoxBorder @@ -110,8 +110,8 @@ BillsHousePokemonList:: call LoadScreenTilesFromBuffer2 jr .billsPokemonLoop .cancel - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer2 jp TextScriptEnd diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index 6a45c2be..f5a2db44 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -94,7 +94,7 @@ CinnabarGymQuiz_AskQuestion: cp c jr nz, .wrongAnswer ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ldh a, [hGymGateIndex] ldh [hBackupGymGateIndex], a ld hl, CinnabarGymQuizCorrectText diff --git a/engine/events/hidden_objects/fanclub_pictures.asm b/engine/events/hidden_objects/fanclub_pictures.asm index 30bc72c7..2a3db4bc 100644 --- a/engine/events/hidden_objects/fanclub_pictures.asm +++ b/engine/events/hidden_objects/fanclub_pictures.asm @@ -1,6 +1,6 @@ FanClubPicture1: ld a, RAPIDASH - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre FanClubPicture1Text @@ -12,7 +12,7 @@ FanClubPicture1Text:: FanClubPicture2: ld a, FEAROW - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre FanClubPicture2Text diff --git a/engine/events/hidden_objects/indigo_plateau_statues.asm b/engine/events/hidden_objects/indigo_plateau_statues.asm index 23e94fcf..f78a5a72 100644 --- a/engine/events/hidden_objects/indigo_plateau_statues.asm +++ b/engine/events/hidden_objects/indigo_plateau_statues.asm @@ -3,7 +3,7 @@ IndigoPlateauStatues:: ld hl, IndigoPlateauStatuesText1 call PrintText ld a, [wXCoord] - bit 0, a + bit 0, a ; even or odd? ld hl, IndigoPlateauStatuesText2 jr nz, .ok ld hl, IndigoPlateauStatuesText3 diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index 539f2c3f..9e02aeba 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -1,6 +1,6 @@ AerodactylFossil: ld a, FOSSIL_AERODACTYL - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre AerodactylFossilText @@ -12,7 +12,7 @@ AerodactylFossilText:: KabutopsFossil: ld a, FOSSIL_KABUTOPS - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre KabutopsFossilText diff --git a/engine/events/hidden_objects/museum_fossils2.asm b/engine/events/hidden_objects/museum_fossils2.asm index d8090e0a..240b7ece 100644 --- a/engine/events/hidden_objects/museum_fossils2.asm +++ b/engine/events/hidden_objects/museum_fossils2.asm @@ -1,6 +1,5 @@ DisplayMonFrontSpriteInBox: ; Displays a pokemon's front sprite in a pop-up window. -; [wcf91] = pokemon internal id number ld a, 1 ldh [hAutoBGTransferEnabled], a call Delay3 @@ -11,8 +10,8 @@ DisplayMonFrontSpriteInBox: ld [wTextBoxID], a call DisplayTextBoxID call UpdateSprites - ld a, [wcf91] - ld [wd0b5], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetMonHeader ld de, vChars1 tile $31 call LoadMonFrontSprite 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/hidden_objects/route_15_binoculars.asm b/engine/events/hidden_objects/route_15_binoculars.asm index 9734e833..a9b8ca37 100644 --- a/engine/events/hidden_objects/route_15_binoculars.asm +++ b/engine/events/hidden_objects/route_15_binoculars.asm @@ -5,7 +5,7 @@ Route15GateLeftBinoculars: call EnableAutoTextBoxDrawing tx_pre Route15UpstairsBinocularsText ld a, ARTICUNO - ld [wcf91], a + ld [wCurPartySpecies], a call PlayCry call DisplayMonFrontSpriteInBox xor a diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index e7d1a729..7fd59ea9 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -40,7 +40,7 @@ SafariZoneGameOver: cp SFX_SAFARI_ZONE_PA jr nz, .waitForMusicToPlay ld a, TEXT_SAFARI_GAME_OVER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wPlayerMovingDirection], a diff --git a/engine/events/hidden_objects/school_blackboard.asm b/engine/events/hidden_objects/school_blackboard.asm index e1cf1312..c40530a6 100644 --- a/engine/events/hidden_objects/school_blackboard.asm +++ b/engine/events/hidden_objects/school_blackboard.asm @@ -24,8 +24,8 @@ LinkCableHelp:: ld a, 1 ld [wTopMenuItemX], a .linkHelpLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 lb bc, 8, 13 call TextBoxBorder @@ -40,8 +40,8 @@ LinkCableHelp:: ld a, [wCurrentMenuItem] cp 3 ; pressed a on "STOP READING" jr z, .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, LinkCableInfoTexts add a ld d, 0 @@ -53,8 +53,8 @@ LinkCableHelp:: call PrintText jp .linkHelpLoop .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd @@ -107,8 +107,8 @@ ViridianSchoolBlackboard:: ld a, 1 ld [wTopMenuItemX], a .blackboardLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 lb bc, 6, 10 call TextBoxBorder @@ -157,8 +157,8 @@ ViridianSchoolBlackboard:: jr z, .exitBlackboard ; we must have pressed a on a status condition ; so print the text - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, ViridianBlackboardStatusPointers add a ld d, 0 @@ -170,8 +170,8 @@ ViridianSchoolBlackboard:: call PrintText jp .blackboardLoop .exitBlackboard - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd diff --git a/engine/events/hidden_objects/town_map.asm b/engine/events/hidden_objects/town_map.asm index 4284214f..11f7cbc7 100644 --- a/engine/events/hidden_objects/town_map.asm +++ b/engine/events/hidden_objects/town_map.asm @@ -4,8 +4,8 @@ TownMapText:: text_asm ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 xor a ldh [hWY], a @@ -13,8 +13,8 @@ TownMapText:: ldh [hAutoBGTransferEnabled], a call LoadFontTilePatterns farcall DisplayTownMap - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld de, TextScriptEnd push de ldh a, [hLoadedROMBank] diff --git a/engine/events/hidden_objects/vermilion_gym_trash.asm b/engine/events/hidden_objects/vermilion_gym_trash.asm index 21dd3ee0..428746f7 100644 --- a/engine/events/hidden_objects/vermilion_gym_trash.asm +++ b/engine/events/hidden_objects/vermilion_gym_trash.asm @@ -61,7 +61,7 @@ GymTrashScript: ; Completed the trash can puzzle. SetEvent EVENT_2ND_LOCK_OPENED ld hl, wCurrentMapScriptFlags - set 6, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] tx_pre_id VermilionGymTrashSuccessText3 diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 1b7d2678..7ba5fe51 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -69,9 +69,9 @@ DoInGameTradeDialogue: ; copies name of species a to hl InGameTrade_GetMonName: push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName - ld hl, wcd6d + ld hl, wNameBuffer pop de ld bc, NAME_LENGTH jp CopyData @@ -91,7 +91,7 @@ InGameTrade_DoTrade: jp c, .tradeFailed ; jump if the player didn't select a pokemon ld a, [wInGameTradeGiveMonSpecies] ld b, a - ld a, [wcf91] + ld a, [wCurPartySpecies] cp b ld a, $2 jr nz, .tradeFailed ; jump if the selected mon's species is not the required one @@ -100,24 +100,24 @@ InGameTrade_DoTrade: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld b, FLAG_SET call InGameTrade_FlagActionPredef ld hl, ConnectCableText call PrintText ld a, [wWhichPokemon] push af - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] push af call LoadHpBarAndStatusTilePatterns call InGameTrade_PrepareTradeData predef InternalClockTradeAnim pop af - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop af ld [wWhichPokemon], a ld a, [wInGameTradeReceiveMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a xor a ld [wMonDataLocation], a ; not used ld [wRemoveMonFromBox], a diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 548db5be..8fbdcfa2 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -1,7 +1,7 @@ PickUpItem: call EnableAutoTextBoxDrawing - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld b, a ld hl, wMissableObjectList .missableObjectsListLoop @@ -18,7 +18,7 @@ PickUpItem: ldh [hMissableObjectIndex], a ld hl, wMapSpriteExtraData - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] dec a add a ld d, 0 diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 9f3ad391..3b0acbe4 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,12 +1,13 @@ ApplyOutOfBattlePoisonDamage: - ld a, [wd730] - add a + ld a, [wStatusFlags5] + assert BIT_SCRIPTED_MOVEMENT_STATE == 7 + add a ; overflows scripted movement state bit into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wd492] bit 7, a jp nz, .noBlackOut - ld a, [wd72e] - bit 6, a + ld a, [wStatusFlags4] + bit BIT_LINK_CONNECTED, a jp nz, .noBlackOut ld a, [wPartyCount] and a @@ -50,7 +51,7 @@ ApplyOutOfBattlePoisonDamage: inc hl ld [hl], a ld a, [de] - ld [wd11e], a + ld [wPokedexNum], a push de ld a, [wWhichPokemon] ld hl, wPartyMonNicks @@ -59,7 +60,7 @@ ApplyOutOfBattlePoisonDamage: ld [wJoyIgnore], a call EnableAutoTextBoxDrawing ld a, TEXT_MON_FAINTED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID callfar IsThisPartymonStarterPikachu_Party jr nc, .curMonNotPlayerPikachu @@ -112,10 +113,10 @@ ApplyOutOfBattlePoisonDamage: jr nz, .noBlackOut call EnableAutoTextBoxDrawing ld a, TEXT_BLACKED_OUT - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID - ld hl, wd72e - set 5, [hl] + ld hl, wStatusFlags4 + set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, $ff jr .done .noBlackOut diff --git a/engine/events/pokecenter.asm b/engine/events/pokecenter.asm index e007030a..820be66a 100644 --- a/engine/events/pokecenter.asm +++ b/engine/events/pokecenter.asm @@ -11,10 +11,10 @@ DisplayPokemonCenterDialogue_:: call SaveScreenTilesToBuffer1 ; save screen ld hl, PokemonCenterWelcomeText call PrintText - ld hl, wd72e - bit 2, [hl] - set 1, [hl] - set 2, [hl] + ld hl, wStatusFlags4 + bit BIT_USED_POKECENTER, [hl] + set BIT_UNKNOWN_4_1, [hl] + set BIT_USED_POKECENTER, [hl] jr nz, .skipShallWeHealYourPokemon ld hl, ShallWeHealYourPokemonText call PrintText diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index a1d69c72..b280c711 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -72,7 +72,7 @@ DisplayPokemartDialogue_:: ld a, [wIsKeyItem] and a jr nz, .unsellableItem - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM jr c, .unsellableItem ld a, PRICEDITEMLISTMENU @@ -156,8 +156,8 @@ DisplayPokemartDialogue_:: call DisplayChooseQuantityMenu inc a jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button - ld a, [wcf91] ; item ID - ld [wd11e], a ; store item ID for GetItemName + ld a, [wCurItem] + 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 47bb1062..a365f45f 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -5,8 +5,8 @@ CeladonPrizeMenu:: ld hl, RequireCoinCaseTextPtr jp PrintText .havingCoinCase - ld hl, wd730 - set 6, [hl] ; disable letter-printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld hl, ExchangeCoinsForPrizesTextPtr call PrintText ; the following are the menu settings @@ -37,8 +37,8 @@ CeladonPrizeMenu:: jr z, .noChoice call HandlePrizeChoice .noChoice - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret RequireCoinCaseTextPtr: @@ -55,17 +55,14 @@ WhichPrizeTextPtr: text_end GetPrizeMenuId: -; determine which one among the three -; prize-texts has been selected -; using the text ID (stored in [hSpriteIndexOrTextID]) -; load the three prizes at wd13d-wd13f -; load the three prices at wd141-wd146 -; display the three prizes' names -; (distinguishing between Pokemon names -; and Items (specifically TMs) names) - ldh a, [hSpriteIndexOrTextID] - sub 3 ; prize-texts' id are 3, 4 and 5 - ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) +; determine which one among the three prize texts has been selected using the text ID (stored in [hTextID]) +; prize texts' IDs are TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1-TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3 +; load the three prizes at wPrize1-wPrice3 +; load the three prices at wPrize1Price-wPrize3Price +; display the three prizes' names, distinguishing between Pokemon names and item names (specifically TMs) + ldh a, [hTextID] + sub TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 + ld [wWhichPrizeWindow], a ; prize texts' relative ID (i.e. 0-2) add a add a ld d, 0 @@ -87,37 +84,37 @@ GetPrizeMenuId: ld bc, 6 call CopyData ld a, [wWhichPrizeWindow] - cp 2 ;is TM_menu? + 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 @@ -193,7 +190,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 @@ -212,9 +209,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 @@ -222,8 +219,8 @@ HandlePrizeChoice: jr nc, .bagFull jr .subtractCoins .giveMon - ld a, [wd11e] - ld [wcf91], a + ld a, [wNamedObjectIndex] + ld [wCurPartySpecies], a push af call GetPrizeMonLevel ld c, a @@ -288,7 +285,7 @@ OhFineThenTextPtr: text_end GetPrizeMonLevel: - ld a, [wcf91] + ld a, [wCurPartySpecies] ld b, a ld hl, PrizeMonLevelDictionary .loop @@ -299,7 +296,7 @@ GetPrizeMonLevel: jr .loop .matchFound ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ret INCLUDE "data/events/prize_mon_levels.asm" diff --git a/engine/events/vending_machine.asm b/engine/events/vending_machine.asm index 68dfadfb..bfe32ef6 100644 --- a/engine/events/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -15,8 +15,8 @@ VendingMachineMenu:: ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 3 lb bc, 8, 12 call TextBoxBorder @@ -27,8 +27,8 @@ VendingMachineMenu:: hlcoord 9, 6 ld de, DrinkPriceText call PlaceString - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .notThirsty |
