diff options
| -rw-r--r-- | include/global.h | 8 | ||||
| -rw-r--r-- | include/text.h | 2 | ||||
| -rw-r--r-- | src/mail.c | 10 | ||||
| -rw-r--r-- | src/main.c | 2 | ||||
| -rw-r--r-- | src/pokemon_1.c | 4 | ||||
| -rw-r--r-- | src/text.c | 52 | ||||
| -rw-r--r-- | src/trainer_card.c | 2 | 
7 files changed, 38 insertions, 42 deletions
| diff --git a/include/global.h b/include/global.h index be35f1299..d23204760 100644 --- a/include/global.h +++ b/include/global.h @@ -29,6 +29,14 @@ enum      VERSION_RUBY = 2,  }; +enum LanguageId { +	LANGUAGE_JAPANESE = 1, +	LANGUAGE_ENGLISH = 2, +	LANGUAGE_GERMAN = 5, +}; + +#define GAME_LANGUAGE (LANGUAGE_ENGLISH) +  enum  {      MALE, diff --git a/include/text.h b/include/text.h index 2c66f30dc..7dbbcb844 100644 --- a/include/text.h +++ b/include/text.h @@ -36,7 +36,7 @@ struct Window  {      u8 textMode;      u8 fontNum; -    u8 charset; +    u8 language;      u8 foregroundColor;      u8 backgroundColor;      u8 shadowColor; diff --git a/src/mail.c b/src/mail.c index a9e21cbc6..c1ec02e4e 100644 --- a/src/mail.c +++ b/src/mail.c @@ -57,12 +57,6 @@ struct MailGraphics {  };  enum { -    LANGUAGE_JAPANESE = 0, -    LANGUAGE_ENGLISH = 1, -    LANGUAGE_GERMAN = 5, -}; - -enum {      ITEM_ORANGE_MAIL = 0x79,      ITEM_HARBOR_MAIL,      ITEM_GLITTER_MAIL, @@ -103,7 +97,7 @@ void sub_80F890C(struct MailStruct *arg0, MainCallback arg1, bool8 arg2) {      u8 buffer[4];      u8 local1; -    unk_2000000.varFF = 2; +    unk_2000000.varFF = GAME_LANGUAGE;      // Compiler uses [sub 1], while asm uses [ptr + FE]      unk_2000000.varFE = 1; @@ -479,7 +473,7 @@ static void sub_80F8DA0(void) {          }      } -    if (unk_2000000.var100 == LANGUAGE_JAPANESE) { +    if (unk_2000000.var100 == 0) {          u8 *ptr;          u16 length; diff --git a/src/main.c b/src/main.c index c443de69b..a3d5c4f30 100644 --- a/src/main.c +++ b/src/main.c @@ -32,7 +32,7 @@ static void IntrDummy(void);  const u8 gGameVersion = GAME_VERSION; -const u8 gGameLanguage = 2; // English +const u8 gGameLanguage = GAME_LANGUAGE; // English  const char BuildDateTime[] = "2002 10 15 20:34"; diff --git a/src/pokemon_1.c b/src/pokemon_1.c index 7ee413a18..d6f475171 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -302,9 +302,9 @@ void sub_803ADE8(struct Pokemon *mon, struct UnknownPokemonStruct *src)      StringCopy(nickname, src->nickname);      if (nickname[0] == 0xFC && nickname[1] == 0x15) -        language = 1; +        language = LANGUAGE_JAPANESE;      else -        language = 2; +        language = GAME_LANGUAGE;      SetMonData(mon, MON_DATA_LANGUAGE, &language);      StripExtCtrlCodes(nickname); diff --git a/src/text.c b/src/text.c index fb7c085a2..2fa573051 100644 --- a/src/text.c +++ b/src/text.c @@ -8,12 +8,6 @@  enum  { -    CHARSET_JAPANESE = 1, -    CHARSET_LATIN -}; - -enum -{      WIN_STATE_END,      WIN_STATE_BEGIN,      WIN_STATE_NORMAL, @@ -361,7 +355,7 @@ static const WriteGlyphTilemapFunc sWriteGlyphTilemapFuncs[] =      WriteGlyphTilemap_Font6,  }; -static const struct Window sDefaultWindow = { .charset = CHARSET_LATIN }; +static const struct Window sDefaultWindow = { .language = GAME_LANGUAGE };  typedef u8 (*ExtCtrlCodeFunc)(struct Window *); @@ -1947,7 +1941,7 @@ void InitWindow(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8      struct WindowConfig *winConfig = win->config;      win->textMode = winConfig->textMode;      win->fontNum = winConfig->fontNum; -    win->charset = CHARSET_LATIN; +    win->language = GAME_LANGUAGE;      win->paletteNum = winConfig->paletteNum;      win->win_field_B = 0;      win->win_field_C = 0; @@ -2045,7 +2039,7 @@ u8 sub_8002F44(struct Window *win)  static u8 sub_8002FA0(struct Window *win, const u8 *text)  {      u8 retVal; -    u8 savedCharset = win->charset; +    u8 savedLanguage = win->language;      const u8 *savedText = win->text;      u16 savedTextIndex = win->textIndex;      win->text = text; @@ -2055,7 +2049,7 @@ static u8 sub_8002FA0(struct Window *win, const u8 *text)      win->text = savedText;      win->textIndex = savedTextIndex;      win->state = WIN_STATE_NORMAL; -    win->charset = savedCharset; +    win->language = savedLanguage;      return retVal;  } @@ -2291,13 +2285,13 @@ static u8 ExtCtrlCode_Spacing(struct Window *win)  static u8 ExtCtrlCode_Japanese(struct Window *win)  { -    win->charset = CHARSET_JAPANESE; +    win->language = LANGUAGE_JAPANESE;      return 2;  }  static u8 ExtCtrlCode_Latin(struct Window *win)  { -    win->charset = CHARSET_LATIN; +    win->language = GAME_LANGUAGE;      return 2;  } @@ -2596,7 +2590,7 @@ static void LoadFixedWidthGlyph(struct Window *win, u32 glyph, u8 *dest)      u8 *upperTile;      u8 *lowerTile; -    GetGlyphTilePointers(win->fontNum, win->charset, glyph, &upperTile, &lowerTile); +    GetGlyphTilePointers(win->fontNum, win->language, glyph, &upperTile, &lowerTile);      switch (win->fontNum)      { @@ -2627,17 +2621,17 @@ static void WriteGlyphTilemap(struct Window *win, u16 upperTileNum, u16 lowerTil      }  } -static void GetGlyphTilePointers(u8 fontNum, u8 charset, u16 glyph, u8 **upperTilePtr, u8 **lowerTilePtr) +static void GetGlyphTilePointers(u8 fontNum, u8 language, u16 glyph, u8 **upperTilePtr, u8 **lowerTilePtr)  {      u16 index;      const struct Font *font; -    if (charset == CHARSET_JAPANESE) -        charset = 0; +    if (language == LANGUAGE_JAPANESE) +        language = 0;      else -        charset = 7; +        language = 7; -    font = &sFonts[charset + fontNum]; +    font = &sFonts[language + fontNum];      switch (font->type)      { @@ -3137,7 +3131,7 @@ static void DrawDownArrow(struct Window *win)              {                  u8 *upperTile;                  u8 *lowerTile; -                GetGlyphTilePointers(win->fontNum, win->charset, 0, &upperTile, &lowerTile); +                GetGlyphTilePointers(win->fontNum, win->language, 0, &upperTile, &lowerTile);                  glyphTileInfo.width = 8 - glyphTileInfo.startPixel;                  glyphTileInfo.src = upperTile;                  glyphTileInfo.dest = (u32 *)(win->tileData + 32 * GetCursorTileNum(win, 1, 0)); @@ -3341,9 +3335,9 @@ static u8 GetGlyphWidth(struct Window *win, u32 glyph)      u8 width = 8;  #if REVISION >= 1 -    if (win->charset != CHARSET_JAPANESE) +    if (win->language != LANGUAGE_JAPANESE)  #else -    if (win->charset == CHARSET_LATIN) +    if (win->language == LANGUAGE_ENGLISH)  #endif      {          width = win->spacing; @@ -3539,7 +3533,7 @@ u8 GetStringWidth(struct Window *win, const u8 *s)  {      u8 width = 0;      u8 savedFontNum = win->fontNum; -    u8 savedCharset = win->charset; +    u8 savedCharset = win->language;      u8 savedSpacing = win->spacing;      s32 i = 0; @@ -3552,9 +3546,9 @@ u8 GetStringWidth(struct Window *win, const u8 *s)          {              u8 temp;              i++; -            temp = win->charset; +            temp = win->language;              width += GetStringWidth(win, GetExpandedPlaceholder(s[i])); -            win->charset = temp; +            win->language = temp;              i++;              break;          } @@ -3580,10 +3574,10 @@ u8 GetStringWidth(struct Window *win, const u8 *s)                  win->spacing = s[i + 1];                  break;              case 0x15: -                win->charset = 1; +                win->language = LANGUAGE_JAPANESE;                  break;              case 0x16: -                win->charset = 2; +                win->language = GAME_LANGUAGE;                  break;              } @@ -3596,7 +3590,7 @@ u8 GetStringWidth(struct Window *win, const u8 *s)      }      win->spacing = savedSpacing; -    win->charset = savedCharset; +    win->language = savedCharset;      win->fontNum = savedFontNum;      return width; @@ -3659,7 +3653,7 @@ u8 GetStringWidthGivenWindowConfig(struct WindowConfig *winConfig, const u8 *s)  void ConvertInternationalString(u8 *s, u8 language)  { -    if (language == CHARSET_JAPANESE) +    if (language == LANGUAGE_JAPANESE)      {          u8 i; @@ -4253,7 +4247,7 @@ static s32 DrawGlyphTiles(struct Window *win, u32 glyph, u32 glyphWidth)      u8 *lowerTile;      s32 retVal = 0; -    GetGlyphTilePointers(win->fontNum, win->charset, glyph, &upperTile, &lowerTile); +    GetGlyphTilePointers(win->fontNum, win->language, glyph, &upperTile, &lowerTile);      glyphTileInfo.textMode = win->textMode;      glyphTileInfo.startPixel = (win->left + win->cursorX) & 7;      glyphTileInfo.width = glyphWidth; diff --git a/src/trainer_card.c b/src/trainer_card.c index 041245bdc..453cec76d 100644 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -148,7 +148,7 @@ void unref_sub_8094588(u16 left, u16 top);  void sub_8093110(Callback arg1) {      sub_80932AC(arg1);      SetMainCallback2(sub_8093174); -    unk_2000000.language = 2; +    unk_2000000.language = GAME_LANGUAGE;  }  void sub_8093130(u8 playerIndex, Callback arg2) { | 
