mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-19 20:18:34 +01:00
Use window constants in easy_chat
This commit is contained in:
parent
c719d5d9b1
commit
6bc1955c99
@ -226,18 +226,23 @@ static void DoQuizQuestionEasyChatScreen(void);
|
|||||||
static void DoQuizSetAnswerEasyChatScreen(void);
|
static void DoQuizSetAnswerEasyChatScreen(void);
|
||||||
static void DoQuizSetQuestionEasyChatScreen(void);
|
static void DoQuizSetQuestionEasyChatScreen(void);
|
||||||
|
|
||||||
#define PALTAG_TRIANGLE_CURSOR 0
|
enum {
|
||||||
#define PALTAG_RECTANGLE_CURSOR 1
|
PALTAG_TRIANGLE_CURSOR,
|
||||||
#define PALTAG_MISC_UI 2
|
PALTAG_RECTANGLE_CURSOR,
|
||||||
#define PALTAG_RS_INTERVIEW_FRAME 3
|
PALTAG_MISC_UI,
|
||||||
|
PALTAG_RS_INTERVIEW_FRAME,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GFXTAG_TRIANGLE_CURSOR,
|
||||||
|
GFXTAG_RECTANGLE_CURSOR,
|
||||||
|
GFXTAG_SCROLL_INDICATOR,
|
||||||
|
GFXTAG_START_SELECT_BUTTONS,
|
||||||
|
GFXTAG_MODE_WINDOW,
|
||||||
|
GFXTAG_RS_INTERVIEW_FRAME,
|
||||||
|
GFXTAG_BUTTON_WINDOW,
|
||||||
|
};
|
||||||
|
|
||||||
#define GFXTAG_TRIANGLE_CURSOR 0
|
|
||||||
#define GFXTAG_RECTANGLE_CURSOR 1
|
|
||||||
#define GFXTAG_SCROLL_INDICATOR 2
|
|
||||||
#define GFXTAG_START_SELECT_BUTTONS 3
|
|
||||||
#define GFXTAG_MODE_WINDOW 4
|
|
||||||
#define GFXTAG_RS_INTERVIEW_FRAME 5
|
|
||||||
#define GFXTAG_BUTTON_WINDOW 6
|
|
||||||
|
|
||||||
// State values for sEasyChatScreen->inputState
|
// State values for sEasyChatScreen->inputState
|
||||||
// Control which input handler to use in HandleEasyChatInput
|
// Control which input handler to use in HandleEasyChatInput
|
||||||
@ -376,6 +381,13 @@ enum {
|
|||||||
WINANIM_KEYBOARD_SWITCH_IN,
|
WINANIM_KEYBOARD_SWITCH_IN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Window IDs
|
||||||
|
enum {
|
||||||
|
WIN_TITLE,
|
||||||
|
WIN_MSG,
|
||||||
|
WIN_INPUT_SELECT, // Word groups, word list, and keyboard
|
||||||
|
};
|
||||||
|
|
||||||
// Values for text frame tilemap
|
// Values for text frame tilemap
|
||||||
#define FRAME_OFFSET_ORANGE 0x1000 // Orange frame, for phrase text
|
#define FRAME_OFFSET_ORANGE 0x1000 // Orange frame, for phrase text
|
||||||
#define FRAME_OFFSET_GREEN 0x4000 // Green frame, for keyboard/word select
|
#define FRAME_OFFSET_GREEN 0x4000 // Green frame, for keyboard/word select
|
||||||
@ -814,7 +826,7 @@ static const struct BgTemplate sEasyChatBgTemplates[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct WindowTemplate sEasyChatWindowTemplates[] = {
|
static const struct WindowTemplate sEasyChatWindowTemplates[] = {
|
||||||
{
|
[WIN_TITLE] = {
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 6,
|
.tilemapLeft = 6,
|
||||||
.tilemapTop = 0,
|
.tilemapTop = 0,
|
||||||
@ -823,7 +835,7 @@ static const struct WindowTemplate sEasyChatWindowTemplates[] = {
|
|||||||
.paletteNum = 10,
|
.paletteNum = 10,
|
||||||
.baseBlock = 0x10,
|
.baseBlock = 0x10,
|
||||||
},
|
},
|
||||||
{
|
[WIN_MSG] = {
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 3,
|
.tilemapLeft = 3,
|
||||||
.tilemapTop = 15,
|
.tilemapTop = 15,
|
||||||
@ -832,7 +844,7 @@ static const struct WindowTemplate sEasyChatWindowTemplates[] = {
|
|||||||
.paletteNum = 15,
|
.paletteNum = 15,
|
||||||
.baseBlock = 0xA,
|
.baseBlock = 0xA,
|
||||||
},
|
},
|
||||||
{
|
[WIN_INPUT_SELECT] = {
|
||||||
.bg = 2,
|
.bg = 2,
|
||||||
.tilemapLeft = 1,
|
.tilemapLeft = 1,
|
||||||
.tilemapTop = 0,
|
.tilemapTop = 0,
|
||||||
@ -3934,10 +3946,10 @@ static void PrintTitle(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
xOffset = GetStringCenterAlignXOffset(FONT_NORMAL, titleText, 144);
|
xOffset = GetStringCenterAlignXOffset(FONT_NORMAL, titleText, 144);
|
||||||
FillWindowPixelBuffer(0, PIXEL_FILL(0));
|
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(0));
|
||||||
PrintEasyChatTextWithColors(0, FONT_NORMAL, titleText, xOffset, 1, TEXT_SKIP_DRAW, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
|
PrintEasyChatTextWithColors(WIN_TITLE, FONT_NORMAL, titleText, xOffset, 1, TEXT_SKIP_DRAW, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
|
||||||
PutWindowTilemap(0);
|
PutWindowTilemap(WIN_TITLE);
|
||||||
CopyWindowToVram(0, COPYWIN_FULL);
|
CopyWindowToVram(WIN_TITLE, COPYWIN_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintEasyChatText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
static void PrintEasyChatText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||||
@ -3957,10 +3969,10 @@ static void PrintEasyChatTextWithColors(u8 windowId, u8 fontId, const u8 *str, u
|
|||||||
static void PrintInitialInstructions(void)
|
static void PrintInitialInstructions(void)
|
||||||
{
|
{
|
||||||
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
|
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
|
||||||
LoadUserWindowBorderGfx(1, 1, 0xE0);
|
LoadUserWindowBorderGfx(WIN_MSG, 1, 0xE0);
|
||||||
DrawTextBorderOuter(1, 1, 14);
|
DrawTextBorderOuter(WIN_MSG, 1, 14);
|
||||||
PrintEasyChatStdMessage(MSG_INSTRUCTIONS);
|
PrintEasyChatStdMessage(MSG_INSTRUCTIONS);
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(WIN_MSG);
|
||||||
CopyBgTilemapBufferToVram(0);
|
CopyBgTilemapBufferToVram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4004,14 +4016,14 @@ static void PrintEasyChatStdMessage(u8 msgId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
FillWindowPixelBuffer(WIN_MSG, PIXEL_FILL(1));
|
||||||
if (text1)
|
if (text1)
|
||||||
PrintEasyChatText(1, FONT_NORMAL, text1, 0, 1, TEXT_SKIP_DRAW, 0);
|
PrintEasyChatText(WIN_MSG, FONT_NORMAL, text1, 0, 1, TEXT_SKIP_DRAW, 0);
|
||||||
|
|
||||||
if (text2)
|
if (text2)
|
||||||
PrintEasyChatText(1, FONT_NORMAL, text2, 0, 17, TEXT_SKIP_DRAW, 0);
|
PrintEasyChatText(WIN_MSG, FONT_NORMAL, text2, 0, 17, TEXT_SKIP_DRAW, 0);
|
||||||
|
|
||||||
CopyWindowToVram(1, COPYWIN_FULL);
|
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateEasyChatYesNoMenu(u8 initialCursorPos)
|
static void CreateEasyChatYesNoMenu(u8 initialCursorPos)
|
||||||
@ -4198,14 +4210,14 @@ static void AdjustBgTilemapForFooter(void)
|
|||||||
|
|
||||||
static void DrawLowerWindow(void)
|
static void DrawLowerWindow(void)
|
||||||
{
|
{
|
||||||
PutWindowTilemap(2);
|
PutWindowTilemap(WIN_INPUT_SELECT);
|
||||||
CopyBgTilemapBufferToVram(2);
|
CopyBgTilemapBufferToVram(WIN_INPUT_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitLowerWindowText(u32 whichText)
|
static void InitLowerWindowText(u32 whichText)
|
||||||
{
|
{
|
||||||
ResetLowerWindowScroll();
|
ResetLowerWindowScroll();
|
||||||
FillWindowPixelBuffer(2, PIXEL_FILL(1));
|
FillWindowPixelBuffer(WIN_INPUT_SELECT, PIXEL_FILL(1));
|
||||||
switch (whichText)
|
switch (whichText)
|
||||||
{
|
{
|
||||||
case TEXT_GROUPS:
|
case TEXT_GROUPS:
|
||||||
@ -4219,7 +4231,7 @@ static void InitLowerWindowText(u32 whichText)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyWindowToVram(2, COPYWIN_GFX);
|
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintKeyboardText(void)
|
static void PrintKeyboardText(void)
|
||||||
@ -4248,7 +4260,7 @@ static void PrintKeyboardGroupNames(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintEasyChatText(2, FONT_NORMAL, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SKIP_DRAW, NULL);
|
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SKIP_DRAW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
y += 16;
|
y += 16;
|
||||||
@ -4260,7 +4272,7 @@ static void PrintKeyboardAlphabet(void)
|
|||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardAlphabet); i++)
|
for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardAlphabet); i++)
|
||||||
PrintEasyChatText(2, FONT_NORMAL, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SKIP_DRAW, NULL);
|
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SKIP_DRAW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintInitialWordSelectText(void)
|
static void PrintInitialWordSelectText(void)
|
||||||
@ -4331,16 +4343,16 @@ static void PrintWordSelectText(u8 scrollOffset, u8 numRows)
|
|||||||
{
|
{
|
||||||
CopyEasyChatWordPadded(sScreenControl->wordSelectPrintBuffer, easyChatWord, 0);
|
CopyEasyChatWordPadded(sScreenControl->wordSelectPrintBuffer, easyChatWord, 0);
|
||||||
if (!DummyWordCheck(easyChatWord))
|
if (!DummyWordCheck(easyChatWord))
|
||||||
PrintEasyChatText(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, NULL);
|
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, NULL);
|
||||||
else // Never reached
|
else // Never reached
|
||||||
PrintEasyChatTextWithColors(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY);
|
PrintEasyChatTextWithColors(WIN_INPUT_SELECT, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y += 16;
|
y += 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyWindowToVram(2, COPYWIN_GFX);
|
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EraseWordSelectRows(u8 scrollOffset, u8 numRows)
|
static void EraseWordSelectRows(u8 scrollOffset, u8 numRows)
|
||||||
@ -4364,15 +4376,15 @@ static void EraseWordSelectRows(u8 scrollOffset, u8 numRows)
|
|||||||
var1 = 0;
|
var1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FillWindowPixelRect(2, PIXEL_FILL(1), 0, y, 224, var2);
|
FillWindowPixelRect(WIN_INPUT_SELECT, PIXEL_FILL(1), 0, y, 224, var2);
|
||||||
if (var1)
|
if (var1)
|
||||||
FillWindowPixelRect(2, PIXEL_FILL(1), 0, 0, 224, var1);
|
FillWindowPixelRect(WIN_INPUT_SELECT, PIXEL_FILL(1), 0, 0, 224, var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearWordSelectWindow(void)
|
static void ClearWordSelectWindow(void)
|
||||||
{
|
{
|
||||||
FillWindowPixelBuffer(2, PIXEL_FILL(1));
|
FillWindowPixelBuffer(WIN_INPUT_SELECT, PIXEL_FILL(1));
|
||||||
CopyWindowToVram(2, COPYWIN_GFX);
|
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitLowerWindowAnim(int winAnimType)
|
static void InitLowerWindowAnim(int winAnimType)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user