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 lab's main menu, which opens one of its three screens */
2
3#include "menus/digimon_lab.h"
4
5/* The main menu's open: fades its page back in, which then shows the party
6 member's stats again (STGDGLAB_updateMenu) */
8 menu->state = TASK_DONE;
9 menu->counter = 0;
10 STGDGLAB_data.funcs.startFade(&menu->panels[3], 1);
11}
12
13/* The main menu's close: fades its page out and hides its stats and name, while
14 a screen is open over it */
16 LabMenuWindows *windows;
17 s32 i;
18
19 menu->state = TASK_DONE;
20 menu->counter = 1;
21 windows = menu->children;
22 STGDGLAB_data.funcs.startFade(&menu->panels[3], 0);
23 for (i = 0; i < 5; i++) {
24 if (windows->statLabels[i] != NULL) {
25 windows->statLabels[i]->setVisible(windows->statLabels[i], 0);
26 }
27 if (windows->statValues[i] != NULL) {
28 windows->statValues[i]->setVisible(windows->statValues[i], 0);
29 }
30 }
31 if (windows->name != NULL) {
32 windows->name->setVisible(windows->name, 0);
33 }
34 for (i = 0; i < 5; i++) {
35 menu->frames[i] = 0;
36 }
37}
38
39/* Shows the main menu's page: the name and five stats (STGDGLAB_menuStats) of
40 the lab's party member, or empty strings and a grey entries hint without one */
42 PartnerTotals totals;
43 LabWindowPos *pos;
44 s32 member;
45 s32 i;
46
47 for (i = 0; i < 5; i++) {
48 pos = &STGDGLAB_data.layout[i];
49 if (windows->statLabels[i] == NULL) {
50 windows->statLabels[i] = createTextWindow(menu->layer, 3, pos->x, pos->y);
51 windows->statLabels[i]->setDepth(windows->statLabels[i], menu->depth - 1);
52 }
54 }
55 member = GAME.funcs.getPartyMember(menu->lab->member);
56 if (member >= 0) {
57 GAME.funcs.computeStats(member, &totals);
58 }
59 for (i = 0; i < 5; i++) {
60 pos = &STGDGLAB_data.layout[i + 5];
61 if (windows->statValues[i] == NULL) {
62 windows->statValues[i] = createTextWindow(menu->layer, 3, pos->x, pos->y);
63 windows->statValues[i]->setDepth(windows->statValues[i], menu->depth - 1);
64 }
65 if (member < 0) {
66 if (i == 0) {
67 windows->statValues[0]->setString(windows->statValues[0], FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 0x1C);
68 } else {
69 windows->statValues[i]->setString(windows->statValues[i], FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 0x12);
70 }
71 } else {
72 windows->statValues[i]->setNumber(windows->statValues[i], 0, totals.stats[STGDGLAB_menuStats[i]]);
73 }
74 windows->statValues[i]->setRightAlign(windows->statValues[i], 1);
75 }
76 pos = &STGDGLAB_data.layout[10];
77 if (windows->name == NULL) {
78 windows->name = createTextWindow(menu->layer, 1, pos->x, pos->y);
79 windows->name->setDepth(windows->name, menu->depth - 1);
80 }
81 if (member < 0) {
82 windows->name->setString(windows->name, FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 0x1B);
83 if (windows->entriesHint != NULL) {
85 }
86 } else {
87 windows->name->setString(windows->name, GAME.funcs.getPartnerStats(member)->name, -1);
88 if (windows->entriesHint != NULL) {
90 }
91 }
92 menu->frames[3] = 0;
93}
94
95/* The menu's title and button hint, each once its panel has faded in; then
96 fades the options' panel in */
97static inline void showMenuTitle(LabMenu *menu, LabMenuWindows *windows) {
98 s32 done;
99
100 done = 0;
101 if (STGDGLAB_data.funcs.updateFade(&menu->panels[0])) {
102 if (windows->title == NULL) {
103 windows->title = createTextWindow(menu->layer, 1, 0xAE, 0x15);
104 windows->title->setDepth(windows->title, menu->depth - 1);
105 }
106 windows->title->setPos(windows->title, 0xAE, 0x15);
107 done = 1;
108 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 1);
109 }
110 if (STGDGLAB_data.funcs.updateFade(&menu->panels[2])) {
111 if (windows->label == NULL) {
112 windows->label = createTextWindow(menu->layer, 1, 0xD3, 0xCC);
113 windows->label->setDepth(windows->label, menu->depth - 1);
114 }
115 windows->label->setPos(windows->label, 0xD3, 0xCC);
116 done++;
117 windows->label->setString(windows->label, FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 5);
118 }
119 if (done == 2) {
120 STGDGLAB_data.funcs.startFade(&menu->panels[1], 1);
121 menu->substate++;
122 }
123}
124
125/* Once their panel has faded in, the three screens' names and the cursor */
126static inline void showMenuOptions(LabMenu *menu, LabMenuWindows *windows) {
127 s32 i;
128
129 if (STGDGLAB_data.funcs.updateFade(&menu->panels[1])) {
130 for (i = 0; i < 3; i++) {
131 if (windows->options[i] == NULL) {
132 windows->options[i] = createTextWindow(menu->layer, 1, 0xA7, i * 0xE + 0x31);
133 windows->options[i]->setDepth(windows->options[i], menu->depth - 1);
134 }
135 windows->options[i]->setString(windows->options[i], FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), i + 2);
136 }
137 if (windows->cursor == NULL) {
138 windows->cursor = createCursor(menu->layer, 1, 0x9A, menu->choice * 0xE + 0x31);
139 }
140 windows->cursor->setVisible(windows->cursor, 1);
141 menu->substate++;
142 }
143}
144
145/* Up and down pick a screen; cross goes on to the party, triangle leaves the lab */
146static inline void pickMenuOption(LabMenu *menu, LabMenuWindows *windows) {
147 s32 old;
148
149 old = menu->choice;
151 if (--menu->choice < 0) {
152 menu->choice = 0;
153 }
154 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
155 if (++menu->choice >= 3) {
156 menu->choice = 2;
157 }
158 }
159 if (old != menu->choice) {
161 windows->cursor->setPos(windows->cursor, 0x9A, menu->choice * 0xE + 0x31);
162 }
163 if (PAD_PRESSED(PAD_CROSS)) {
165 menu->step = 0;
166 menu->substate++;
167 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
169 menu->step = 1;
170 menu->substate++;
171 menu->lab->fadeOut(menu->lab);
172 }
173}
174
175/* Left and right go through the party's members; cross opens the screen for
176 the member, triangle goes back to the screens, circle (on "Switch
177 Digimon", with a member) opens the member's entries */
178static inline void pickMember(LabMenu *menu, LabMenuWindows *windows) {
179 s32 old;
180
181 old = menu->lab->member;
183 if (--menu->lab->member < 0) {
184 menu->lab->member = menu->memberCount - 1;
185 }
187 if (++menu->lab->member > menu->memberCount - 1) {
188 menu->lab->member = 0;
189 }
190 }
191 if (old != menu->lab->member) {
193 STGDGLAB_showMenuPage(menu, windows);
194 } else if (PAD_PRESSED(PAD_CROSS)) {
196 menu->step = 1;
197 menu->substate++;
198 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
200 menu->step = 0;
201 menu->substate++;
202 } else if (PAD_PRESSED(PAD_CIRCLE) && menu->choice == 0 &&
203 GAME.funcs.getPartyMember(menu->lab->member) >= 0) {
204 menu->step = 2;
205 menu->substate++;
207 }
208}
209
210/* Once the member panel has faded out, fades the page out and hides its
211 windows (the stats and name only when going back to the screens) */
212static inline void closeMenuPage(LabMenu *menu, LabMenuWindows *windows) {
213 s32 i;
214
215 if (STGDGLAB_data.funcs.updateFade(&menu->panels[7])) {
216 if (menu->step == 0) {
217 STGDGLAB_data.funcs.startFade(&menu->panels[3], 0);
218 for (i = 0; i < 5; i++) {
219 if (windows->statLabels[i] != NULL) {
220 windows->statLabels[i]->setVisible(windows->statLabels[i], 0);
221 }
222 if (windows->statValues[i] != NULL) {
223 windows->statValues[i]->setVisible(windows->statValues[i], 0);
224 }
225 }
226 if (windows->name != NULL) {
227 windows->name->setVisible(windows->name, 0);
228 }
229 }
230 STGDGLAB_data.funcs.startFade(&menu->panels[4], 0);
231 STGDGLAB_data.funcs.startFade(&menu->panels[5], 0);
232 STGDGLAB_data.funcs.startFade(&menu->panels[6], 0);
233 if (menu->choice == 0) {
234 STGDGLAB_data.funcs.startFade(&menu->panels[8], 0);
235 }
236 if (windows->title != NULL) {
237 windows->title->setVisible(windows->title, 0);
238 }
239 if (windows->label != NULL) {
240 windows->label->setVisible(windows->label, 0);
241 }
242 if (windows->entriesHint != NULL) {
243 windows->entriesHint->setVisible(windows->entriesHint, 0);
244 }
245 menu->substate++;
246 }
247}
248
249/* Once the page's panel has faded in, the member's page and its label */
250static inline void showMenuPageLabel(LabMenu *menu, LabMenuWindows *windows) {
252 if (STGDGLAB_data.funcs.updateFade(&menu->panels[4])) {
253 STGDGLAB_showMenuPage(menu, windows);
254 if (windows->label == NULL) {
255 windows->label = createTextWindow(menu->layer, 1, 0xA1, 0x17);
256 windows->label->setDepth(windows->label, menu->depth - 1);
257 }
258 windows->label->setPos(windows->label, 0xA1, 0x17);
259 windows->label->setString(windows->label, FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), 6);
260 menu->substate++;
261 }
262}
263
264/* Once their panels have faded in, the entries hint (on "Switch Digimon")
265 and the title that asks for a member for the picked screen */
266static inline void showMenuPageTitle(LabMenu *menu, LabMenuWindows *windows) {
267 if (menu->choice == 0 && STGDGLAB_data.funcs.updateFade(&menu->panels[8])) {
268 if (windows->entriesHint == NULL) {
269 windows->entriesHint = createTextWindow(menu->layer, 1, 0xF, 0x55);
270 windows->entriesHint->setDepth(windows->entriesHint, menu->depth - 1);
271 }
273 }
275 if (STGDGLAB_data.funcs.updateFade(&menu->panels[6])) {
276 if (windows->title == NULL) {
277 windows->title = createTextWindow(menu->layer, 1, 0xAE, 0x49);
278 }
279 windows->title->setPos(windows->title, 0xAE, 0x49);
280 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_DIGI_LAB)), menu->choice + 0x18);
281 menu->substate++;
282 }
283}
284
285/* Once the page's panels have faded out (all but the page itself when a
286 screen or the entries open): opens the screen, the member's entries or the
287 screens' menu again */
288static inline void waitMenuPageClosed(LabMenu *menu) {
289 s32 closed;
290 s32 m;
291
292 closed = 0;
293 for (m = menu->step != 0; m < 6; m++) {
294 closed += STGDGLAB_data.funcs.updateFade(&menu->panels[m + 3]);
295 }
296 if (menu->step == 1) {
297 if (closed == 5) {
298 menu->nextSubstate(menu);
299 menu->picked = 1;
300 }
301 } else if (menu->step == 2) {
302 if (closed == 5) {
303 menu->setSubstate(menu, 30);
304 }
305 } else if (closed == 6) {
306 menu->setSubstate(menu, 0);
307 }
308}
309
310/* The main menu's states: fades its panels in, picks one of the three
311 screens with up and down, then shows the party's stats while left and
312 right go through them; circle opens the partner's entries */
314 TextWindow **items;
315 /* The match depends on cases 4 and 5 having their own counters, and on
316 case 5 clearing its count after k */
317 s32 faded;
318 s32 j;
319 s32 k;
320
321 switch (menu->substate) {
322 case 0:
323 default:
324 STGDGLAB_data.funcs.startFade(&menu->panels[0], 1);
325 STGDGLAB_data.funcs.startFade(&menu->panels[2], 1);
326 menu->substate++;
327 break;
328 case 1:
329 showMenuTitle(menu, windows);
330 break;
331 case 2:
332 showMenuOptions(menu, windows);
333 break;
334 case 3:
335 pickMenuOption(menu, windows);
336 break;
337 case 4:
338 for (j = 0, items = menu->children; j < menu->childCount - 2; j++, items++) {
339 if (*items != NULL) {
340 (*items)->setVisible(*items, 0);
341 }
342 }
343 windows->cursor->setVisible(windows->cursor, 0);
344 STGDGLAB_data.funcs.startFade(&menu->panels[0], 0);
345 STGDGLAB_data.funcs.startFade(&menu->panels[1], 0);
346 STGDGLAB_data.funcs.startFade(&menu->panels[2], 0);
347 menu->substate++;
348 break;
349 case 5:
350 for (k = 0, faded = 0; k < 3; k++) {
351 faded += STGDGLAB_data.funcs.updateFade(&menu->panels[k]);
352 if (faded == 3) {
353 if (menu->step == 0) {
354 menu->setSubstate(menu, 10);
355 STGDGLAB_data.funcs.startFade(&menu->panels[3], 1);
356 menu->lab->member = 0;
357 if (menu->choice == 0) {
358 menu->memberCount = menu->lab->partySize;
359 } else {
360 menu->memberCount = menu->lab->partyCount;
361 }
362 } else {
363 menu->setState(menu, TASK_KILL);
364 }
365 }
366 }
367 break;
368 case 10:
369 STGDGLAB_data.funcs.startFade(&menu->panels[4], 1);
370 STGDGLAB_data.funcs.startFade(&menu->panels[5], 1);
371 STGDGLAB_data.funcs.startFade(&menu->panels[6], 1);
372 STGDGLAB_data.funcs.startFade(&menu->panels[7], 1);
373 if (menu->choice == 0) {
374 STGDGLAB_data.funcs.startFade(&menu->panels[8], 1);
375 }
376 menu->substate++;
377 break;
378 case 11:
379 showMenuPageLabel(menu, windows);
380 break;
381 case 12:
382 showMenuPageTitle(menu, windows);
383 break;
384 case 14:
385 if (STGDGLAB_data.funcs.updateFade(&menu->panels[7])) {
386 menu->substate++;
387 }
388 break;
389 case 15:
390 pickMember(menu, windows);
391 break;
392 case 16:
393 STGDGLAB_data.funcs.startFade(&menu->panels[7], 0);
394 menu->substate++;
395 break;
396 case 17:
397 closeMenuPage(menu, windows);
398 break;
399 case 18:
400 waitMenuPageClosed(menu);
401 break;
402 case 19:
403 if (menu->picked == 0) {
404 menu->setSubstate(menu, 10);
405 if (menu->panels[3].level == 0) {
406 STGDGLAB_data.funcs.startFade(&menu->panels[3], 1);
407 }
408 }
409 break;
410 case 30:
411 if (windows->panel == NULL) {
413 }
414 menu->substate++;
415 break;
416 case 31:
417 if (windows->panel == NULL) {
418 menu->setSubstate(menu, 10);
419 }
420 break;
421 }
422}
423
424/* Draws the main menu's frames and the party's animations */
425void STGDGLAB_drawMenu(LabMenu *menu, void *children) {
426 SpriteDrawer sprite;
427 PartnerAnim *anim;
428 s32 member;
429 s32 id;
430 s32 i;
431
432 initSpriteDrawer(&sprite);
433 if (menu->substate < 10) {
434 sprite.setTexture(0x280, 0x100);
435 sprite.setLayerId(menu->layer, menu->depth);
436 if (menu->panels[0].level != 0) {
437 if (menu->panels[0].level != ONE) {
438 sprite.setScale(menu->panels[0].level, ONE, ONE);
439 sprite.setPivot(0x140, 0x15);
440 }
441 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x20, 0x92, 0xF);
442 }
443 if (menu->panels[1].level != 0) {
444 STRETCH_SPRITE(sprite, menu->panels[1].level, 0x140, 0x45);
445 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x21, 0x92, 0x2A);
446 }
447 if (menu->panels[2].level != 0) {
448 STRETCH_SPRITE(sprite, menu->panels[2].level, 0x140, 0xD2);
449 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x24, 0xC6, 0xC4);
450 }
451 return;
452 }
453 member = GAME.funcs.getPartyPartner(menu->lab->member);
454 if (GFX.funcs.getTime() - menu->animTime >= 12) {
455 menu->animTime = GFX.funcs.getTime();
456 if (member >= 0) {
457 anim = &STGDGLAB_data.anim[member];
458 menu->frames[3]++;
459 if (anim->frames[menu->frames[3]] == -1 || menu->frames[3] >= 7) {
460 menu->frames[3] = 0;
461 }
462 }
463 for (i = 0; i < menu->lab->partySize; i++) {
464 id = GAME.funcs.getPartyPartner(i);
465 if (id >= 0) {
466 anim = &STGDGLAB_data.anim[id];
467 menu->frames[i]++;
468 if (anim->frames[menu->frames[i]] == -1) {
469 menu->frames[i] = 0;
470 }
471 }
472 }
473 }
474 if (GFX.funcs.getTime() - menu->blinkTime >= 10) {
475 menu->blinkTime = GFX.funcs.getTime();
476 menu->frames[4]++;
477 if (menu->frames[4] >= 4) {
478 menu->frames[4] = 0;
479 }
480 }
481 sprite.setTexture(0x280, 0x100);
482 sprite.setLayerId(menu->layer, menu->depth);
483 if (menu->panels[7].level != 0) {
484 if (menu->panels[7].level != ONE) {
485 sprite.setScale(menu->panels[7].level, ONE, ONE);
486 } else {
487 sprite.setScale(ONE, ONE, ONE);
488 sprite.setTexture(0x140, 0);
489 sprite.setLayerId(menu->layer, menu->depth - 1);
490 sprite.setClutRow(menu->frames[4]);
491 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0xD, menu->lab->member * 0x30 + 0xA5, 0x65);
492 sprite.setLayerId(menu->layer, menu->depth);
493 sprite.setClutRow(0);
494 }
495 sprite.setTexture(0x280, 0x100);
496 for (i = 0; i < menu->lab->partySize; i++) {
497 id = GAME.funcs.getPartyPartner(i);
498 if (id >= 0) {
499 if (menu->panels[7].level != ONE) {
500 sprite.setPivot(i * 0x30 + 0xB4, 0x8A);
501 }
502 anim = &STGDGLAB_data.anim[id];
503 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), anim->frames[menu->frames[i]], i * 0x30 + 0xA5, 0x81);
504 }
505 }
506 }
507 if (menu->panels[6].level != 0) {
508 STRETCH_SPRITE(sprite, menu->panels[6].level, 0x140, 0x8A);
509 sprite.setTexture(0x140, 0);
510 sprite.setLayerId(menu->layer, menu->depth - 1);
511 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x10, 0x90, 0x5F);
512 sprite.setTexture(0x140, 0);
513 sprite.setLayerId(menu->layer, menu->depth);
514 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x11, 0x90, 0x5F);
515 sprite.setTexture(0x280, 0x100);
516 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x27, 0x90, 0x5F);
517 }
518 if (menu->panels[3].level != 0) {
519 STRETCH_SPRITE(sprite, menu->panels[3].level, 0, 0x2F);
520 if (member >= 0) {
521 anim = &STGDGLAB_data.anim[member];
522 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), anim->frames[menu->frames[3]], 0x10, 0x16);
523 }
524 sprite.setTexture(0x140, 0);
525 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0xE, 0, 0x13);
526 sprite.setTexture(0x280, 0x100);
527 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x1E, 0, 0x13);
528 }
529 sprite.setTexture(0x280, 0x100);
530 if (menu->panels[4].level != 0) {
531 STRETCH_SPRITE(sprite, menu->panels[4].level, 0x140, 0x1D);
532 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x25, 0x8F, 0xF);
533 }
534 if (menu->panels[5].level != 0) {
535 STRETCH_SPRITE(sprite, menu->panels[5].level, 0x140, 0x4E);
536 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x20, 0x92, 0x43);
537 }
538 if (menu->panels[8].level != 0) {
539 STRETCH_SPRITE(sprite, menu->panels[8].level, 0, 0x5A);
540 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x26, 0, 0x4D);
541 }
542}
543
544/* The main menu's task: runs and draws the menu; while its page fades
545 (TASK_DONE, from STGDGLAB_openMenu and STGDGLAB_closeMenu) it only draws */
546void STGDGLAB_updateMenu(LabMenu *menu, void *children) {
547 switch (menu->state) {
548 case TASK_INIT:
549 default:
550 menu->nextState(menu);
551 menu->panels[0].duration = 10;
552 menu->panels[1].duration = 10;
553 menu->panels[2].duration = 8;
554 menu->panels[3].duration = 10;
555 menu->panels[4].duration = 10;
556 menu->panels[5].duration = 10;
557 menu->panels[6].duration = 10;
558 menu->panels[7].duration = 8;
559 menu->panels[8].duration = 8;
560 break;
561 case TASK_RUN:
562 STGDGLAB_runMenu(menu, children);
563 STGDGLAB_drawMenu(menu, children);
564 break;
565 case TASK_DONE:
566 if (STGDGLAB_data.funcs.updateFade(&menu->panels[3]) != 0) {
567 menu->state = TASK_RUN;
568 if (menu->counter == 0) {
569 STGDGLAB_showMenuPage(menu, children);
570 }
571 }
572 STGDGLAB_drawMenu(menu, children);
573 break;
574 case TASK_KILL:
575 break;
576 }
577}
578
579/* Creates the lab's main menu (task) */
582
583 menu->open = STGDGLAB_openMenu;
585 menu->layer = SCREEN_LAYER;
586 menu->depth = 2;
587 menu->lab = lab;
588 return menu;
589}
590
591/* The stats the menu's page shows, in PartnerTotals.stats */
593 0, 2, 3, 4,
594 5,
595};
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
STGDGLAB.PRO: the Digimon Lab (MODE_DIGI_LAB; "デジモンラボ" in STAGSLCT's list of scenes),...
#define FILE_LAB_SPRITES
The lab's sprite sheet; the next file is its texture archive.
Definition digimon_lab.h:25
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
#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
Cursor * createCursor(s16 layerId, s32 depth, s16 x, s16 y)
A menu cursor on a layer at (x, y)
Definition cursor.c:92
LabEntryList * STGDGLAB_createEntryList(s32 partner, s32 allEntries, s32 closable)
Creates the list of a partner's entries (task): only its slots unless ALLENTRIES; CLOSABLE lets trian...
Definition entry_list.c:339
#define TEXT_DIGI_LAB
DGLABO: STGDGLAB's.
Definition file.h:208
#define TEXT_FILE(file)
Definition file.h:190
#define FILE_MENU_SPRITES
Files the engine loads by number.
Definition file.h:188
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
#define STRETCH_SPRITE(sprite, level, x, y)
Definition gfx.h:273
#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
LabData STGDGLAB_data
Definition lab.c:611
static void showMenuPageTitle(LabMenu *menu, LabMenuWindows *windows)
Once their panels have faded in, the entries hint (on "Switch Digimon") and the title that asks for a...
Definition menu.c:266
static void pickMember(LabMenu *menu, LabMenuWindows *windows)
Left and right go through the party's members; cross opens the screen for the member,...
Definition menu.c:178
static void showMenuOptions(LabMenu *menu, LabMenuWindows *windows)
Once their panel has faded in, the three screens' names and the cursor.
Definition menu.c:126
void STGDGLAB_openMenu(LabMenu *menu)
The main menu's open: fades its page back in, which then shows the party member's stats again (STGDGL...
Definition menu.c:7
static void waitMenuPageClosed(LabMenu *menu)
Once the page's panels have faded out (all but the page itself when a screen or the entries open): op...
Definition menu.c:288
void STGDGLAB_drawMenu(LabMenu *menu, void *children)
Draws the main menu's frames and the party's animations.
Definition menu.c:425
LabMenu * STGDGLAB_createMenu(Lab *lab)
Creates the lab's main menu (task)
Definition menu.c:580
void STGDGLAB_updateMenu(LabMenu *menu, void *children)
The main menu's task: runs and draws the menu; while its page fades (TASK_DONE, from STGDGLAB_openMen...
Definition menu.c:546
void STGDGLAB_showMenuPage(LabMenu *menu, LabMenuWindows *windows)
Shows the main menu's page: the name and five stats (STGDGLAB_menuStats) of the lab's party member,...
Definition menu.c:41
static void showMenuTitle(LabMenu *menu, LabMenuWindows *windows)
The menu's title and button hint, each once its panel has faded in; then fades the options' panel in.
Definition menu.c:97
void STGDGLAB_runMenu(LabMenu *menu, LabMenuWindows *windows)
The main menu's states: fades its panels in, picks one of the three screens with up and down,...
Definition menu.c:313
s32 STGDGLAB_menuStats[]
The stats the menu's page shows, in PartnerTotals.stats.
Definition menu.c:592
void STGDGLAB_closeMenu(LabMenu *menu)
The main menu's close: fades its page out and hides its stats and name, while a screen is open over i...
Definition menu.c:15
static void showMenuPageLabel(LabMenu *menu, LabMenuWindows *windows)
Once the page's panel has faded in, the member's page and its label.
Definition menu.c:250
static void pickMenuOption(LabMenu *menu, LabMenuWindows *windows)
Up and down pick a screen; cross goes on to the party, triangle leaves the lab.
Definition menu.c:146
static void closeMenuPage(LabMenu *menu, LabMenuWindows *windows)
Once the member panel has faded out, fades the page out and hides its windows (the stats and name onl...
Definition menu.c:212
#define PAD_CROSS
Definition pad.h:31
#define PAD_CIRCLE
Definition pad.h:30
#define PAD_DOWN
Definition pad.h:24
#define PAD_RIGHT
Definition pad.h:23
#define PAD_TRIANGLE
Definition pad.h:32
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
Definition pad.h:140
#define PAD_UP
Definition pad.h:22
#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_CONFIRM
SYSTEM07.
Definition sound.h:44
#define SOUND_SELECT
Sounds the overlays share, with SOUNDTST's names.
Definition sound.h:38
#define SOUND_MENU_CANCEL
SYSTEM01.
Definition sound.h:39
#define SOUND_MENU_MOVE
SYSTEM06.
Definition sound.h:43
#define SOUND_CURSOR
SYSTEM02: a cursor moves.
Definition sound.h:40
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
void(* setPos)()
(cursor, x, y)
Definition text.h:34
void(* setVisible)()
(cursor, visible)
Definition text.h:33
void *(* load)(u32 file)
Definition file.h:92
void *(* getEntry)(u32 fileAndIndex)
Definition file.h:96
struct PartnerStats *(* getPartnerStats)(s32 partner)
Definition game_state.h:38
void(* computeStats)(s32 partner, union PartnerTotals *out)
Definition game_state.h:31
s32(* getPartyPartner)()
Definition game_state.h:28
s32(* getPartyMember)(u32 index)
Definition game_state.h:24
GameFuncs funcs
Definition game_state.h:582
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
LabFuncs funcs
PartnerAnim * anim
STGDGLAB_partnerAnims, by partner.
LabWindowPos * layout
STGDGLAB_layout.
s32(* updateFade)(PanelAnim *fade)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
TextWindow * statValues[5]
STGDGLAB_menuStats.
Definition digimon_lab.h:51
TextWindow * name
Definition digimon_lab.h:52
TextWindow * label
Definition digimon_lab.h:49
Cursor * cursor
Definition digimon_lab.h:55
TextWindow * title
Definition digimon_lab.h:47
TextWindow * options[3]
the three screens
Definition digimon_lab.h:48
struct LabEntryList * panel
Definition digimon_lab.h:56
TextWindow * statLabels[5]
Definition digimon_lab.h:50
TextWindow * entriesHint
circle shows the entries (grey without a partner)
Definition digimon_lab.h:53
The lab's main menu (STGDGLAB_createMenu)
Definition digimon_lab.h:29
void(* nextState)(struct LabMenu *task)
Definition digimon_lab.h:30
s32 blinkTime
Definition digimon_lab.h:38
PanelAnim panels[9]
Definition digimon_lab.h:36
void(* nextSubstate)(struct LabMenu *task)
Definition digimon_lab.h:30
s32 choice
into STGDGLAB_screens
Definition digimon_lab.h:35
void(* setSubstate)(struct LabMenu *task, s32 substate)
Definition digimon_lab.h:30
void(* close)(struct LabMenu *menu)
Definition digimon_lab.h:43
s32 memberCount
the members left and right go through
Definition digimon_lab.h:41
void(* setState)(struct LabMenu *task, s32 state)
Definition digimon_lab.h:30
s32 frames[5]
the party's animations, the picked partner's, then the blinking frame's CLUT row
Definition digimon_lab.h:39
s32 animTime
Definition digimon_lab.h:37
s32 layer
Definition digimon_lab.h:33
struct Lab * lab
Definition digimon_lab.h:31
s32 childCount
Definition digimon_lab.h:30
s32 counter
Definition digimon_lab.h:30
s32 depth
Definition digimon_lab.h:34
void(* open)(struct LabMenu *menu)
Definition digimon_lab.h:42
void * children
Definition digimon_lab.h:30
s32 substate
Definition digimon_lab.h:30
s32 state
Definition digimon_lab.h:30
s32 picked
Definition digimon_lab.h:32
Where a window of the menu or the first screen goes, and its string.
Definition digimon_lab.h:66
s32 string
of TEXT_DIGI_LAB, -1: none
Definition digimon_lab.h:67
The mode's main task (STGDGLAB_createLab)
s32 partySize
the party's slots: PARTY_SIZE
s32 partyCount
void(* fadeOut)(struct Lab *lab)
s32 member
the party member the screens show
s32 level
Definition menu.h:21
s32 duration
Definition menu.h:19
A partner Digimon's animation in a menu: up to seven sprite ids, -1 ending it early (the sprites are ...
Definition game_state.h:340
s32 frames[7]
Definition game_state.h:341
char name[0x18]
Definition game_state.h:304
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(* setPivot)()
(x, y)
Definition gfx.h:250
void(* setScale)()
(x, y, z), ONE = 1.0
Definition gfx.h:248
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(* setPalette)(struct TextWindow *obj, u8 arg)
Definition text.h:174
void(* setDepth)()
Definition text.h:183
void(* setRightAlign)()
no prototype: callers would truncate u8 args
Definition text.h:178
void(* setNumber)()
Definition text.h:166
void(* setPos)(struct TextWindow *obj, s16 x, s16 y)
Definition text.h:173
void(* setString)()
Definition text.h:165
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
#define PALETTE_WHITE
The text windows' palettes (TextWindow.palette, setPalette): rows of the font's CLUTs,...
Definition text.h:112
#define PALETTE_GREY
what is unavailable
Definition text.h:119
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)
computeStats' result: the stats with the equipment added, by STAT_* or by name.
Definition game_state.h:409
s16 stats[24]
Definition game_state.h:410