Added a constant for NPC trainer name length (#1712)

This commit is contained in:
LOuroboros 2022-07-25 23:59:13 -03:00 committed by GitHub
parent a8c93dcf35
commit b59f7aed7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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

View File

@ -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;