Replaced if directives with conditions, where possible.
This commit is contained in:
parent
90be465a9a
commit
499b4a6d42
14 changed files with 138 additions and 168 deletions
|
@ -26,7 +26,6 @@ static const s32 sPowersOfTen[] =
|
|||
1000000000,
|
||||
};
|
||||
|
||||
#if DECAP_ENABLED
|
||||
// Tries to determine whether `str` is safe to prepend a ctrl char to
|
||||
// gStringVarX are always safe, as well as stack allocated IWRAM
|
||||
// (if `length mod 4` is 1 or 2)
|
||||
|
@ -35,19 +34,18 @@ bool32 IsStringAddrSafe(u8 *str, u32 length) {
|
|||
return (str >= gStackBase && (length & 3) && (length & 3) <= 2);
|
||||
return (str >= gStringVar1 && str < sUnknownStringVar);
|
||||
}
|
||||
#endif
|
||||
|
||||
u8 *StringCopy_Nickname(u8 *dest, const u8 *src)
|
||||
{
|
||||
u32 i;
|
||||
u32 limit = POKEMON_NAME_LENGTH;
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (IsStringAddrSafe(dest, limit) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
else if (*src == CHAR_FIXED_CASE)
|
||||
*dest++ = *src++;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (IsStringAddrSafe(dest, limit) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
else if (*src == CHAR_FIXED_CASE)
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
for (i = 0; i < limit; i++)
|
||||
{
|
||||
|
@ -66,10 +64,10 @@ u8 *StringGet_Nickname(u8 *str)
|
|||
u8 i;
|
||||
u32 limit = POKEMON_NAME_LENGTH;
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (*str == CHAR_FIXED_CASE)
|
||||
str++;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (*str == CHAR_FIXED_CASE)
|
||||
str++;
|
||||
}
|
||||
|
||||
for (i = 0; i < limit; i++)
|
||||
if (str[i] == EOS)
|
||||
|
@ -84,10 +82,10 @@ u8 *StringCopy_PlayerName(u8 *dest, const u8 *src)
|
|||
s32 i;
|
||||
s32 limit = PLAYER_NAME_LENGTH;
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (IsStringAddrSafe(dest, limit) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (IsStringAddrSafe(dest, limit) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
}
|
||||
|
||||
for (i = 0; i < limit; i++)
|
||||
{
|
||||
|
@ -103,11 +101,11 @@ u8 *StringCopy_PlayerName(u8 *dest, const u8 *src)
|
|||
|
||||
u8 *StringCopy(u8 *dest, const u8 *src)
|
||||
{
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
// If `src` is mirrored, prepend fixed-case char
|
||||
if (IsMirrorPtr(src) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING) {
|
||||
// If `src` is mirrored, prepend fixed-case char
|
||||
if (IsMirrorPtr(src) && *src != CHAR_FIXED_CASE)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
}
|
||||
while (*src != EOS)
|
||||
{
|
||||
*dest = *src;
|
||||
|
@ -158,12 +156,12 @@ u16 StringLength(const u8 *str)
|
|||
s32 StringCompare(const u8 *str1, const u8 *str2)
|
||||
{
|
||||
// Ignore leading fixed-case char
|
||||
#if DECAP_ENABLED
|
||||
if (*str1 == CHAR_FIXED_CASE)
|
||||
str1++;
|
||||
if (*str2 == CHAR_FIXED_CASE)
|
||||
str2++;
|
||||
#endif
|
||||
if (DECAP_ENABLED) {
|
||||
if (*str1 == CHAR_FIXED_CASE)
|
||||
str1++;
|
||||
if (*str2 == CHAR_FIXED_CASE)
|
||||
str2++;
|
||||
}
|
||||
while (*str1 == *str2)
|
||||
{
|
||||
if (*str1 == EOS)
|
||||
|
@ -178,12 +176,12 @@ s32 StringCompare(const u8 *str1, const u8 *str2)
|
|||
s32 StringCompareN(const u8 *str1, const u8 *str2, u32 n)
|
||||
{
|
||||
// Ignore leading fixed-case char
|
||||
#if DECAP_ENABLED
|
||||
if (*str1 == CHAR_FIXED_CASE)
|
||||
str1++;
|
||||
if (*str2 == CHAR_FIXED_CASE)
|
||||
str2++;
|
||||
#endif
|
||||
if (DECAP_ENABLED) {
|
||||
if (*str1 == CHAR_FIXED_CASE)
|
||||
str1++;
|
||||
if (*str2 == CHAR_FIXED_CASE)
|
||||
str2++;
|
||||
}
|
||||
while (*str1 == *str2)
|
||||
{
|
||||
if (*str1 == EOS)
|
||||
|
@ -382,9 +380,7 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8
|
|||
|
||||
u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
|
||||
{
|
||||
#if DECAP_ENABLED
|
||||
bool32 fixedCase = FALSE;
|
||||
#endif
|
||||
for (;;)
|
||||
{
|
||||
u8 c = *src++;
|
||||
|
@ -395,17 +391,17 @@ u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
|
|||
{
|
||||
case PLACEHOLDER_BEGIN:
|
||||
placeholderId = *src++;
|
||||
#if DECAP_ENABLED
|
||||
// Handle fixed-case versions of placeholders
|
||||
if (!fixedCase && (placeholderId & PLACEHOLDER_FIXED_MASK || placeholderId == PLACEHOLDER_ID_PLAYER)) {
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
expandedString = GetExpandedPlaceholder(placeholderId & ~PLACEHOLDER_FIXED_MASK);
|
||||
dest = StringExpandPlaceholders(dest, expandedString);
|
||||
*dest++ = CHAR_UNFIX_CASE;
|
||||
*dest = EOS;
|
||||
break;
|
||||
if (DECAP_ENABLED) {
|
||||
// Handle fixed-case versions of placeholders
|
||||
if (!fixedCase && (placeholderId & PLACEHOLDER_FIXED_MASK || placeholderId == PLACEHOLDER_ID_PLAYER)) {
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
expandedString = GetExpandedPlaceholder(placeholderId & ~PLACEHOLDER_FIXED_MASK);
|
||||
dest = StringExpandPlaceholders(dest, expandedString);
|
||||
*dest++ = CHAR_UNFIX_CASE;
|
||||
*dest = EOS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
expandedString = GetExpandedPlaceholder(placeholderId & ~PLACEHOLDER_FIXED_MASK);
|
||||
dest = StringExpandPlaceholders(dest, expandedString);
|
||||
break;
|
||||
|
@ -774,10 +770,10 @@ static const u8 *SkipExtCtrlCode(const u8 *s)
|
|||
s++;
|
||||
s += GetExtCtrlCodeLength(*s);
|
||||
}
|
||||
#if DECAP_ENABLED
|
||||
while (*s == CHAR_FIXED_CASE || *s == CHAR_UNFIX_CASE)
|
||||
s++;
|
||||
#endif
|
||||
if (DECAP_ENABLED) {
|
||||
while (*s == CHAR_FIXED_CASE || *s == CHAR_UNFIX_CASE)
|
||||
s++;
|
||||
}
|
||||
|
||||
|
||||
return s;
|
||||
|
|
53
gflib/text.c
53
gflib/text.c
|
@ -241,7 +241,6 @@ static void SetFontsPointer(const struct FontInfo *fonts)
|
|||
gFonts = fonts;
|
||||
}
|
||||
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
void * MirrorPtr(const void *ptr) {
|
||||
if (((u32)ptr) >> 27) // ROM
|
||||
return ROM_MIRROR_PTR(ptr);
|
||||
|
@ -263,7 +262,6 @@ bool32 IsMirrorPtr(const void *ptr) {
|
|||
else
|
||||
return ((u32)ptr) & RAM_MIRROR_MASK;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DeactivateAllTextPrinters(void)
|
||||
{
|
||||
|
@ -292,11 +290,9 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8
|
|||
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||
}
|
||||
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
u16 AddTextPrinterFixedCaseParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)) {
|
||||
return AddTextPrinterParameterized(windowId, fontId, MirrorPtr(str), x, y, speed, callback);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
|
@ -311,19 +307,18 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
|||
sTempTextPrinter.textSpeed = speed;
|
||||
sTempTextPrinter.delayCounter = 0;
|
||||
sTempTextPrinter.scrollDistance = 0;
|
||||
#if DECAP_ENABLED
|
||||
#if DECAP_MIRRORING
|
||||
// string address is mirrored; treat it as a fixed-case string
|
||||
if (IsMirrorPtr(printerTemplate->currentChar)) {
|
||||
sTempTextPrinter.lastChar = CHAR_FIXED_CASE;
|
||||
// Techhnically, unmirroring isn't necessary;
|
||||
// but older emulators may not support mirroring
|
||||
// printerTemplate->currentChar = UnmirrorPtr(printerTemplate->currentChar);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (DECAP_ENABLED) {
|
||||
if (DECAP_MIRRORING) {
|
||||
// string address is mirrored; treat it as a fixed-case string
|
||||
if (IsMirrorPtr(printerTemplate->currentChar)) {
|
||||
sTempTextPrinter.lastChar = CHAR_FIXED_CASE;
|
||||
// Techhnically, unmirroring isn't necessary;
|
||||
// but older emulators may not support mirroring
|
||||
// printerTemplate->currentChar = UnmirrorPtr(printerTemplate->currentChar);
|
||||
}
|
||||
}
|
||||
sTempTextPrinter.lastChar = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)ARRAY_COUNT(sTempTextPrinter.subStructFields); i++)
|
||||
sTempTextPrinter.subStructFields[i] = 0;
|
||||
|
@ -974,7 +969,6 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
|
|||
}
|
||||
}
|
||||
|
||||
#if DECAP_ENABLED
|
||||
// if table[char] & 0xFF == 0, character is not uppercase
|
||||
const u16 gLowercaseDiffTable[] = {
|
||||
// English
|
||||
|
@ -993,15 +987,12 @@ const u16 gLowercaseDiffTable[] = {
|
|||
[CHAR_A_DIAERESIS ... CHAR_U_DIAERESIS] = CHAR_a_DIAERESIS - CHAR_A_DIAERESIS,
|
||||
[EOS] = 0,
|
||||
};
|
||||
#endif
|
||||
|
||||
static u16 RenderText(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
u32 currChar;
|
||||
#if DECAP_ENABLED
|
||||
u32 lastChar;
|
||||
#endif
|
||||
s32 width;
|
||||
s32 widthHelper;
|
||||
|
||||
|
@ -1029,11 +1020,11 @@ static u16 RenderText(struct TextPrinter *textPrinter)
|
|||
|
||||
currChar = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
#if DECAP_ENABLED
|
||||
lastChar = textPrinter->lastChar;
|
||||
if (lastChar != CHAR_FIXED_CASE)
|
||||
textPrinter->lastChar = currChar;
|
||||
#endif
|
||||
if (DECAP_ENABLED) {
|
||||
lastChar = textPrinter->lastChar;
|
||||
if (lastChar != CHAR_FIXED_CASE)
|
||||
textPrinter->lastChar = currChar;
|
||||
}
|
||||
|
||||
switch (currChar)
|
||||
{
|
||||
|
@ -1189,10 +1180,11 @@ static u16 RenderText(struct TextPrinter *textPrinter)
|
|||
textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing;
|
||||
return RENDER_PRINT;
|
||||
case EOS:
|
||||
#if DECAP_ENABLED
|
||||
// Clear fixed case
|
||||
textPrinter->lastChar = currChar;
|
||||
if (DECAP_ENABLED)
|
||||
// Clear fixed case
|
||||
textPrinter->lastChar = currChar;
|
||||
return RENDER_FINISH;
|
||||
#if DECAP_ENABLED
|
||||
// Disable/enable decapitalization
|
||||
// In vanilla these are 1-2 pixel spaces
|
||||
case CHAR_FIXED_CASE:
|
||||
|
@ -1227,11 +1219,8 @@ static u16 RenderText(struct TextPrinter *textPrinter)
|
|||
// Two consecutive uppercase chars; lowercase this one
|
||||
if (IS_UPPER(currChar) && IS_UPPER(lastChar))
|
||||
currChar = TO_LOWER(currChar);
|
||||
}
|
||||
#else
|
||||
return RENDER_FINISH;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (subStruct->fontId)
|
||||
{
|
||||
|
|
|
@ -127,9 +127,7 @@ struct TextPrinter
|
|||
u8 scrollDistance;
|
||||
u8 minLetterSpacing; // 0x20
|
||||
u8 japanese;
|
||||
#if DECAP_ENABLED
|
||||
u8 lastChar; // used to determine whether to decap strings
|
||||
#endif
|
||||
};
|
||||
|
||||
struct FontInfo
|
||||
|
@ -173,18 +171,14 @@ extern TextFlags gTextFlags;
|
|||
extern u8 gDisableTextPrinters;
|
||||
extern struct TextGlyph gCurGlyph;
|
||||
|
||||
#if DECAP_ENABLED
|
||||
extern const u16 gLowercaseDiffTable[];
|
||||
#define IS_UPPER(x) (gLowercaseDiffTable[(x) & 0xFF])
|
||||
#define TO_LOWER(x) (((x) + gLowercaseDiffTable[(x)]) & 0xFF)
|
||||
|
||||
#if DECAP_MIRRORING
|
||||
void * UnmirrorPtr(const void * ptr);
|
||||
void * MirrorPtr(const void * ptr);
|
||||
bool32 IsMirrorPtr(const void *ptr);
|
||||
u16 AddTextPrinterFixedCaseParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void DeactivateAllTextPrinters(void);
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
|
|
|
@ -3198,13 +3198,13 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battler)
|
|||
break;
|
||||
}
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (toCpy != text && *toCpy != CHAR_FIXED_CASE) {
|
||||
*text = CHAR_FIXED_CASE;
|
||||
StringCopyN(text+1, toCpy, PLAYER_NAME_LENGTH);
|
||||
toCpy = text;
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (toCpy != text && *toCpy != CHAR_FIXED_CASE) {
|
||||
*text = CHAR_FIXED_CASE;
|
||||
StringCopyN(text+1, toCpy, PLAYER_NAME_LENGTH);
|
||||
toCpy = text;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return toCpy;
|
||||
}
|
||||
|
@ -3637,25 +3637,25 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
|||
|
||||
if (toCpy != NULL)
|
||||
{
|
||||
#if DECAP_ENABLED
|
||||
bool32 fixedCase = *src & PLACEHOLDER_FIXED_MASK;
|
||||
if (DECAP_ENABLED) {
|
||||
bool32 fixedCase = *src & PLACEHOLDER_FIXED_MASK;
|
||||
|
||||
if (fixedCase)
|
||||
dst[dstID++] = CHAR_FIXED_CASE;
|
||||
if (fixedCase)
|
||||
dst[dstID++] = CHAR_FIXED_CASE;
|
||||
|
||||
while (*toCpy != EOS) {
|
||||
if (*toCpy == CHAR_FIXED_CASE)
|
||||
fixedCase = TRUE;
|
||||
else if (*toCpy == CHAR_UNFIX_CASE)
|
||||
fixedCase = FALSE;
|
||||
dst[dstID++] = *toCpy++;
|
||||
while (*toCpy != EOS) {
|
||||
if (*toCpy == CHAR_FIXED_CASE)
|
||||
fixedCase = TRUE;
|
||||
else if (*toCpy == CHAR_UNFIX_CASE)
|
||||
fixedCase = FALSE;
|
||||
dst[dstID++] = *toCpy++;
|
||||
}
|
||||
if (fixedCase)
|
||||
dst[dstID++] = CHAR_UNFIX_CASE;
|
||||
} else {
|
||||
while (*toCpy != EOS)
|
||||
dst[dstID++] = *toCpy++;
|
||||
}
|
||||
if (fixedCase)
|
||||
dst[dstID++] = CHAR_UNFIX_CASE;
|
||||
#else
|
||||
while (*toCpy != EOS) {
|
||||
dst[dstID++] = *toCpy++;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (*src == B_TXT_TRAINER1_LOSE_TEXT || *src == B_TXT_TRAINER2_LOSE_TEXT
|
||||
|
|
|
@ -3954,9 +3954,8 @@ static void PrintTitle(void)
|
|||
|
||||
static void PrintEasyChatText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING) && !(DECAP_EASY_CHAT)
|
||||
str = MirrorPtr(str);
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_EASY_CHAT)
|
||||
str = MirrorPtr(str);
|
||||
AddTextPrinterParameterized(windowId, fontId, str, x, y, speed, callback);
|
||||
}
|
||||
|
||||
|
@ -5243,9 +5242,8 @@ u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows
|
|||
u16 i, j;
|
||||
u16 numColumns = columns - 1;
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_EASY_CHAT)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_EASY_CHAT)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
|
|
|
@ -117,12 +117,12 @@ bool8 ShowFieldMessageFromBuffer(void)
|
|||
|
||||
static void ExpandStringAndStartDrawFieldMessage(const u8 *str, bool32 allowSkippingDelayWithButtonPress)
|
||||
{
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING) && !(DECAP_FIELD_MSG)
|
||||
gStringVar4[0] = CHAR_FIXED_CASE;
|
||||
StringExpandPlaceholders(gStringVar4+1, str);
|
||||
#else
|
||||
StringExpandPlaceholders(gStringVar4, str);
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_FIELD_MSG) {
|
||||
gStringVar4[0] = CHAR_FIXED_CASE;
|
||||
StringExpandPlaceholders(gStringVar4+1, str);
|
||||
} else {
|
||||
StringExpandPlaceholders(gStringVar4, str);
|
||||
}
|
||||
AddTextPrinterForMessage(allowSkippingDelayWithButtonPress);
|
||||
CreateTask_DrawFieldMessage();
|
||||
}
|
||||
|
|
|
@ -875,11 +875,10 @@ static u16 SanitizeItemId(u16 itemId)
|
|||
|
||||
const u8 *ItemId_GetName(u16 itemId)
|
||||
{
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING) && !(DECAP_ITEM_NAMES)
|
||||
return ROM_MIRROR_PTR(gItems[SanitizeItemId(itemId)].name);
|
||||
#else
|
||||
return gItems[SanitizeItemId(itemId)].name;
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_ITEM_NAMES)
|
||||
return ROM_MIRROR_PTR(gItems[SanitizeItemId(itemId)].name);
|
||||
else
|
||||
return gItems[SanitizeItemId(itemId)].name;
|
||||
}
|
||||
|
||||
u32 ItemId_GetPrice(u16 itemId)
|
||||
|
|
|
@ -96,11 +96,10 @@ void AgbMain()
|
|||
*(vu16 *)BG_PLTT = RGB_WHITE; // Set the backdrop to white on startup
|
||||
InitGpuRegManager();
|
||||
// Setup waitstates for all ROM mirrors
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | 0x5B4; // WAITCNT_WSX_S_1 | WAITCNT_WSX_N_3
|
||||
#else
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING)
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | 0x5B4; // WAITCNT_WSX_S_1 | WAITCNT_WSX_N_3
|
||||
else
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
|
||||
InitKeys();
|
||||
InitIntrHandlers();
|
||||
m4aSoundInit();
|
||||
|
|
|
@ -2745,11 +2745,10 @@ static void PrintMessage(const u8 *text)
|
|||
{
|
||||
DrawStdFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x4F, 13);
|
||||
gTextFlags.canABSpeedUpPrint = TRUE;
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING) && !(DECAP_PARTY_MENU)
|
||||
AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, MirrorPtr(text), GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
|
||||
#else
|
||||
AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_PARTY_MENU)
|
||||
AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, MirrorPtr(text), GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
|
||||
else
|
||||
AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
|
||||
}
|
||||
|
||||
static void PartyMenuDisplayYesNoMenu(void)
|
||||
|
|
|
@ -2154,10 +2154,10 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (IsStringAddrSafe(data, POKEMON_NAME_LENGTH))
|
||||
*data++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (IsStringAddrSafe(data, POKEMON_NAME_LENGTH))
|
||||
*data++ = CHAR_FIXED_CASE;
|
||||
}
|
||||
retVal = 0;
|
||||
while (retVal < min(sizeof(boxMon->nickname), POKEMON_NAME_LENGTH))
|
||||
{
|
||||
|
@ -2520,10 +2520,10 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
|||
break;
|
||||
case MON_DATA_OT_NAME:
|
||||
{
|
||||
#if (DECAP_ENABLED) && !(DECAP_NICKNAMES)
|
||||
if (IsStringAddrSafe(data, PLAYER_NAME_LENGTH))
|
||||
*data++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_NICKNAMES) {
|
||||
if (IsStringAddrSafe(data, PLAYER_NAME_LENGTH))
|
||||
*data++ = CHAR_FIXED_CASE;
|
||||
}
|
||||
retVal = 0;
|
||||
|
||||
while (retVal < PLAYER_NAME_LENGTH)
|
||||
|
|
|
@ -5548,11 +5548,10 @@ static void InitBoxTitle(u8 boxId)
|
|||
sStorage->wallpaperPalBits |= (1 << 16) << tagIndex;
|
||||
|
||||
StringCopyPadded(sStorage->boxTitleText, GetBoxNamePtr(boxId), 0, BOX_NAME_LENGTH);
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
DrawTextWindowAndBufferTiles(MirrorPtr(sStorage->boxTitleText), sStorage->boxTitleTiles, 0, 0, 2);
|
||||
#else
|
||||
DrawTextWindowAndBufferTiles(sStorage->boxTitleText, sStorage->boxTitleTiles, 0, 0, 2);
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING)
|
||||
DrawTextWindowAndBufferTiles(MirrorPtr(sStorage->boxTitleText), sStorage->boxTitleTiles, 0, 0, 2);
|
||||
else
|
||||
DrawTextWindowAndBufferTiles(sStorage->boxTitleText, sStorage->boxTitleTiles, 0, 0, 2);
|
||||
LoadSpriteSheet(&spriteSheet);
|
||||
x = GetBoxTitleBaseX(GetBoxNamePtr(boxId));
|
||||
|
||||
|
@ -9610,11 +9609,10 @@ struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition)
|
|||
u8 *GetBoxNamePtr(u8 boxId)
|
||||
{
|
||||
if (boxId < TOTAL_BOXES_COUNT)
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING)
|
||||
return MirrorPtr(gPokemonStoragePtr->boxNames[boxId]);
|
||||
#else
|
||||
return gPokemonStoragePtr->boxNames[boxId];
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING)
|
||||
return MirrorPtr(gPokemonStoragePtr->boxNames[boxId]);
|
||||
else
|
||||
return gPokemonStoragePtr->boxNames[boxId];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -2819,11 +2819,10 @@ static void ResetWindows(void)
|
|||
|
||||
static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId)
|
||||
{
|
||||
#if (DECAP_ENABLED) && (DECAP_MIRRORING) && !(DECAP_SUMMARY)
|
||||
AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string));
|
||||
#else
|
||||
AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, string);
|
||||
#endif
|
||||
if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_SUMMARY)
|
||||
AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string));
|
||||
else
|
||||
AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, string);
|
||||
}
|
||||
|
||||
static void PrintMonInfo(void)
|
||||
|
|
|
@ -1570,9 +1570,8 @@ u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
|
|||
u8 *str;
|
||||
u16 i;
|
||||
|
||||
#if (DECAP_ENABLED) && !(DECAP_MAP_NAMES)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
#endif
|
||||
if (DECAP_ENABLED && !DECAP_MAP_NAMES)
|
||||
*dest++ = CHAR_FIXED_CASE;
|
||||
|
||||
if (regionMapId == MAPSEC_SECRET_BASE)
|
||||
{
|
||||
|
|
|
@ -1186,13 +1186,13 @@ static s32 TryMessage(s32 i, s32 n, const u8 *string)
|
|||
if (string[j] == CHAR_PROMPT_CLEAR)
|
||||
j++;
|
||||
}
|
||||
#if DECAP_ENABLED
|
||||
// ignore case-fixing characters in string
|
||||
if (string[j] == CHAR_FIXED_CASE || string[j] == CHAR_UNFIX_CASE) {
|
||||
k--; // will be incremented in 'continue'
|
||||
continue;
|
||||
if (DECAP_ENABLED) {
|
||||
// ignore case-fixing characters in string
|
||||
if (string[j] == CHAR_FIXED_CASE || string[j] == CHAR_UNFIX_CASE) {
|
||||
k--; // will be incremented in 'continue'
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (string[j] != event->pattern[k])
|
||||
{
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue