Partymon structs for opponent and player parties.

This commit is contained in:
yenatch 2014-02-23 00:37:09 -05:00
parent 0ea86cecba
commit a01dad8e49
5 changed files with 80 additions and 227 deletions

View File

@ -1565,7 +1565,7 @@ AIScoring_HealBell: ; 38d1f
ld a, [OTPartyCount]
ld b, a
ld c, 0
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld de, $0030
.asm_38d2c
@ -1784,7 +1784,7 @@ AICheckLastPlayerMon: ; 38e2e
ld a, [PartyCount]
ld b, a
ld c, 0
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld de, PartyMon2 - PartyMon1
.loop

View File

@ -11,7 +11,7 @@ Function3c000: ; 3c000
ld [BattleEnded], a
inc a
ld [$d264], a
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld bc, $002f
ld d, $3
.asm_3c019
@ -1234,7 +1234,7 @@ Function3c801: ; 3c801
xor a
ld [hli], a
ld [hl], a
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld a, [CurBattleMon]
call GetPartyLocation
xor a
@ -1250,7 +1250,7 @@ Function3c801: ; 3c801
ld a, [IsInBattle]
dec a
ret z
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld a, [CurOTMon]
call GetPartyLocation
xor a
@ -2177,7 +2177,7 @@ Function3ce01: ; 3ce01
dec a
jr z, .asm_3ce16
ld a, [CurOTMon]
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call GetPartyLocation
xor a
ld [hli], a
@ -2355,7 +2355,7 @@ Function3cf35: ; 3cf35
ld a, [OTPartyCount]
ld b, a
xor a
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld de, $0030
.asm_3cf40
or [hl]
@ -2832,7 +2832,7 @@ Function3d1f8: ; 3d1f8
ld a, [$cfa9]
cp $1
jr z, .asm_3d20a
ld hl, PartyMon1Spd
ld hl, PartyMon1Speed
ld de, EnemyMonSpd
jp Function3d8b3
; 3d227
@ -3390,7 +3390,7 @@ Function3d599: ; 3d599
ld a, [CurOTMon]
cp b
jr z, .asm_3d5d0
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
push bc
ld a, b
call GetPartyLocation
@ -3546,7 +3546,7 @@ Function3d672: ; 3d672
ld a, [CurOTMon]
cp b
jr z, .asm_3d6a7
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
push bc
ld a, b
call GetPartyLocation
@ -3778,7 +3778,7 @@ Function3d873: ; 3d873
ld a, [PartyCount]
ld e, a
xor a
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld bc, $002f
.asm_3d87e
or [hl]
@ -3794,7 +3794,7 @@ Function3d873: ; 3d873
Function3d887: ; 3d887
ld a, [CurPartyMon]
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
@ -6514,7 +6514,7 @@ LoadEnemyMon: ; 3e8eb
.OpponentParty
; Get HP from the party struct
ld hl, (PartyMon1CurHP + 1) - PartyMon1 + OTPartyMon1
ld hl, (PartyMon1HP + 1) - PartyMon1 + OTPartyMon1
ld a, [CurPartyMon]
call GetPartyLocation
ld a, [hld]
@ -9021,18 +9021,18 @@ GetRoamMonMapNumber: ; 3f9e9
; 3fa01
GetRoamMonHP: ; 3fa01
; output: hl = RoamMonCurHP
; output: hl = RoamMonHP
ld a, [TempEnemyMonSpecies]
ld b, a
ld a, [RoamMon1Species]
cp b
ld hl, RoamMon1CurHP
ld hl, RoamMon1HP
ret z
ld a, [RoamMon2Species]
cp b
ld hl, RoamMon2CurHP
ld hl, RoamMon2HP
ret z
ld hl, RoamMon3CurHP
ld hl, RoamMon3HP
ret
; 3fa19

View File

@ -1951,7 +1951,7 @@ Function349f4: ; 349f4
ld e, 0
ld b, $20
ld c, 0
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
.asm_34a05
ld a, [CurOTMon]
@ -2059,7 +2059,7 @@ Function34a85: ; 34a85
push bc
ld a, [OTPartyCount]
ld e, a
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld b, $20
ld c, $0
.asm_34a91
@ -2254,7 +2254,7 @@ Function34b77: ; 34b77
ld de, OTPartySpecies
ld b, $20
ld c, 0
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
.asm_34b82
ld a, [de]
@ -7286,7 +7286,7 @@ BattleCommand23: ; 3680f
jr z, .asm_3689a ; 368a3 $f5
push af
push bc
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
@ -7382,7 +7382,7 @@ BattleCommand23: ; 3680f
push af
push bc
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
@ -7437,7 +7437,7 @@ Function36994: ; 36994
jr z, .asm_369ae
ld a, e
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
or [hl]
@ -9860,7 +9860,7 @@ ResetBatonPassStatus: ; 37ab1
CheckAnyOtherAlivePartyMons: ; 37ae9
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld a, [PartyCount]
ld d, a
ld a, [CurBattleMon]
@ -9870,7 +9870,7 @@ CheckAnyOtherAlivePartyMons: ; 37ae9
CheckAnyOtherAliveEnemyMons: ; 37af6
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld a, [OTPartyCount]
ld d, a
ld a, [CurOTMon]

View File

@ -13408,7 +13408,7 @@ Functiondf8c:: ; df8c
ld [hl], a
ld a, [PartyCount]
dec a
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld bc, $0030
call AddNTimes
xor a
@ -14218,7 +14218,7 @@ UnknownText_0xe533: ; 0xe533
Functione538: ; e538
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld de, $0030
ld b, $0
.asm_e540
@ -21093,7 +21093,7 @@ Function139ed: ; 139ed
INCBIN "baserom.gbc",$139fe,$13a12 - $139fe
Function13a12: ; 13a12
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld a, [hli]
or [hl]
jr z, .asm_13a2b
@ -35592,7 +35592,7 @@ Function2a1df:: ; 2a1df
ld a, [$dca1]
and a
jr z, .asm_2a1fe
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld bc, PartyMon2 - PartyMon1 - 1
.asm_2a1eb
ld a, [hli]
@ -35772,9 +35772,9 @@ InitRoamMons: ; 2a2a0
; hp
xor a ; generate new stats
ld [RoamMon1CurHP], a
ld [RoamMon2CurHP], a
; ld [RoamMon3CurHP], a
ld [RoamMon1HP], a
ld [RoamMon2HP], a
; ld [RoamMon3HP], a
ret
; 2a2ce
@ -36222,10 +36222,10 @@ INCLUDE "stats/wild/swarm_water.asm"
Function2b930: ; 2b930
callba UpdateEnemyMonInParty
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call Function2b995
push bc
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call Function2b995
ld a, c
pop bc
@ -36242,10 +36242,10 @@ Function2b930: ; 2b930
jr z, .asm_2b976
cp $2
jr z, .asm_2b97f
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call Function2b9a6
push de
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call Function2b9a6
pop hl
ld a, d
@ -36343,16 +36343,16 @@ Function2b9a6: ; 2b9a6
; 2b9e1
Function2b9e1: ; 2b9e1
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call Function2ba01
jr nz, .asm_2b9f2
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call Function2ba01
ld e, $1
ret
.asm_2b9f2
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call Function2ba01
ld e, $0
ret nz
@ -36424,7 +36424,7 @@ Function2c012: ; 2c012
Function2c01c: ; 2c01c
call Function2c0ad
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld de, PartyCount
call Function2c059
ld a, $60
@ -36441,7 +36441,7 @@ Function2c01c: ; 2c01c
Function2c03a: ; 2c03a
call Function2c0c5
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld de, OTPartyCount
call Function2c059
ld hl, $cfc4
@ -36589,7 +36589,7 @@ Function2c0f1: ; 2c0f1
Function2c10d: ; 2c10d
call Function2c165
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld de, PartyCount
call Function2c059
ld hl, $cfc4
@ -36600,7 +36600,7 @@ Function2c10d: ; 2c10d
ld [$d003], a
ld hl, Sprites
call Function2c143
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld de, OTPartyCount
call Function2c059
ld hl, $cfc4
@ -37838,7 +37838,7 @@ Function2ee2f: ; 2ee2f
ld [$ffde], a
call DelayFrame
ld b, 6
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld de, PartyMon2 - PartyMon1 - 1
.asm_2ee3d
ld a, [hli]
@ -37849,7 +37849,7 @@ Function2ee2f: ; 2ee2f
jr nz, .asm_2ee3d
.asm_2ee45
ld de, PartyMon1Level - PartyMon1CurHP
ld de, PartyMon1Level - PartyMon1HP
add hl, de
ld a, [hl]
ld [BattleMonLevel], a
@ -38610,7 +38610,7 @@ asm_38436: ; 38436 (e:4436)
Function3844b: ; 3844b
ld a, [OTPartyCount]
ld c, a
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
ld d, 0
.asm_38454
ld a, [hli]
@ -47317,7 +47317,7 @@ Function4aafb: ; 4aafb
Function4ab06: ; 4ab06
ld a, [CurPartyMon]
ld bc, $0030
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
ld b, a
@ -49821,7 +49821,7 @@ Function4deea: ; 4deea (13:5eea)
; known jump sources: 4deea (13:5eea)
Function4df45: ; 4df45 (13:5f45)
ld hl, TempMonCurHP ; $d130
ld hl, TempMonHP ; $d130
ld a, [hli]
ld b, a
ld c, [hl]
@ -51493,7 +51493,7 @@ Function500cf: ; 500cf
Function50117: ; 50117
ld a, b
ld bc, $0030
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
or [hl]
@ -51533,7 +51533,7 @@ Function50138: ; 50138
push hl
ld a, b
ld bc, $0030
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call AddNTimes
ld e, l
ld d, h
@ -52497,7 +52497,7 @@ _SacredAsh: ; 507e6
CheckAnyFaintedMon: ; 507fb
ld de, PartyMon2 - PartyMon1
ld bc, PartySpecies
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
ld a, [PartyCount]
and a
ret z
@ -52613,7 +52613,7 @@ Function50893: ; 50893
ld a, $c
call Predef
pop bc
ld hl, TempMonCurHP - TempMon
ld hl, TempMonHP - TempMon
add hl, bc
ld d, h
ld e, l
@ -52821,9 +52821,9 @@ DrawHP: ; 50b10
cp BOXMON
jr z, .asm_50b30
ld a, [TempMonCurHP]
ld a, [TempMonHP]
ld b, a
ld a, [TempMonCurHP + 1]
ld a, [TempMonHP + 1]
ld c, a
; Any HP?
@ -52870,7 +52870,7 @@ DrawHP: ; 50b10
; Print HP
ld bc, $0015 ; move (1,1)
add hl, bc
ld de, TempMonCurHP
ld de, TempMonHP
ld a, [MonType]
cp BOXMON
jr nz, .asm_50b66
@ -81380,7 +81380,7 @@ Functionfb5dd: ; fb5dd
jr z, .asm_fb5f8
push bc
ld a, c
ld hl, PartyMon1CurHP
ld hl, PartyMon1HP
call GetPartyLocation
pop bc
ld a, [hli]
@ -81392,7 +81392,7 @@ Functionfb5dd: ; fb5dd
dec b
jr nz, .asm_fb5e7
ld a, [$d003]
ld hl, OTPartyMon1CurHP
ld hl, OTPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]

193
wram.asm
View File

@ -14,6 +14,7 @@ party_struct: MACRO
\1ID:: dw
\1Exp:: ds 3 ; Big endian
\1StatExp::
\1HPExp:: dw
\1AtkExp:: dw
\1DefExp:: dw
@ -25,10 +26,10 @@ party_struct: MACRO
\1SpdSpcDV:: db
\1PP::
\1PP1:: db
\1PP2:: db
\1PP3:: db
\1PP4:: db
\1PPMove1:: db
\1PPMove2:: db
\1PPMove3:: db
\1PPMove4:: db
\1Happiness:: db
\1PokerusStatus:: db
@ -1127,7 +1128,7 @@ TempMonStatus:: ; d12e
ds 1
; d12f
ds 1
TempMonCurHP:: ; d130
TempMonHP:: ; d130
ds 2
TempMonMaxHP:: ; d132
ds 2
@ -1496,96 +1497,18 @@ OTPartySpecies:: ; d281
ds 1 ; any empty slots including the 7th must be FF
; or the routine will keep going
OTPartyMon1::
OTPartyMon1Species:: ; d288
ds 1
OTPartyMon1Item:: ; d289
ds 1
OTPartyMon1Moves:: ; d28a
OTPartyMon1Move1:: ; d28a
ds 1
OTPartyMon1Move2:: ; d28b
ds 1
OTPartyMon1Move3:: ; d28c
ds 1
OTPartyMon1Move4:: ; d28d
ds 1
OTPartyMon1ID:: ; d28e
ds 2
OTPartyMon1Exp:: ; d290
ds 3
OTPartyMon1HPExp:: ; d293
ds 2
OTPartyMon1AtkExp:: ; d295
ds 2
OTPartyMon1DefExp:: ; d297
ds 2
OTPartyMon1SpdExp:: ; d299
ds 2
OTPartyMon1SpclExp:: ; d29b
ds 2
OTPartyMon1DVs:: ; d29d
OTPartyMon1AtkDefDV:: ; d29d
ds 1
OTPartyMon1SpdSpclDV:: ; d29e
ds 1
OTPartyMon1PP:: ; d29f
OTPartyMon1PPMove1:: ; d29f
ds 1
OTPartyMon1PPMove2:: ; d2a0
ds 1
OTPartyMon1PPMove3:: ; d2a1
ds 1
OTPartyMon1PPMove4:: ; d2a2
ds 1
OTPartyMon1Happiness:: ; d2a3
ds 1
OTPartyMon1PokerusStatus:: ; d2a4
ds 1
OTPartyMon1CaughtData:: ; d2a5
OTPartyMon1CaughtGender:: ; d2a5
OTPartyMon1CaughtLocation:: ; d2a5
ds 1
OTPartyMon1CaughtTime:: ; d2a6
ds 1
OTPartyMon1Level:: ; d2a7
ds 1
OTPartyMon1Status:: ; d2a8
ds 1
OTPartyMon1Unused:: ; d2a9
ds 1
OTPartyMon1CurHP:: ; d2aa
ds 2
OTPartyMon1MaxHP:: ; d2ac
ds 2
OTPartyMon1Atk:: ; d2ae
ds 2
OTPartyMon1Def:: ; d2b0
ds 2
OTPartyMon1Spd:: ; d2b2
ds 2
OTPartyMon1SpclAtk:: ; d2b4
ds 2
OTPartyMon1SpclDef:: ; d2b6
ds 2
OTPartyMon1:: ; d288
party_struct OTPartyMon1
OTPartyMon2:: ; d2b8
ds 48
party_struct OTPartyMon2
OTPartyMon3:: ; d2e8
ds 48
party_struct OTPartyMon3
OTPartyMon4:: ; d318
ds 48
party_struct OTPartyMon4
OTPartyMon5:: ; d348
ds 48
party_struct OTPartyMon5
OTPartyMon6:: ; d378
ds 48
party_struct OTPartyMon6
OTPartyMonOT::
@ -1970,88 +1893,18 @@ PartyEnd:: ; dcde
ds 1 ; legacy functions don't check PartyCount
PartyMons::
PartyMon1::
PartyMon1Species:: ; dcdf
ds 1
PartyMon1Item:: ; dce0
ds 1
PartyMon1Moves:: ; dce1
PartyMon1Move1:: ; dce1
ds 1
PartyMon1Move2:: ; dce2
ds 1
PartyMon1Move3:: ; dce3
ds 1
PartyMon1Move4:: ; dce4
ds 1
PartyMon1ID:: ; dce5
ds 2
PartyMon1Exp:: ; dce7
ds 3
PartyMon1StatExp::
PartyMon1HPExp:: ; dcea
ds 2
PartyMon1AtkExp:: ; dcec
ds 2
PartyMon1DefExp:: ; dcee
ds 2
PartyMon1SpdExp:: ; dcf0
ds 2
PartyMon1SpclExp:: ; dcf2
ds 2
PartyMon1DVs:: ; dcf4
; hp = %1000 for each dv
ds 1 ; atk/def
ds 1 ; spd/spc
PartyMon1PP:: ; dcf6
ds 4
PartyMon1Happiness:: ; dcfa
ds 1
PartyMon1PokerusStatus:: ; dcfb
ds 1
PartyMon1CaughtData:: ; dcfc
PartyMon1CaughtTime:: ; dcfc
PartyMon1CaughtLevel:: ; dcfc
ds 1
PartyMon1CaughtGender:: ; dcfd
PartyMon1CaughtLocation:: ; dcfd
ds 1
PartyMon1Level:: ; dcfe
ds 1
PartyMon1Status:: ; dcff
ds 1
; dd00 unused
ds 1
PartyMon1CurHP:: ; dd01
ds 2
PartyMon1MaxHP:: ; dd03
ds 2
PartyMon1Atk:: ; dd05
ds 2
PartyMon1Def:: ; dd07
ds 2
PartyMon1Spd:: ; dd09
ds 2
PartyMon1SpclAtk:: ; dd0b
ds 2
PartyMon1SpclDef:: ; dd0d
ds 2
PartyMon1:: ; dcdf
party_struct PartyMon1
PartyMon2:: ; dd0f
ds 48
party_struct PartyMon2
PartyMon3:: ; dd3f
ds 48
party_struct PartyMon3
PartyMon4:: ; dd6f
ds 48
party_struct PartyMon4
PartyMon5:: ; dd9f
ds 48
party_struct PartyMon5
PartyMon6:: ; ddcf
ds 48
party_struct PartyMon6
PartyMonOT::
PartyMon1OT:: ; ddff
@ -2159,7 +2012,7 @@ RoamMon1MapGroup:: ; dfd1
ds 1
RoamMon1MapNumber:: ; dfd2
ds 1
RoamMon1CurHP:: ; dfd3
RoamMon1HP:: ; dfd3
ds 1
RoamMon1DVs:: ; dfd4
ds 2
@ -2172,7 +2025,7 @@ RoamMon2MapGroup:: ; dfd8
ds 1
RoamMon2MapNumber:: ; dfd9
ds 1
RoamMon2CurHP:: ; dfda
RoamMon2HP:: ; dfda
ds 1
RoamMon2DVs:: ; dfdb
ds 2
@ -2185,7 +2038,7 @@ RoamMon3MapGroup:: ; dfdf
ds 1
RoamMon3MapNumber:: ; dfe0
ds 1
RoamMon3CurHP:: ; dfe1
RoamMon3HP:: ; dfe1
ds 1
RoamMon3DVs:: ; dfe2
ds 2