Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
sort_screen.c
Go to the documentation of this file.
1/* The ninth object of STSTATUS.PRO (see card_screen.c), the screen of
2 STSTATUS_createSortScreen: its rodata starts at 0x80082C88 (USA). */
3
4#include "menus/field_menu.h"
5
6/* Creates the party order screen's windows: the title, the help and the
7 party's pages */
9 s32 i;
10 s32 j;
11 WindowPos *pos;
12
13 pos = &STSTATUS_data.layout[11];
14 windows->title = createTextWindow(screen->layer, 1, pos->x, pos->y);
15 pos = &STSTATUS_data.layout[12];
16 windows->help = createTextWindow(screen->layer, 1, pos->x, pos->y);
17 for (j = 0; j < 3; j++) {
18 pos = &STSTATUS_data.layout[0];
19 windows->pages[j].name = createTextWindow(screen->layer, 1, pos->x, pos->y + j * 46);
20 pos = &STSTATUS_data.layout[1];
21 for (i = 0; i < 5; i++, pos++) {
22 windows->pages[j].labels[i] = createTextWindow(screen->layer, 3, pos->x, pos->y + j * 46);
23 }
24 pos = &STSTATUS_data.layout[6];
25 for (i = 0; i < 5; i++, pos++) {
26 windows->pages[j].values[i] = createTextWindow(screen->layer, 3, pos->x, pos->y + j * 46);
27 }
28 }
29}
30
31/* As STSTATUS_showCardPage */
32void STSTATUS_showSortPage(SortScreen *screen, SortScreenWindows *windows, s32 member, s32 show) {
33 PartnerTotals stats;
34 WindowPos *layout;
35 s32 id;
36 s32 i;
37
38 if (show) {
39 id = GAME.funcs.getPartyMember(member);
40 GAME.funcs.computeStats(id, &stats);
41 windows->pages[member].name->setString(windows->pages[member].name, GAME.funcs.getPartnerStats(id), -1);
42 layout = &STSTATUS_data.layout[1];
43 for (i = 0; i < 5; i++, layout++) {
44 windows->pages[member].labels[i]->setString(windows->pages[member].labels[i],
46 }
47 for (i = 0; i < 5; i++) {
48 windows->pages[member].values[i]->setNumber(windows->pages[member].values[i], 0, stats.stats[STSTATUS_pageStats9[i]]);
49 windows->pages[member].values[i]->setRightAlign(windows->pages[member].values[i], 1);
50 }
51 } else {
52 windows->pages[member].name->setVisible(windows->pages[member].name, 0);
53 for (i = 0; i < 5; i++) {
54 windows->pages[member].labels[i]->setVisible(windows->pages[member].labels[i], 0);
55 }
56 for (i = 0; i < 5; i++) {
57 windows->pages[member].values[i]->setVisible(windows->pages[member].values[i], 0);
58 }
59 }
60}
61
62/* Moves the member cursor's palette on every 8 frames */
63static inline void STSTATUS_stepSortCursor(SortScreen *screen) {
64 if (GFX.funcs.getTime() - screen->cursorTime >= 8) {
65 screen->cursorTime = GFX.funcs.getTime();
66 screen->cursorFrame++;
67 if (screen->cursorFrame >= 8) {
68 screen->cursorFrame = 0;
69 }
70 }
71}
72
73/* Moves the partners' portraits to their next frames every 13 frames */
74static inline void STSTATUS_animateSortPortraits(SortScreen *screen) {
75 s32 id;
76 s32 i;
77
78 if (GFX.funcs.getTime() - screen->frameTime >= 13) {
79 screen->frameTime = GFX.funcs.getTime();
80 for (i = 0; i < screen->count; i++) {
82 screen->frames[i]++;
83 if (STSTATUS_data.partnerAnims[id].frames[screen->frames[i]] == -1 || screen->frames[i] >= 7) {
84 screen->frames[i] = 0;
85 }
86 }
87 }
88}
89
90/* Moves the swap arrow's palette on every 11 frames */
91static inline void STSTATUS_stepSortArrow(SortScreen *screen) {
92 if (GFX.funcs.getTime() - screen->arrowTime >= 11) {
93 screen->arrowTime = GFX.funcs.getTime();
94 screen->arrowFrame++;
95 if (screen->arrowFrame >= 8) {
96 screen->arrowFrame = 0;
97 }
98 }
99}
100
101/* Draws the cursors, the partners' portraits and frames, the two being
102 swapped squashed by the fade, and the swap's arrow */
104 SpriteDrawer sprite;
105 s32 id;
106 s32 i;
107
108 initSpriteDrawer(&sprite);
109 sprite.setLayerId(screen->layer, screen->depth);
111 sprite.setTexture(0x280, 0x100);
112 if (screen->cursorShown) {
113 if (screen->substate == 6) {
114 sprite.setClutRow(screen->cursorFrame);
115 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->cursor * 0x2E + 0x11);
116 } else if (screen->substate == 7) {
117 sprite.setClutRow(screen->cursorFrame);
118 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->second * 0x2E + 0x11);
119 sprite.setClutRow(8);
120 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->first * 0x2E + 0x11);
121 } else if (screen->substate == 8) {
122 sprite.setScale(ONE, screen->fade.level, ONE);
123 sprite.setPivot(0, screen->first * 0x2E + 0x25);
124 sprite.setClutRow(8);
125 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->first * 0x2E + 0x11);
126 sprite.setPivot(0, screen->second * 0x2E + 0x25);
127 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->second * 0x2E + 0x11);
128 }
129 sprite.setClutRow(0);
130 }
132 for (i = 0; i < screen->count; i++) {
133 if (screen->pageFades[i].level != 0) {
134 if (screen->pageFades[i].level != ONE) {
135 sprite.setScale(screen->pageFades[i].level, screen->pageFades[i].level, ONE);
136 sprite.setPivot(0x7C, i * 0x2E + 0x27);
137 } else if ((screen->substate == 8 || screen->substate == 9) && (i == screen->first || i == screen->second)) {
138 sprite.setScale(ONE, screen->fade.level, ONE);
139 sprite.setPivot(0x7C, i * 0x2E + 0x27);
140 } else {
141 sprite.setScale(ONE, ONE, ONE);
142 }
143 id = GAME.funcs.getPartyMember(i);
144 /* the match depends on (*&...): FILE_CACHE.getEntry would keep the
145 cache's address in a register through the loop */
147 STSTATUS_data.partnerAnims[id].frames[screen->frames[i]], 0x6B, i * 0x2E + 0x13);
148 }
149 }
150 sprite.setTexture(0x140, 0);
151 /* the match depends on the three loops sharing i and on the frame's
152 plain draws written in both elses (merged after reload) */
153 for (i = 0; i < screen->count; i++) {
154 if (screen->pageFades[i].level != 0) {
155 if (screen->pageFades[i].level != ONE) {
156 sprite.setScale(screen->pageFades[i].level, ONE, ONE);
157 sprite.setPivot(0, i * 0x2E + 0x25);
158 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x15, 0, i * 0x2E + 0x11);
159 sprite.setScale(screen->pageFades[i].level, screen->pageFades[i].level, ONE);
160 sprite.setPivot(0x7C, i * 0x2E + 0x27);
161 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x16, 0x67, i * 0x2E + 0x13);
162 sprite.setScale(screen->pageFades[i].level, ONE, ONE);
163 sprite.setPivot(0, i * 0x2E + 0x25);
164 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x17, 0, i * 0x2E + 0x11);
165 } else if (screen->substate == 8 || screen->substate == 9) {
166 if (i == screen->first || i == screen->second) {
167 sprite.setScale(ONE, screen->fade.level, ONE);
168 sprite.setPivot(0, i * 0x2E + 0x25);
169 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x15, 0, i * 0x2E + 0x11);
170 sprite.setPivot(0x7C, i * 0x2E + 0x27);
171 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x16, 0x67, i * 0x2E + 0x13);
172 sprite.setPivot(0, i * 0x2E + 0x25);
173 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x17, 0, i * 0x2E + 0x11);
174 } else {
175 sprite.setScale(ONE, ONE, ONE);
176 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x15, 0, i * 0x2E + 0x11);
177 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x16, 0x67, i * 0x2E + 0x13);
178 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x17, 0, i * 0x2E + 0x11);
179 }
180 } else {
181 sprite.setScale(ONE, ONE, ONE);
182 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x15, 0, i * 0x2E + 0x11);
183 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x16, 0x67, i * 0x2E + 0x13);
184 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x17, 0, i * 0x2E + 0x11);
185 }
186 }
187 }
188 if (screen->fades[0].level != 0) {
189 STRETCH_SPRITE(sprite, screen->fades[0].level, 0x140, 0x19);
190 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x18, 0x22, 0xD);
191 }
192 if (screen->fades[1].level != 0) {
193 STRETCH_SPRITE(sprite, screen->fades[1].level, 0, 0xD3);
194 sprite.setTexture(0x280, 0x100);
195 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x20, 0, 0xC2);
196 }
197 if (screen->arrowShown) {
199 sprite.setLayerId(screen->layer, 0);
200 sprite.setClutRow(screen->arrowFrame);
201 switch (screen->first) {
202 case 0:
203 default:
204 if (screen->second == 1) {
205 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x29, 0x93, 0x22);
206 } else {
207 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x28, 0x93, 0x22);
208 }
209 break;
210 case 1:
211 if (screen->second == 0) {
212 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x29, 0x93, 0x22);
213 } else {
214 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x29, 0x93, 0x4F);
215 }
216 break;
217 case 2:
218 if (screen->second == 0) {
219 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x28, 0x93, 0x22);
220 } else {
221 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x29, 0x93, 0x4F);
222 }
223 break;
224 }
225 }
226}
227
228/* Once the first page and its panel are in, shows the page and, with one
229 member, the help, else the title and starts the second page */
230static inline void STSTATUS_openFirstSortPage(SortScreen *screen, SortScreenWindows *windows) {
231 if (screen->count == 1) {
232 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
233 } else {
234 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
235 }
236 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[0])) {
237 STSTATUS_showSortPage(screen, windows, 0, 1);
238 if (screen->count == 1) {
239 screen->substate = 15;
240 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x10);
241 } else {
242 screen->substate++;
243 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x11);
244 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 1);
245 }
246 }
247}
248
249/* Once the second page is in, shows it and, with two members, the help, else
250 starts the third page */
251static inline void STSTATUS_openSecondSortPage(SortScreen *screen, SortScreenWindows *windows) {
252 if (screen->count == 2) {
253 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
254 }
255 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[1])) {
256 STSTATUS_showSortPage(screen, windows, 1, 1);
257 if (screen->count == 2) {
258 screen->substate = 5;
259 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0xF);
260 } else {
261 screen->substate++;
262 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 1);
263 }
264 }
265}
266
267/* Once the third page and the help's panel are in, shows the page and the
268 help */
269static inline void STSTATUS_openThirdSortPage(SortScreen *screen, SortScreenWindows *windows) {
271 if (STSTATUS_data.funcs.updateFade(&screen->fades[1])) {
272 STSTATUS_showSortPage(screen, windows, 2, 1);
273 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0xF);
274 screen->substate = 5;
275 }
276}
277
278/* Choosing the first member to swap: up and down move the cursor (wrapping),
279 cross picks the member and moves the arrow to the next one, triangle closes
280 the screen */
281static inline void STSTATUS_chooseFirstToSwap(SortScreen *screen, SortScreenWindows *windows) {
282 s32 old;
283
284 old = screen->cursor;
286 screen->cursor--;
287 if (screen->cursor < 0) {
288 screen->cursor = screen->count - 1;
289 }
290 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
291 screen->cursor++;
292 if (screen->cursor > screen->count - 1) {
293 screen->cursor = 0;
294 }
295 }
296 if (old != screen->cursor) {
298 }
299 if (PAD_PRESSED(PAD_CROSS)) {
301 screen->arrowShown = 1;
302 screen->substate++;
303 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x12);
304 screen->first = screen->second = screen->cursor;
305 do {
306 screen->second++;
307 if (screen->second > screen->count - 1) {
308 screen->second = 0;
309 }
310 } while (screen->first == screen->second);
311 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
313 screen->cursorShown = 0;
314 screen->substate = 0x14;
315 }
316}
317
318/* Choosing whom to swap the first member with: up and down move the arrow
319 (wrapping, past the first), cross hides both pages, triangle goes back */
320static inline void STSTATUS_chooseSecondToSwap(SortScreen *screen, SortScreenWindows *windows) {
321 s32 old;
322
323 old = screen->second;
325 do {
326 screen->second--;
327 if (screen->second < 0) {
328 screen->second = screen->count - 1;
329 }
330 } while (screen->first == screen->second);
331 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
332 do {
333 screen->second++;
334 if (screen->second > screen->count - 1) {
335 screen->second = 0;
336 }
337 } while (screen->first == screen->second);
338 }
339 if (old != screen->second) {
341 }
342 if (PAD_PRESSED(PAD_CROSS)) {
344 STSTATUS_showSortPage(screen, windows, screen->first, 0);
345 STSTATUS_showSortPage(screen, windows, screen->second, 0);
346 STSTATUS_data.funcs.startFade(&screen->fade, 0);
347 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x11);
348 screen->substate++;
349 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
351 screen->arrowShown = 0;
352 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x11);
353 screen->substate--;
354 }
355}
356
357/* Once both pages are hidden, swaps the two members in the party and starts
358 their portraits again */
359static inline void STSTATUS_swapMembers(SortScreen *screen) {
360 s32 member;
361
362 if (STSTATUS_data.funcs.updateFade(&screen->fade)) {
363 STSTATUS_data.funcs.startFade(&screen->fade, 1);
364 screen->arrowShown = 0;
365 member = GAME.funcs.getPartyMember(screen->first);
366 GAME.party[screen->first] = GAME.funcs.getPartyMember(screen->second);
367 GAME.party[screen->second] = member;
368 screen->frames[screen->first] = 0;
369 screen->frames[screen->second] = 0;
370 screen->substate++;
371 }
372}
373
374/* Once the fade is back, shows both pages again and goes back to choosing */
375static inline void STSTATUS_showSwappedPages(SortScreen *screen, SortScreenWindows *windows) {
376 if (STSTATUS_data.funcs.updateFade(&screen->fade)) {
377 STSTATUS_showSortPage(screen, windows, screen->first, 1);
378 STSTATUS_showSortPage(screen, windows, screen->second, 1);
379 screen->substate = 6;
380 }
381}
382
383/* Starts closing the screen: the help, the last page and its panel */
384static inline void STSTATUS_closeSortScreen(SortScreen *screen, SortScreenWindows *windows) {
385 switch (screen->count) {
386 case 1:
387 default:
388 windows->help->setVisible(windows->help, 0);
389 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
390 STSTATUS_showSortPage(screen, windows, 0, 0);
391 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
392 break;
393 case 2:
394 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
395 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
396 windows->help->setVisible(windows->help, 0);
397 STSTATUS_showSortPage(screen, windows, 1, 0);
398 break;
399 case 3:
400 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 0);
401 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
402 windows->help->setVisible(windows->help, 0);
403 STSTATUS_showSortPage(screen, windows, 2, 0);
404 break;
405 }
406 screen->substate = screen->count + 0x14;
407}
408
409/* One member: ends the screen once the page is closed */
410static inline void STSTATUS_closeSortScreenAlone(SortScreen *screen) {
411 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[0])) {
412 screen->state = 3;
413 }
414 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
415}
416
417/* Two members: once the second page and the help's panel are closed, starts
418 closing the first and the title */
421 if (STSTATUS_data.funcs.updateFade(&screen->fades[1])) {
422 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
423 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
424 windows->title->setVisible(windows->title, 0);
425 STSTATUS_showSortPage(screen, windows, 0, 0);
426 screen->substate = 0x18;
427 }
428}
429
430/* Two or three members: ends the screen once the first page and the title
431 are closed */
432static inline void STSTATUS_closeFirstSortPage(SortScreen *screen) {
434 if (STSTATUS_data.funcs.updateFade(&screen->fades[0])) {
435 screen->state = 3;
436 }
437}
438
439/* Three members: once the third page and the help's panel are closed, starts
440 closing the second */
441static inline void STSTATUS_closeThirdSortPage(SortScreen *screen, SortScreenWindows *windows) {
443 if (STSTATUS_data.funcs.updateFade(&screen->fades[1])) {
444 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
445 STSTATUS_showSortPage(screen, windows, 1, 0);
446 screen->substate = 0x19;
447 }
448}
449
450/* Three members: once the second page is closed, starts closing the first
451 and the title */
453 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[1])) {
454 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
455 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
456 windows->title->setVisible(windows->title, 0);
457 STSTATUS_showSortPage(screen, windows, 0, 0);
458 screen->substate = 0x18;
459 }
460}
461
462/* The party order screen's steps: the pages fade in, two members are chosen
463 and swapped, then the pages fade out */
465 switch (screen->substate) {
466 case 0:
467 default:
468 STSTATUS_openFirstSortPage(screen, windows);
469 break;
470 case 1:
471 STSTATUS_openSecondSortPage(screen, windows);
472 break;
473 case 2:
474 STSTATUS_openThirdSortPage(screen, windows);
475 break;
476 case 5:
477 screen->cursorShown = 1;
478 screen->substate++;
479 break;
480 case 6:
481 STSTATUS_chooseFirstToSwap(screen, windows);
482 break;
483 case 7:
484 STSTATUS_chooseSecondToSwap(screen, windows);
485 break;
486 case 8:
487 STSTATUS_swapMembers(screen);
488 break;
489 case 9:
490 STSTATUS_showSwappedPages(screen, windows);
491 break;
492 case 15:
493 screen->cursorShown = 1;
494 screen->substate++;
495 break;
496 case 16:
498 screen->substate = 0x14;
499 }
500 break;
501 case 0x14:
502 STSTATUS_closeSortScreen(screen, windows);
503 break;
504 case 0x15:
506 break;
507 case 0x16:
508 STSTATUS_closeSecondOfTwoSortPages(screen, windows);
509 break;
510 case 0x18:
512 break;
513 case 0x17:
514 STSTATUS_closeThirdSortPage(screen, windows);
515 break;
516 case 0x19:
518 break;
519 }
520}
521
522/* The party order screen's task: counts the party, starts the fades and creates
523 the windows, then runs and draws the screen */
525 s32 i;
526
527 switch (screen->state) {
528 case TASK_INIT:
529 default:
530 screen->nextState(screen);
531 for (i = 0; i < 3; i++) {
532 if (GAME.funcs.getPartyMember(i) >= 0) {
533 screen->count++;
534 }
535 }
536 for (i = 0; i < screen->count; i++) {
537 screen->pageFades[i].duration = 10;
538 }
539 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 1);
540 for (i = 0; i < 2; i++) {
541 screen->fades[i].duration = 10;
542 STSTATUS_data.funcs.startFade(&screen->fades[i], 1);
543 screen->fade.duration = 8;
544 STSTATUS_data.funcs.startFade(&screen->fade, 0);
545 }
546 STSTATUS_createSortWindows(screen, windows);
547 break;
548 case TASK_RUN:
549 STSTATUS_runSortScreen(screen, windows);
551 break;
552 case TASK_DONE:
553 case TASK_KILL:
554 break;
555 }
556}
557
558/* Creates the field menu's party order screen (task), where two members swap
559 places */
562
563 screen->layer = SCREEN_LAYER;
564 screen->depth = 2;
565 screen->menu = menu;
566 return (Task *)screen;
567}
568
signed int s32
Definition common.h:11
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
STSTATUS.PRO: the field menu's screens.
#define FILE_STATUS_SPRITES
The menu's sprite sheet; the next file is its texture archive.
Definition field_menu.h:20
#define TEXT_FILE(file)
Definition file.h:190
#define TEXT_STATUS
STATUS: the field menu's and STSTATUS's.
Definition file.h:225
#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 STAT_MP
Definition game_state.h:283
#define STAT_MAX_HP
Definition game_state.h:282
#define STAT_HP
Definition game_state.h:281
#define STAT_LEVEL
Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
Definition game_state.h:279
#define STAT_MAX_MP
Definition game_state.h:284
#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
StatusData STSTATUS_data
Definition helpers.c:356
#define PAD_CROSS
Definition pad.h:31
#define PAD_DOWN
Definition pad.h:24
#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_REPEATED(button)
Definition pad.h:141
static void STSTATUS_openFirstSortPage(SortScreen *screen, SortScreenWindows *windows)
Once the first page and its panel are in, shows the page and, with one member, the help,...
static void STSTATUS_stepSortArrow(SortScreen *screen)
Moves the swap arrow's palette on every 11 frames.
Definition sort_screen.c:91
s32 STSTATUS_pageStats9[]
static void STSTATUS_closeSecondOfThreeSortPages(SortScreen *screen, SortScreenWindows *windows)
Three members: once the second page is closed, starts closing the first and the title.
void STSTATUS_showSortPage(SortScreen *screen, SortScreenWindows *windows, s32 member, s32 show)
As STSTATUS_showCardPage.
Definition sort_screen.c:32
static void STSTATUS_stepSortCursor(SortScreen *screen)
Moves the member cursor's palette on every 8 frames.
Definition sort_screen.c:63
void STSTATUS_runSortScreen(SortScreen *screen, SortScreenWindows *windows)
The party order screen's steps: the pages fade in, two members are chosen and swapped,...
void STSTATUS_updateSortScreen(SortScreen *screen, SortScreenWindows *windows)
The party order screen's task: counts the party, starts the fades and creates the windows,...
static void STSTATUS_closeSortScreenAlone(SortScreen *screen)
One member: ends the screen once the page is closed.
static void STSTATUS_swapMembers(SortScreen *screen)
Once both pages are hidden, swaps the two members in the party and starts their portraits again.
static void STSTATUS_closeThirdSortPage(SortScreen *screen, SortScreenWindows *windows)
Three members: once the third page and the help's panel are closed, starts closing the second.
Task * STSTATUS_createSortScreen(FieldMenuScreen *menu, s32 extra)
Creates the field menu's party order screen (task), where two members swap places.
static void STSTATUS_closeFirstSortPage(SortScreen *screen)
Two or three members: ends the screen once the first page and the title are closed.
void STSTATUS_drawSortScreen(SortScreen *screen)
Draws the cursors, the partners' portraits and frames, the two being swapped squashed by the fade,...
static void STSTATUS_closeSecondOfTwoSortPages(SortScreen *screen, SortScreenWindows *windows)
Two members: once the second page and the help's panel are closed, starts closing the first and the t...
static void STSTATUS_showSwappedPages(SortScreen *screen, SortScreenWindows *windows)
Once the fade is back, shows both pages again and goes back to choosing.
static void STSTATUS_openSecondSortPage(SortScreen *screen, SortScreenWindows *windows)
Once the second page is in, shows it and, with two members, the help, else starts the third page.
static void STSTATUS_chooseFirstToSwap(SortScreen *screen, SortScreenWindows *windows)
Choosing the first member to swap: up and down move the cursor (wrapping), cross picks the member and...
static void STSTATUS_chooseSecondToSwap(SortScreen *screen, SortScreenWindows *windows)
Choosing whom to swap the first member with: up and down move the arrow (wrapping,...
static void STSTATUS_closeSortScreen(SortScreen *screen, SortScreenWindows *windows)
Starts closing the screen: the help, the last page and its panel.
static void STSTATUS_openThirdSortPage(SortScreen *screen, SortScreenWindows *windows)
Once the third page and the help's panel are in, shows the page and the help.
static void STSTATUS_animateSortPortraits(SortScreen *screen)
Moves the partners' portraits to their next frames every 13 frames.
Definition sort_screen.c:74
void STSTATUS_createSortWindows(SortScreen *screen, SortScreenWindows *windows)
Creates the party order screen's windows: the title, the help and the party's pages.
Definition sort_screen.c:8
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...
The mode's main task (STSTATUS_createMenu)
Definition field_menu.h:25
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(* getPartyMember)(u32 index)
Definition game_state.h:24
s32 party[3]
partner indices
Definition game_state.h:511
GameFuncs funcs
Definition game_state.h:582
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
s32 level
Definition menu.h:21
s32 duration
Definition menu.h:19
s32 frames[7]
Definition game_state.h:341
TextWindow * values[5]
Definition menu.h:88
TextWindow * labels[5]
Definition menu.h:87
TextWindow * name
Definition menu.h:86
PartnerPage pages[3]
Definition field_menu.h:372
TextWindow * help
Definition field_menu.h:373
TextWindow * title
Definition field_menu.h:371
The screen of STSTATUS_createSortScreen.
Definition field_menu.h:348
PanelAnim fades[2]
Definition field_menu.h:366
s32 cursorFrame
Definition field_menu.h:363
s32 count
party members
Definition field_menu.h:353
PanelAnim pageFades[3]
Definition field_menu.h:365
s32 first
the members to swap
Definition field_menu.h:361
s32 cursorShown
Definition field_menu.h:359
s32 frames[3]
of the partners' portraits
Definition field_menu.h:354
FieldMenuScreen * menu
Definition field_menu.h:350
PanelAnim fade
Definition field_menu.h:367
void(* nextState)(struct SortScreen *task)
Definition field_menu.h:349
s32 arrowShown
the swap's arrow
Definition field_menu.h:356
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
WindowPos * layout
where the windows go, and their strings
Definition field_menu.h:438
PartnerAnim * partnerAnims
the partners' portraits
Definition field_menu.h:437
StatusFuncs funcs
Definition field_menu.h:445
s32(* updateFade)(PanelAnim *fade)
Definition field_menu.h:276
void(* startFade)(PanelAnim *fade, s32 fadeIn)
Definition field_menu.h:275
Any task, seen through its header.
Definition task.h:62
void(* setRightAlign)()
no prototype: callers would truncate u8 args
Definition text.h:178
void(* setNumber)()
Definition text.h:166
void(* setString)()
Definition text.h:165
void(* setVisible)(struct TextWindow *obj, u8 arg)
Definition text.h:177
Where a window goes, and the string it shows.
Definition menu.h:102
s16 y
Definition menu.h:106
s32 string
Definition menu.h:103
s16 x
Definition menu.h:104
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)
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