Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
999 changes: 499 additions & 500 deletions include/constants/charcode.h

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion include/constants/global.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef POKEHEARTGOLD_CONSTANTS_GLOBAL_H
#define POKEHEARTGOLD_CONSTANTS_GLOBAL_H

#include "constants/charcode.h"
#include "constants/global_fieldmap.h"
#include "constants/gx.h"
#include "constants/sdk_extras.h"
Expand Down
2 changes: 2 additions & 0 deletions src/ascii_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "global.h"

#include "constants/charcode.h"

s32 Ascii_StrLen(const s8 *str) {
s32 i = 0;
while (str[i] != 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/daycare.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ void DaycareMon_Extras_Init(DaycareMail *mail) {
mail->nickname[i] = 0;
}

mail->ot_name[0] = EOS;
mail->nickname[0] = EOS;
mail->ot_name[0] = CHAR_EOS;
mail->nickname[0] = CHAR_EOS;
}

void DaycareMon_Init(DaycareMon *mon) {
Expand Down
24 changes: 12 additions & 12 deletions src/font_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ static void DecompressGlyphTiles_LazyFromNarc(struct FontData *fontData, u16 gly
u32 GetStringWidth(struct FontData *fontData, const u16 *string, u32 letterSpacing) {
u32 ret = 0;

while (*string != EOS) {
if (*string == EXT_CTRL_CODE_BEGIN) {
while (*string != CHAR_EOS) {
if (*string == CHAR_CONTROL_CODE_ARG) {
string = MsgArray_SkipControlCode(string);
if (*string != EOS) {
if (*string != CHAR_EOS) {
continue;
}
break;
Expand All @@ -228,10 +228,10 @@ u32 GetStringWidth(struct FontData *fontData, const u16 *string, u32 letterSpaci
u32 GetStringWidthFirstLine(struct FontData *fontData, const u16 *string, u32 letterSpacing) {
u32 ret = 0;

while (*string != EOS && *string != CHAR_LF) {
if (*string == EXT_CTRL_CODE_BEGIN) {
while (*string != CHAR_EOS && *string != CHAR_LINE_BREAK) {
if (*string == CHAR_CONTROL_CODE_ARG) {
string = MsgArray_SkipControlCode(string);
if (*string != EOS && *string != CHAR_LF) {
if (*string != CHAR_EOS && *string != CHAR_LINE_BREAK) {
continue;
}
break;
Expand All @@ -244,10 +244,10 @@ u32 GetStringWidthFirstLine(struct FontData *fontData, const u16 *string, u32 le
}

BOOL StringAllCharsValid(struct FontData *fontData, const u16 *string) {
while (*string != EOS) {
if (*string == EXT_CTRL_CODE_BEGIN) {
while (*string != CHAR_EOS) {
if (*string == CHAR_CONTROL_CODE_ARG) {
string = MsgArray_SkipControlCode(string);
if (*string == EOS) {
if (*string == CHAR_EOS) {
return TRUE;
}
// bug: if multiple ext ctrl codes in tandem,
Expand Down Expand Up @@ -276,10 +276,10 @@ static u32 GetGlyphWidth_FixedWidth(struct FontData *fontData, int glyphId) {
u32 GetStringWidthMultiline(struct FontData *fontData, const u16 *string, u32 letterSpacing) {
u32 cur = 0, ret = 0;

while (*string != EOS) {
if (*string == EXT_CTRL_CODE_BEGIN) {
while (*string != CHAR_EOS) {
if (*string == CHAR_CONTROL_CODE_ARG) {
string = MsgArray_SkipControlCode(string);
} else if (*string == CHAR_LF) {
} else if (*string == CHAR_LINE_BREAK) {
if (ret < cur - letterSpacing) {
ret = cur - letterSpacing;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hall_of_fame.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void Save_HOF_RecordParty(HallOfFame *hof, Party *party, RTCDate *date) {
GetMonData(mon, MON_DATA_OT_NAME_STRING, string);
CopyStringToU16Array(string, team->party[j].otname, PLAYER_NAME_LENGTH + 1);
} else {
team->party[j].nickname[0] = EOS;
team->party[j].otname[0] = EOS;
team->party[j].nickname[0] = CHAR_EOS;
team->party[j].otname[0] = CHAR_EOS;
}
j++;
}
Expand Down
22 changes: 11 additions & 11 deletions src/link_ruleset_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static u8 sRulesetIndexes[] = {
};

static LinkBattleRuleset sDefaultRuleset = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 6,
.maxLevel = 100,
Expand All @@ -38,7 +38,7 @@ static LinkBattleRuleset sDefaultRuleset = {

static LinkBattleRuleset sAlternateRulesets[] = {
[STD_RULESET_STANDARD] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 3,
.maxLevel = 50,
Expand All @@ -51,7 +51,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_FANCY] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 80,
.partyCount = 3,
.maxLevel = 30,
Expand All @@ -64,7 +64,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_LITTLE] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 3,
.maxLevel = 5,
Expand All @@ -77,7 +77,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = TRUE,
},
[STD_RULESET_LIGHT] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 3,
.maxLevel = 50,
Expand All @@ -90,7 +90,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_DOUBLE] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 4,
.maxLevel = 50,
Expand All @@ -103,7 +103,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_STANDARD_2] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 3,
.maxLevel = 100,
Expand All @@ -116,7 +116,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_LIGHT_2] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 3,
.maxLevel = 100,
Expand All @@ -129,7 +129,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_DOUBLE_2] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 4,
.maxLevel = 100,
Expand All @@ -142,7 +142,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_DOUBLE_3] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0,
.partyCount = 4,
.maxLevel = 200,
Expand All @@ -155,7 +155,7 @@ static LinkBattleRuleset sAlternateRulesets[] = {
.dragonRageClause = FALSE,
},
[STD_RULESET_GS] = {
.name = { EOS },
.name = { CHAR_EOS },
.totalLevel = 0 | FLAG_RULESET_BAN_SOUL_DEW,
.partyCount = 4,
.maxLevel = 100,
Expand Down
4 changes: 2 additions & 2 deletions src/mail_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ u32 MailMsg_NumFields(u16 msg_bank, u16 msg_no) {
msg = ReadMsgData_NewNarc_NewString(NARC_msgdata_msg, sMessageBanks[msg_bank], msg_no, HEAP_ID_DEFAULT);
msg_cstr = String_cstr(msg);
ret = 0;
while (*msg_cstr != EOS) {
if (*msg_cstr == EXT_CTRL_CODE_BEGIN) {
while (*msg_cstr != CHAR_EOS) {
if (*msg_cstr == CHAR_CONTROL_CODE_ARG) {
if (MsgArray_ControlCodeIsStrVar(msg_cstr)) {
ret++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/message_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ void BufferDeptStoreFloorNo(MessageFormat *msgFmt, u32 fieldno, u32 floor) {
void StringExpandPlaceholders(MessageFormat *msgFmt, String *dest, String *src) {
const u16 *cstr = String_cstr(src);
String_SetEmpty(dest);
while (*cstr != EOS) {
if (*cstr == EXT_CTRL_CODE_BEGIN) {
while (*cstr != CHAR_EOS) {
if (*cstr == CHAR_CONTROL_CODE_ARG) {
if (MsgArray_ControlCodeIsStrVar(cstr)) {
u32 idx = MsgArray_ControlCodeGetField(cstr, 0);
GF_ASSERT(idx < msgFmt->count);
Expand Down
4 changes: 3 additions & 1 deletion src/message_printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "global.h"

#include "constants/charcode.h"

#include "filesystem_files_def.h"
#include "gf_gfx_loader.h"

Expand Down Expand Up @@ -73,7 +75,7 @@ void sub_0200CDAC(MessagePrinter *messagePrinter, u8 glyphId, Window *window, u3
void PrintUIntOnWindow(MessagePrinter *messagePrinter, u32 num, u32 ndigits, PrintingMode mode, Window *window, u32 x, u32 y) {
ConvertUIntToDecimalString(messagePrinter->string, num, mode, ndigits);
u32 i;
for (i = 0; messagePrinter->string[i] != EOS; i++) {
for (i = 0; messagePrinter->string[i] != CHAR_EOS; i++) {
if (messagePrinter->string[i] >= CHAR_JP_0 && messagePrinter->string[i] <= CHAR_JP_9) {
BlitBitmapRectToWindow(window, messagePrinter->ppCharData->pRawData + (messagePrinter->string[i] - CHAR_JP_0) * 32, 0, 0, 8, 8, x, y, 8, 8);
} else {
Expand Down
Loading