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 dec c
jr nz,.next2 jr nz,.next2
xor a xor a
ld [$FFB0],a ld [hVBlankWY],a
ld a,$C0 ld a,$C0
ld [$FF47],a ld [$FF47],a
ret ret

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,7 +26,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld [hli], a ld [hli], a
ld [hl], a ; set the damage output to zero ld [hl], a ; set the damage output to zero
dec a dec a
ld [wd05e], a ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1 ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1 ld de, wEnemyMonSpeed + 1
ld a, [H_WHOSETURN] ; $fff3 ld a, [H_WHOSETURN] ; $fff3
@ -50,7 +50,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld a, $2 ld a, $2
ld [wd05e], a ld [wCriticalHitOrOHKO], a
ret ret
.asm_33f8a .asm_33f8a
ld a, $1 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 call LoadTextBoxTilePatterns
hlCoord 3, 4 hlCoord 3, 4
ld b, $7 ld b, $7
ld c, $c ld c, $c
call TextBoxBorder call TextBoxBorder
hlCoord 4, 5 hlCoord 4, 5
ld de, wPlayerName ; wd158 ld de, wPlayerName
call PlaceString call PlaceString
hlCoord 4, 10 hlCoord 4, 10
ld de, W_GRASSRATE ; W_GRASSRATE ld de, W_GRASSRATE ; enemy name
call PlaceString call PlaceString
; place bold "VS" tiles between the names
hlCoord 9, 8 hlCoord 9, 8
ld a, $69 ld a, $69
ld [hli], a ld [hli], a
@ -17,5 +19,5 @@ Func_372d6: ; 372d6 (d:72d6)
xor a xor a
ld [wcfcb], a ld [wcfcb], a
callab SetupPlayerAndEnemyPokeballs callab SetupPlayerAndEnemyPokeballs
ld c, $96 ld c, 150
jp DelayFrames jp DelayFrames

View file

@ -1203,11 +1203,11 @@ Func_3a72a: ; 3a72a (e:672a)
ld a,d ; how many available monsters are there? ld a,d ; how many available monsters are there?
cp 2 ; don't bother if only 1 or 2 cp 2 ; don't bother if only 1 or 2
jp nc,Func_3a74b jp nc,SwitchEnemyMon
and a and a
ret ret
Func_3a74b: ; 3a74b (e:674b) SwitchEnemyMon: ; 3a74b (e:674b)
; prepare to withdraw the active monster: copy hp, number, and status to roster ; 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 .asm_3ba83
ld [wListMenuID], a ; wListMenuID ld [wListMenuID], a ; wListMenuID
predef UpdateHPBar2 predef UpdateHPBar2
ld hl, Func_3cd5a ; $4d5a ld hl, DrawHUDsAndHPBars ; $4d5a
call BankswitchEtoF call BankswitchEtoF
ld hl, RegainedHealthText ; $7aac ld hl, RegainedHealthText ; $7aac
jp PrintText jp PrintText
@ -226,8 +226,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld a, [hl] ld a, [hl]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
ld hl, wcd26 ld hl, wEnemyMonUnmodifiedAttack
ld de, wcd12 ld de, wPlayerMonUnmodifiedAttack
call Func_3bb7d call Func_3bb7d
ld hl, wEnemyMonStatMods ; wcd2e ld hl, wEnemyMonStatMods ; wcd2e
ld de, wPlayerMonStatMods ; wcd1a ld de, wPlayerMonStatMods ; wcd1a

View file

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

View file

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

View file

@ -38,7 +38,7 @@ EvolveTradeMon: ; 17d7d (5:7d7d)
ld [wccd4], a ld [wccd4], a
ld a, $32 ld a, $32
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
callab Func_3ad0e callab TryEvolvingMon
xor a xor a
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
jp Func_2307 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 ld hl, wccd3
xor a xor a
ld [hl], a ld [hl], a
ld a, [wWhichPokemon] ; wWhichPokemon ld a, [wWhichPokemon]
ld c, a ld c, a
ld b, $1 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] ld a, [$ffd7]
push af push af
xor a xor a
ld [wd121], a ld [wd121], a
dec a dec a
ld [wWhichPokemon], a ; wWhichPokemon ld [wWhichPokemon], a
push hl push hl
push bc push bc
push de push de
ld hl, wPartyCount ; wPartyCount ld hl, wPartyCount
push hl push hl
asm_3ad2e: ; 3ad2e (e:6d2e)
ld hl, wWhichPokemon ; wWhichPokemon Evolution_PartyMonLoop: ; loop over party mons
ld hl, wWhichPokemon
inc [hl] inc [hl]
pop hl pop hl
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $ff cp $ff ; have we reached the end of the party?
jp z, Func_3aede jp z, .done
ld [wHPBarMaxHP], a ld [wHPBarMaxHP], a
push hl push hl
ld a, [wWhichPokemon] ; wWhichPokemon ld a, [wWhichPokemon]
ld c, a ld c, a
ld hl, wccd3 ld hl, wccd3
ld b, $2 ld b, $2
call Func_3b057 call Evolution_FlagAction
ld a, c ld a, c
and a and a ; is the mon's bit set?
jp z, asm_3ad2e jp z, Evolution_PartyMonLoop ; if not, go to the next mon
ld a, [wHPBarMaxHP] ld a, [wHPBarMaxHP]
dec a dec a
ld b, $0 ld b, 0
ld hl, EvosMovesPointerTable ld hl, EvosMovesPointerTable
add a add a
rl b rl b
@ -58,56 +62,57 @@ asm_3ad2e: ; 3ad2e (e:6d2e)
ld [wcf91], a ld [wcf91], a
pop hl pop hl
Func_3ad71: ; 3ad71 (e:6d71) .evoEntryLoop ; loop over evolution entries
ld a, [hli] ld a, [hli]
and a and a ; have we reached the end of the evolution data?
jr z, asm_3ad2e jr z, Evolution_PartyMonLoop
ld b, a ld b, a ; evolution type
cp $3 cp EV_TRADE
jr z, .asm_3ad91 jr z, .checkTradeEvo
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE ; not trade evolution
cp $32 ld a, [W_ISLINKBATTLE]
jr z, asm_3ad2e cp $32 ; in a trade?
jr z, Evolution_PartyMonLoop ; if so, go the next mon
ld a, b ld a, b
cp $2 cp EV_ITEM
jr z, .asm_3ada4 jr z, .checkItemEvo
ld a, [wccd4] ld a, [wccd4]
and a and a
jr nz, asm_3ad2e jr nz, Evolution_PartyMonLoop
ld a, b ld a, b
cp $1 cp EV_LEVEL
jr z, .asm_3adad jr z, .checkLevel
.asm_3ad91 .checkTradeEvo
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE ld a, [W_ISLINKBATTLE]
cp $32 cp $32 ; in a trade?
jp nz, Func_3aed9 jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry
ld a, [hli] ld a, [hli] ; level requirement
ld b, a ld b, a
ld a, [wcfb9] ld a, [wcfb9]
cp b cp b ; is the mon's level greater than the evolution requirement?
jp c, asm_3ad2e jp c, Evolution_PartyMonLoop ; if so, go the next mon
jr .asm_3adb6 jr .asm_3adb6
.asm_3ada4 .checkItemEvo
ld a, [hli]
ld b, a
ld a, [wcf91]
cp b
jp nz, Func_3aed9
.asm_3adad
ld a, [hli] 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 b, a
ld a, [wcfb9] ld a, [wcfb9]
cp b cp b ; is the mon's level greater than the evolution requirement?
jp c, Func_3aeda jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.asm_3adb6 .asm_3adb6
ld [W_CURENEMYLVL], a ; W_CURENEMYLVL ld [W_CURENEMYLVL], a
ld a, $1 ld a, $1
ld [wd121], a ld [wd121], a
push hl push hl
ld a, [hl] ld a, [hl]
ld [wHPBarMaxHP + 1], a ld [wHPBarMaxHP + 1], a
ld a, [wWhichPokemon] ; wWhichPokemon ld a, [wWhichPokemon]
ld hl, wPartyMonNicks ; wPartyMonNicks ld hl, wPartyMonNicks
call GetPartyMonName call GetPartyMonName
call CopyStringToCF4B call CopyStringToCF4B
ld hl, IsEvolvingText ld hl, IsEvolvingText
@ -115,17 +120,17 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld c, $32 ld c, $32
call DelayFrames call DelayFrames
xor a xor a
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMap ld hl, wTileMap
ld bc, $c14 ld bc, $c14
call ClearScreenArea call ClearScreenArea
ld a, $1 ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba ld [H_AUTOBGTRANSFERENABLED], a
ld a, $ff ld a, $ff
ld [wcfcb], a ld [wcfcb], a
call ClearSprites call ClearSprites
callab Func_7bde9 callab Func_7bde9
jp c, Func_3af2e jp c, CancelledEvolution
ld hl, EvolvedText ld hl, EvolvedText
call PrintText call PrintText
pop hl pop hl
@ -147,7 +152,7 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld c, $28 ld c, $28
call DelayFrames call DelayFrames
call ClearScreen call ClearScreen
call Func_3aef7 call RenameEvolvedMon
ld a, [wd11e] ld a, [wd11e]
push af push af
ld a, [wd0b5] ld a, [wd0b5]
@ -168,15 +173,15 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld de, wcfba ld de, wcfba
ld b, $1 ld b, $1
call CalcStats call CalcStats
ld a, [wWhichPokemon] ; wWhichPokemon ld a, [wWhichPokemon]
ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1) ld hl, wPartyMon1
ld bc, $2c ld bc, wPartyMon2 - wPartyMon1
call AddNTimes call AddNTimes
ld e, l ld e, l
ld d, h ld d, h
push hl push hl
push bc push bc
ld bc, $22 ld bc, wPartyMon1MaxHP - wPartyMon1
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld b, a ld b, a
@ -202,23 +207,23 @@ Func_3ad71: ; 3ad71 (e:6d71)
ld [wd11e], a ld [wd11e], a
xor a xor a
ld [wcc49], a ld [wcc49], a
call Func_3af5b call LearnMoveFromLevelUp
pop hl pop hl
predef SetPartyMonTypes predef SetPartyMonTypes
ld a, [W_ISINBATTLE] ; W_ISINBATTLE ld a, [W_ISINBATTLE]
and a and a
call z, Func_3af52 call z, Evolution_ReloadTilesetTilePatterns
predef IndexToPokedex predef IndexToPokedex
ld a, [wd11e] ld a, [wd11e]
dec a dec a
ld c, a ld c, a
ld b, $1 ld b, $1
ld hl, wPokedexOwned ; wPokedexOwned ld hl, wPokedexOwned
push bc push bc
call Func_3b057 call Evolution_FlagAction
pop bc pop bc
ld hl, wPokedexSeen ; wd30a ld hl, wPokedexSeen
call Func_3b057 call Evolution_FlagAction
pop de pop de
pop hl pop hl
ld a, [wcf98] ld a, [wcf98]
@ -226,25 +231,25 @@ Func_3ad71: ; 3ad71 (e:6d71)
push hl push hl
ld l, e ld l, e
ld h, d ld h, d
jr Func_3aeda jr .nextEvoEntry2
Func_3aed9: ; 3aed9 (e:6ed9) .nextEvoEntry1
inc hl inc hl
Func_3aeda: ; 3aeda (e:6eda) .nextEvoEntry2
inc hl inc hl
jp Func_3ad71 jp .evoEntryLoop
Func_3aede: ; 3aede (e:6ede) .done
pop de pop de
pop bc pop bc
pop hl pop hl
pop af pop af
ld [$ffd7], a ld [$ffd7], a
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE ld a, [W_ISLINKBATTLE]
cp $32 cp $32
ret z ret z
ld a, [W_ISINBATTLE] ; W_ISINBATTLE ld a, [W_ISINBATTLE]
and a and a
ret nz ret nz
ld a, [wd121] ld a, [wd121]
@ -252,7 +257,9 @@ Func_3aede: ; 3aede (e:6ede)
call nz, Func_2307 call nz, Func_2307
ret 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] ld a, [wd0b5]
push af push af
ld a, [W_MONHDEXNUM] ld a, [W_MONHDEXNUM]
@ -262,17 +269,17 @@ Func_3aef7: ; 3aef7 (e:6ef7)
ld [wd0b5], a ld [wd0b5], a
ld hl, wcd6d ld hl, wcd6d
ld de, wcf4b ld de, wcf4b
.asm_3af0e .compareNamesLoop
ld a, [de] ld a, [de]
inc de inc de
cp [hl] cp [hl]
inc hl inc hl
ret nz ret nz
cp $50 cp $50
jr nz, .asm_3af0e jr nz, .compareNamesLoop
ld a, [wWhichPokemon] ; wWhichPokemon ld a, [wWhichPokemon]
ld bc, $b ld bc, $b
ld hl, wPartyMonNicks ; wPartyMonNicks ld hl, wPartyMonNicks
call AddNTimes call AddNTimes
push hl push hl
call GetName call GetName
@ -280,13 +287,13 @@ Func_3aef7: ; 3aef7 (e:6ef7)
pop de pop de
jp CopyData jp CopyData
Func_3af2e: ; 3af2e (e:6f2e) CancelledEvolution: ; 3af2e (e:6f2e)
ld hl, StoppedEvolvingText ld hl, StoppedEvolvingText
call PrintText call PrintText
call ClearScreen call ClearScreen
pop hl pop hl
call Func_3af52 call Evolution_ReloadTilesetTilePatterns
jp asm_3ad2e jp Evolution_PartyMonLoop
EvolvedText: ; 3af3e (e:6f3e) EvolvedText: ; 3af3e (e:6f3e)
TX_FAR _EvolvedText TX_FAR _EvolvedText
@ -304,18 +311,18 @@ IsEvolvingText: ; 3af4d (e:6f4d)
TX_FAR _IsEvolvingText TX_FAR _IsEvolvingText
db "@" db "@"
Func_3af52: ; 3af52 (e:6f52) Evolution_ReloadTilesetTilePatterns: ; 3af52 (e:6f52)
ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE ld a, [W_ISLINKBATTLE] ; W_ISLINKBATTLE
cp $32 cp $32 ; in a trade?
ret z ret z ; if so, return
jp ReloadTilesetTilePatterns jp ReloadTilesetTilePatterns
Func_3af5b: ; 3af5b (e:6f5b) LearnMoveFromLevelUp: ; 3af5b (e:6f5b)
ld hl, EvosMovesPointerTable ld hl, EvosMovesPointerTable
ld a, [wd11e] ld a, [wd11e] ; species
ld [wcf91], a ld [wcf91], a
dec a dec a
ld bc, $0 ld bc, 0
ld hl, EvosMovesPointerTable ld hl, EvosMovesPointerTable
add a add a
rl b rl b
@ -324,42 +331,45 @@ Func_3af5b: ; 3af5b (e:6f5b)
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
.asm_3af73 .skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data
ld a, [hli] ld a, [hli]
and a and a ; have we reached the end of the evolution data?
jr nz, .asm_3af73 jr nz, .skipEvolutionDataLoop ; if not, jump back up
.asm_3af77 .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] ld a, [hli]
and a and a ; have we reached the end of the learn set?
jr z, .asm_3afb1 jr z, .done ; if we've reached the end of the learn set, jump
ld b, a ld b, a ; level the move is learnt at
ld a, [W_CURENEMYLVL] ; W_CURENEMYLVL ld a, [W_CURENEMYLVL]
cp b cp b ; is the move learnt at the mon's current level?
ld a, [hli] ld a, [hli] ; move ID
jr nz, .asm_3af77 jr nz, .learnSetLoop
ld d, a ld d, a ; ID of move to learn
ld a, [wcc49] ld a, [wcc49]
and a and a
jr nz, .asm_3af96 jr nz, .next
ld hl, wPartyMon1Moves ; wPartyMon1Moves ; if [wcc49] is 0, get the address of the mon's current moves
ld a, [wWhichPokemon] ; wWhichPokemon ; there is no reason to make this conditional because the code wouldn't work properly without doing this
ld bc, $2c ; every call to this function sets [wcc49] to 0
ld hl, wPartyMon1Moves
ld a, [wWhichPokemon]
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes call AddNTimes
.asm_3af96 .next
ld b, $4 ld b, $4
.asm_3af98 .checkCurrentMovesLoop ; check if the move to learn is already known
ld a, [hli] ld a, [hli]
cp d cp d
jr z, .asm_3afb1 jr z, .done ; if already known, jump
dec b dec b
jr nz, .asm_3af98 jr nz, .checkCurrentMovesLoop
ld a, d ld a, d
ld [wd0e0], a ld [wd0e0], a
ld [wd11e], a ld [wd11e], a
call GetMoveName call GetMoveName
call CopyStringToCF4B call CopyStringToCF4B
predef LearnMove predef LearnMove
.asm_3afb1 .done
ld a, [wcf91] ld a, [wcf91]
ld [wd11e], a ld [wd11e], a
ret ret
@ -484,7 +494,7 @@ WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e)
jr nz, .asm_3b050 jr nz, .asm_3b050
ret ret
Func_3b057: ; 3b057 (e:7057) Evolution_FlagAction: ; 3b057 (e:7057)
predef_jump FlagActionPredef predef_jump FlagActionPredef
INCLUDE "data/evos_moves.asm" 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 a, [wcf98]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld d, $1 ld d, $1 ; init level to 1
.asm_58f4e .loop
inc d inc d ; increment level
call CalcExperience call CalcExperience
push hl push hl
ld hl, wcfa8 ld hl, wcfa8 ; current exp
ld a, [$ff98] ; compare exp needed for level d with current exp
ld a, [H_MULTIPLICAND + 2]
ld c, a ld c, a
ld a, [hld] ld a, [hld]
sub c sub c
ld a, [$ff97] ld a, [H_MULTIPLICAND + 1]
ld c, a ld c, a
ld a, [hld] ld a, [hld]
sbc c sbc c
ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND) ld a, [H_MULTIPLICAND]
ld c, a ld c, a
ld a, [hl] ld a, [hl]
sbc c sbc c
pop hl pop hl
jr nc, .asm_58f4e jr nc, .loop ; if exp needed for level d is not greater than exp, try the next level
dec d dec d ; since the exp was too high on the last loop iteration, go back to the previous value and return
ret ret
; calculates the amount of experience needed for level d ; 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 [W_ENEMYBATTSTATUS3], a ; W_ENEMYBATTSTATUS3
ld a, [wcf91] ld a, [wcf91]
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
callab Func_3eb01 callab LoadEnemyMonData
call SetPokedexOwnedFlag call SetPokedexOwnedFlag
callab Func_e7a4 callab Func_e7a4
ld hl, wcf4b ld hl, wcf4b

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,15 +8,15 @@ VBlank::
ld a, [H_LOADEDROMBANK] ld a, [H_LOADEDROMBANK]
ld [wd122], a ld [wd122], a
ld a, [$ffae] ld a, [hVBlankSCX]
ld [rSCX], a ld [rSCX], a
ld a, [$ffaf] ld a, [hVBlankSCY]
ld [rSCY], a ld [rSCY], a
ld a, [wd0a0] ld a, [wd0a0]
and a and a
jr nz, .ok jr nz, .ok
ld a, [$ffb0] ld a, [hVBlankWY]
ld [rWY], a ld [rWY], a
.ok .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_POWEROFTEN EQU $FF99 ; 3 bytes, big endian order
H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes, big endian order (to back out of a subtraction) 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 hJoyHeldLast EQU $FFB1
hJoyReleased EQU $FFB2 hJoyReleased EQU $FFB2
hJoyPressed EQU $FFB3 hJoyPressed EQU $FFB3

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

117
wram.asm
View file

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