Labelled many functions/variables

This commit is contained in:
YamaArashi 2014-08-08 22:39:13 -07:00
parent c9946975d4
commit 59f0507e4c
49 changed files with 2474 additions and 2232 deletions

View file

@ -92,7 +92,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb)
dec c
jr nz,.next2
xor a
ld [$FFB0],a
ld [hVBlankWY],a
ld a,$C0
ld [$FF47],a
ret

View file

@ -75,8 +75,8 @@ Func_7861: ; 7861 (1:7861)
.asm_78aa
ld [wListMenuID], a ; wListMenuID
predef UpdateHPBar2
predef Func_3cd60
predef Func_3cdec
predef DrawPlayerHUDAndHPBar
predef DrawEnemyHUDAndHPBar
callab ReadPlayerMonCurHPAndStatus
ld hl, SuckedHealthText ; $78dc
ld a, [H_WHOSETURN] ; $fff3

View file

@ -3,18 +3,18 @@ Func_525af: ; 525af (14:65af)
ld [wd0d4], a
xor a
ld [wcd6a], a
ld [wcf0b], a
ld [wBattleResult], a
ld hl, wcc2b
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld [wListScrollOffset], a ; wcc36
ld [wd05e], a
ld [wCriticalHitOrOHKO], a
ld [wBattleMonSpecies], a
ld [wPartyAliveFlags], a
ld [wPartyGainExpFlags], a
ld [wPlayerMonNumber], a ; wPlayerMonNumber
ld [wd078], a
ld [wEscapedFromBattle], a
ld [wd35d], a
ld hl, wcf1d
ld [hli], a
@ -73,7 +73,7 @@ ParalyzeEffect_: ; 52601 (14:6601)
and a
jr nz, .asm_52659
set 6, [hl]
callab Func_3ed27
callab QuarterSpeedDueToParalysis
ld c, $1e
call DelayFrames
callab Func_3fba8

View file

@ -1,63 +1,63 @@
GainExperience: ; 5524f (15:524f)
ld a, [W_ISLINKBATTLE]
cp $4
ret z
call Func_5546c
ld hl, wPartyMons
ret z ; return if link battle
call DivideExpDataByNumMonsGainingExp
ld hl, wPartyMon1
xor a
ld [wWhichPokemon], a
Func_5525f: ; 5525f (15:525f)
.partyMonLoop ; loop over each mon and add gained exp
inc hl
ld a, [hli]
or [hl]
jp z, Func_55436
or [hl] ; is mon's HP 0?
jp z, .nextMon ; if so, go to next mon
push hl
ld hl, wPartyAliveFlags
ld hl, wPartyGainExpFlags
ld a, [wWhichPokemon]
ld c, a
ld b, $2
predef FlagActionPredef
ld a, c
and a
and a ; is mon's gain exp flag set?
pop hl
jp z, Func_55436
ld de, $10
jp z, .nextMon ; if mon's gain exp flag not set, go to next mon
ld de, (wPartyMon1HPExp + 1) - (wPartyMon1HP + 1)
add hl, de
ld d, h
ld e, l
ld hl, wd002
ld hl, wEnemyMonBaseStats
ld c, $5
.asm_55285
.gainStatExpLoop
ld a, [hli]
ld b, a
ld a, [de]
add b
ld b, a ; enemy mon base stat
ld a, [de] ; stat exp
add b ; add enemy mon base state to stat exp
ld [de], a
jr nc, .asm_5529a
jr nc, .nextBaseStat
; if there was a carry, increment the upper byte
dec de
ld a, [de]
inc a
jr z, .asm_55295
jr z, .maxStatExp ; jump if the value overflowed
ld [de], a
inc de
jr .asm_5529a
.asm_55295
jr .nextBaseStat
.maxStatExp ; if the upper byte also overflowed, then we have hit the max stat exp
ld a, $ff
ld [de], a
inc de
ld [de], a
.asm_5529a
.nextBaseStat
dec c
jr z, .asm_552a1
inc de
inc de
jr .asm_55285
jr .gainStatExpLoop
.asm_552a1
xor a
ld [H_MULTIPLICAND], a
ld [H_MULTIPLICAND + 1], a
ld a, [wd008]
ld a, [wEnemyMonBaseExp]
ld [H_MULTIPLICAND + 2], a
ld a, [wEnemyMonLevel]
ld [H_MULTIPLIER], a
@ -66,44 +66,46 @@ Func_5525f: ; 5525f (15:525f)
ld [H_DIVISOR], a
ld b, 4
call Divide
ld hl, $fff2
ld hl, -((wPartyMon1HPExp + 1) - wPartyMon1OTID + 4 * 2)
add hl, de
ld b, [hl]
ld b, [hl] ; party mon OTID
inc hl
ld a, [wPlayerID]
cp b
jr nz, .asm_552d1
jr nz, .tradedMon
ld b, [hl]
ld a, [wPlayerID + 1]
cp b
ld a, $0
jr z, .asm_552d6
.asm_552d1
call Func_5549f
jr z, .next
.tradedMon
call BoostExp ; traded mon exp boost
ld a, $1
.asm_552d6
.next
ld [wcf4d], a
ld a, [W_ISINBATTLE]
dec a
call nz, Func_5549f
dec a ; is it a trainer battle?
call nz, BoostExp ; if so, boost exp
inc hl
inc hl
inc hl
; add the gained exp to the party mon's exp
ld b, [hl]
ld a, [$ff98]
ld a, [H_QUOTIENT + 3]
ld [wcf4c], a
add b
ld [hld], a
ld b, [hl]
ld a, [$ff97]
ld a, [H_QUOTIENT + 2]
ld [wcf4b], a
adc b
ld [hl], a
jr nc, .asm_552f8
jr nc, .noCarry
dec hl
inc [hl]
inc hl
.asm_552f8
.noCarry
; calculate exp for the mon at max level, and cap the exp at that value
inc hl
push hl
ld a, [wWhichPokemon]
@ -111,11 +113,12 @@ Func_5525f: ; 5525f (15:525f)
ld b, 0
ld hl, wPartySpecies
add hl, bc
ld a, [hl]
ld a, [hl] ; species
ld [wd0b5], a
call GetMonHeader
ld d, MAX_LEVEL
callab CalcExperience
callab CalcExperience ; get max exp
; compare max exp with current exp
ld a, [$ff96]
ld b, a
ld a, [$ff97]
@ -129,7 +132,8 @@ Func_5525f: ; 5525f (15:525f)
sbc c
ld a, [hl]
sbc b
jr c, .asm_5532e
jr c, .next2
; the mon's exp is greater than the max exp, so overwrite it with the max exp
ld a, b
ld [hli], a
ld a, c
@ -137,103 +141,108 @@ Func_5525f: ; 5525f (15:525f)
ld a, d
ld [hld], a
dec hl
.asm_5532e
.next2
push hl
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
ld hl, GainedText
call PrintText
xor a
xor a ; party mon data
ld [wcc49], a
call LoadMonData
pop hl
ld bc, $13
ld bc, wPartyMon1Level - wPartyMon1Exp
add hl, bc
push hl
callba Func_58f43
callba CalcLevelFromExperience
pop hl
ld a, [hl]
ld a, [hl] ; current level
cp d
jp z, Func_55436
jp z, .nextMon ; if level didn't change, go to next mon
ld a, [W_CURENEMYLVL]
push af
push hl
ld a, d
ld [W_CURENEMYLVL], a
ld [hl], a
ld bc, $ffdf
ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc
ld a, [hl]
ld a, [hl] ; species
ld [wd0b5], a
ld [wd11e], a
call GetMonHeader
ld bc, $23
ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
add hl, bc
push hl
ld a, [hld]
ld c, a
ld b, [hl]
push bc
push bc ; push max HP (from before levelling up)
ld d, h
ld e, l
ld bc, $ffee
ld bc, (wPartyMon1HPExp - 1) - wPartyMon1MaxHP
add hl, bc
ld b, $1
ld b, $1 ; consider stat exp when calculating stats
call CalcStats
pop bc
pop bc ; pop max HP (from before levelling up)
pop hl
ld a, [hld]
sub c
ld c, a
ld a, [hl]
sbc b
ld b, a
ld de, $ffe0
ld b, a ; bc = difference between old max HP and new max HP after levelling
ld de, (wPartyMon1HP + 1) - wPartyMon1MaxHP
add hl, de
ld a, [hl]
; add to the current HP the amount of max HP gained when levelling
ld a, [hl] ; wPartyMon1HP + 1
add c
ld [hld], a
ld a, [hl]
ld a, [hl] ; wPartyMon1HP + 1
adc b
ld [hl], a
ld [hl], a ; wPartyMon1HP
ld a, [wPlayerMonNumber]
ld b, a
ld a, [wWhichPokemon]
cp b
jr nz, .asm_553f7
cp b ; is the current mon in battle?
jr nz, .printGrewLevelText
; current mon is in battle
ld de, wBattleMonHP
; copy party mon HP to battle mon HP
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
ld bc, $1f
; copy other stats from party mon to battle mon
ld bc, wPartyMon1Level - (wPartyMon1HP + 1)
add hl, bc
push hl
ld de, wBattleMonLevel ; wBattleMonLevel
ld bc, $b
ld de, wBattleMonLevel
ld bc, $b ; size of stats
call CopyData
pop hl
ld a, [W_PLAYERBATTSTATUS3] ; W_PLAYERBATTSTATUS3
bit 3, a
jr nz, .asm_553c8
ld a, [W_PLAYERBATTSTATUS3]
bit 3, a ; is the mon transformed?
jr nz, .recalcStatChanges
; the mon is transformed, so copy transformed data
ld de, wcd0f
ld bc, $b
call CopyData
.asm_553c8
.recalcStatChanges
xor a
ld [wd11e], a
callab Func_3ed99
callab Func_3ed1a
callab Func_3ee19
callab Func_3cd60
callab Func_3ee94
callab CalculateModifiedStats
callab ApplyBurnAndParalysisPenaltiesToPlayer
callab ApplyBadgeStatBoosts
callab DrawPlayerHUDAndHPBar
callab PrintEmptyString
call SaveScreenTilesToBuffer1
.asm_553f7
.printGrewLevelText
ld hl, GrewLevelText
call PrintText
xor a
xor a ; party mon data
ld [wcc49], a
call LoadMonData
ld d, $1
@ -244,88 +253,90 @@ Func_5525f: ; 5525f (15:525f)
ld [wcc49], a
ld a, [wd0b5]
ld [wd11e], a
predef Func_3af5b
predef LearnMoveFromLevelUp
ld hl, wccd3
ld a, [wWhichPokemon] ; wWhichPokemon
ld a, [wWhichPokemon]
ld c, a
ld b, $1
predef FlagActionPredef
pop hl
pop af
ld [W_CURENEMYLVL], a ; W_CURENEMYLVL
ld [W_CURENEMYLVL], a
Func_55436: ; 55436 (15:5436)
ld a, [wPartyCount] ; wPartyCount
.nextMon
ld a, [wPartyCount]
ld b, a
ld a, [wWhichPokemon] ; wWhichPokemon
ld a, [wWhichPokemon]
inc a
cp b
jr z, .asm_55450
ld [wWhichPokemon], a ; wWhichPokemon
ld bc, $2c
ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1)
jr z, .done
ld [wWhichPokemon], a
ld bc, wPartyMon2 - wPartyMon1
ld hl, wPartyMon1
call AddNTimes
jp Func_5525f
.asm_55450
ld hl, wPartyAliveFlags
jp .partyMonLoop
.done
ld hl, wPartyGainExpFlags
xor a
ld [hl], a
ld a, [wPlayerMonNumber] ; wPlayerMonNumber
ld [hl], a ; clear gain exp flags
ld a, [wPlayerMonNumber]
ld c, a
ld b, $1
push bc
predef FlagActionPredef
ld hl, wccf5
predef FlagActionPredef ; set the gain exp flag for the mon that is currently out
ld hl, wPartyFoughtCurrentEnemyFlags
xor a
ld [hl], a
pop bc
predef_jump FlagActionPredef
predef_jump FlagActionPredef ; set the fought current enemy flag for the mon that is currently out
Func_5546c: ; 5546c (15:546c)
ld a, [wPartyAliveFlags]
; divide enemy base stats, catch rate, and base exp by the number of mons gaining exp
DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c)
ld a, [wPartyGainExpFlags]
ld b, a
xor a
ld c, $8
ld d, $0
.asm_55475
.countSetBitsLoop ; loop to count set bits in wPartyGainExpFlags
xor a
srl b
adc d
ld d, a
dec c
jr nz, .asm_55475
jr nz, .countSetBitsLoop
cp $2
ret c
ld [wd11e], a
ld hl, wd002
ret c ; return if only one mon is gaining exp
ld [wd11e], a ; store number of mons gaining exp
ld hl, wEnemyMonBaseStats
ld c, $7
.asm_55488
.divideLoop
xor a
ld [H_DIVIDEND], a ; $ff95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
ld [H_DIVIDEND], a
ld a, [hl]
ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND)
ld [H_DIVIDEND + 1], a
ld a, [wd11e]
ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
ld [H_DIVISOR], a
ld b, $2
call Divide
ld a, [$ff98]
call Divide ; divide value by number of mons gaining exp
ld a, [H_QUOTIENT + 3]
ld [hli], a
dec c
jr nz, .asm_55488
jr nz, .divideLoop
ret
Func_5549f: ; 5549f (15:549f)
ld a, [$ff97]
; multiplies exp by 1.5
BoostExp: ; 5549f (15:549f)
ld a, [H_QUOTIENT + 2]
ld b, a
ld a, [$ff98]
ld a, [H_QUOTIENT + 3]
ld c, a
srl b
rr c
add c
ld [$ff98], a
ld a, [$ff97]
ld [H_QUOTIENT + 3], a
ld a, [H_QUOTIENT + 2]
adc b
ld [$ff97], a
ld [H_QUOTIENT + 2], a
ret
GainedText: ; 554b2 (15:54b2)

View file

@ -38,7 +38,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, b
and a
jr z, .noSilphScope
callab Func_3eb01
callab LoadEnemyMonData
jr .notPokemonTower
.noSilphScope
ld hl, EnemyAppearedText
@ -54,7 +54,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99)
call PrintText
ld hl, UnveiledGhostText
call PrintText
callab Func_3eb01
callab LoadEnemyMonData
callab Func_708ca
ld hl, WildMonAppearedText
call PrintText
@ -94,25 +94,25 @@ GhostCantBeIDdText: ; 58e54 (16:4e54)
TX_FAR _GhostCantBeIDdText
db "@"
SendOutMon: ; 58e59 (16:4e59)
ld hl, wEnemyMonHP ; wEnemyMonHP
PrintSendOutMonMessage: ; 58e59 (16:4e59)
ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
ld hl, GoText
jr z, .printText
xor a
ld [H_NUMTOPRINT], a ; $ff96 (aliases: H_MULTIPLICAND)
ld hl, wEnemyMonHP ; wEnemyMonHP
ld [H_MULTIPLICAND], a
ld hl, wEnemyMonHP
ld a, [hli]
ld [wcce3], a
ld [$ff97], a
ld [H_MULTIPLICAND + 1], a
ld a, [hl]
ld [wcce4], a
ld [$ff98], a
ld a, $19
ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
ld [H_MULTIPLICAND + 2], a
ld a, 25
ld [H_MULTIPLIER], a
call Multiply
ld hl, wEnemyMonMaxHP ; wEnemyMonMaxHP
ld hl, wEnemyMonMaxHP
ld a, [hli]
ld b, [hl]
srl a
@ -121,19 +121,19 @@ SendOutMon: ; 58e59 (16:4e59)
rr b
ld a, b
ld b, $4
ld [H_REMAINDER], a ; $ff99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
ld [H_DIVISOR], a ; enemy mon max HP divided by 4
call Divide
ld a, [$ff98]
ld hl, GoText
cp $46
ld a, [H_QUOTIENT + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
ld hl, GoText ; 70% or greater
cp 70
jr nc, .printText
ld hl, DoItText
cp $28
ld hl, DoItText ; 40% - 69%
cp 40
jr nc, .printText
ld hl, GetmText
cp $a
ld hl, GetmText ; 10% - 39%
cp 10
jr nc, .printText
ld hl, EnemysWeakText
ld hl, EnemysWeakText ; 0% - 9%
.printText
jp PrintText

View file

@ -87,7 +87,7 @@ BattleTransition: ; 7096d (1c:496d)
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
ld [$ffb0], a
ld [hVBlankWY], a
dec a
ld [wcfcb], a
call DelayFrame

View file

@ -1,70 +1,71 @@
Func_137aa: ; 137aa (4:77aa)
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
EndOfBattle: ; 137aa (4:77aa)
ld a, [W_ISLINKBATTLE]
cp $4
jr nz, .asm_137eb
jr nz, .notLinkBattle
; link battle
ld a, [wEnemyMonPartyPos]
ld hl, wEnemyMon1Status
ld bc, wEnemyMon2 - wEnemyMon1
call AddNTimes
ld a, [wEnemyMonStatus] ; wcfe9
ld a, [wEnemyMonStatus]
ld [hl], a
call ClearScreen
callab Func_372d6
ld a, [wcf0b]
callab DisplayLinkBattleVersusTextBox
ld a, [wBattleResult]
cp $1
ld de, YouWinText
jr c, .asm_137de
jr c, .placeWinOrLoseString
ld de, YouLoseText
jr z, .asm_137de
jr z, .placeWinOrLoseString
ld de, DrawText
.asm_137de
.placeWinOrLoseString
hlCoord 6, 8
call PlaceString
ld c, $c8
call DelayFrames
jr .asm_1380a
.asm_137eb
ld a, [wcf0b]
jr .evolution
.notLinkBattle
ld a, [wBattleResult]
and a
jr nz, .asm_13813
ld hl, wcce5
jr nz, .resetVariables
ld hl, wTotalPayDayMoney
ld a, [hli]
or [hl]
inc hl
or [hl]
jr z, .asm_1380a
ld de, wPlayerMoney + 2 ; wd349
jr z, .evolution ; if pay day money is 0, jump
ld de, wPlayerMoney + 2
ld c, $3
predef AddBCDPredef
ld hl, PickUpPayDayMoneyText
call PrintText
.asm_1380a
.evolution
xor a
ld [wccd4], a
predef Func_3ad1c
.asm_13813
predef EvolutionAfterBattle
.resetVariables
xor a
ld [wd083], a
ld [wc02a], a
ld [W_ISINBATTLE], a ; W_ISINBATTLE
ld [W_BATTLETYPE], a ; wd05a
ld [W_MOVEMISSED], a ; W_MOVEMISSED
ld [W_CUROPPONENT], a ; wd059
ld [W_ISINBATTLE], a
ld [W_BATTLETYPE], a
ld [W_MOVEMISSED], a
ld [W_CUROPPONENT], a
ld [wd11f], a
ld [wd120], a
ld [wd078], a
ld [wNumRunAttempts], a
ld [wEscapedFromBattle], a
ld hl, wcc2b
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld [wListScrollOffset], a ; wcc36
ld [wListScrollOffset], a
ld hl, wd060
ld b, $18
.asm_1383e
.loop
ld [hli], a
dec b
jr nz, .asm_1383e
jr nz, .loop
ld hl, wd72c
set 0, [hl]
call WaitForSoundToFinish
@ -307,7 +308,7 @@ HazeEffect_: ; 139da (4:79da)
ld hl, wcd12
ld de, wBattleMonAttack
call Func_13a4a
ld hl, wcd26
ld hl, wEnemyMonUnmodifiedAttack
ld de, wEnemyMonAttack
call Func_13a4a
ld hl, wEnemyMonStatus

View file

@ -53,8 +53,8 @@ SubstituteEffectHandler: ; 17dad (5:7dad)
call Bankswitch ;jump to routine depending on animation setting
ld hl, SubstituteText
call PrintText
ld hl, Func_3cd5a
ld b, BANK(Func_3cd5a)
ld hl, DrawHUDsAndHPBars
ld b, BANK(DrawHUDsAndHPBars)
jp Bankswitch
.alreadyHasSubstitute
ld hl, HasSubstituteText

View file

@ -1962,7 +1962,7 @@ AnimationWavyScreen: ; 79666 (1e:5666)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld d, $80
ld e, $8f
ld c, $ff
@ -1984,7 +1984,7 @@ AnimationWavyScreen: ; 79666 (1e:5666)
dec c
jr nz, .asm_7967f
xor a
ld [$ffb0], a
ld [hVBlankWY], a
call SaveScreenTilesToBuffer2
call ClearScreen
ld a, $1
@ -2744,11 +2744,11 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77)
ld hl, vBGMap0
call Func_79e0d
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld hl, vBGMap0 + $320
call Func_79e0d
ld a, $38
ld [$ffb0], a
ld [hVBlankWY], a
call Func_792fd
ld hl, vBGMap0
call Func_79e0d
@ -2759,11 +2759,11 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77)
call AnimationShowMonPic
call ClearSprites
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld hl, vBGMap1
call Func_79e0d
xor a
ld [$ffb0], a
ld [hVBlankWY], a
call SaveScreenTilesToBuffer1
ld hl, vBGMap0
call Func_79e0d

View file

@ -88,10 +88,10 @@ PayDayEffect_ ; 2feb8 (b:7eb8)
xor a
ld hl, wcd6d
ld [hli], a
ld a, [$fff3]
ld a, [H_WHOSETURN]
and a
ld a, [wBattleMonLevel]
jr z, .asm_2fec8 ; 0x2fec3 $3
jr z, .asm_2fec8
ld a, [wEnemyMonLevel]
.asm_2fec8
add a
@ -118,10 +118,10 @@ PayDayEffect_ ; 2feb8 (b:7eb8)
ld a, [$ff99]
add b
ld [hl], a
ld de, wcce7
ld de, wTotalPayDayMoney + 2
ld c, $3
predef AddBCDPredef
ld hl, CoinsScatteredText ; $7f04
ld hl, CoinsScatteredText
jp PrintText
CoinsScatteredText: ; 2ff04 (b:7f04)

View file

@ -26,7 +26,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld [hli], a
ld [hl], a ; set the damage output to zero
dec a
ld [wd05e], a
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
ld a, [H_WHOSETURN] ; $fff3
@ -50,7 +50,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld [hli], a
ld [hl], a
ld a, $2
ld [wd05e], a
ld [wCriticalHitOrOHKO], a
ret
.asm_33f8a
ld a, $1

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,17 @@
Func_372d6: ; 372d6 (d:72d6)
; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names
DisplayLinkBattleVersusTextBox: ; 372d6 (d:72d6)
call LoadTextBoxTilePatterns
hlCoord 3, 4
ld b, $7
ld c, $c
call TextBoxBorder
hlCoord 4, 5
ld de, wPlayerName ; wd158
ld de, wPlayerName
call PlaceString
hlCoord 4, 10
ld de, W_GRASSRATE ; W_GRASSRATE
ld de, W_GRASSRATE ; enemy name
call PlaceString
; place bold "VS" tiles between the names
hlCoord 9, 8
ld a, $69
ld [hli], a
@ -17,5 +19,5 @@ Func_372d6: ; 372d6 (d:72d6)
xor a
ld [wcfcb], a
callab SetupPlayerAndEnemyPokeballs
ld c, $96
ld c, 150
jp DelayFrames

View file

@ -1203,11 +1203,11 @@ Func_3a72a: ; 3a72a (e:672a)
ld a,d ; how many available monsters are there?
cp 2 ; don't bother if only 1 or 2
jp nc,Func_3a74b
jp nc,SwitchEnemyMon
and a
ret
Func_3a74b: ; 3a74b (e:674b)
SwitchEnemyMon: ; 3a74b (e:674b)
; prepare to withdraw the active monster: copy hp, number, and status to roster

View file

@ -93,7 +93,7 @@ HealEffect_: ; 3b9ec (e:79ec)
.asm_3ba83
ld [wListMenuID], a ; wListMenuID
predef UpdateHPBar2
ld hl, Func_3cd5a ; $4d5a
ld hl, DrawHUDsAndHPBars ; $4d5a
call BankswitchEtoF
ld hl, RegainedHealthText ; $7aac
jp PrintText
@ -226,8 +226,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld a, [hl]
ld [wd11e], a
call GetMonName
ld hl, wcd26
ld de, wcd12
ld hl, wEnemyMonUnmodifiedAttack
ld de, wPlayerMonUnmodifiedAttack
call Func_3bb7d
ld hl, wEnemyMonStatMods ; wcd2e
ld de, wPlayerMonStatMods ; wcd1a

View file

@ -1,5 +1,5 @@
PrintSafariZoneBattleText: ; 4277 (1:4277)
ld hl, wcce9
ld hl, wSafariBaitFactor
ld a, [hl]
and a
jr z, .asm_4284
@ -19,7 +19,7 @@ PrintSafariZoneBattleText: ; 4277 (1:4277)
ld [wd0b5], a
call GetMonHeader
ld a, [W_MONHCATCHRATE]
ld [wd007], a
ld [wEnemyMonCatchRate], a
pop hl
.asm_429f
push hl

View file

@ -826,7 +826,7 @@ TradeCenter_Trade:
.asm_59d9
predef Func_410f3
.asm_59de
callab Func_3ad0e
callab TryEvolvingMon
call ClearScreen
call LoadTrainerInfoTextBoxTiles
call Func_226e

View file

@ -38,7 +38,7 @@ EvolveTradeMon: ; 17d7d (5:7d7d)
ld [wccd4], a
ld a, $32
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
callab Func_3ad0e
callab TryEvolvingMon
xor a
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
jp Func_2307

View file

@ -1,45 +1,49 @@
Func_3ad0e: ; 3ad0e (e:6d0e)
; try to evolve the mon in [wWhichPokemon]
TryEvolvingMon: ; 3ad0e (e:6d0e)
ld hl, wccd3
xor a
ld [hl], a
ld a, [wWhichPokemon] ; wWhichPokemon
ld a, [wWhichPokemon]
ld c, a
ld b, $1
call Func_3b057
call Evolution_FlagAction
Func_3ad1c: ; 3ad1c (e:6d1c)
; this is only called after battle
; it is supposed to do level up evolutions, though there is a bug that allows item evolutions to occur
EvolutionAfterBattle: ; 3ad1c (e:6d1c)
ld a, [$ffd7]
push af
xor a
ld [wd121], a
dec a
ld [wWhichPokemon], a ; wWhichPokemon
ld [wWhichPokemon], a
push hl
push bc
push de
ld hl, wPartyCount ; wPartyCount
ld hl, wPartyCount
push hl
asm_3ad2e: ; 3ad2e (e:6d2e)
ld hl, wWhichPokemon ; wWhichPokemon
Evolution_PartyMonLoop: ; loop over party mons
ld hl, wWhichPokemon
inc [hl]
pop hl
inc hl
ld a, [hl]
cp $ff
jp z, Func_3aede
cp $ff ; have we reached the end of the party?
jp z, .done
ld [wHPBarMaxHP], a
push hl
ld a, [wWhichPokemon] ; wWhichPokemon
ld a, [wWhichPokemon]
ld c, a
ld hl, wccd3
ld b, $2
call Func_3b057
call Evolution_FlagAction
ld a, c
and a
jp z, asm_3ad2e
and a ; is the mon's bit set?
jp z, Evolution_PartyMonLoop ; if not, go to the next mon
ld a, [wHPBarMaxHP]
dec a
ld b, $0
ld b, 0
ld hl, EvosMovesPointerTable
add a
rl b
@ -58,56 +62,57 @@ asm_3ad2e: ; 3ad2e (e:6d2e)
ld [wcf91], a
pop hl
Func_3ad71: ; 3ad71 (e:6d71)
.evoEntryLoop ; loop over evolution entries
ld a, [hli]
and a
jr z, asm_3ad2e
ld b, a
cp $3
jr z, .asm_3ad91
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
cp $32
jr z, asm_3ad2e
and a ; have we reached the end of the evolution data?
jr z, Evolution_PartyMonLoop
ld b, a ; evolution type
cp EV_TRADE
jr z, .checkTradeEvo
; not trade evolution
ld a, [W_ISLINKBATTLE]
cp $32 ; in a trade?
jr z, Evolution_PartyMonLoop ; if so, go the next mon
ld a, b
cp $2
jr z, .asm_3ada4
cp EV_ITEM
jr z, .checkItemEvo
ld a, [wccd4]
and a
jr nz, asm_3ad2e
jr nz, Evolution_PartyMonLoop
ld a, b
cp $1
jr z, .asm_3adad
.asm_3ad91
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
cp $32
jp nz, Func_3aed9
ld a, [hli]
cp EV_LEVEL
jr z, .checkLevel
.checkTradeEvo
ld a, [W_ISLINKBATTLE]
cp $32 ; in a trade?
jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry
ld a, [hli] ; level requirement
ld b, a
ld a, [wcfb9]
cp b
jp c, asm_3ad2e
cp b ; is the mon's level greater than the evolution requirement?
jp c, Evolution_PartyMonLoop ; if so, go the next mon
jr .asm_3adb6
.asm_3ada4
ld a, [hli]
ld b, a
ld a, [wcf91]
cp b
jp nz, Func_3aed9
.asm_3adad
.checkItemEvo
ld a, [hli]
ld b, a ; evolution item
ld a, [wcf91] ; this is supposed to be the last item used, but it is also used to hold species numbers
cp b ; was the evolution item in this entry used?
jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry
.checkLevel
ld a, [hli] ; level requirement
ld b, a
ld a, [wcfb9]
cp b
jp c, Func_3aeda
cp b ; is the mon's level greater than the evolution requirement?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.asm_3adb6
ld [W_CURENEMYLVL], a ; W_CURENEMYLVL
ld [W_CURENEMYLVL], a
ld a, $1
ld [wd121], a
push hl
ld a, [hl]
ld [wHPBarMaxHP + 1], a
ld a, [wWhichPokemon] ; wWhichPokemon
ld hl, wPartyMonNicks ; wPartyMonNicks
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
call CopyStringToCF4B
ld hl, IsEvolvingText
@ -115,17 +120,17 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld c, $32
call DelayFrames
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMap
ld bc, $c14
call ClearScreenArea
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld [H_AUTOBGTRANSFERENABLED], a
ld a, $ff
ld [wcfcb], a
call ClearSprites
callab Func_7bde9
jp c, Func_3af2e
jp c, CancelledEvolution
ld hl, EvolvedText
call PrintText
pop hl
@ -147,7 +152,7 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld c, $28
call DelayFrames
call ClearScreen
call Func_3aef7
call RenameEvolvedMon
ld a, [wd11e]
push af
ld a, [wd0b5]
@ -168,15 +173,15 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld de, wcfba
ld b, $1
call CalcStats
ld a, [wWhichPokemon] ; wWhichPokemon
ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1)
ld bc, $2c
ld a, [wWhichPokemon]
ld hl, wPartyMon1
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld e, l
ld d, h
push hl
push bc
ld bc, $22
ld bc, wPartyMon1MaxHP - wPartyMon1
add hl, bc
ld a, [hli]
ld b, a
@ -202,23 +207,23 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld [wd11e], a
xor a
ld [wcc49], a
call Func_3af5b
call LearnMoveFromLevelUp
pop hl
predef SetPartyMonTypes
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
ld a, [W_ISINBATTLE]
and a
call z, Func_3af52
call z, Evolution_ReloadTilesetTilePatterns
predef IndexToPokedex
ld a, [wd11e]
dec a
ld c, a
ld b, $1
ld hl, wPokedexOwned ; wPokedexOwned
ld hl, wPokedexOwned
push bc
call Func_3b057
call Evolution_FlagAction
pop bc
ld hl, wPokedexSeen ; wd30a
call Func_3b057
ld hl, wPokedexSeen
call Evolution_FlagAction
pop de
pop hl
ld a, [wcf98]
@ -226,25 +231,25 @@ Func_3ad71: ; 3ad71 (e:6d71)
push hl
ld l, e
ld h, d
jr Func_3aeda
jr .nextEvoEntry2
Func_3aed9: ; 3aed9 (e:6ed9)
.nextEvoEntry1
inc hl
Func_3aeda: ; 3aeda (e:6eda)
.nextEvoEntry2
inc hl
jp Func_3ad71
jp .evoEntryLoop
Func_3aede: ; 3aede (e:6ede)
.done
pop de
pop bc
pop hl
pop af
ld [$ffd7], a
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
ld a, [W_ISLINKBATTLE]
cp $32
ret z
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
ld a, [W_ISINBATTLE]
and a
ret nz
ld a, [wd121]
@ -252,7 +257,9 @@ Func_3aede: ; 3aede (e:6ede)
call nz, Func_2307
ret
Func_3aef7: ; 3aef7 (e:6ef7)
; checks if the evolved mon's name is different from the standard name (i.e. it has a nickname)
; if so, rename it to is evolved form's standard name
RenameEvolvedMon: ; 3aef7 (e:6ef7)
ld a, [wd0b5]
push af
ld a, [W_MONHDEXNUM]
@ -262,17 +269,17 @@ Func_3aef7: ; 3aef7 (e:6ef7)
ld [wd0b5], a
ld hl, wcd6d
ld de, wcf4b
.asm_3af0e
.compareNamesLoop
ld a, [de]
inc de
cp [hl]
inc hl
ret nz
cp $50
jr nz, .asm_3af0e
ld a, [wWhichPokemon] ; wWhichPokemon
jr nz, .compareNamesLoop
ld a, [wWhichPokemon]
ld bc, $b
ld hl, wPartyMonNicks ; wPartyMonNicks
ld hl, wPartyMonNicks
call AddNTimes
push hl
call GetName
@ -280,13 +287,13 @@ Func_3aef7: ; 3aef7 (e:6ef7)
pop de
jp CopyData
Func_3af2e: ; 3af2e (e:6f2e)
CancelledEvolution: ; 3af2e (e:6f2e)
ld hl, StoppedEvolvingText
call PrintText
call ClearScreen
pop hl
call Func_3af52
jp asm_3ad2e
call Evolution_ReloadTilesetTilePatterns
jp Evolution_PartyMonLoop
EvolvedText: ; 3af3e (e:6f3e)
TX_FAR _EvolvedText
@ -304,18 +311,18 @@ IsEvolvingText: ; 3af4d (e:6f4d)
TX_FAR _IsEvolvingText
db "@"
Func_3af52: ; 3af52 (e:6f52)
Evolution_ReloadTilesetTilePatterns: ; 3af52 (e:6f52)
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
cp $32
ret z
cp $32 ; in a trade?
ret z ; if so, return
jp ReloadTilesetTilePatterns
Func_3af5b: ; 3af5b (e:6f5b)
LearnMoveFromLevelUp: ; 3af5b (e:6f5b)
ld hl, EvosMovesPointerTable
ld a, [wd11e]
ld a, [wd11e] ; species
ld [wcf91], a
dec a
ld bc, $0
ld bc, 0
ld hl, EvosMovesPointerTable
add a
rl b
@ -324,42 +331,45 @@ Func_3af5b: ; 3af5b (e:6f5b)
ld a, [hli]
ld h, [hl]
ld l, a
.asm_3af73
.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data
ld a, [hli]
and a
jr nz, .asm_3af73
.asm_3af77
and a ; have we reached the end of the evolution data?
jr nz, .skipEvolutionDataLoop ; if not, jump back up
.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
jr z, .asm_3afb1
ld b, a
ld a, [W_CURENEMYLVL] ; W_CURENEMYLVL
cp b
ld a, [hli]
jr nz, .asm_3af77
ld d, a
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, [W_CURENEMYLVL]
cp b ; is the move learnt at the mon's current level?
ld a, [hli] ; move ID
jr nz, .learnSetLoop
ld d, a ; ID of move to learn
ld a, [wcc49]
and a
jr nz, .asm_3af96
ld hl, wPartyMon1Moves ; wPartyMon1Moves
ld a, [wWhichPokemon] ; wWhichPokemon
ld bc, $2c
jr nz, .next
; if [wcc49] is 0, get the address of the mon's current moves
; there is no reason to make this conditional because the code wouldn't work properly without doing this
; every call to this function sets [wcc49] to 0
ld hl, wPartyMon1Moves
ld a, [wWhichPokemon]
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
.asm_3af96
.next
ld b, $4
.asm_3af98
.checkCurrentMovesLoop ; check if the move to learn is already known
ld a, [hli]
cp d
jr z, .asm_3afb1
jr z, .done ; if already known, jump
dec b
jr nz, .asm_3af98
jr nz, .checkCurrentMovesLoop
ld a, d
ld [wd0e0], a
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
predef LearnMove
.asm_3afb1
.done
ld a, [wcf91]
ld [wd11e], a
ret
@ -484,7 +494,7 @@ WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e)
jr nz, .asm_3b050
ret
Func_3b057: ; 3b057 (e:7057)
Evolution_FlagAction: ; 3b057 (e:7057)
predef_jump FlagActionPredef
INCLUDE "data/evos_moves.asm"

View file

@ -1,28 +1,30 @@
Func_58f43: ; 58f43 (16:4f43)
; calculates the level a mon should be based on its current exp
CalcLevelFromExperience: ; 58f43 (16:4f43)
ld a, [wcf98]
ld [wd0b5], a
call GetMonHeader
ld d, $1
.asm_58f4e
inc d
ld d, $1 ; init level to 1
.loop
inc d ; increment level
call CalcExperience
push hl
ld hl, wcfa8
ld a, [$ff98]
ld hl, wcfa8 ; current exp
; compare exp needed for level d with current exp
ld a, [H_MULTIPLICAND + 2]
ld c, a
ld a, [hld]
sub c
ld a, [$ff97]
ld a, [H_MULTIPLICAND + 1]
ld c, a
ld a, [hld]
sbc c
ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND)
ld a, [H_MULTIPLICAND]
ld c, a
ld a, [hl]
sbc c
pop hl
jr nc, .asm_58f4e
dec d
jr nc, .loop ; if exp needed for level d is not greater than exp, try the next level
dec d ; since the exp was too high on the last loop iteration, go back to the previous value and return
ret
; calculates the amount of experience needed for level d

View file

@ -12,7 +12,7 @@ _GivePokemon: ; 4fda5 (13:7da5)
ld [W_ENEMYBATTSTATUS3], a ; W_ENEMYBATTSTATUS3
ld a, [wcf91]
ld [wEnemyMonSpecies2], a
callab Func_3eb01
callab LoadEnemyMonData
call SetPokedexOwnedFlag
callab Func_e7a4
ld hl, wcf4b

View file

@ -32,7 +32,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0)
inc [hl]
.asm_701eb
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld c, BANK(Music_HallOfFame)
ld a, MUSIC_HALL_OF_FAME
call PlayMusic
@ -86,7 +86,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0)
call Func_70377
call Func_70423
xor a
ld [$ffb0], a
ld [hVBlankWY], a
ld hl, rLCDC ; $ff40
res 3, [hl]
ret

View file

@ -64,7 +64,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9)
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
call Delay3
xor a
ld [$ffb0], a
ld [hVBlankWY], a
call SaveScreenTilesToBuffer1
ld a, $11
ld [wd125], a
@ -83,7 +83,7 @@ DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9)
call LoadScreenTilesFromBuffer1
call Delay3
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ret
PrintBlackboardLinkCableText: ; 5dc1a (17:5c1a)

View file

@ -119,7 +119,7 @@ TownMapText: ; fc12 (3:7c12)
set 6, [hl]
call GBPalWhiteOutWithDelay3
xor a
ld [$ffb0], a
ld [hVBlankWY], a
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call LoadFontTilePatterns

View file

@ -237,7 +237,7 @@ ItemUseBall: ; d687 (3:5687)
ld [H_QUOTIENT + 3],a
.next9 ;$5776
pop bc
ld a,[wd007] ;enemy: Catch Rate
ld a,[wEnemyMonCatchRate] ;enemy: Catch Rate
cp b
jr c,.next10
ld a,[H_QUOTIENT + 2]
@ -256,7 +256,7 @@ ItemUseBall: ; d687 (3:5687)
xor a
ld [H_MULTIPLICAND],a
ld [H_MULTIPLICAND + 1],a
ld a,[wd007] ;enemy: Catch Rate
ld a,[wEnemyMonCatchRate] ;enemy: Catch Rate
ld [H_MULTIPLICAND + 2],a
ld a,100
ld [H_MULTIPLIER],a
@ -376,7 +376,7 @@ ItemUseBall: ; d687 (3:5687)
ld [wcf91],a
ld a,[wEnemyMonLevel]
ld [W_CURENEMYLVL],a
callab Func_3eb01
callab LoadEnemyMonData
pop af
ld [wcf91],a
pop hl
@ -647,7 +647,7 @@ ItemUseEvoStone: ; da5b (3:5a5b)
ld a,(SFX_02_3e - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent ; play sound
call WaitForSoundToFinish ; wait for sound to end
callab Func_3ad0e ; try to evolve pokemon
callab TryEvolvingMon ; try to evolve pokemon
ld a,[wd121]
and a
jr z,.noEffect
@ -805,7 +805,7 @@ ItemUseMedicine: ; dabb (3:5abb)
push bc
ld a,[wcf06]
ld c,a
ld hl,wccf5
ld hl,wPartyFoughtCurrentEnemyFlags
ld b,$02
predef FlagActionPredef
ld a,c
@ -813,7 +813,7 @@ ItemUseMedicine: ; dabb (3:5abb)
jr z,.next
ld a,[wcf06]
ld c,a
ld hl,wPartyAliveFlags
ld hl,wPartyGainExpFlags
ld b,$01
predef FlagActionPredef
.next
@ -1273,10 +1273,10 @@ ItemUseMedicine: ; dabb (3:5abb)
call WaitForTextScrollButtonPress ; wait for button press
xor a
ld [wcc49],a
predef Func_3af5b ; learn level up move, if any
predef LearnMoveFromLevelUp ; learn level up move, if any
xor a
ld [wccd4],a
callab Func_3ad0e ; evolve pokemon, if appropriate
callab TryEvolvingMon ; evolve pokemon, if appropriate
ld a,$01
ld [wcfcb],a
pop af
@ -1303,17 +1303,17 @@ VitaminText: ; df2e (3:5f2e)
ItemUseBait: ; df52 (3:5f52)
ld hl,ThrewBaitText
call PrintText
ld hl,wd007 ; catch rate
ld hl,wEnemyMonCatchRate ; catch rate
srl [hl] ; halve catch rate
ld a,BAIT_ANIM
ld hl,wcce9 ; bait factor
ld de,wcce8 ; escape factor
ld hl,wSafariBaitFactor ; bait factor
ld de,wSafariEscapeFactor ; escape factor
jr BaitRockCommon
ItemUseRock: ; df67 (3:5f67)
ld hl,ThrewRockText
call PrintText
ld hl,wd007 ; catch rate
ld hl,wEnemyMonCatchRate ; catch rate
ld a,[hl]
add a ; double catch rate
jr nc,.noCarry
@ -1321,8 +1321,8 @@ ItemUseRock: ; df67 (3:5f67)
.noCarry
ld [hl],a
ld a,ROCK_ANIM
ld hl,wcce8 ; escape factor
ld de,wcce9 ; bait factor
ld hl,wSafariEscapeFactor ; escape factor
ld de,wSafariBaitFactor ; bait factor
BaitRockCommon: ; df7f (3:5f7f)
ld [W_ANIMATIONID],a
@ -1383,7 +1383,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf)
ld [W_NUMSAFARIBALLS],a
ld [W_SAFARIZONEENTRANCECURSCRIPT],a
inc a
ld [wd078],a
ld [wEscapedFromBattle],a
ld [wcd6a],a ; item used
ld a,[wd152]
and a ; using Dig?
@ -1517,7 +1517,7 @@ ItemUsePokedoll: ; e0cd (3:60cd)
dec a
jp nz,ItemUseNotTime
ld a,$01
ld [wd078],a
ld [wEscapedFromBattle],a
jp PrintItemUseTextAndRemoveItem
ItemUseGuardSpec: ; e0dc (3:60dc)

View file

@ -523,7 +523,7 @@ PrintJustAMomentText1:: ; 5824 (8:5825)
cp $c
ret nz
ld a, [W_CURMAP]
cp $ef
cp BATTLE_CENTER
ld a, $2
jr z, .asm_2183a
inc a
@ -541,7 +541,7 @@ PrintJustAMomentText2:: ; 5845 (8:5845)
cp $8
ret nz
ld a, [W_CURMAP]
cp $ef
cp BATTLE_CENTER
ld a, $2
jr z, .asm_2185a
inc a

View file

@ -171,8 +171,8 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
and a
jp z, LoadTextBoxTilePatterns
ld hl, Func_3ee5b
ld b, BANK(Func_3ee5b)
ld hl, LoadHudTilePatterns
ld b, BANK(LoadHudTilePatterns)
jp Bankswitch
.unknownPointerTable_665e: ; 665e (1:665e)

View file

@ -57,7 +57,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
call LoadMonData
pop hl
push hl
ld a,[wcc35]
ld a,[wMenuItemToSwap]
and a ; is the player swapping pokemon positions?
jr z,.skipUnfilledRightArrow
; if the player is swapping pokemon positions

View file

@ -11,14 +11,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
and a
jp z,RedisplayStartMenu
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld [wd07d],a
ld [wcfcb],a
call DisplayPartyMenu
jr .checkIfPokemonChosen
.loop
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld [wd07d],a
call GoBackToPartyMenu
.checkIfPokemonChosen
@ -336,7 +336,7 @@ StartMenu_Item: ; 13302 (4:7302)
Coorda 5, 10
call PlaceUnfilledArrowMenuCursor
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld a,[wcf91]
cp a,BICYCLE
jp z,.useOrTossItem
@ -738,17 +738,17 @@ SwitchPartyMon_OAM: ; 13625 (4:7625)
jp PlaySound
SwitchPartyMon_Stats: ; 13653 (4:7653)
ld a, [wcc35]
ld a, [wMenuItemToSwap]
and a
jr nz, .asm_13661
ld a, [wWhichPokemon] ; wWhichPokemon
inc a
ld [wcc35], a
ld [wMenuItemToSwap], a
ret
.asm_13661
xor a
ld [wd07d], a
ld a, [wcc35]
ld a, [wMenuItemToSwap]
dec a
ld b, a
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
@ -756,12 +756,12 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
cp b
jr nz, .asm_1367b
xor a
ld [wcc35], a
ld [wMenuItemToSwap], a
ld [wd07d], a
ret
.asm_1367b
ld a, b
ld [wcc35], a
ld [wMenuItemToSwap], a
push hl
push de
ld hl, wPartySpecies
@ -773,7 +773,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
jr nc, .asm_1368e
inc h
.asm_1368e
ld a, [wcc35]
ld a, [wMenuItemToSwap]
add e
ld e, a
jr nc, .asm_13696
@ -795,7 +795,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
call CopyData
ld hl, wPartyMons
ld bc, $2c
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call AddNTimes
pop de
push hl
@ -813,7 +813,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ld bc, $b
call CopyData
ld hl, wPartyMonOT ; wd273
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call SkipFixedLengthTextEntries
pop de
push hl
@ -831,7 +831,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ld bc, $b
call CopyData
ld hl, wPartyMonNicks ; wPartyMonNicks
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call SkipFixedLengthTextEntries
pop de
push hl
@ -841,10 +841,10 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ld hl, wcc97
ld bc, $b
call CopyData
ld a, [wcc35]
ld a, [wMenuItemToSwap]
ld [wWhichTrade], a ; wWhichTrade
xor a
ld [wcc35], a
ld [wMenuItemToSwap], a
ld [wd07d], a
pop de
pop hl

View file

@ -24,7 +24,7 @@ Func_71e1: ; 71e1 (1:71e1)
ld a, $ff
ld [$ffaa], a
ld a, $2
ld [$ff01], a
ld [rSB], a
xor a
ld [$ffad], a
ld a, $80
@ -34,7 +34,7 @@ Func_71e1: ; 71e1 (1:71e1)
ld [wcc47], a
jr z, .asm_7287 ; 0x720b $7a
ld a, $1
ld [$ff01], a
ld [rSB], a
ld a, $81
ld [$ff02], a
call DelayFrame
@ -148,7 +148,7 @@ Func_72d7: ; 72d7 (1:72d7)
ld a, $ff
ld [$ffaa], a
ld a, $2
ld [$ff01], a
ld [rSB], a
xor a
ld [$ffad], a
ld a, $80

View file

@ -38,14 +38,14 @@ asm_ef82: ; ef82 (3:6f82)
call ClearSprites
call Func_3dbe
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
call Delay3
call LoadGBPal
call LoadCurrentMapView
call SaveScreenTilesToBuffer2
call Delay3
xor a
ld [$ffb0], a
ld [hVBlankWY], a
ld hl, UsedCutText
call PrintText
call LoadScreenTilesFromBuffer2
@ -63,7 +63,7 @@ asm_ef82: ; ef82 (3:6f82)
ld a, (SFX_02_56 - SFX_Headers_02) / 3
call PlaySound
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
call UpdateSprites
jp Func_eedc

View file

@ -52,7 +52,7 @@ GetPredefPointer:
PredefPointers:: ; 4fe79 (13:7e79)
; these are pointers to ASM routines.
; they appear to be used in overworld map scripts.
add_predef Func_3cd60
add_predef DrawPlayerHUDAndHPBar
add_predef Func_3f0c6
add_predef Func_3f073
add_predef ScaleSpriteByTwo
@ -78,7 +78,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef Func_ee9e
add_predef InitPlayerData2
add_predef Func_c754
add_predef Func_3af5b
add_predef LearnMoveFromLevelUp
add_predef LearnMove
add_predef IsItemInBag_ ; 1C, used in Pokémon Tower
dbw $03,Func_3eb5 ; for these two, the bank number is actually 0
@ -94,7 +94,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef Func_5ab0
add_predef Func_3ed02
add_predef ShowPokedexMenu
add_predef Func_3ad1c
add_predef EvolutionAfterBattle
add_predef SaveSAVtoSRAM0
add_predef InitOpponent
add_predef Func_5a5f
@ -125,7 +125,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef StarterDex ; 46
add_predef _AddPartyMon
add_predef UpdateHPBar2
add_predef Func_3cdec
add_predef DrawEnemyHUDAndHPBar
add_predef LoadTownMap_Nest
add_predef Func_27d6b
add_predef EmotionBubble; 4C player exclamation

View file

@ -11,7 +11,7 @@ SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7)
ld de, W_RIVALNAME ; wd34a
call CopyFixedLengthText
xor a
ld [$ffb0], a
ld [hVBlankWY], a
ld [wd358], a
ld hl, wd732
ld [hli], a
@ -31,7 +31,7 @@ LoadTitlescreenGraphics: ; 42dd (1:42dd)
ld a, $40
ld [$ffaf], a
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
call ClearScreen
call DisableLCD
call LoadFontTilePatterns
@ -127,7 +127,7 @@ ENDC
call Func_4533
call SaveScreenTilesToBuffer1
ld a, $40
ld [$ffb0], a
ld [hVBlankWY], a
call LoadScreenTilesFromBuffer2
ld a, $98
call Func_4533
@ -182,7 +182,7 @@ ENDC
call PlaySound
call PrintGameVersionOnTitleScreen
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld d, $90
.asm_440a
ld h, d
@ -225,7 +225,7 @@ ENDC
call GBPalWhiteOutWithDelay3
call ClearSprites
xor a
ld [$ffb0], a
ld [hVBlankWY], a
inc a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
call ClearScreen
@ -270,7 +270,7 @@ Func_4496: ; 4496 (1:4496)
call Func_4524
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld d, 1 ; scroll out
callba TitleScroll
ret
@ -279,7 +279,7 @@ Func_44c1: ; 44c1 (1:44c1)
ld d, 0 ; scroll in
callba TitleScroll
xor a
ld [$ffb0], a
ld [hVBlankWY], a
ret
Func_44cf: ; 44cf (1:44cf)
@ -353,7 +353,7 @@ Func_4533: ; 4533 (1:4533)
LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538)
xor a
ld [$ffb0], a
ld [hVBlankWY], a
call ClearScreen
call LoadTextBoxTilePatterns

View file

@ -175,7 +175,7 @@ Func_41245: ; 41245 (10:5245)
ld a, $ab
ld [rLCDC], a ; $ff40
ld a, $50
ld [$ffb0], a
ld [hVBlankWY], a
ld a, $86
ld [rWX], a ; $ff4b
ld [$ffae], a
@ -397,7 +397,7 @@ Func_41411: ; 41411 (10:5411)
xor a
ld [$ffae], a
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ret
Func_4142d: ; 4142d (10:542d)
@ -655,7 +655,7 @@ Func_415c8: ; 415c8 (10:55c8)
ld a, $7
ld [rWX], a ; $ff4b
xor a
ld [$ffb0], a
ld [hVBlankWY], a
ld a, $90
ld [$ffae], a
ret

View file

@ -417,7 +417,7 @@ HandlePartyMenuInput:: ; 145a (0:145a)
ld [wcc2b],a
ld hl,wd730
res 6,[hl] ; turn on letter printing delay
ld a,[wcc35]
ld a,[wMenuItemToSwap]
and a
jp nz,.swappingPokemon
pop af
@ -449,7 +449,7 @@ HandlePartyMenuInput:: ; 145a (0:145a)
.cancelSwap ; if the B button was pressed
callba ErasePartyMenuCursors
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld [wd07d],a
call RedrawPartyMenu
jr HandlePartyMenuInput
@ -1155,10 +1155,10 @@ Serial:: ; 2125 (0:2125)
ld a, [$ffaa]
inc a
jr z, .asm_2142
ld a, [$ff01]
ld a, [rSB]
ld [$ffad], a
ld a, [$ffac]
ld [$ff01], a
ld [rSB], a
ld a, [$ffaa]
cp $2
jr z, .asm_2162
@ -1166,13 +1166,13 @@ Serial:: ; 2125 (0:2125)
ld [$ff02], a
jr .asm_2162
.asm_2142
ld a, [$ff01]
ld a, [rSB]
ld [$ffad], a
ld [$ffaa], a
cp $2
jr z, .asm_215f
xor a
ld [$ff01], a
ld [rSB], a
ld a, $3
ld [rDIV], a ; $ff04
.asm_2153
@ -1184,7 +1184,7 @@ Serial:: ; 2125 (0:2125)
jr .asm_2162
.asm_215f
xor a
ld [$ff01], a
ld [rSB], a
.asm_2162
ld a, $1
ld [$ffa9], a
@ -1445,7 +1445,7 @@ Func_22ed:: ; 22ed (0:22ed)
Func_22fa:: ; 22fa (0:22fa)
ld a, $2
ld [$ff01], a
ld [rSB], a
xor a
ld [$ffad], a
ld a, $80
@ -1697,7 +1697,7 @@ CloseTextDisplay:: ; 29e8 (0:29e8)
ld a,[W_CURMAP]
call SwitchToMapRomBank
ld a,$90
ld [$ffb0],a ; move the window off the screen
ld [hVBlankWY],a ; move the window off the screen
call DelayFrame
call LoadGBPal
xor a
@ -1919,13 +1919,13 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
ld a,$01 ; hardcoded bank
jr .bankswitch
.specialBattleType ; Old Man battle
ld a, Bank(OldManItemList)
ld a, Bank(DisplayBattleMenu)
.bankswitch
call BankswitchHome
ld hl,wd730
set 6,[hl] ; turn off letter printing delay
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
ld [wd12a],a
ld a,[wcf8b]
ld l,a
@ -2206,11 +2206,11 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
jp .waitForKeyPressLoop
.buttonAPressed ; the player chose to make the transaction
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
ret
.buttonBPressed ; the player chose to cancel the transaction
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
ld a,$ff
ret
@ -2232,7 +2232,7 @@ ExitListMenu:: ; 2e3b (0:2e3b)
res 6,[hl]
call BankswitchBack
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
scf
ret
@ -2400,7 +2400,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
inc c
push bc
inc c
ld a,[wcc35] ; ID of item chosen for swapping (counts from 1)
ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1)
and a ; is an item being swapped?
jr z,.nextListEntry
sla a
@ -2610,7 +2610,7 @@ ChooseFlyDestination:: ; 30a9 (0:30a9)
ld hl, LoadTownMap_Fly
jp Bankswitch
; causes the text box to close waithout waiting for a button press after displaying text
; causes the text box to close without waiting for a button press after displaying text
DisableWaitingAfterTextDisplay:: ; 30b6 (0:30b6)
ld a,$01
ld [wcc3c],a
@ -3095,7 +3095,7 @@ Func_3381:: ; 3381 (0:3381)
jp WaitForSoundToFinish
Func_33b7:: ; 33b7 (0:33b7)
ld a, [wcf0b]
ld a, [wBattleResult]
and a
jr nz, .asm_33c6
ld a, [W_PBSTOREDREGISTERH]

View file

@ -25,7 +25,7 @@ rLCDC_DEFAULT EQU %11100011
ld [rIE], a
ld [$ff43], a
ld [$ff42], a
ld [$ff01], a
ld [rSB], a
ld [$ff02], a
ld [$ff4b], a
ld [$ff4a], a
@ -74,7 +74,7 @@ rLCDC_DEFAULT EQU %11100011
ld [rIE], a
ld a, 144 ; move the window off-screen
ld [$ffb0], a
ld [hVBlankWY], a
ld [rWY], a
ld a, 7
ld [rWX], a

View file

@ -766,7 +766,7 @@ HandleFlyOrTeleportAway::
call UpdateSprites
call Delay3
xor a
ld [wcf0b], a
ld [wBattleResult], a
ld [wd700], a
ld [W_ISINBATTLE], a
ld [wd35d], a

View file

@ -8,15 +8,15 @@ VBlank::
ld a, [H_LOADEDROMBANK]
ld [wd122], a
ld a, [$ffae]
ld a, [hVBlankSCX]
ld [rSCX], a
ld a, [$ffaf]
ld a, [hVBlankSCY]
ld [rSCY], a
ld a, [wd0a0]
and a
jr nz, .ok
ld a, [$ffb0]
ld a, [hVBlankWY]
ld [rWY], a
.ok

View file

@ -32,6 +32,11 @@ H_NUMTOPRINT EQU $FF96 ; 3 bytes, big endian order
H_POWEROFTEN EQU $FF99 ; 3 bytes, big endian order
H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes, big endian order (to back out of a subtraction)
; these values are copied to SCX, SCY, and WY during V-blank
hVBlankSCX EQU $FFAE
hVBlankSCY EQU $FFAF
hVBlankWY EQU $FFB0
hJoyHeldLast EQU $FFB1
hJoyReleased EQU $FFB2
hJoyPressed EQU $FFB3

View file

@ -22,7 +22,7 @@ INCLUDE "data/facing.asm"
Func_40b0::
; Reset player status on blackout.
xor a
ld [wcf0b], a
ld [wBattleResult], a
ld [wd700], a
ld [W_ISINBATTLE], a
ld [wd35d], a
@ -821,7 +821,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
pop hl
inc a
jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item
ld a,[wcc35] ; ID of item chosen for swapping (counts from 1)
ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1)
and a ; has the first item to swap already been chosen?
jr nz,.swapItems
; if not, set the currently selected item as the first item
@ -830,7 +830,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld b,a
ld a,[wListScrollOffset] ; index of top (visible) menu item within the list
add b
ld [wcc35],a ; ID of item chosen for swapping (counts from 1)
ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1)
ld c,20
call DelayFrames
jp DisplayListMenuIDLoop
@ -841,11 +841,11 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld a,[wListScrollOffset]
add b
ld b,a
ld a,[wcc35] ; ID of item chosen for swapping (counts from 1)
ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1)
cp b ; is the currently selected item the same as the first item to swap?
jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself
dec a
ld [wcc35],a ; ID of item chosen for swapping (counts from 1)
ld [wMenuItemToSwap],a ; ID of item chosen for swapping (counts from 1)
ld c,20
call DelayFrames
push hl
@ -865,7 +865,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld c,a
ld b,0
add hl,bc ; hl = address of currently selected item entry
ld a,[wcc35] ; ID of item chosen for swapping (counts from 1)
ld a,[wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1)
add a
add e
ld e,a
@ -892,7 +892,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld a,[$ff95]
ld [de],a ; put second item ID in first item slot
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
pop de
pop hl
jp DisplayListMenuIDLoop
@ -944,7 +944,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld [wCurrentMenuItem],a
.done
xor a
ld [wcc35],a ; 0 means no item is currently being swapped
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
pop de
pop hl
jp DisplayListMenuIDLoop
@ -1059,7 +1059,7 @@ DisplayTextIDInit: ; 7096 (1:7096)
ld b,$9c ; window background address
call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM
xor a
ld [$ffb0],a ; put the window on the screen
ld [hVBlankWY],a ; put the window on the screen
call LoadFontTilePatterns
ld a,$01
ld [H_AUTOBGTRANSFERENABLED],a ; enable continuous WRAM to VRAM transfer each V-blank
@ -2019,7 +2019,7 @@ INCLUDE "data/map_header_banks.asm"
Func_c335: ; c335 (3:4335)
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld [rWY], a ; $ff4a
xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
@ -3978,7 +3978,7 @@ Func_f51e: ; f51e (3:751e)
add $2
ld [wcc49], a
call LoadMonData
callba Func_58f43
callba CalcLevelFromExperience
ld a, d
ld [W_CURENEMYLVL], a ; W_CURENEMYLVL
pop hl

View file

@ -27,7 +27,7 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15)
ld [wcf8c], a
xor a
ld [wcf93], a
ld [wcc35], a
ld [wMenuItemToSwap], a
ld a, SPECIALLISTMENU
ld [wListMenuID], a
call DisplayListMenuID

View file

@ -26,7 +26,7 @@ DayCareMText1: ; 56254 (15:6254)
xor a
ld [wcfcb], a
ld [wd07d], a
ld [wcc35], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
push af
call GBPalWhiteOutWithDelay3
@ -65,7 +65,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
ld a, $3
ld [wcc49], a
call LoadMonData
callab Func_58f43
callab CalcLevelFromExperience
ld a, d
cp $64
jr c, .asm_56315

View file

@ -51,7 +51,7 @@ NameRaterText1: ; 1da56 (7:5a56)
xor a
ld [wd07d], a
ld [wcfcb], a
ld [wcc35], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
push af
call GBPalWhiteOutWithDelay3

View file

@ -57,7 +57,7 @@ PokemonTower6Script4: ; 60b48 (18:4b48)
call UpdateSprites
ld a, $f0
ld [wJoyIgnore], a
ld a, [wcf0b]
ld a, [wBattleResult]
and a
jr nz, .asm_60b82
ld hl, wd768

View file

@ -47,7 +47,7 @@ Route12Script3: ; 5964c (16:564c)
cp $ff
jr z, Route12Script_59606
call UpdateSprites
ld a, [wcf0b]
ld a, [wBattleResult]
cp $2
jr z, .asm_59664
ld a, $e

View file

@ -48,7 +48,7 @@ Route16Script3: ; 5998f (16:598f)
cp $ff
jp z, Route16Script_59946
call UpdateSprites
ld a, [wcf0b]
ld a, [wBattleResult]
cp $2
jr z, .asm_599a8
ld a, $b

View file

@ -106,10 +106,10 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b)
jr nz, .asm_1dbfa ; 0x1dc22 $d6
xor a
ld [$ff4a], a
ld [$ffb0], a
ld [hVBlankWY], a
call VermilionDock_1dc94
ld a, $90
ld [$ffb0], a
ld [hVBlankWY], a
ld a, $1
ld [wcfcb], a
pop hl

View file

@ -1551,7 +1551,7 @@ _SafariZoneAngryText:: ; 89d6a (22:5d6a)
_PickUpPayDayMoneyText:: ; 89d80 (22:5d80)
text $52, " picked up"
line "¥@"
TX_BCD wcce5, $c3
TX_BCD wTotalPayDayMoney, $c3
text "!"
prompt

117
wram.asm
View file

@ -247,7 +247,9 @@ wMenuJoypadPollCount:: ; cc34
; how many times should HandleMenuInput poll the joypad state before it returns?
ds 1
wcc35:: ds 1
wMenuItemToSwap:: ; cc35
; id of menu item selected for swapping (counts from 1) (0 means that no menu item has been selected for swapping)
ds 1
wListScrollOffset:: ; cc36
; offset of the current top menu item from the beginning of the list
@ -336,10 +338,18 @@ wEnemyMoveListIndex:: ; cce2
wcce3:: ds 1
wcce4:: ds 1
wcce5:: ds 2
wcce7:: ds 1
wcce8:: ds 1
wcce9:: ds 2
wTotalPayDayMoney:: ; cce5
; total amount of money made using Pay Day during the current battle
ds 3
wSafariEscapeFactor:: ; cce8
ds 1
wSafariBaitFactor:: ; cce9
ds 1;
ds 1
wcceb:: ds 1
wccec:: ds 1
wcced:: ds 1
@ -350,16 +360,38 @@ wccf1:: ds 1
wccf2:: ds 1
wccf3:: ds 1
wccf4:: ds 1
wccf5:: ds 1
wPartyFoughtCurrentEnemyFlags::
; flags that indicate which party members have fought the current enemy mon
flag_array 6
wccf6:: ds 1
wccf7:: ds 14
wcd05:: ds 1
wcd06:: ds 9
wcd0f:: ds 1
wcd10:: ds 1
wcd11:: ds 1
wcd12:: ds 1
wcd13:: ds 7
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 0
wcd0f:: ; overload, used in in-game trade code
ds 1
wPlayerMonUnmodifiedMaxHP:: ; cd10
ds 0
wcd10:: ; overload, used in in-game trade code
ds 1
wcd11:: ; overload, used in in-game trade code
ds 1
wPlayerMonUnmodifiedAttack:: ; cd12
ds 0
wcd12:: ; overload, used in in-game trade code
ds 1
wcd13:: ; overload, used in in-game trade code (to store name string)
ds 1
wPlayerMonUnmodifiedDefense:: ; cd14
ds 2
wPlayerMonUnmodifiedSpeed:: ; cd16
ds 2
wPlayerMonUnmodifiedSpecial:: ; cd18
ds 2
; stat modifiers for the player's current pokemon
; value can range from 1 - 13 ($1 to $D)
@ -381,9 +413,20 @@ wPlayerMonEvasionMod:: ; cd1f
ds 3
wcd23:: ds 3
wcd26:: ds 3
wcd29:: ds 4
wEnemyMonUnmodifiedLevel:: ; cd23
ds 1
wEnemyMonUnmodifiedMaxHP:: ; cd24
ds 2
wEnemyMonUnmodifiedAttack:: ; cd26
ds 2
wEnemyMonUnmodifiedDefense:: ; cd28
ds 1
wcd29:: ; overload, used in in-game trade code
ds 1
wEnemyMonUnmodifiedSpeed:: ; cd2a
ds 2
wEnemyMonUnmodifiedSpecial:: ; cd2c
ds 1
wEngagedTrainerClass:: ; cd2d
ds 1
@ -505,7 +548,11 @@ wAnimSoundID:: ; cf07
wcf08:: ds 1
wcf09:: ds 1
wcf0a:: ds 1
wcf0b:: ds 1
wBattleResult:: ; cf0b
; $00 - win
; $01 - lose
; $02 - draw
ds 1
wcf0c:: ds 1
wcf0d:: ds 1
wcf0e:: ds 1
@ -660,7 +707,7 @@ wEnemyMonStatus:: db
wEnemyMonType::
wEnemyMonType1:: db
wEnemyMonType2:: db
wEnemyMonCatchRate:: db
wEnemyMonCatchRate_NotReferenced:: db
wEnemyMonMoves:: ds NUM_MOVES
wEnemyMonDVs:: ds 2
wEnemyMonLevel:: db
@ -673,9 +720,9 @@ wEnemyMonPP:: ds 2 ; NUM_MOVES - 2
SECTION "WRAM Bank 1", WRAMX, BANK[1]
ds 2 ; NUM_MOVES - 2
wd002:: ds 5
wd007:: ds 1
wd008:: ds 1
wEnemyMonBaseStats:: ds 5
wEnemyMonCatchRate:: ds 1
wEnemyMonBaseExp:: ds 1
wBattleMonNick:: ds 11 ; d009
wBattleMon:: battle_struct wBattleMon ; d014
@ -705,7 +752,8 @@ W_ISINBATTLE:: ; d057
; trainer battle, this is 2
ds 1
wPartyAliveFlags:: ; d058
wPartyGainExpFlags:: ; d058
; flags that indicate which party members should be be given exp when GainExperience is called
flag_array 6
W_CUROPPONENT:: ; d059
@ -730,7 +778,12 @@ W_TRAINERNO:: ; d05d
; which instance of [youngster, lass, etc] is this?
ds 1
wd05e:: ds 1
wCriticalHitOrOHKO:: ; d05e
; $00 = normal attack
; $01 = critical hit
; $02 = successful OHKO
; $ff = failed OHKO
ds 1
W_MOVEMISSED:: ; d05f
ds 1
@ -776,7 +829,10 @@ W_ENEMYBATTSTATUS2:: ; d068
W_ENEMYBATTSTATUS3:: ; d069
ds 1
wd06a:: ds 1
wPlayerNumAttacksLeft::
; when the player is attacking multiple times, the number of attacks left
ds 1
wd06b:: ds 1
W_PLAYERTOXICCOUNTER:: ; d06c
@ -786,7 +842,10 @@ W_PLAYERDISABLEDMOVE:: ; d06d
ds 1
wd06f:: ds 1
wEnemyNumAttacksLeft::
; when the player is attacking multiple times, the number of attacks left
ds 1
wd070:: ds 1
W_ENEMYTOXICCOUNTER:: ; d071
@ -801,7 +860,11 @@ W_NUMHITS:: ; d074
ds 1
wd075:: ds 3
wd078:: ds 1
wEscapedFromBattle::
; non-zero when an item or move that allows escape from battle was used
ds 1
wd079:: ds 1
wd07a:: ds 1
wd07b:: ds 1
@ -1016,7 +1079,11 @@ wd11c:: ds 1
wd11d:: ds 1
wd11e:: ds 1
wd11f:: ds 1
wd120:: ds 1
wNumRunAttempts::
; number of times the player has tried to run from battle
ds 1
wd121:: ds 1
wd122:: ds 2
wd124:: ds 1