Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
deck_editor.h
Go to the documentation of this file.
1#ifndef STCRDDEK_H
2#define STCRDDEK_H
3
4/*
5 * STCRDDEK: the deck editor, where the player builds the three decks from
6 * the cards they own and renames them on the keyboard (name_entry.h). Its
7 * modules are in src/cardgame/deck_editor/, and the functions below are by module, in
8 * the order they link.
9 */
10
11/* The name of this overlay's copy of a function or type of src/shared/ */
12#define OVL_NAME(name) STCRDDEK_##name
13
14/* The overlay's NameEntry and the name entry's files (name_entry.h) */
15#define NAME_ENTRY_HAS_UNUSED98 0
16#define NAME_ENTRY_HAS_HIDE 0
17#define NAME_ENTRY_SPRITES STCRDDEK_KEY_SPRITES
18#define NAME_ENTRY_FILE_KEYBOARD STCRDDEK_FILE_KEYBOARD
19#include "shared/name_entry.h"
20
21#if VERSION_US || VERSION_JP
22#define STCRDDEK_FILE_SPRITES 0x62E /* as the card shop's */
23#define STCRDDEK_FILE_IMAGES 0x632
24#define STCRDDEK_FILE_CARDS 0x7E7 /* the card images, the first of five */
25#define STCRDDEK_FILE_KEYBOARD 0x762
26#define STCRDDEK_FILE_KEY_SPRITES 0x761
27#elif VERSION_EU
28#define STCRDDEK_FILE_SPRITES 0x63E
29#define STCRDDEK_FILE_IMAGES 0x642
30#define STCRDDEK_FILE_CARDS 0x7F6
31#define STCRDDEK_FILE_KEYBOARD 0x771
32#define STCRDDEK_FILE_KEY_SPRITES 0x770
33#endif
34#define STCRDDEK_SPRITES (STCRDDEK_FILE_SPRITES << 16) /* sprite bank */
35#define STCRDDEK_IMAGES (STCRDDEK_FILE_IMAGES << 16) /* TIM archive */
36#define STCRDDEK_KEY_SPRITES (STCRDDEK_FILE_KEY_SPRITES << 16) /* the keyboard's and partners' sprites */
37
38/* The screen's helpers */
39typedef struct DeckFuncs {
40 /* 0x00 */ void (*loadFiles)(void);
41 /* 0x04 */ s32 (*filesLoading)(void);
42 /* 0x08 */ void (*startFade)(PanelAnim *fade, s32 fadeIn);
43 /* 0x0C */ s32 (*updateFade)(PanelAnim *fade);
44 /* 0x10 */ void (*startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames);
45 /* 0x14 */ s32 (*updateLerp)(MenuLerp *lerp);
46} DeckFuncs;
47
48/* The deck being edited */
49typedef struct DeckEditor {
51 /* 0x050 */ struct DeckScreen *screen;
52 /* 0x054 */ s32 layer;
53 /* 0x058 */ s32 depth;
54 /* 0x05C */ s32 deck; /* GAME.decks[] */
55 /* 0x060 */ s32 column; /* of the deck's grid, 9 cards a row */
56 /* 0x064 */ s32 row;
57 /* 0x068 */ s32 cursorFrame;
58 /* 0x06C */ s32 cursorTime;
59 /* 0x070 */ s32 cursorShown;
60 /* 0x074 */ s32 listCursor; /* in the list of the cards owned */
61 /* 0x078 */ s32 listTop;
62 /* 0x07C */ s32 listCount;
63 /* 0x080 */ s32 arrowsShown;
64 /* 0x084 */ s32 arrowTime;
65 /* 0x088 */ s16 list[315]; /* the cards owned and not in the deck */
66 /* 0x2FE */ s8 owned[315]; /* how many of each card are not in the deck */
67 /* 0x43C */ s32 infoShown; /* the card's info panel */
68 /* 0x440 */ s32 blinkTime;
69 /* 0x444 */ PanelAnim panels[5];
71
72/* A line of the list of the cards owned */
73typedef struct CardLine {
74 /* 0x0 */ TextWindow *name;
75 /* 0x4 */ TextWindow *label;
76 /* 0x8 */ TextWindow *count;
77} CardLine;
78
79typedef struct DeckEditorChildren {
80 /* 0x00 */ TextWindow *title;
81 /* 0x04 */ TextWindow *hint;
82 /* 0x08 */ TextWindow *deckName;
83 /* 0x0C */ TextWindow *kinds[6];
84 /* 0x24 */ TextWindow *cardName;
86 /* 0x2C */ TextWindow *points;
87 /* 0x30 */ TextWindow *apLabel;
88 /* 0x34 */ TextWindow *ap;
89 /* 0x38 */ TextWindow *hpLabel;
90 /* 0x3C */ TextWindow *hp;
91 /* 0x40 */ TextWindow *effect;
96 /* 0x54 */ TextWindow *listAp;
98 /* 0x5C */ TextWindow *listHp;
100 /* 0x64 */ CardLine lines[8];
101 /* 0xC4 */ Cursor *cursor;
102 /* 0xC8 */ TextWindow *message;
103 /* 0xCC */ struct DeckCards *cards;
104 /* 0xD0 */ ScrollBar *scrollBar;
106
107/* Draws the deck's cards, appearing one per frame */
108typedef struct DeckCards {
110 /* 0x50 */ DeckEditor *editor;
111 /* 0x54 */ s32 layer;
112 /* 0x58 */ s32 depth;
113 /* 0x5C */ s32 count; /* cards shown so far */
114 /* 0x60 */ u8 pad[0x10]; /* never read or written: createTask allocates 0x70 bytes */
115} DeckCards;
116
117/* A task that waits for triangle; nothing creates it */
118typedef struct DeckIdle {
120 /* 0x50 */ void *parent;
121 /* 0x54 */ s32 layer;
122 /* 0x58 */ s32 depth;
123 /* 0x5C */ u8 pad[0x10]; /* never read or written: createTask allocates 0x6C bytes */
124} DeckIdle;
125
126/* A deck's row on the screen: its name and how many cards of each kind it has */
127typedef struct DeckRow {
128 /* 0x00 */ TextWindow *name;
129 /* 0x04 */ TextWindow *counts[6];
130} DeckRow;
131
132typedef struct DeckScreenChildren {
133 /* 0x00 */ union {
135 NameEntry *name; /* renaming */
136 } child; /* NULL once it is gone */
137 /* 0x04 */ TextWindow *title;
138 /* 0x08 */ DeckRow rows[3];
139 /* 0x5C */ TextWindow *options[2];
140 /* 0x64 */ Cursor *cursor;
141 /* 0x68 */ ScreenFade *fader;
143
144/* The screen's controller: the three decks to choose from */
145typedef struct DeckScreen {
147 /* 0x050 */ s32 layer;
148 /* 0x054 */ s32 depth;
149 /* 0x058 */ s32 scroll; /* of the background */
150 /* 0x05C */ s32 tick;
151 /* 0x060 */ s32 deck; /* under the cursor */
152 /* 0x064 */ s32 chosen;
153 /* 0x068 */ s32 cursorFrame;
154 /* 0x06C */ s32 cursorTime;
155 /* 0x070 */ s32 renaming;
156 /* 0x074 */ s32 kinds[3][6]; /* how many cards of each kind a deck has */
157 /* 0x0BC */ PanelAnim panels[3];
158 /* 0x0EC */ PanelAnim rowPanels[3];
159 /* 0x11C */ void (*countKinds)(struct DeckScreen *task); /* STCRDDEK_countCardKinds */
160} DeckScreen;
161
162/* scene.c */
164void STCRDDEK_startFader(ScreenFade *task, s32 fadeIn, s32 duration);
168
169/* deck_cards.c */
174
175/* editor.c */
185void STCRDDEK_initIdle(DeckIdle *task, void *children);
186void STCRDDEK_drawIdle(DeckIdle *task);
187void STCRDDEK_stepIdle(DeckIdle *task, void *children);
188void STCRDDEK_updateIdle(DeckIdle *task, void *children);
189DeckIdle *STCRDDEK_createIdle(void *parent);
190
191/* name_entry.c */
200void STCRDDEK_setName(NameEntry *task, char *name);
201void STCRDDEK_getName(NameEntry *task, char *out);
204
205/* scroll_bar.c */
208void STCRDDEK_setScrollBarCount(ScrollBar *bar, s32 pageSize, s32 count);
212
213/* screen.c */
221void STCRDDEK_loadFiles(void);
223void STCRDDEK_startFade(PanelAnim *fade, s32 fadeIn);
225void STCRDDEK_startLerp(MenuLerp *lerp, s32 from, s32 to, s32 frames);
227
228/* STCRDDEK's data (data/stcrddek.c), in its order */
230extern Glyph STCRDDEK_glyphs[]; /* the name's font */
231extern Glyph STCRDDEK_icons[];
237extern s32 STCRDDEK_nameAnims[][7];
238extern BigKey STCRDDEK_bigKeys[];
242
243#endif /* STCRDDEK_H */
signed int s32
Definition common.h:11
signed char s8
Definition common.h:7
signed short s16
Definition common.h:9
unsigned char u8
Definition common.h:8
DeckCards * STCRDDEK_createDeckCards(DeckEditor *editor)
Creates the deck's cards (task) on the editor's grid.
Definition deck_cards.c:78
void STCRDDEK_showEditorWindows(DeckEditor *task, DeckEditorChildren *children, s32 show)
Shows the title, the deck's name and counts of each kind, the hint (taking turns with another one) an...
Definition editor.c:54
Glyph STCRDDEK_glyphs[]
the name's font
Definition stcrddek.c:246
s32 STCRDDEK_updateFade(PanelAnim *fade)
void STCRDDEK_setScrollBarX(ScrollBar *bar, s32 x, s32 width)
scroll_bar.c
void STCRDDEK_updateScreen(DeckScreen *task, DeckScreenChildren *children)
The screen's task: loads its files and creates its windows, then runs it; waits for the editor or the...
Definition screen.c:370
KeyTabs STCRDDEK_keyPagesJp[]
the European version reads these two for language 0
Definition stcrddek.c:715
NameKeyboard STCRDDEK_keyboard
Definition stcrddek.c:785
DeckFuncs STCRDDEK_funcs
Definition stcrddek.c:781
Glyph STCRDDEK_icons[]
Definition stcrddek.c:597
void STCRDDEK_stepIdle(DeckIdle *task, void *children)
Ends the idle task on triangle.
Definition editor.c:808
s32 STCRDDEK_filesLoading(void)
Whether the texts or the keyboard are still loading (the card images aren't waited for)
Definition screen.c:458
void STCRDDEK_startTween(PanelAnim *fade, s32 fadeIn)
name_entry.c
void STCRDDEK_setScrollBarRange(ScrollBar *bar, s32 top, s32 bottom)
void STCRDDEK_drawIdle(DeckIdle *task)
Only sets up a sprite drawer.
Definition editor.c:800
void STCRDDEK_drawEditor(DeckEditor *task)
Draws the editor: the cursor on the deck's grid, the info panel, the deck's panel,...
Definition editor.c:234
void STCRDDEK_showListCard(DeckEditor *task, DeckEditorChildren *children, s32 show)
Shows the list's card under the cursor: its name and its numbers or its text, or hides them.
Definition editor.c:158
void STCRDDEK_setScrollBarCount(ScrollBar *bar, s32 pageSize, s32 count)
ScrollBar * STCRDDEK_createScrollBar(void)
void STCRDDEK_updateIdle(DeckIdle *task, void *children)
A task that waits for triangle, then ends; nothing creates it.
Definition editor.c:815
void STCRDDEK_createScreenWindows(DeckScreen *task, DeckScreenChildren *children)
screen.c
Definition screen.c:8
void STCRDDEK_showCardList(DeckEditor *task, DeckEditorChildren *children, s32 show)
Shows the eight lines of the list of the cards owned from listTop (each card's name and how many are ...
Definition editor.c:130
void STCRDDEK_showNameWindows(NameEntry *task, NameEntryWindows *windows, s32 show)
void STCRDDEK_drawKeyboard(NameEntry *task)
void STCRDDEK_buildCardList(DeckEditor *task)
Lists the cards owned but not in the deck: owned holds each card's copies left over,...
Definition editor.c:209
void STCRDDEK_startLerp(MenuLerp *lerp, s32 from, s32 to, s32 frames)
void STCRDDEK_initIdle(DeckIdle *task, void *children)
Left empty.
Definition editor.c:796
void STCRDDEK_countCardKinds(DeckScreen *task)
Counts how many cards of each kind (their color) each of the three decks has.
Definition screen.c:116
KeyTabs STCRDDEK_keyPages[]
Definition stcrddek.c:749
s32 STCRDDEK_updateLerp(MenuLerp *lerp)
void STCRDDEK_updateFader(ScreenFade *task)
BigKey STCRDDEK_bigKeys[]
Definition stcrddek.c:774
void STCRDDEK_stepScreen(DeckScreen *task, DeckScreenChildren *children)
The screen's states: opens the title and the decks' rows; cross on a deck offers to edit or rename it...
Definition screen.c:249
void STCRDDEK_updateEditor(DeckEditor *task, DeckEditorChildren *children)
The editor's task: creates its windows, then runs and draws it.
Definition editor.c:762
DeckEditor * STCRDDEK_createEditor(DeckScreen *screen, s32 deck)
Creates the editor (task) of one of GAME.decks.
Definition editor.c:785
s32 STCRDDEK_keyArrowCluts[]
Definition stcrddek.c:777
DeckScreen * STCRDDEK_createScreen(void)
Creates the deck screen (task)
Definition screen.c:428
void STCRDDEK_updateScrollBar(ScrollBar *bar)
NameEntry * STCRDDEK_createNameEntry(char *text)
Creates the name entry (task) to rename a deck, starting from its name: up to 10 characters.
Definition name_entry.c:20
void STCRDDEK_getName(NameEntry *task, char *out)
void STCRDDEK_startFader(ScreenFade *task, s32 fadeIn, s32 duration)
void STCRDDEK_updateScene(Task *task, DeckScreen **child)
scene.c
void STCRDDEK_updateDeckCards(DeckCards *task)
The deck cards' task: shows one more card each frame, then keeps drawing all 40 until the editor kill...
Definition deck_cards.c:59
ScreenFade * STCRDDEK_createFader(void)
s32 STCRDDEK_cursorCluts[]
STCRDDEK's data (data/stcrddek.c), in its order.
Definition stcrddek.c:6
void STCRDDEK_setName(NameEntry *task, char *name)
void STCRDDEK_createNameWindows(NameEntry *task, NameEntryWindows *windows)
void STCRDDEK_startFade(PanelAnim *fade, s32 fadeIn)
void STCRDDEK_drawDeckCards(DeckCards *task)
deck_cards.c
Definition deck_cards.c:7
void STCRDDEK_closeNameEntry(NameEntry *task)
void STCRDDEK_drawFader(ScreenFade *task)
DeckIdle * STCRDDEK_createIdle(void *parent)
Creates the idle task; nothing calls it.
Definition editor.c:833
KeyPage STCRDDEK_keyChars[]
Definition stcrddek.c:752
void STCRDDEK_createEditorWindows(DeckEditor *task, DeckEditorChildren *children)
editor.c
Definition editor.c:9
void STCRDDEK_setNameVram(NameEntry *task, s32 x, s32 y)
void STCRDDEK_updateNameEntry(NameEntry *task, NameEntryWindows *windows)
void STCRDDEK_stepEditor(DeckEditor *task, DeckEditorChildren *children)
The editor's states: picks a card of the deck (R1 its info panel, circle sorts the deck,...
Definition editor.c:645
TextStyle STCRDDEK_nameStyle
Definition stcrddek.c:763
void STCRDDEK_updateKeyboard(NameEntry *task, NameEntryWindows *windows)
s32 STCRDDEK_updateTween(PanelAnim *fade)
s32 STCRDDEK_nameAnims[][7]
Definition stcrddek.c:768
void STCRDDEK_drawScreen(DeckScreen *task)
Draws the screen: the background scrolling diagonally, the title panel, the decks' rows,...
Definition screen.c:56
KeyPage STCRDDEK_keyCharsJp[]
Definition stcrddek.c:720
void STCRDDEK_setScrollBarPos(ScrollBar *bar, s32 pos)
void STCRDDEK_showDeckRow(DeckScreen *task, DeckScreenChildren *children, s32 deck, s32 show)
Shows a deck's row: its name and how many cards of each kind it has, or hides it.
Definition screen.c:36
void STCRDDEK_loadFiles(void)
Loads the screen's textures and requests the card images, the card texts and the keyboard.
Definition screen.c:439
void STCRDDEK_loadNextCard(DeckCards *task)
Shows one more of the deck's cards, loading its image into its cell of VRAM; TASK_DONE once all 40 ar...
Definition deck_cards.c:39
#define TASK_HEADER(Type)
Definition task.h:39
The on-screen keyboard that the overlays use to type a name (STCRDDEK's deck names,...
A key of the keyboard bigger than one cell: its sprite and where it goes.
Definition name_entry.h:45
A line of the list of the cards owned.
Definition deck_editor.h:73
TextWindow * count
Definition deck_editor.h:76
TextWindow * name
Definition deck_editor.h:74
TextWindow * label
Definition deck_editor.h:75
A menu cursor: a text window showing one of the CURSOR_FRAMES glyphs.
Definition text.h:19
Draws the deck's cards, appearing one per frame.
u8 pad[0x10]
never read or written: createTask allocates 0x70 bytes
s32 count
cards shown so far
DeckEditor * editor
CardLine lines[8]
TextWindow * listHpLabel
Definition deck_editor.h:97
struct DeckCards * cards
TextWindow * kinds[6]
Definition deck_editor.h:83
TextWindow * listEffect
Definition deck_editor.h:99
ScrollBar * scrollBar
TextWindow * ap
Definition deck_editor.h:88
TextWindow * listCardName
Definition deck_editor.h:92
TextWindow * listPoints
Definition deck_editor.h:94
TextWindow * deckName
Definition deck_editor.h:82
TextWindow * effect
Definition deck_editor.h:91
TextWindow * points
Definition deck_editor.h:86
TextWindow * listApLabel
Definition deck_editor.h:95
TextWindow * title
Definition deck_editor.h:80
TextWindow * cardName
Definition deck_editor.h:84
TextWindow * message
TextWindow * listHp
Definition deck_editor.h:98
TextWindow * hint
Definition deck_editor.h:81
TextWindow * apLabel
Definition deck_editor.h:87
TextWindow * listPointsLabel
Definition deck_editor.h:93
TextWindow * pointsLabel
Definition deck_editor.h:85
TextWindow * hp
Definition deck_editor.h:90
TextWindow * hpLabel
Definition deck_editor.h:89
TextWindow * listAp
Definition deck_editor.h:96
The deck being edited.
Definition deck_editor.h:49
PanelAnim panels[5]
Definition deck_editor.h:69
s32 cursorFrame
Definition deck_editor.h:57
s32 column
of the deck's grid, 9 cards a row
Definition deck_editor.h:55
s32 cursorShown
Definition deck_editor.h:59
s8 owned[315]
how many of each card are not in the deck
Definition deck_editor.h:66
s32 infoShown
the card's info panel
Definition deck_editor.h:67
s16 list[315]
the cards owned and not in the deck
Definition deck_editor.h:65
s32 deck
GAME.decks[].
Definition deck_editor.h:54
s32 arrowsShown
Definition deck_editor.h:63
s32 listCursor
in the list of the cards owned
Definition deck_editor.h:60
struct DeckScreen * screen
Definition deck_editor.h:51
The screen's helpers.
Definition deck_editor.h:39
void(* loadFiles)(void)
Definition deck_editor.h:40
s32(* updateLerp)(MenuLerp *lerp)
Definition deck_editor.h:45
void(* startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames)
Definition deck_editor.h:44
s32(* filesLoading)(void)
Definition deck_editor.h:41
void(* startFade)(PanelAnim *fade, s32 fadeIn)
Definition deck_editor.h:42
s32(* updateFade)(PanelAnim *fade)
Definition deck_editor.h:43
A task that waits for triangle; nothing creates it.
void * parent
u8 pad[0x10]
never read or written: createTask allocates 0x6C bytes
A deck's row on the screen: its name and how many cards of each kind it has.
TextWindow * name
TextWindow * counts[6]
TextWindow * title
NameEntry * name
renaming
DeckEditor * editor
ScreenFade * fader
union DeckScreenChildren::@8 child
NULL once it is gone.
TextWindow * options[2]
The screen's controller: the three decks to choose from.
s32 kinds[3][6]
how many cards of each kind a deck has
s32 deck
under the cursor
void(* countKinds)(struct DeckScreen *task)
STCRDDEK_countCardKinds.
PanelAnim rowPanels[3]
PanelAnim panels[3]
void * children
s32 scroll
of the background
One glyph of a font sheet.
Definition text.h:237
A page of the keyboard: 7 rows of 15 cells.
Definition name_entry.h:58
The texts of a keyboard page's three tabs.
Definition name_entry.h:63
Moves a value towards a target in fixed point, as the menu overlays' startLerp and updateLerp do.
Definition menu.h:27
A name entry: the keyboard, the name typed so far and the panels that open and close.
Definition name_entry.h:95
The character pages of the keyboard (as STDGNAME's and STPLNMET's)
Definition name_entry.h:68
Opens or closes a menu panel: level goes 0 -> ONE in duration frames (or back at twice the speed),...
Definition menu.h:18
Fades the whole screen to black and back with a subtractive rectangle.
Definition gfx.h:361
A vertical scroll bar, as the menu overlays (STSTATUS, STGDGLAB) draw one.
Definition menu.h:38
Any task, seen through its header.
Definition task.h:62
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
Definition text.h:131