Skip to content

Commit

Permalink
Identify remaining uses of wd0b5 and wd11e (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 authored Sep 19, 2024
1 parent 613d346 commit 5a622f6
Show file tree
Hide file tree
Showing 57 changed files with 243 additions and 237 deletions.
6 changes: 3 additions & 3 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down 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
44 changes: 22 additions & 22 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 @@ -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
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 @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -3835,7 +3835,7 @@ DetermineExclamationPointTextNum:
jr .loop
.done
ld a, b
ld [wd11e], a ; exclamation point num
ld [wMoveGrammar], a
pop bc
ret

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 @@ -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
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 @@ -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
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 Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions engine/battle/effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 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,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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -306,15 +306,15 @@ 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
xor a
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
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/move_effects/transform.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
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/battle/trainer_ai.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions engine/events/cinnabar_lab.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
2 changes: 1 addition & 1 deletion engine/events/display_pokedex.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions engine/events/give_pokemon.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5a622f6

Please sign in to comment.