Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
menu.c
Go to the documentation of this file.
1/* The slot picker: its header and the memory card slots, which slide in and
2 out */
3
4#include "menus/memory_card.h"
5
6/* Slides the slot picker's header down into view */
8 TextWindow **windows = menu->children;
9
10 STGMCARD_funcs.startLerp(&menu->lerps[1], -0x55, 0, 10);
11 windows[0]->setNumber(windows[0], 1, menu->saves->port + 1);
12#if VERSION_EU
13 windows[0]->setVisible(windows[0], 0);
14#endif
15 menu->substate = 1;
16}
17
18/* Selects `slot`, slides the slot picker's cursor into place and moves it to the slot;
19 then the player picks one with left and right */
21 STGMCARD_funcs.startLerp(&menu->lerps[2], 0, 0x2F, 8);
22 menu->substate = 5;
23 STGMCARD_funcs.slot = slot;
25}
26
27/* Slides the slot picker's header up out of view, then resets the picker */
29 STGMCARD_funcs.startLerp(&menu->lerps[1], 0, -0x55, 5);
30 menu->substate = 4;
31}
32
33/* Slides the slot picker's cursor from the previous slot to the selected one */
36 menu->substate = 7;
37}
38
39/* Slides the slot picker's three slots in from the right */
41 STGMCARD_funcs.startLerp(&menu->lerps[0], 0xDE, 0, 10);
42 menu->substate = 2;
43}
44
45/* Slides the slot picker's three slots out to the right */
47 STGMCARD_funcs.startLerp(&menu->lerps[0], 0, 0xDE, 5);
48 menu->substate = 3;
49}
50
51/* Puts the slot picker back out of view, idle, with slot 0 selected */
53 menu->substate = 0;
54 menu->slid = 0;
57 STGMCARD_funcs.startLerp(&menu->lerps[0], 0xDE, 0, 10);
58 STGMCARD_funcs.startLerp(&menu->lerps[1], -0x55, 0, 10);
59 STGMCARD_funcs.startLerp(&menu->lerps[2], 0, 0x2F, 8);
60 STGMCARD_funcs.startLerp(&menu->lerps[3], -1, 0, 1);
61 menu->lerps[3].value = 0;
62}
63
64/* The save picker's task: slides in and out, moves between the first three
65 saves with left and right, and draws each one's lead partner */
67 SpriteDrawer sprite;
68 s32 prev;
69 s32 i;
70
71 switch (menu->state) {
72 case TASK_INIT:
73 default:
74 menu->nextState(menu);
76 if (*windows == NULL) {
77 *windows = createTextWindow(menu->layer, 1, 0x15, menu->lerps[1].value + 0x18);
78 }
79 (*windows)->setString(*windows, FILE_CACHE.load(TEXT_FILE(TEXT_MEMORY_CARD)), 3);
80 (*windows)->setNumber(*windows, 1, menu->saves->port + 1);
81#if VERSION_EU
82 (*windows)->setVisible(*windows, 0);
83#endif
84 break;
85 case TASK_DONE:
86 case TASK_KILL:
87 break;
88 case TASK_RUN:
89 switch (menu->substate) {
90 case 0:
91 break;
92 case 1:
93 if (STGMCARD_funcs.updateLerp(&menu->lerps[1]) != 0) {
94 menu->substate = 0;
95 menu->slid = 1;
96 }
97 break;
98 case 2:
99 if (STGMCARD_funcs.updateLerp(&menu->lerps[0]) != 0) {
100 menu->substate = 0;
101 menu->slid = 2;
102 }
103 break;
104 case 3:
105 if (STGMCARD_funcs.updateLerp(&menu->lerps[0]) != 0) {
106 menu->substate = 0;
107 menu->slid = 3;
108 }
109 break;
110 case 4:
111 if (STGMCARD_funcs.updateLerp(&menu->lerps[1]) != 0) {
112 STGMCARD_resetMenu(menu);
113 }
114 break;
115 case 5:
116 if (STGMCARD_funcs.updateLerp(&menu->lerps[2]) != 0) {
118 }
119 break;
120 case 6:
122 prev = STGMCARD_funcs.slot;
124 STGMCARD_funcs.slot = prev - 1;
125 if (STGMCARD_funcs.slot < 0) {
127 }
128 if (STGMCARD_funcs.slot != prev) {
129 menu->saves->refresh(menu->saves);
132 }
134 prev = STGMCARD_funcs.slot;
135 STGMCARD_funcs.slot = prev + 1;
137 if (STGMCARD_funcs.slot >= 3) {
139 }
140 if (STGMCARD_funcs.slot != prev) {
141 menu->saves->refresh(menu->saves);
144 }
145 }
146 break;
147 case 7:
148 if (STGMCARD_funcs.updateLerp(&menu->lerps[3]) != 0) {
149 menu->substate = 6;
150 }
151 break;
152 }
153 initSpriteDrawer(&sprite);
154 sprite.setLayerId(menu->layer, menu->depth);
155 sprite.setTexture(0x280, 0);
156 i = 0;
157 if (GFX.funcs.getTime() - menu->blinkTime >= 3) {
158 menu->blinkTime = GFX.funcs.getTime();
159 if (menu->blinkDown == 0) {
160 if (++menu->blinkFrame >= 12) {
161 menu->blinkFrame = 10;
162 menu->blinkDown = 1;
163 }
164 } else {
165 if (--menu->blinkFrame <= 0) {
166 menu->blinkFrame = 0;
167 menu->blinkDown = 0;
168 }
169 }
170 }
171 sprite.setClutRow(menu->blinkFrame);
172 sprite.draw(FILE_CACHE.getEntry(FILE_GMCARD_SHEET << 16), 0x23, menu->lerps[2].value + 0x30 + menu->lerps[3].value, menu->lerps[1].value + 0x12);
173 sprite.setClutRow(0);
174 sprite.draw(FILE_CACHE.getEntry(FILE_GMCARD_SHEET << 16), 0x20, 0, menu->lerps[1].value + 0x10);
175 (*windows)->setPos(*windows, 0x15, menu->lerps[1].value + 0x18);
176 for (i = 0; i < 3; i++) {
177 if (menu->saves->file.saves[i].name[0] != 0) {
179 }
180 }
181 sprite.draw(FILE_CACHE.getEntry(FILE_GMCARD_SHEET << 16), 0x22, menu->lerps[0].value + 0x62, 0x20);
182 break;
183 }
184}
185
186/* Creates the slot picker (task) of the save list */
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
#define TEXT_MEMORY_CARD
MEMCRD.
Definition file.h:217
#define TEXT_FILE(file)
Definition file.h:190
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
Definition gfx.h:45
STGMCARD.PRO: the memory card screen (MODE_CONTINUE).
#define FILE_GMCARD_SHEET
Definition memory_card.h:19
void STGMCARD_slideInSlots(MemCardMenu *menu)
Slides the slot picker's three slots in from the right.
Definition menu.c:40
void STGMCARD_startSlotPick(MemCardMenu *menu, s32 slot)
Selects slot, slides the slot picker's cursor into place and moves it to the slot; then the player pi...
Definition menu.c:20
void STGMCARD_resetMenu(MemCardMenu *menu)
Puts the slot picker back out of view, idle, with slot 0 selected.
Definition menu.c:52
void STGMCARD_slideOutSlots(MemCardMenu *menu)
Slides the slot picker's three slots out to the right.
Definition menu.c:46
MemCardMenu * STGMCARD_createMenu(MemCardSaves *saves)
Creates the slot picker (task) of the save list.
Definition menu.c:187
void STGMCARD_slideOutHeader(MemCardMenu *menu)
Slides the slot picker's header up out of view, then resets the picker.
Definition menu.c:28
void STGMCARD_updateMenu(MemCardMenu *menu, TextWindow **windows)
The save picker's task: slides in and out, moves between the first three saves with left and right,...
Definition menu.c:66
void STGMCARD_moveSlotCursor(MemCardMenu *menu)
Slides the slot picker's cursor from the previous slot to the selected one.
Definition menu.c:34
void STGMCARD_slideInHeader(MemCardMenu *menu)
Slides the slot picker's header down into view.
Definition menu.c:7
#define PAD_RIGHT
Definition pad.h:23
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
Definition pad.h:140
#define PAD_LEFT
Definition pad.h:25
#define PAD_REPEATED(button)
Definition pad.h:141
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
Definition sound.c:180
#define SOUND_MENU_MOVE
SYSTEM06.
Definition sound.h:43
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
MemCardScreenFuncs STGMCARD_funcs
STGMCARD's data (data/stgmcard.c)
Definition stgmcard.c:127
s32 STGMCARD_slotIconX[]
Definition stgmcard.c:45
s32 STGMCARD_partnerIcons[]
the sprite of a save's first partner, by partner (from 3), and its x, by save
Definition stgmcard.c:41
void *(* load)(u32 file)
Definition file.h:92
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
MemCardSave saves[3]
Definition memory_card.h:89
The slot picker (STGMCARD_updateMenu): the header with the port, the three slots and their cursor,...
void(* nextState)(struct MemCardMenu *task)
void * children
s32 blinkDown
the frame counts down
s32 slid
the last slide done: 1 header in, 2 slots in, 3 slots out
void(* slideInSlots)(struct MemCardMenu *menu)
void(* slideInHeader)(struct MemCardMenu *menu)
void(* slideOutSlots)(struct MemCardMenu *menu)
MemCardSaves * saves
void(* reset)(struct MemCardMenu *menu)
MenuLerp lerps[4]
slots x, header y, cursor x, cursor move
void(* slideOutHeader)(struct MemCardMenu *menu)
void(* startPick)(struct MemCardMenu *menu, s32 slot)
u8 name[0x18]
empty for a free slot
Definition memory_card.h:72
s32 partners[3]
3 and up: a partner, whose animation the details show
Definition memory_card.h:77
The saves of a memory card (STGMCARD_updateSaves)
MemCardFile file
the card's
void(* refresh)(struct MemCardSaves *saves)
void(* startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames)
s32 prevSlot
where the cursor moves from
s32 slot
the selected one
s32(* updateLerp)(MenuLerp *lerp)
s32 value
Definition menu.h:30
short(* playSound)(s32 id)
returns the voice of a key-on
Definition sound.h:187
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
Definition gfx.h:223
void(* setLayerId)()
(id, depth)
Definition gfx.h:244
void(* setClutRow)()
(row)
Definition gfx.h:247
void(* draw)()
(sheet, frame, x, y)
Definition gfx.h:246
void(* setTexture)()
(x, y)
Definition gfx.h:242
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
Definition text.h:131
void(* setNumber)()
Definition text.h:166
void(* setVisible)(struct TextWindow *obj, u8 arg)
Definition text.h:177
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)