diff --git a/include/constants/global.h b/include/constants/global.h index f4b503c32..2a0ac7d6f 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -103,6 +103,7 @@ #define WONDER_NEWS_BODY_TEXT_LINES 10 #define TYPE_NAME_LENGTH 6 #define ABILITY_NAME_LENGTH 12 +#define TRAINER_NAME_LENGTH 10 #define MAX_STAMP_CARD_STAMPS 7 diff --git a/include/constants/trainer_hill.h b/include/constants/trainer_hill.h index 371763faf..e0f660b6f 100644 --- a/include/constants/trainer_hill.h +++ b/include/constants/trainer_hill.h @@ -52,8 +52,6 @@ #define TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED 1 #define TRAINER_HILL_PLAYER_STATUS_NORMAL 2 -#define HILL_TRAINER_NAME_LENGTH 11 - #define TRAINER_HILL_OTID 0x10000000 // The full map of each Trainer Hill floor is 16x21. diff --git a/include/data.h b/include/data.h index 2d3619e67..8846cc93e 100644 --- a/include/data.h +++ b/include/data.h @@ -71,7 +71,7 @@ struct Trainer /*0x01*/ u8 trainerClass; /*0x02*/ u8 encounterMusic_gender; // last bit is gender /*0x03*/ u8 trainerPic; - /*0x04*/ u8 trainerName[12]; + /*0x04*/ u8 trainerName[TRAINER_NAME_LENGTH + 1]; /*0x10*/ u16 items[MAX_TRAINER_ITEMS]; /*0x18*/ bool8 doubleBattle; /*0x1C*/ u32 aiFlags; diff --git a/include/global.tv.h b/include/global.tv.h index e24ead3f2..1fb1b8a33 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -81,7 +81,8 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u16 species; /*0x04*/ u8 pokemonName[POKEMON_NAME_LENGTH + 1]; - /*0x0F*/ u8 trainerName[11]; + /*0x0F*/ u8 trainerName[PLAYER_NAME_LENGTH + 1]; + /*0x17*/ u8 unused[3]; /*0x1A*/ u8 random; /*0x1B*/ u8 random2; /*0x1C*/ u16 randomSpecies; diff --git a/include/trainer_hill.h b/include/trainer_hill.h index 954087e1b..6e2ec0ba0 100644 --- a/include/trainer_hill.h +++ b/include/trainer_hill.h @@ -5,7 +5,7 @@ struct TrainerHillTrainer { - u8 name[HILL_TRAINER_NAME_LENGTH]; + u8 name[TRAINER_NAME_LENGTH + 1]; u8 facilityClass; bool32 unused; // Set to TRUE on JP trainers u16 speechBefore[EASY_CHAT_BATTLE_WORDS_COUNT]; diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index b854c899e..2723e1200 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -31,7 +31,7 @@ struct GFRomHeader u32 mysteryEventFlag; u32 pokedexCount; u8 playerNameLength; - u8 unk2; + u8 trainerNameLength; u8 pokemonNameLength1; u8 pokemonNameLength2; u8 unk5; @@ -111,7 +111,7 @@ static const struct GFRomHeader sGFRomHeader = { .mysteryEventFlag = FLAG_SYS_MYSTERY_EVENT_ENABLE, .pokedexCount = NATIONAL_DEX_COUNT, .playerNameLength = PLAYER_NAME_LENGTH, - .unk2 = 10, + .trainerNameLength = TRAINER_NAME_LENGTH, .pokemonNameLength1 = POKEMON_NAME_LENGTH, .pokemonNameLength2 = POKEMON_NAME_LENGTH, // Two of the below 12s are likely move/ability name length, given their presence in this header diff --git a/src/trainer_hill.c b/src/trainer_hill.c index dad6b97ea..4549166ac 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -36,7 +36,7 @@ struct FloorTrainers { - u8 name[HILL_TRAINERS_PER_FLOOR][HILL_TRAINER_NAME_LENGTH]; + u8 name[HILL_TRAINERS_PER_FLOOR][TRAINER_NAME_LENGTH + 1]; u8 facilityClass[HILL_TRAINERS_PER_FLOOR]; }; @@ -305,7 +305,7 @@ void GetTrainerHillTrainerName(u8 *dst, u16 trainerId) s32 i; u8 id = trainerId - 1; - for (i = 0; i < HILL_TRAINER_NAME_LENGTH; i++) + for (i = 0; i < TRAINER_NAME_LENGTH + 1; i++) dst[i] = sFloorTrainers->name[id][i]; } @@ -330,7 +330,7 @@ void InitTrainerHillBattleStruct(void) for (i = 0; i < HILL_TRAINERS_PER_FLOOR; i++) { - for (j = 0; j < HILL_TRAINER_NAME_LENGTH; j++) + for (j = 0; j < TRAINER_NAME_LENGTH + 1; j++) sFloorTrainers->name[i][j] = sHillData->floors[sHillData->floorId].trainers[i].name[j]; sFloorTrainers->facilityClass[i] = sHillData->floors[sHillData->floorId].trainers[i].facilityClass;