Skip to Content
The Alchemy Project

src/window/screens_name_entry.c

The name entry screen, where the player names a party member on a keyboard of letters, with a DEL key that takes back the last letter and an END key that keeps the name. More…

Included by screens.c.

Macros

NameDescription
#defineIS_KANA_MARK (c)A dakuten or handakuten, which joins the kana before it and is no letter of its own.
#defineNAME_VOICED_KEY 254The keyboard's keys for the kana voicing marks (TEXT_MARK_VOICED and TEXT_MARK_SEMIVOICED), as its tilemap's low bytes hold them.
#defineNAME_SEMIVOICED_KEY 255
#defineNAME_MAX_BYTES 14A name's room in bytes and in letters, and the keyboard column of its commands.
#defineNAME_MAX_LETTERS 5
#defineNAME_COMMAND_COLUMN 18
#defineNAME_LAST_LETTER_COLUMN (NAME_COMMAND_COLUMN - 2)The last column of letters, before the gap and the commands.
#defineNAME_IS_GAP_COLUMN (column)The empty columns between the keyboard's groups of letters.
#defineNAME_KEYBOARD_HEIGHT JAPANESE_OR(13, 9)The Japanese keyboard is a kana grid of eleven rows with a blank row in its middle, and its command column has a third key, at the top, that turns to the other kana page.
#defineNAME_DIVIDER_BOTTOM JAPANESE_OR(12, 7)
#defineNAME_KEY_CURSOR_Y JAPANESE_OR(92, 52)
#defineNAME_DELETE_ROW JAPANESE_OR(8, 4)
#defineNAME_END_ROW JAPANESE_OR(10, 5)
#defineNAME_PAGE_ROW 0
#defineNAME_BLANK_ROW 5
#defineNAME_LAST_ROW NAME_END_ROW
#defineNAME_LABEL_WIDTH SPANISH_OR(9, 8)The width of the window showing the name, in tiles.
#defineNAME_KEY_LABELS 1
#defineNAME_END_KEY_WIDTH BY_LANGUAGE(3, 3, 4, 3, 3, 4)
#defineNAME_ENTRY_DRAW (window, name)
#defineNAME_CARET_X (name) (72 + mnNameEntryCountLetters(name) * 10)
#defineNAME_IS_COMMAND_ROW (row)

Functions

NameDescription
BoolmnNameEntryAcceptsMark (Sint32 letter, Sint32 prev)Returns whether letter may follow prev in a name: any character but a voicing mark may, and a voicing mark only after a kana in its table of ranges (pairs of first and last kana, ended by 0).
Sint32mnNameEntryCountLetters (const Uint8 *name)Returns how many letters name has, not counting its voicing marks.
Sint32mnNameEntryAcceptsAnyLetter (void)Unused: mnNameEntryAcceptsMark's place in the editions whose letters take no marks, which accepts every letter.
voidmnWindowCopyTilemapRegion (WINDOW *window, const void *resource)Decompresses a tilemap, such as the name entry's keyboard, and copies it over the window's rectangle, into the BG map in VRAM and the window state's copy of it.
Sint32mnPointingHandLoadIntoFreeSlot (void)Loads the pointing hand cursor's tiles into a free VRAM slot and returns the slot, which the caller frees with syVRAMCacheFreeEntry.
voidmnPointingHandLoadIntoSlot (Sint32 slot)Loads the pointing hand's tiles into VRAM cache entry slot.
voidmnNameCaretLoadIntoSlot (Sint32 slot)Loads the name entry caret's tiles into VRAM cache entry slot.
Sint32mnTextMeasureString (const Uint8 *str)Returns the width of the string str in pixels, measured as decoded text (it is copied into the window state's text buffer).
voidmnNameEntryDrawName (Sint32 window, Uint8 *name)Draws the name being entered, name, at the top left of window, followed in TEXT_COLOR_RED by an underscore for each of the NAME_MAX_LETTERS places still free: the loop fills the text to 7 bytes, the name and the two-byte colour code before the underscores.
Sint32mnNameEntryEditMemberName (Sint32 member)The name entry screen for party member member: the player types a name of up to NAME_MAX_LETTERS letters on the keyboard and keeps it with END (Start jumps there).

Variables

NameDescription
extern const Uint8NameEntryVoicedMarkRanges [](charmap_ja.tsv), ending at 0.
extern const Uint8NameEntrySemivoicedMarkRanges []The kana that take a handakuten, as NameEntryVoicedMarkRanges.
extern const Uint8NameEntryAlternateKeyboardTilemap []The Japanese keyboard's second page of letters, which Select turns to.
extern const Uint8NameEntryDeleteKeyLabel []
extern const Uint8NameEntryEndKeyLabel []

Description

The name entry screen, where the player names a party member on a keyboard of letters, with a DEL key that takes back the last letter and an END key that keeps the name. Part of screens.c.

Macros in detail

IS_KANA_MARK

#define IS_KANA_MARK(c)

A dakuten or handakuten, which joins the kana before it and is no letter of its own.

Referenced by mnNameEntryCountLetters() and mnNameEntryEditMemberName().

Definition at line 7 of file screens_name_entry.c.

NAME_VOICED_KEY

#define NAME_VOICED_KEY 254

The keyboard's keys for the kana voicing marks (TEXT_MARK_VOICED and TEXT_MARK_SEMIVOICED), as its tilemap's low bytes hold them.

Referenced by mnNameEntryEditMemberName().

Definition at line 20 of file screens_name_entry.c.

NAME_SEMIVOICED_KEY

#define NAME_SEMIVOICED_KEY 255

Referenced by mnNameEntryEditMemberName().

Definition at line 21 of file screens_name_entry.c.

NAME_MAX_BYTES

#define NAME_MAX_BYTES 14

A name's room in bytes and in letters, and the keyboard column of its commands.

Referenced by mnNameEntryEditMemberName().

Definition at line 195 of file screens_name_entry.c.

NAME_MAX_LETTERS

#define NAME_MAX_LETTERS 5

Referenced by mnNameEntryEditMemberName().

Definition at line 196 of file screens_name_entry.c.

NAME_COMMAND_COLUMN

#define NAME_COMMAND_COLUMN 18

Referenced by mnNameEntryEditMemberName().

Definition at line 197 of file screens_name_entry.c.

NAME_LAST_LETTER_COLUMN

#define NAME_LAST_LETTER_COLUMN (NAME_COMMAND_COLUMN - 2)

The last column of letters, before the gap and the commands.

Referenced by mnNameEntryEditMemberName().

Definition at line 199 of file screens_name_entry.c.

NAME_IS_GAP_COLUMN

#define NAME_IS_GAP_COLUMN(column)

The empty columns between the keyboard's groups of letters.

Referenced by mnNameEntryEditMemberName().

Definition at line 201 of file screens_name_entry.c.

NAME_KEYBOARD_HEIGHT

#define NAME_KEYBOARD_HEIGHT JAPANESE_OR(13, 9)

The Japanese keyboard is a kana grid of eleven rows with a blank row in its middle, and its command column has a third key, at the top, that turns to the other kana page.

Referenced by mnNameEntryEditMemberName().

Definition at line 207 of file screens_name_entry.c.

NAME_DIVIDER_BOTTOM

#define NAME_DIVIDER_BOTTOM JAPANESE_OR(12, 7)

Referenced by mnNameEntryEditMemberName().

Definition at line 208 of file screens_name_entry.c.

NAME_KEY_CURSOR_Y

#define NAME_KEY_CURSOR_Y JAPANESE_OR(92, 52)

Referenced by mnNameEntryEditMemberName().

Definition at line 209 of file screens_name_entry.c.

NAME_DELETE_ROW

#define NAME_DELETE_ROW JAPANESE_OR(8, 4)

Referenced by mnNameEntryEditMemberName().

Definition at line 210 of file screens_name_entry.c.

NAME_END_ROW

#define NAME_END_ROW JAPANESE_OR(10, 5)

Referenced by mnNameEntryEditMemberName().

Definition at line 211 of file screens_name_entry.c.

NAME_PAGE_ROW

#define NAME_PAGE_ROW 0

Referenced by mnNameEntryEditMemberName().

Definition at line 212 of file screens_name_entry.c.

NAME_BLANK_ROW

#define NAME_BLANK_ROW 5

Referenced by mnNameEntryEditMemberName().

Definition at line 213 of file screens_name_entry.c.

NAME_LAST_ROW

#define NAME_LAST_ROW NAME_END_ROW

Referenced by mnNameEntryEditMemberName().

Definition at line 214 of file screens_name_entry.c.

NAME_LABEL_WIDTH

#define NAME_LABEL_WIDTH SPANISH_OR(9, 8)

The width of the window showing the name, in tiles.

Referenced by mnNameEntryEditMemberName().

Definition at line 217 of file screens_name_entry.c.

NAME_KEY_LABELS

#define NAME_KEY_LABELS 1

#define NAME_KEY_LABELS 0

Definition at lines 223 and 225 of file screens_name_entry.c.

NAME_END_KEY_WIDTH

#define NAME_END_KEY_WIDTH BY_LANGUAGE(3, 3, 4, 3, 3, 4)

Referenced by mnNameEntryEditMemberName().

Definition at line 227 of file screens_name_entry.c.

NAME_ENTRY_DRAW

#define NAME_ENTRY_DRAW(window, name)

Referenced by mnNameEntryEditMemberName().

Definition at lines 245 and 249 of file screens_name_entry.c.

NAME_CARET_X

#define NAME_CARET_X(name) (72 + mnNameEntryCountLetters(name) * 10)

#define NAME_CARET_X(name) (mnTextMeasureString(name) + 70)

Referenced by mnNameEntryEditMemberName().

Definition at lines 247 and 251 of file screens_name_entry.c.

NAME_IS_COMMAND_ROW

#define NAME_IS_COMMAND_ROW(row)

Referenced by mnNameEntryEditMemberName().

Definition at lines 257 and 261 of file screens_name_entry.c.

Functions in detail

mnNameEntryAcceptsMark

Bool mnNameEntryAcceptsMark(Sint32 letter, Sint32 prev)

Returns whether letter may follow prev in a name: any character but a voicing mark may, and a voicing mark only after a kana in its table of ranges (pairs of first and last kana, ended by 0).

References NameEntrySemivoicedMarkRanges, NameEntryVoicedMarkRanges and Sint32.

Referenced by mnNameEntryEditMemberName().

Definition at line 26 of file screens_name_entry.c.

mnNameEntryCountLetters

Sint32 mnNameEntryCountLetters(const Uint8 *name)

Returns how many letters name has, not counting its voicing marks.

References Sint32.

Definition at line 45 of file screens_name_entry.c.

mnNameEntryAcceptsAnyLetter

Sint32 mnNameEntryAcceptsAnyLetter(void)

Unused: mnNameEntryAcceptsMark's place in the editions whose letters take no marks, which accepts every letter.

References Sint32.

Definition at line 60 of file screens_name_entry.c.

mnWindowCopyTilemapRegion

void mnWindowCopyTilemapRegion(WINDOW *window, const void *resource)

Decompresses a tilemap, such as the name entry's keyboard, and copies it over the window's rectangle, into the BG map in VRAM and the window state's copy of it.

References Sint32, syDecompressTaggedLZ(), syHeapAllocateEWRAM() and syHeapRelease().

Referenced by mnNameEntryEditMemberName().

Definition at line 69 of file screens_name_entry.c.

mnPointingHandLoadIntoFreeSlot

Sint32 mnPointingHandLoadIntoFreeSlot(void)

Loads the pointing hand cursor's tiles into a free VRAM slot and returns the slot, which the caller frees with syVRAMCacheFreeEntry.

References mnVRAMBlockLoadResourceStub(), Sint32 and syVRAMCacheFindFreeEntry().

Referenced by mnDebugMenuOpen(), mnDebugShortcutOpen(), mnDebugSoundTestOpen(), mnDebugWarpOpen(), mnPauseMenuOpen() and mnSettingsMenuOpen().

Definition at line 108 of file screens_name_entry.c.

mnPointingHandLoadIntoSlot

void mnPointingHandLoadIntoSlot(Sint32 slot)

Loads the pointing hand's tiles into VRAM cache entry slot.

References mnVRAMBlockLoadResourceStub() and Sint32.

Referenced by scClearEnterPassword().

Definition at line 118 of file screens_name_entry.c.

mnNameCaretLoadIntoSlot

void mnNameCaretLoadIntoSlot(Sint32 slot)

Loads the name entry caret's tiles into VRAM cache entry slot.

References mnVRAMBlockLoadResourceStub() and Sint32.

Referenced by scClearEnterPassword().

Definition at line 124 of file screens_name_entry.c.

mnTextMeasureString

Sint32 mnTextMeasureString(const Uint8 *str)

Returns the width of the string str in pixels, measured as decoded text (it is copied into the window state's text buffer).

References mnTextMeasureDecoded() and Sint32.

Definition at line 133 of file screens_name_entry.c.

mnNameEntryDrawName

void mnNameEntryDrawName(Sint32 window, Uint8 *name)

Draws the name being entered, name, at the top left of window, followed in TEXT_COLOR_RED by an underscore for each of the NAME_MAX_LETTERS places still free: the loop fills the text to 7 bytes, the name and the two-byte colour code before the underscores.

References mnTextDrawString() and Sint32.

Definition at line 163 of file screens_name_entry.c.

mnNameEntryEditMemberName

Sint32 mnNameEntryEditMemberName(Sint32 member)

The name entry screen for party member member: the player types a name of up to NAME_MAX_LETTERS letters on the keyboard and keeps it with END (Start jumps there). B or DEL with no letters left cancels and returns -1; END with no letters keeps the name it had.

The Japanese form enters kana: a dakuten or handakuten joins the kana before it (mnNameEntryAcceptsMark refuses a mark that cannot), takes a byte but is no letter, and goes with it when that kana is removed; Select or the top command key turns to the other kana page, and the cursor steps over the keyboard's blank row. It also returns without waiting for every button to be released, which the later editions added.

References FrameCount, gmUnitGet(), MainRoutineStateWork, mnCursorAdvanceStub(), mnCursorMoveTowardTargetStub(), mnCursorSetPosImmediateStub(), mnCursorSetStub(), mnNameEntryAcceptsMark(), mnPortraitCloseWindow(), mnPortraitOpenWindow(), mnTextDrawStringInWindow(), mnVRAMBlockLoadResourceStub(), mnWindowClose(), mnWindowColorApply(), mnWindowCopyTilemapRegion(), mnWindowCreate(), mnWindowDrawDividerLine(), mnWindowSetTextTileRect(), mnWindowSpriteCreate(), mnWindowSpritePrepareForRedraw(), NameEntryAlternateKeyboardTilemap, NameEntryCaretWave, NameEntryDeleteKeyLabel, NameEntryEndKeyLabel, NameEntryKeyboardTilemap, PerWork, result, Sint32, syDMAXCopy(), sySoundPlayStub(), sySynch(), syVRAMCacheFindFreeEntry() and syWindowLoadGraphics().

Referenced by dbPsynergyTestEditIsaacName(), dbShopTestEditPartyNames(), scClearEnterPassword() and scInit().

Definition at line 276 of file screens_name_entry.c.

Variables in detail

NameEntryAlternateKeyboardTilemap

extern const Uint8 NameEntryAlternateKeyboardTilemap[]

The Japanese keyboard's second page of letters, which Select turns to.

Referenced by mnNameEntryEditMemberName().

Definition at line 231 of file screens_name_entry.c.