Skip to content

Commit

Permalink
Identify uses of wd0b5
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Sep 10, 2024
1 parent d138e55 commit b3ca416
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 60 deletions.
4 changes: 2 additions & 2 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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?
Expand Down
10 changes: 5 additions & 5 deletions engine/battle/experience.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -168,8 +168,8 @@ GainExperience:
ld [hl], a
ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc
ld a, [hl] ; species
ld [wd0b5], a
ld a, [hl]
ld [wCurSpecies], a
ld [wPokedexNum], a
call GetMonHeader
ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
Expand Down Expand Up @@ -251,7 +251,7 @@ GainExperience:
call LoadScreenTilesFromBuffer1
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
ld a, [wd0b5]
ld a, [wCurSpecies]
ld [wPokedexNum], a
predef LearnMoveFromLevelUp
ld hl, wCanEvolveFlags
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/get_trainer_name.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/misc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/print_type.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; [wd0b5] = pokemon ID
; [wCurSpecies] = pokemon ID
; hl = dest addr
PrintMonType:
call GetPredefRegisters
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/safari_zone.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/events/hidden_objects/museum_fossils.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1254,7 +1254,7 @@ ItemUseMedicine:
.useVitamin
push hl
ld a, [hl]
ld [wd0b5], a
ld [wCurSpecies], a
ld [wPokedexNum], a
ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level
Expand Down Expand Up @@ -2650,7 +2650,7 @@ SendNewMonToBox:
inc a
ld [de], a
ld a, [wCurPartySpecies]
ld [wd0b5], a
ld [wCurSpecies], a
ld c, a
.loop
inc de
Expand Down
2 changes: 1 addition & 1 deletion engine/items/tms.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/menus/league_pc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion engine/menus/pokedex.asm
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ ShowPokedexDataInternal:
pop af
ld [wPokedexNum], a
ld a, [wCurPartySpecies]
ld [wd0b5], a
ld [wCurSpecies], a
pop de

push af
Expand Down
2 changes: 1 addition & 1 deletion engine/movie/credits.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions engine/movie/evolution.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,15 +26,15 @@ EvolveMon:
call EvolutionSetWholeScreenPalette
ld a, [wEvoNewSpecies]
ld [wCurPartySpecies], a
ld [wd0b5], a
ld [wCurSpecies], a
call Evolution_LoadPic
ld de, vFrontPic
ld hl, vBackPic
ld bc, 7 * 7
call CopyVideoData
ld a, [wEvoOldSpecies]
ld [wCurPartySpecies], a
ld [wd0b5], a
ld [wCurSpecies], a
call Evolution_LoadPic
ld a, $1
ldh [hAutoBGTransferEnabled], a
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions engine/movie/hall_of_fame.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion engine/movie/oak_speech/oak_speech.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/movie/title.asm
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ ClearBothBGMaps:

LoadTitleMonSprite:
ld [wCurPartySpecies], a
ld [wd0b5], a
ld [wCurSpecies], a
hlcoord 5, 10
call GetMonHeader
jp LoadFrontSpriteByMonIndex
Expand Down
2 changes: 1 addition & 1 deletion engine/movie/trade.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/pokemon/add_mon.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
15 changes: 8 additions & 7 deletions engine/pokemon/evos_moves.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -155,7 +155,7 @@ Evolution_PartyMonLoop: ; loop over party mons
call RenameEvolvedMon
ld a, [wPokedexNum]
push af
ld a, [wd0b5]
ld a, [wCurSpecies]
ld [wPokedexNum], a
predef IndexToPokedex
ld a, [wPokedexNum]
Expand All @@ -165,7 +165,7 @@ Evolution_PartyMonLoop: ; loop over party mons
call AddNTimes
ld de, wMonHeader
call CopyData
ld a, [wd0b5]
ld a, [wCurSpecies]
ld [wMonHIndex], a
pop af
ld [wPokedexNum], a
Expand Down Expand Up @@ -203,7 +203,7 @@ Evolution_PartyMonLoop: ; loop over party mons
dec hl
pop bc
call CopyData
ld a, [wd0b5]
ld a, [wCurSpecies]
ld [wPokedexNum], a
xor a
ld [wMonDataLocation], a
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/pokemon/experience.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/pokemon/load_mon_data.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LoadMonData_::

.GetMonHeader
ld a, [wCurPartySpecies]
ld [wd0b5], a ; input for GetMonHeader
ld [wCurSpecies], a
call GetMonHeader

ld hl, wPartyMons
Expand Down
Loading

0 comments on commit b3ca416

Please sign in to comment.