ref: 4afc2f01ef96e6e94f3171c1c6bac84e70596854
parent: 8c2c9e91b50daf8e13c0833524d5f36ba67bb4f8
author: Remy Oukaour <[email protected]>
date: Mon Dec 11 12:35:35 EST 2017
Add member constants for the base data struct, same as most other structs
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -3484,8 +3484,8 @@
add hl, bc
ld a, [hl]
dec a
- ld hl, BaseData + 7 ; type
- ld bc, BaseData1 - BaseData0
+ ld hl, BaseData + BASE_TYPES
+ ld bc, BASE_DATA_SIZE
call AddNTimes
ld de, EnemyMonType
ld bc, 2
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -1,3 +1,30 @@
+; base data struct members (see data/base_stats/*.asm)
+BASE_DEX_NO EQUS "(BaseDexNo - CurBaseData)"
+BASE_STATS EQUS "(BaseStats - CurBaseData)"
+BASE_HP EQUS "(BaseHP - CurBaseData)"
+BASE_ATK EQUS "(BaseAttack - CurBaseData)"
+BASE_SPD EQUS "(BaseSpeed - CurBaseData)"
+BASE_SAT EQUS "(BaseSpecialAttack - CurBaseData)"
+BASE_SDF EQUS "(BaseSpecialDefense - CurBaseData)"
+BASE_TYPES EQUS "(BaseType - CurBaseData)"
+BASE_TYPE_1 EQUS "(BaseType1 - CurBaseData)"
+BASE_TYPE_2 EQUS "(BaseType2 - CurBaseData)"
+BASE_CATCH_RATE EQUS "(BaseCatchRate - CurBaseData)"
+BASE_EXP EQUS "(BaseExp - CurBaseData)"
+BASE_ITEMS EQUS "(BaseItems - CurBaseData)"
+BASE_ITEM_1 EQUS "(BaseItem1 - CurBaseData)"
+BASE_ITEM_2 EQUS "(BaseItem2 - CurBaseData)"
+BASE_GENDER EQUS "(BaseGender - CurBaseData)"
+BASE_UNKNOWN_1 EQUS "(BaseUnknown1 - CurBaseData)"
+BASE_EGG_STEPS EQUS "(BaseEggSteps - CurBaseData)"
+BASE_UNKNOWN_2 EQUS "(BaseUnknown2 - CurBaseData)"
+BASE_PIC_SIZE EQUS "(BasePicSize - CurBaseData)"
+BASE_PADDING EQUS "(BasePadding - CurBaseData)"
+BASE_GROWTH_RATE EQUS "(BaseGrowthRate - CurBaseData)"
+BASE_EGG_GROUPS EQUS "(BaseEggGroups - CurBaseData)"
+BASE_TMHM EQUS "(BaseTMHM - CurBaseData)"
+BASE_DATA_SIZE EQUS "(CurBaseDataEnd - CurBaseData)"
+
; BaseGrowthRate values
; GrowthRates indexes (see main.asm)
const_def
@@ -28,37 +55,37 @@
; party_struct members (see macros/wram.asm)
-MON_SPECIES EQUS "(PartyMon1Species - PartyMon1)"
-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)"
-MON_SPD_EXP EQUS "(PartyMon1SpdExp - PartyMon1)"
-MON_SPC_EXP EQUS "(PartyMon1SpcExp - PartyMon1)"
-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)"
-MON_MAXHP EQUS "(PartyMon1MaxHP - PartyMon1)"
-MON_ATK EQUS "(PartyMon1Attack - PartyMon1)"
-MON_DEF EQUS "(PartyMon1Defense - PartyMon1)"
-MON_SPD EQUS "(PartyMon1Speed - PartyMon1)"
-MON_SAT EQUS "(PartyMon1SpclAtk - PartyMon1)"
-MON_SDF EQUS "(PartyMon1SpclDef - PartyMon1)"
-BOXMON_STRUCT_LENGTH EQUS "(PartyMon1End - PartyMon1)"
-PARTYMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1)"
+MON_SPECIES EQUS "(PartyMon1Species - PartyMon1)"
+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)"
+MON_SPD_EXP EQUS "(PartyMon1SpdExp - PartyMon1)"
+MON_SPC_EXP EQUS "(PartyMon1SpcExp - PartyMon1)"
+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)"
+MON_MAXHP EQUS "(PartyMon1MaxHP - PartyMon1)"
+MON_ATK EQUS "(PartyMon1Attack - PartyMon1)"
+MON_DEF EQUS "(PartyMon1Defense - PartyMon1)"
+MON_SPD EQUS "(PartyMon1Speed - PartyMon1)"
+MON_SAT EQUS "(PartyMon1SpclAtk - PartyMon1)"
+MON_SDF EQUS "(PartyMon1SpclDef - PartyMon1)"
+BOXMON_STRUCT_LENGTH EQUS "(PartyMon1End - PartyMon1)"
+PARTYMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1)"
REDMON_STRUCT_LENGTH EQU 44
--- a/data/base_stats.asm
+++ b/data/base_stats.asm
@@ -1,6 +1,4 @@
-BaseData0::
INCLUDE "data/base_stats/bulbasaur.asm"
-BaseData1::
INCLUDE "data/base_stats/ivysaur.asm"
INCLUDE "data/base_stats/venusaur.asm"
INCLUDE "data/base_stats/charmander.asm"
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -737,8 +737,8 @@
.skip_steel
push bc
dec a
- ld hl, BaseData + 7 ; type
- ld bc, BaseData1 - BaseData0
+ ld hl, BaseData + BASE_TYPES
+ ld bc, BASE_DATA_SIZE
call AddNTimes
ld bc, 2
ld a, BANK(BaseData)
--- a/home.asm
+++ b/home.asm
@@ -1704,11 +1704,11 @@
; Get BaseData
dec a
- ld bc, BaseData1 - BaseData0
+ ld bc, BASE_DATA_SIZE
ld hl, BaseData
call AddNTimes
ld de, CurBaseData
- ld bc, BaseData1 - BaseData0
+ ld bc, BASE_DATA_SIZE
call CopyBytes
jr .end
@@ -1881,8 +1881,8 @@
dec a
ld b, 0
add hl, bc
- ld hl, BaseData + 0
- ld bc, BaseData1 - BaseData0
+ ld hl, BaseData + BASE_DEX_NO
+ ld bc, BASE_DATA_SIZE
call AddNTimes
ld a, BANK(BaseData)
call GetFarHalfword
--- a/home/map.asm
+++ b/home/map.asm
@@ -2374,12 +2374,12 @@
push bc
ld hl, Tilesets
- ld bc, Tileset1 - Tileset0
+ ld bc, TilesetHeaderEnd - TilesetHeader
ld a, [wTileset]
call AddNTimes
ld de, TilesetBank
- ld bc, Tileset1 - Tileset0
+ ld bc, TilesetHeaderEnd - TilesetHeader
ld a, BANK(Tilesets)
call FarCopyBytes
--- a/main.asm
+++ b/main.asm
@@ -3919,8 +3919,8 @@
push bc
ld a, [CurPartySpecies]
dec a
- ld hl, BaseData + BaseGender - CurBaseData
- ld bc, BaseData1 - BaseData
+ ld hl, BaseData + BASE_GENDER
+ ld bc, BASE_DATA_SIZE
call AddNTimes
pop bc
--- a/tilesets/tileset_headers.asm
+++ b/tilesets/tileset_headers.asm
@@ -7,9 +7,7 @@
dw \1PalMap
endm
-Tileset0::
tileset Tileset0
-Tileset1::
tileset TilesetJohto1
tileset TilesetJohto2
tileset TilesetKanto
--- a/wram.asm
+++ b/wram.asm
@@ -1997,6 +1997,7 @@
TilesetAnim:: dw ; bank 3f ; d1e2
ds 2 ; unused ; d1e4
TilesetPalettes:: dw ; bank 3f ; d1e6
+TilesetHeaderEnd::
EvolvableFlags:: flag_array PARTY_LENGTH ; d1e8
@@ -2109,7 +2110,9 @@
BaseType2:: db ; d23e
BaseCatchRate:: db ; d23f
BaseExp:: db ; d240
-BaseItems:: dw ; d241
+BaseItems:: ; d241
+BaseItem1:: db ; d241
+BaseItem2:: db ; d242
BaseGender:: db ; d243
BaseUnknown1:: db ; d244
BaseEggSteps:: db ; d245
@@ -2119,6 +2122,7 @@
BaseGrowthRate:: db ; d24c
BaseEggGroups:: db ; d24d
BaseTMHM:: flag_array NUM_TM_HM_TUTOR ; d24e
+CurBaseDataEnd::
CurDamage:: dw ; d256