Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
item_screen.c
Go to the documentation of this file.
1/* The sixth object of STSTATUS.PRO (see card_screen.c), the first screen
2 (STSTATUS_createItemScreen): its rodata starts at 0x800829D0 (USA). */
3
4#include "menus/field_menu.h"
5
6/* Creates the first screen's windows */
8 WindowPos *pos;
9 s32 i;
10 s32 j;
11
12 pos = &STSTATUS_data.layout[11];
13 windows->title = createTextWindow(screen->layer, 1, pos->x, pos->y);
14 pos = &STSTATUS_data.layout[12];
15 windows->help = createTextWindow(screen->layer, 1, pos->x, pos->y);
16 windows->kind = createTextWindow(screen->layer, 1, pos->x, pos->y + 14);
17 windows->answers[0] = createTextWindow(screen->layer, 1, pos->x + 0x10, pos->y + 14);
18 windows->answers[1] = createTextWindow(screen->layer, 1, pos->x + 0x42, pos->y + 14);
19 windows->answerCursor = createCursor(screen->layer, screen->depth - 1, pos->x, pos->y + 14);
20 windows->answerCursor->setVisible(windows->answerCursor, 0);
21 for (j = 0; j < 3; j++) {
22 pos = &STSTATUS_data.layout[0];
23 windows->pages[j].name = createTextWindow(screen->layer, 1, pos->x, pos->y + j * 46);
24 pos = &STSTATUS_data.layout[1];
25 for (i = 0; i < 5; i++, pos++) {
26 windows->pages[j].labels[i] = createTextWindow(screen->layer, 3, pos->x, pos->y + j * 46);
27 }
28 pos = &STSTATUS_data.layout[6];
29 for (i = 0; i < 5; i++, pos++) {
30 windows->pages[j].values[i] = createTextWindow(screen->layer, 3, pos->x, pos->y + j * 46);
31 }
32 }
33 windows->money = createTextWindow(screen->layer, 3, 0x42, 0xA6);
34 windows->moneyLabel = createTextWindow(screen->layer, 3, 0x46, 0xA6);
35 pos = &STSTATUS_data.layout[15];
36 for (i = 0; i < 5; i++) {
37 windows->options[i] = createTextWindow(screen->layer, 1, pos->x, pos->y + i * 14);
38 }
39 windows->optionCursor = createCursor(screen->layer, screen->depth - 1, 0xB0, screen->option * 14 + 0x31);
40 windows->optionCursor->setVisible(windows->optionCursor, 0);
41 windows->itemName = createTextWindow(screen->layer, 1, 0x25, 0xAE);
42 windows->equippedLabel = createTextWindow(screen->layer, 1, 0xA1, 0xAF);
43 windows->equipped = createTextWindow(screen->layer, 1, 0xE0, 0xAF);
44 windows->ownedLabel = createTextWindow(screen->layer, 1, 0xEA, 0xAF);
45 windows->owned = createTextWindow(screen->layer, 1, 0x128, 0xAF);
46}
47
48/* As STSTATUS_showCardPage */
49void STSTATUS_showItemPage(ItemScreen *screen, ItemScreenWindows *windows, s32 member, s32 show) {
50 PartnerTotals stats;
51 WindowPos *layout;
52 s32 id;
53 s32 i;
54
55 if (show) {
56 id = GAME.funcs.getPartyMember(member);
57 GAME.funcs.computeStats(id, &stats);
58 windows->pages[member].name->setString(windows->pages[member].name, GAME.funcs.getPartnerStats(id), -1);
59 layout = &STSTATUS_data.layout[1];
60 for (i = 0; i < 5; i++, layout++) {
61 windows->pages[member].labels[i]->setString(windows->pages[member].labels[i],
63 }
64 for (i = 0; i < 5; i++) {
65 windows->pages[member].values[i]->setNumber(windows->pages[member].values[i], 0, stats.stats[STSTATUS_pageStats0[i]]);
66 windows->pages[member].values[i]->setRightAlign(windows->pages[member].values[i], 1);
67 }
68 } else {
69 windows->pages[member].name->setVisible(windows->pages[member].name, 0);
70 for (i = 0; i < 5; i++) {
71 windows->pages[member].labels[i]->setVisible(windows->pages[member].labels[i], 0);
72 }
73 for (i = 0; i < 5; i++) {
74 windows->pages[member].values[i]->setVisible(windows->pages[member].values[i], 0);
75 }
76 }
77}
78
79/* Shows or hides the player's money */
80void STSTATUS_showMoney(ItemScreen *screen, ItemScreenWindows *windows, s32 show) {
81 if (show != 0) {
83 windows->money->setNumber(windows->money, 0, GAME.money);
84 windows->money->setRightAlign(windows->money, 1);
85 } else {
86 windows->moneyLabel->setVisible(windows->moneyLabel, 0);
87 windows->money->setVisible(windows->money, 0);
88 }
89}
90
91/* Shows or hides the first screen's five options, the item lists */
93 WindowPos *layout;
94 s32 i;
95
96 if (show != 0) {
97 layout = &STSTATUS_data.layout[15];
98 for (i = 0; i < 5; i++) {
99 windows->options[i]->setString(windows->options[i], FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)),
100 layout->string + i);
101 }
102 } else {
103 for (i = 0; i < 5; i++) {
104 windows->options[i]->setVisible(windows->options[i], 0);
105 }
106 }
107}
108
109/* Shows or hides the chosen item's name and how many are equipped and owned */
111 ItemScreenWindows *windows = screen->children;
112
113 if (show) {
114 windows->itemName->setString(windows->itemName, FILE_CACHE.load(TEXT_FILE(TEXT_ITEM_NAMES)), screen->item);
116 windows->equipped->setNumber(windows->equipped, 0, GAME.equippedItems[screen->item]);
117 windows->equipped->setRightAlign(windows->equipped, 1);
119 windows->owned->setNumber(windows->owned, 0, GAME.items[screen->item]);
120 windows->owned->setRightAlign(windows->owned, 1);
121 screen->itemShown = 1;
122 } else {
123 windows->itemName->setVisible(windows->itemName, 0);
124 windows->equippedLabel->setVisible(windows->equippedLabel, 0);
125 windows->equipped->setVisible(windows->equipped, 0);
126 windows->ownedLabel->setVisible(windows->ownedLabel, 0);
127 windows->owned->setVisible(windows->owned, 0);
128 screen->itemShown = 0;
129 }
130}
131
132/* The help line: 1 the chosen item and the kind of a weapon, 2 a question
133 with two answers, -2 hides the answers, -1 the kind, others all */
135 ItemScreenWindows *windows = screen->children;
136 ItemInfo *info;
137 ItemData *data;
138
139 if (mode == 1) {
140 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_ITEM_INFO)), screen->item);
141 info = ITEM_FUNCS.get(screen->item);
142 if (info->type >= 2 && info->type <= 14) {
143 data = info->data.record;
145 }
146 } else if (mode == -1) {
147 windows->kind->setVisible(windows->kind, 0);
148 } else if (mode == 2) {
149 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x31);
150 windows->answers[0]->setString(windows->answers[0], FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x32);
151 windows->answers[1]->setString(windows->answers[1], FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x33);
152 windows->answerCursor->setVisible(windows->answerCursor, 1);
153 } else if (mode == -2) {
154 windows->answers[0]->setVisible(windows->answers[0], 0);
155 windows->answers[1]->setVisible(windows->answers[1], 0);
156 windows->answerCursor->setVisible(windows->answerCursor, 0);
157 } else {
158 windows->help->setVisible(windows->help, 0);
159 windows->kind->setVisible(windows->kind, 0);
160 }
161}
162
163/* Opens or closes the chosen item's panel (its icon and frame); closing it also
164 hides the item's name, counts and help */
166 if (show != 0) {
167 STSTATUS_data.funcs.startFade(&screen->fade, 1);
168 return;
169 }
170 STSTATUS_data.funcs.startFade(&screen->fade, 0);
171 STSTATUS_showChosenItem(screen, 0);
172 STSTATUS_showItemHelp(screen, 0);
173}
174
175/* Moves the chosen item's panel on; 1 once it is fully open or closed */
177 return STSTATUS_data.funcs.updateFade(&screen->fade) != 0;
178}
179
180/* Uses the chosen item on the chosen party member */
182 s32 amount = 0;
183 ItemEffect *effect = ITEM_FUNCS.get(screen->item)->data.effect;
185 StatusStatItem *entry;
186 s16 *values;
187 s32 i;
188 s32 result = 0;
189
190 switch (effect->kind) {
191 case 0:
192 break;
193 case 1:
194 if (stats->stats[STAT_HP] < stats->stats[STAT_MAX_HP]) {
195 stats->stats[STAT_HP] += effect->amount;
196 amount = effect->amount;
197 if (stats->stats[STAT_HP] > stats->stats[STAT_MAX_HP]) {
198 stats->stats[STAT_HP] = stats->stats[STAT_MAX_HP];
199 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x52);
200 result = 2;
201 } else {
202 result = 1;
203 }
204 }
205 break;
206 case 17:
207 if (stats->stats[STAT_TP] < 99) {
208 stats->stats[STAT_TP] += effect->amount;
209 amount = effect->amount;
210 result = 1;
211 if (stats->stats[STAT_TP] > 99) {
212 stats->stats[STAT_TP] = 99;
213 }
214 }
215 break;
216 default:
217 for (i = 0; STSTATUS_statItems[i].kind != -1; i++) {
218 entry = &STSTATUS_statItems[i];
219 if (effect->kind == entry->kind) {
220 values = stats->stats;
221 if (values[entry->stat] < entry->max) {
222 amount = RANDOM.next() % effect->amount + 1;
223 values[entry->stat] += amount;
224 if (values[entry->stat] > entry->max) {
225 values[entry->stat] = entry->max;
226 }
227 result = 1;
228 }
229 break;
230 }
231 }
232 break;
233 }
234 if (result != 0) {
235 if (result == 1) {
236 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), effect->kind + 0x52);
237 windows->help->setNumber(windows->help, 1, amount);
238 }
239 GAME.items[screen->item]--;
240 STSTATUS_showItemPage(screen, windows, screen->member, 1);
242 } else {
243 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x6A);
245 }
246}
247
248/* Moves the partners' portraits to their next frames every 13 frames */
249static inline void STSTATUS_animateItemPortraits(ItemScreen *screen) {
250 s32 id;
251 s32 i;
252
253 if (GFX.funcs.getTime() - screen->frameTime >= 13) {
254 screen->frameTime = GFX.funcs.getTime();
255 for (i = 0; i < screen->count; i++) {
256 id = GAME.funcs.getPartyMember(i);
257 screen->frames[i]++;
258 if (STSTATUS_data.partnerAnims[id].frames[screen->frames[i]] == -1 ||
259 screen->frames[i] >= 7) {
260 screen->frames[i] = 0;
261 }
262 }
263 }
264}
265
266/* Moves the member cursor's palette on every 9 frames */
267static inline void STSTATUS_stepItemCursor(ItemScreen *screen) {
268 if (GFX.funcs.getTime() - screen->cursorTime >= 9) {
269 screen->cursorTime = GFX.funcs.getTime();
270 screen->cursorFrame++;
271 if (screen->cursorFrame >= 8) {
272 screen->cursorFrame = 0;
273 }
274 }
275}
276
277/* Draws the partners' portraits and frames, the item, the cursor and the help arrow */
279 SpriteDrawer sprite;
280 s32 id;
281 s32 i;
282
283 initSpriteDrawer(&sprite);
284 sprite.setLayerId(screen->layer, screen->depth);
286 for (i = 0; i < screen->count; i++) {
287 if (screen->pageFades[i].level != 0) {
288 ZOOM_SPRITE(sprite, screen->pageFades[i].level, 0x7C, i * 0x2E + 0x27);
289 id = GAME.funcs.getPartyMember(i);
290 sprite.setTexture(0x280, 0x100);
292 STSTATUS_data.partnerAnims[id].frames[screen->frames[i]], 0x6B,
293 i * 0x2E + 0x13);
294 }
295 }
296 sprite.setTexture(0x140, 0);
297 DRAW_PAGE_PANELS(sprite, screen, i);
298 if (screen->fades[0].level != 0) {
299 STRETCH_SPRITE(sprite, screen->fades[0].level, 0x140, 0x19);
300 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x18, 0x22, 0xD);
301 }
302 if (screen->fades2[0].level != 0) {
303 STRETCH_SPRITE(sprite, screen->fades2[0].level, 0x140, 0x52);
304 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x1C, 0xA8, 0x28);
305 }
306 if (screen->fades2[1].level != 0) {
307 STRETCH_SPRITE(sprite, screen->fades2[1].level, 0, 0xA8);
308 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0x1A, 0, 0x9E);
309 }
310 if (screen->fades[1].level != 0) {
311 if (screen->blink) {
312 if (GFX.funcs.getTime() - screen->blinkTime >= 4) {
313 screen->blinkTime = GFX.funcs.getTime();
314 screen->blinkFrame++;
315 if (screen->blinkFrame >= 5) {
316 screen->blinkFrame = 0;
317 }
318 }
319 sprite.setTexture(0x140, 0);
320 sprite.setClutRow(screen->blinkFrame);
321 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), 0xA, 0x123, 0xD6);
322 sprite.setClutRow(0);
323 }
324 STRETCH_SPRITE(sprite, screen->fades[1].level, 0, 0xD3);
325 sprite.setTexture(0x280, 0x100);
326 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x20, 0, 0xC2);
327 }
328 if (screen->fade.level != 0) {
329 if (screen->fade.level != ONE) {
330 sprite.setScale(screen->fade.level, ONE, ONE);
331 sprite.setPivot(0x140, 0xB2);
332 } else {
333 sprite.setScale(ONE, ONE, ONE);
334 sprite.setTexture(0x140, 0);
335 sprite.draw(FILE_CACHE.getEntry(FILE_MENU_SPRITES << 16), ITEM_FUNCS.getCategory(screen->item), 0x16, 0xAE);
336 }
337 sprite.setTexture(0x280, 0x100);
338 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x2F, 0xF, 0xA5);
339 }
340 if (screen->cursorShown) {
342 sprite.setScale(ONE, ONE, ONE);
343 sprite.setLayerId(screen->layer, screen->depth - 1);
344 sprite.setClutRow(screen->cursorFrame);
345 sprite.draw(FILE_CACHE.getEntry(FILE_STATUS_SPRITES << 16), 0x1E, 0, screen->member * 0x2E + 0x11);
346 }
347}
348
349/* Starts the fades of the first page and the title and, with one party
350 member, of the other panels (the help's unless it stayed open); the next
351 substate is the party's size */
352static inline void STSTATUS_startItemScreen(ItemScreen *screen) {
353 switch (screen->count) {
354 case 1:
355 default:
356 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 1);
357 STSTATUS_data.funcs.startFade(&screen->fades[0], 1);
358 if (screen->step == 0) {
359 STSTATUS_data.funcs.startFade(&screen->fades[1], 1);
360 }
361 STSTATUS_data.funcs.startFade(&screen->fades2[1], 1);
362 STSTATUS_data.funcs.startFade(&screen->fades2[0], 1);
363 break;
364 case 2:
365 case 3:
366 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 1);
367 STSTATUS_data.funcs.startFade(&screen->fades[0], 1);
368 break;
369 }
370 screen->substate = screen->count;
371}
372
373/* One member: once the panels are in, shows the title, the page, the help,
374 the money and the options */
375static inline void STSTATUS_openItemScreenAlone(ItemScreen *screen, ItemScreenWindows *windows) {
377 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
378 if (screen->step == 0) {
379 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
380 }
382 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
383 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x14);
384 STSTATUS_showItemPage(screen, windows, 0, 1);
385 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
386 windows->kind->setString(windows->kind, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x15);
387 STSTATUS_showMoney(screen, windows, 1);
388 STSTATUS_showItemLists(screen, windows, 1);
389 windows->optionCursor->setVisible(windows->optionCursor, 1);
390 screen->substate = 10;
391 }
392}
393
394/* Two members: once the first page and the title are in, shows them and
395 starts the second page and the other panels */
396static inline void STSTATUS_openFirstOfTwoItemPages(ItemScreen *screen, ItemScreenWindows *windows) {
398 if (STSTATUS_data.funcs.updateFade(&screen->fades[0])) {
399 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 1);
400 if (screen->step == 0) {
401 STSTATUS_data.funcs.startFade(&screen->fades[1], 1);
402 }
403 STSTATUS_data.funcs.startFade(&screen->fades2[1], 1);
404 STSTATUS_data.funcs.startFade(&screen->fades2[0], 1);
405 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x14);
406 STSTATUS_showItemPage(screen, windows, 0, 1);
407 screen->substate = 4;
408 }
409}
410
411/* Two members: once the second page and the panels are in, shows the page,
412 the options, the help and the money */
415 if (screen->step == 0) {
416 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
417 }
419 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
420 STSTATUS_showItemPage(screen, windows, 1, 1);
421 STSTATUS_showItemLists(screen, windows, 1);
422 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
423 windows->kind->setString(windows->kind, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x15);
424 STSTATUS_showMoney(screen, windows, 1);
425 windows->optionCursor->setVisible(windows->optionCursor, 1);
426 screen->substate = 10;
427 }
428}
429
430/* Three members: once the first page and the title are in, shows them and
431 starts the second page and the options' panel */
434 if (STSTATUS_data.funcs.updateFade(&screen->fades[0])) {
435 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 1);
436 STSTATUS_data.funcs.startFade(&screen->fades2[0], 1);
437 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x14);
438 STSTATUS_showItemPage(screen, windows, 0, 1);
439 screen->substate = 5;
440 }
441}
442
443/* Three members: once the second page and the options' panel are in, shows
444 them and starts the third page and the help's and the money's panels */
447 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
448 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 1);
449 if (screen->step == 0) {
450 STSTATUS_data.funcs.startFade(&screen->fades[1], 1);
451 }
452 STSTATUS_data.funcs.startFade(&screen->fades2[1], 1);
453 STSTATUS_showItemPage(screen, windows, 1, 1);
454 STSTATUS_showItemLists(screen, windows, 1);
455 screen->substate++;
456 }
457}
458
459/* Three members: once the third page and the panels are in, shows the page,
460 the help and the money */
461static inline void STSTATUS_openThirdItemPage(ItemScreen *screen, ItemScreenWindows *windows) {
463 if (screen->step == 0) {
464 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
465 }
466 if (STSTATUS_data.funcs.updateFade(&screen->fades2[1])) {
467 STSTATUS_showItemPage(screen, windows, 2, 1);
468 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
469 windows->kind->setString(windows->kind, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x15);
470 windows->optionCursor->setVisible(windows->optionCursor, 1);
471 STSTATUS_showMoney(screen, windows, 1);
472 screen->substate = 10;
473 }
474}
475
476/* The options, the item lists: up and down move the cursor, cross opens the
477 chosen list (or says it is empty), triangle closes the screen */
478static inline void STSTATUS_chooseItemList(ItemScreen *screen, ItemScreenWindows *windows) {
479 s32 old;
480
481 old = screen->option;
483 screen->option--;
484 if (screen->option < 0) {
485 screen->option = 0;
486 }
487 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
488 screen->option++;
489 if (screen->option >= 5) {
490 screen->option = 4;
491 }
492 }
493 if (old != screen->option) {
495 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
496 windows->optionCursor->setPos(windows->optionCursor, 0xB0, screen->option * 0xE + 0x31);
497 } else if (PAD_PRESSED(PAD_CROSS)) {
499 screen->itemCount = ITEM_FUNCS.list(STSTATUS_itemLists[screen->option], screen->items);
500 if (screen->itemCount <= 0) {
501 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x64);
502 } else {
503 screen->substate = 11;
504 }
505 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
507 screen->substate = 0x32;
508 }
509}
510
511/* Starts closing the pages and the panels but the help's, for the item list */
512static inline void STSTATUS_closeItemScreenForList(ItemScreen *screen, ItemScreenWindows *windows) {
513 s32 i;
514
515 for (i = 0; i < screen->count; i++) {
516 STSTATUS_data.funcs.startFade(&screen->pageFades[i], 0);
517 STSTATUS_showItemPage(screen, windows, i, 0);
518 }
519 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
520 windows->title->setVisible(windows->title, 0);
521 windows->help->setVisible(windows->help, 0);
522 windows->kind->setVisible(windows->kind, 0);
523 STSTATUS_data.funcs.startFade(&screen->fades2[1], 0);
524 windows->moneyLabel->setVisible(windows->moneyLabel, 0);
525 windows->money->setVisible(windows->money, 0);
526 STSTATUS_data.funcs.startFade(&screen->fades2[0], 0);
527 for (i = 0; i < 5; i++) {
528 windows->options[i]->setVisible(windows->options[i], 0);
529 }
530 windows->optionCursor->setVisible(windows->optionCursor, 0);
531 screen->substate++;
532}
533
534/* Once they are closed, opens the chosen option's item list and the item's
535 panel */
536static inline void STSTATUS_openItemList(ItemScreen *screen, ItemScreenWindows *windows) {
537 s32 i;
538
539 for (i = 0; i < screen->count; i++) {
541 }
542 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
544 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
545 windows->panel = STSTATUS_createItemList(screen, screen->option, 0);
546 STSTATUS_fadeItemInfo(screen, 1);
547 screen->substate = 15;
548 }
549}
550
551/* Once the item list closes: back to the options when it was cancelled, to
552 the end (0x28) at -2, else to choosing a member to use the item on */
553static inline void STSTATUS_leaveItemList(ItemScreen *screen, ItemScreenWindows *windows) {
554 if (windows->panel == NULL) {
555 if (screen->itemIndex == -1) {
556 screen->substate = 0;
557 screen->step = 1;
558 } else if (screen->itemIndex == -2) {
559 screen->substate = 0x28;
560 } else {
561 screen->setSubstate(screen, 0x14);
562 }
563 }
564}
565
566/* Once the first page and the title are in, shows them and starts the second
567 page, or shows the cursor with one member */
568static inline void STSTATUS_openFirstMemberPage(ItemScreen *screen, ItemScreenWindows *windows) {
570 if (STSTATUS_data.funcs.updateFade(&screen->fades[0])) {
571 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x27);
572 STSTATUS_showItemPage(screen, windows, 0, 1);
573 if (screen->count != 1) {
574 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 1);
575 screen->substate++;
576 } else {
577 screen->substate = 0x18;
578 }
579 }
580}
581
582/* Once the second page is in, shows it and starts the third, or shows the
583 cursor with two members */
584static inline void STSTATUS_openSecondMemberPage(ItemScreen *screen, ItemScreenWindows *windows) {
585 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[1])) {
586 STSTATUS_showItemPage(screen, windows, 1, 1);
587 if (screen->count == 2) {
588 screen->substate = 0x18;
589 } else {
590 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 1);
591 screen->substate++;
592 }
593 }
594}
595
596/* Once the third page is in, shows it */
597static inline void STSTATUS_openThirdMemberPage(ItemScreen *screen, ItemScreenWindows *windows) {
598 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[2])) {
599 STSTATUS_showItemPage(screen, windows, 2, 1);
600 screen->substate++;
601 }
602}
603
604/* Choosing the member to use the item on: up and down move the cursor, cross
605 uses the item, triangle goes back to the list */
606static inline void STSTATUS_chooseItemMember(ItemScreen *screen, ItemScreenWindows *windows) {
607 s32 old;
608
609 old = screen->member;
611 screen->member--;
612 if (screen->member < 0) {
613 screen->member = 0;
614 }
615 } else if (PAD_PRESSED(PAD_DOWN) || PAD_REPEATED(PAD_DOWN)) {
616 screen->member++;
617 if (screen->member > screen->count - 1) {
618 screen->member = screen->count - 1;
619 }
620 }
621 if (old != screen->member) {
623 } else if (PAD_PRESSED(PAD_CROSS)) {
624 STSTATUS_fadeItemInfo(screen, 0);
625 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
626 windows->title->setVisible(windows->title, 0);
627 STSTATUS_useItem(screen, windows);
628 screen->substate = 0x64;
629 screen->step = 0;
630 screen->blink = 1;
631 } else if (PAD_PRESSED(PAD_TRIANGLE)) {
633 screen->step = 1;
634 screen->substate++;
635 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
636 windows->title->setVisible(windows->title, 0);
637 }
638}
639
640/* Hides the cursor; once the title's and the item's panels are closed, goes
641 on to closing the pages */
642static inline void STSTATUS_closeItemTitle(ItemScreen *screen) {
643 s32 done;
644
645 screen->cursorShown = 0;
646 done = STSTATUS_data.funcs.updateFade(&screen->fades[0]);
647 if (STSTATUS_itemInfoFaded(screen) && done) {
648 screen->substate++;
649 }
650}
651
652/* Starts closing the last page (and the title with one member) */
653static inline void STSTATUS_closeMemberPages(ItemScreen *screen, ItemScreenWindows *windows) {
654 switch (screen->count) {
655 case 1:
656 default:
657 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
658 STSTATUS_showItemPage(screen, windows, 0, 0);
659 windows->title->setVisible(windows->title, 0);
660 screen->substate = 0x1E;
661 break;
662 case 2:
663 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
664 STSTATUS_showItemPage(screen, windows, 1, 0);
665 screen->substate = 0x1D;
666 break;
667 case 3:
668 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 0);
669 STSTATUS_showItemPage(screen, windows, 2, 0);
670 screen->substate = 0x1C;
671 break;
672 }
673}
674
675/* Once the third page is closed, starts closing the second */
676static inline void STSTATUS_closeThirdMemberPage(ItemScreen *screen, ItemScreenWindows *windows) {
677 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[2])) {
678 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
679 STSTATUS_showItemPage(screen, windows, 1, 0);
680 screen->substate++;
681 }
682}
683
684/* Once the second page is closed, starts closing the first and the title */
685static inline void STSTATUS_closeSecondMemberPage(ItemScreen *screen, ItemScreenWindows *windows) {
686 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[1])) {
687 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
688 STSTATUS_showItemPage(screen, windows, 0, 0);
689 windows->title->setVisible(windows->title, 0);
690 screen->substate++;
691 }
692}
693
694/* Once the first page is closed, opens the item list again on the item (and
695 the item's panel, after an item was used) */
696static inline void STSTATUS_reopenItemList(ItemScreen *screen, ItemScreenWindows *windows) {
697 if (STSTATUS_data.funcs.updateFade(&screen->pageFades[0])) {
698 if (screen->step == 0) {
699 STSTATUS_fadeItemInfo(screen, 1);
700 }
701 windows->panel = STSTATUS_createItemList(screen, screen->option, screen->item);
702 screen->substate = 15;
703 }
704}
705
706/* Hides the cursor; once the item's panel is closed, waits for cross */
707static inline void STSTATUS_closeUsedItem(ItemScreen *screen) {
708 screen->cursorShown = 0;
709 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
710 if (STSTATUS_itemInfoFaded(screen)) {
711 screen->substate++;
712 }
713}
714
715/* Cross after an item was used: back to the item list, or to the options
716 when the list is empty now */
717static inline void STSTATUS_confirmItemUsed(ItemScreen *screen) {
718 if (PAD_PRESSED(PAD_CROSS)) {
720 screen->itemCount = ITEM_FUNCS.list(STSTATUS_itemLists[screen->option], screen->items);
721 if (screen->itemCount <= 0) {
722 screen->nextSubstate(screen);
723 STSTATUS_data.funcs.startFade(&screen->fades[0], 1);
724 STSTATUS_data.funcs.startFade(&screen->fades2[1], 1);
725 STSTATUS_data.funcs.startFade(&screen->fades2[0], 1);
726 } else {
727 screen->substate = 0x1B;
728 }
729 screen->blink = 0;
730 }
731}
732
733/* Once the panels are in again, shows the title, the options, the money and
734 the help */
735static inline void STSTATUS_reopenItemOptions(ItemScreen *screen, ItemScreenWindows *windows) {
736 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
738 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
739 windows->title->setString(windows->title, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x14);
740 STSTATUS_showItemLists(screen, windows, 1);
741 STSTATUS_showMoney(screen, windows, 1);
742 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
743 windows->kind->setString(windows->kind, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), 0x15);
744 windows->optionCursor->setVisible(windows->optionCursor, 1);
745 screen->substate = 10;
746 }
747}
748
749/* Greys the options' cursor and says the chosen list is empty */
750static inline void STSTATUS_lockItemOptions(ItemScreen *screen, ItemScreenWindows *windows) {
751 windows->optionCursor->setStill(windows->optionCursor, 1);
753 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x64);
754 screen->substate++;
755}
756
757/* Triangle gives the options' cursor back */
758static inline void STSTATUS_unlockItemOptions(ItemScreen *screen, ItemScreenWindows *windows) {
761 windows->optionCursor->setStill(windows->optionCursor, 0);
763 windows->help->setString(windows->help, FILE_CACHE.load(TEXT_FILE(TEXT_STATUS)), screen->option + 0x1B);
764 screen->substate = 10;
765 }
766}
767
768/* Starts closing the screen: the last page and, with it, the panels the
769 other pages don't wait for */
770static inline void STSTATUS_closeItemScreen(ItemScreen *screen, ItemScreenWindows *windows) {
771 switch (screen->count) {
772 case 1:
773 default:
774 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
775 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
776 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
777 STSTATUS_data.funcs.startFade(&screen->fades2[1], 0);
778 STSTATUS_data.funcs.startFade(&screen->fades2[0], 0);
779 STSTATUS_showItemPage(screen, windows, 0, 0);
780 windows->title->setVisible(windows->title, 0);
781 windows->help->setVisible(windows->help, 0);
782 windows->kind->setVisible(windows->kind, 0);
783 windows->moneyLabel->setVisible(windows->moneyLabel, 0);
784 windows->money->setVisible(windows->money, 0);
785 STSTATUS_showItemLists(screen, windows, 0);
786 break;
787 case 2:
788 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
789 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
790 STSTATUS_data.funcs.startFade(&screen->fades2[1], 0);
791 STSTATUS_data.funcs.startFade(&screen->fades2[0], 0);
792 STSTATUS_showItemPage(screen, windows, 1, 0);
793 windows->help->setVisible(windows->help, 0);
794 windows->kind->setVisible(windows->kind, 0);
795 windows->moneyLabel->setVisible(windows->moneyLabel, 0);
796 windows->money->setVisible(windows->money, 0);
797 STSTATUS_showItemLists(screen, windows, 0);
798 break;
799 case 3:
800 STSTATUS_data.funcs.startFade(&screen->pageFades[2], 0);
801 STSTATUS_data.funcs.startFade(&screen->fades[1], 0);
802 STSTATUS_data.funcs.startFade(&screen->fades2[1], 0);
803 STSTATUS_showItemPage(screen, windows, 2, 0);
804 windows->help->setVisible(windows->help, 0);
805 windows->kind->setVisible(windows->kind, 0);
806 windows->moneyLabel->setVisible(windows->moneyLabel, 0);
807 windows->money->setVisible(windows->money, 0);
808 break;
809 }
810 windows->optionCursor->setVisible(windows->optionCursor, 0);
811 screen->substate = screen->count + 0x32;
812}
813
814/* One member: ends the screen once the page and the panels are closed */
815static inline void STSTATUS_closeItemScreenAlone(ItemScreen *screen) {
817 STSTATUS_data.funcs.updateFade(&screen->fades[0]);
818 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
820 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
821 screen->state = 3;
822 }
823}
824
825/* Two members: once the second page and its panels are closed, starts
826 closing the first and the title */
829 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
831 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
832 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
833 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
834 windows->title->setVisible(windows->title, 0);
835 STSTATUS_showItemPage(screen, windows, 0, 0);
836 screen->substate = 0x36;
837 }
838}
839
840/* Two members: ends the screen once the first page and the help are closed */
843 if (STSTATUS_data.funcs.updateFade(&screen->fades[1])) {
844 screen->state = 3;
845 }
846}
847
848/* Three members: once the third page and its panels are closed, starts
849 closing the second and the options */
850static inline void STSTATUS_closeThirdItemPage(ItemScreen *screen, ItemScreenWindows *windows) {
852 STSTATUS_data.funcs.updateFade(&screen->fades[1]);
853 if (STSTATUS_data.funcs.updateFade(&screen->fades2[1])) {
854 STSTATUS_data.funcs.startFade(&screen->pageFades[1], 0);
855 STSTATUS_data.funcs.startFade(&screen->fades2[0], 0);
856 STSTATUS_showItemPage(screen, windows, 1, 0);
857 STSTATUS_showItemLists(screen, windows, 0);
858 screen->substate = 0x37;
859 }
860}
861
862/* Three members: once the second page and the options are closed, starts
863 closing the first and the title */
866 if (STSTATUS_data.funcs.updateFade(&screen->fades2[0])) {
867 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 0);
868 STSTATUS_data.funcs.startFade(&screen->fades[0], 0);
869 windows->title->setVisible(windows->title, 0);
870 STSTATUS_showItemPage(screen, windows, 0, 0);
871 screen->substate++;
872 }
873}
874
875/* Three members: ends the screen once the first page and the title are
876 closed */
879 if (STSTATUS_data.funcs.updateFade(&screen->fades[0])) {
880 screen->state = 3;
881 }
882}
883
884/* The first screen's update: opens the pages, picks an item list, then
885 the party member to use the chosen item on, and closes them */
887 switch (screen->substate) {
888 case 0:
889 default:
891 break;
892 case 1:
893 STSTATUS_openItemScreenAlone(screen, windows);
894 break;
895 case 2:
896 STSTATUS_openFirstOfTwoItemPages(screen, windows);
897 break;
898 case 4:
899 STSTATUS_openSecondOfTwoItemPages(screen, windows);
900 break;
901 case 3:
902 STSTATUS_openFirstOfThreeItemPages(screen, windows);
903 break;
904 case 5:
906 break;
907 case 6:
908 STSTATUS_openThirdItemPage(screen, windows);
909 break;
910 case 10:
911 STSTATUS_chooseItemList(screen, windows);
912 break;
913 case 11:
914 STSTATUS_closeItemScreenForList(screen, windows);
915 break;
916 case 12:
917 STSTATUS_openItemList(screen, windows);
918 break;
919 case 15:
920 if (STSTATUS_itemInfoFaded(screen)) {
921 screen->substate++;
922 }
923 break;
924 case 0x10:
925 STSTATUS_leaveItemList(screen, windows);
926 break;
927 case 0x14:
928 STSTATUS_data.funcs.startFade(&screen->pageFades[0], 1);
929 STSTATUS_data.funcs.startFade(&screen->fades[0], 1);
930 screen->substate++;
931 break;
932 case 0x15:
933 STSTATUS_openFirstMemberPage(screen, windows);
934 break;
935 case 0x16:
936 STSTATUS_openSecondMemberPage(screen, windows);
937 break;
938 case 0x17:
939 STSTATUS_openThirdMemberPage(screen, windows);
940 break;
941 case 0x18:
942 screen->cursorShown = 1;
943 screen->substate++;
944 break;
945 case 0x19:
946 STSTATUS_chooseItemMember(screen, windows);
947 break;
948 case 0x1A:
950 break;
951 case 0x1B:
952 STSTATUS_closeMemberPages(screen, windows);
953 break;
954 case 0x1C:
955 STSTATUS_closeThirdMemberPage(screen, windows);
956 break;
957 case 0x1D:
958 STSTATUS_closeSecondMemberPage(screen, windows);
959 break;
960 case 0x1E:
961 STSTATUS_reopenItemList(screen, windows);
962 break;
963 case 0x28:
964 screen->state = 3;
965 break;
966 case 0x64:
968 break;
969 case 0x65:
971 break;
972 case 0x66:
973 STSTATUS_reopenItemOptions(screen, windows);
974 break;
975 case 0x6E:
976 STSTATUS_lockItemOptions(screen, windows);
977 break;
978 case 0x6F:
979 STSTATUS_unlockItemOptions(screen, windows);
980 break;
981 case 0x32:
982 STSTATUS_closeItemScreen(screen, windows);
983 break;
984 case 0x33:
986 break;
987 case 0x34:
988 STSTATUS_closeSecondOfTwoItemPages(screen, windows);
989 break;
990 case 0x36:
992 break;
993 case 0x35:
994 STSTATUS_closeThirdItemPage(screen, windows);
995 break;
996 case 0x37:
998 break;
999 case 0x38:
1001 break;
1002 }
1003}
1004
1005/* The first screen's task: counts the party, sets the fades and creates the
1006 windows, then runs and draws the screen */
1008 s32 i;
1009
1010 switch (screen->state) {
1011 case TASK_INIT:
1012 default:
1013 screen->nextState(screen);
1014 for (i = 0; i < 3; i++) {
1015 if (GAME.funcs.getPartyMember(i) >= 0) {
1016 screen->count++;
1017 }
1018 }
1019 for (i = 0; i < screen->count; i++) {
1020 screen->pageFades[i].duration = 10;
1021 }
1022 for (i = 0; i < 2; i++) {
1023 screen->fades[i].duration = 10;
1024 }
1025 screen->fades2[0].duration = 10;
1026 screen->fades2[1].duration = 10;
1027 screen->fade.duration = 10;
1028 STSTATUS_createItemWindows(screen, windows);
1029 break;
1030 case TASK_RUN:
1031 STSTATUS_runItemScreen(screen, windows);
1033 break;
1034 case TASK_DONE:
1035 case TASK_KILL:
1036 break;
1037 }
1038}
1039
1040/* Creates the field menu's first screen (task), the items */
1043
1044 screen->layer = SCREEN_LAYER;
1045 screen->depth = 6;
1046 screen->menu = menu;
1047 return (Task *)screen;
1048}
1049
1050/* The item lists of the first screen's options */
1052 1, 0x80000002, 0x80000003, 0x80000004,
1053 0,
1054};
1059/* The strings of the item kinds (WeaponData.kind), from 0 */
1061 0, 67, 77, 79,
1062 65, 66, 68, 80,
1063 68,
1064};
1065/* What the items that raise a stat raise */
1067 { 2, STAT_MAX_HP, 9999 },
1068 { 3, STAT_MAX_MP, 9999 },
1069 { 4, STAT_STRENGTH, 999 },
1070 { 5, STAT_DEFENSE, 999 },
1071 { 6, STAT_SPIRIT, 999 },
1072 { 7, STAT_WISDOM, 999 },
1073 { 8, STAT_SPEED, 999 },
1074 { 9, STAT_CHARISMA, 999 },
1075 { 10, STAT_RESISTS, 999 },
1076 { 11, STAT_RESISTS + 1, 999 },
1077 { 12, STAT_RESISTS + 2, 999 },
1078 { 13, STAT_RESISTS + 3, 999 },
1079 { 14, STAT_RESISTS + 4, 999 },
1080 { 15, STAT_RESISTS + 5, 999 },
1081 { 16, STAT_RESISTS + 6, 999 },
1082 { -1, 0, 0 },
1083};
#define NULL
Definition common.h:17
signed int s32
Definition common.h:11
signed short s16
Definition common.h:9
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
ItemList * STSTATUS_createItemList(ItemScreen *screen, s32 list, s32 item)
Creates the first screen's list of the items of a list (task), the cursor on ITEM when it is not 0.
Definition item_list.c:358
STSTATUS.PRO: the field menu's screens.
#define DRAW_PAGE_PANELS(sprite, screen, i)
Draws the panels of the party's pages (parts 0x15 to 0x17 of the menu's sprites), each stretched acro...
Definition field_menu.h:455
#define FILE_STATUS_SPRITES
The menu's sprite sheet; the next file is its texture archive.
Definition field_menu.h:20
#define TEXT_ITEM_INFO
ITMINF.
Definition file.h:214
#define TEXT_FILE(file)
Definition file.h:190
#define TEXT_STATUS
STATUS: the field menu's and STSTATUS's.
Definition file.h:225
#define TEXT_ITEM_NAMES
ITMNAM.
Definition file.h:215
#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_STRENGTH
the six battle stats
Definition game_state.h:286
#define STAT_MP
Definition game_state.h:283
#define STAT_SPIRIT
Definition game_state.h:288
#define STAT_MAX_HP
Definition game_state.h:282
#define STAT_HP
Definition game_state.h:281
#define STAT_SPEED
Definition game_state.h:290
#define STAT_TP
what the training's intensities cost
Definition game_state.h:280
#define STAT_LEVEL
Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
Definition game_state.h:279
#define STAT_DEFENSE
Definition game_state.h:287
#define STAT_CHARISMA
Definition game_state.h:291
#define STAT_MAX_MP
Definition game_state.h:284
#define STAT_RESISTS
the first of the seven resistances
Definition game_state.h:292
#define STAT_WISDOM
Definition game_state.h:289
#define STRETCH_SPRITE(sprite, level, x, y)
Definition gfx.h:273
#define ZOOM_SPRITE(sprite, level, x, y)
Definition gfx.h:275
#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
static void STSTATUS_closeThirdItemPage(ItemScreen *screen, ItemScreenWindows *windows)
Three members: once the third page and its panels are closed, starts closing the second and the optio...
void STSTATUS_updateItemScreen(ItemScreen *screen, ItemScreenWindows *windows)
The first screen's task: counts the party, sets the fades and creates the windows,...
void STSTATUS_useItem(ItemScreen *screen, ItemScreenWindows *windows)
Uses the chosen item on the chosen party member.
Task * STSTATUS_createItemScreen(FieldMenuScreen *menu, s32 extra)
Creates the field menu's first screen (task), the items.
void STSTATUS_runItemScreen(ItemScreen *screen, ItemScreenWindows *windows)
The first screen's update: opens the pages, picks an item list, then the party member to use the chos...
static void STSTATUS_openSecondOfThreeItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Three members: once the second page and the options' panel are in, shows them and starts the third pa...
void STSTATUS_drawItemScreen(ItemScreen *screen)
Draws the partners' portraits and frames, the item, the cursor and the help arrow.
static void STSTATUS_closeItemScreenAlone(ItemScreen *screen)
One member: ends the screen once the page and the panels are closed.
static void STSTATUS_openFirstOfThreeItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Three members: once the first page and the title are in, shows them and starts the second page and th...
static void STSTATUS_chooseItemList(ItemScreen *screen, ItemScreenWindows *windows)
The options, the item lists: up and down move the cursor, cross opens the chosen list (or says it is ...
static void STSTATUS_closeItemScreenForList(ItemScreen *screen, ItemScreenWindows *windows)
Starts closing the pages and the panels but the help's, for the item list.
static void STSTATUS_startItemScreen(ItemScreen *screen)
Starts the fades of the first page and the title and, with one party member, of the other panels (the...
void STSTATUS_fadeItemInfo(ItemScreen *screen, s32 show)
Opens or closes the chosen item's panel (its icon and frame); closing it also hides the item's name,...
static void STSTATUS_openItemList(ItemScreen *screen, ItemScreenWindows *windows)
Once they are closed, opens the chosen option's item list and the item's panel.
static void STSTATUS_closeItemTitle(ItemScreen *screen)
Hides the cursor; once the title's and the item's panels are closed, goes on to closing the pages.
static void STSTATUS_reopenItemOptions(ItemScreen *screen, ItemScreenWindows *windows)
Once the panels are in again, shows the title, the options, the money and the help.
static void STSTATUS_openSecondOfTwoItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Two members: once the second page and the panels are in, shows the page, the options,...
static void STSTATUS_openFirstOfTwoItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Two members: once the first page and the title are in, shows them and starts the second page and the ...
static void STSTATUS_unlockItemOptions(ItemScreen *screen, ItemScreenWindows *windows)
Triangle gives the options' cursor back.
static void STSTATUS_closeSecondOfTwoItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Two members: once the second page and its panels are closed, starts closing the first and the title.
void STSTATUS_createItemWindows(ItemScreen *screen, ItemScreenWindows *windows)
Creates the first screen's windows.
Definition item_screen.c:7
s32 STSTATUS_itemLists[]
The item lists of the first screen's options.
StatusStatItem STSTATUS_statItems[]
What the items that raise a stat raise.
static void STSTATUS_closeFirstOfThreeItemPages(ItemScreen *screen)
Three members: ends the screen once the first page and the title are closed.
static void STSTATUS_openThirdMemberPage(ItemScreen *screen, ItemScreenWindows *windows)
Once the third page is in, shows it.
static void STSTATUS_closeFirstOfTwoItemPages(ItemScreen *screen)
Two members: ends the screen once the first page and the help are closed.
static void STSTATUS_closeUsedItem(ItemScreen *screen)
Hides the cursor; once the item's panel is closed, waits for cross.
static void STSTATUS_closeSecondOfThreeItemPages(ItemScreen *screen, ItemScreenWindows *windows)
Three members: once the second page and the options are closed, starts closing the first and the titl...
static void STSTATUS_lockItemOptions(ItemScreen *screen, ItemScreenWindows *windows)
Greys the options' cursor and says the chosen list is empty.
s32 STSTATUS_pageStats0[]
void STSTATUS_showItemPage(ItemScreen *screen, ItemScreenWindows *windows, s32 member, s32 show)
As STSTATUS_showCardPage.
Definition item_screen.c:49
static void STSTATUS_reopenItemList(ItemScreen *screen, ItemScreenWindows *windows)
Once the first page is closed, opens the item list again on the item (and the item's panel,...
s32 STSTATUS_itemInfoFaded(ItemScreen *screen)
Moves the chosen item's panel on; 1 once it is fully open or closed.
static void STSTATUS_closeItemScreen(ItemScreen *screen, ItemScreenWindows *windows)
Starts closing the screen: the last page and, with it, the panels the other pages don't wait for.
static void STSTATUS_closeMemberPages(ItemScreen *screen, ItemScreenWindows *windows)
Starts closing the last page (and the title with one member)
static void STSTATUS_leaveItemList(ItemScreen *screen, ItemScreenWindows *windows)
Once the item list closes: back to the options when it was cancelled, to the end (0x28) at -2,...
s32 STSTATUS_kindStrings0[]
The strings of the item kinds (WeaponData.kind), from 0.
static void STSTATUS_openFirstMemberPage(ItemScreen *screen, ItemScreenWindows *windows)
Once the first page and the title are in, shows them and starts the second page, or shows the cursor ...
static void STSTATUS_openSecondMemberPage(ItemScreen *screen, ItemScreenWindows *windows)
Once the second page is in, shows it and starts the third, or shows the cursor with two members.
void STSTATUS_showItemHelp(ItemScreen *screen, s32 mode)
The help line: 1 the chosen item and the kind of a weapon, 2 a question with two answers,...
static void STSTATUS_animateItemPortraits(ItemScreen *screen)
Moves the partners' portraits to their next frames every 13 frames.
static void STSTATUS_closeThirdMemberPage(ItemScreen *screen, ItemScreenWindows *windows)
Once the third page is closed, starts closing the second.
void STSTATUS_showMoney(ItemScreen *screen, ItemScreenWindows *windows, s32 show)
Shows or hides the player's money.
Definition item_screen.c:80
static void STSTATUS_chooseItemMember(ItemScreen *screen, ItemScreenWindows *windows)
Choosing the member to use the item on: up and down move the cursor, cross uses the item,...
static void STSTATUS_openItemScreenAlone(ItemScreen *screen, ItemScreenWindows *windows)
One member: once the panels are in, shows the title, the page, the help, the money and the options.
static void STSTATUS_closeSecondMemberPage(ItemScreen *screen, ItemScreenWindows *windows)
Once the second page is closed, starts closing the first and the title.
static void STSTATUS_stepItemCursor(ItemScreen *screen)
Moves the member cursor's palette on every 9 frames.
void STSTATUS_showChosenItem(ItemScreen *screen, s32 show)
Shows or hides the chosen item's name and how many are equipped and owned.
static void STSTATUS_openThirdItemPage(ItemScreen *screen, ItemScreenWindows *windows)
Three members: once the third page and the panels are in, shows the page, the help and the money.
void STSTATUS_showItemLists(ItemScreen *screen, ItemScreenWindows *windows, s32 show)
Shows or hides the first screen's five options, the item lists.
Definition item_screen.c:92
static void STSTATUS_confirmItemUsed(ItemScreen *screen)
Cross after an item was used: back to the item list, or to the options when the list is empty now.
ItemFuncs ITEM_FUNCS
Definition items.c:890
#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
Random RANDOM
Definition random.c:533
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_RECOVERY
RECOVERY.
Definition sound.h:46
#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(* setPalette)()
Definition text.h:35
void(* setPos)()
(cursor, x, y)
Definition text.h:34
void(* setStill)()
Definition text.h:38
void(* setVisible)()
(cursor, visible)
Definition text.h:33
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
s8 items[0x193]
counts, up to 99
Definition game_state.h:512
s8 equippedItems[0x193]
Definition game_state.h:513
GameFuncs funcs
Definition game_state.h:582
s32(* getTime)(void)
Definition gfx.h:31
GfxFuncs funcs
Definition gfx.h:77
What a usable item does (its ItemInfo.data, an ITEM_EFFECT_*)
Definition game_state.h:200
u16 amount
the HP it heals, the gauge it fills, a boost in 128ths
Definition game_state.h:203
u8 kind
1 heals amount HP, 2-17 raise a stat by up to amount (STSTATUS_useItem)
Definition game_state.h:202
s32(* getCategory)(s32 item)
getItemCategory
Definition game_state.h:671
struct ItemInfo *(* get)(s32 item)
getItem
Definition game_state.h:670
s32(* list)(s32 type, s16 *out)
listItems
Definition game_state.h:673
An item (ITEMS, ITEM_FUNCS)
Definition game_state.h:225
u8 type
2-14 weapons, 15-20 armour, 21-24 accessories
Definition game_state.h:230
ItemRecord data
the type's record, or the usable items' effect
Definition game_state.h:226
struct ItemList * panel
STSTATUS_createItemList's, while open.
Definition field_menu.h:113
TextWindow * equippedLabel
Definition field_menu.h:109
TextWindow * moneyLabel
Definition field_menu.h:105
TextWindow * help
Definition field_menu.h:100
TextWindow * ownedLabel
Definition field_menu.h:111
TextWindow * owned
Definition field_menu.h:112
TextWindow * options[5]
Definition field_menu.h:106
TextWindow * money
Definition field_menu.h:104
Cursor * answerCursor
Definition field_menu.h:103
PartnerPage pages[3]
Definition field_menu.h:99
TextWindow * itemName
Definition field_menu.h:108
Cursor * optionCursor
Definition field_menu.h:107
TextWindow * title
Definition field_menu.h:98
TextWindow * answers[2]
Definition field_menu.h:102
TextWindow * kind
Definition field_menu.h:101
TextWindow * equipped
how many of the item are equipped
Definition field_menu.h:110
The field menu's first screen (STSTATUS_createItemScreen)
Definition field_menu.h:68
s16 items[0x194]
of the chosen option's list
Definition field_menu.h:81
s32 blinkTime
Definition field_menu.h:89
FieldMenuScreen * menu
Definition field_menu.h:70
void(* nextSubstate)(struct ItemScreen *task)
Definition field_menu.h:69
s32 cursorTime
Definition field_menu.h:86
s32 blink
the help arrow
Definition field_menu.h:87
void * children
Definition field_menu.h:69
void(* nextState)(struct ItemScreen *task)
Definition field_menu.h:69
PanelAnim fades2[2]
Definition field_menu.h:92
s32 item
the chosen one
Definition field_menu.h:78
s32 blinkFrame
Definition field_menu.h:88
s32 cursorShown
Definition field_menu.h:84
PanelAnim fade
Definition field_menu.h:93
s32 itemIndex
Definition field_menu.h:79
s32 frameTime
Definition field_menu.h:75
void(* setSubstate)(struct ItemScreen *task, s32 substate)
Definition field_menu.h:69
s32 frames[3]
of the partners' portraits
Definition field_menu.h:74
s32 cursorFrame
Definition field_menu.h:85
s32 count
party members
Definition field_menu.h:73
s32 itemCount
Definition field_menu.h:82
s32 member
the one an item is used on
Definition field_menu.h:83
s32 itemShown
Definition field_menu.h:80
PanelAnim pageFades[3]
Definition field_menu.h:90
PanelAnim fades[2]
Definition field_menu.h:91
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
A partner Digimon from its name on (Partner.info), as getPartnerStats gives it.
Definition game_state.h:303
s16 stats[19]
Definition game_state.h:306
s32(* next)(void)
0 to RANDOM_COUNT - 1
Definition random.h:15
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
What the items that raise a stat raise (STSTATUS_statItems), up to a kind of -1.
Definition field_menu.h:624
s16 kind
the item's second byte
Definition field_menu.h:625
s16 stat
in PartnerStats.stats
Definition field_menu.h:626
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
u8 kind
EQUIP_KIND_*.
Definition game_state.h:146
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
#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)
ItemInfo.data's record, by ItemInfo.type.
Definition game_state.h:188
WeaponData weapon
Definition game_state.h:189
ItemData * record
Definition game_state.h:210
ItemEffect * effect
Definition game_state.h:211
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