summaryrefslogtreecommitdiff
path: root/src/naming_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/naming_screen.c')
-rw-r--r--src/naming_screen.c271
1 files changed, 136 insertions, 135 deletions
diff --git a/src/naming_screen.c b/src/naming_screen.c
index 3c8478e04..19da9da02 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -25,6 +25,7 @@
#include "menu.h"
#include "text_window.h"
#include "overworld.h"
+#include "walda_phrase.h"
#include "constants/event_objects.h"
#include "constants/rgb.h"
@@ -149,7 +150,7 @@ struct NamingScreenTemplate
const u8 *title;
};
-struct NamingScreenData
+struct NamingScreenData
{
u8 tilemapBuffer1[0x800];
u8 tilemapBuffer2[0x800];
@@ -299,12 +300,12 @@ static const u8 sKeyboardChars[KBPAGE_COUNT * KBROW_COUNT * KBCOL_COUNT] = __(
"!?♂♀/- "
"…“”‘' ");
-static const u8 sPageColumnCounts[KBPAGE_COUNT] = {
- [KEYBOARD_LETTERS_LOWER] = KBCOL_COUNT,
- [KEYBOARD_LETTERS_UPPER] = KBCOL_COUNT,
- [KEYBOARD_SYMBOLS] = 6
+static const u8 sPageColumnCounts[KBPAGE_COUNT] = {
+ [KEYBOARD_LETTERS_LOWER] = KBCOL_COUNT,
+ [KEYBOARD_LETTERS_UPPER] = KBCOL_COUNT,
+ [KEYBOARD_SYMBOLS] = 6
};
-static const u8 sPageColumnXPos[KBPAGE_COUNT * KBCOL_COUNT] = {
+static const u8 sPageColumnXPos[KBPAGE_COUNT * KBCOL_COUNT] = {
0, 12, 24, 56, 68, 80, 92, 123, // KEYBOARD_LETTERS_LOWER
0, 12, 24, 56, 68, 80, 92, 123, // KEYBOARD_LETTERS_UPPER
0, 22, 44, 66, 88, 110 // KEYBOARD_SYMBOLS
@@ -583,25 +584,25 @@ static void Task_NamingScreen(u8 taskId)
}
// Which gfx/pal to load for the swap page button
-static const u8 sPageToNextGfxId[KBPAGE_COUNT] =
-{
- [KBPAGE_SYMBOLS] = PAGE_SWAP_UPPER,
- [KBPAGE_LETTERS_UPPER] = PAGE_SWAP_LOWER,
- [KBPAGE_LETTERS_LOWER] = PAGE_SWAP_OTHERS
+static const u8 sPageToNextGfxId[KBPAGE_COUNT] =
+{
+ [KBPAGE_SYMBOLS] = PAGE_SWAP_UPPER,
+ [KBPAGE_LETTERS_UPPER] = PAGE_SWAP_LOWER,
+ [KBPAGE_LETTERS_LOWER] = PAGE_SWAP_OTHERS
};
-static const u8 sPageToNextKeyboardId[KBPAGE_COUNT] =
-{
- [KBPAGE_SYMBOLS] = KEYBOARD_LETTERS_UPPER,
- [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_LOWER,
- [KBPAGE_LETTERS_LOWER] = KEYBOARD_SYMBOLS
+static const u8 sPageToNextKeyboardId[KBPAGE_COUNT] =
+{
+ [KBPAGE_SYMBOLS] = KEYBOARD_LETTERS_UPPER,
+ [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_LOWER,
+ [KBPAGE_LETTERS_LOWER] = KEYBOARD_SYMBOLS
};
-static const u8 sPageToKeyboardId[KBPAGE_COUNT] =
-{
- [KBPAGE_SYMBOLS] = KEYBOARD_SYMBOLS,
- [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_UPPER,
- [KBPAGE_LETTERS_LOWER] = KEYBOARD_LETTERS_LOWER
+static const u8 sPageToKeyboardId[KBPAGE_COUNT] =
+{
+ [KBPAGE_SYMBOLS] = KEYBOARD_SYMBOLS,
+ [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_UPPER,
+ [KBPAGE_LETTERS_LOWER] = KEYBOARD_LETTERS_LOWER
};
static u8 PageToNextGfxId(u8 page)
@@ -674,7 +675,7 @@ static bool8 MainState_PressedOKButton(void)
SetInputState(INPUT_STATE_DISABLED);
SetCursorFlashing(FALSE);
TryStartButtonFlash(BUTTON_COUNT, FALSE, TRUE);
- if (sNamingScreen->templateNum == NAMING_SCREEN_CAUGHT_MON
+ if (sNamingScreen->templateNum == NAMING_SCREEN_CAUGHT_MON
&& CalculatePlayerPartyCount() >= PARTY_SIZE)
{
DisplaySentToPCMessage();
@@ -1030,9 +1031,9 @@ static void SpriteCB_Cursor(struct Sprite *sprite)
if (sprite->sX == GetCurrentPageColumnCount())
sprite->invisible = TRUE;
- if (sprite->invisible
+ if (sprite->invisible
|| !(sprite->sFlashing)
- || sprite->sX != sprite->sPrevX
+ || sprite->sX != sprite->sPrevX
|| sprite->sY != sprite->sPrevY)
{
sprite->sColor = 0;
@@ -1071,7 +1072,7 @@ static void SpriteCB_InputArrow(struct Sprite *sprite)
sprite->sDelay = 8;
sprite->sXPosId = (sprite->sXPosId + 1) & (ARRAY_COUNT(x) - 1);
}
- sprite->pos2.x = x[sprite->sXPosId];
+ sprite->x2 = x[sprite->sXPosId];
}
#undef sDelay
@@ -1089,13 +1090,13 @@ static void SpriteCB_Underscore(struct Sprite *sprite)
pos = GetTextEntryPosition();
if (pos != (u8)sprite->sId)
{
- sprite->pos2.y = 0;
+ sprite->y2 = 0;
sprite->sYPosId = 0;
sprite->sDelay = 0;
}
else
{
- sprite->pos2.y = y[sprite->sYPosId];
+ sprite->y2 = y[sprite->sYPosId];
sprite->sDelay++;
if (sprite->sDelay > 8)
{
@@ -1134,11 +1135,11 @@ static void SetCursorPos(s16 x, s16 y)
struct Sprite *cursorSprite = &gSprites[sNamingScreen->cursorSpriteId];
if (x < sPageColumnCounts[CurrentPageToKeyboardId()])
- cursorSprite->pos1.x = sPageColumnXPos[x + CurrentPageToKeyboardId() * KBCOL_COUNT] + 38;
+ cursorSprite->x = sPageColumnXPos[x + CurrentPageToKeyboardId() * KBCOL_COUNT] + 38;
else
- cursorSprite->pos1.x = 0;
+ cursorSprite->x = 0;
- cursorSprite->pos1.y = y * 16 + 88;
+ cursorSprite->y = y * 16 + 88;
cursorSprite->sPrevX = cursorSprite->sX;
cursorSprite->sPrevY = cursorSprite->sY;
cursorSprite->sX = x;
@@ -1284,11 +1285,11 @@ static bool8 PageSwapSprite_SlideOff(struct Sprite *sprite)
struct Sprite *text = &gSprites[sprite->sTextSpriteId];
struct Sprite *button = &gSprites[sprite->sButtonSpriteId];
- text->pos2.y++;
- if (text->pos2.y > 7)
+ text->y2++;
+ if (text->y2 > 7)
{
sprite->sState++;
- text->pos2.y = -4;
+ text->y2 = -4;
text->invisible = TRUE;
SetPageSwapButtonGfx(PageToNextGfxId(((u8)sprite->sPage + 1) % KBPAGE_COUNT), text, button);
}
@@ -1300,24 +1301,24 @@ static bool8 PageSwapSprite_SlideOn(struct Sprite *sprite)
struct Sprite *text = &gSprites[sprite->sTextSpriteId];
text->invisible = FALSE;
- text->pos2.y++;
- if (text->pos2.y >= 0)
+ text->y2++;
+ if (text->y2 >= 0)
{
- text->pos2.y = 0;
+ text->y2 = 0;
sprite->sState = 1; // go to PageSwapSprite_Idle
}
return FALSE;
}
static const u16 sPageSwapPalTags[] = {
- [PAGE_SWAP_UPPER] = PALTAG_PAGE_SWAP_UPPER,
- [PAGE_SWAP_OTHERS] = PALTAG_PAGE_SWAP_OTHERS,
+ [PAGE_SWAP_UPPER] = PALTAG_PAGE_SWAP_UPPER,
+ [PAGE_SWAP_OTHERS] = PALTAG_PAGE_SWAP_OTHERS,
[PAGE_SWAP_LOWER] = PALTAG_PAGE_SWAP_LOWER
};
static const u16 sPageSwapGfxTags[] = {
- [PAGE_SWAP_UPPER] = GFXTAG_PAGE_SWAP_UPPER,
- [PAGE_SWAP_OTHERS] = GFXTAG_PAGE_SWAP_OTHERS,
+ [PAGE_SWAP_UPPER] = GFXTAG_PAGE_SWAP_UPPER,
+ [PAGE_SWAP_OTHERS] = GFXTAG_PAGE_SWAP_OTHERS,
[PAGE_SWAP_LOWER] = GFXTAG_PAGE_SWAP_LOWER
};
@@ -1651,7 +1652,7 @@ static void HandleDpadMovement(struct Task *task)
if (cursorX > GetCurrentPageColumnCount())
cursorX = 0;
-
+
// Handle moving on/off the button column
if (sDpadDeltaX[input] != 0)
{
@@ -2089,7 +2090,7 @@ static void Debug_NamingScreenNickname(void)
static const struct NamingScreenTemplate sPlayerNamingScreenTemplate =
{
.copyExistingString = FALSE,
- .maxChars = 7,
+ .maxChars = PLAYER_NAME_LENGTH,
.iconFunction = 1,
.addGenderIcon = FALSE,
.initialPage = KBPAGE_LETTERS_UPPER,
@@ -2100,7 +2101,7 @@ static const struct NamingScreenTemplate sPlayerNamingScreenTemplate =
static const struct NamingScreenTemplate sPCBoxNamingTemplate =
{
.copyExistingString = FALSE,
- .maxChars = 8,
+ .maxChars = BOX_NAME_LENGTH,
.iconFunction = 2,
.addGenderIcon = FALSE,
.initialPage = KBPAGE_LETTERS_UPPER,
@@ -2111,7 +2112,7 @@ static const struct NamingScreenTemplate sPCBoxNamingTemplate =
static const struct NamingScreenTemplate sMonNamingScreenTemplate =
{
.copyExistingString = FALSE,
- .maxChars = 10,
+ .maxChars = POKEMON_NAME_LENGTH,
.iconFunction = 3,
.addGenderIcon = TRUE,
.initialPage = KBPAGE_LETTERS_UPPER,
@@ -2122,7 +2123,7 @@ static const struct NamingScreenTemplate sMonNamingScreenTemplate =
static const struct NamingScreenTemplate sWaldaWordsScreenTemplate =
{
.copyExistingString = TRUE,
- .maxChars = 15,
+ .maxChars = WALDA_PHRASE_LENGTH,
.iconFunction = 4,
.addGenderIcon = FALSE,
.initialPage = KBPAGE_LETTERS_UPPER,
@@ -2184,67 +2185,67 @@ static const struct OamData sOam_32x16 =
static const struct Subsprite sSubsprites_PageSwapFrame[] =
{
{
- .x = -20,
- .y = -16,
- .shape = SPRITE_SHAPE(32x8),
- .size = SPRITE_SIZE(32x8),
- .tileOffset = 0,
+ .x = -20,
+ .y = -16,
+ .shape = SPRITE_SHAPE(32x8),
+ .size = SPRITE_SIZE(32x8),
+ .tileOffset = 0,
.priority = 1
},
{
- .x = 12,
- .y = -16,
- .shape = SPRITE_SHAPE(8x8),
- .size = SPRITE_SIZE(8x8),
- .tileOffset = 4,
+ .x = 12,
+ .y = -16,
+ .shape = SPRITE_SHAPE(8x8),
+ .size = SPRITE_SIZE(8x8),
+ .tileOffset = 4,
.priority = 1
},
{
- .x = -20,
- .y = -8,
- .shape = SPRITE_SHAPE(32x8),
- .size = SPRITE_SIZE(32x8),
- .tileOffset = 5,
+ .x = -20,
+ .y = -8,
+ .shape = SPRITE_SHAPE(32x8),
+ .size = SPRITE_SIZE(32x8),
+ .tileOffset = 5,
.priority = 1
},
{
- .x = 12,
- .y = -8,
- .shape = SPRITE_SHAPE(8x8),
+ .x = 12,
+ .y = -8,
+ .shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
- .tileOffset = 9,
+ .tileOffset = 9,
.priority = 1
},
{
- .x = -20,
- .y = 0,
- .shape = SPRITE_SHAPE(32x8),
- .size = SPRITE_SIZE(32x8),
- .tileOffset = 10,
+ .x = -20,
+ .y = 0,
+ .shape = SPRITE_SHAPE(32x8),
+ .size = SPRITE_SIZE(32x8),
+ .tileOffset = 10,
.priority = 1
},
{
- .x = 12,
- .y = 0,
- .shape = SPRITE_SHAPE(8x8),
- .size = SPRITE_SIZE(8x8),
- .tileOffset = 14,
+ .x = 12,
+ .y = 0,
+ .shape = SPRITE_SHAPE(8x8),
+ .size = SPRITE_SIZE(8x8),
+ .tileOffset = 14,
.priority = 1
},
{
- .x = -20,
- .y = 8,
- .shape = SPRITE_SHAPE(32x8),
+ .x = -20,
+ .y = 8,
+ .shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
- .tileOffset = 15,
+ .tileOffset = 15,
.priority = 1
},
{
- .x = 12,
- .y = 8,
- .shape = SPRITE_SHAPE(8x8),
+ .x = 12,
+ .y = 8,
+ .shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
- .tileOffset = 19,
+ .tileOffset = 19,
.priority = 1
}
};
@@ -2252,19 +2253,19 @@ static const struct Subsprite sSubsprites_PageSwapFrame[] =
static const struct Subsprite sSubsprites_PageSwapText[] =
{
{
- .x = -12,
- .y = -4,
- .shape = SPRITE_SHAPE(16x8),
- .size = SPRITE_SIZE(16x8),
- .tileOffset = 0,
+ .x = -12,
+ .y = -4,
+ .shape = SPRITE_SHAPE(16x8),
+ .size = SPRITE_SIZE(16x8),
+ .tileOffset = 0,
.priority = 1
},
{
- .x = 4,
- .y = -4,
- .shape = SPRITE_SHAPE(8x8),
- .size = SPRITE_SIZE(8x8),
- .tileOffset = 2,
+ .x = 4,
+ .y = -4,
+ .shape = SPRITE_SHAPE(8x8),
+ .size = SPRITE_SIZE(8x8),
+ .tileOffset = 2,
.priority = 1
}
};
@@ -2272,51 +2273,51 @@ static const struct Subsprite sSubsprites_PageSwapText[] =
static const struct Subsprite sSubsprites_Button[] =
{
{
- .x = -20,
- .y = -12,
- .shape = SPRITE_SHAPE(32x8),
+ .x = -20,
+ .y = -12,
+ .shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
- .tileOffset = 0,
+ .tileOffset = 0,
.priority = 1
},
{
- .x = 12,
- .y = -12,
- .shape = SPRITE_SHAPE(8x8),
+ .x = 12,
+ .y = -12,
+ .shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
- .tileOffset = 4,
+ .tileOffset = 4,
.priority = 1
},
{
- .x = -20,
- .y = -4,
- .shape = SPRITE_SHAPE(32x8),
+ .x = -20,
+ .y = -4,
+ .shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
- .tileOffset = 5,
+ .tileOffset = 5,
.priority = 1
},
{
- .x = 12,
- .y = -4,
- .shape = SPRITE_SHAPE(8x8),
+ .x = 12,
+ .y = -4,
+ .shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
- .tileOffset = 9,
+ .tileOffset = 9,
.priority = 1
},
{
- .x = -20,
- .y = 4,
- .shape = SPRITE_SHAPE(32x8),
- .size = SPRITE_SIZE(32x8),
- .tileOffset = 10,
+ .x = -20,
+ .y = 4,
+ .shape = SPRITE_SHAPE(32x8),
+ .size = SPRITE_SIZE(32x8),
+ .tileOffset = 10,
.priority = 1
},
{
- .x = 12,
- .y = 4,
- .shape = SPRITE_SHAPE(8x8),
+ .x = 12,
+ .y = 4,
+ .shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
- .tileOffset = 14,
+ .tileOffset = 14,
.priority = 1
}
};
@@ -2324,27 +2325,27 @@ static const struct Subsprite sSubsprites_Button[] =
static const struct Subsprite sSubsprites_PCIcon[] =
{
{
- .x = -8,
- .y = -12,
- .shape = SPRITE_SHAPE(16x8),
- .size = SPRITE_SIZE(16x8),
- .tileOffset = 0,
+ .x = -8,
+ .y = -12,
+ .shape = SPRITE_SHAPE(16x8),
+ .size = SPRITE_SIZE(16x8),
+ .tileOffset = 0,
.priority = 3
},
{
- .x = -8,
- .y = -4,
- .shape = SPRITE_SHAPE(16x8),
+ .x = -8,
+ .y = -4,
+ .shape = SPRITE_SHAPE(16x8),
.size = SPRITE_SIZE(16x8),
- .tileOffset = 2,
+ .tileOffset = 2,
.priority = 3
},
{
- .x = -8,
- .y = 4,
- .shape = SPRITE_SHAPE(16x8),
- .size = SPRITE_SIZE(16x8),
- .tileOffset = 4,
+ .x = -8,
+ .y = 4,
+ .shape = SPRITE_SHAPE(16x8),
+ .size = SPRITE_SIZE(16x8),
+ .tileOffset = 4,
.priority = 3
}
};
@@ -2503,7 +2504,7 @@ static const struct SpriteTemplate sSpriteTemplate_Underscore =
static const struct SpriteTemplate sSpriteTemplate_PCIcon =
{
- .tileTag = 0xFFFF,
+ .tileTag = TAG_NONE,
.paletteTag = PALTAG_PC_ICON,
.oam = &sOam_8x8,
.anims = sAnims_PCIcon,
@@ -2514,21 +2515,21 @@ static const struct SpriteTemplate sSpriteTemplate_PCIcon =
static const u8* const sNamingScreenKeyboardText[KBPAGE_COUNT][KBROW_COUNT] =
{
- [KEYBOARD_LETTERS_LOWER] =
+ [KEYBOARD_LETTERS_LOWER] =
{
gText_NamingScreenKeyboard_abcdef,
gText_NamingScreenKeyboard_ghijkl,
gText_NamingScreenKeyboard_mnopqrs,
gText_NamingScreenKeyboard_tuvwxyz
},
- [KEYBOARD_LETTERS_UPPER] =
+ [KEYBOARD_LETTERS_UPPER] =
{
gText_NamingScreenKeyboard_ABCDEF,
gText_NamingScreenKeyboard_GHIJKL,
gText_NamingScreenKeyboard_MNOPQRS,
gText_NamingScreenKeyboard_TUVWXYZ
},
- [KEYBOARD_SYMBOLS] =
+ [KEYBOARD_SYMBOLS] =
{
gText_NamingScreenKeyboard_01234,
gText_NamingScreenKeyboard_56789,