From ab2394c4a4b92bbfe2001a415afc580aaf9b7034 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 8 Jun 2025 00:21:39 +0200 Subject: [PATCH] pokemon data clean-up --- data/data_81076E4.s | 28 ---------------------------- include/code_803D110.h | 1 - include/dungeon_name_banner.h | 6 ++++++ ld_script.ld | 1 + src/dungeon_name_banner.c | 1 + src/pokemon.c | 34 +++++++++++----------------------- src/pokemon_3.c | 7 +++++-- src/run_dungeon.c | 1 + 8 files changed, 25 insertions(+), 54 deletions(-) create mode 100644 include/dungeon_name_banner.h diff --git a/data/data_81076E4.s b/data/data_81076E4.s index 6d2ff9172..4818a46a5 100644 --- a/data/data_81076E4.s +++ b/data/data_81076E4.s @@ -2,35 +2,7 @@ .align 2,0 -@ pokemon_3 #1 -.string "pksdir0\0" -.global gIQSkillGroups -gIQSkillGroups: @ 81076E4 -.4byte 9999 -.4byte 4 -.4byte 1 -.4byte 2 -.4byte 4 -.4byte 4 -.4byte 6 -.4byte 7 -.4byte 8 -.4byte 9 -.4byte 9 -.4byte 9 -.4byte 10 -.4byte 10 -.4byte 11 -.4byte 11 -.4byte 14 -.4byte 14 -.4byte 14 -.4byte 16 -.4byte 16 -.4byte 9 -.4byte 17 -.4byte 6 @ pokemon_3 #2 .string "pksdir0\0" @ pokemon_3 #3 diff --git a/include/code_803D110.h b/include/code_803D110.h index d4f4e948a..f2a9993ad 100644 --- a/include/code_803D110.h +++ b/include/code_803D110.h @@ -2,7 +2,6 @@ #define GUARD_CODE_803D110_H void nullsub_56(void); -void ShowDungeonNameBanner_Async(void); void sub_803DF60(void); void sub_803E02C(void); void sub_803E13C(void); diff --git a/include/dungeon_name_banner.h b/include/dungeon_name_banner.h new file mode 100644 index 000000000..532ea750d --- /dev/null +++ b/include/dungeon_name_banner.h @@ -0,0 +1,6 @@ +#ifndef GUARD_DUNGEON_NAME_BANNER_H +#define GUARD_DUNGEON_NAME_BANNER_H + +void ShowDungeonNameBanner_Async(void); + +#endif diff --git a/ld_script.ld b/ld_script.ld index 296f20ee3..4a44733bf 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -671,6 +671,7 @@ SECTIONS { src/dungeon_cutscene_no_one_here.o(.rodata); src/dungeon_portrait_placement.o(.rodata); src/pokemon.o(.rodata); + src/pokemon_3.o(.rodata); data/data_81076E4.o(.rodata); src/game_options.o(.rodata); src/random_mersenne_twister.o(.rodata); diff --git a/src/dungeon_name_banner.c b/src/dungeon_name_banner.c index 6850bd9ef..30cf86368 100644 --- a/src/dungeon_name_banner.c +++ b/src/dungeon_name_banner.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_name_banner.h" #include "constants/dungeon.h" #include "structs/str_202ED28.h" #include "structs/str_202EDE8.h" diff --git a/src/pokemon.c b/src/pokemon.c index a06d9a422..70b75d59e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -33,15 +33,6 @@ struct unkStruct_8107654 s32 unk4; }; -ALIGNED(4) static const char sMonsterParameterFileName[] = "monspara"; -ALIGNED(4) static const char gUnknown_8107600[] = _("{color YELLOW_RAW}%s{reset}"); -ALIGNED(4) static const char gUnknown_8107608[] = _("{color CYAN_RAW}%s{reset}"); -ALIGNED(4) static const char gUnownLetters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?"; -ALIGNED(4) static const char gUnknown_8107630[] = "%s%c"; -ALIGNED(4) static const char gUnknown_8107638[] = "%s"; -ALIGNED(4) static const char gUnknown_810763C[] = _("{color}%c%s{reset}"); -static const u8 gUnknown_8107645[12] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - extern s16 gFrenzyPlantIQReq; // 0x14d extern s16 gHydroCannonIQReq; // 0x14d extern s16 gBlastBurnIQReq; // 0x14d @@ -55,7 +46,7 @@ extern void xxx_pokemon2_to_pokemonstruct_808DF44(PokemonStruct1*, PokemonStruct void LoadMonsterParameters(void) { gRecruitedPokemonRef = &gRecruitedPokemon; - gMonsterParametersFile = OpenFileAndGetFileDataPtr(sMonsterParameterFileName, &gSystemFileArchive); + gMonsterParametersFile = OpenFileAndGetFileDataPtr("monspara", &gSystemFileArchive); gMonsterParameters = (MonsterDataEntry *)gMonsterParametersFile->data; gLevelCurrentPokeId = 0; // More in blue @@ -653,30 +644,25 @@ void CopyMonsterNameToBuffer(u8 * buffer, s32 index) void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index) { s32 new_index = index; - sprintfStatic(buffer, gUnknown_8107600, gMonsterParameters[new_index].species); // {color YELLOW}%s{reset} + sprintfStatic(buffer, _("{color YELLOW_RAW}%s{reset}"), gMonsterParameters[new_index].species); } void CopyCyanMonsterNametoBuffer(u8 *buffer, s32 index_) { s32 index = (s16) index_; - sprintfStatic(buffer, gUnknown_8107608, gMonsterParameters[index].species); // {color CYAN}%s{reset} + sprintfStatic(buffer, _("{color CYAN_RAW}%s{reset}"), gMonsterParameters[index].species); } void sub_808D930(u8 *buffer, s32 index) { - char *unownString; - s32 unownIndex; - const char *preload; s16 index_s16 = index; if (GetBaseSpecies(index_s16) == MONSTER_UNOWN) { - preload = gUnknown_8107630; // %s%c - unownString = GetMonSpecies(MONSTER_UNOWN); - unownIndex = GetUnownIndex(index_s16); - sprintfStatic(buffer,preload,unownString,gUnownLetters[unownIndex]); // ABCDEFGHIJKLMNOPQRSTUVWXYZ!? + char *const unownLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?"; + sprintfStatic(buffer,"%s%c",GetMonSpecies(MONSTER_UNOWN),unownLetters[GetUnownIndex(index_s16)]); } else { - sprintfStatic(buffer,gUnknown_8107638, gMonsterParameters[index_s16].species); // %s + sprintfStatic(buffer,"%s", gMonsterParameters[index_s16].species); } } @@ -693,7 +679,7 @@ void PrintColoredPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon, s32 color if (colorNum == COLOR_WHITE) { colorNum = COLOR_CYAN; } - sprintfStatic(buffer,gUnknown_810763C,colorNum,nameBuffer); // {color}%c%s{reset} + sprintfStatic(buffer,_("{color}%c%s{reset}"),colorNum,nameBuffer); } void sub_808D9DC(u8 *buffer, PokemonStruct2 *param_2, s32 colorNum) @@ -704,7 +690,7 @@ void sub_808D9DC(u8 *buffer, PokemonStruct2 *param_2, s32 colorNum) if (colorNum == COLOR_WHITE) { colorNum = COLOR_YELLOW; } - sprintfStatic(buffer,gUnknown_810763C,colorNum,nameBuffer); // {color}%c%s{reset} + sprintfStatic(buffer,_("{color}%c%s{reset}"),colorNum,nameBuffer); } void sub_808DA0C(u8 *buffer, PokemonStruct2 *param_2) @@ -712,7 +698,7 @@ void sub_808DA0C(u8 *buffer, PokemonStruct2 *param_2) u8 nameBuffer [20]; sub_80922B4(nameBuffer, param_2->name, POKEMON_NAME_LENGTH); - sprintfStatic(buffer,gUnknown_8107638,nameBuffer); // %s + sprintfStatic(buffer,"%s",nameBuffer); } void PrintPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon) @@ -720,6 +706,8 @@ void PrintPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon) sub_80922B4(buffer, pokemon->name, POKEMON_NAME_LENGTH); } +static const u8 gUnknown_8107645[12] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + bool8 sub_808DA44(s32 _species, u32 a2_) { // this is the dumbest thing ever, but just making a1 a s16 and diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 0e9450850..af02b2177 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "constants/ability.h" #include "constants/colors.h" #include "constants/dungeon.h" @@ -33,8 +34,6 @@ struct UnusedOffenseStruct u8 spDefBoost; }; -extern u32 gIQSkillGroups[]; - extern SpriteOAM gShadowSprites[3]; // Shadow sprites of some kind extern const s16 gUnknown_810AC60; // 0xC extern const s16 gUnknown_810AC62; // 0xC @@ -444,6 +443,10 @@ void ToggleIQSkill(IqSkillFlags *iq, u32 skillIndex) } } +static const s32 gIQSkillGroups[] = { + 9999, 4, 1, 2, 4, 4, 6, 7, 8, 9, 9, 9, 10, 10, 11, 11, 14, 14, 14, 16, 16, 9, 17, 6 +}; + void SetIQSkill(IqSkillFlags *iq, u32 skillIndex) { s32 iqSkill; diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 1549db9e5..0379443a8 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -35,6 +35,7 @@ #include "dungeon_message_log.h" #include "dungeon_misc.h" #include "dungeon_music.h" +#include "dungeon_name_banner.h" #include "dungeon_random.h" #include "dungeon_strings.h" #include "dungeon_serializer.h"