Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
recipe_screen.c
Go to the documentation of this file.
1/* The main menu's third screen: each table's recipes, checked against the ids
2 a partner has */
3
4#include "menus/digimon_lab.h"
5
6/* Puts in found[row][slot] the owned ids of the recipe (row, col) and clears
7 complete[row] when they're fewer than the recipe needs; gives the ids
8 checked, 0 for a column past the recipes */
9s32 STGDGLAB_findRecipe(LabRecipeScreen *screen, s32 row, u32 col, s32 slot) {
10 s32 i;
11 s32 j;
12 s32 table;
13 s32 *found;
14 s16 *ids;
15 s16 id;
16
17 if (col >= 5) {
18 return 0;
19 }
20 table = screen->table;
21 ids = STGDGLAB_data.recipes[table][row * 4 + col].ids;
22 found = screen->found[row][slot];
23 screen->foundCount[row] = 0;
24 for (i = 0; i < 5; i++) {
25 found[i] = 0;
26 id = ids[i];
27 if (id > 0) {
28 for (j = 0; j < screen->ownedCount; j++) {
29 if (screen->owned[j] == id) {
30 found[i] = screen->owned[j];
31 screen->foundCount[row]++;
32 break;
33 }
34 }
35 }
36 }
37 if (screen->foundCount[row] < STGDGLAB_data.recipes[table][row * 4 + col].needed) {
38 screen->complete[row] = 0;
39 }
40 return 5;
41}
42
43/* Whether the partner has the first id of the recipe (row, col); 0 for a column
44 past the recipes */
46 s16 id;
47 s32 i;
48 s32 j;
49 s16 *ids;
50
51 if (col >= 5) {
52 return 0;
53 }
54 id = 0;
55 ids = STGDGLAB_data.recipes[screen->table][row * 4 + col].ids;
56 for (i = 0; i < 5; i++) {
57 if (*ids > 0) {
58 id = *ids;
59 break;
60 }
61 ids++;
62 }
63 if (id != 0) {
64 for (j = 0; j < screen->ownedCount; j++) {
65 if (screen->owned[j] == id) {
66 return 1;
67 }
68 }
69 }
70 return 0;
71}
72
73/* How many of the row's four recipes the third screen shows: those whose first
74 id the partner has (STGDGLAB_hasRecipeId) */
76 s32 i;
77 s32 count;
78
79 if (row >= 4) {
80 return 0;
81 }
82 i = 0;
83 count = 0;
84 for (; i < 4; i++) {
85 count += STGDGLAB_hasRecipeId(screen, row, i);
86 }
87 return count;
88}
89
90/* Puts the third screen's cursor on the row's first recipe, at its first id
91 found (the last one when none is) */
93 screen->slot = 0;
94 screen->col = 0;
95 while (screen->found[screen->row][screen->slot][screen->col] == 0) {
96 if (++screen->col >= 5) {
97 screen->col = 4;
98 break;
99 }
100 }
101}
102
103/* Draws the third screen: the picked id, the frames, the recipes of the row
104 (the ids found, the empty slots after them) and the arrows */
106 SpriteDrawer sprite;
107 s32 complete;
108 s32 frame;
109 s32 id;
110 s32 shown;
111 /* The match depends on the slots' loop and the second pair of loops
112 having their own counters, and on the first inner loop setting shown
113 after j */
114 s32 i;
115 s32 j;
116 s32 k;
117 s32 m;
118 s32 n;
119
120 complete = 0;
121 if (screen->complete[0] != 0 && screen->complete[1] != 0 && screen->complete[2] != 0) {
122 complete = screen->complete[3] != 0;
123 }
124 initSpriteDrawer(&sprite);
125 sprite.setLayerId(screen->layer, screen->depth - 1);
126 if (screen->panels[1].level != 0) {
127 id = screen->found[screen->row][screen->slot][screen->col];
128 sprite.setTexture(0x140, 0x100);
129 sprite.setAltClut(0x280, 0);
130 sprite.setScale(screen->panels[1].level, ONE, ONE);
131 if (screen->slot < 2) {
132 sprite.setPivot(0, 0xC2);
133 if (id != 0) {
134 frame = STGDGLAB_data.funcs.getSprite(id);
135 sprite.draw(FILE_CACHE.getEntry((FILE_LAB_SPRITES << 16) | 1), frame, 0x14, 0xAF);
136 }
137 sprite.setTexture(0x280, 0x100);
138 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x42, 0, 0xA8);
139 } else {
140 sprite.setPivot(0, 0x4C);
141 if (id != 0) {
142 frame = STGDGLAB_data.funcs.getSprite(id);
143 sprite.draw(FILE_CACHE.getEntry((FILE_LAB_SPRITES << 16) | 1), frame, 0x14, 0x39);
144 }
145 sprite.setTexture(0x280, 0x100);
146 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x42, 0, 0x32);
147 }
148 }
149 initSpriteDrawer(&sprite);
150 sprite.setTexture(0x280, 0x100);
151 sprite.setLayerId(screen->layer, screen->depth);
152 if (GFX.funcs.getTime() - screen->time >= 8) {
153 screen->time = GFX.funcs.getTime();
154 if (++screen->clutRow >= 4) {
155 screen->clutRow = 0;
156 }
157 }
158 sprite.setClutRow(screen->clutRow);
159 if (screen->panels[4].level == ONE) {
160 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x47, screen->col * 0x28 + 0x4A, screen->slot * 0x2E + 0x32);
161 }
162 if (screen->arrowLeft != 0) {
163 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x45, 0x17, 0xC9);
164 }
165 if (screen->arrowRight != 0) {
166 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x46, 0x110, 0xC9);
167 }
168 sprite.setClutRow(0);
169 if (screen->panels[0].level != ONE) {
170 sprite.setScale(screen->panels[0].level, ONE, ONE);
171 sprite.setPivot(0, 0x1F);
172 }
173 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x44, 0, 0x11);
174 if (screen->panels[0].level != ONE) {
175 sprite.setPivot(0x140, 0x1F);
176 }
177 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x43, 0xF0, 0x11);
178 STRETCH_SPRITE(sprite, screen->panels[4].level, 0x44, 0x42);
179 if (screen->found[screen->row][0][0] != -1) {
180 if (complete) {
181 sprite.setClutRow(2);
182 } else if (screen->complete[screen->row] != 0) {
183 sprite.setClutRow(1);
184 }
185 for (i = 0; i < 4; i++) {
186 for (j = 4, shown = 0; j >= 0; j--) {
187 id = screen->found[screen->row][i][j];
188 if (id != 0) {
189 if (STGDGLAB_data.funcs.getSprite(id) != -1) {
190 shown = 1;
191 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x3F, j * 0x28 + 0x4A, i * 0x2E + 0x32);
192 }
193 } else if (shown) {
194 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x40, j * 0x28 + 0x4A, i * 0x2E + 0x32);
195 }
196 }
197 }
198 } else {
199 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x3F, 0x4A, 0x32);
200 }
201 if (complete) {
202 sprite.setClutRow(2);
203 } else {
204 sprite.setClutRow(0);
205 }
206 STRETCH_SPRITE_V(sprite, screen->panels[3].level, 0x40, 0x3F);
207 for (k = screen->slots - 2; k >= 0; k--) {
208 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x3C, 0x3D, k * 0x2E + 0x3F);
209 }
210 STRETCH_SPRITE_V(sprite, screen->panels[2].level, 0x3D, 0x42);
211 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x3D, 0x14, 0x32);
212 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x40, 0x24, 0x32);
213 initSpriteDrawer(&sprite);
214 sprite.setTexture(0x140, 0x100);
215 sprite.setAltClut(0x280, 0);
216 sprite.setLayerId(screen->layer, screen->depth - 1);
217 STRETCH_SPRITE_V(sprite, screen->panels[2].level, 0x3D, 0x42);
218 id = STGDGLAB_tableItems[screen->table];
219 sprite.draw(FILE_CACHE.getEntry((FILE_LAB_SPRITES << 16) | 1), STGDGLAB_data.funcs.getSprite(id), 0x14, 0x32);
220 STRETCH_SPRITE(sprite, screen->panels[4].level, 0x44, 0x42);
221 if (screen->found[screen->row][0][0] != -1) {
222 for (m = 0; m < 4; m++) {
223 for (n = 4; n >= 0; n--) {
224 id = screen->found[screen->row][m][n];
225 if (id != 0) {
226 frame = STGDGLAB_data.funcs.getSprite(id);
227 if (frame != -1) {
228 sprite.draw(FILE_CACHE.getEntry((FILE_LAB_SPRITES << 16) | 1), frame, n * 0x28 + 0x4A, m * 0x2E + 0x32);
229 }
230 }
231 }
232 }
233 } else {
234 sprite.setTexture(0x280, 0x100);
235 sprite.draw(FILE_CACHE.getEntry(FILE_LAB_SPRITES << 16), 0x49, 0x4A, 0x32);
236 }
237}
238
239#if VERSION_EU || VERSION_JP
240/* Moves the third screen's cursor by step slots, to the first column with
241 an id; whether it moved */
243 s32 old = screen->slot;
244 s32 col;
245
246 do {
247 screen->slot += step;
248 if (screen->slot < 0) {
249 screen->slot = 0;
250 } else if (screen->slots - 1 < screen->slot) {
251 screen->slot = screen->slots - 1;
252 }
253 col = 0;
254 while (screen->found[screen->row][screen->slot][col] == 0) {
255 if (++col >= 5) {
256 break;
257 }
258 }
259 } while (screen->found[screen->row][screen->slot][col] == 0);
260 if (old != screen->slot) {
261 screen->col = col;
262 return 1;
263 }
264 return 0;
265}
266#endif
267
268#define FOUND(screen) ((screen)->found[(screen)->row][(screen)->slot][(screen)->col])
269
270/* Finds the owned ids of each recipe of the table's four rows: a row is
271 complete when none of its recipes lacks ids, and has found[row][0][0] -1
272 when it has none */
273static inline void checkRecipes(LabRecipeScreen *screen) {
274 s32 i;
275 s32 j;
276 s32 n;
277 s32 count;
278 s32 found;
279
280 for (i = 0; i < 4; i++) {
281 screen->complete[i] = 1;
282 for (j = 0, n = 0, count = 0; j < 4; j++) {
283 found = STGDGLAB_hasRecipeId(screen, i, j);
284 count += found;
285 if (found) {
286 STGDGLAB_findRecipe(screen, i, j, n);
287 n++;
288 } else if (STGDGLAB_data.recipes[screen->table][i * 4 + j].needed != 0) {
289 screen->complete[i] = 0;
290 }
291 }
292 if (count == 0) {
293 screen->found[i][0][0] = -1;
294 }
295 }
296}
297
298/* Once the title's panel has faded in, the title with the partner's name, the
299 row's number and the arrows' hints; then fades the row's panel in */
300static inline void showRecipeTitle(LabRecipeScreen *screen, LabRecipeScreenWindows *win) {
301 PartnerStats *stats;
302
304 if (STGDGLAB_data.funcs.updateFade(&screen->panels[2]) != 0) {
305 stats = GAME.funcs.getPartnerStats(screen->table);
307 win->title->setSubString(win->title, stats, -1, 1);
308 win->rowNumber->setNumber(win->rowNumber, 0, screen->row + 1);
309 win->rowNumber->setRightAlign(win->rowNumber, 1);
312 win->prev->setVisible(win->prev, 0);
314 STGDGLAB_data.funcs.startFade(&screen->panels[3], 1);
315 screen->substate++;
316 }
317}
318
319/* Moves the cursor over the row's owned ids, skipping the empty places; cross
320 opens the picked id's name and description */
321static inline void pickRecipeId(LabRecipeScreen *screen) {
322 s32 oldCol;
323 s32 oldSlot;
324
325 oldCol = screen->col;
326 oldSlot = screen->slot;
327#if VERSION_US
329 do {
330 if (--screen->slot < 0) {
331 screen->slot = 0;
332 break;
333 }
334 } while (FOUND(screen) == 0);
335 if (FOUND(screen) == 0) {
336 screen->slot = oldSlot;
337 if (screen->slots != 0) {
338 if (screen->col == 0) {
339 screen->col = 1;
340 } else {
341 screen->col--;
342 }
343 do {
344 if (--screen->slot < 0) {
345 screen->slot = 0;
346 break;
347 }
348 } while (FOUND(screen) == 0);
349 if (FOUND(screen) == 0) {
350 screen->slot = oldSlot;
351 screen->col = oldCol;
352 }
353 }
354 }
355 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
356 do {
357 if (++screen->slot > screen->slots - 1) {
358 screen->slot = screen->slots - 1;
359 break;
360 }
361 } while (FOUND(screen) == 0);
362 if (FOUND(screen) == 0) {
363 screen->slot = oldSlot;
364 if (screen->slots != 0) {
365 if (screen->col == 0) {
366 screen->col = 1;
367 } else {
368 screen->col--;
369 }
370 do {
371 if (++screen->slot > screen->slots - 1) {
372 screen->slot = screen->slots - 1;
373 break;
374 }
375 } while (FOUND(screen) == 0);
376 if (FOUND(screen) == 0) {
377 screen->slot = oldSlot;
378 screen->col = oldCol;
379 }
380 }
381 }
382 }
383#elif VERSION_EU || VERSION_JP
384 if (screen->slots >= 2) {
386 STGDGLAB_moveRecipeCursor(screen, -1);
387 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
388 STGDGLAB_moveRecipeCursor(screen, 1);
389 }
390 }
391 if (oldSlot == screen->slot)
392#endif
393 {
395 do {
396 if (--screen->col < 0) {
397 screen->col = 0;
398 break;
399 }
400 } while (FOUND(screen) == 0);
401 if (FOUND(screen) == 0) {
402 screen->col = oldCol;
403 }
405 do {
406 if (++screen->col >= 5) {
407 screen->col = 4;
408 break;
409 }
410 } while (FOUND(screen) == 0);
411 if (FOUND(screen) == 0) {
412 screen->col = oldCol;
413 }
414 }
415 }
416 if (oldCol != screen->col || oldSlot != screen->slot) {
418 }
419#if VERSION_EU || VERSION_JP
420 else
421#endif
422 if (PAD_PRESSED(PAD_CROSS)) {
424 STGDGLAB_data.funcs.startFade(&screen->panels[1], 1);
425 screen->substate++;
426 }
427}
428
429/* Once its panel has faded in, the picked id's name and description, by
430 the panel of its place */
431static inline void showRecipeName(LabRecipeScreen *screen, LabRecipeScreenWindows *win) {
432 s32 id;
433 s32 nameId;
434
435 if (STGDGLAB_data.funcs.updateFade(&screen->panels[1]) != 0) {
436 id = FOUND(screen);
437 nameId = GET_DIGIMON(id)->nameId;
438 if (id != 0) {
439 if (screen->slot < 2) {
440 win->name->setPos(win->name, 0x3A, 0xAD);
441 win->desc->setPos(win->desc, 0x3A, 0xBC);
442 } else {
443 win->name->setPos(win->name, 0x3A, 0x37);
444 win->desc->setPos(win->desc, 0x3A, 0x46);
445 }
448 }
449 screen->substate++;
450 }
451}
452
453/* Fades the row out and, unless the screen is closing (counter), the next
454 row in */
455static inline void changeRecipeRow(LabRecipeScreen *screen) {
456 switch (screen->step) {
457 case 0:
458 default:
459 STGDGLAB_data.funcs.startFade(&screen->panels[4], 0);
460 screen->step++;
461 break;
462 case 1:
463 if (STGDGLAB_data.funcs.updateFade(&screen->panels[4]) != 0) {
464 STGDGLAB_data.funcs.startFade(&screen->panels[3], 0);
465 screen->row = screen->nextRow;
466 screen->step++;
467 }
468 break;
469 case 2:
470 if (STGDGLAB_data.funcs.updateFade(&screen->panels[3]) != 0) {
471 if (screen->counter == 0) {
473 STGDGLAB_data.funcs.startFade(&screen->panels[3], 1);
474 STGDGLAB_data.funcs.startFade(&screen->panels[4], 1);
475 screen->slots = STGDGLAB_countRowIds(screen, screen->row);
476 screen->step++;
477 } else {
478 screen->state = TASK_RUN;
479 }
480 }
481 break;
482 case 3:
483 if (STGDGLAB_data.funcs.updateFade(&screen->panels[3]) != 0) {
484 screen->step++;
485 }
486 break;
487 case 4:
488 if (STGDGLAB_data.funcs.updateFade(&screen->panels[4]) != 0) {
489 screen->state = TASK_RUN;
490 }
491 break;
492 }
493}
494
495/* L1 and R1 go to the previous or next row (the arrows show where there is
496 one), triangle closes the screen; otherwise the cursor moves over the row */
497static inline void runRecipeRow(LabRecipeScreen *screen, LabRecipeScreenWindows *win) {
498 screen->nextRow = screen->row;
500 if (--screen->nextRow < 0) {
501 screen->nextRow = 0;
502 }
503 } else if ((!PAD_HELD(PAD_L1) && PAD_PRESSED(PAD_R1)) || (!PAD_HELD(PAD_L1) && PAD_REPEATED(PAD_R1))) {
504 if (++screen->nextRow > screen->rowCount - 1) {
505 screen->nextRow = screen->rowCount - 1;
506 }
507 }
508 if (screen->nextRow != screen->row) {
510 win->rowNumber->setNumber(win->rowNumber, 0, screen->nextRow + 1);
511 win->rowNumber->setRightAlign(win->rowNumber, 1);
512 if (screen->nextRow == 0) {
513 win->prev->setVisible(win->prev, 0);
514 screen->arrowLeft = 0;
515 } else if (screen->nextRow == screen->rowCount - 1) {
516 win->next->setVisible(win->next, 0);
517 screen->arrowRight = 0;
518 } else {
519 win->prev->setVisible(win->prev, 1);
520 win->next->setVisible(win->next, 1);
521 screen->arrowLeft = 1;
522 screen->arrowRight = 1;
523 }
524 screen->state = TASK_DONE;
525 screen->step = 0;
526 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
528 screen->state = TASK_DONE;
529 screen->substate = 7;
530 screen->step = 0;
531 screen->counter = 1;
532 screen->arrowLeft = 0;
533 screen->arrowRight = 0;
534 win->prev->setVisible(win->prev, 0);
535 win->next->setVisible(win->next, 0);
536 } else if (screen->found[screen->row][0][0] != -1) {
537 pickRecipeId(screen);
538 }
539}
540
541/* The third screen: a row of recipes at a time, the picked id's name and
542 description on cross */
544 switch (screen->state) {
545 case TASK_INIT:
546 default:
547 if (screen->lab->menuOpen(screen->lab)) {
548 screen->nextState(screen);
549 screen->table = GAME.funcs.getPartyMember(screen->lab->member);
550 screen->ownedCount = GAME.funcs.listPartnerEntries(screen->table, screen->owned);
551 win->title = createTextWindow(screen->layer, 1, 0x14, 0x19);
552 win->rowNumber = createTextWindow(screen->layer, 1, 0xFF, 0x19);
553 win->rowLabel = createTextWindow(screen->layer, 1, 0x101, 0x19);
554 win->prev = createTextWindow(screen->layer, 1, 0x27, 0xC4);
555 win->prev->setDepth(win->prev, 2);
556 win->next = createTextWindow(screen->layer, 1, 0x115, 0xC4);
557 win->next->setDepth(win->next, 2);
558 win->name = createTextWindow(screen->layer, 1, 0x14, 0x19);
559 win->name->setDepth(win->name, 0);
560 win->desc = createTextWindow(screen->layer, 1, 0x14, 0x19);
561 win->desc->setDepth(win->desc, 0);
562 checkRecipes(screen);
563 screen->rowCount = 4;
564 screen->slots = STGDGLAB_countRowIds(screen, screen->row);
566 screen->panels[0].duration = 8;
567 screen->panels[1].duration = 8;
568 screen->panels[2].duration = 8;
569 screen->panels[4].duration = 8;
570 screen->panels[3].duration = 8;
571 screen->arrowLeft = 0;
572 screen->arrowRight = 1;
573 STGDGLAB_data.funcs.startFade(&screen->panels[0], 1);
574 STGDGLAB_data.funcs.startFade(&screen->panels[2], 1);
575 STGDGLAB_data.funcs.startFade(&screen->panels[4], 1);
576 STGDGLAB_data.funcs.startFade(&screen->panels[3], 1);
577 }
578 break;
579 case TASK_RUN:
580 switch (screen->substate) {
581 case 0:
582 default:
583 showRecipeTitle(screen, win);
584 break;
585 case 1:
586 if (STGDGLAB_data.funcs.updateFade(&screen->panels[3]) != 0) {
587 STGDGLAB_data.funcs.startFade(&screen->panels[4], 1);
588 screen->substate++;
589 }
590 break;
591 case 2:
592 if (STGDGLAB_data.funcs.updateFade(&screen->panels[4]) != 0) {
593 screen->substate++;
594 }
595 break;
596 case 3:
597 runRecipeRow(screen, win);
598 break;
599 case 4:
600 showRecipeName(screen, win);
601 break;
602 case 5:
603 if (PAD_PRESSED(PAD_CROSS)) {
604 STGDGLAB_data.funcs.startFade(&screen->panels[1], 0);
605 win->name->setVisible(win->name, 0);
606 win->desc->setVisible(win->desc, 0);
607 screen->substate++;
608 }
609 break;
610 case 6:
611 if (STGDGLAB_data.funcs.updateFade(&screen->panels[1]) != 0) {
612 screen->substate = 3;
613 }
614 break;
615 case 7:
616 STGDGLAB_data.funcs.startFade(&screen->panels[0], 0);
617 STGDGLAB_data.funcs.startFade(&screen->panels[2], 0);
618 win->title->setVisible(win->title, 0);
619 win->rowNumber->setVisible(win->rowNumber, 0);
620 win->rowLabel->setVisible(win->rowLabel, 0);
621 screen->substate++;
622 break;
623 case 8:
625 if (STGDGLAB_data.funcs.updateFade(&screen->panels[2]) != 0) {
626 screen->setState(screen, TASK_KILL);
627 }
628 break;
629 }
630 STGDGLAB_drawRecipeScreen(screen, win);
631 break;
632 case TASK_DONE:
633 changeRecipeRow(screen);
634 STGDGLAB_drawRecipeScreen(screen, win);
635 break;
636 case TASK_KILL:
637 break;
638 }
639}
640
641/* Creates the main menu's third screen (task), the recipes, and fades the
642 menu's page out */
645
646 screen->layer = SCREEN_LAYER;
647 screen->depth = 2;
648 screen->lab = lab;
649 lab->closeMenu(lab);
650 return (Task *)screen;
651}
652
653/* The item each table's screen shows (STGDGLAB_entries) */
655 383, 385, 384, 3,
656 145, 366, 373, 31,
657};
signed int s32
Definition common.h:11
unsigned int u32
Definition common.h:12
signed short s16
Definition common.h:9
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
#define TEXT_DIGI_LAB
DGLABO: STGDGLAB's.
Definition file.h:208
#define TEXT_FILE(file)
Definition file.h:190
#define TEXT_DIGIMON_INFO
DIGINF.
Definition file.h:210
#define TEXT_DIGIMON_NAMES
DIGNAM.
Definition file.h:211
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
DigimonData *(* GET_DIGIMON)(s32 id)
getDigimon for the overlays, in the small data (.sdata) between game/items.c's and file/file_table....
Definition get_digimon.c:10
#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
#define STRETCH_SPRITE_V(sprite, level, x, y)
Definition gfx.h:274
LabData STGDGLAB_data
Definition lab.c:611
#define PAD_CROSS
Definition pad.h:31
#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_L1
Definition pad.h:28
#define PAD_LEFT
Definition pad.h:25
#define PAD_HELD(button)
Definition pad.h:142
#define PAD_R1
Definition pad.h:29
#define PAD_REPEATED(button)
Definition pad.h:141
static void checkRecipes(LabRecipeScreen *screen)
Finds the owned ids of each recipe of the table's four rows: a row is complete when none of its recip...
void STGDGLAB_resetRecipeCursor(LabRecipeScreen *screen)
Puts the third screen's cursor on the row's first recipe, at its first id found (the last one when no...
static void changeRecipeRow(LabRecipeScreen *screen)
Fades the row out and, unless the screen is closing (counter), the next row in.
static void runRecipeRow(LabRecipeScreen *screen, LabRecipeScreenWindows *win)
L1 and R1 go to the previous or next row (the arrows show where there is one), triangle closes the sc...
Task * STGDGLAB_createRecipeScreen(Lab *lab)
Creates the main menu's third screen (task), the recipes, and fades the menu's page out.
void STGDGLAB_updateRecipeScreen(LabRecipeScreen *screen, LabRecipeScreenWindows *win)
The third screen: a row of recipes at a time, the picked id's name and description on cross.
static void showRecipeTitle(LabRecipeScreen *screen, LabRecipeScreenWindows *win)
Once the title's panel has faded in, the title with the partner's name, the row's number and the arro...
s32 STGDGLAB_tableItems[]
The item each table's screen shows (STGDGLAB_entries)
s32 STGDGLAB_countRowIds(LabRecipeScreen *screen, u32 row)
How many of the row's four recipes the third screen shows: those whose first id the partner has (STGD...
s32 STGDGLAB_moveRecipeCursor(LabRecipeScreen *screen, s32 step)
Moves the third screen's cursor by step slots, to the first column with an id; whether it moved.
static void showRecipeName(LabRecipeScreen *screen, LabRecipeScreenWindows *win)
Once its panel has faded in, the picked id's name and description, by the panel of its place.
s32 STGDGLAB_hasRecipeId(LabRecipeScreen *screen, s32 row, u32 col)
Whether the partner has the first id of the recipe (row, col); 0 for a column past the recipes.
s32 STGDGLAB_findRecipe(LabRecipeScreen *screen, s32 row, u32 col, s32 slot)
Puts in found[row][slot] the owned ids of the recipe (row, col) and clears complete[row] when they're...
void STGDGLAB_drawRecipeScreen(LabRecipeScreen *screen, LabRecipeScreenWindows *win)
Draws the third screen: the picked id, the frames, the recipes of the row (the ids found,...
static void pickRecipeId(LabRecipeScreen *screen)
Moves the cursor over the row's owned ids, skipping the empty places; cross opens the picked id's nam...
#define FOUND(screen)
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_MENU_CANCEL
SYSTEM01.
Definition sound.h:39
#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...
u8 nameId
string in file 0x4F
Definition game_state.h:105
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
s32(* getPartyMember)(u32 index)
Definition game_state.h:24
s32(* listPartnerEntries)()
(partner, s16 *out): the count
Definition game_state.h:34
GameFuncs funcs
Definition game_state.h:582
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
LabFuncs funcs
LabRecipe * recipes[8]
[row * 4 + col]
s32(* updateFade)(PanelAnim *fade)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s32(* getSprite)(s32 id)
TextWindow * prev
by the arrows
TextWindow * name
the picked id's
TextWindow * title
with the partner's name
The main menu's third screen (STGDGLAB_createRecipeScreen)
PanelAnim panels[5]
s32 complete[4]
0: a recipe of the row lacks ids
s32 table
into STGDGLAB_data.recipes
struct Lab * lab
s32 slots
how many of found[row] are in use
void(* setState)(struct LabRecipeScreen *task, s32 state)
s32 nextRow
L1 and R1 move to it.
void(* nextState)(struct LabRecipeScreen *task)
s32 found[4][4][5]
the owned ids of each recipe
s16 ids[5]
0: none
Definition digimon_lab.h:62
s16 needed
how many of the ids the partner must have
Definition digimon_lab.h:61
The mode's main task (STGDGLAB_createLab)
s32(* closeMenu)(struct Lab *lab)
s32 member
the party member the screens show
s32(* menuOpen)(struct Lab *lab)
s32 level
Definition menu.h:21
s32 duration
Definition menu.h:19
A partner Digimon from its name on (Partner.info), as getPartnerStats gives it.
Definition game_state.h:303
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(* setAltClut)()
(x, y)
Definition gfx.h:243
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
Any task, seen through its header.
Definition task.h:62
void(* setDepth)()
Definition text.h:183
void(* setRightAlign)()
no prototype: callers would truncate u8 args
Definition text.h:178
void(* setSubString)()
Definition text.h:168
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
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)