Code entry
This commit is contained in:
parent
401df8da4d
commit
996db6d4dc
5 changed files with 41 additions and 0 deletions
|
@ -554,3 +554,5 @@ gSpecials::
|
|||
def_special Script_GetChosenMonOffensiveIVs
|
||||
def_special Script_GetChosenMonDefensiveIVs
|
||||
def_special UseBlankMessageToCancelPokemonPic
|
||||
def_special EnterCode
|
||||
def_special GetCodeFeedback
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
#define TYPE_NAME_LENGTH 8
|
||||
#define ABILITY_NAME_LENGTH 16
|
||||
#define TRAINER_NAME_LENGTH 10
|
||||
#define CODE_NAME_LENGTH 11
|
||||
|
||||
#define MAX_STAMP_CARD_STAMPS 7
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ enum {
|
|||
NAMING_SCREEN_CAUGHT_MON,
|
||||
NAMING_SCREEN_NICKNAME,
|
||||
NAMING_SCREEN_WALDA,
|
||||
NAMING_SCREEN_CODE,
|
||||
};
|
||||
|
||||
void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback);
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "constants/metatile_labels.h"
|
||||
#include "palette.h"
|
||||
#include "battle_util.h"
|
||||
#include "naming_screen.h"
|
||||
|
||||
#define TAG_ITEM_ICON 5500
|
||||
|
||||
|
@ -4344,3 +4345,16 @@ void UseBlankMessageToCancelPokemonPic(void)
|
|||
AddTextPrinterParameterized(0, FONT_NORMAL, &t, 0, 1, 0, NULL);
|
||||
ScriptMenu_HidePokemonPic();
|
||||
}
|
||||
|
||||
void EnterCode(void)
|
||||
{
|
||||
DoNamingScreen(NAMING_SCREEN_CODE, gStringVar2, 0, 0, 0, CB2_ReturnToFieldContinueScript);
|
||||
}
|
||||
void GetCodeFeedback(void)
|
||||
{
|
||||
static const u8 sText_SampleCode[] = _("TestText");
|
||||
if (!StringCompare(gStringVar2, sText_SampleCode))
|
||||
gSpecialVar_Result = 1;
|
||||
else
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
|
|
|
@ -1373,6 +1373,7 @@ static void NamingScreen_CreatePlayerIcon(void);
|
|||
static void NamingScreen_CreatePCIcon(void);
|
||||
static void NamingScreen_CreateMonIcon(void);
|
||||
static void NamingScreen_CreateWaldaDadIcon(void);
|
||||
static void NamingScreen_CreateCodeIcon(void);
|
||||
|
||||
static void (*const sIconFunctions[])(void) =
|
||||
{
|
||||
|
@ -1381,6 +1382,7 @@ static void (*const sIconFunctions[])(void) =
|
|||
NamingScreen_CreatePCIcon,
|
||||
NamingScreen_CreateMonIcon,
|
||||
NamingScreen_CreateWaldaDadIcon,
|
||||
NamingScreen_CreateCodeIcon,
|
||||
};
|
||||
|
||||
static void CreateInputTargetIcon(void)
|
||||
|
@ -1431,6 +1433,13 @@ static void NamingScreen_CreateWaldaDadIcon(void)
|
|||
StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH);
|
||||
}
|
||||
|
||||
static void NamingScreen_CreateCodeIcon(void)
|
||||
{
|
||||
u8 spriteId;
|
||||
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MYSTERY_GIFT_MAN, SpriteCallbackDummy, 56, 37, 0);
|
||||
gSprites[spriteId].oam.priority = 3;
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// Keyboard handling
|
||||
//--------------------------------------------------
|
||||
|
@ -1744,6 +1753,7 @@ static void (*const sDrawTextEntryBoxFuncs[])(void) =
|
|||
[NAMING_SCREEN_CAUGHT_MON] = DrawMonTextEntryBox,
|
||||
[NAMING_SCREEN_NICKNAME] = DrawMonTextEntryBox,
|
||||
[NAMING_SCREEN_WALDA] = DrawNormalTextEntryBox,
|
||||
[NAMING_SCREEN_CODE] = DrawNormalTextEntryBox,
|
||||
};
|
||||
|
||||
static void DrawTextEntryBox(void)
|
||||
|
@ -2146,6 +2156,18 @@ static const struct NamingScreenTemplate sWaldaWordsScreenTemplate =
|
|||
.title = gText_TellHimTheWords,
|
||||
};
|
||||
|
||||
static const u8 sText_EnterCode[] = _("Enter code:");
|
||||
static const struct NamingScreenTemplate sCodeScreenTemplate =
|
||||
{
|
||||
.copyExistingString = FALSE,
|
||||
.maxChars = CODE_NAME_LENGTH,
|
||||
.iconFunction = 5,
|
||||
.addGenderIcon = FALSE,
|
||||
.initialPage = KBPAGE_LETTERS_UPPER,
|
||||
.unused = 35,
|
||||
.title = sText_EnterCode,
|
||||
};
|
||||
|
||||
static const struct NamingScreenTemplate *const sNamingScreenTemplates[] =
|
||||
{
|
||||
[NAMING_SCREEN_PLAYER] = &sPlayerNamingScreenTemplate,
|
||||
|
@ -2153,6 +2175,7 @@ static const struct NamingScreenTemplate *const sNamingScreenTemplates[] =
|
|||
[NAMING_SCREEN_CAUGHT_MON] = &sMonNamingScreenTemplate,
|
||||
[NAMING_SCREEN_NICKNAME] = &sMonNamingScreenTemplate,
|
||||
[NAMING_SCREEN_WALDA] = &sWaldaWordsScreenTemplate,
|
||||
[NAMING_SCREEN_CODE] = &sCodeScreenTemplate,
|
||||
};
|
||||
|
||||
static const struct OamData sOam_8x8 =
|
||||
|
|
Loading…
Reference in a new issue