Extract species-related structs to species.h

This commit is contained in:
Rachel
2025-01-15 14:28:59 -08:00
parent 50eae5bf1c
commit 2e09fce6a2
5 changed files with 78 additions and 70 deletions

View File

@@ -17,11 +17,6 @@ enum {
STAT_MAX
};
#define MAX_ABILITIES 2
#define MAX_EGG_GROUPS 2
#define MAX_TYPES 2
#define MAX_EVOLUTIONS 7
#define MAX_PARTY_SIZE 6
#define NUM_BOOSTABLE_STATS 8
@@ -35,12 +30,6 @@ enum {
#define MAX_POKEMON_MARKINGS 6
#define MAX_POKEMON_LEVEL 100
#define LEARNSET_NO_MOVE_TO_LEARN 0
#define MAX_LEARNSET_ENTRIES 20
#define LEARNSET_MOVE_ALREADY_KNOWN 0xFFFE
#define LEARNSET_ALL_SLOTS_FILLED 0xFFFF
#define LEARNSET_SENTINEL_ENTRY 0xFFFF
#define EVOLVE_FRIENDSHIP_THRESHOLD 220
/**

View File

@@ -16,6 +16,8 @@
#define NELEMS(a) (sizeof(a) / sizeof(*(a)))
#define XtOffset(pointer_type, field) ((unsigned int)&(((pointer_type)NULL)->field))
#define ALIGN_4 __attribute__((aligned(4)))
typedef struct {
int x;
int y;

View File

@@ -14,6 +14,7 @@
#include "struct_defs/archived_sprite.h"
#include "struct_defs/chatot_cry.h"
#include "struct_defs/pokemon.h"
#include "struct_defs/species.h"
#include "struct_defs/sprite_animation_frame.h"
#include "overlay005/struct_ov5_021DE5D0.h"
@@ -31,53 +32,6 @@
#define FACE_BACK 0
#define FACE_FRONT 2
typedef struct SpeciesBaseStats {
u8 hp;
u8 attack;
u8 defense;
u8 speed;
u8 spAttack;
u8 spDefense;
} SpeciesBaseStats;
typedef struct SpeciesEVYields {
u16 hp : 2;
u16 attack : 2;
u16 defense : 2;
u16 speed : 2;
u16 spAttack : 2;
u16 spDefense : 2;
} SpeciesEVYields;
typedef struct SpeciesWildHeldItems {
u16 common;
u16 rare;
} SpeciesWildHeldItems;
typedef struct SpeciesData {
SpeciesBaseStats baseStats;
u8 types[MAX_TYPES];
u8 catchRate;
u8 baseExpReward;
SpeciesEVYields evYields;
SpeciesWildHeldItems wildHeldItems;
u8 genderRatio;
u8 hatchCycles;
u8 baseFriendship;
u8 expRate;
u8 eggGroups[MAX_EGG_GROUPS];
u8 abilities[MAX_ABILITIES];
u8 safariFleeRate;
u8 bodyColor : 7;
u8 flipSprite : 1;
// u16 padding;
u32 tmLearnsetMask1; // Bitflags for whether this pokemon can learn a TM (TM1 -> TM32)
u32 tmLearnsetMask2; // Bitflags for whether this pokemon can learn a TM (TM33 -> TM64)
u32 tmLearnsetMask3; // Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4)
u32 tmLearnsetMask4; // Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused)
} SpeciesData;
enum EvolutionClass {
EVO_CLASS_BY_LEVEL = 0,
EVO_CLASS_BY_TRADE,

View File

@@ -0,0 +1,75 @@
#ifndef POKEPLATINUM_SPECIES_H
#define POKEPLATINUM_SPECIES_H
#define MAX_ABILITIES 2
#define MAX_EGG_GROUPS 2
#define MAX_TYPES 2
#define MAX_EVOLUTIONS 7
#define MAX_LEARNSET_ENTRIES 20
#define LEARNSET_NO_MOVE_TO_LEARN 0
#define LEARNSET_MOVE_ALREADY_KNOWN 0xFFFE
#define LEARNSET_ALL_SLOTS_FILLED 0xFFFF
#define LEARNSET_SENTINEL_ENTRY 0xFFFF
typedef struct SpeciesBaseStats {
u8 hp;
u8 attack;
u8 defense;
u8 speed;
u8 spAttack;
u8 spDefense;
} SpeciesBaseStats;
typedef struct SpeciesEVYields {
u16 hp : 2;
u16 attack : 2;
u16 defense : 2;
u16 speed : 2;
u16 spAttack : 2;
u16 spDefense : 2;
} SpeciesEVYields;
typedef struct SpeciesWildHeldItems {
u16 common;
u16 rare;
} SpeciesWildHeldItems;
typedef struct SpeciesData {
SpeciesBaseStats baseStats;
u8 types[MAX_TYPES];
u8 catchRate;
u8 baseExpReward;
SpeciesEVYields evYields;
SpeciesWildHeldItems wildHeldItems;
u8 genderRatio;
u8 hatchCycles;
u8 baseFriendship;
u8 expRate;
u8 eggGroups[MAX_EGG_GROUPS];
u8 abilities[MAX_ABILITIES];
u8 safariFleeRate;
u8 bodyColor : 7;
u8 flipSprite : 1;
// u16 padding;
u32 tmLearnsetMask1; // Bitflags for whether this pokemon can learn a TM (TM1 -> TM32)
u32 tmLearnsetMask2; // Bitflags for whether this pokemon can learn a TM (TM33 -> TM64)
u32 tmLearnsetMask3; // Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4)
u32 tmLearnsetMask4; // Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused)
} SpeciesData;
typedef struct SpeciesEvolution {
u16 method;
u16 param;
u16 targetSpecies;
} SpeciesEvolution;
// This struct is not explicitly used; it is provided to document and enforce the size of
// the learnset entries.
typedef struct SpeciesLearnset {
ALIGN_4 u16 entries[MAX_LEARNSET_ENTRIES + 1];
} SpeciesLearnset;
#endif // POKEPLATINUM_SPECIES_H

View File

@@ -92,18 +92,6 @@ static const s8 sNatureFlavorAffinities[][5] = {
{ 0x0, 0x0, 0x0, 0x0, 0x0 },
};
typedef struct SpeciesEvolution {
u16 method;
u16 param;
u16 targetSpecies;
} SpeciesEvolution;
// This struct is not explicitly used; it is provided to document and enforce the size of
// the learnset entries.
typedef struct SpeciesLearnset {
__attribute__((aligned(4))) u16 entries[MAX_LEARNSET_ENTRIES + 1];
} SpeciesLearnset;
enum PokemonDataBlockID {
DATA_BLOCK_A = 0,
DATA_BLOCK_B,