Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
inventory.c
Go to the documentation of this file.
1#include "inventory.h"
2#include "hud_element.h"
3#include "dx/config.h"
4#include "dx/debug_menu.h"
5
6#define FULLY_EXTENDED_Y 18
7#define FULLY_RETRACTED_Y -100
8
12};
13
16
18
23
24extern HudScript* DigitHudScripts[10];
25
43
45
48
50 PlayerData* playerData = &gPlayerData;
51 s32 i;
52
53 D_8010CD10 = FALSE;
54 D_8010CD12 = FALSE;
55
56 playerData->curHP = 10;
57 playerData->curMaxHP = 10;
58 playerData->hardMaxHP = 10;
59 playerData->curFP = 5;
60 playerData->curMaxFP = 5;
61 playerData->hardMaxFP = 5;
62 playerData->maxBP = 3;
63 playerData->level = 1;
64 playerData->bootsLevel = 0;
65 playerData->hammerLevel = -1;
66 playerData->hasActionCommands = FALSE;
67 playerData->coins = 0;
68 playerData->starPieces = 0;
69 playerData->starPoints = 0;
70 playerData->unused_011 = 0;
71 playerData->unused_288 = 0;
72
74 playerData->merleeCastsLeft = 0;
75 playerData->merleeTurnCount = -1;
76
77 playerData->maxStarPower = 0;
78 playerData->starPower = 0;
79 playerData->starBeamLevel = 0;
80
81 playerData->curPartner = PARTNER_NONE;
82
83 for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) {
84 playerData->partners[i].enabled = FALSE;
85 playerData->partners[i].level = PARTNER_RANK_NORMAL;
86 playerData->partners[i].unk_02[0] = 0;
87 playerData->partners[i].unk_02[1] = 0;
88 playerData->partners[i].unk_02[2] = 0;
89 }
90
91 for (i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
92 playerData->keyItems[i] = ITEM_NONE;
93 }
94
95 for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) {
96 playerData->badges[i] = ITEM_NONE;
97 }
98
99 for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
100 playerData->invItems[i] = ITEM_NONE;
101 }
102
103 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
104 playerData->equippedBadges[i] = ITEM_NONE;
105 }
106
107 for (i = 0; i < ARRAY_COUNT(playerData->storedItems); i++) {
108 playerData->storedItems[i] = ITEM_NONE;
109 }
110
111 playerData->actionCommandAttempts = 0;
112 playerData->actionCommandSuccesses = 0;
113 playerData->hitsTaken = 0;
114 playerData->hitsBlocked = 0;
115 playerData->playerFirstStrikes = 0;
116 playerData->enemyFirstStrikes = 0;
117 playerData->powerBounces = 0;
118 playerData->battlesCount = 0;
119 playerData->battlesWon = 0;
120 playerData->fleeAttempts = 0;
121 playerData->battlesFled = 0;
122 playerData->trainingsDone = 0;
123 playerData->walkingStepsTaken = 0;
124 playerData->runningStepsTaken = 0;
125 playerData->idleFrameCounter = 0;
126 playerData->totalCoinsEarned = 0;
127 playerData->frameCounter = 0;
128 playerData->quizzesAnswered = 0;
129 playerData->quizzesCorrect = 0;
130
131 for (i = 0; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) {
132 playerData->partnerUnlockedTime[i] = 0;
133 playerData->partnerUsedTime[i] = 0;
134 }
135
136 playerData->droTreeHintTime = 0;
137 playerData->starPiecesCollected = 0;
138 playerData->jumpGamePlays = 0;
139 playerData->jumpGameTotal = 0;
140 playerData->jumpGameRecord = 0;
141 playerData->smashGamePlays = 0;
142 playerData->smashGameTotal = 0;
143 playerData->smashGameRecord = 0;
144}
145
146s32 add_item(s32 itemID) {
147 s32 idx;
148
149 // handle key items
150 if (item_is_key(itemID)) {
151 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
152 if (gPlayerData.keyItems[idx] == ITEM_NONE) {
153 break;
154 }
155 }
156
157 if (idx >= ARRAY_COUNT(gPlayerData.keyItems)) {
158 return -1;
159 }
160
161 gPlayerData.keyItems[idx] = itemID;
162 return idx;
163 }
164
165 // handle badges
166 if (item_is_badge(itemID)) {
167 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
168 if (gPlayerData.badges[idx] == ITEM_NONE) {
169 break;
170 }
171 }
172
173 if (idx >= ARRAY_COUNT(gPlayerData.badges)) {
174 return -1;
175 }
176
177 gPlayerData.badges[idx] = itemID;
178 return idx;
179 }
180
181 // handle consumables
183
184 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
185 if (gPlayerData.invItems[idx] == ITEM_NONE) {
186 break;
187 }
188 }
189
190 if (idx == ARRAY_COUNT(gPlayerData.invItems)) {
191 return -1;
192 }
193
194 gPlayerData.invItems[idx] = itemID;
195 return idx;
196}
197
198s32 remove_item(s32 itemID) {
199 s32 idx;
200
201 // handle key items
202 if (item_is_key(itemID)) {
203 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
204 if (gPlayerData.keyItems[idx] == itemID) {
205 break;
206 }
207 }
208
209 if (idx >= ARRAY_COUNT(gPlayerData.keyItems)) {
210 return -1;
211 }
212
213 gPlayerData.keyItems[idx] = ITEM_NONE;
214 return idx;
215 }
216
217 // handle badges
218 if (item_is_badge(itemID)) {
219 // unequip
220 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.equippedBadges); idx++) {
221 if (gPlayerData.equippedBadges[idx] == itemID) {
222 gPlayerData.equippedBadges[idx] = ITEM_NONE;
223 }
224 }
225
226 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
227 if (gPlayerData.badges[idx] == itemID) {
228 break;
229 }
230 }
231
232 if (idx >= ARRAY_COUNT(gPlayerData.badges)) {
233 return -1;
234 }
235
236 gPlayerData.badges[idx] = ITEM_NONE;
237 return idx;
238 }
239
240 // handle consumables
241 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
242 if (gPlayerData.invItems[idx] == itemID) {
243 break;
244 }
245 }
246
247 if (idx == ARRAY_COUNT(gPlayerData.invItems)) {
248 return -1;
249 }
250
251 gPlayerData.invItems[idx] = ITEM_NONE;
253 return idx;
254}
255
258s32 find_item(s32 itemID) {
259 s32 idx;
260
261 // handle key items
262 if (item_is_key(itemID)) {
263 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
264 if (gPlayerData.keyItems[idx] == itemID) {
265 break;
266 }
267 }
268
269 if (idx >= ARRAY_COUNT(gPlayerData.keyItems)) {
270 return -1;
271 }
272 return idx;
273 }
274
275 // handle badges
276 if (item_is_badge(itemID)) {
277 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
278 if (gPlayerData.badges[idx] == itemID) {
279 break;
280 }
281 }
282
283 if (idx >= ARRAY_COUNT(gPlayerData.badges)) {
284 return -1;
285 }
286 return idx;
287 }
288
289 // handle consumables
290 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
291 if (gPlayerData.invItems[idx] == itemID) {
292 break;
293 }
294 }
295
296 if (idx == ARRAY_COUNT(gPlayerData.invItems)) {
297 return -1;
298 }
299 return idx;
300}
301
304s32 count_item(s32 itemID) {
305 s32 idx;
306 s32 sum = 0;
307
308 // handle key items
309 if (item_is_key(itemID)) {
310 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
311 if (gPlayerData.keyItems[idx] == itemID) {
312 sum++;
313 }
314 }
315 return sum;
316 }
317
318 // handle badges
319 if (item_is_badge(itemID)) {
320 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
321 if (gPlayerData.badges[idx] == itemID) {
322 sum++;
323 }
324 }
325 return sum;
326 }
327
328 // handle consumables
329 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
330 if (gPlayerData.invItems[idx] == itemID) {
331 sum++;
332 }
333 }
334 return sum;
335}
336
337b32 has_item(s32 itemID) {
338 s32 idx;
339
340 // handle key items
341 if (item_is_key(itemID)) {
342 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
343 if (gPlayerData.keyItems[idx] == itemID) {
344 return TRUE;
345 }
346 }
347 return FALSE;
348 }
349
350 // handle badges
351 if (item_is_badge(itemID)) {
352 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
353 if (gPlayerData.badges[idx] == itemID) {
354 return TRUE;
355 }
356 }
357 return FALSE;
358 }
359
360 // handle consumables
361 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
362 if (gPlayerData.invItems[idx] == itemID) {
363 return TRUE;
364 }
365 }
366 return FALSE;
367}
368
369s32 store_item(s32 itemID) {
370 s32 idx;
371
372 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.storedItems); idx++) {
373 if (gPlayerData.storedItems[idx] == ITEM_NONE) {
374 break;
375 }
376 }
377
378 if (idx == ARRAY_COUNT(gPlayerData.storedItems)) {
379 return -1;
380 } else {
381 gPlayerData.storedItems[idx] = itemID;
382 }
383
384 return idx;
385}
386
388 s32 idx;
389
390 if (!item_is_badge(itemID)) {
391 return FALSE;
392 }
393
394 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.equippedBadges); idx++) {
395 if (gPlayerData.equippedBadges[idx] == itemID) {
396 return TRUE;
397 }
398 }
399
400 return FALSE;
401}
402
405 s32 i, j;
406
407 for (i = ARRAY_COUNT(gPlayerData.invItems) - 2; i >= 0; i--) {
408 // leave ITEM_NONE at the end of the list alone
409 if (gPlayerData.invItems[i] == ITEM_NONE) {
410 continue;
411 }
412 // swap any other ITEM_NONE to the end of the list
413 for (j = ARRAY_COUNT(gPlayerData.invItems) - 1; i < j; j--) {
414 if (gPlayerData.invItems[j] == ITEM_NONE) {
416 gPlayerData.invItems[i] = ITEM_NONE;
417 break;
418 }
419 }
420 }
421}
422
424 s32 idx;
425 s32 sum = 0;
426
427 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
428 if (gPlayerData.invItems[idx] != ITEM_NONE) {
429 sum++;
430 }
431 }
432
433 return sum;
434}
435
439
441 s32 idx;
442 s32 sum = 0;
443
444 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.storedItems); idx++) {
445 if (gPlayerData.storedItems[idx] != ITEM_NONE) {
446 sum++;
447 }
448 }
449
450 return sum;
451}
452
456
458 PlayerData* playerData = &gPlayerData;
459
460 playerData->curMaxHP = playerData->hardMaxHP + (is_ability_active(ABILITY_HP_PLUS) * 5);
461 if (playerData->curMaxHP > 75) {
462 playerData->curMaxHP = 75;
463 }
464 if (playerData->curHP > playerData->curMaxHP) {
465 playerData->curHP = playerData->curMaxHP;
466 }
467
468 playerData->curMaxFP = playerData->hardMaxFP + (is_ability_active(ABILITY_FP_PLUS) * 5);
469 if (playerData->curMaxFP > 75) {
470 playerData->curMaxFP = 75;
471 }
472 if (playerData->curFP > playerData->curMaxFP) {
473 playerData->curFP = playerData->curMaxFP;
474 }
475}
476
478 StatusBar* statusBar = &gStatusBar;
479 PlayerData* playerData = &gPlayerData;
480 s32 iconIndex;
481
482 statusBar->drawPosX = 12;
483 D_8010CD10 = FALSE;
484 D_8010CD12 = FALSE;
485 statusBar->drawPosY = FULLY_RETRACTED_Y;
486 statusBar->hidden = FALSE;
487 statusBar->showTimer = 210;
488 statusBar->unk_3B = FALSE;
489 statusBar->ignoreChanges = FALSE;
490 statusBar->openInputDisabled = FALSE;
491 statusBar->alwaysShown = FALSE;
492 statusBar->hpBlinking = BLINK_OFF;
493 statusBar->hpBlinkCounter = 0;
494 statusBar->hpBlinkTimer = 0;
495 statusBar->fpBlinking = BLINK_OFF;
496 statusBar->fpBlinkCounter = 0;
497 statusBar->fpBlinkTimer = 0;
498 statusBar->spBlinking = BLINK_OFF;
499 statusBar->spBlinkCounter = 0;
500 statusBar->coinsBlinking = BLINK_OFF;
501 statusBar->coinsBlinkCounter = 0;
502 statusBar->coinsBlinkTimer = 0;
503 statusBar->disabled = 0;
504 statusBar->starpointsBlinking = BLINK_OFF;
505 statusBar->displayHP = playerData->curHP;
506 statusBar->displayFP = playerData->curFP;
507 statusBar->displayCoins = playerData->coins;
508 statusBar->displayStarpoints = playerData->starPoints;
509 statusBar->displayStarPower = playerData->starPower;
510 statusBar->starpointsBlinkCounter = 0;
511 statusBar->unk_6E = -1;
512 statusBar->unk_3C = FALSE;
513 statusBar->unk_57 = 0;
514 statusBar->unk_58 = 0;
515 statusBar->unk_59 = 0;
516 statusBar->spBarsToBlink = 0;
517 statusBar->coinCounterHideTime = 0;
518 statusBar->unk_6D = 0;
519 statusBar->iconIndex12 = -1;
520
522
523#if VERSION_PAL
524 switch (gCurrentLanguage) {
525 case LANGUAGE_EN:
526 iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP);
527 break;
528 case LANGUAGE_DE:
529 iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_de);
530 break;
531 case LANGUAGE_FR:
532 iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_fr);
533 break;
534 case LANGUAGE_ES:
535 iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_es);
536 break;
537 }
538
541#else
542 statusBar->hpIconHIDs[0] = iconIndex = hud_element_create(&HES_StatusHP);
545#endif
546
547 statusBar->hpIconHIDs[1] = iconIndex = hud_element_create(&HES_StatusHeart);
550
551#if VERSION_PAL
552 switch (gCurrentLanguage) {
553 case LANGUAGE_EN:
554 iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP);
555 break;
556 case LANGUAGE_DE:
557 iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_de);
558 break;
559 case LANGUAGE_FR:
560 iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_fr);
561 break;
562 case LANGUAGE_ES:
563 iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_es);
564 break;
565 }
566
569#else
570 statusBar->fpIconHIDs[0] = iconIndex = hud_element_create(&HES_StatusFP);
573#endif
574
575 statusBar->fpIconHIDs[1] = iconIndex = hud_element_create(&HES_StatusFlower);
578
579 statusBar->coinIconHID = iconIndex = hud_element_create(&HES_StatusCoin);
582
586
587 statusBar->spIconHID = iconIndex = hud_element_create(&HES_StatusStarPoint);
590
591 statusBar->spShineHID = iconIndex = hud_element_create(&HES_StatusSPShine);
594
595 statusBar->hpTimesHID = iconIndex = hud_element_create(&HES_StatusTimes);
598
599 statusBar->fpTimesHID = iconIndex = hud_element_create(&HES_StatusTimes);
602
603 statusBar->spTimesHID = iconIndex = hud_element_create(&HES_StatusTimes);
606
607 statusBar->coinTimesHID = iconIndex = hud_element_create(&HES_StatusTimes);
610
611 statusBar->starIconHID = iconIndex = hud_element_create(&HES_StatusStar1);
614
616}
617
618void status_bar_draw_number(s32 iconID, s32 startX, s32 startY, s32 value, s32 numDigits) {
619 s8 digits[4];
620 s32 drawX, drawY;
621 b32 keepDrawing;
622 s32 digit;
623 s32 i;
624
626 drawX = startX + 8;
627 drawY = startY + 8;
628 hud_element_set_render_pos(iconID, drawX, drawY - 1);
630 hud_element_draw_next(iconID);
631
632 // Write each digit of the input number into the digits array
633 for (i = 0; i < numDigits; i++) {
634 digit = value % 10;
635 digits[(numDigits - i) - 1] = digit;
636 value /= 10;
637 }
638
639 drawX += 13;
640 keepDrawing = FALSE;
641
642 for (i = 0; i < numDigits; i++, drawX += 8) {
643 digit = digits[i];
644
645 // Once we have encountered our first non-zero digit, we need to keep drawing the remaining digits
646 if (digit != 0 || keepDrawing || (i == numDigits - 1)) {
647 keepDrawing = TRUE;
649 hud_element_set_render_pos(iconID, drawX, drawY);
651 hud_element_draw_next(iconID);
652 }
653 }
654}
655
656void status_bar_draw_stat(s32 id, s32 startX, s32 startY, s32 currentValue, s32 maxValue) {
657 s8 digits[4];
658 b32 keepDrawing;
659 s32 digit;
660 s32 numDigits = 2;
661 s32 drawX;
662 s32 drawY;
663 s32 i = 0;
664 s32 baseX = startX + 8;
665 s32 baseY = startY + 8;
666
668 hud_element_set_render_pos(id, baseX + 14, baseY + 1);
671
672 for (i = 0; i < numDigits; i++) {
673 s32 num = currentValue % 10;
674 digits[numDigits - i - 1] = num;
675 currentValue /= 10;
676 }
677
678 drawX = baseX;
679 drawY = baseY;
680 keepDrawing = FALSE;
681 for (i = 0; i < numDigits; i++, drawX += 8) {
682 digit = digits[i];
683 if (digit != 0 || keepDrawing || i == numDigits - 1) {
684 keepDrawing = TRUE;
686 hud_element_set_render_pos(id, drawX, drawY);
689 }
690 }
691
692 for (i = 0; i < numDigits; i++) {
693 digits[numDigits - i - 1] = maxValue % 10;
694 maxValue /= 10;
695 }
696
697 drawX = baseX + 26;
698 drawY = baseY;
699 keepDrawing = FALSE;
700 for (i = 0; i < numDigits; i++, drawX += 8) {
701 digit = digits[i];
702 if (digit != 0 || keepDrawing || i == numDigits - 1) {
703 keepDrawing = TRUE;
705 hud_element_set_render_pos(id, drawX, drawY);
708 }
709 }
710}
711
713 StatusBar* statusBar = &gStatusBar;
714 PlayerData* playerData = &gPlayerData;
715 PlayerStatus* playerStatus = &gPlayerStatus;
716 s32 sp50;
717 s32 sp54;
718 s32 i;
719 s32 x;
720 s32 y;
721 s32 showStat;
722 s32 id;
723 s32 limit;
724 s32 s7;
725 s32 s1;
726 s32 spBars;
727 s32 maxStarPower;
728
733 ) {
734 return;
735 }
736
737 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->coins != statusBar->displayCoins) {
739 }
740
741 // update coin counter (+1 coin per frame for each 5-coin delta)
742 i = playerData->coins - statusBar->displayCoins;
743 if (i < 0) {
744 i = (i - 4) / 5;
745 } else {
746 i = (i + 4) / 5;
747 }
748 statusBar->displayCoins += i;
749
750 // show the status bar if HP has changed
751 if (statusBar->displayHP != playerData->curHP && !statusBar->ignoreChanges) {
752 if (statusBar->hidden) {
753 statusBar->showTimer = 70;
754 statusBar->hidden = FALSE;
755 statusBar->unk_3B = FALSE;
756 } else {
757 statusBar->showTimer = 70;
758 }
759 }
760
761 // show the status bar if FP has changed
762 if (statusBar->displayFP != playerData->curFP && !statusBar->ignoreChanges) {
763 if (statusBar->hidden) {
764 statusBar->showTimer = 70;
765 statusBar->hidden = FALSE;
766 statusBar->unk_3B = FALSE;
767 } else {
768 statusBar->showTimer = 70;
769 }
770 }
771
772 // show the status bar if star power has changed
773 if (statusBar->displayStarPower != playerData->starPower && !statusBar->ignoreChanges) {
774 if (statusBar->hidden) {
775 statusBar->showTimer = 70;
776 statusBar->hidden = FALSE;
777 statusBar->unk_3B = FALSE;
778 } else {
779 statusBar->showTimer = 70;
780 }
781 }
782
783 // sync displayed HP toward true HP
784 if (statusBar->displayHP != playerData->curHP) {
785 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curHP < statusBar->displayHP) {
787 }
788 if (statusBar->displayHP < playerData->curHP) {
789 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
790 if (gGameStatusPtr->frameCounter % 4 == 0) {
791 statusBar->displayHP++;
793 }
794 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
795 statusBar->displayHP++;
796 }
797 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
798 statusBar->displayHP--;
799 }
800 }
801
802 // sync displayed FP toward true FP
803 if (statusBar->displayFP != playerData->curFP) {
804 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curFP < statusBar->displayFP) {
806 }
807 if (statusBar->displayFP < playerData->curFP) {
808 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
809 if (gGameStatusPtr->frameCounter % 4 == 0) {
810 statusBar->displayFP++;
812 }
813 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
814 statusBar->displayFP++;
815 }
816 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
817 statusBar->displayFP--;
818 }
819 }
820
821 // sync displayed star power toward true star power
822 if (statusBar->displayStarPower != playerData->starPower) {
823 if (statusBar->displayStarPower < playerData->starPower) {
824 statusBar->displayStarPower += 10;
825 if (statusBar->displayStarPower > playerData->starPower) {
826 statusBar->displayStarPower = playerData->starPower;
827 }
828 } else {
829 statusBar->displayStarPower -= 10;
830 if (statusBar->displayStarPower < playerData->starPower) {
831 statusBar->displayStarPower = playerData->starPower;
832 }
833 }
834 }
835
836 if (statusBar->disabled) {
837 return;
838 }
839
840 if (statusBar->alwaysShown && statusBar->hidden && playerStatus->inputDisabledCount == 0) {
841 statusBar->showTimer = 42;
842 statusBar->hidden = FALSE;
843 statusBar->unk_3B = FALSE;
844 }
845
846 switch (statusBar->hidden) {
847 case FALSE:
848 statusBar->drawPosY += 10;
849 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
850 statusBar->drawPosY = FULLY_EXTENDED_Y;
851 if (statusBar->unk_3C && statusBar->unk_3B && playerStatus->actionState != ACTION_STATE_IDLE) {
852 statusBar->showTimer = 0;
853 }
854 if (statusBar->showTimer != 0) {
855 statusBar->showTimer--;
856 } else {
857 if (!statusBar->ignoreChanges) {
858 if (!statusBar->unk_3B || playerStatus->actionState != ACTION_STATE_IDLE) {
860 statusBar->hidden = TRUE;
861 statusBar->showTimer = 0;
862 statusBar->unk_3C = FALSE;
863 }
864 }
865 }
866 }
867 }
868 break;
869 case TRUE:
870 statusBar->drawPosY -= 5;
871 if (statusBar->drawPosY < FULLY_RETRACTED_Y) {
872 statusBar->drawPosY = FULLY_RETRACTED_Y;
873 if (!statusBar->ignoreChanges) {
874 if (playerStatus->actionState != ACTION_STATE_IDLE) {
875 statusBar->showTimer = 0;
876 } else if (playerStatus->flags & (PS_FLAG_NO_STATIC_COLLISION | PS_FLAG_INPUT_DISABLED)) {
877 statusBar->showTimer = 0;
878 } else {
879 statusBar->showTimer++;
880 }
881
882 if (statusBar->showTimer >= 240 && gGameStatusPtr->context == CONTEXT_WORLD) {
883 statusBar->showTimer = 210;
884 statusBar->hidden = FALSE;
885 statusBar->unk_3B = TRUE;
886 statusBar->unk_3C = TRUE;
887 }
888 }
889 }
890 break;
891 }
892
893 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, SCREEN_WIDTH - 12, SCREEN_HEIGHT - 20);
894 x = statusBar->drawPosX;
895 y = statusBar->drawPosY;
896 draw_box(0, WINDOW_STYLE_5, x, y, 0, 174, 35, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
897 draw_box(0, WINDOW_STYLE_6, x + 174, y, 0, 122, 25, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
898
899 if (statusBar->hpBlinkTimer > 0) {
900 statusBar->hpBlinkTimer--;
901 if (statusBar->hpBlinkTimer == 0) {
903 }
904 }
905
906 showStat = TRUE;
907 if (statusBar->hpBlinking != BLINK_OFF) {
908 if (statusBar->hpBlinkCounter > 8) {
909 showStat = FALSE;
910 if (statusBar->hpBlinkCounter > 12) {
911 statusBar->hpBlinkCounter = 0;
912 showStat = TRUE;
913 }
914 }
915 statusBar->hpBlinkCounter++;
916 }
917
918 if (showStat) {
919 id = statusBar->hpIconHIDs[0];
920 x = statusBar->drawPosX + 22;
921 y = statusBar->drawPosY + 13;
924
925 id = statusBar->hpIconHIDs[1];
926 x = statusBar->drawPosX + 37;
927 y = statusBar->drawPosY + 13;
930
931 x = statusBar->drawPosX + 48;
932 y = statusBar->drawPosY + 8;
933 status_bar_draw_stat(statusBar->hpTimesHID, x, y, statusBar->displayHP, playerData->curMaxHP);
934 }
935
936 if (statusBar->fpBlinkTimer > 0) {
937 statusBar->fpBlinkTimer--;
938 if (statusBar->fpBlinkTimer == 0) {
940 }
941 }
942
943 showStat = TRUE;
944 if (statusBar->fpBlinking != BLINK_OFF) {
945 if (statusBar->fpBlinkCounter > 8) {
946 showStat = FALSE;
947 if (statusBar->fpBlinkCounter > 12) {
948 statusBar->fpBlinkCounter = 0;
949 showStat = TRUE;
950 }
951 }
952 statusBar->fpBlinkCounter++;
953 }
954
955 if (showStat) {
956 id = statusBar->fpIconHIDs[0];
957 x = statusBar->drawPosX + 110;
958 y = statusBar->drawPosY + 13;
961
962 id = statusBar->fpIconHIDs[1];
963 x = statusBar->drawPosX + 125;
964 y = statusBar->drawPosY + 13;
967
968 x = statusBar->drawPosX + 136;
969 y = statusBar->drawPosY + 8;
970 status_bar_draw_stat(statusBar->fpTimesHID, x, y, statusBar->displayFP, playerData->curMaxFP);
971 }
972
973 if (playerData->level >= 27) {
974 playerData->starPoints = 0;
975 }
976
977 showStat = TRUE;
978 if (statusBar->starpointsBlinking != BLINK_OFF) {
979 if (statusBar->starpointsBlinkCounter > 8) {
980 if (statusBar->starpointsBlinkCounter <= 12) {
981 showStat = FALSE;
982 } else {
983 statusBar->starpointsBlinkCounter = 0;
984 }
985 }
986 statusBar->starpointsBlinkCounter++;
987 }
988
989 if (showStat) {
990 id = statusBar->spIconHID;
991 x = statusBar->drawPosX + 195;
992 y = statusBar->drawPosY + 14;
995
996 id = statusBar->spShineHID;
997 x = statusBar->drawPosX + 195;
998 y = statusBar->drawPosY + 9;
1001
1002 x = statusBar->drawPosX + 200;
1003 y = statusBar->drawPosY + 8;
1004 status_bar_draw_number(statusBar->spTimesHID, x, y, playerData->starPoints, 2);
1005 }
1006
1007 if (statusBar->coinsBlinkTimer > 0) {
1008 statusBar->coinsBlinkTimer--;
1009 if (statusBar->coinsBlinkTimer == 0) {
1011 }
1012 }
1013
1014 showStat = TRUE;
1015 if (statusBar->coinsBlinking != BLINK_OFF) {
1016 if (statusBar->coinsBlinkCounter > 8) {
1017 showStat = FALSE;
1018 if (statusBar->coinsBlinkCounter > 12) {
1019 statusBar->coinsBlinkCounter = 0;
1020 showStat = TRUE;
1021 }
1022 }
1023 statusBar->coinsBlinkCounter++;
1024 }
1025
1026 if (showStat) {
1027 id = statusBar->coinIconHID;
1028 x = statusBar->drawPosX + 244;
1029 y = statusBar->drawPosY + 14;
1032
1033 id = statusBar->coinSparkleHID;
1034 x = statusBar->drawPosX + 244;
1035 y = statusBar->drawPosY + 14;
1038
1039 x = statusBar->drawPosX + 247;
1040 y = statusBar->drawPosY + 8;
1041 status_bar_draw_number(statusBar->coinTimesHID, x, y, statusBar->displayCoins, 3);
1042 }
1043
1044 id = statusBar->starIconHID;
1045 showStat = TRUE;
1046 if (statusBar->spBlinking != BLINK_OFF) {
1047 if (statusBar->spBlinkCounter > 5) {
1048 if (statusBar->spBlinkCounter <= 8) {
1049 showStat = FALSE;
1050 } else {
1051 statusBar->spBlinkCounter = 0;
1052 showStat = TRUE;
1053 }
1054 }
1055 statusBar->spBlinkCounter++;
1056 }
1057
1058 x = statusBar->drawPosX + 20;
1059 y = statusBar->drawPosY + 28;
1060
1061 spBars = statusBar->displayStarPower / SP_PER_BAR;
1062 limit = statusBar->displayStarPower % SP_PER_BAR;
1063 limit /= 32;
1064 limit += spBars * 8;
1065 if (statusBar->unk_57 == 1) {
1066 spBars = playerData->starPower / SP_PER_BAR;
1067 limit = playerData->starPower % SP_PER_BAR;
1068 limit = limit / 32;
1069 limit += spBars * 8;
1070 func_800F0CB0(0, x + limit * 25 / 10, y, 1.0f);
1071 statusBar->unk_57 = 2;
1072 }
1073
1074 sp54 = FALSE;
1075 if (statusBar->unk_57 != 0) {
1076 if (statusBar->unk_58 != 0) {
1077 statusBar->unk_58--;
1078 } else {
1079 statusBar->unk_57 = 0;
1080 }
1081 if ((statusBar->unk_58 / 5) & 1) {
1082 sp54 = TRUE;
1083 }
1084 maxStarPower = statusBar->unk_59; // required to match
1085 s7 = statusBar->unk_59 % 8;
1086 s7 += statusBar->unk_59 / 8 * 8;
1087 } else {
1088 s7 = limit;
1089 }
1090
1091 i = 0;
1092 sp50 = 0;
1093 s1 = 0;
1094
1095 if (statusBar->spBlinking != BLINK_OFF) {
1096 if (!showStat) {
1097 s32 limit = statusBar->spBarsToBlink * 8;
1098 if (sp50 < limit) {
1099 while (TRUE) {
1100 i++; s1++; if (i >= limit) { break; }
1101 i++; s1++; if (i >= limit) { break; }
1102 i++; s1++; if (i >= limit) { break; }
1103 i++; s1++; if (i >= limit) { break; }
1104 i++; s1++; if (i >= limit) { break; }
1105 i++; s1++; if (i >= limit) { break; }
1106 i++; s1++; if (i >= limit) { break; }
1107 i++;
1108 s1 = 0;
1109 sp50++;
1110 if (i >= limit) {
1111 break;
1112 }
1113 }
1114 }
1115 }
1116 }
1117
1118 while (TRUE) {
1119 if (i >= limit || i >= s7 && !sp54) {
1120 break;
1121 }
1122 i++;
1123
1125 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[0], y - 2);
1127
1128 s1++;
1129 if (i >= limit || i >= s7 && !sp54) {
1130 break;
1131 }
1132 i++;
1134
1135 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[1], y - 2);
1137 s1++;
1138 if (i >= limit || i >= s7 && !sp54) {
1139 break;
1140 }
1141 i++;
1143 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[2], y - 2);
1145 s1++;
1146 if (i >= limit || i >= s7 && !sp54) {
1147 break;
1148 }
1149 i++;
1151 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[3], y - 2);
1153 s1++;
1154 if (i >= limit || i >= s7 && !sp54) {
1155 break;
1156 }
1157 i++;
1159 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[4], y - 2);
1161 s1++;
1162
1163 if (i >= limit || i >= s7 && !sp54) {
1164 break;
1165 }
1166 i++;
1168 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[5], y - 2);
1170 s1++;
1171
1172 if (i >= limit || i >= s7 && !sp54) {
1173 break;
1174 }
1175 i++;
1177 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[6], y - 2);
1179 s1++;
1180
1181 if (i >= limit || i >= s7 && !sp54) {
1182 break;
1183 }
1184 i++;
1186 hud_element_set_render_pos(id, x + 12 + sp50 * 20, y);
1188
1189 s1 = 0;
1190 sp50++;
1191 if (i >= limit || i >= s7 && !sp54) {
1192 break;
1193 }
1194 }
1195
1196 maxStarPower = playerData->maxStarPower;
1197 limit = maxStarPower * 8;
1198 while (TRUE) {
1199 if (i >= limit) {
1200 break;
1201 }
1202 if (s1 == 0) {
1203 i++;
1205 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1207 if (i >= limit) {
1208 break;
1209 }
1210 s1 = 1;
1211 }
1212 if (s1 == 1) {
1213 i++;
1215 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1217 if (i >= limit) {
1218 break;
1219 }
1220 s1 = 2;
1221 }
1222 if (s1 == 2) {
1223 i++;
1225 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1227 if (i >= limit) {
1228 break;
1229 }
1230 s1 = 3;
1231 }
1232 if (s1 == 3) {
1233 i++;
1235 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1237 if (i >= limit) {
1238 break;
1239 }
1240 s1 = 4;
1241 }
1242 if (s1 == 4) {
1243 i++;
1245 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1247 if (i >= limit) {
1248 break;
1249 }
1250 s1 = 5;
1251 }
1252 if (s1 == 5) {
1253 i++;
1255 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1257 if (i >= limit) {
1258 break;
1259 }
1260 s1 = 6;
1261 }
1262 if (s1 == 6) {
1263 i++;
1265 hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[s1], y - 2);
1267 if (i >= limit) {
1268 break;
1269 }
1270 s1 = 7;
1271 }
1272
1273 if (s1 == 7) {
1274 i++;
1276 hud_element_set_render_pos(id, x + 12 + sp50 * 20, y);
1278 if (i >= limit) {
1279 break;
1280 }
1281 }
1282 s1 = 0;
1283 sp50++;
1284 }
1285
1286 func_800F0D80();
1287 func_800F102C();
1288}
1289
1290void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
1291 StatusBar* statusBar = &gStatusBar;
1292 s32 iconIndex;
1293
1294 if ((gPlayerData.coins != statusBar->displayCoins) && ((gGameStatusPtr->frameCounter % 3) == 0)) {
1296 }
1297
1298 iconIndex = statusBar->coinCountTimesHID;
1299 hud_element_set_render_pos(iconIndex, posX + 27, posY + 11);
1300 hud_element_draw_clipped(iconIndex);
1301
1302 iconIndex = statusBar->coinCountIconHID;
1303 hud_element_set_render_pos(iconIndex, posX + 15, posY + 11);
1304 hud_element_draw_clipped(iconIndex);
1305
1307}
1308
1310 StatusBar* statusBar = &gStatusBar;
1311
1312 if (statusBar->unk_6D != 0) {
1313 statusBar->unk_6D--;
1314 if ((statusBar->unk_6D == 0) && (statusBar->iconIndex12 > -1)) {
1315 hud_element_free(statusBar->iconIndex12);
1316 hud_element_free(statusBar->iconIndex13);
1317 statusBar->iconIndex12 = -1;
1318 }
1319 D_8010CD12 = FALSE;
1320 }
1321
1322 if (statusBar->coinCounterHideTime == 0) {
1323 return;
1324 }
1325
1326 if ((statusBar->displayCoins == gPlayerData.coins) && (statusBar->coinCounterHideTime > 30)) {
1327 statusBar->coinCounterHideTime = 30;
1328 }
1329
1330 if ((statusBar->displayCoins == gPlayerData.coins) || (statusBar->coinCounterHideTime <= 30)) {
1331 statusBar->coinCounterHideTime--;
1332 if (statusBar->coinCounterHideTime == 0) {
1334 statusBar->unk_6D = 15;
1335 D_8010CD10 = FALSE;
1336 D_8010CD12 = TRUE;
1337 statusBar->iconIndex12 = statusBar->coinCountTimesHID;
1338 statusBar->iconIndex13 = statusBar->coinCountIconHID;
1339 statusBar->displayCoins = gPlayerData.coins;
1340 if (statusBar->unk_6E > -1) {
1341 statusBar->ignoreChanges = statusBar->unk_6E;
1342 statusBar->unk_6E = -1;
1343 }
1344 }
1345 }
1346}
1347
1349 StatusBar* statusBar = &gStatusBar;
1350 s32 index;
1351
1352 if (D_8010CD10 || D_8010CD12) {
1354 if (statusBar->iconIndex12 > -1) {
1357 statusBar->iconIndex12 = -1;
1358 }
1359 statusBar->coinCounterHideTime = 0;
1360 statusBar->unk_6D = 0;
1361 D_8010CD10 = FALSE;
1362 D_8010CD12 = FALSE;
1363 }
1364
1365 if (statusBar->coinCounterHideTime == 0) {
1368 statusBar->coinCountTimesHID = index = hud_element_create(&HES_MenuTimes);
1370 hud_element_set_tint(index, 255, 255, 255);
1371 statusBar->coinCountIconHID = index = hud_element_create(&HES_StatusCoin);
1373 hud_element_set_tint(index, 255, 255, 255);
1374 statusBar->coinCounterHideTime = 0;
1375
1376 if (statusBar->unk_6E < 0) {
1377 statusBar->unk_6E = statusBar->ignoreChanges;
1378 }
1379
1380 statusBar->ignoreChanges = TRUE;
1381 D_8010CD10 = TRUE;
1382 }
1383}
1384
1386 StatusBar* statusBar = &gStatusBar;
1387
1388 if (D_8010CD10 && (statusBar->coinCounterHideTime == 0)) {
1389 statusBar->coinCounterHideTime = 60;
1390 }
1391}
1392
1394 StatusBar* statusBar = &gStatusBar;
1395
1396 if (D_8010CD10 && (statusBar->coinCounterHideTime == 0)) {
1397 statusBar->coinCounterHideTime = 1;
1398 }
1399}
1400
1401API_CALLABLE(ShowCoinCounter) {
1402 if (evt_get_variable(script, *script->ptrReadPos)) {
1404 } else {
1406 }
1407
1408 return ApiStatus_DONE2;
1409}
1410
1411void draw_status_ui(void) {
1414
1415 #if DX_DEBUG_MENU
1416 dx_debug_menu_main();
1417 #endif
1418}
1419
1421 StatusBar* statusBar = &gStatusBar;
1422
1423 if (statusBar->hidden) {
1424 statusBar->showTimer = 210;
1425 statusBar->hidden = FALSE;
1426 statusBar->unk_3B = TRUE;
1427 }
1428}
1429
1431 StatusBar* statusBar = &gStatusBar;
1432
1433 if (statusBar->hidden) {
1434 statusBar->showTimer = 105;
1435 statusBar->hidden = FALSE;
1436 statusBar->unk_3B = TRUE;
1437 }
1438}
1439
1441 StatusBar* statusBar = &gStatusBar;
1442
1443 if (statusBar->hidden != TRUE) {
1444 statusBar->hidden = TRUE;
1445 statusBar->showTimer = 0;
1446 statusBar->unk_3B = TRUE;
1447 }
1448}
1449
1451 StatusBar* statusBar = &gStatusBar;
1452
1453 statusBar->drawPosY = FULLY_RETRACTED_Y;
1454 statusBar->ignoreChanges = FALSE;
1455 statusBar->showTimer = 0;
1456 statusBar->hidden = TRUE;
1457 statusBar->unk_3B = FALSE;
1458 statusBar->unk_3C = FALSE;
1459}
1460
1462 StatusBar* statusBar = &gStatusBar;
1463
1464 statusBar->drawPosY = 0;
1465 statusBar->ignoreChanges = FALSE;
1466 statusBar->showTimer = 210;
1467 statusBar->hidden = FALSE;
1468 statusBar->unk_3B = TRUE;
1469 statusBar->unk_3C = FALSE;
1470}
1471
1475
1479
1480// determine whether the player can open or close the status bar via button press
1483 return FALSE;
1484 }
1485
1486 if (gStatusBar.alwaysShown) {
1487 return FALSE;
1488 }
1489
1491 return FALSE;
1492 }
1493
1494 return TRUE;
1495}
1496
1500
1502 StatusBar* statusBar = &gStatusBar;
1503
1504 statusBar->ignoreChanges = TRUE;
1505 statusBar->drawPosY = FULLY_EXTENDED_Y;
1506}
1507
1511
1513 StatusBar* statusBar = &gStatusBar;
1514
1515 return statusBar->alwaysShown + statusBar->ignoreChanges;
1516}
1517
1519 gStatusBar.alwaysShown = TRUE;
1520}
1521
1523 gStatusBar.alwaysShown = FALSE;
1524}
1525
1527 return !gStatusBar.hidden;
1528}
1529
1531 StatusBar* statusBar = &gStatusBar;
1532
1534 statusBar->hpBlinkTimer = 120;
1535 }
1536
1537 if (statusBar->hpBlinking != BLINK_ON) {
1538 statusBar->hpBlinking = BLINK_ON;
1539 statusBar->hpBlinkCounter = 0;
1540 }
1541}
1542
1544 StatusBar* statusBar = &gStatusBar;
1545
1546 if (statusBar->hpBlinking != BLINK_OFF) {
1547 statusBar->hpBlinking = BLINK_OFF;
1548 statusBar->hpBlinkCounter = 0;
1549 statusBar->hpBlinkTimer = 0;
1550 }
1551}
1552
1554 StatusBar* statusBar = &gStatusBar;
1555
1557 statusBar->fpBlinkTimer = 120;
1558 }
1559
1560 if (statusBar->fpBlinking != BLINK_ON) {
1561 statusBar->fpBlinking = BLINK_ON;
1562 statusBar->fpBlinkCounter = 0;
1563 }
1564}
1565
1567 StatusBar* statusBar = &gStatusBar;
1568
1569 if (statusBar->fpBlinking != BLINK_OFF) {
1570 statusBar->fpBlinking = BLINK_OFF;
1571 statusBar->fpBlinkCounter = 0;
1572 }
1573}
1574
1576 StatusBar* statusBar = &gStatusBar;
1577
1579 statusBar->coinsBlinkTimer = 120;
1580 }
1581
1582 if (statusBar->coinsBlinking != BLINK_ON) {
1583 statusBar->coinsBlinking = BLINK_ON;
1584 statusBar->coinsBlinkCounter = 0;
1585 }
1586}
1587
1589 StatusBar* statusBar = &gStatusBar;
1590
1591 if (statusBar->coinsBlinking != BLINK_OFF) {
1592 statusBar->coinsBlinking = BLINK_OFF;
1593 statusBar->coinsBlinkCounter = 0;
1594 statusBar->coinsBlinkTimer = 0;
1595 }
1596}
1597
1599 PlayerData* playerData = &gPlayerData;
1600 StatusBar* statusBar = &gStatusBar;
1601
1602 statusBar->spBarsToBlink = playerData->maxStarPower;
1603 if (statusBar->spBlinking != BLINK_ON) {
1604 statusBar->spBlinking = BLINK_ON;
1605 statusBar->spBlinkCounter = 0;
1606 }
1607}
1608
1610 StatusBar* statusBar = &gStatusBar;
1611
1612 if (statusBar->spBlinking != BLINK_OFF) {
1613 statusBar->spBlinking = BLINK_OFF;
1614 statusBar->spBlinkCounter = 0;
1615 }
1616}
1617
1618void status_bar_start_blinking_sp_bars(s32 numBarsToBlink) {
1619 StatusBar* statusBar = &gStatusBar;
1620
1621 statusBar->spBarsToBlink = numBarsToBlink;
1622 if (statusBar->spBlinking != BLINK_ON) {
1623 statusBar->spBlinking = BLINK_ON;
1624 statusBar->spBlinkCounter = 0;
1625 }
1626}
1627
1629 StatusBar* statusBar = &gStatusBar;
1630
1631 if (statusBar->starpointsBlinking != BLINK_ON) {
1632 statusBar->starpointsBlinking = BLINK_ON;
1633 statusBar->starpointsBlinkCounter = 0;
1634 }
1635}
1636
1638 StatusBar* statusBar = &gStatusBar;
1639
1640 if (statusBar->starpointsBlinking != BLINK_OFF) {
1641 statusBar->starpointsBlinking = BLINK_OFF;
1642 statusBar->starpointsBlinkCounter = 0;
1643 }
1644}
1645
1647 StatusBar* statusBar = &gStatusBar;
1648
1649 if (statusBar->disabled > 0) {
1650 statusBar->disabled--;
1651 }
1652}
1653
1655 StatusBar* statusBar = &gStatusBar;
1656
1657 statusBar->disabled++;
1658}
1659
1661 PlayerData* playerData = &gPlayerData;
1662 StatusBar* statusBar = &gStatusBar;
1663
1664 statusBar->displayHP = playerData->curHP;
1665 statusBar->displayFP = playerData->curFP;
1666 statusBar->displayStarPower = playerData->starPower;
1667 statusBar->displayCoins = playerData->coins;
1668 statusBar->displayStarpoints = playerData->starPoints;
1669}
1670
1672 PlayerData* playerData = &gPlayerData;
1673 StatusBar* statusBar = &gStatusBar;
1674 s32 i;
1675
1676 statusBar->drawPosX = 12;
1677 statusBar->drawPosY = FULLY_RETRACTED_Y;
1678 statusBar->hidden = 0;
1679 statusBar->showTimer = 210;
1680 statusBar->unk_3B = FALSE;
1681 statusBar->ignoreChanges = FALSE;
1682 statusBar->openInputDisabled = FALSE;
1683 statusBar->alwaysShown = FALSE;
1684 statusBar->hpBlinking = BLINK_OFF;
1685 statusBar->hpBlinkCounter = 0;
1686 statusBar->hpBlinkTimer = 0;
1687 statusBar->fpBlinking = BLINK_OFF;
1688 statusBar->fpBlinkCounter = 0;
1689 statusBar->fpBlinkTimer = 0;
1690 statusBar->coinsBlinking = BLINK_OFF;
1691 statusBar->coinsBlinkCounter = 0;
1692 statusBar->coinsBlinkTimer = 0;
1693 statusBar->spBlinking = BLINK_OFF;
1694 statusBar->spBlinkCounter = 0;
1695 statusBar->disabled = 0;
1696 statusBar->starpointsBlinking = BLINK_OFF;
1697 statusBar->starpointsBlinkCounter = 0;
1698 statusBar->unk_6E = -1;
1699 statusBar->displayHP = playerData->curHP;
1700 statusBar->displayFP = playerData->curFP;
1701 statusBar->displayCoins = playerData->coins;
1702 statusBar->displayStarpoints = playerData->starPoints;
1703 statusBar->displayStarPower = playerData->starPower;
1704 statusBar->unk_3C = FALSE;
1705
1706 for (i = 0; i < ARRAY_COUNT(statusBar->hpIconHIDs); i++) {
1707 copy_world_hud_element_ref_to_battle(statusBar->hpIconHIDs[i], statusBar->hpIconHIDs[i]);
1708 }
1709
1710 for (i = 0; i < ARRAY_COUNT(statusBar->fpIconHIDs); i++) {
1711 copy_world_hud_element_ref_to_battle(statusBar->fpIconHIDs[i], statusBar->fpIconHIDs[i]);
1712 }
1713
1723}
1724
1725s32 is_ability_active(s32 ability) {
1726 PlayerData* playerData = &gPlayerData;
1727 s32 attackFXArray[6];
1728 s32 attackFXIndex;
1729 s32 badgeItemID;
1730 s32 badgeMoveID;
1731 s32 ret;
1732 s32 i;
1733
1734 ret = 0;
1735 attackFXIndex = 0;
1736
1737 for (i = 0; i < ARRAY_COUNT(attackFXArray); i++) {
1738 attackFXArray[i] = 0;
1739 }
1740
1742 return 0;
1743 }
1744
1745 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
1746 badgeItemID = playerData->equippedBadges[i];
1747 if (badgeItemID == ITEM_NONE)
1748 continue;
1749
1750 badgeMoveID = gItemTable[badgeItemID].moveID;
1751
1752 switch (ability) {
1754 if (badgeMoveID == MOVE_DODGE_MASTER) {
1755 ret++;
1756 }
1757 break;
1759 if (badgeMoveID == MOVE_SPIKE_SHIELD) {
1760 ret++;
1761 }
1762 break;
1764 if (badgeMoveID == MOVE_FIRST_ATTACK) {
1765 ret++;
1766 }
1767 break;
1768 case ABILITY_HP_PLUS:
1769 if (badgeMoveID == MOVE_HP_PLUS) {
1770 ret++;
1771 }
1772 break;
1773 case ABILITY_DOUBLE_DIP:
1774 if (badgeMoveID == MOVE_DOUBLE_DIP) {
1775 ret++;
1776 }
1777 break;
1779 if (badgeMoveID == MOVE_MYSTERY_SCROLL) {
1780 ret++;
1781 }
1782 if (playerData->hasActionCommands) {
1783 ret++;
1784 }
1785 break;
1787 if (badgeMoveID == MOVE_FIRE_SHIELD) {
1788 ret++;
1789 }
1790 break;
1792 if (badgeMoveID == MOVE_PRETTY_LUCKY) {
1793 ret++;
1794 }
1795 break;
1796 case ABILITY_HP_DRAIN:
1797 if (badgeMoveID == MOVE_HP_DRAIN) {
1798 ret++;
1799 }
1800 break;
1802 if (badgeMoveID == MOVE_ALLOR_NOTHING) {
1803 ret++;
1804 }
1805 break;
1806 case ABILITY_SLOW_GO:
1807 if (badgeMoveID == MOVE_SLOW_GO) {
1808 ret++;
1809 }
1810 break;
1811 case ABILITY_FP_PLUS:
1812 if (badgeMoveID == MOVE_FP_PLUS) {
1813 ret++;
1814 }
1815 break;
1816 case ABILITY_ICE_POWER:
1817 if (badgeMoveID == MOVE_ICE_POWER) {
1818 ret++;
1819 }
1820 break;
1822 if (badgeMoveID == MOVE_FEELING_FINE) {
1823 ret++;
1824 }
1825 break;
1826 case ABILITY_ATTACK_FX:
1827 if (badgeMoveID == MOVE_ATTACK_FX_A) {
1828 attackFXArray[attackFXIndex++] = 1;
1829 ret = -1;
1830 }
1831 if (badgeMoveID == MOVE_ATTACK_FX_D) {
1832 attackFXArray[attackFXIndex++] = 2;
1833 ret = -1;
1834 }
1835 if (badgeMoveID == MOVE_ATTACK_FX_B) {
1836 attackFXArray[attackFXIndex++] = 3;
1837 ret = -1;
1838 }
1839 if (badgeMoveID == MOVE_ATTACK_FX_E) {
1840 attackFXArray[attackFXIndex++] = 4;
1841 ret = -1;
1842 }
1843 if (badgeMoveID == MOVE_ATTACK_FX_C) {
1844 attackFXArray[attackFXIndex++] = 5;
1845 ret = -1;
1846 }
1847 if (badgeMoveID == MOVE_ATTACK_FX_F) {
1848 attackFXArray[attackFXIndex++] = 6;
1849 ret = -1;
1850 }
1851 break;
1853 if (badgeMoveID == MOVE_MONEY_MONEY) {
1854 ret++;
1855 }
1856 break;
1857 case ABILITY_CHILL_OUT:
1858 if (badgeMoveID == MOVE_CHILL_OUT_BADGE) {
1859 ret++;
1860 }
1861 break;
1863 if (badgeMoveID == MOVE_HAPPY_HEART) {
1864 ret++;
1865 }
1866 break;
1867 case ABILITY_ZAP_TAP:
1868 if (badgeMoveID == MOVE_ZAP_TAP) {
1869 ret++;
1870 }
1871 break;
1872 case ABILITY_MEGA_RUSH:
1873 if (badgeMoveID == MOVE_MEGA_RUSH) {
1874 ret++;
1875 }
1876 break;
1877 case ABILITY_BERSERKER:
1878 if (badgeMoveID == MOVE_BERSERKER) {
1879 ret++;
1880 }
1881 break;
1882 case ABILITY_RIGHT_ON:
1883 if (badgeMoveID == MOVE_RIGHT_ON) {
1884 ret++;
1885 }
1886 break;
1888 if (badgeMoveID == MOVE_RUNAWAY_PAY) {
1889 ret++;
1890 }
1891 break;
1893 if (badgeMoveID == MOVE_FLOWER_SAVER) {
1894 ret++;
1895 }
1896 break;
1897 case ABILITY_PAY_OFF:
1898 if (badgeMoveID == MOVE_PAY_OFF) {
1899 ret++;
1900 }
1901 break;
1903 if (badgeMoveID == MOVE_DEFEND_PLUS) {
1904 ret++;
1905 }
1906 break;
1907 case ABILITY_POWER_PLUS:
1908 if (badgeMoveID == MOVE_POWER_PLUS) {
1909 ret++;
1910 }
1911 break;
1912 case ABILITY_REFUND:
1913 if (badgeMoveID == MOVE_REFUND) {
1914 ret++;
1915 }
1916 break;
1917 case ABILITY_POWER_RUSH:
1918 if (badgeMoveID == MOVE_POWER_RUSH) {
1919 ret++;
1920 }
1921 break;
1923 if (badgeMoveID == MOVE_CRAZY_HEART) {
1924 ret++;
1925 }
1926 break;
1927 case ABILITY_LAST_STAND:
1928 if (badgeMoveID == MOVE_LAST_STAND) {
1929 ret++;
1930 }
1931 break;
1932 case ABILITY_CLOSE_CALL:
1933 if (badgeMoveID == MOVE_CLOSE_CALL) {
1934 ret++;
1935 }
1936 break;
1938 if (badgeMoveID == MOVE_P_UP_D_DOWN) {
1939 ret++;
1940 }
1941 break;
1942 case ABILITY_LUCKY_DAY:
1943 if (badgeMoveID == MOVE_LUCKY_DAY) {
1944 ret++;
1945 }
1946 break;
1948 if (badgeMoveID == MOVE_MEGA_HP_DRAIN) {
1949 ret++;
1950 }
1951 break;
1953 if (badgeMoveID == MOVE_P_DOWN_D_UP) {
1954 ret++;
1955 }
1956 break;
1958 if (badgeMoveID == MOVE_FLOWER_FANATIC) {
1959 ret++;
1960 }
1961 break;
1963 if (badgeMoveID == MOVE_SPEEDY_SPIN) {
1964 ret++;
1965 }
1966 break;
1968 if (badgeMoveID == MOVE_SPIN_ATTACK) {
1969 ret++;
1970 }
1971 break;
1972 case ABILITY_I_SPY:
1973 if (badgeMoveID == MOVE_I_SPY) {
1974 ret++;
1975 }
1976 break;
1978 if (badgeMoveID == MOVE_BUMP_ATTACK) {
1979 ret++;
1980 }
1981 break;
1983 if (badgeMoveID == MOVE_QUICK_CHANGE) {
1984 ret++;
1985 }
1986 break;
1988 if (badgeMoveID == MOVE_HEART_FINDER) {
1989 ret++;
1990 }
1991 break;
1993 if (badgeMoveID == MOVE_FLOWER_FINDER) {
1994 ret++;
1995 }
1996 break;
1998 if (badgeMoveID == MOVE_DIZZY_ATTACK) {
1999 ret++;
2000 }
2001 break;
2003 if (badgeMoveID == MOVE_UNUSED_FINAL_GOOMPA) {
2004 ret++;
2005 }
2006 break;
2008 if (badgeMoveID == MOVE_UNUSED_FINAL_BOBOMB) {
2009 ret++;
2010 }
2011 break;
2012 case ABILITY_DEEP_FOCUS:
2013 if (badgeMoveID == MOVE_DEEP_FOCUS) {
2014 ret++;
2015 }
2016 break;
2018 if (badgeMoveID == MOVE_SUPER_FOCUS) {
2019 ret++;
2020 }
2021 break;
2022 case ABILITY_KAIDEN:
2023 if (badgeMoveID == MOVE_KAIDEN) {
2024 ret++;
2025 }
2026 break;
2028 if (badgeMoveID == MOVE_DAMAGE_DODGE) {
2029 ret++;
2030 }
2031 break;
2033 if (badgeMoveID == MOVE_HAPPY_FLOWER) {
2034 ret++;
2035 }
2036 break;
2038 if (badgeMoveID == MOVE_GROUP_FOCUS) {
2039 ret++;
2040 }
2041 break;
2042 case ABILITY_PEEKABOO:
2043 if (badgeMoveID == MOVE_PEEKABOO) {
2044 ret++;
2045 }
2046 break;
2048 if (badgeMoveID == MOVE_HEALTHY_HEALTHY) {
2049 ret++;
2050 }
2051 break;
2052 }
2053 }
2054
2055 if (ret < 0) {
2056 ret = attackFXArray[rand_int(attackFXIndex - 1)];
2057 }
2058 return ret;
2059}
2060
2062 return 0;
2063}
2064
2065s32 add_coins(s32 amt) {
2066 PlayerData* playerData = &gPlayerData;
2067 s16 newCoins = playerData->coins + amt;
2068
2069 playerData->coins = newCoins;
2070 if (newCoins > 999) {
2071 playerData->coins = 999;
2072 }
2073 if (playerData->coins < 0) {
2074 playerData->coins = 0;
2075 }
2076
2077 if (amt > 0) {
2078 playerData->totalCoinsEarned += amt;
2079 if (playerData->totalCoinsEarned > 99999) {
2080 playerData->totalCoinsEarned = 99999;
2081 }
2082 }
2083 return playerData->coins;
2084}
2085
2086s32 add_star_points(s32 amt) {
2087 PlayerData* playerData = &gPlayerData;
2088 s8 newSP = playerData->starPoints + amt;
2089
2090 // TODO: probably a macro!
2091 playerData->starPoints = newSP;
2092 if (newSP > 100) {
2093 playerData->starPoints = 100;
2094 }
2095
2096 // TODO: probably a macro!
2097 newSP = playerData->starPoints;
2098 if (newSP < 0) {
2099 playerData->starPoints = 0;
2100 }
2101 return gPlayerData.starPoints;
2102}
2103
2104s32 add_star_pieces(s32 amt) {
2105 PlayerData* playerData = &gPlayerData;
2106 s32 newSP = playerData->starPieces;
2107
2108 newSP += amt;
2109 if (newSP > MAX_STAR_PIECES) {
2110 newSP = MAX_STAR_PIECES;
2111 }
2112 if (newSP < 0) {
2113 newSP = 0;
2114 }
2115 playerData->starPieces = newSP;
2116
2117 if (amt > 0) {
2118 playerData->starPiecesCollected += amt;
2119 }
2120
2121 return playerData->starPieces;
2122}
2123
2128
2129void set_max_star_power(s8 newMax) {
2130 gPlayerData.maxStarPower = newMax;
2131 gPlayerData.starPower = newMax * SP_PER_BAR;
2132}
2133
2134void add_star_power(s32 amt) {
2135 PlayerData* playerData = &gPlayerData;
2136 StatusBar* statusBar = &gStatusBar;
2137 s32 maxPower;
2138
2139 statusBar->unk_57 = 1;
2140 statusBar->unk_58 = 60;
2141
2142 if (playerData->starPower < 0) {
2143 statusBar->unk_59 = (playerData->starPower + 31) / SP_PER_SEG;
2144 } else {
2145 statusBar->unk_59 = playerData->starPower / SP_PER_SEG;
2146 }
2147
2148 playerData->starPower += amt;
2149
2150 maxPower = playerData->maxStarPower * SP_PER_BAR;
2151 if (playerData->starPower > maxPower) {
2152 playerData->starPower = maxPower;
2153 }
2154
2156}
2157
2158s32 recover_fp(s32 amt) {
2159 if (amt == -2) {
2162 } else if (amt == -1) {
2164 } else {
2165 if (amt > 0) {
2166 gPlayerData.curFP += amt;
2167 }
2170 }
2171 }
2172 return gPlayerData.curFP;
2173}
2174
2175s32 recover_hp(s32 amt) {
2176 if (amt == -2) {
2179 } else if (amt == -1) {
2181 } else {
2182 if (amt > 0) {
2183 gPlayerData.curHP += amt;
2184 }
2187 }
2188 }
2189 return gPlayerData.curHP;
2190}
2191
2192void subtract_hp(s32 amt) {
2193 PlayerData* playerData = &gPlayerData;
2194 s32 newHP = playerData->curHP;
2195
2196 if (amt > 0) {
2197 newHP -= amt;
2198 }
2199 if (amt < 0 || newHP < 1) {
2200 newHP = 1;
2201 }
2202 playerData->curHP = newHP;
2203}
2204
2205s8 has_full_hp(void) {
2207}
2208
2209s8 has_full_fp(void) {
2211}
s16 equippedBadges[64]
s16 badges[128]
s32 coinCountTimesHID
s16 storedItems[32]
PartnerData partners[12]
s16 displayStarpoints
s8 starpointsBlinkCounter
s32 partnerUsedTime[12]
u16 actionCommandSuccesses
s32 b32
s32 hpIconHIDs[2]
s16 b16
u16 starPiecesCollected
s32 partnerUnlockedTime[12]
u16 actionCommandAttempts
s16 keyItems[32]
s32 fpIconHIDs[2]
s16 invItems[10]
#define rand_int
#define draw_box
@ MERLEE_SPELL_NONE
Definition enums.h:1910
@ WINDOW_STYLE_5
Definition enums.h:6375
@ WINDOW_STYLE_6
Definition enums.h:6376
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
Definition enums.h:5393
@ DRAW_NUMBER_STYLE_MONOSPACE
Definition enums.h:5394
@ PEACH_FLAG_IS_PEACH
Definition enums.h:2488
@ STORY_EPILOGUE
Definition enums.h:234
@ LANGUAGE_DE
Definition enums.h:6401
@ LANGUAGE_ES
Definition enums.h:6403
@ LANGUAGE_EN
Definition enums.h:6400
@ LANGUAGE_FR
Definition enums.h:6402
@ WINDOW_PRIORITY_21
Definition enums.h:3187
@ MSG_PAL_STANDARD
Definition enums.h:5415
@ WINDOW_UPDATE_HIDE
Definition enums.h:5312
@ PS_FLAG_NO_STATIC_COLLISION
Definition enums.h:3051
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
@ DRAW_NUMBER_CHARSET_THIN
Definition enums.h:5401
@ INTRO_PART_0
Definition enums.h:3552
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ CONTEXT_WORLD
Definition enums.h:3529
@ ABILITY_BERSERKER
Definition enums.h:457
@ ABILITY_FLOWER_SAVER
Definition enums.h:460
@ ABILITY_QUICK_CHANGE
Definition enums.h:462
@ ABILITY_DEEP_FOCUS
Definition enums.h:484
@ ABILITY_BUMP_ATTACK
Definition enums.h:478
@ ABILITY_FEELING_FINE
Definition enums.h:450
@ ABILITY_ATTACK_FX
Definition enums.h:451
@ ABILITY_FLOWER_FINDER
Definition enums.h:480
@ ABILITY_P_DOWN_D_UP
Definition enums.h:473
@ ABILITY_FP_PLUS
Definition enums.h:448
@ ABILITY_MEGA_HP_DRAIN
Definition enums.h:472
@ ABILITY_DOUBLE_DIP
Definition enums.h:441
@ ABILITY_PAY_OFF
Definition enums.h:461
@ ABILITY_POWER_RUSH
Definition enums.h:466
@ ABILITY_SPIN_ATTACK
Definition enums.h:476
@ ABILITY_CHILL_OUT
Definition enums.h:453
@ ABILITY_MONEY_MONEY
Definition enums.h:452
@ ABILITY_FLOWER_FANATIC
Definition enums.h:474
@ ABILITY_REFUND
Definition enums.h:465
@ ABILITY_PEEKABOO
Definition enums.h:490
@ ABILITY_POWER_PLUS
Definition enums.h:464
@ ABILITY_CLOSE_CALL
Definition enums.h:469
@ ABILITY_HEALTHY_HEALTHY
Definition enums.h:491
@ ABILITY_MEGA_RUSH
Definition enums.h:456
@ ABILITY_HEART_FINDER
Definition enums.h:479
@ ABILITY_DIZZY_ATTACK
Definition enums.h:481
@ ABILITY_DEFEND_PLUS
Definition enums.h:463
@ ABILITY_HP_PLUS
Definition enums.h:440
@ ABILITY_FINAL_GOOMPA
Definition enums.h:482
@ ABILITY_I_SPY
Definition enums.h:477
@ ABILITY_DAMAGE_DODGE
Definition enums.h:487
@ ABILITY_SPIKE_SHIELD
Definition enums.h:438
@ ABILITY_KAIDEN
Definition enums.h:486
@ ABILITY_ZAP_TAP
Definition enums.h:455
@ ABILITY_LAST_STAND
Definition enums.h:468
@ ABILITY_P_UP_D_DOWN
Definition enums.h:470
@ ABILITY_HAPPY_HEART
Definition enums.h:454
@ ABILITY_FIRE_SHIELD
Definition enums.h:443
@ ABILITY_DODGE_MASTER
Definition enums.h:436
@ ABILITY_FINAL_BOBOMB
Definition enums.h:483
@ ABILITY_ICE_POWER
Definition enums.h:449
@ ABILITY_LUCKY_DAY
Definition enums.h:471
@ ABILITY_CRAZY_HEART
Definition enums.h:467
@ ABILITY_SUPER_FOCUS
Definition enums.h:485
@ ABILITY_ALL_OR_NOTHING
Definition enums.h:446
@ ABILITY_HAPPY_FLOWER
Definition enums.h:488
@ ABILITY_RUNAWAY_PAY
Definition enums.h:459
@ ABILITY_PRETTY_LUCKY
Definition enums.h:444
@ ABILITY_RIGHT_ON
Definition enums.h:458
@ ABILITY_HP_DRAIN
Definition enums.h:445
@ ABILITY_MYSTERY_SCROLL
Definition enums.h:442
@ ABILITY_FIRST_ATTACK
Definition enums.h:439
@ ABILITY_GROUP_FOCUS
Definition enums.h:489
@ ABILITY_SLOW_GO
Definition enums.h:447
@ ABILITY_SPEEDY_SPIN
Definition enums.h:475
@ SOUND_FLOWER_PICKUP
Definition enums.h:927
@ SOUND_COIN_PICKUP
Definition enums.h:922
@ SOUND_HEART_PICKUP
Definition enums.h:924
@ PARTNER_NONE
Definition enums.h:2885
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ DEMO_STATE_NONE
Definition enums.h:3535
@ WIN_CURRENCY_COUNTER
Definition enums.h:5261
#define ApiStatus_DONE2
Definition evt.h:118
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
void basic_hidden_window_update(s32 windowIndex, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
Definition windows.c:184
void func_800F0CB0(s32, f32, f32, f32)
void set_window_update(s32 panelID, s32)
Definition windows.c:434
void basic_window_update(s32 windowIndex, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
Definition windows.c:161
void func_800F102C(void)
void func_800F0D80(void)
void set_window_properties(s32 panelID, s32 posX, s32 posY, s32 width, s32 height, u8, void *drawContents, void *drawContentsArg, s8 parent)
Definition windows.c:373
void func_800F0D5C(void)
void draw_number(s32 value, s32 x, s32 y, s32 variableWidthChars, s32 palette, s32 opacity, u16 style)
Definition msg.c:2223
HudScript HES_StatusCoin
HudScript HES_MenuTimes
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_draw_next(s32 id)
void hud_element_set_tint(s32 id, s32 r, s32 g, s32 b)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_set_flags(s32 id, s32 flags)
Turns on the given flags.
void hud_element_clear_flags(s32 id, s32 flags)
Turns off the given flags.
void hud_element_draw_clipped(s32 id)
void hud_element_free(s32 id)
void copy_world_hud_element_ref_to_battle(s32 worldID, s32 battleID)
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:74
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:80
@ HUD_ELEMENT_FLAG_FILTER_TEX
Definition hud_element.h:88
s32 HudScript[]
Definition hud_element.h:9
b32 can_control_status_bar(void)
Definition inventory.c:1481
void setup_status_bar_for_world(void)
Definition inventory.c:1450
void show_coin_counter(void)
Definition inventory.c:1348
s32 find_item(s32 itemID)
Search player inventory for itemID and return first matching array index.
Definition inventory.c:258
#define FULLY_RETRACTED_Y
Definition inventory.c:7
void status_bar_start_blinking_hp(void)
Definition inventory.c:1530
s32 recover_hp(s32 amt)
Recover player HP.
Definition inventory.c:2175
HudScript * TimesHudScript
Definition partners.c:146
HudScript HES_StatusHP_de
s32 add_star_pieces(s32 amt)
Definition inventory.c:2104
HudScript HES_StatusHP
HudScript * SlashHudScript
Definition partners.c:147
HudScript HES_StatusFP_de
HudScript * DigitHudScripts[10]
Definition partners.c:142
void status_bar_ignore_changes(void)
Definition inventory.c:1497
void reset_status_bar(void)
Definition inventory.c:1671
s32 store_item(s32 itemID)
Add itemID to player storage and return slot in which it was placed.
Definition inventory.c:369
void setup_status_bar_for_battle(void)
Definition inventory.c:1461
void enable_status_bar_input(void)
Definition inventory.c:1472
void status_bar_start_blinking_fp(void)
Definition inventory.c:1553
HudScript HES_StatusStar1
HudScript HES_StatusFP
s32 recover_fp(s32 amt)
Recover player FP.
Definition inventory.c:2158
s32 is_partner_ability_active(s32 ability)
Definition inventory.c:2061
void sort_consumables(void)
Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
Definition inventory.c:404
void decrement_status_bar_disabled(void)
Definition inventory.c:1646
void update_coin_counter(void)
Definition inventory.c:1309
void hide_coin_counter(void)
Definition inventory.c:1385
void sync_status_bar(void)
Definition inventory.c:1660
void status_bar_stop_blinking_hp(void)
Definition inventory.c:1543
void open_status_bar_quickly(void)
Definition inventory.c:1430
s32 get_consumables_empty(void)
Definition inventory.c:436
BlinkModes
Definition inventory.c:9
@ BLINK_ON
Definition inventory.c:11
@ BLINK_OFF
Definition inventory.c:10
HudScript * SPStarHudScripts[]
Definition partners.c:152
HudScript HES_StatusStarEmpty
s32 count_item(s32 itemID)
Search player inventory for itemID and count the number matches.
Definition inventory.c:304
HudScript * SPIncrementHudScripts[]
Definition partners.c:148
HudScript HES_StatusSPShine
s8 has_full_fp(void)
Definition inventory.c:2209
void close_status_bar(void)
Definition inventory.c:1440
HudScript HES_StatusStarPoint
HudScript HES_StatusHP_es
void status_bar_stop_blinking_sp(void)
Definition inventory.c:1609
void update_status_bar(void)
Definition inventory.c:712
void increment_max_star_power(void)
Definition inventory.c:2124
b32 is_badge_equipped(s32 itemID)
Definition inventory.c:387
void status_bar_show_and_ignore_changes(void)
Definition inventory.c:1501
s8 has_full_hp(void)
Definition inventory.c:2205
void status_bar_stop_blinking_starpoints(void)
Definition inventory.c:1637
s32 StatusBarSPIncrementOffsets[]
Definition partners.c:156
s32 add_star_points(s32 amt)
Definition inventory.c:2086
HudScript HES_StatusCoinSparkle
void disable_status_bar_input(void)
Definition inventory.c:1476
s32 remove_item(s32 itemID)
Remove first instance of itemID found in player inventory.
Definition inventory.c:198
void status_bar_start_blinking_starpoints(void)
Definition inventory.c:1628
BSS b16 D_8010CD10
Definition inventory.c:14
void status_bar_stop_blinking_fp(void)
Definition inventory.c:1566
void status_bar_draw_number(s32 iconID, s32 startX, s32 startY, s32 value, s32 numDigits)
Definition inventory.c:618
void status_bar_stop_blinking_coins(void)
Definition inventory.c:1588
HudScript HES_StatusFP_fr
s32 get_stored_empty(void)
Definition inventory.c:453
s32 get_stored_count(void)
Definition inventory.c:440
HudScript HES_StatusTimes
void status_bar_start_blinking_sp(void)
Definition inventory.c:1598
void set_max_star_power(s8 newMax)
Definition inventory.c:2129
BSS b16 D_8010CD12
Definition inventory.c:15
void subtract_hp(s32 amt)
Definition inventory.c:2192
void status_bar_always_show_off(void)
Definition inventory.c:1522
s32 get_consumables_count(void)
Definition inventory.c:423
void clear_player_data(void)
Definition inventory.c:49
void hide_coin_counter_immediately(void)
Definition inventory.c:1393
s32 status_bar_is_ignoring_changes(void)
Definition inventory.c:1512
HudScript HES_StatusHP_fr
void status_bar_draw_stat(s32 id, s32 startX, s32 startY, s32 currentValue, s32 maxValue)
Definition inventory.c:656
StatusBar gStatusBar
Definition inventory.c:17
HudScript HES_StatusFP_es
void enforce_hpfp_limits(void)
Definition inventory.c:457
s32 is_status_bar_visible(void)
Definition inventory.c:1526
s32 add_coins(s32 amt)
Definition inventory.c:2065
void open_status_bar_slowly(void)
Definition inventory.c:1420
void initialize_status_bar(void)
Definition inventory.c:477
void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY)
Definition inventory.c:1290
b32 has_item(s32 itemID)
Check whether player has itemID in their inventory.
Definition inventory.c:337
HudScript HES_StatusHeart
HudScript HES_StatusSPEmptyIncrement
HudScript HES_StatusFlower
void status_bar_start_blinking_coins(void)
Definition inventory.c:1575
s32 is_ability_active(s32 ability)
Definition inventory.c:1725
#define FULLY_EXTENDED_Y
Definition inventory.c:6
void status_bar_respond_to_changes(void)
Definition inventory.c:1508
void status_bar_always_show_on(void)
Definition inventory.c:1518
void increment_status_bar_disabled(void)
Definition inventory.c:1654
void draw_status_ui(void)
Definition inventory.c:1411
void status_bar_start_blinking_sp_bars(s32 numBarsToBlink)
Definition inventory.c:1618
void add_star_power(s32 amt)
Definition inventory.c:2134
s32 add_item(s32 itemID)
Add itemID to player inventory and return inventory slot in which it was placed.
Definition inventory.c:146
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
@ GB_StoryProgress
ApiStatus ShowCoinCounter(Evt *script, b32 isInitialCall)
#define SCREEN_WIDTH
Definition macros.h:105
#define BSS
Definition macros.h:7
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define SCREEN_HEIGHT
Definition macros.h:106
#define SP_PER_SEG
Definition macros.h:103
#define MAX_STAR_PIECES
Definition macros.h:100
#define SP_PER_BAR
Definition macros.h:102
#define UNK_TYPE
Definition types.h:6
ItemData gItemTable[]
#define gCurrentLanguage
Definition variables.h:115
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Gfx * gMainGfxPos
Definition cam_main.c:15
PlayerData gPlayerData
Definition 77480.c:40
PlayerStatus gPlayerStatus
Definition 77480.c:39