named wram variables

This commit is contained in:
YamaArashi 2015-08-07 05:20:37 -07:00
parent 525f1b96f3
commit f658aff538
6 changed files with 55 additions and 45 deletions

View file

@ -2956,7 +2956,7 @@ TossBallAnimation: ; 79e16 (1e:5e16)
ld a,[W_ISINBATTLE] ld a,[W_ISINBATTLE]
cp a,2 cp a,2
jr z,.BlockBall ; if in trainer battle, play different animation jr z,.BlockBall ; if in trainer battle, play different animation
ld a,[wd11e] ld a,[wPokeBallAnimData]
ld b,a ld b,a
; upper nybble: how many animations (from PokeBallAnimations) to play ; upper nybble: how many animations (from PokeBallAnimations) to play

View file

@ -2962,7 +2962,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6)
lb bc, 1, 2 lb bc, 1, 2
call PrintNumber call PrintNumber
coord hl, 8, 11 coord hl, 8, 11
ld de, wd11e ld de, wMaxPP
lb bc, 1, 2 lb bc, 1, 2
call PrintNumber call PrintNumber
call GetCurrentMove call GetCurrentMove
@ -5287,7 +5287,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
ld d,a ; d = type 1 of defender ld d,a ; d = type 1 of defender
ld e,[hl] ; e = type 2 of defender ld e,[hl] ; e = type 2 of defender
ld a,[W_PLAYERMOVETYPE] ld a,[W_PLAYERMOVETYPE]
ld [wd11e],a ld [wMoveType],a
ld a,[H_WHOSETURN] ld a,[H_WHOSETURN]
and a and a
jr z,.next jr z,.next
@ -5301,9 +5301,9 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
ld d,a ; d = type 1 of defender ld d,a ; d = type 1 of defender
ld e,[hl] ; e = type 2 of defender ld e,[hl] ; e = type 2 of defender
ld a,[W_ENEMYMOVETYPE] ld a,[W_ENEMYMOVETYPE]
ld [wd11e],a ld [wMoveType],a
.next .next
ld a,[wd11e] ; move type ld a,[wMoveType]
cp b ; does the move type match type 1 of the attacker? cp b ; does the move type match type 1 of the attacker?
jr z,.sameTypeAttackBonus jr z,.sameTypeAttackBonus
cp c ; does the move type match type 2 of the attacker? cp c ; does the move type match type 2 of the attacker?
@ -5328,8 +5328,8 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
ld hl,wDamageMultipliers ld hl,wDamageMultipliers
set 7,[hl] set 7,[hl]
.skipSameTypeAttackBonus .skipSameTypeAttackBonus
ld a,[wd11e] ld a,[wMoveType]
ld b,a ; b = move type ld b,a
ld hl,TypeEffects ld hl,TypeEffects
.loop .loop
ld a,[hli] ; a = "attacking type" of the current type pair ld a,[hli] ; a = "attacking type" of the current type pair
@ -5392,7 +5392,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
; function to tell how effective the type of an enemy attack is on the player's current pokemon ; function to tell how effective the type of an enemy attack is on the player's current pokemon
; this doesn't take into account the effects that dual types can have ; this doesn't take into account the effects that dual types can have
; (e.g. 4x weakness / resistance, weaknesses and resistances canceling) ; (e.g. 4x weakness / resistance, weaknesses and resistances canceling)
; the result is stored in [wd11e] ; the result is stored in [wTypeEffectiveness]
; ($05 is not very effective, $10 is neutral, $14 is super effective) ; ($05 is not very effective, $10 is neutral, $14 is super effective)
; as far is can tell, this is only used once in some AI code to help decide which move to use ; as far is can tell, this is only used once in some AI code to help decide which move to use
AIGetTypeEffectiveness: ; 3e449 (f:6449) AIGetTypeEffectiveness: ; 3e449 (f:6449)
@ -5403,7 +5403,7 @@ AIGetTypeEffectiveness: ; 3e449 (f:6449)
inc hl inc hl
ld c,[hl] ; c = type 2 of player's pokemon ld c,[hl] ; c = type 2 of player's pokemon
ld a,$10 ld a,$10
ld [wd11e],a ; initialize [wd11e] to neutral effectiveness ld [wTypeEffectiveness],a ; initialize to neutral effectiveness
ld hl,TypeEffects ld hl,TypeEffects
.loop .loop
ld a,[hli] ld a,[hli]
@ -5424,7 +5424,7 @@ AIGetTypeEffectiveness: ; 3e449 (f:6449)
jr .loop jr .loop
.done .done
ld a,[hl] ld a,[hl]
ld [wd11e],a ; store damage multiplier ld [wTypeEffectiveness],a ; store damage multiplier
ret ret
INCLUDE "data/type_effects.asm" INCLUDE "data/type_effects.asm"
@ -6577,12 +6577,12 @@ CalculateModifiedStats: ; 3ed99 (f:6d99)
CalculateModifiedStat: ; 3eda5 (f:6da5) CalculateModifiedStat: ; 3eda5 (f:6da5)
push bc push bc
push bc push bc
ld a, [wd11e] ld a, [wCalculateWhoseStats]
and a and a
ld a, c ld a, c
ld hl, wBattleMonAttack ld hl, wBattleMonAttack
ld de, wPlayerMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack
ld bc, wPlayerMonAttackMod ld bc, wPlayerMonStatMods
jr z, .next jr z, .next
ld hl, wEnemyMonAttack ld hl, wEnemyMonAttack
ld de, wEnemyMonUnmodifiedAttack ld de, wEnemyMonUnmodifiedAttack

View file

@ -231,8 +231,8 @@ GainExperience: ; 5524f (15:524f)
ld bc, 1 + NUM_STATS * 2 ld bc, 1 + NUM_STATS * 2
call CopyData call CopyData
.recalcStatChanges .recalcStatChanges
xor a xor a ; battle mon
ld [wd11e], a ld [wCalculateWhoseStats], a
callab CalculateModifiedStats callab CalculateModifiedStats
callab ApplyBurnAndParalysisPenaltiesToPlayer callab ApplyBurnAndParalysisPenaltiesToPlayer
callab ApplyBadgeStatBoosts callab ApplyBadgeStatBoosts

View file

@ -312,7 +312,7 @@ ItemUseBall: ; d687 (3:5687)
ld b,$63 ld b,$63
.next12 .next12
ld a,b ld a,b
ld [wd11e],a ld [wPokeBallAnimData],a
.BallSuccess2 .BallSuccess2
ld c,20 ld c,20
call DelayFrames call DelayFrames
@ -331,7 +331,7 @@ ItemUseBall: ; d687 (3:5687)
ld [wcf91],a ld [wcf91],a
pop af pop af
ld [wWhichPokemon],a ld [wWhichPokemon],a
ld a,[wd11e] ld a,[wPokeBallAnimData]
cp a,$10 cp a,$10
ld hl,ItemUseBallText00 ld hl,ItemUseBallText00
jp z,.printText0 jp z,.printText0
@ -1895,7 +1895,7 @@ ItemUsePPRestore: ; e31e (3:631e)
ld [wPlayerMoveListIndex],a ld [wPlayerMoveListIndex],a
jr nz,.chooseMon jr nz,.chooseMon
ld hl,wPartyMon1Moves ld hl,wPartyMon1Moves
ld bc,44 ld bc, wPartyMon2 - wPartyMon1
call GetSelectedMoveOffset call GetSelectedMoveOffset
push hl push hl
ld a,[hl] ld a,[hl]
@ -1937,7 +1937,7 @@ ItemUsePPRestore: ; e31e (3:631e)
cp b ; is the pokemon whose PP was restored active in battle? cp b ; is the pokemon whose PP was restored active in battle?
jr nz,.skipUpdatingInBattleData jr nz,.skipUpdatingInBattleData
ld hl,wPartyMon1PP ld hl,wPartyMon1PP
ld bc,44 ld bc, wPartyMon2 - wPartyMon1
call AddNTimes call AddNTimes
ld de,wBattleMonPP ld de,wBattleMonPP
ld bc,4 ld bc,4
@ -1959,12 +1959,12 @@ ItemUsePPRestore: ; e31e (3:631e)
ld [wMonDataLocation],a ld [wMonDataLocation],a
call GetMaxPP call GetMaxPP
ld hl,wPartyMon1Moves ld hl,wPartyMon1Moves
ld bc,44 ld bc, wPartyMon2 - wPartyMon1
call GetSelectedMoveOffset call GetSelectedMoveOffset
ld bc,21 ld bc, wPartyMon1PP - wPartyMon1Moves
add hl,bc ; hl now points to move's PP add hl,bc ; hl now points to move's PP
ld a,[wd11e] ld a,[wMaxPP]
ld b,a ; b = max PP ld b,a
ld a,[wPPRestoreItem] ld a,[wPPRestoreItem]
cp a,MAX_ETHER cp a,MAX_ETHER
jr z,.fullyRestorePP jr z,.fullyRestorePP
@ -2009,7 +2009,7 @@ ItemUsePPRestore: ; e31e (3:631e)
.elixirLoop .elixirLoop
push bc push bc
ld hl,wPartyMon1Moves ld hl,wPartyMon1Moves
ld bc,44 ld bc, wPartyMon2 - wPartyMon1
call GetSelectedMoveOffset call GetSelectedMoveOffset
ld a,[hl] ld a,[hl]
and a ; does the current slot have a move? and a ; does the current slot have a move?
@ -2283,20 +2283,17 @@ GotOffBicycleText: ; e5fc (3:65fc)
; also, when a PP Up is used, it increases the current PP by one PP Up bonus ; also, when a PP Up is used, it increases the current PP by one PP Up bonus
; INPUT: ; INPUT:
; [wWhichPokemon] = index of pokemon in party ; [wWhichPokemon] = index of pokemon in party
; [wd11e] = mode
; 0: Pokemon Center healing
; 1: using a PP Up
; [wCurrentMenuItem] = index of move (when using a PP Up) ; [wCurrentMenuItem] = index of move (when using a PP Up)
RestoreBonusPP: ; e606 (3:6606) RestoreBonusPP: ; e606 (3:6606)
ld hl,wPartyMon1Moves ld hl,wPartyMon1Moves
ld bc,44 ld bc, wPartyMon2 - wPartyMon1
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
call AddNTimes call AddNTimes
push hl push hl
ld de,wNormalMaxPPList - 1 ld de,wNormalMaxPPList - 1
predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList
pop hl pop hl
ld c,21 ld c, wPartyMon1PP - wPartyMon1Moves
ld b,0 ld b,0
add hl,bc ; hl now points to move 1 PP add hl,bc ; hl now points to move 1 PP
ld de,wNormalMaxPPList ld de,wNormalMaxPPList
@ -2307,7 +2304,7 @@ RestoreBonusPP: ; e606 (3:6606)
ld a,b ld a,b
cp a,5 ; reached the end of the pokemon's moves? cp a,5 ; reached the end of the pokemon's moves?
ret z ; if so, return ret z ; if so, return
ld a,[wd11e] ld a,[wUsingPPUp]
dec a ; using a PP Up? dec a ; using a PP Up?
jr nz,.skipMenuItemIDCheck jr nz,.skipMenuItemIDCheck
; if using a PP Up, check if this is the move it's being used on ; if using a PP Up, check if this is the move it's being used on
@ -2329,8 +2326,6 @@ RestoreBonusPP: ; e606 (3:6606)
; INPUT: ; INPUT:
; [de] = normal max PP ; [de] = normal max PP
; [hl] = move PP ; [hl] = move PP
; [wd11e] = max number of times to add bonus
; set to 1 when using a PP Up, set to 255 otherwise
AddBonusPP: ; e642 (3:6642) AddBonusPP: ; e642 (3:6642)
push bc push bc
ld a,[de] ; normal max PP of move ld a,[de] ; normal max PP of move
@ -2358,9 +2353,9 @@ AddBonusPP: ; e642 (3:6642)
.addAmount .addAmount
add b add b
ld b,a ld b,a
ld a,[wd11e] ld a,[wUsingPPUp]
dec a dec a ; is the player using a PP Up right now?
jr z,.done jr z,.done ; if so, only add the bonus once
dec c dec c
jr nz,.loop jr nz,.loop
.done .done
@ -2379,7 +2374,7 @@ AddBonusPP: ; e642 (3:6642)
; 04: player's in-battle pokemon ; 04: player's in-battle pokemon
; [wCurrentMenuItem] = move index ; [wCurrentMenuItem] = move index
; OUTPUT: ; OUTPUT:
; [wd11e] = max PP ; [wMaxPP] = max PP
GetMaxPP: ; e677 (3:6677) GetMaxPP: ; e677 (3:6677)
ld a,[wMonDataLocation] ld a,[wMonDataLocation]
and a and a
@ -2432,12 +2427,12 @@ GetMaxPP: ; e677 (3:6677)
ld l,e ld l,e
inc hl ; hl = wcd73 inc hl ; hl = wcd73
ld [hl],a ld [hl],a
xor a xor a ; add the bonus for the existing PP Up count
ld [wd11e],a ; no limit on PP Up amount ld [wUsingPPUp],a
call AddBonusPP ; add bonus PP from PP Ups call AddBonusPP ; add bonus PP from PP Ups
ld a,[hl] ld a,[hl]
and a,%00111111 ; mask out the PP Up count and a,%00111111 ; mask out the PP Up count
ld [wd11e],a ; store max PP ld [wMaxPP],a ; store max PP
ret ret
GetSelectedMoveOffset: ; e6e3 (3:66e3) GetSelectedMoveOffset: ; e6e3 (3:66e3)

View file

@ -371,7 +371,7 @@ StatusScreen2: ; 12b57 (4:6b57)
call PrintNumber call PrintNumber
ld a, "/" ld a, "/"
ld [hli], a ld [hli], a
ld de, wd11e ld de, wMaxPP
lb bc, 1, 2 lb bc, 1, 2
call PrintNumber call PrintNumber
pop hl pop hl

View file

@ -1882,6 +1882,21 @@ wFirstMonsNotOutYet:: ; d11d
; which will be the first mon sent out. ; which will be the first mon sent out.
ds 1 ds 1
; lower nybble: number of shakes
; upper nybble: number of animations to play
wPokeBallAnimData:: ; d11e
wUsingPPUp:: ; d11e
wMaxPP:: ; d11e
; 0 for player, non-zero for enemy
wCalculateWhoseStats:: ; d11e
wTypeEffectiveness:: ; d11e
wMoveType:: ; d11e
wNumSetBits:: ; d11e wNumSetBits:: ; d11e
wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits