Start documenting naming screen

This commit is contained in:
GriffinR 2020-08-07 02:00:41 -04:00
parent 4aed5b078a
commit 463d79c7c1
20 changed files with 832 additions and 741 deletions

View File

Before

Width:  |  Height:  |  Size: 89 B

After

Width:  |  Height:  |  Size: 89 B

View File

@ -102,6 +102,7 @@
#define TEST_BUTTON(field, button) ({(field) & (button);})
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)
#define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
#define JOY_REPEAT(button) TEST_BUTTON(gMain.newAndRepeatedKeys, button)
#define S16TOPOSFLOAT(val) \
({ \

View File

@ -4074,11 +4074,11 @@ extern const u8 gUnknown_08DD4620[];
extern const u8 gUnknown_08DD46E0[];
extern const u8 gUnknown_08DD47A0[];
extern const u8 gNamingScreenRWindow_Gfx[];
extern const u8 gNamingScreenKeyboardButton_Gfx[];
extern const u8 gNamingScreenPageButton_Gfx[];
extern const u8 gNamingScreenROptions_Gfx[];
extern const u8 gNamingScreenCursor_Gfx[];
extern const u8 gNamingScreenRightPointingTriangleTiles[];
extern const u8 gNamingScreenUnderscoreTiles[];
extern const u8 gNamingScreenInputArrow_Gfx[];
extern const u8 gNamingScreenUnderscore_Gfx[];
extern const u32 gUnknown_08D9BA44[];

View File

@ -3,91 +3,14 @@
#include "main.h"
#define KBEVENT_NONE 0
#define KBEVENT_PRESSED_A 5
#define KBEVENT_PRESSED_B 6
#define KBEVENT_PRESSED_SELECT 8
#define KBEVENT_PRESSED_START 9
#define KBROW_COUNT 4
enum
{
KBPAGE_LETTERS_LOWER,
KBPAGE_LETTERS_UPPER,
KBPAGE_SYMBOLS,
KBPAGE_COUNT,
};
enum
{
enum {
NAMING_SCREEN_PLAYER,
NAMING_SCREEN_BOX,
NAMING_SCREEN_CAUGHT_MON,
NAMING_SCREEN_3,
NAMING_SCREEN_NICKNAME,
NAMING_SCREEN_WALDA,
};
struct NamingScreenTemplate
{
u8 copyExistingString;
u8 maxChars;
u8 iconFunction;
u8 addGenderIcon;
u8 initialPage;
u8 unused;
const u8 *title;
};
struct NamingScreenData {
/*0x0*/ u8 tilemapBuffer1[0x800];
/*0x800*/ u8 tilemapBuffer2[0x800];
/*0x800*/ u8 tilemapBuffer3[0x800];
/*0x1800*/ u8 textBuffer[0x10];
/*0x1810*/ u8 tileBuffer[0x600];
/*0x1E10*/ u8 state;
/*0x1E11*/ u8 windows[5];
/*0x1E16*/ u16 inputCharBaseXPos;
/*0x1E18*/ u16 bg1vOffset;
/*0x1E1A*/ u16 bg2vOffset;
/*0x1E1C*/ u16 bg1Priority;
/*0x1E1E*/ u16 bg2Priority;
/*0x1E20*/ u8 bgToReveal;
/*0x1E21*/ u8 bgToHide;
/*0x1E22*/ u8 currentPage;
/*0x1E23*/ u8 cursorSpriteId;
/*0x1E24*/ u8 selectBtnFrameSpriteId;
/*0x1E25*/ u8 keyRepeatStartDelayCopy;
/*0x1E28*/ const struct NamingScreenTemplate *template;
/*0x1E2C*/ u8 templateNum;
/*0x1E30*/ u8 *destBuffer;
/*0x1E34*/ u16 monSpecies;
/*0x1E36*/ u16 monGender;
/*0x1E38*/ u32 monPersonality;
/*0x1E3C*/ MainCallback returnCallback;
};
enum
{
MAIN_STATE_BEGIN_FADE_IN,
MAIN_STATE_WAIT_FADE_IN,
MAIN_STATE_HANDLE_INPUT,
MAIN_STATE_MOVE_TO_OK_BUTTON,
MAIN_STATE_START_PAGE_SWAP,
MAIN_STATE_WAIT_PAGE_SWAP,
MAIN_STATE_6,
MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE,
MAIN_STATE_BEGIN_FADE_OUT,
};
enum
{
INPUT_STATE_DISABLED,
INPUT_STATE_ENABLED,
INPUT_STATE_2,
};
void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback);
#endif // GUARD_NAMING_SCREEN_H

View File

@ -20,7 +20,7 @@ void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset);
void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum);
void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum);
void rbox_fill_rectangle(u8 windowId);
const u16 *stdpal_get(u8 id);
const u16 *GetTextWindowPalette(u8 id);
const u16 *GetOverworldTextboxPalettePtr(void);
void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset);

View File

@ -494,7 +494,7 @@ static void CB2_ShowTrainerHillRecords(void)
break;
case 3:
LoadTrainerHillRecordsWindowGfx(3);
LoadPalette(stdpal_get(0), 0xF0, 0x20);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
gMain.state++;
break;
case 4:

View File

@ -4657,7 +4657,7 @@ static bool32 sub_802A8E8(void)
return FALSE;
break;
case 5:
LoadPalette(stdpal_get(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
break;
default:
gUnknown_02022CF8->unk3018 = 0;

View File

@ -672,7 +672,7 @@ static void CB2_EggHatch_1(void)
species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES);
gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyID]);
personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_PERSONALITY, 0);
DoNamingScreen(3, gStringVar3, species, gender, personality, EggHatchSetMonNickname);
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar3, species, gender, personality, EggHatchSetMonNickname);
break;
case 1:
case -1:

View File

@ -735,7 +735,7 @@ static bool32 InitFrontierPass(void)
case 8:
LoadPalette(gUnknown_08DE07C8[0], 0, 0x1A0);
LoadPalette(gUnknown_08DE07C8[1 + sPassData->trainerStars], 0x10, 0x20);
LoadPalette(stdpal_get(0), 0xF0, 0x20);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
sub_80C629C();
sub_80C6104(sPassData->cursorArea, sPassData->previousCursorArea);
if (sPassData->unkE == 1 || sPassData->unkE == 2)
@ -1378,7 +1378,7 @@ static bool32 InitFrontierMap(void)
if (FreeTempTileDataBuffersIfPossible())
return FALSE;
LoadPalette(gUnknown_08DE07C8[0], 0, 0x1A0);
LoadPalette(stdpal_get(0), 0xF0, 0x20);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
CopyToBgTilemapBuffer(2, gUnknown_08570E00, 0, 0);
CopyBgTilemapBufferToVram(2);
break;

View File

@ -1435,10 +1435,9 @@ const u32 gNamingScreenMenu_Gfx[] = INCBIN_U32("graphics/naming_screen/menu.4bpp
const u8 gNamingScreenRWindow_Gfx[] = INCBIN_U8("graphics/naming_screen/rwindow.4bpp");
const u8 gNamingScreenROptions_Gfx[] = INCBIN_U8("graphics/naming_screen/roptions.4bpp");
const u8 gNamingScreenCursor_Gfx[] = INCBIN_U8("graphics/naming_screen/cursor.4bpp");
const u8 gNamingScreenKeyboardButton_Gfx[] = INCBIN_U8("graphics/naming_screen/keyboard_button.4bpp");
const u8 gNamingScreenRightPointingTriangleTiles[] = INCBIN_U8("graphics/naming_screen/right_pointing_triangle.4bpp");
const u8 gNamingScreenUnderscoreTiles[] = INCBIN_U8("graphics/naming_screen/underscore.4bpp");
const u8 gNamingScreenPageButton_Gfx[] = INCBIN_U8("graphics/naming_screen/page_button.4bpp");
const u8 gNamingScreenInputArrow_Gfx[] = INCBIN_U8("graphics/naming_screen/right_pointing_triangle.4bpp");
const u8 gNamingScreenUnderscore_Gfx[] = INCBIN_U8("graphics/naming_screen/underscore.4bpp");
const u32 gUnknown_08DD4544[] = INCBIN_U32("graphics/unknown/unknown_DD4544.bin.lz");
const u32 gUnknown_08DD4620[] = INCBIN_U32("graphics/unknown/unknown_DD4620.bin.lz");

View File

@ -702,7 +702,7 @@ static void Task_Hof_DisplayPlayer(u8 taskId)
gTasks[taskId].tPlayerSpriteID = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId_Debug(gSaveBlock2Ptr->playerGender, TRUE), 1, 120, 72, 6, 0xFFFF);
AddWindow(&sHof_WindowTemplate);
LoadWindowGfx(1, gSaveBlock2Ptr->optionsWindowFrameType, 0x21D, 0xD0);
LoadPalette(stdpal_get(1), 0xE0, 0x20);
LoadPalette(GetTextWindowPalette(1), 0xE0, 0x20);
gTasks[taskId].tFrameCount = 120;
gTasks[taskId].func = Task_Hof_WaitAndPrintPlayerInfo;
}

View File

@ -1609,7 +1609,7 @@ static void Task_NewGameBirchSpeech_StartNamingScreen(u8 taskId)
FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20);
DestroyTask(taskId);
DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen);
DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen);
}
}

View File

@ -208,7 +208,7 @@ s32 FadeToWonderCardMenu(void)
case 3:
if (FreeTempTileDataBuffersIfPossible())
return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20);
LoadPalette(GetTextWindowPalette(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderCardData->unk_0170->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderCardData->unk_0170->map, sWonderCardData->buffer_045C);
@ -607,7 +607,7 @@ s32 FadeToWonderNewsMenu(void)
case 3:
if (FreeTempTileDataBuffersIfPossible())
return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20);
LoadPalette(GetTextWindowPalette(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderNewsData->unk_01BC->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderNewsData->unk_01BC->map, sWonderNewsData->buffer_03A4);

View File

@ -410,7 +410,7 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader)
break;
case 1:
LoadPalette(gUnkTextboxBorderPal, 0, 0x20);
LoadPalette(stdpal_get(2), 0xd0, 0x20);
LoadPalette(GetTextWindowPalette(2), 0xd0, 0x20);
Menu_LoadStdPalAt(0xC0);
LoadUserWindowBorderGfx(0, 0xA, 0xE0);
LoadUserWindowBorderGfx_(0, 0x1, 0xF0);

File diff suppressed because it is too large Load Diff

View File

@ -8097,7 +8097,7 @@ static bool8 sub_80D0344(void)
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_80CFE84();
LoadPalette(stdpal_get(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
ShowBg(0);
return FALSE;
}
@ -8203,7 +8203,7 @@ static bool8 sub_80D04C8(void)
case 3:
if (!IsDma3ManagerBusyWithBgCopy())
{
LoadPalette(stdpal_get(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
sub_80CFE84();
ShowBg(0);
return FALSE;

View File

@ -49,7 +49,7 @@ static const u16 sTextWindowFrame18_Pal[] = INCBIN_U16("graphics/text_window/18.
static const u16 sTextWindowFrame19_Pal[] = INCBIN_U16("graphics/text_window/19.gbapal");
static const u16 sTextWindowFrame20_Pal[] = INCBIN_U16("graphics/text_window/20.gbapal");
static const u16 sUnknown_0851017C[][16] =
static const u16 sTextWindowPalettes[][16] =
{
INCBIN_U16("graphics/text_window/message_box.gbapal"),
INCBIN_U16("graphics/text_window/text_pal1.gbapal"),
@ -160,7 +160,7 @@ void rbox_fill_rectangle(u8 windowId)
FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11);
}
const u16 *stdpal_get(u8 id)
const u16 *GetTextWindowPalette(u8 id)
{
switch (id)
{
@ -182,7 +182,7 @@ const u16 *stdpal_get(u8 id)
break;
}
return (const u16 *)(sUnknown_0851017C) + id;
return (const u16 *)(sTextWindowPalettes) + id;
}
const u16 *GetOverworldTextboxPalettePtr(void)

View File

@ -3442,7 +3442,7 @@ void ChangePokemonNickname(void)
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
DoNamingScreen(3, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL), GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL), ChangePokemonNickname_CB);
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL), GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL), ChangePokemonNickname_CB);
}
void ChangePokemonNickname_CB(void)
@ -3458,7 +3458,7 @@ void ChangeBoxPokemonNickname(void)
boxMon = GetBoxedMonPtr(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos);
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar3);
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar2);
DoNamingScreen(3, gStringVar2, GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL), GetBoxMonGender(boxMon), GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), ChangeBoxPokemonNickname_CB);
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL), GetBoxMonGender(boxMon), GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), ChangeBoxPokemonNickname_CB);
}
void ChangeBoxPokemonNickname_CB(void)