Skip to content

Commit

Permalink
Identify remaining uses of wd11e
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Sep 10, 2024
1 parent d65c98a commit d138e55
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion 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
8 changes: 4 additions & 4 deletions engine/battle/experience.asm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ GainExperience:
add hl, bc
ld a, [hl] ; species
ld [wd0b5], a
ld [wd11e], a
ld [wPokedexNum], a
call GetMonHeader
ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
add hl, bc
Expand Down Expand Up @@ -252,7 +252,7 @@ GainExperience:
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
ld a, [wd0b5]
ld [wd11e], a
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/events/heal_party.asm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ HealParty:
.done
xor a
ld [wWhichPokemon], a
ld [wd11e], a
ld [wUsingPPUp], a

ld a, [wPartyCount]
ld b, a
Expand Down
2 changes: 1 addition & 1 deletion engine/events/poison.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -542,7 +542,7 @@ ItemUseBall:
call PrintText
call ClearSprites
ld a, [wEnemyMonSpecies]
ld [wd11e], a
ld [wPokedexNum], a
predef ShowPokedexData

.skipShowingPokedexData
Expand Down Expand Up @@ -1255,7 +1255,7 @@ ItemUseMedicine:
push hl
ld a, [hl]
ld [wd0b5], a
ld [wd11e], a
ld [wPokedexNum], a
ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level
ld a, [hl] ; a = level
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2892,7 +2892,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
Expand Down Expand Up @@ -2927,7 +2927,7 @@ CheckMapForMon:
inc hl
ld b, NUM_WILDMONS
.loop
ld a, [wd11e]
ld a, [wPokedexNum]
cp [hl]
jr nz, .nextEntry
ld a, c
Expand Down
6 changes: 3 additions & 3 deletions engine/items/tms.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
34 changes: 17 additions & 17 deletions engine/menus/pokedex.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -142,7 +142,7 @@ HandlePokedexSideMenu:

; play pokemon cry
.choseCry
ld a, [wd11e]
ld a, [wPokedexNum]
call GetCryData
call PlaySound
jr .handleMenuInput
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -455,7 +455,7 @@ ShowPokedexDataInternal:
call PlaceString

ld hl, PokedexEntryPointers
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld e, a
ld d, 0
Expand Down Expand Up @@ -487,7 +487,7 @@ ShowPokedexDataInternal:
ld hl, wPokedexOwned
call IsPokemonBitSet
pop af
ld [wd11e], a
ld [wPokedexNum], a
ld a, [wCurPartySpecies]
ld [wd0b5], a
pop de
Expand Down
4 changes: 2 additions & 2 deletions engine/pokemon/evos_moves.asm
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Evolution_ReloadTilesetTilePatterns:

LearnMoveFromLevelUp:
ld hl, EvosMovesPointerTable
ld a, [wd11e] ; species
ld a, [wPokedexNum] ; species
ld [wCurPartySpecies], a
dec a
ld bc, 0
Expand Down Expand Up @@ -372,7 +372,7 @@ LearnMoveFromLevelUp:
predef LearnMove
.done
ld a, [wCurPartySpecies]
ld [wd11e], a
ld [wPokedexNum], a
ret

; writes the moves a mon has at level [wCurEnemyLevel] to [de]
Expand Down
4 changes: 2 additions & 2 deletions engine/pokemon/set_types.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; 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 a, [wPokedexNum]
ld [wd0b5], a
push hl
call GetMonHeader
Expand Down
12 changes: 6 additions & 6 deletions home/list_menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -460,7 +460,7 @@ PrintListMenuEntries::
add hl, bc
call PrintLevel
pop af
ld [wd11e], a
ld [wNamedObjectIndex], a
.skipPrintingPokemonLevel
pop hl
pop de
Expand All @@ -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]
Expand All @@ -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
Expand Down
Loading

0 comments on commit d138e55

Please sign in to comment.