Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
name_entry.h
Go to the documentation of this file.
1#ifndef NAME_ENTRY_H
2#define NAME_ENTRY_H
3
4/*
5 * The on-screen keyboard that the overlays use to type a name (STCRDDEK's
6 * deck names, for example). The name is kept as maxLength full-width
7 * Shift-JIS characters, padded with spaces. STCRDDEK, STPLNMET and STDGNAME
8 * each have a copy of its code, from src/shared/name_entry/; the
9 * overlay's header defines, before including this one, OVL_NAME,
10 * NAME_ENTRY_HAS_UNUSED98 and NAME_ENTRY_HAS_HIDE (see NameEntry), and
11 * NAME_ENTRY_SPRITES and NAME_ENTRY_FILE_KEYBOARD, its sprite bank and its
12 * archive of the keyboard's images.
13 */
14
15#include "engine/game.h"
16
17#define SJIS_SPACE 0x4081 /* full-width space, 0x81 0x40 */
18
19/* The keyboard's special keys: row * 15 + column of their first cell */
20#define NAME_KEY_DELETE 0x46 /* row 4: clears the character (the one before on a space) */
21#define NAME_KEY_SPACE 0x55 /* row 5 */
22#define NAME_KEY_LEFT 0x64 /* row 6: moves the cursor */
23#define NAME_KEY_RIGHT 0x65
24#define NAME_KEY_END 0x67 /* row 6, column 13: where Start goes */
25
26/*
27 * The Japanese keyboard (three pages) is for language 0 of the European
28 * version, the Japanese version's only one; the USA version only has the
29 * one page.
30 */
31#if VERSION_US
32#define NAME_ENTRY_JAPANESE 0
33#elif VERSION_EU || VERSION_JP
34#define NAME_ENTRY_JAPANESE (LANGUAGE == 0)
35#endif
36
37/* A sprite of the keyboard drawn per language, one after the other (USA: the first) */
38#if VERSION_US
39#define NAME_ENTRY_TEXT_SPRITE(sprite) ((sprite) + 1)
40#elif VERSION_EU || VERSION_JP
41#define NAME_ENTRY_TEXT_SPRITE(sprite) (LANGUAGE + (sprite))
42#endif
43
44/* A key of the keyboard bigger than one cell: its sprite and where it goes */
45typedef struct BigKey {
46 /* 0x0 */ s32 sprite;
47 /* 0x4 */ s32 x;
48 /* 0x8 */ s32 y;
49} BigKey;
50
51/* A keyboard cell: 1 starts a key, 0 is empty and negative cells belong to a wide key */
52typedef struct NameKey {
53 /* 0x0 */ s8 kind;
54 /* 0x1 */ u8 code;
55} NameKey;
56
57/* A page of the keyboard: 7 rows of 15 cells */
58typedef struct KeyPage {
59 /* 0x0 */ NameKey cells[7][15];
60} KeyPage;
61
62/* The texts of a keyboard page's three tabs */
63typedef struct KeyTabs {
64 /* 0x0 */ s32 texts[3];
65} KeyTabs;
66
67/* The character pages of the keyboard (as STDGNAME's and STPLNMET's) */
68typedef struct NameKeyboard {
69 /* 0x0 */ s32 pageCount;
70 /* 0x4 */ KeyTabs *tabTexts; /* one per page */
71 /* 0x8 */ KeyPage *pages;
73
74typedef struct NameEntryWindows {
75 /* 0x00 */ TextWindow *title;
76 /* 0x04 */ TextWindow *name;
77 /* 0x08 */ TextWindow *tabs[3];
78 /* 0x14 */ TextWindow *unused14[3]; /* nothing creates or reads them */
79 /* 0x20 */ TextWindow *leftLabel;
81 /* 0x28 */ TextWindow *l1Label;
82 /* 0x2C */ TextWindow *r1Label;
83 /* 0x30 */ TextWindow *message;
85
86/*
87 * A name entry: the keyboard, the name typed so far and the panels that
88 * open and close. STDGNAME's has a word more at 0x98, which moves what
89 * follows by 4, and STPLNMET's a hide method before close: the including
90 * overlay says so with NAME_ENTRY_HAS_UNUSED98 and NAME_ENTRY_HAS_HIDE (0
91 * or 1). The offsets are STCRDDEK's. With three layouts, each overlay's
92 * copy has a tag of its own (STCRDDEK_NameEntry, ...).
93 */
94typedef struct OVL_NAME(NameEntry) NameEntry;
95struct OVL_NAME(NameEntry) {
97 /* 0x50 */ s32 mode;
98 /* 0x54 */ s32 layer;
99 /* 0x58 */ s32 depth;
100 /* 0x5C */ s32 vramX; /* where the keyboard's images go in VRAM */
101 /* 0x60 */ s32 vramY;
102 /* 0x64 */ s32 partner; /* -1: none */
103 /* 0x68 */ s32 partnerFrame;
104 /* 0x6C */ s32 partnerTime;
105 /* 0x70 */ s32 clutRow;
106 /* 0x74 */ s32 clutTime;
107 /* 0x78 */ u16 name[12];
108 /* 0x90 */ s32 cursor;
109 /* 0x94 */ s32 maxLength;
110#if NAME_ENTRY_HAS_UNUSED98
111 /* 0x98 */ s32 unused98; /* nothing reads or writes it */
112#endif
113 /* 0x98 */ s32 column;
114 /* 0x9C */ s32 row;
115 /* 0xA0 */ s32 keyFrame;
116 /* 0xA4 */ s32 keyTime;
117 /* 0xA8 */ s32 active;
118 /* 0xAC */ s32 page;
119 /* 0xB0 */ s32 arrowFrame;
120 /* 0xB4 */ s32 arrowTime;
121 /* 0xB8 */ s32 unusedB8; /* nothing reads or writes it */
122 /* 0xBC */ PanelAnim unusedBC; /* given a duration of 10, as the two below, and never run */
125 /* 0xEC */ void (*getName)(NameEntry *task, char *out);
126#if NAME_ENTRY_HAS_HIDE
127 /* 0xF0 */ void (*hide)(NameEntry *task, s32 hide);
128#endif
129 /* 0xF0 */ void (*close)(NameEntry *task);
130};
131
132#endif /* NAME_ENTRY_H */
#define OVL_NAME(name)
The name of this overlay's copy of a function of src/shared/.
Definition battle_mode.h:26
signed int s32
Definition common.h:11
signed char s8
Definition common.h:7
unsigned short u16
Definition common.h:10
unsigned char u8
Definition common.h:8
#define TASK_HEADER(Type)
Definition task.h:39
long close(long fd)
void getName(NameEntry *task, char *out)
Writes the name typed, without its leading and trailing spaces, back in half-width characters.
Definition get_name.inc.c:3
A key of the keyboard bigger than one cell: its sprite and where it goes.
Definition name_entry.h:45
s32 sprite
Definition name_entry.h:46
s32 y
Definition name_entry.h:48
s32 x
Definition name_entry.h:47
A page of the keyboard: 7 rows of 15 cells.
Definition name_entry.h:58
NameKey cells[7][15]
Definition name_entry.h:59
The texts of a keyboard page's three tabs.
Definition name_entry.h:63
s32 texts[3]
Definition name_entry.h:64
TextWindow * unused14[3]
nothing creates or reads them
Definition name_entry.h:78
TextWindow * title
Definition name_entry.h:75
TextWindow * tabs[3]
Definition name_entry.h:77
TextWindow * rightLabel
Definition name_entry.h:80
TextWindow * name
Definition name_entry.h:76
TextWindow * r1Label
Definition name_entry.h:82
TextWindow * l1Label
Definition name_entry.h:81
TextWindow * message
Definition name_entry.h:83
TextWindow * leftLabel
Definition name_entry.h:79
A name entry: the keyboard, the name typed so far and the panels that open and close.
Definition name_entry.h:95
s32 partnerFrame
Definition name_entry.h:103
PanelAnim messageScale
Definition name_entry.h:124
PanelAnim unusedBC
Definition name_entry.h:122
PanelAnim keyboardScale
Definition name_entry.h:123
s32 maxLength
Definition name_entry.h:109
s32 arrowTime
Definition name_entry.h:120
s32 partnerTime
Definition name_entry.h:104
s32 arrowFrame
Definition name_entry.h:119
A keyboard cell: 1 starts a key, 0 is empty and negative cells belong to a wide key.
Definition name_entry.h:52
The character pages of the keyboard (as STDGNAME's and STPLNMET's)
Definition name_entry.h:68
KeyTabs * tabTexts
one per page
Definition name_entry.h:70
KeyPage * pages
Definition name_entry.h:71
Opens or closes a menu panel: level goes 0 -> ONE in duration frames (or back at twice the speed),...
Definition menu.h:18
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
Definition text.h:131