split text util

This commit is contained in:
DizzyEggg 2025-06-10 14:10:32 +02:00
parent 345d7c9f42
commit c9cebdb004
33 changed files with 167 additions and 200 deletions

View File

@ -2,82 +2,7 @@
@ START rescue_team_info.c
.string "pksdir0\0"
.global gRescueRankMaxPoints
gRescueRankMaxPoints: @ 8109810
.4byte 50
.4byte 500
.4byte 1500
.4byte 3000
.4byte 7500
.4byte 15000
.4byte 100000000
.global gTeamNamePlaceholder
gTeamNamePlaceholder: @ 810982C
.string "Pokémon\0"
@ END rescue_team_info.c
@ text_util
.string "pksdir0\0"
.global gUnknown_810983C
gUnknown_810983C: @ 810983C
.4byte gUnknown_8109888
.4byte gUnknown_8109884
.4byte gUnknown_8109880
.4byte gUnknown_810987C
.4byte gUnknown_8109878
.4byte gUnknown_8109874
.4byte gUnknown_8109870
.4byte gUnknown_810986C
.4byte gUnknown_8109868
.4byte gUnknown_8109864
.global gUnknown_8109864
gUnknown_8109864: @ 8109864
.byte 0x82, 0x58, 0x00, 0x00
.global gUnknown_8109868
gUnknown_8109868: @ 8109868
.byte 0x82, 0x57, 0x00, 0x00
.global gUnknown_810986C
gUnknown_810986C: @ 810986C
.byte 0x82, 0x56, 0x00, 0x00
.global gUnknown_8109870
gUnknown_8109870: @ 8109870
.byte 0x82, 0x55, 0x00, 0x00
.global gUnknown_8109874
gUnknown_8109874: @ 8109874
.byte 0x82, 0x54, 0x00, 0x00
.global gUnknown_8109878
gUnknown_8109878: @ 8109878
.byte 0x82, 0x53, 0x00, 0x00
.global gUnknown_810987C
gUnknown_810987C: @ 810987C
.byte 0x82, 0x52, 0x00, 0x00
.global gUnknown_8109880
gUnknown_8109880: @ 8109880
.byte 0x82, 0x51, 0x00, 0x00
.global gUnknown_8109884
gUnknown_8109884: @ 8109884
.byte 0x82, 0x50, 0x00, 0x00
.global gUnknown_8109888
gUnknown_8109888: @ 8109888
.byte 0x82, 0x4f, 0x00, 0x00
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ START friend_area.c
.string "pksdir0\0"

View File

@ -0,0 +1,7 @@
#ifndef GUARD_POKEMON_ABILITIES_H
#define GUARD_POKEMON_ABILITIES_H
void CopyAbilityNametoBuffer(char *buffer, u8 index);
const u8 *GetAbilityDescription(u8 index);
#endif // GUARD_POKEMON_ABILITIES_H

9
include/pokemon_types.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef GUARD_POKEMON_TYPES_H
#define GUARD_POKEMON_TYPES_H
const char *GetUnformattedTypeString(u8 type);
const char * GetFormattedTypeString(u8 type);
u8 IsTypePhysical(u8 index);
u8 GetBestResistingType(u8 index);
#endif // GUARD_POKEMON_TYPES_H

View File

@ -30,7 +30,6 @@ void sub_80920D8(u8 *buffer);
void SetRescueTeamName(u8 *buffer);
s32 GetTeamRankPts(void);
s32 GetPtsToNextRank(void);
void SetTeamRankPoints(s32 newPts);
void AddToTeamRankPts(s32 newPts);
u8 GetRescueTeamRank(void);
const u8 *GetTeamRankString(u32 index);

View File

@ -29,7 +29,7 @@ extern const u8 *const gUnknown_810AF50[20];
extern const u8 *const gAdventureLogText[32];
extern const u8 *const gRescueTeamRanks[MAX_TEAM_RANKS];
extern const u8 *const gAbilityNames[NUM_ABILITIES];
extern const u8 *const AbilityDescriptions[NUM_ABILITIES];
extern const u8 *const gAbilityDescriptions[NUM_ABILITIES];
extern const u8 *const gRangeNames[49];
extern const u8 *const gUnknown_810CF00;
extern const u8 *const gTextType;

View File

@ -1,16 +1,10 @@
#ifndef GUARD_TEXT_UTIL_H
#define GUARD_TEXT_UTIL_H
void sub_80922B4(u8 *buffer, const u8 *string, s32 size);
u32 sub_80922E4(u32 r0);
void StrncpyCustom(u8 *buffer, const u8 *string, s32 n); // Regular strncpy, but it calls GetCharId for each char
void CopyStringtoBuffer(u8 *buffer, const u8 *string);
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
const char *GetUnformattedTypeString(u8 type);
const char * GetFormattedTypeString(u8 type);
u8 IsTypePhysical(u8 index);
u8 sub_8092364(u8 index);
void CopyAbilityNametoBuffer(char *buffer, u8 index);
const u8 *GetAbilityDescription(u8 index);
u32 ReturnIntFromChar2(u8);
s32 ReturnIntFromChar(u8 c);
u32 GetCharId(u8);
#endif

View File

@ -312,6 +312,8 @@ SECTIONS {
src/items.o(.text);
src/rescue_team_info.o(.text);
src/text_util.o(.text);
src/pokemon_types.o(.text);
src/pokemon_abilities.o(.text);
src/friend_area.o(.text);
src/moves.o(.text);
src/number_util.o(.text);
@ -678,6 +680,10 @@ SECTIONS {
src/pokemon_summary_window.o(.rodata);
src/dungeon_info.o(.rodata);
src/items.o(.rodata);
src/rescue_team_info.o(.rodata);
src/text_util.o(.rodata);
src/pokemon_types.o(.rodata);
src/pokemon_abilities.o(.rodata);
data/data_81076E4.o(.rodata);
src/game_options.o(.rodata);
src/random_mersenne_twister.o(.rodata);
@ -689,9 +695,7 @@ SECTIONS {
data/data_8109D10.o(.rodata);
src/dungeon_data.o(.rodata);
src/exclusive_pokemon.o(.rodata);
src/rescue_team_info.o(.rodata);
src/strings.o(.rodata);
src/text_util.o(.rodata);
data/data_810AE24_2.o(.rodata);
src/position_util.o(.rodata);
data/data_8115EB8.o(.rodata);

View File

@ -103,9 +103,9 @@ static void sub_8016110(void)
case CONFIRM_NAME_MENU_PROMPT:
BuildConfirmNameMenu();
if (sUnknown_203B200->unk4 == 1)
sub_80922B4(gFormatBuffer_Monsters[0], sUnknown_203B200->pokeName, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Monsters[0], sUnknown_203B200->pokeName, POKEMON_NAME_LENGTH);
else
sub_80922B4(gFormatBuffer_Monsters[0], sUnknown_203B200->pokeName, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Monsters[0], sUnknown_203B200->pokeName, POKEMON_NAME_LENGTH);
CreateMenuDialogueBoxAndPortrait(sIsNameOKPrompt, 0, 3, sUnknown_203B200->menus, 0, 4, 0, NULL, 32);
break;

View File

@ -276,7 +276,7 @@ void sub_801F214(void)
}
}
extern void sub_80922B4(u8 *buffer, u8 *string, s32 size);
extern void StrncpyCustom(u8 *buffer, u8 *string, s32 size);
void sub_801F280(bool8 param_1)
{
@ -285,7 +285,7 @@ void sub_801F280(bool8 param_1)
CallPrepareTextbox_8008C54(gUnknown_203B270->unk50);
sub_80073B8(gUnknown_203B270->unk50);
sub_80922B4(buffer,gUnknown_203B270->pokeStruct->name,POKEMON_NAME_LENGTH);
StrncpyCustom(buffer,gUnknown_203B270->pokeStruct->name,POKEMON_NAME_LENGTH);
strcpy(gFormatBuffer_Monsters[0],buffer);
PrintFormattedStringOnWindow(0xc,0,gUnknown_80DC28C,gUnknown_203B270->unk50,0); // Move: {COLOR_1 YELLOW}{ARG_POKEMON_0){END_COLOR_TEXT_1}

View File

@ -65,8 +65,8 @@ void sub_8094558(u32 param_1,u8 *param_2,UnkDungeonGlobal_unk1CE98_sub *param_3)
PrintYellowDungeonNametoBuffer(gFormatBuffer_Monsters[0], &param_3->dungeonLocation);
PrintFormattedStringOnWindow(4,0x10,gUnknown_8113850,param_1,0); // #+Place: $m0
y = 0x1A;
sub_80922B4(gFormatBuffer_Monsters[0], param_3->buffer1, POKEMON_NAME_LENGTH);
sub_80922B4(gFormatBuffer_Monsters[1], param_3->buffer2, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Monsters[0], param_3->buffer1, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Monsters[1], param_3->buffer2, POKEMON_NAME_LENGTH);
if (sub_8094528(param_3->moveID) != 0) {
// $m1 was defeated by
FormatString(gText_Pokemon1WasDefeatedBy,buffer, buffer + sizeof(buffer),0);

View File

@ -2,7 +2,7 @@
#include "constants/ability.h"
#include "structs/str_dungeon.h"
#include "dungeon_logic.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "dungeon_message.h"
#include "string_format.h"
#include "type_effectiveness.h"

View File

@ -34,7 +34,7 @@
#include "dungeon_config.h"
#include "game_options.h"
#include "weather.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "dungeon_random.h"
#include "position_util.h"
#include "dungeon_ai_movement.h"
@ -1233,7 +1233,7 @@ void sub_806A120(Entity * pokemon, Entity * target, Move* move)
if ((((EntityIsValid(pokemon)) && (EntityIsValid(target))) && (pokemon != target))
&& (entityInfo = GetEntInfo(target), entityInfo->reflectClassStatus.status == STATUS_CONVERSION2)) {
moveType = GetMoveTypeForMonster(pokemon, move);
uVar2_u32 = sub_8092364(moveType);
uVar2_u32 = GetBestResistingType(moveType);
if (uVar2_u32 != TYPE_NONE) {
entityInfo->types[0] = uVar2_u32;
entityInfo->types[1] = 0;

View File

@ -38,7 +38,7 @@
#include "move_orb_actions_4.h"
#include "weather.h"
#include "targeting_flags.h"
#include "text_util.h"
#include "pokemon_types.h"
extern void sub_80429C8(Entity *r0);
extern bool8 sub_8045888(Entity *r0);

View File

@ -291,7 +291,7 @@ void FriendList_ShowWindow(void)
;
}
sub_80922B4(nameTxtBuff, pokePtr->name, POKEMON_NAME_LENGTH);
StrncpyCustom(nameTxtBuff, pokePtr->name, POKEMON_NAME_LENGTH);
sub_808D930(txtBuff3, pokePtr->speciesNum);
sprintfStatic(winTxtBuff, _("{color}%c%s{reset}"), color, nameTxtBuff);
PrintStringOnWindow(8, GetMenuEntryYCoord(&sFriendList->unk358.s0.input, i), winTxtBuff, sFriendList->unk358.s0.winId, '\0');
@ -470,7 +470,7 @@ UNUSED static PokemonStruct1 *sub_80243E8(void)
u8 nameBuffer[20];
PokemonStruct1 *pokeStruct = &gRecruitedPokemonRef->pokemon[sFriendList->unk1A[(sFriendList->unk358.s0.input.unk1E * sFriendList->unk358.s0.input.unk1C) + sFriendList->unk358.s0.input.menuIndex]];
sub_80922B4(nameBuffer, pokeStruct->name, POKEMON_NAME_LENGTH);
StrncpyCustom(nameBuffer, pokeStruct->name, POKEMON_NAME_LENGTH);
sprintfStatic(buffer, "%s", nameBuffer);
return pokeStruct;
}

View File

@ -1212,7 +1212,7 @@ void sub_8032828(void)
CreateMenuDialogueBoxAndPortrait(&gUnknown_80E2D7C[0], 0, 6, gUnknown_80E2290, NULL, 4, 0, NULL, 0x101);
break;
case 0x59:
sub_80922B4(buffer, GetPlayerPokemonStruct()->name, POKEMON_NAME_LENGTH);
StrncpyCustom(buffer, GetPlayerPokemonStruct()->name, POKEMON_NAME_LENGTH);
sprintfStatic(gUnknown_203B33C->unk424, gUnknown_80E32C4, buffer);
CreateDialogueBoxAndPortrait(gUnknown_203B33C->unk424, 0, 0, 0x101);
break;

View File

@ -1380,7 +1380,7 @@ void sub_80A8EC0(u8 *buffer,s32 a1)
sub_80A7DDC(&sp, &species);
monStruct = sub_80A8D54(sp);
if (monStruct != NULL) {
sub_80922B4(buffer, monStruct->name, POKEMON_NAME_LENGTH);
StrncpyCustom(buffer, monStruct->name, POKEMON_NAME_LENGTH);
}
else if (sp == 32) {
CopyMonsterNameToBuffer(buffer, species);

View File

@ -3280,7 +3280,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
{
ptr->name[index] = gUnknown_2039D98[index];
}
sub_80922B4(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
IncrementAdventureNumJoined();
return 0;
}
@ -3338,7 +3338,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
{
pokemon->name[index] = gUnknown_2039D98[index];
}
sub_80922B4(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Names[r2], gUnknown_2039D98, POKEMON_NAME_LENGTH);
IncrementAdventureNumJoined();
return 0;

View File

@ -12,7 +12,7 @@
#include "string_format.h"
#include "text_1.h"
#include "text_2.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "strings.h"
#include "dungeon_info.h"

View File

@ -300,9 +300,9 @@ void DrawLoadScreenText(void)
// Draw Player Name
playerInfo = GetPlayerPokemonStruct();
if (playerInfo == NULL)
sub_80922B4(playerName, gNoNamePlaceholder, POKEMON_NAME_LENGTH);
StrncpyCustom(playerName, gNoNamePlaceholder, POKEMON_NAME_LENGTH);
else
sub_80922B4(playerName, playerInfo->name, POKEMON_NAME_LENGTH);
StrncpyCustom(playerName, playerInfo->name, POKEMON_NAME_LENGTH);
sprintfStatic(gLoadScreen->formattedPlayerName,gUnknown_80E7804,playerName);
PrintStringOnWindow(64,12,gLoadScreen->formattedPlayerName,0,0);
@ -358,7 +358,7 @@ void DrawLoadScreenText(void)
temp2 = gUnknown_203B484;
if(temp2->unk4.speciesNum != MONSTER_NONE) {
sub_808D930(speciesHelper,temp2->unk4.speciesNum);
sub_80922B4(nameHelper,temp2->unk4.name,POKEMON_NAME_LENGTH);
StrncpyCustom(nameHelper,temp2->unk4.name,POKEMON_NAME_LENGTH);
sprintfStatic(gLoadScreen->formattedHelperInfo,gHelperInfoPlaceholder,nameHelper,speciesHelper); // %s (%s)
}
else

View File

@ -196,7 +196,7 @@ void sub_8012BC4(u32 x, u32 y, s32 n, s32 len, u32 color, u32 windowId)
do {
iVar1 = *piVar4;
piVar4++;
chr = ReturnIntFromChar2(iVar1 + 0x30);
chr = GetCharId(iVar1 + 0x30);
iVar3 = GetCharacter(chr);
total_x += iVar3->width;
DrawCharOnWindow(x - total_x, y, chr, color, windowId);
@ -210,7 +210,7 @@ void sub_8012BC4(u32 x, u32 y, s32 n, s32 len, u32 color, u32 windowId)
void DrawCharOnWindowWidth12(u32 x, u32 y, u32 chr, u32 color, u32 windowId)
{
u32 add_x;
u32 chrId = ReturnIntFromChar2(chr);
u32 chrId = GetCharId(chr);
const unkChar *chrInfo = GetCharacter(chrId);
if (chrInfo->width < 12)

View File

@ -36,7 +36,7 @@
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "trap.h"
#include "weather.h"

View File

@ -10,7 +10,7 @@
#include "string_format.h"
#include "text_1.h"
#include "text_2.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "strings.h"
static EWRAM_DATA OpenedFile *sWazaParametersFile = { NULL }; // NDS=213C188

View File

@ -866,7 +866,7 @@ static void UpdateLetterWidths(void)
sNamingScreen->letterWidths[i] = 8;
return;
}
chrId = ReturnIntFromChar2(sNamingScreen->textPtr[i]);
chrId = GetCharId(sNamingScreen->textPtr[i]);
chrInfo = GetCharacter(chrId);
sNamingScreen->letterWidths[i] = chrInfo->width;
total += chrInfo->width;
@ -879,7 +879,7 @@ s32 GetStrWidth(u8 *buffer, s32 size)
s32 width = 0;
for (i = 0; i < size && buffer[i] != '\0'; i++) {
width += GetCharacter(ReturnIntFromChar2(buffer[i]))->width;
width += GetCharacter(GetCharId(buffer[i]))->width;
}
return width;

View File

@ -780,7 +780,7 @@ void sub_8026E08(u32 r0)
CallPrepareTextbox_8008C54(r0);
sub_80073B8(r0);
sub_80922B4(gFormatBuffer_Monsters[0], sUnknown_203B2B8->pokeStruct->name, POKEMON_NAME_LENGTH);
StrncpyCustom(gFormatBuffer_Monsters[0], sUnknown_203B2B8->pokeStruct->name, POKEMON_NAME_LENGTH);
sub_808D930(buffer, sUnknown_203B2B8->pokeStruct->speciesNum);
sprintfStatic(buffer1, sUnknown_80DD6E0, gFormatBuffer_Monsters[0]);
x = sub_8008ED0(buffer1);

View File

@ -39,7 +39,6 @@ extern s16 gBlastBurnIQReq; // 0x14d
extern s16 gVoltTackleIQReq; // 0x14d
extern char* gFormattedStatusNames[];
extern u32 ReturnIntFromChar(u8 r0);
extern void xxx_pokemon2_to_pokemonstruct_808DF44(PokemonStruct1*, PokemonStruct2*);
// arm9.bin::0205C34C
@ -675,7 +674,7 @@ void PrintColoredPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon, s32 color
{
u8 nameBuffer [20];
sub_80922B4(nameBuffer, pokemon->name, POKEMON_NAME_LENGTH);
StrncpyCustom(nameBuffer, pokemon->name, POKEMON_NAME_LENGTH);
if (colorNum == COLOR_WHITE) {
colorNum = COLOR_CYAN;
}
@ -686,7 +685,7 @@ void sub_808D9DC(u8 *buffer, PokemonStruct2 *param_2, s32 colorNum)
{
u8 nameBuffer [20];
sub_80922B4(nameBuffer, param_2->name, POKEMON_NAME_LENGTH);
StrncpyCustom(nameBuffer, param_2->name, POKEMON_NAME_LENGTH);
if (colorNum == COLOR_WHITE) {
colorNum = COLOR_YELLOW;
}
@ -697,13 +696,13 @@ void sub_808DA0C(u8 *buffer, PokemonStruct2 *param_2)
{
u8 nameBuffer [20];
sub_80922B4(nameBuffer, param_2->name, POKEMON_NAME_LENGTH);
StrncpyCustom(nameBuffer, param_2->name, POKEMON_NAME_LENGTH);
sprintfStatic(buffer,"%s",nameBuffer);
}
void PrintPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon)
{
sub_80922B4(buffer, pokemon->name, POKEMON_NAME_LENGTH);
StrncpyCustom(buffer, pokemon->name, POKEMON_NAME_LENGTH);
}
static const u8 gUnknown_8107645[12] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

15
src/pokemon_abilities.c Normal file
View File

@ -0,0 +1,15 @@
#include "global.h"
#include "globaldata.h"
#include "pokemon_abilities.h"
#include "strings.h"
// Unused
void CopyAbilityNametoBuffer(char *buffer, u8 index)
{
strncpy(buffer, gAbilityNames[index], 0x50);
}
const u8 *GetAbilityDescription(u8 index)
{
return gAbilityDescriptions[index];
}

View File

@ -103,7 +103,7 @@ void CreateRescueTitle(unkStruct_802C39C *param_1)
if (param_1->playerName == NULL)
PrintStringOnWindow(178 - GetMaxPokeNameWidth(), param_1->y, GetMonSpecies(param_1->clientSpecies), param_1->unk0[0], 0);
else {
sub_80922B4(buf_2, param_1->playerName, POKEMON_NAME_LENGTH);
StrncpyCustom(buf_2, param_1->playerName, POKEMON_NAME_LENGTH);
PrintStringOnWindow(178 - GetMaxPokeNameWidth(), param_1->y, buf_2, param_1->unk0[0], 0);
}
}
@ -266,7 +266,7 @@ void CreateRescueDescription(unkStruct_802C39C *param_1)
if (param_1->playerName == NULL)
PrintStringOnWindow(68, y, GetMonSpecies(param_1->clientSpecies), param_1->unk0[0], 0);
else {
sub_80922B4(buf_3, param_1->playerName, POKEMON_NAME_LENGTH);
StrncpyCustom(buf_3, param_1->playerName, POKEMON_NAME_LENGTH);
sub_808D930(buf_4, param_1->clientSpecies);
sprintfStatic(buf_2, gUnknown_80E8AD0, buf_3, buf_4);
PrintStringOnWindow(68, y, buf_2, param_1->unk0[0], 0);

View File

@ -7,7 +7,8 @@
#include "pokemon_evolution.h"
#include "text_1.h"
#include "items.h"
#include "text_util.h"
#include "pokemon_types.h"
#include "pokemon_abilities.h"
#include "friend_area.h"
#include "dungeon_info.h"
#include "dungeon_data.h"

26
src/pokemon_types.c Normal file
View File

@ -0,0 +1,26 @@
#include "global.h"
#include "globaldata.h"
#include "pokemon_types.h"
#include "strings.h"
#include "dungeon_data.h"
// arm9.bin::02061508
const char *GetUnformattedTypeString(u8 type)
{
return gUnformattedTypeStrings[type];
}
const char * GetFormattedTypeString(u8 type)
{
return gFormattedTypeStrings[type];
}
u8 IsTypePhysical(u8 index)
{
return gIsTypePhysicalTable[index];
}
u8 GetBestResistingType(u8 index)
{
return gBestResistTypeTable[index];
}

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "rescue_team_info.h"
#include "code_8092334.h"
#include "text_util.h"
@ -10,8 +11,16 @@ EWRAM_DATA struct RescueTeamData gRescueTeamInfo = {0};
extern void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
extern const u8 *gRescueTeamRanks[];
extern s32 gRescueRankMaxPoints[MAX_TEAM_RANKS];
extern u8 gTeamNamePlaceholder[0x8]; // Pokemon
static const s32 sRescueRankMaxPoints[MAX_TEAM_RANKS] = {
[NORMAL_RANK] = 50,
[BRONZE_RANK] = 500,
[SILVER_RANK] = 1500,
[GOLD_RANK] = 3000,
[PLATINUM_RANK] = 7500,
[DIAMOND_RANK] = 15000,
[LUCARIO_RANK] = 100000000,
};
void LoadRescueTeamInfo(void)
{
@ -25,7 +34,7 @@ struct RescueTeamData *GetRescueTeamInfo(void)
void InitializeRescueTeamInfo(void)
{
BoundedCopyStringtoBuffer(gRescueTeamInfoRef->teamName, gTeamNamePlaceholder, TEAM_NAME_LENGTH);
BoundedCopyStringtoBuffer(gRescueTeamInfoRef->teamName, _("Pokémon"), TEAM_NAME_LENGTH);
gRescueTeamInfoRef->teamRankPts = 0;
gRescueTeamInfoRef->isTeamRenamed = FALSE;
}
@ -41,7 +50,7 @@ void sub_80920B8(u8 *buffer)
void sub_80920D8(u8 *buffer)
{
sub_80922B4(buffer, gRescueTeamInfoRef->teamName, TEAM_NAME_LENGTH);
StrncpyCustom(buffer, gRescueTeamInfoRef->teamName, TEAM_NAME_LENGTH);
}
void SetRescueTeamName(u8 *buffer)
@ -68,7 +77,7 @@ s32 GetPtsToNextRank(void)
}
else
{
return (gRescueRankMaxPoints[teamRank] - gRescueTeamInfoRef->teamRankPts);
return (sRescueRankMaxPoints[teamRank] - gRescueTeamInfoRef->teamRankPts);
}
}
@ -91,7 +100,7 @@ u8 GetRescueTeamRank(void)
s32 rank;
for(rank = NORMAL_RANK; rank < MAX_TEAM_RANKS; rank++){
if (gRescueTeamInfoRef->teamRankPts < gRescueRankMaxPoints[rank]) {
if (gRescueTeamInfoRef->teamRankPts < sRescueRankMaxPoints[rank]) {
return rank;
}
}

View File

@ -202,7 +202,7 @@ const u8 *const gAbilityNames[NUM_ABILITIES] = {
[ABILITY_SHIELD_DUST] = _("Shield Dust"),
};
const u8 *const AbilityDescriptions[NUM_ABILITIES] = {
const u8 *const gAbilityDescriptions[NUM_ABILITIES] = {
[ABILITY_UNKNOWN] = _("{color RED}-------"),
[ABILITY_STENCH] = _("{color RED}Stench{reset}: May terrify an\nattacking foe."),
[ABILITY_THICK_FAT] = _("{color RED}Thick Fat{reset}: Resistant to\nFire- and Ice-type moves."),

View File

@ -1,99 +1,78 @@
#include "global.h"
#include "globaldata.h"
#include "text_util.h"
#include "strings.h"
#include "dungeon_data.h"
extern u32 gUnknown_810983C[26]; // TODO: verify size later
u32 ReturnIntFromChar(u8 r0)
// Not sure what the deal is with these two funcs. GetCharId is mostly used alongside GetCharacter function, which gets char info, such as width, etc.
s32 ReturnIntFromChar(u8 c)
{
return r0;
return c;
}
// arm9.bin::020614D0
u32 ReturnIntFromChar2(u8 r0)
u32 GetCharId(u8 c)
{
return r0;
return c;
}
UNUSED static void sub_8092290(u8 *buffer, u8 *string)
{
while( *string != '\0' ) {
*buffer++ = ReturnIntFromChar2(*string++);
}
*buffer = 0; // append a 0
while( *string != '\0' ) {
*buffer++ = GetCharId(*string++);
}
*buffer = '\0'; // append terminating char
}
void sub_80922B4(u8 *buffer, const u8 *string, s32 size)
void StrncpyCustom(u8 *buffer, const u8 *string, s32 n)
{
while(1)
{
if(size-- < 1 || *string == '\0')
{
while(1) {
if (n-- <= 0 || *string == '\0') {
break;
}
*buffer++ = ReturnIntFromChar2(*string++);
*buffer++ = GetCharId(*string++);
}
*buffer = 0; // append a 0
*buffer = '\0'; // append terminating char
}
u32 sub_80922E4(u32 r0)
// Inverted font block - maybe used in international/Japanese games?
static const u8 *const sInvertedFontDigits[] = {
_(""),
_(""),
_(""),
_(""),
_(""),
_(""),
_(""),
_(""),
_(""),
_(""),
};
UNUSED static const u8 *GetDigitInvertedFontStr(u32 digit)
{
return gUnknown_810983C[r0];
return sInvertedFontDigits[digit];
}
void CopyStringtoBuffer(u8 *buffer, const u8 *string)
{
while( *string != '\0' ) {
*buffer++ = *string++;
}
*buffer = 0; // append a 0
while( *string != '\0' ) {
*buffer++ = *string++;
}
*buffer = '\0'; // append a terminating char
}
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size)
{
while( 1 ) {
if (size-- < 1) {
break;
while( 1 ) {
if (size-- < 1) {
break;
}
if (*string == '\0') {
*buffer = '\0'; // append a terminating char and break
break;
}
// NOTE: *buffer++ = *string++ cases register flip
*buffer = *string;
buffer++;
string++;
}
if (*string == '\0') {
*buffer = 0; // append a 0 and break
break;
}
// NOTE: *buffer++ = *string++ cases register flip
*buffer = *string;
buffer++;
string++;
}
}
// arm9.bin::02061508
const char *GetUnformattedTypeString(u8 type)
{
return gUnformattedTypeStrings[type];
}
const char * GetFormattedTypeString(u8 type)
{
return gFormattedTypeStrings[type];
}
u8 IsTypePhysical(u8 index)
{
return gIsTypePhysicalTable[index];
}
u8 sub_8092364(u8 index)
{
return gBestResistTypeTable[index];
}
void CopyAbilityNametoBuffer(char *buffer, u8 index)
{
strncpy(buffer, gAbilityNames[index], 0x50);
}
const u8 *GetAbilityDescription(u8 index)
{
return AbilityDescriptions[index];
}

View File

@ -1246,7 +1246,7 @@ void UpdateThankYouMailText(void)
switch(sUnknown_203B2C4->state) {
case 5:
pokeStruct = GetPlayerPokemonStruct();
sub_80922B4(buffer1,pokeStruct->name, POKEMON_NAME_LENGTH);
StrncpyCustom(buffer1,pokeStruct->name, POKEMON_NAME_LENGTH);
sprintfStatic(sUnknown_203B2C4->formattedString,gUnknown_80DF250,buffer1);
CreateDialogueBoxAndPortrait(sUnknown_203B2C4->formattedString,0,&sUnknown_203B2C4->monPortrait,0x10d);
break;
@ -1404,7 +1404,7 @@ void UpdateThankYouMailText(void)
break;
case THANK_YOU_MAIL_COMMS_CLEANUP:
pokeStruct2 = GetPlayerPokemonStruct();
sub_80922B4(buffer2, pokeStruct2->name, POKEMON_NAME_LENGTH);
StrncpyCustom(buffer2, pokeStruct2->name, POKEMON_NAME_LENGTH);
sprintfStatic(sUnknown_203B2C4->formattedString,gUnknown_80DF63C,buffer2);
CreateDialogueBoxAndPortrait(sUnknown_203B2C4->formattedString,0,&sUnknown_203B2C4->monPortrait,0x10d);
break;