mirror of
https://github.com/pret/pokefirered.git
synced 2026-05-09 04:23:14 -05:00
cleanup
This commit is contained in:
parent
c06c944440
commit
f2c127eb57
|
|
@ -20,6 +20,6 @@ void Apprentice_ScriptContext_Enable(void);
|
|||
void ResetApprenticeStruct(struct Apprentice *apprentice);
|
||||
void ResetAllApprenticeData(void);
|
||||
void CallApprenticeFunction(void);
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, u8 language);
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, enum Language language);
|
||||
|
||||
#endif // GUARD_APPRENTICE_H
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
// IDE support
|
||||
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__INTELLISENSE__)
|
||||
// We define these when using certain IDEs to fool preproc
|
||||
#define _(x) {x}
|
||||
#define __(x) {x}
|
||||
#define _(x) {0}
|
||||
#define __(x) {0}
|
||||
#define INCBIN(...) {0}
|
||||
#define INCBIN_U8 INCBIN
|
||||
#define INCBIN_U16 INCBIN
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GUARD_STRING_UTIL_H
|
||||
#define GUARD_STRING_UTIL_H
|
||||
|
||||
#include "constants/global.h"
|
||||
|
||||
enum StringConvertMode
|
||||
{
|
||||
STR_CONV_MODE_LEFT_ALIGN,
|
||||
|
|
@ -40,11 +42,11 @@ u8 *StringCopyPadded(u8 *dest, const u8 *src, u8 c, u16 n);
|
|||
u8 *StringFillWithTerminator(u8 *dest, u16 n);
|
||||
u8 *StringCopyN_Multibyte(u8 *dest, const u8 *src, u32 n);
|
||||
u32 StringLength_Multibyte(const u8 *str);
|
||||
u8 *WriteColorChangeControlCode(u8 *dest, u32 colorType, u8 color);
|
||||
u8 *WriteColorChangeControlCode(u8 *dest, enum TextColorType colorType, u8 color);
|
||||
bool32 IsStringJapanese(u8 *str);
|
||||
u8 GetExtCtrlCodeLength(u8 code);
|
||||
s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2);
|
||||
void ConvertInternationalString(u8 *s, u8 language);
|
||||
void ConvertInternationalString(u8 *s, enum Language language);
|
||||
void StripExtCtrlCodes(u8 *str);
|
||||
bool32 DoesStringProperlyTerminate(const u8 *str, u32 last);
|
||||
|
||||
|
|
|
|||
|
|
@ -928,7 +928,7 @@ extern const u8 gDaycareText_GetAlongVeryWell[];
|
|||
extern const u8 gDaycareText_GetAlong[];
|
||||
extern const u8 gDaycareText_DontLikeOther[];
|
||||
extern const u8 gDaycareText_PlayOther[];
|
||||
extern const u8 gExpandedPlaceholder_Empty[];
|
||||
extern const u8 gText_EmptyString[];
|
||||
extern const u8 gText_HatchedFromEgg[];
|
||||
extern const u8 gText_NickHatchPrompt[];
|
||||
|
||||
|
|
|
|||
|
|
@ -1237,7 +1237,7 @@ static void GetShouldApprenticeLeave(void)
|
|||
gSpecialVar_0x8004 = TRUE;
|
||||
}
|
||||
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, u8 language)
|
||||
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, enum Language language)
|
||||
{
|
||||
const struct ApprenticeTrainer *apprentice = &gApprentices[apprenticeId];
|
||||
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ static const struct WindowTemplate sDaycareLevelMenuWindowTemplate =
|
|||
|
||||
static const struct ListMenuItem sLevelMenuItems[] =
|
||||
{
|
||||
{gExpandedPlaceholder_Empty, 0},
|
||||
{gExpandedPlaceholder_Empty, 1},
|
||||
{gText_EmptyString, 0},
|
||||
{gText_EmptyString, 1},
|
||||
{gOtherText_Exit, DAYCARE_LEVEL_MENU_EXIT}
|
||||
};
|
||||
|
||||
|
|
@ -1354,7 +1354,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation)
|
|||
{
|
||||
u8 metLevel;
|
||||
enum PokeBall ball;
|
||||
u8 language;
|
||||
enum Language language;
|
||||
u8 metLocation;
|
||||
u8 isEgg;
|
||||
|
||||
|
|
|
|||
|
|
@ -1917,7 +1917,7 @@ static void DrawTextEntry(void)
|
|||
for (i = 0; i < maxChars; i++)
|
||||
{
|
||||
temp[0] = sNamingScreen->textBuffer[i];
|
||||
temp[1] = gExpandedPlaceholder_Empty[0];
|
||||
temp[1] = gText_EmptyString[0];
|
||||
extraWidth = (IsWideLetter(temp[0]) == TRUE) ? 2 : 0;
|
||||
|
||||
AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY], FONT_NORMAL, temp, i * 8 + xpos + extraWidth, 1, TEXT_SKIP_DRAW, NULL);
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ static const s32 sPowersOfTen[] =
|
|||
1000000000,
|
||||
};
|
||||
|
||||
extern const u8 gExpandedPlaceholder_Empty[];
|
||||
extern u8 gExpandedPlaceholder_Kun[];
|
||||
extern u8 gExpandedPlaceholder_Chan[];
|
||||
extern u8 gExpandedPlaceholder_Sapphire[];
|
||||
extern u8 gExpandedPlaceholder_Ruby[];
|
||||
extern u8 gExpandedPlaceholder_Aqua[];
|
||||
|
|
@ -380,40 +377,37 @@ u8 *StringBraille(u8 *dest, const u8 *src)
|
|||
}
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_UnknownStringVar(void)
|
||||
static const u8 *ExpandPlaceholder_UnknownStringVar(void)
|
||||
{
|
||||
return gUnknownStringVar;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_PlayerName(void)
|
||||
static const u8 *ExpandPlaceholder_PlayerName(void)
|
||||
{
|
||||
return gSaveBlock2Ptr->playerName;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_StringVar1(void)
|
||||
static const u8 *ExpandPlaceholder_StringVar1(void)
|
||||
{
|
||||
return gStringVar1;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_StringVar2(void)
|
||||
static const u8 *ExpandPlaceholder_StringVar2(void)
|
||||
{
|
||||
return gStringVar2;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_StringVar3(void)
|
||||
static const u8 *ExpandPlaceholder_StringVar3(void)
|
||||
{
|
||||
return gStringVar3;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_KunChan(void)
|
||||
static const u8 *ExpandPlaceholder_KunChan(void)
|
||||
{
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
return gExpandedPlaceholder_Kun;
|
||||
else
|
||||
return gExpandedPlaceholder_Chan;
|
||||
return gText_EmptyString;
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_RivalName(void)
|
||||
static const u8 *ExpandPlaceholder_RivalName(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->rivalName[0] == EOS)
|
||||
{
|
||||
|
|
@ -428,7 +422,7 @@ static u8 *ExpandPlaceholder_RivalName(void)
|
|||
}
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Version(void)
|
||||
static const u8 *ExpandPlaceholder_Version(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Ruby;
|
||||
|
|
@ -437,7 +431,7 @@ static u8 *ExpandPlaceholder_Version(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Magma(void)
|
||||
static const u8 *ExpandPlaceholder_Magma(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Magma;
|
||||
|
|
@ -446,7 +440,7 @@ static u8 *ExpandPlaceholder_Magma(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Aqua(void)
|
||||
static const u8 *ExpandPlaceholder_Aqua(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Aqua;
|
||||
|
|
@ -455,7 +449,7 @@ static u8 *ExpandPlaceholder_Aqua(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Maxie(void)
|
||||
static const u8 *ExpandPlaceholder_Maxie(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Maxie;
|
||||
|
|
@ -464,7 +458,7 @@ static u8 *ExpandPlaceholder_Maxie(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Archie(void)
|
||||
static const u8 *ExpandPlaceholder_Archie(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Archie;
|
||||
|
|
@ -473,7 +467,7 @@ static u8 *ExpandPlaceholder_Archie(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Groudon(void)
|
||||
static const u8 *ExpandPlaceholder_Groudon(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Groudon;
|
||||
|
|
@ -482,7 +476,7 @@ static u8 *ExpandPlaceholder_Groudon(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static u8 *ExpandPlaceholder_Kyogre(void)
|
||||
static const u8 *ExpandPlaceholder_Kyogre(void)
|
||||
{
|
||||
#if defined(FIRERED)
|
||||
return gExpandedPlaceholder_Kyogre;
|
||||
|
|
@ -493,7 +487,7 @@ static u8 *ExpandPlaceholder_Kyogre(void)
|
|||
|
||||
const u8 *GetExpandedPlaceholder(u32 id)
|
||||
{
|
||||
typedef u8 *(*ExpandPlaceholderFunc)(void);
|
||||
typedef const u8 *(*ExpandPlaceholderFunc)(void);
|
||||
|
||||
static const ExpandPlaceholderFunc funcs[] =
|
||||
{
|
||||
|
|
@ -514,7 +508,7 @@ const u8 *GetExpandedPlaceholder(u32 id)
|
|||
};
|
||||
|
||||
if (id >= ARRAY_COUNT(funcs))
|
||||
return gExpandedPlaceholder_Empty;
|
||||
return gText_EmptyString;
|
||||
else
|
||||
return funcs[id]();
|
||||
}
|
||||
|
|
@ -570,7 +564,7 @@ u8 *StringCopyN_Multibyte(u8 *dest, const u8 *src, u32 n)
|
|||
else
|
||||
{
|
||||
*dest++ = *src++;
|
||||
if (*(src - 1) == 0xF9)
|
||||
if (*(src - 1) == CHAR_EXTRA_SYMBOL)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
}
|
||||
|
|
@ -585,7 +579,7 @@ u32 StringLength_Multibyte(const u8 *str)
|
|||
|
||||
while (*str != EOS)
|
||||
{
|
||||
if (*str == 0xF9)
|
||||
if (*str == CHAR_EXTRA_SYMBOL)
|
||||
str++;
|
||||
str++;
|
||||
length++;
|
||||
|
|
@ -594,23 +588,31 @@ u32 StringLength_Multibyte(const u8 *str)
|
|||
return length;
|
||||
}
|
||||
|
||||
u8 *WriteColorChangeControlCode(u8 *dest, u32 colorType, u8 color)
|
||||
u8 *WriteColorChangeControlCode(u8 *dest, enum TextColorType colorType, u8 color)
|
||||
{
|
||||
*dest = 0xFC;
|
||||
*dest = EXT_CTRL_CODE_BEGIN;
|
||||
dest++;
|
||||
|
||||
switch (colorType)
|
||||
{
|
||||
case 0:
|
||||
*dest = 1;
|
||||
case TEXT_COLOR_TYPE_FOREGROUND:
|
||||
*dest = EXT_CTRL_CODE_COLOR;
|
||||
dest++;
|
||||
break;
|
||||
case 1:
|
||||
*dest = 3;
|
||||
case TEXT_COLOR_TYPE_SHADOW:
|
||||
*dest = EXT_CTRL_CODE_SHADOW;
|
||||
dest++;
|
||||
break;
|
||||
case 2:
|
||||
*dest = 2;
|
||||
case TEXT_COLOR_TYPE_HIGHLIGHT:
|
||||
*dest = EXT_CTRL_CODE_HIGHLIGHT;
|
||||
dest++;
|
||||
break;
|
||||
case TEXT_COLOR_TYPE_ACCENT:
|
||||
*dest = EXT_CTRL_CODE_ACCENT;
|
||||
dest++;
|
||||
break;
|
||||
case TEXT_COLOR_TYPE_BACKGROUND:
|
||||
*dest = EXT_CTRL_CODE_BACKGROUND;
|
||||
dest++;
|
||||
break;
|
||||
}
|
||||
|
|
@ -676,7 +678,7 @@ u8 GetExtCtrlCodeLength(u8 code)
|
|||
|
||||
static const u8 *SkipExtCtrlCode(const u8 *s)
|
||||
{
|
||||
while (*s == 0xFC)
|
||||
while (*s == EXT_CTRL_CODE_BEGIN)
|
||||
{
|
||||
s++;
|
||||
s += GetExtCtrlCodeLength(*s);
|
||||
|
|
@ -700,11 +702,11 @@ s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2)
|
|||
if (*str1 < *str2)
|
||||
{
|
||||
retVal = -1;
|
||||
if (*str2 == 0xFF)
|
||||
if (*str2 == EOS)
|
||||
retVal = 1;
|
||||
}
|
||||
|
||||
if (*str1 == 0xFF)
|
||||
if (*str1 == EOS)
|
||||
return retVal;
|
||||
|
||||
str1++;
|
||||
|
|
@ -713,13 +715,13 @@ s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2)
|
|||
|
||||
retVal = 1;
|
||||
|
||||
if (*str1 == 0xFF)
|
||||
if (*str1 == EOS)
|
||||
retVal = -1;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void ConvertInternationalString(u8 *s, u8 language)
|
||||
void ConvertInternationalString(u8 *s, enum Language language)
|
||||
{
|
||||
if (language == LANGUAGE_JAPANESE)
|
||||
{
|
||||
|
|
@ -727,9 +729,9 @@ void ConvertInternationalString(u8 *s, u8 language)
|
|||
|
||||
StripExtCtrlCodes(s);
|
||||
i = StringLength(s);
|
||||
s[i++] = 0xFC;
|
||||
s[i++] = 22;
|
||||
s[i++] = 0xFF;
|
||||
s[i++] = EXT_CTRL_CODE_BEGIN;
|
||||
s[i++] = EXT_CTRL_CODE_ENG;
|
||||
s[i++] = EOS;
|
||||
|
||||
i--;
|
||||
|
||||
|
|
@ -739,8 +741,8 @@ void ConvertInternationalString(u8 *s, u8 language)
|
|||
i--;
|
||||
}
|
||||
|
||||
s[0] = 0xFC;
|
||||
s[1] = 21;
|
||||
s[0] = EXT_CTRL_CODE_BEGIN;
|
||||
s[1] = EXT_CTRL_CODE_JPN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -748,9 +750,9 @@ void StripExtCtrlCodes(u8 *str)
|
|||
{
|
||||
u16 srcIndex = 0;
|
||||
u16 destIndex = 0;
|
||||
while (str[srcIndex] != 0xFF)
|
||||
while (str[srcIndex] != EOS)
|
||||
{
|
||||
if (str[srcIndex] == 0xFC)
|
||||
if (str[srcIndex] == EXT_CTRL_CODE_BEGIN)
|
||||
{
|
||||
srcIndex++;
|
||||
srcIndex += GetExtCtrlCodeLength(str[srcIndex]);
|
||||
|
|
@ -760,7 +762,7 @@ void StripExtCtrlCodes(u8 *str)
|
|||
str[destIndex++] = str[srcIndex++];
|
||||
}
|
||||
}
|
||||
str[destIndex] = 0xFF;
|
||||
str[destIndex] = EOS;
|
||||
}
|
||||
|
||||
bool32 DoesStringProperlyTerminate(const u8 *str, u32 last)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
#include "strings.h"
|
||||
#include "constants/item.h"
|
||||
|
||||
const u8 gExpandedPlaceholder_Empty[] = _("");
|
||||
const u8 gExpandedPlaceholder_Kun[] = _("");
|
||||
const u8 gExpandedPlaceholder_Chan[] = _("");
|
||||
const u8 gText_EmptyString[] = _("");
|
||||
|
||||
const u8 gExpandedPlaceholder_Sapphire[] = _("SAPPHIRE");
|
||||
const u8 gExpandedPlaceholder_Ruby[] = _("RUBY");
|
||||
const u8 gExpandedPlaceholder_Aqua[] = _("AQUA");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user