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/pokemon | |
| 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/pokemon')
| -rw-r--r-- | engine/pokemon/add_mon.asm | 40 | ||||
| -rw-r--r-- | engine/pokemon/bills_pc.asm | 26 | ||||
| -rw-r--r-- | engine/pokemon/evos_moves.asm | 80 | ||||
| -rw-r--r-- | engine/pokemon/experience.asm | 2 | ||||
| -rw-r--r-- | engine/pokemon/learn_move.asm | 12 | ||||
| -rw-r--r-- | engine/pokemon/load_mon_data.asm | 10 | ||||
| -rw-r--r-- | engine/pokemon/set_types.asm | 6 | ||||
| -rw-r--r-- | engine/pokemon/status_screen.asm | 26 |
8 files changed, 101 insertions, 101 deletions
diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index c498f02a..a0b1ef0a 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -21,7 +21,7 @@ _AddPartyMon:: jr nc, .noCarry inc d .noCarry - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [de], a ; write species of new mon in party list inc de ld a, $ff ; terminator @@ -64,8 +64,8 @@ _AddPartyMon:: ld e, l ld d, h push hl - ld a, [wcf91] - ld [wd0b5], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHeader ld a, [hli] @@ -80,20 +80,20 @@ _AddPartyMon:: jr nz, .next4 ; If the mon is being added to the player's party, update the pokedex. - ld a, [wcf91] - ld [wd11e], a + ld a, [wCurPartySpecies] + ld [wPokedexNum], a push de predef IndexToPokedex pop de - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST ld hl, wPokedexOwned call FlagAction ld a, c ; whether the mon was already flagged as owned - ld [wUnusedD153], a ; not read - ld a, [wd11e] + ld [wUnusedAlreadyOwnedFlag], a + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -170,7 +170,7 @@ _AddPartyMon:: inc de ld a, [hli] ; catch rate (held item in gen 2) ld [de], a - ld a, [wcf91] + ld a, [wCurPartySpecies] cp KADABRA jr nz, .notKadabra ld a, TWISTEDSPOON_GSC @@ -205,7 +205,7 @@ _AddPartyMon:: inc de ld [de], a push de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld d, a callfar CalcExperience pop de @@ -230,7 +230,7 @@ _AddPartyMon:: pop hl call AddPartyMon_WriteMovePP inc de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld [de], a inc de ld a, [wIsInBattle] @@ -267,13 +267,13 @@ AddPartyMon_WriteMovePP: ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, wcd6d + ld de, wMoveData ld a, BANK(Moves) call FarCopyData pop bc pop de pop hl - ld a, [wcd6d + 5] ; PP is byte 5 of move data + ld a, [wMoveData + MOVE_PP] .empty inc de ld [de], a @@ -281,7 +281,7 @@ AddPartyMon_WriteMovePP: jr nz, .pploop ; there are still moves to read ret -; adds enemy mon [wcf91] (at position [wWhichPokemon] in enemy list) to own party +; adds enemy mon [wCurPartySpecies] (at position [wWhichPokemon] in enemy list) to own party ; used in the cable club trade center _AddEnemyMonToPlayerParty:: ld hl, wPartyCount @@ -294,7 +294,7 @@ _AddEnemyMonToPlayerParty:: ld c, a ld b, $0 add hl, bc - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [hli], a ; add mon as last list entry ld [hl], $ff ; write new sentinel ld hl, wPartyMons @@ -328,10 +328,10 @@ _AddEnemyMonToPlayerParty:: call SkipFixedLengthTextEntries ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) - ld a, [wcf91] - ld [wd11e], a + ld a, [wCurPartySpecies] + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -377,7 +377,7 @@ _MoveMon:: cp DAYCARE_TO_PARTY ld a, [wDayCareMon] jr z, .copySpecies - ld a, [wcf91] + ld a, [wCurPartySpecies] .copySpecies ld [hli], a ; write new mon ID ld [hl], $ff ; write new sentinel @@ -506,7 +506,7 @@ _MoveMon:: call LoadMonData farcall CalcLevelFromExperience ld a, d - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 6901ef46..bfa86cff 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -90,8 +90,8 @@ PKMNLeaguePCText: db "<PKMN>LEAGUE@" LogOffPCText: db "LOG OFF@" BillsPC_:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wParentMenuItem], a inc a ; MONSTER_NAME @@ -99,8 +99,8 @@ BillsPC_:: call LoadHpBarAndStatusTilePatterns ld a, [wListScrollOffset] push af - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, BillsPCMenu ; accessing it directly ld a, SFX_TURN_ON_PC @@ -185,8 +185,8 @@ BillsPCMenu: jp z, BillsPCPrintBox ExitBillsPC: - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, .next ; accessing it directly call LoadTextBoxTilePatterns @@ -194,13 +194,13 @@ ExitBillsPC: call PlaySound call WaitForSoundToFinish .next - ld hl, wFlags_0xcd60 - res 5, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 pop af ld [wListScrollOffset], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret BillsPCPrintBox: @@ -241,7 +241,7 @@ BillsPCDeposit: callfar PlayPikachuSoundClip jr .asm_215cf .asm_215c9 - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry .asm_215cf callabd_ModifyPikachuHappiness PIKAHAPPY_DEPOSITED @@ -304,7 +304,7 @@ BillsPCWithdraw: callfar PlayPikachuSoundClip jr .asm_21666 .asm_21660 - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry .asm_21666 xor a ; BOX_TO_PARTY @@ -341,7 +341,7 @@ BillsPCRelease: ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry ld hl, MonWasReleasedText call PrintText diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 4536453e..19250ba2 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -53,13 +53,13 @@ Evolution_PartyMonLoop: ; loop over party mons ld h, [hl] ld l, a push hl - ld a, [wcf91] + ld a, [wCurPartySpecies] push af xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData pop af - ld [wcf91], a + ld [wCurPartySpecies], a pop hl .evoEntryLoop ; loop over evolution entries @@ -96,10 +96,10 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [wIsInBattle] ; are we in battle? and a ld a, [hli] - jp nz, .nextEvoEntry1 ; don't evolve if we're in a battle as wcf91 could be holding the last mon sent out + jp nz, .nextEvoEntry1 ; don't evolve if we're in a battle as wCurPartySpecies could be holding the last mon sent out ld b, a ; evolution item - ld a, [wcf91] ; last item used + ld a, [wCurItem] cp b ; was the evolution item in this entry used? jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry .checkLevel @@ -109,7 +109,7 @@ Evolution_PartyMonLoop: ; loop over party mons cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry .doEvolution - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, 1 ld [wEvolutionOccurred], a push hl @@ -139,7 +139,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 @@ -157,22 +157,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 @@ -207,8 +207,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 @@ -218,7 +218,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 @@ -264,14 +264,15 @@ 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 hl, wcd6d + ld [wCurSpecies], a + ld hl, wNameBuffer ld de, wStringBuffer .compareNamesLoop ld a, [de] @@ -287,7 +288,7 @@ RenameEvolvedMon: call AddNTimes push hl call GetName - ld hl, wcd6d + ld hl, wNameBuffer pop de jp CopyData @@ -322,15 +323,15 @@ Evolution_ReloadTilesetTilePatterns: jp ReloadTilesetTilePatterns LearnMoveFromLevelUp: - ld a, [wd11e] ; species - ld [wcf91], a + ld a, [wPokedexNum] ; species + ld [wCurPartySpecies], a call GetMonLearnset .learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list ld a, [hli] and a ; have we reached the end of the learn set? jr z, .done ; if we've reached the end of the learn set, jump ld b, a ; level the move is learnt at - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b ; is the move learnt at the mon's current level? ld a, [hli] ; move ID jr nz, .learnSetLoop @@ -356,7 +357,7 @@ LearnMoveFromLevelUp: jr nz, .checkCurrentMovesLoop ld a, d ld [wMoveNum], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer predef LearnMove @@ -376,12 +377,12 @@ LearnMoveFromLevelUp: ld a, $85 ld [wPikachuMood], a .done - ld a, [wcf91] - ld [wd11e], a + ld a, [wCurPartySpecies] + ld [wPokedexNum], a ret Func_3b079: - ld a, [wcf91] + ld a, [wCurPartySpecies] push af call Func_3b0a2 jr c, .asm_3b09c @@ -399,37 +400,36 @@ Func_3b079: jr c, .asm_3b09c .asm_3b096 pop af - ld [wcf91], a + ld [wCurPartySpecies], a and a ret .asm_3b09c pop af - ld [wcf91], a + ld [wCurPartySpecies], a scf ret Func_3b0a2: -; XXX what is wcf91 entering this function? - ld a, [wd11e] + ld a, [wTempTMHM] ld [wMoveNum], a predef CanLearnTM ld a, c and a jr nz, .asm_3b0ec ld hl, Pointer_3b0ee - ld a, [wcf91] + ld a, [wCurPartySpecies] ld de, $1 call IsInArray jr c, .asm_3b0d2 ld a, $ff ld [wMonHGrowthRate], a - ld a, [wd11e] + ld a, [wTempTMHM] ld hl, wMonHMoves ld de, $1 call IsInArray jr c, .asm_3b0ec .asm_3b0d2 - ld a, [wd11e] + ld a, [wTempTMHM] ld d, a call GetMonLearnset .loop @@ -437,7 +437,7 @@ Func_3b0a2: and a jr z, .asm_3b0ea ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jr c, .asm_3b0ea ld a, [hli] @@ -472,7 +472,7 @@ Func_3b10f: inc hl .asm_3b124 inc hl - ld a, [wcf91] + ld a, [wCurPartySpecies] cp [hl] jr z, .asm_3b138 inc hl @@ -489,11 +489,11 @@ Func_3b10f: .asm_3b138 inc c ld a, c - ld [wcf91], a + ld [wCurPartySpecies], a scf ret -; writes the moves a mon has at level [wCurEnemyLVL] to [de] +; writes the moves a mon has at level [wCurEnemyLevel] to [de] ; move slots are being filled up sequentially and shifted if all slots are full WriteMonMoves: call GetPredefRegisters @@ -511,7 +511,7 @@ WriteMonMoves: and a jp z, .done ; end of list ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) ld a, [wLearningMovesFromDayCare] @@ -617,7 +617,7 @@ Evolution_FlagAction: GetMonLearnset: ld hl, EvosMovesPointerTable ld b, 0 - ld a, [wcf91] + ld a, [wCurPartySpecies] dec a ld c, a add hl, bc 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 03f17bcc..e10c6bcf 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -3,7 +3,7 @@ LearnMove: ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wLearnMoveMonName ld bc, NAME_LENGTH call CopyData @@ -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 @@ -126,11 +126,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 @@ -146,10 +146,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/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index 3d9417a7..964db2e4 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -4,11 +4,11 @@ LoadMonData_:: ; 1: enemymon ; 2: boxmon ; 3: daycaremon -; Return monster id at wcf91 and its data at wLoadedMon. +; Return monster id at wCurPartySpecies and its data at wLoadedMon. ; Also load base stats at wMonHeader for convenience. ld a, [wDayCareMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld a, [wMonDataLocation] cp DAYCARE_DATA jr z, .GetMonHeader @@ -18,8 +18,8 @@ LoadMonData_:: call GetMonSpecies .GetMonHeader - ld a, [wcf91] - ld [wd0b5], a ; input for GetMonHeader + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMons @@ -64,5 +64,5 @@ GetMonSpecies: ld d, 0 add hl, de ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ret 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 0adfc217..d88ef8c1 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 @@ -71,14 +71,14 @@ StatusScreen: ; mon is in a box or daycare ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 call CalcStats ; Recalculate stats .DontRecalculate - ld hl, wd72c - set 1, [hl] + ld hl, wStatusFlags2 + set BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $33 ldh [rNR50], a ; Reduce the volume call GBPalWhiteOutWithDelay3 @@ -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 @@ -186,10 +186,10 @@ StatusScreen: callfar PlayPikachuSoundClip jr .continue .playRegularCry - ld a, [wcf91] - call PlayCry ; play Pokémon cry + ld a, [wCurPartySpecies] + call PlayCry .continue - call WaitForTextScrollButtonPress ; wait for button + call WaitForTextScrollButtonPress pop af ldh [hTileAnimations], a ret @@ -434,7 +434,7 @@ StatusScreen2: hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 9, 1 call PlaceString @@ -444,8 +444,8 @@ StatusScreen2: call WaitForTextScrollButtonPress ; wait for button pop af ldh [hTileAnimations], a - ld hl, wd72c - res 1, [hl] + ld hl, wStatusFlags2 + res BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $77 ldh [rNR50], a call GBPalWhiteOut |
