Alchemy

name_entry.c

The name entry screen.

games/tbs/src/window/battle_command/name_entry.c on GitHub

The name entry screen. Part of battle_command.c, the menu object, compiled only through it.

Functions

NameEntry_AcceptsMark

UNUSED s32 NameEntry_AcceptsMark(s32 mark, s32 letter)

The international name entry has no voicing marks: where the Japanese edition checks a mark against the letter before it, this edition keeps a function that accepts every character. Nothing calls it.

Used by NameEntry_EditOwnerName.

Line 11

NameEntry_AcceptsMark

s32 NameEntry_AcceptsMark(s32 mark, s32 letter)

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

Used by NameEntry_EditOwnerName.

Line 22

NameEntry_CountLetters

s32 NameEntry_CountLetters(const u8 *name)

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

Used by NameEntry_EditOwnerName.

Line 40

UiWindow_CopyTilemapRegion

void UiWindow_CopyTilemapRegion(const struct UiWindow *window, const void *source)

Decompresses the type-01 tilemap source and copies it over window's rectangle, both into the BG screen block at 0x06002000 and into the UI tilemap that mirrors it.

Used by NameEntry_EditOwnerName.

Line 56

UiWindow_SetTileAttributeRect

void UiWindow_SetTileAttributeRect(const struct UiWindow *window, s32 x, s32 y, s32 width, s32 height, u32 palette)

Like UiWindow_SetTileAttributeBitRect, but ORs all of palette into the palette number of each entry (bits 12-15) after clearing only its lowest bit. On entries of palette 15 or 14 that sets them to palette, 15 or 14: the name entry's key and the Colosso choice under the cursor flash this way.

Used by NameEntry_EditOwnerName, PartyTalkMenu_Choose.

Line 91

Resource_CopyFixedBlockB

void Resource_CopyFixedBlockB(s32 slot)

Loads the pointing hand cursor's tiles into VRAM slot slot.

Line 134

Resource_CopyFixedBlockA

void Resource_CopyFixedBlockA(s32 slot)

Loads the 16x16 sprite gResource_FixedBlockATiles into VRAM slot slot.

Line 139

UiText_SetRenderString

s32 UiText_SetRenderString(const u8 *str)

Puts the string str into the UI's text entries and returns its width in pixels. It overwrites the start of the decoded text ring (UiRenderWork.entries), so any message decoded there is lost; the name entry measures the name with it to place its caret.

Used by NameEntry_EditOwnerName.

Line 155

UiText_DrawPaddedLabel

void UiText_DrawPaddedLabel(struct UiWindow *window, u8 *name)

Draws the name being entered, name, at the top left of window, followed in text colour 2 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.

Used by NameEntry_EditOwnerName.

Line 186

NameEntry_EditOwnerName

s32 NameEntry_EditOwnerName(s32 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 ends with End (or Start, which jumps there). A puts the key under the cursor into the name, B or Delete removes the last letter, and B on an empty name cancels. Ending with an empty name keeps the old one. Returns 0, or -1 when cancelled. The new name is written over the member's unit name only on End. The title's new game (menu/clear.c) and the debug menu reach it.

The keyboard: letter keys in columns 0 to 16, in groups of five with gaps at columns 5, 11 and 17, rows 0 to 5; column 18 holds Delete (row 4) and End (row 5).

Used by DebugMenu_EditIsaacName, SaveMenu_Run.

Line 243

NameEntry_EditOwnerName

s32 NameEntry_EditOwnerName(s32 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 ends with End (or Start, which jumps there). A puts the key under the cursor into the name, B or Delete removes the last letter, and B on an empty name cancels. Ending with an empty name keeps the old one. Returns 0, or -1 when cancelled. A voicing mark joins the letter before it and does not count as a letter.

The keyboard: letter keys in columns 0 to 16, in groups of five with gaps at columns 5, 11 and 17, on rows 0 to 4 and 6 to 10; column 18 holds the keyboard switch (row 0, or Select), Delete (row 8) and End (row 10).

Used by DebugMenu_EditIsaacName, SaveMenu_Run.

Line 518

Macros

TEXT_COLOR_COMMAND

#define TEXT_COLOR_COMMAND 8

The text control code that sets the colour of the text after it, from the byte that follows ({text_color:N} in the message catalogs).

Used by UiText_DrawPaddedLabel.

Line 180

Also, macros without a comment: NAME_VOICED_MARK, NAME_SEMIVOICED_MARK, NAME_COMMAND_COLUMN, NAME_MAX_LETTERS, NAME_MAX_BYTES, NAME_LABEL_WIDTH, NAME_LABEL_WIDTH, NAME_KEY_LABELS, NAME_KEY_LABELS, NAME_END_KEY_WIDTH, NAME_END_KEY_WIDTH.

On this page