From 9088c3c2b6e0afb79a4b245e623d1b3f24dd5868 Mon Sep 17 00:00:00 2001 From: gijs Date: Fri, 24 May 2024 11:22:32 +0200 Subject: [PATCH] Add `Gender` enum --- include/character.h | 3 ++- include/class.h | 3 ++- include/gender.h | 20 ++++++++++++++++++++ src/segment_obdata/_ob_fierce_selection.c | 3 ++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 include/gender.h diff --git a/include/character.h b/include/character.h index ea0578d..386ae33 100644 --- a/include/character.h +++ b/include/character.h @@ -5,6 +5,7 @@ #include "assert.h" #include "element.h" +#include "gender.h" typedef struct { // Possible data still undiscovered: @@ -16,7 +17,7 @@ typedef struct { /* 0x11 */ u8 portrait; /* 0x12 */ u8 class; /* 0x13 */ u8 level; - /* 0x14 */ u8 gender; + /* 0x14 */ Gender gender; /* 0x15 */ u8 field_0x15; /* 0x16 */ u16 max_hp; /* 0x18 */ u16 cur_hp; diff --git a/include/class.h b/include/class.h index 11cb867..4842c80 100644 --- a/include/class.h +++ b/include/class.h @@ -5,11 +5,12 @@ #include "assert.h" #include "equipment.h" +#include "gender.h" typedef struct { /* 0x00 */ char* name; /* 0x04 */ u8 field_0x4; - /* 0x05 */ u8 gender; + /* 0x05 */ Gender gender; /* 0x06 */ u8 leadership_rank; /* 0x07 */ u8 field_0x7; diff --git a/include/gender.h b/include/gender.h new file mode 100644 index 0000000..8c29b44 --- /dev/null +++ b/include/gender.h @@ -0,0 +1,20 @@ +#ifndef __GENDER_H__ +#define __GENDER_H__ + +#include + +#include "assert.h" + +typedef u8 Gender; + +enum { + /* 00 */ GENDER_MALE, + /* 01 */ GENDER_FEMALE, + // The gender is based on the gender of the leader. + /* 02 */ GENDER_LEADER, + +}; + +ASSERT_SIZE(Gender, 1); + +#endif // __GENDER_H__ diff --git a/src/segment_obdata/_ob_fierce_selection.c b/src/segment_obdata/_ob_fierce_selection.c index 66437f6..d180b7d 100644 --- a/src/segment_obdata/_ob_fierce_selection.c +++ b/src/segment_obdata/_ob_fierce_selection.c @@ -2,6 +2,7 @@ #include "class.h" #include "ability.h" +#include "gender.h" INCLUDE_ASM(const s32, "segment_obdata/_ob_fierce_selection", func_8016D200); @@ -132,7 +133,7 @@ u8 class_get_field_0x4(u8 portrait, u8 class) { } /* 43D70 8016DE70 */ -u8 obClassGetGender(u8 portrait, u8 class) { +Gender obClassGetGender(u8 portrait, u8 class) { if (obClassData[portrait].field_0x45 == class) return obClassData[portrait].gender;