Replace party struct relative values with EQUS constants

This commit is contained in:
PikalaxALT 2015-11-04 11:19:58 -05:00
parent 14e0da5116
commit 739bb3c136
40 changed files with 2824 additions and 2816 deletions

View File

@ -250,7 +250,7 @@ endr
ld d, a
ld e, 0
ld hl, OTPartyMon1Level
ld bc, OTPartyMon2 - OTPartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
.next
ld a, [hl]
cp e
@ -685,7 +685,7 @@ AI_TrySwitch: ; 3844b
inc d
.fainted
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
dec c
@ -710,7 +710,7 @@ AI_Switch: ; 3846c
push af
ld a, [CurOTMon]
ld hl, OTPartyMon1Status
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, h
ld e, l
@ -754,7 +754,7 @@ Function384d5: ; This appears to be unused
AI_HealStatus: ; 384e0
ld a, [CurOTMon]
ld hl, OTPartyMon1Status
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
xor a
ld [hl], a

View File

@ -1719,7 +1719,7 @@ AI_Smart_HealBell: ; 38d1f
ld b, a
ld c, 0
ld hl, OTPartyMon1HP
ld de, OTPartyMon2 - OTPartyMon1
ld de, PARTYMON_STRUCT_LENGTH
.loop
push hl
@ -1933,7 +1933,7 @@ AICheckLastPlayerMon: ; 38e2e
ld b, a
ld c, 0
ld hl, PartyMon1HP
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
.loop
ld a, [CurBattleMon]

View File

@ -2295,7 +2295,7 @@ ShareExperiencePoints: ; 3ceaa
.asm_3ceb5
push hl
push bc
ld bc, PartyMon1HP - PartyMon1
ld bc, MON_HP
add hl, bc
ld a, [hli]
or [hl]
@ -2305,7 +2305,7 @@ ShareExperiencePoints: ; 3ceaa
push hl
push bc
ld bc, PartyMon1Item - PartyMon1
ld bc, MON_ITEM
add hl, bc
pop bc
ld a, [hl]
@ -2320,7 +2320,7 @@ ShareExperiencePoints: ; 3ceaa
.asm_3ced1
sla c
push de
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
add hl, de
pop de
dec b
@ -2384,7 +2384,7 @@ CheckEnemyTrainerDefeated: ; 3cf35
ld b, a
xor a
ld hl, OTPartyMon1HP
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
.loop
or [hl]
@ -4062,7 +4062,7 @@ TryToRunAwayFromBattle: ; 3d8b3
Function3da0d: ; 3da0d
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call GetPartyParamLocation
ld de, BattleMonSpecies
ld bc, 1 + 1 + NUM_MOVES ; species, item, moves ; BattleMonDVs - BattleMonSpecies
@ -4265,7 +4265,7 @@ Function3db5f: ; 3db5f
call Call_PlayBattleAnim
.asm_3dbbc
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call GetPartyParamLocation
ld b, h
ld c, l
@ -5608,7 +5608,7 @@ MoveSelectionScreen: ; 3e4bc
jr .asm_3e4e2
.asm_3e4dd
ld a, PartyMon1Moves - PartyMon1
ld a, MON_MOVES
call GetPartyParamLocation
.asm_3e4e2
@ -5867,7 +5867,7 @@ endr
push hl
call .asm_3e6a5
pop hl
ld bc, PartyMon1PP - PartyMon1Moves
ld bc, (MON_PP) - (MON_MOVES)
add hl, bc
call .asm_3e6a5
@ -7424,7 +7424,7 @@ GiveExperiencePoints: ; 3ee3b
.asm_3ee89
push hl
push bc
ld a, PartyMon1PokerusStatus - PartyMon1
ld a, MON_PKRUS
call GetPartyParamLocation
ld a, [hl]
and a
@ -7489,7 +7489,7 @@ endr
dec a
call nz, DoubleExp
push bc
ld a, PartyMon1Item - PartyMon1
ld a, MON_ITEM
call GetPartyParamLocation
ld a, [hl]
cp LUCKY_EGG
@ -7574,7 +7574,7 @@ endr
predef CopyPkmnToTempMon
callab CalcLevel
pop bc
ld hl, PartyMon1Level - PartyMon1
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp MAX_LEVEL
@ -7587,7 +7587,7 @@ endr
ld a, d
ld [CurPartyLevel], a
ld [hl], a
ld hl, PartyMon1Species - PartyMon1
ld hl, MON_SPECIES
add hl, bc
ld a, [hl]
ld [CurSpecies], a
@ -7733,7 +7733,7 @@ endr
cp b
jr z, .asm_3f0d1
ld [CurPartyMon], a
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call GetPartyParamLocation
ld b, h
ld c, l
@ -8577,7 +8577,7 @@ Function3f594: ; 3f594
ld b, a
.partyloop
push bc
ld a, PartyMon1HP - PartyMon1
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
or [hl]

View File

@ -706,7 +706,7 @@ BattleCommand02: ; 343db
; If the monster's id doesn't match the player's,
; some conditions need to be met.
ld a, PartyMon1ID - PartyMon1
ld a, MON_ID
call BattlePartyAttr
ld a, [PlayerID]
@ -1949,7 +1949,7 @@ CountEnemyAliveMons: ; 349f4
.next
srl b
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
inc e
@ -1987,7 +1987,7 @@ Function34a2a: ; 34a2a
push hl
push bc
ld bc, PartyMon1HP - PartyMon1
ld bc, MON_HP
add hl, bc
pop bc
ld a, [hli]
@ -2022,7 +2022,7 @@ Function34a2a: ; 34a2a
ret z
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
@ -2136,7 +2136,7 @@ Function34aa7: ; 34aa7
.asm_34b00
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
srl b
@ -2266,7 +2266,7 @@ endr
srl b
pop hl
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
jr .loop
@ -3358,7 +3358,7 @@ endr
DittoMetalPowder: ; 352b1
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hBattleTurn]
and a
@ -3633,7 +3633,7 @@ SpeciesItemBoost: ; 353d1
ld h, a
push hl
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hBattleTurn]
@ -4840,7 +4840,7 @@ BattleCommand46: ; 35a74
bit SUBSTATUS_TRANSFORMED, [hl]
jp nz, .asm_35b10
ld a, PartyMon1Moves - PartyMon1
ld a, MON_MOVES
call UserPartyAttr
ld d, h
ld e, l
@ -5118,7 +5118,7 @@ BattleCommand4a: ; 35c0f
ld a, [AttackMissed]
and a
jp nz, .asm_35c91
ld bc, PartyMon2 - PartyMon1 ; ????
ld bc, PARTYMON_STRUCT_LENGTH ; ????
ld hl, EnemyMonMoves
ld a, [hBattleTurn]
and a
@ -5166,7 +5166,7 @@ endr
sub b
ld [hl], a
push af
ld a, PartyMon1PP - PartyMon1
ld a, MON_PP
call OpponentPartyAttr
ld d, b
pop af
@ -5262,7 +5262,7 @@ BattleCommand4c: ; 35cc9
ld [hl], a
ld h, d
ld l, e
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld d, PartyEnd - PartySpecies
.asm_35ce9
ld [hl], a
@ -7418,7 +7418,7 @@ Function36994: ; 36994
ld a, [PartyCount]
ld d, a
ld e, 0
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
.asm_3699d
ld a, [CurBattleMon]
cp e
@ -9286,7 +9286,7 @@ BattleCommand53: ; 37563
jr z, .done
.party
ld a, PartyMon1Status - PartyMon1
ld a, MON_STATUS
call UserPartyAttr
res FRZ, [hl]
@ -9408,7 +9408,7 @@ BattleCommand5f: ; 377ce
Function377f5: ; 377f5
ld a, PartyMon1Species - PartyMon1
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
ld [CurPartySpecies], a
@ -9937,7 +9937,7 @@ CheckAnyOtherAliveMons: ; 37b01
.next
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
inc c

View File

@ -265,6 +265,7 @@ MON_ITEM EQUS "PartyMon1Item - PartyMon1"
MON_MOVES EQUS "PartyMon1Moves - PartyMon1"
MON_ID EQUS "PartyMon1ID - PartyMon1"
MON_EXP EQUS "PartyMon1Exp - PartyMon1"
MON_STAT_EXP EQUS "PartyMon1StatExp - PartyMon1"
MON_HP_EXP EQUS "PartyMon1HPExp - PartyMon1"
MON_ATK_EXP EQUS "PartyMon1AtkExp - PartyMon1"
MON_DEF_EXP EQUS "PartyMon1DefExp - PartyMon1"
@ -274,8 +275,11 @@ MON_DVS EQUS "PartyMon1DVs - PartyMon1"
MON_PP EQUS "PartyMon1PP - PartyMon1"
MON_HAPPINESS EQUS "PartyMon1Happiness - PartyMon1"
MON_PKRUS EQUS "PartyMon1PokerusStatus - PartyMon1"
MON_CAUGHTDATA EQUS "PartyMon1CaughtData - PartyMon1"
MON_CAUGHTLEVEL EQUS "PartyMon1CaughtLevel - PartyMon1"
MON_CAUGHTTIME EQUS "PartyMon1CaughtTime - PartyMon1"
MON_CAUGHTGENDER EQUS "PartyMon1CaughtGender - PartyMon1"
MON_CAUGHTLOCATION EQUS "PartyMon1CaughtLocation - PartyMon1"
MON_LEVEL EQUS "PartyMon1Level - PartyMon1"
MON_STATUS EQUS "PartyMon1Status - PartyMon1"
MON_HP EQUS "PartyMon1HP - PartyMon1"
@ -285,5 +289,6 @@ MON_DEF EQUS "PartyMon1Defense - PartyMon1"
MON_SPD EQUS "PartyMon1Speed - PartyMon1"
MON_SAT EQUS "PartyMon1SpclAtk - PartyMon1"
MON_SDF EQUS "PartyMon1SpclDef - PartyMon1"
BOXMON_STRUCT_LENGTH EQUS "PartyMon1Status - PartyMon1"
BOXMON_STRUCT_LENGTH EQUS "PartyMon1End - PartyMon1"
PARTYMON_STRUCT_LENGTH EQUS "PartyMon1StatsEnd - PartyMon1"
SCRATCHMON_STRUCT_LENGTH EQUS "PartyMon1StatsEnd - PartyMon1Item"

View File

@ -121,7 +121,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
; Check if Pkmn was already loaded before
; Check current and the 2 previous teams
; includes check if item is double at the current team
ld bc, party_struct_length + PKMN_NAME_LENGTH
ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH
call AddNTimes
ld a, [hli]
ld b, a
@ -164,17 +164,17 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
cp b
jr z, .FindARandomBattleTowerPkmn
ld bc, party_struct_length + PKMN_NAME_LENGTH
ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH
call CopyBytes
ld a, [wNamedObjectIndexBuffer]
push af
push de
ld hl, - (party_struct_length + PKMN_NAME_LENGTH)
ld hl, - (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH)
add hl, de
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
ld bc, party_struct_length
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
push hl
call GetPokemonName

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ GiveOddEgg: ; 1fb4b6
call AddNTimes
ld de, OddEggSpecies
ld bc, party_struct_length + 2 * PKMN_NAME_LENGTH
ld bc, PARTYMON_STRUCT_LENGTH + 2 * PKMN_NAME_LENGTH
call CopyBytes
ld a, EGG_TICKET

View File

@ -15,7 +15,7 @@ FruitTreeScript:: ; 44000
.fruit
writetext HeyItsFruitText
copybytetovar CurFruit
giveitem $ff, 1
giveitem ITEM_FROM_MEM, 1
iffalse .packisfull
keeptextopen
writetext ObtainedFruitText

View File

@ -43,7 +43,7 @@ PredefPointers:: ; 856b
add_predef GiveEgg
add_predef Functionc6e0
add_predef CalcPkmnStats
add_predef Functione17b
add_predef CalcPkmnStatC
add_predef CanLearnTMHMMove
add_predef GetTMHMMove
add_predef Function28eef ; $ 10

View File

@ -302,7 +302,7 @@ VerifyUniqueness: ; 8b2e9
.nextmon: ; 8b31a
push bc
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
inc de
pop bc

View File

@ -12,7 +12,7 @@ SpecialDratini: ; 0x8b170
call GetNthPartyMon
ld a, [bc]
ld c, a
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
.CheckForDratini
; start at the end of the party and search backwards for a Dratini
ld a, [hl]
@ -59,7 +59,7 @@ endr
call GetFarByte
; get the address of the move's PP and update the PP
ld hl, PartyMon1PP - PartyMon1Moves
ld hl, (MON_PP) - (MON_MOVES)
add hl, de
ld [hl], a
@ -100,7 +100,7 @@ GetNthPartyMon: ; 0x8b1ce
jr z, .EmptyParty
dec a
ret z
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
.loop
add hl, de
dec a

View File

@ -16,7 +16,7 @@ Special_CheckMagikarpLength: ; fbb32
; Now let's compute its length based on its DVs and ID.
ld a, [CurPartyMon]
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
push hl
ld bc, MON_DVS

View File

@ -12,7 +12,7 @@ MoveDeletion:
jr z, .asm_2c5bc
ld a, [CurPartyMon]
ld hl, PartyMon1Moves + 1
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hl]
and a
@ -116,7 +116,7 @@ Function2c5f9: ; 2c5f9
ld hl, PartyMon1Moves
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
push bc
@ -145,7 +145,7 @@ Function2c5f9: ; 2c5f9
ld hl, PartyMon1PP
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
inc b

View File

@ -91,7 +91,7 @@ CheckIfMonIsYourOT: ; fb78a
jr c, .nope
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld de, PlayerID

View File

@ -97,7 +97,7 @@ SeerAction4: ; 4f12b
; 4f134
ReadCaughtData: ; 4f134
ld a, PartyMon1CaughtData - PartyMon1
ld a, MON_CAUGHTDATA
call GetPartyParamLocation
ld a, [hli]
ld [wd03b], a
@ -109,7 +109,7 @@ ReadCaughtData: ; 4f134
ld a, 1
ld [wd002], a
ld a, PartyMon1ID - PartyMon1
ld a, MON_ID
call GetPartyParamLocation
ld a, [PlayerID]
cp [hl]
@ -358,7 +358,7 @@ SeerCancelText: ; 0x4f2af
SeerAdvice: ; 4f2b4
ld a, PartyMon1Level - PartyMon1
ld a, MON_LEVEL
call GetPartyParamLocation
ld a, [wd038 + 2]
ld c, a
@ -426,7 +426,7 @@ SeerAdvice5: ; 0x4f2fc
GetCaughtGender: ; 4f301
ld hl, PartyMon1CaughtGender - PartyMon1
ld hl, MON_CAUGHTGENDER
add hl, bc
ld a, [hl]

View File

@ -38,7 +38,7 @@ SpecialOmanyteChamber: ; 8adef
dec a
ld [CurPartyMon], a
push bc
ld a, PartyMon1Item - PartyMon1
ld a, MON_ITEM
call GetPartyParamLocation
pop bc
ld a, [hl]

View File

@ -1965,7 +1965,7 @@ GetPartyParamLocation:: ; 3917
GetPartyLocation:: ; 3927
; Add the length of a PartyMon struct to hl a times.
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
jp AddNTimes
; 392d

View File

@ -573,7 +573,7 @@ endr
ld a, [PartyCount]
dec a
ld hl, PartyMon1Happiness
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, FRIEND_BALL_HAPPINESS
@ -1198,7 +1198,7 @@ SunStone: ; ee0f
jp c, .asm_ee38
ld a, PartyMon1Item - PartyMon1
ld a, MON_ITEM
call GetPartyParamLocation
ld a, [hl]
@ -1239,7 +1239,7 @@ Calcium: ; ee3d
call Functioneed9
ld a, PartyMon1StatExp - PartyMon1
ld a, MON_STAT_EXP
call GetPartyParamLocation
add hl, bc
@ -1281,11 +1281,11 @@ Functionee83: ; ee83
Functionee8c: ; ee8c
ld a, PartyMon1MaxHP - PartyMon1
ld a, MON_MAXHP
call GetPartyParamLocation
ld d, h
ld e, l
ld a, PartyMon1HPExp - 1 - PartyMon1
ld a, MON_EXP + 2
call GetPartyParamLocation
ld b, $1
predef_jump CalcPkmnStats
@ -1338,11 +1338,11 @@ Functioneed9: ; eed9
; eeeb
Table_eeeb: ; eeeb
db HP_UP, PartyMon1HPExp - PartyMon1StatExp
db PROTEIN, PartyMon1AtkExp - PartyMon1StatExp
db IRON, PartyMon1DefExp - PartyMon1StatExp
db CARBOS, PartyMon1SpdExp - PartyMon1StatExp
db CALCIUM, PartyMon1SpcExp - PartyMon1StatExp
db HP_UP, (MON_HP_EXP) - (MON_STAT_EXP)
db PROTEIN, (MON_ATK_EXP) - (MON_STAT_EXP)
db IRON, (MON_DEF_EXP) - (MON_STAT_EXP)
db CARBOS, (MON_SPD_EXP) - (MON_STAT_EXP)
db CALCIUM, (MON_SPC_EXP) - (MON_STAT_EXP)
; eef5
@ -1350,7 +1350,7 @@ Functioneef5: ; eef5
ld a, [CurPartySpecies]
ld [CurSpecies], a
ld [wd265], a
ld a, PartyMon1Level - PartyMon1
ld a, MON_LEVEL
call GetPartyParamLocation
ld a, [hl]
ld [CurPartyLevel], a
@ -1370,7 +1370,7 @@ RareCandy: ; ef14
call Functioneef5
ld a, PartyMon1Level - PartyMon1
ld a, MON_LEVEL
call GetPartyParamLocation
ld a, [hl]
@ -1385,7 +1385,7 @@ RareCandy: ; ef14
callba CalcExpAtLevel
pop de
ld a, PartyMon1Exp - PartyMon1
ld a, MON_EXP
call GetPartyParamLocation
ld a, [hMultiplicand]
@ -1395,7 +1395,7 @@ RareCandy: ; ef14
ld a, [$ffb6]
ld [hl], a
ld a, PartyMon1MaxHP - PartyMon1
ld a, MON_MAXHP
call GetPartyParamLocation
ld a, [hli]
ld b, a
@ -1403,7 +1403,7 @@ RareCandy: ; ef14
push bc
call Functionee8c
ld a, PartyMon1MaxHP + 1 - PartyMon1
ld a, MON_MAXHP + 1
call GetPartyParamLocation
pop bc
@ -1503,7 +1503,7 @@ Functionefda: ; efda (3:6fda)
ld a, $1
ret z
call Functionf058
ld a, PartyMon1Status - PartyMon1
ld a, MON_STATUS
call GetPartyParamLocation
ld a, [hl]
and c
@ -1542,7 +1542,7 @@ Functionf009: ; f009 (3:7009)
Functionf01e: ; f01e (3:701e)
call Functionf2a6
ret nc
ld a, PartyMon1HP - PartyMon1
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
ld [BattleMonHP], a
@ -1724,7 +1724,7 @@ Functionf144: ; f144
xor a
ld [Danger], a
call Functionf2c3
ld a, PartyMon1Status - PartyMon1
ld a, MON_STATUS
call GetPartyParamLocation
xor a
ld [hli], a
@ -1960,7 +1960,7 @@ Functionf2ba: ; f2ba (3:72ba)
Functionf2c3: ; f2c3 (3:72c3)
call Functionf36f
asm_f2c6: ; f2c6 (3:72c6)
ld a, PartyMon1HP - PartyMon1
ld a, MON_HP
call GetPartyParamLocation
ld [hl], d
inc hl
@ -1968,7 +1968,7 @@ asm_f2c6: ; f2c6 (3:72c6)
jp Functionf328
Functionf2d1: ; f2d1 (3:72d1)
ld a, PartyMon1HP + 1 - PartyMon1
ld a, MON_HP + 1
call GetPartyParamLocation
ld a, [hl]
add e
@ -1978,11 +1978,11 @@ Functionf2d1: ; f2d1 (3:72d1)
ld [hl], a
jr c, .asm_f2f5
call Functionf328
ld a, PartyMon1HP + 1 - PartyMon1
ld a, MON_HP + 1
call GetPartyParamLocation
ld d, h
ld e, l
ld a, PartyMon1MaxHP + 1 - PartyMon1
ld a, MON_MAXHP + 1
call GetPartyParamLocation
ld a, [de]
sub [hl]
@ -1997,7 +1997,7 @@ Functionf2d1: ; f2d1 (3:72d1)
ret
Functionf2f9: ; f2f9 (3:72f9)
ld a, PartyMon1HP + 1 - PartyMon1
ld a, MON_HP + 1
call GetPartyParamLocation
ld a, [hl]
sub e
@ -2035,7 +2035,7 @@ Functionf31b: ; f31b (3:731b)
ret
Functionf328: ; f328 (3:7328)
ld a, PartyMon1HP - PartyMon1
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
ld [wd1ef], a
@ -2061,7 +2061,7 @@ Functionf33f: ; f33f
; f348
Functionf348: ; f348 (3:7348)
ld a, PartyMon1HP - PartyMon1
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
ld [wd1ed], a
@ -2078,7 +2078,7 @@ Functionf356: ; f356 (3:7356)
Functionf35f: ; f35f (3:735f)
push hl
ld a, PartyMon1MaxHP - PartyMon1
ld a, MON_MAXHP
call GetPartyParamLocation
ld a, [hli]
ld [Buffer2], a
@ -2096,7 +2096,7 @@ Functionf36f: ; f36f (3:736f)
Functionf378: ; f378 (3:7378)
push bc
ld a, PartyMon1MaxHP - PartyMon1
ld a, MON_MAXHP
call GetPartyParamLocation
ld a, [hli]
ld [hDividend + 0], a
@ -2408,7 +2408,7 @@ PokeFlute: ; f50c
.Functionf554
ld de, PartyMon2 - PartyMon1
ld de, PARTYMON_STRUCT_LENGTH
ld c, PARTY_LENGTH
.loop
@ -2555,7 +2555,7 @@ Mysteryberry: ; f5bf
ld [CurMoveNum], a
jr nz, .loop
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call GetMthMoveOfNthPartymon
push hl
@ -2625,7 +2625,7 @@ Functionf652: ; f652
.asm_f677
ld a, [CurPartyMon]
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld de, BattleMonMoves
ld b, NUM_MOVES
@ -2641,7 +2641,7 @@ Functionf652: ; f652
rept NUM_MOVES + 2 ; BattleMonPP - BattleMonMoves
inc de
endr
ld bc, PartyMon1PP - PartyMon1Moves
ld bc, (MON_PP) - (MON_MOVES)
add hl, bc
ld a, [hl]
ld [de], a
@ -2674,7 +2674,7 @@ Elixer_RestorePPofAllMoves: ; f6af
.moveLoop
push bc
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call GetMthMoveOfNthPartymon
ld a, [hl]
and a
@ -2710,7 +2710,7 @@ RestorePP: ; f6e8
ld [MonType], a
call Functionf8ec
ld hl, PartyMon1PP
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call GetMthMoveOfNthPartymon
ld a, [wd265]
ld b, a
@ -3105,13 +3105,13 @@ GotOffTheItemText: ; 0xf847
Functionf84c: ; f84c
ld a, PartyMon1Moves - PartyMon1
ld a, MON_MOVES
call GetPartyParamLocation
push hl
ld de, Buffer1
predef FillPP
pop hl
ld bc, PartyMon1PP - PartyMon1Moves
ld bc, (MON_PP) - (MON_MOVES)
add hl, bc
ld de, Buffer1
ld b, 0
@ -3193,10 +3193,10 @@ ComputeMaxPP: ; f881
; f8b9
Functionf8b9: ; f8b9
ld a, PartyMon1PP - PartyMon1
ld a, MON_PP
call GetPartyParamLocation
push hl
ld a, PartyMon1Moves - PartyMon1
ld a, MON_MOVES
call GetPartyParamLocation
pop de
xor a ; PARTYMON
@ -3239,7 +3239,7 @@ Functionf8ec: ; f8ec
and a
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
jr z, .got_partymon ; PARTYMON
ld hl, OTPartyMon1Moves
@ -3279,7 +3279,7 @@ Functionf8ec: ; f8ec
pop hl
push bc
ld bc, PartyMon1PP - PartyMon1Moves
ld bc, (MON_PP) - (MON_MOVES)
ld a, [MonType]
cp WILDMON
jr nz, .notwild

654
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@ UnknownScript_0x194e69:
iftrue UnknownScript_0x194e94
writetext UnknownText_0x195196
keeptextopen
giveitem TM_DRAGONBREATH, $1
giveitem TM_DRAGONBREATH, 1
iffalse UnknownScript_0x194e8e
itemtotext TM_DRAGONBREATH, $0
writetext UnknownText_0x1951bf

View File

@ -86,7 +86,7 @@ EatathonContestPoster:
CeladonCafeTrashcan:
checkevent EVENT_FOUND_LEFTOVERS_IN_CELADON_CAFE
iftrue .TrashEmpty
giveitem LEFTOVERS, $1
giveitem LEFTOVERS, 1
iffalse .PackFull
loadfont
itemtotext LEFTOVERS, $0

View File

@ -36,7 +36,7 @@ CeladonVendingMachine:
.FreshWater
checkmoney $0, 200
if_equal $2, .NotEnoughMoney
giveitem FRESH_WATER, $1
giveitem FRESH_WATER, 1
iffalse .NotEnoughSpace
takemoney $0, 200
itemtotext FRESH_WATER, $0
@ -45,7 +45,7 @@ CeladonVendingMachine:
.SodaPop
checkmoney $0, 300
if_equal $2, .NotEnoughMoney
giveitem SODA_POP, $1
giveitem SODA_POP, 1
iffalse .NotEnoughSpace
takemoney $0, 300
itemtotext SODA_POP, $0
@ -54,7 +54,7 @@ CeladonVendingMachine:
.Lemonade
checkmoney $0, 350
if_equal $2, .NotEnoughMoney
giveitem LEMONADE, $1
giveitem LEMONADE, 1
iffalse .NotEnoughSpace
takemoney $0, 350
itemtotext LEMONADE, $0

View File

@ -49,7 +49,7 @@ UnknownScript_0x18c8b8:
loadfont
writetext UnknownText_0x18c9bf
keeptextopen
giveitem TM_DRAGONBREATH, $1
giveitem TM_DRAGONBREATH, 1
iffalse UnknownScript_0x18c8f4
itemtotext TM_DRAGONBREATH, $0
writetext UnknownText_0x18c9fb
@ -122,7 +122,7 @@ TwinsLeaandpia2Script:
end
PokeBallScript_0x18c95a:
giveitem DRAGON_FANG, $1
giveitem DRAGON_FANG, 1
iffalse UnknownScript_0x18c970
disappear $2
loadfont

View File

@ -499,7 +499,7 @@ AideScript_GiveYouBalls:
keeptextopen
itemtotext POKE_BALL, $1
scall AideScript_ReceiveTheBalls
giveitem POKE_BALL, $5
giveitem POKE_BALL, 5
writetext AideText_ExplainBalls
keeptextopen
itemnotify

View File

@ -22,7 +22,7 @@ GoldenrodVendingMachine:
.FreshWater
checkmoney $0, 200
if_equal $2, .NotEnoughMoney
giveitem FRESH_WATER, $1
giveitem FRESH_WATER, 1
iffalse .NotEnoughSpace
takemoney $0, 200
itemtotext FRESH_WATER, $0
@ -31,7 +31,7 @@ GoldenrodVendingMachine:
.SodaPop
checkmoney $0, 300
if_equal $2, .NotEnoughMoney
giveitem SODA_POP, $1
giveitem SODA_POP, 1
iffalse .NotEnoughSpace
takemoney $0, 300
itemtotext SODA_POP, $0
@ -40,7 +40,7 @@ GoldenrodVendingMachine:
.Lemonade
checkmoney $0, 350
if_equal $2, .NotEnoughMoney
giveitem LEMONADE, $1
giveitem LEMONADE, 1
iffalse .NotEnoughSpace
takemoney $0, 350
itemtotext LEMONADE, $0

View File

@ -64,7 +64,7 @@ UnknownScript_0x56c4d:
itemtotext TM_THUNDER, $0
scall UnknownScript_0x56ca1
iffalse UnknownScript_0x56cbd
giveitem TM_THUNDER, $1
giveitem TM_THUNDER, 1
iffalse UnknownScript_0x56cb7
takecoins 5500
jump UnknownScript_0x56ca6
@ -75,7 +75,7 @@ UnknownScript_0x56c69:
itemtotext TM_BLIZZARD, $0
scall UnknownScript_0x56ca1
iffalse UnknownScript_0x56cbd
giveitem TM_BLIZZARD, $1
giveitem TM_BLIZZARD, 1
iffalse UnknownScript_0x56cb7
takecoins 5500
jump UnknownScript_0x56ca6
@ -86,7 +86,7 @@ UnknownScript_0x56c85:
itemtotext TM_FIRE_BLAST, $0
scall UnknownScript_0x56ca1
iffalse UnknownScript_0x56cbd
giveitem TM_FIRE_BLAST, $1
giveitem TM_FIRE_BLAST, 1
iffalse UnknownScript_0x56cb7
takecoins 5500
jump UnknownScript_0x56ca6

View File

@ -106,7 +106,7 @@ UnknownScript_0x6104b:
end
UnknownScript_0x61051:
giveitem EON_MAIL, $1
giveitem EON_MAIL, 1
writetext UnknownText_0x6252a
closetext
loadmovesprites

View File

@ -85,7 +85,7 @@ GyaradosScript_0x70063:
UnknownScript_0x7007a:
returnafterbattle
loadfont
giveitem RED_SCALE, $1
giveitem RED_SCALE, 1
waitbutton
writetext UnknownText_0x703df
playsound SFX_ITEM

View File

@ -56,7 +56,7 @@ UnknownScript_0x190040:
iffalse UnknownScript_0x190072
checkmoney $0, 300
if_equal $2, UnknownScript_0x19006c
giveitem RAGECANDYBAR, $1
giveitem RAGECANDYBAR, 1
iffalse UnknownScript_0x190078
waitbutton
playsound SFX_TRANSACTION

View File

@ -28,7 +28,7 @@ UnknownScript_0x196e56:
writetext UnknownText_0x196fa8
keeptextopen
waitbutton
giveitem MYSTERY_EGG, $1
giveitem MYSTERY_EGG, 1
writetext UnknownText_0x196fd2
playsound SFX_KEY_ITEM
waitbutton

View File

@ -69,7 +69,7 @@ UnknownScript_0x191844:
writetext UnknownText_0x191c5a
keeptextopen
waitbutton
giveitem LOST_ITEM, $1
giveitem LOST_ITEM, 1
iffalse UnknownScript_0x191865
disappear $6
writetext UnknownText_0x191d0a

View File

@ -25,7 +25,7 @@ UnknownScript_0x9cec5:
iffalse UnknownScript_0x9cf02
checkmoney $0, 500
if_equal $2, UnknownScript_0x9cef6
giveitem MOOMOO_MILK, $1
giveitem MOOMOO_MILK, 1
iffalse UnknownScript_0x9cefc
takemoney $0, 500
special Function24ae8

View File

@ -6527,7 +6527,7 @@ Function102bdc: ; 102bdc
jr nz, .asm_102c05
.asm_102bfa
ld bc, OTPartyMon1Level - OTPartyMon1
ld bc, MON_LEVEL
add hl, bc
ld a, [hl]
cp MAX_LEVEL + 1
@ -6718,7 +6718,7 @@ Function102d48: ; 102d48
call SetSeenAndCaughtMon
ld a, [wcd4c]
dec a
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1Happiness
call AddNTimes
ld [hl], BASE_HAPPINESS
@ -6729,7 +6729,7 @@ Function102d48: ; 102d48
jr nz, .asm_102d98
ld a, [wcd4c]
dec a
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1DVs
call AddNTimes
predef GetUnownLetter

View File

@ -4101,7 +4101,7 @@ Function119d93: ; 119d93 (46:5d93)
call SimpleMultiply
ld hl, wcd50
ld [hl], a
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld de, PartyMon1Level
ld a, [PartyCount]
.asm_119daf
@ -4143,7 +4143,7 @@ Function119dd1: ; 119dd1 (46:5dd1)
ld a, $1
ld [rSVBK], a ; $ff00+$70
ld hl, PartyMon1Level
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld de, PartySpecies
ld a, [PartyCount]
.asm_119deb
@ -7867,7 +7867,7 @@ Function11b98f: ; 11b98f
ld a, $ff
ld [bc], a
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld a, e
ld [wcd2a], a
.loop2
@ -7881,7 +7881,7 @@ Function11b98f: ; 11b98f
ld l, a
ld a, [wcd23]
ld h, a
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
ld hl, PartyMonOT
ld bc, NAME_LENGTH
@ -7920,7 +7920,7 @@ Function11b98f: ; 11b98f
ld a, "@"
ld [de], a
ld hl, s0_a600
ld bc, party_struct_length - 1
ld bc, PARTYMON_STRUCT_LENGTH - 1
ld a, [wcd2a]
.loop5
add hl, bc
@ -7935,7 +7935,7 @@ Function11b98f: ; 11b98f
ld l, a
ld a, [wcd29]
ld h, a
ld bc, party_struct_length - 1
ld bc, PARTYMON_STRUCT_LENGTH - 1
call CopyBytes
call CloseSRAM
ret

View File

@ -431,7 +431,7 @@ Function1702b7: ; 1702b7
ld [bc], a
inc bc
push bc
ld bc, party_struct_length
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
push de
ld a, [BGMapBuffer]
@ -648,7 +648,7 @@ CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2
ld hl, BT_OTrainer ; $d100
ld de, wBT_OTTempCopy ; $c608
ld bc, BT_OTrainerEnd - BT_OTrainer ; $e0 = $a + $1 + 3*$3b + $24
; = $a + $1 + BATTLETOWER_NROFPKMNS * (party_struct_length + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
; = $a + $1 + BATTLETOWER_NROFPKMNS * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
call CopyBytes
pop af
ld [rSVBK], a

View File

@ -410,7 +410,7 @@ Function17d1f1: ; 17d1f1
ld hl, PartyMon1DVs
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
callab Functionfba18
@ -2398,7 +2398,7 @@ Function17ded9: ; 17ded9
ld a, [hli]
ld b, a
push hl
callba SetPkmnCaughtData
callba SetPartymonCaughtData
pop hl
pop bc
jr .asm_17df5e
@ -2585,7 +2585,7 @@ Function17e026: ; 17e026
ld b, a
push hl
call CloseSRAM
callba Function4db92
callba SetBoxMonCaughtData
ld a, $1
call GetSRAMBank
pop hl

View File

@ -615,7 +615,7 @@ Function91e4: ; 91e4
.asm_91f5
ld hl, PartyMon1DVs
ld bc, PartyMon2 - PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld c, l

View File

@ -9,12 +9,12 @@ sScratch::
SECTION "SRAM Bank 0", SRAM [$a600], BANK [0]
s0_a600:: ds 6 * (party_struct_length + PartyMon1 - PartyMon1Item)
s0_a71a:: ds 6 * (party_struct_length + PartyMon1 - PartyMon1Item)
s0_a600:: ds 6 * (SCRATCHMON_STRUCT_LENGTH)
s0_a71a:: ds 6 * (SCRATCHMON_STRUCT_LENGTH)
s0_a834:: ds 1
s0_a835:: ds 10 * (party_struct_length + PartyMon1 - PartyMon1Item)
s0_a835:: ds 10 * (SCRATCHMON_STRUCT_LENGTH)
s0_aa0b:: ds 1
s0_aa0c:: ds 10 * (party_struct_length + PartyMon1 - PartyMon1Item)
s0_aa0c:: ds 10 * (SCRATCHMON_STRUCT_LENGTH)
sMysteryGiftItem:: ds 1
s0_abe3:: ds 1

View File

@ -4,7 +4,6 @@ flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
box_struct_length EQU 24 + NUM_MOVES * 2 ; 32
box_struct: MACRO
\1Species:: db
\1Item:: db
@ -30,7 +29,6 @@ box_struct: MACRO
\1End::
ENDM
party_struct_length EQU box_struct_length + 16
party_struct: MACRO
box_struct \1
\1Status:: db
@ -76,7 +74,7 @@ box: MACRO
\1Species:: ds MONS_PER_BOX + 1
\1Mons::
\1Mon1:: box_struct \1Mon1
\1Mon2:: ds box_struct_length * (MONS_PER_BOX +- 1)
\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX +- 1)
\1MonOT:: ds NAME_LENGTH * MONS_PER_BOX
\1MonNicknames:: ds PKMN_NAME_LENGTH * MONS_PER_BOX
\1MonNicknamesEnd::
@ -129,7 +127,6 @@ channel_struct: MACRO
ds 1 ; c131
ds 1 ; c132
ENDM
GLOBAL box_struct_length, party_struct_length
INCLUDE "vram.asm"
@ -885,15 +882,15 @@ wc7e8:: ds 24
RSSET 0 ; Offsets for wBT_OTTempCopy:: @ $c608
wBT_OTTempCopy_0 RB 10 ; $c608
wBT_OTTempCopy_0 RB NAME_LENGTH + -1 ; $c608
wBT_OTTempCopy_TrainerClass RB 1 ; $c608 + $a = $c612
wBT_OTTempCopy_Pkmn1 RB party_struct_length ; $c608 + $b = $c613
wBT_OTTempCopy_Pkmn1 RB $30 ; PARTYMON_STRUCT_LENGTH ; $c608 + $b = $c613
wBT_OTTempCopy_Pkmn1Name RB PKMN_NAME_LENGTH + -1 ; $c608 + $45 = $c64d
wBT_OTTempCopy_45 RB 1
wBT_OTTempCopy_Pkmn2 RB party_struct_length ; $c608 + $46 = $c64e
wBT_OTTempCopy_Pkmn2 RB $30 ; PARTYMON_STRUCT_LENGTH ; $c608 + $46 = $c64e
wBT_OTTempCopy_Pkmn2Name RB PKMN_NAME_LENGTH + -1 ; $c608 + $76 = $c67e
wBT_OTTempCopy_80 RB 1
wBT_OTTempCopy_Pkmn3 RB party_struct_length ; $c608 + $81 = $c689
wBT_OTTempCopy_Pkmn3 RB $30 ; PARTYMON_STRUCT_LENGTH ; $c608 + $81 = $c689
wBT_OTTempCopy_Pkmn3Name RB PKMN_NAME_LENGTH + -1 ; $c608 + $b1 = $c6b9
wBT_OTTempCopy_BB RB 1