Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
inventory.c File Reference

Go to the source code of this file.

Macros

#define FULLY_EXTENDED_Y   18
 
#define FULLY_RETRACTED_Y   -100
 

Enumerations

enum  BlinkModes { BLINK_OFF = 0 , BLINK_ON = 1 }
 
enum  ShimmerStates { STATUS_SHIMMER_OFF = 0 , STATUS_SHIMMER_BEGIN = 1 , STATUS_SHIMMER_ON = 2 }
 

Functions

void status_bar_start_blinking_coins (void)
 
void status_bar_stop_blinking_coins (void)
 
void clear_player_data (void)
 
s32 add_item (s32 itemID)
 Add itemID to player inventory and return inventory slot in which it was placed.
 
s32 remove_item (s32 itemID)
 Remove first instance of itemID found in player inventory.
 
s32 find_item (s32 itemID)
 Search player inventory for itemID and return first matching array index.
 
s32 count_item (s32 itemID)
 Search player inventory for itemID and count the number matches.
 
b32 has_item (s32 itemID)
 Check whether player has itemID in their inventory.
 
s32 store_item (s32 itemID)
 Add itemID to player storage and return slot in which it was placed.
 
b32 is_badge_equipped (s32 itemID)
 
void sort_consumables (void)
 Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
 
s32 get_consumables_count (void)
 
s32 get_consumables_empty (void)
 
s32 get_stored_count (void)
 
s32 get_stored_empty (void)
 
void enforce_hpfp_limits (void)
 
void initialize_status_bar (void)
 
void status_bar_draw_number (s32 iconID, s32 startX, s32 startY, s32 value, s32 numDigits)
 
void status_bar_draw_stat (s32 id, s32 startX, s32 startY, s32 currentValue, s32 maxValue)
 
void update_status_bar (void)
 
void coin_counter_draw_content (UNK_TYPE arg0, s32 posX, s32 posY)
 
void update_coin_counter (void)
 
void show_coin_counter (void)
 
void hide_coin_counter (void)
 
void hide_coin_counter_immediately (void)
 
void draw_status_ui (void)
 
void open_status_bar_slowly (void)
 
void open_status_bar_quickly (void)
 
void close_status_bar (void)
 
void setup_status_bar_for_world (void)
 
void setup_status_bar_for_battle (void)
 
void enable_status_bar_input (void)
 
void disable_status_bar_input (void)
 
b32 can_control_status_bar (void)
 
void status_bar_ignore_changes (void)
 
void status_bar_show_and_ignore_changes (void)
 
void status_bar_respond_to_changes (void)
 
s32 status_bar_is_ignoring_changes (void)
 
void status_bar_always_show_on (void)
 
void status_bar_always_show_off (void)
 
s32 is_status_bar_visible (void)
 
void status_bar_start_blinking_hp (void)
 
void status_bar_stop_blinking_hp (void)
 
void status_bar_start_blinking_fp (void)
 
void status_bar_stop_blinking_fp (void)
 
void status_bar_start_blinking_sp (void)
 
void status_bar_stop_blinking_sp (void)
 
void status_bar_start_blinking_sp_bars (s32 numBarsToBlink)
 
void status_bar_start_blinking_starpoints (void)
 
void status_bar_stop_blinking_starpoints (void)
 
void decrement_status_bar_disabled (void)
 
void increment_status_bar_disabled (void)
 
void sync_status_bar (void)
 
void reset_status_bar (void)
 
s32 is_ability_active (s32 ability)
 
s32 is_partner_ability_active (s32 ability)
 
s32 add_coins (s32 amt)
 
s32 add_star_points (s32 amt)
 
s32 add_star_pieces (s32 amt)
 
void increment_max_star_power (void)
 
void set_max_star_power (s8 newMax)
 
void add_star_power (s32 amt)
 
s32 recover_fp (s32 amt)
 Recover player FP.
 
s32 recover_hp (s32 amt)
 Recover player HP.
 
void subtract_hp (s32 amt)
 
s8 has_full_hp (void)
 
s8 has_full_fp (void)
 

Variables

BSS b16 ShowingCoinCounter
 
BSS b16 HidingCoinCounter
 
StatusBar gStatusBar
 
HudScriptTimesHudScript
 
HudScriptSPIncrementHudScripts []
 
HudScriptSPStarHudScripts []
 
s32 StatusBarSPIncrementOffsets []
 
HudScriptDigitHudScripts [10]
 
HudScript HES_StatusCoinSparkle
 
HudScript HES_StatusHP
 
HudScript HES_StatusHP_de
 
HudScript HES_StatusHP_fr
 
HudScript HES_StatusHP_es
 
HudScript HES_StatusHeart
 
HudScript HES_StatusFP
 
HudScript HES_StatusFP_de
 
HudScript HES_StatusFP_fr
 
HudScript HES_StatusFP_es
 
HudScript HES_StatusFlower
 
HudScript HES_StatusStarPoint
 
HudScript HES_StatusStar1
 
HudScript HES_StatusTimes
 
HudScript HES_StatusSPShine
 
HudScript HES_StatusSPEmptyIncrement
 
HudScript HES_StatusStarEmpty
 
HudScriptSlashHudScript
 

Macro Definition Documentation

◆ FULLY_EXTENDED_Y

#define FULLY_EXTENDED_Y   18

Definition at line 5 of file inventory.c.

Referenced by status_bar_show_and_ignore_changes(), and update_status_bar().

◆ FULLY_RETRACTED_Y

#define FULLY_RETRACTED_Y   -100

Enumeration Type Documentation

◆ BlinkModes

Enumerator
BLINK_OFF 
BLINK_ON 

Definition at line 8 of file inventory.c.

8 {
9 BLINK_OFF = 0,
10 BLINK_ON = 1,
11};
@ BLINK_ON
Definition inventory.c:10
@ BLINK_OFF
Definition inventory.c:9

◆ ShimmerStates

Enumerator
STATUS_SHIMMER_OFF 
STATUS_SHIMMER_BEGIN 
STATUS_SHIMMER_ON 

Definition at line 13 of file inventory.c.

13 {
17};
@ STATUS_SHIMMER_OFF
Definition inventory.c:14
@ STATUS_SHIMMER_BEGIN
Definition inventory.c:15
@ STATUS_SHIMMER_ON
Definition inventory.c:16

Function Documentation

◆ status_bar_start_blinking_coins()

void status_bar_start_blinking_coins ( void )

Definition at line 1585 of file inventory.c.

1585 {
1587
1590 }
1591
1592 if (statusBar->coinsBlinking != BLINK_ON) {
1593 statusBar->coinsBlinking = BLINK_ON;
1594 statusBar->coinsBlinkAnimTime = 0;
1595 }
1596}
BSS s32 PopupMenu_SelectedIndex
@ CONTEXT_WORLD
Definition enums.h:3528
StatusBar gStatusBar
Definition inventory.c:22
GameStatus * gGameStatusPtr
Definition main_loop.c:31

Referenced by update_status_bar().

◆ status_bar_stop_blinking_coins()

void status_bar_stop_blinking_coins ( void )

Definition at line 1598 of file inventory.c.

1598 {
1600
1601 if (statusBar->coinsBlinking != BLINK_OFF) {
1603 statusBar->coinsBlinkAnimTime = 0;
1604 statusBar->coinsBlinkTimeLeft = 0;
1605 }
1606}

Referenced by update_status_bar().

◆ clear_player_data()

void clear_player_data ( void )

Definition at line 54 of file inventory.c.

54 {
56 s32 i;
57
60
61 playerData->curHP = 10;
62 playerData->curMaxHP = 10;
63 playerData->hardMaxHP = 10;
64 playerData->curFP = 5;
65 playerData->curMaxFP = 5;
66 playerData->hardMaxFP = 5;
67 playerData->maxBP = 3;
68 playerData->level = 1;
69 playerData->bootsLevel = 0;
70 playerData->hammerLevel = -1;
71 playerData->hasActionCommands = FALSE;
72 playerData->coins = 0;
73 playerData->starPieces = 0;
74 playerData->starPoints = 0;
75 playerData->unused_011 = 0;
76 playerData->unused_288 = 0;
77
78 playerData->merleeSpellType = MERLEE_SPELL_NONE;
79 playerData->merleeCastsLeft = 0;
80 playerData->merleeTurnCount = -1;
81
82 playerData->maxStarPower = 0;
83 playerData->starPower = 0;
84 playerData->starBeamLevel = 0;
85
86 playerData->curPartner = PARTNER_NONE;
87
88 for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) {
89 playerData->partners[i].enabled = FALSE;
90 playerData->partners[i].level = PARTNER_RANK_NORMAL;
91 playerData->partners[i].unk_02[0] = 0;
92 playerData->partners[i].unk_02[1] = 0;
93 playerData->partners[i].unk_02[2] = 0;
94 }
95
96 for (i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
97 playerData->keyItems[i] = ITEM_NONE;
98 }
99
100 for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) {
101 playerData->badges[i] = ITEM_NONE;
102 }
103
104 for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
105 playerData->invItems[i] = ITEM_NONE;
106 }
107
108 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
109 playerData->equippedBadges[i] = ITEM_NONE;
110 }
111
112 for (i = 0; i < ARRAY_COUNT(playerData->storedItems); i++) {
113 playerData->storedItems[i] = ITEM_NONE;
114 }
115
116 playerData->actionCommandAttempts = 0;
117 playerData->actionCommandSuccesses = 0;
118 playerData->hitsTaken = 0;
119 playerData->hitsBlocked = 0;
120 playerData->playerFirstStrikes = 0;
121 playerData->enemyFirstStrikes = 0;
122 playerData->powerBounces = 0;
123 playerData->battlesCount = 0;
124 playerData->battlesWon = 0;
125 playerData->fleeAttempts = 0;
126 playerData->battlesFled = 0;
127 playerData->trainingsDone = 0;
128 playerData->walkingStepsTaken = 0;
129 playerData->runningStepsTaken = 0;
130 playerData->idleFrameCounter = 0;
131 playerData->totalCoinsEarned = 0;
132 playerData->frameCounter = 0;
133 playerData->quizzesAnswered = 0;
134 playerData->quizzesCorrect = 0;
135
136 for (i = 0; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) {
137 playerData->partnerUnlockedTime[i] = 0;
138 playerData->partnerUsedTime[i] = 0;
139 }
140
141 playerData->droTreeHintTime = 0;
142 playerData->starPiecesCollected = 0;
143 playerData->jumpGamePlays = 0;
144 playerData->jumpGameTotal = 0;
145 playerData->jumpGameRecord = 0;
146 playerData->smashGamePlays = 0;
147 playerData->smashGameTotal = 0;
148 playerData->smashGameRecord = 0;
149}
@ MERLEE_SPELL_NONE
Definition enums.h:1910
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_NONE
Definition enums.h:2885
BSS b16 HidingCoinCounter
Definition inventory.c:20
BSS b16 ShowingCoinCounter
Definition inventory.c:19
#define ARRAY_COUNT(arr)
Definition macros.h:40
PlayerData gPlayerData
Definition 77480.c:39

Referenced by filemenu_yesno_handle_input(), load_demo_battle(), load_engine_data(), state_init_title_screen(), state_step_demo(), state_step_intro(), and state_step_startup().

◆ add_item()

s32 add_item ( s32 itemID)

Add itemID to player inventory and return inventory slot in which it was placed.

Returns
the index of the new item in the player's inventory, or -1 if there was no room

Definition at line 151 of file inventory.c.

151 {
152 s32 idx;
153
154 // handle key items
155 if (item_is_key(itemID)) {
156 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
158 break;
159 }
160 }
161
163 return -1;
164 }
165
166 gPlayerData.keyItems[idx] = itemID;
167 return idx;
168 }
169
170 // handle badges
171 if (item_is_badge(itemID)) {
172 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
174 break;
175 }
176 }
177
179 return -1;
180 }
181
182 gPlayerData.badges[idx] = itemID;
183 return idx;
184 }
185
186 // handle consumables
188
189 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
191 break;
192 }
193 }
194
196 return -1;
197 }
198
199 gPlayerData.invItems[idx] = itemID;
200 return idx;
201}
s16 badges[128]
s16 keyItems[32]
s16 invItems[10]
void sort_consumables(void)
Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
Definition inventory.c:409

Referenced by update_item_entity_pickup().

◆ remove_item()

s32 remove_item ( s32 itemID)

Remove first instance of itemID found in player inventory.

Returns
the index of the removed item in the player's inventory, or -1 none was found

Definition at line 203 of file inventory.c.

203 {
204 s32 idx;
205
206 // handle key items
207 if (item_is_key(itemID)) {
208 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
209 if (gPlayerData.keyItems[idx] == itemID) {
210 break;
211 }
212 }
213
215 return -1;
216 }
217
219 return idx;
220 }
221
222 // handle badges
223 if (item_is_badge(itemID)) {
224 // unequip
226 if (gPlayerData.equippedBadges[idx] == itemID) {
228 }
229 }
230
231 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
232 if (gPlayerData.badges[idx] == itemID) {
233 break;
234 }
235 }
236
238 return -1;
239 }
240
242 return idx;
243 }
244
245 // handle consumables
246 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
247 if (gPlayerData.invItems[idx] == itemID) {
248 break;
249 }
250 }
251
253 return -1;
254 }
255
258 return idx;
259}
s16 equippedBadges[64]

◆ find_item()

s32 find_item ( s32 itemID)

Search player inventory for itemID and return first matching array index.

Returns
the index of the given item in the player's inventory, or -1 if not found

Definition at line 263 of file inventory.c.

263 {
264 s32 idx;
265
266 // handle key items
267 if (item_is_key(itemID)) {
268 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
269 if (gPlayerData.keyItems[idx] == itemID) {
270 break;
271 }
272 }
273
275 return -1;
276 }
277 return idx;
278 }
279
280 // handle badges
281 if (item_is_badge(itemID)) {
282 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
283 if (gPlayerData.badges[idx] == itemID) {
284 break;
285 }
286 }
287
289 return -1;
290 }
291 return idx;
292 }
293
294 // handle consumables
295 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
296 if (gPlayerData.invItems[idx] == itemID) {
297 break;
298 }
299 }
300
302 return -1;
303 }
304 return idx;
305}

Referenced by btl_state_update_defeat().

◆ count_item()

s32 count_item ( s32 itemID)

Search player inventory for itemID and count the number matches.

Returns
the number of items matching itemID

Definition at line 309 of file inventory.c.

309 {
310 s32 idx;
311 s32 sum = 0;
312
313 // handle key items
314 if (item_is_key(itemID)) {
315 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
316 if (gPlayerData.keyItems[idx] == itemID) {
317 sum++;
318 }
319 }
320 return sum;
321 }
322
323 // handle badges
324 if (item_is_badge(itemID)) {
325 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
326 if (gPlayerData.badges[idx] == itemID) {
327 sum++;
328 }
329 }
330 return sum;
331 }
332
333 // handle consumables
334 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
335 if (gPlayerData.invItems[idx] == itemID) {
336 sum++;
337 }
338 }
339 return sum;
340}

◆ has_item()

b32 has_item ( s32 itemID)

Check whether player has itemID in their inventory.

Returns
boolean 'does player have item?'

Definition at line 342 of file inventory.c.

342 {
343 s32 idx;
344
345 // handle key items
346 if (item_is_key(itemID)) {
347 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.keyItems); idx++) {
348 if (gPlayerData.keyItems[idx] == itemID) {
349 return TRUE;
350 }
351 }
352 return FALSE;
353 }
354
355 // handle badges
356 if (item_is_badge(itemID)) {
357 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.badges); idx++) {
358 if (gPlayerData.badges[idx] == itemID) {
359 return TRUE;
360 }
361 }
362 return FALSE;
363 }
364
365 // handle consumables
366 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
367 if (gPlayerData.invItems[idx] == itemID) {
368 return TRUE;
369 }
370 }
371 return FALSE;
372}

◆ store_item()

s32 store_item ( s32 itemID)

Add itemID to player storage and return slot in which it was placed.

Returns
the index of the new item in player storage, or -1 if there was no room

Definition at line 374 of file inventory.c.

374 {
375 s32 idx;
376
377 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.storedItems); idx++) {
379 break;
380 }
381 }
382
384 return -1;
385 } else {
386 gPlayerData.storedItems[idx] = itemID;
387 }
388
389 return idx;
390}
s16 storedItems[32]

◆ is_badge_equipped()

b32 is_badge_equipped ( s32 itemID)
Returns
whether the player has itemID as an equipped badge

Definition at line 392 of file inventory.c.

392 {
393 s32 idx;
394
395 if (!item_is_badge(itemID)) {
396 return FALSE;
397 }
398
400 if (gPlayerData.equippedBadges[idx] == itemID) {
401 return TRUE;
402 }
403 }
404
405 return FALSE;
406}

◆ sort_consumables()

void sort_consumables ( void )

Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.

Definition at line 409 of file inventory.c.

409 {
410 s32 i, j;
411
412 for (i = ARRAY_COUNT(gPlayerData.invItems) - 2; i >= 0; i--) {
413 // leave ITEM_NONE at the end of the list alone
414 if (gPlayerData.invItems[i] == ITEM_NONE) {
415 continue;
416 }
417 // swap any other ITEM_NONE to the end of the list
418 for (j = ARRAY_COUNT(gPlayerData.invItems) - 1; i < j; j--) {
422 break;
423 }
424 }
425 }
426}

Referenced by add_item(), remove_consumable(), remove_item(), and update_item_entity_pickup().

◆ get_consumables_count()

s32 get_consumables_count ( void )
Returns
the number of consumables in player inventory

Definition at line 428 of file inventory.c.

428 {
429 s32 idx;
430 s32 sum = 0;
431
432 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.invItems); idx++) {
434 sum++;
435 }
436 }
437
438 return sum;
439}

Referenced by get_consumables_empty().

◆ get_consumables_empty()

s32 get_consumables_empty ( void )
Returns
the available room for consumables in player inventory

Definition at line 441 of file inventory.c.

441 {
443}
s32 get_consumables_count(void)
Definition inventory.c:428

◆ get_stored_count()

s32 get_stored_count ( void )
Returns
the number of consumables in player storage

Definition at line 445 of file inventory.c.

445 {
446 s32 idx;
447 s32 sum = 0;
448
449 for (idx = 0; idx < ARRAY_COUNT(gPlayerData.storedItems); idx++) {
451 sum++;
452 }
453 }
454
455 return sum;
456}

Referenced by get_stored_empty().

◆ get_stored_empty()

s32 get_stored_empty ( void )
Returns
the available room in player storage

Definition at line 458 of file inventory.c.

458 {
460}
s32 get_stored_count(void)
Definition inventory.c:445

◆ enforce_hpfp_limits()

void enforce_hpfp_limits ( void )

Definition at line 462 of file inventory.c.

462 {
464
466 if (playerData->curMaxHP > 75) {
467 playerData->curMaxHP = 75;
468 }
469 if (playerData->curHP > playerData->curMaxHP) {
470 playerData->curHP = playerData->curMaxHP;
471 }
472
473 playerData->curMaxFP = playerData->hardMaxFP + (is_ability_active(ABILITY_FP_PLUS) * 5);
474 if (playerData->curMaxFP > 75) {
475 playerData->curMaxFP = 75;
476 }
477 if (playerData->curFP > playerData->curMaxFP) {
478 playerData->curFP = playerData->curMaxFP;
479 }
480}
@ ABILITY_FP_PLUS
Definition enums.h:448
@ ABILITY_HP_PLUS
Definition enums.h:440
s32 is_ability_active(s32 ability)
Definition inventory.c:1735

Referenced by pause_badges_handle_input(), and pause_handle_input().

◆ initialize_status_bar()

void initialize_status_bar ( void )

Definition at line 482 of file inventory.c.

482 {
486
487 statusBar->drawPosX = 12;
490 statusBar->drawPosY = FULLY_RETRACTED_Y;
491 statusBar->hidden = FALSE;
492 statusBar->showTimer = 210;
493 statusBar->unk_3B = FALSE;
494 statusBar->ignoreChanges = FALSE;
495 statusBar->openInputDisabled = FALSE;
496 statusBar->alwaysShown = FALSE;
497 statusBar->hpBlinking = BLINK_OFF;
498 statusBar->hpBlinkAnimTime = 0;
499 statusBar->hpBlinkTimeLeft = 0;
500 statusBar->fpBlinking = BLINK_OFF;
501 statusBar->fpBlinkAnimTime = 0;
502 statusBar->fpBlinkTimeLeft = 0;
503 statusBar->starPowerBlinking = BLINK_OFF;
504 statusBar->starPowerBlinkCounter = 0;
505 statusBar->coinsBlinking = BLINK_OFF;
506 statusBar->coinsBlinkAnimTime = 0;
507 statusBar->coinsBlinkTimeLeft = 0;
508 statusBar->disabled = 0;
509 statusBar->starpointsBlinking = BLINK_OFF;
510 statusBar->displayHP = playerData->curHP;
511 statusBar->displayFP = playerData->curFP;
512 statusBar->displayCoins = playerData->coins;
513 statusBar->displayStarpoints = playerData->starPoints;
514 statusBar->displayStarPower = playerData->starPower;
515 statusBar->starpointsBlinkAnimTime = 0;
516 statusBar->prevIgnoreChanges = -1;
517 statusBar->unk_3C = FALSE;
518 statusBar->shimmerState = STATUS_SHIMMER_OFF;
519 statusBar->shimmerTime = 0;
520 statusBar->shimmerLimit = 0;
521 statusBar->powBarsToBlink = 0;
522 statusBar->coinCounterHideDelay = 0;
523 statusBar->coinCountDisposeTime = 0;
524 statusBar->iconIndex12 = -1;
525
527
528#if VERSION_PAL
529 switch (gCurrentLanguage) {
530 case LANGUAGE_EN:
531 hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP);
532 break;
533 case LANGUAGE_DE:
534 hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_de);
535 break;
536 case LANGUAGE_FR:
537 hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_fr);
538 break;
539 case LANGUAGE_ES:
540 hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_es);
541 break;
542 }
543
546#else
547 statusBar->hpIconHIDs[0] = hid = hud_element_create(&HES_StatusHP);
550#endif
551
552 statusBar->hpIconHIDs[1] = hid = hud_element_create(&HES_StatusHeart);
555
556#if VERSION_PAL
557 switch (gCurrentLanguage) {
558 case LANGUAGE_EN:
559 hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP);
560 break;
561 case LANGUAGE_DE:
562 hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_de);
563 break;
564 case LANGUAGE_FR:
565 hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_fr);
566 break;
567 case LANGUAGE_ES:
568 hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_es);
569 break;
570 }
571
574#else
575 statusBar->fpIconHIDs[0] = hid = hud_element_create(&HES_StatusFP);
578#endif
579
583
587
591
595
599
603
607
611
615
619
621}
s32 HudElemID
@ LANGUAGE_DE
Definition enums.h:6400
@ LANGUAGE_ES
Definition enums.h:6402
@ LANGUAGE_EN
Definition enums.h:6399
@ LANGUAGE_FR
Definition enums.h:6401
void star_power_shimmer_init(void)
HudScript HES_StatusCoin
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.
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:72
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:78
@ HUD_ELEMENT_FLAG_FILTER_TEX
Definition hud_element.h:86
#define FULLY_RETRACTED_Y
Definition inventory.c:6
HudScript HES_StatusHP_de
HudScript HES_StatusHP
HudScript HES_StatusFP_de
HudScript HES_StatusStar1
HudScript HES_StatusFP
HudScript HES_StatusSPShine
void close_status_bar(void)
Definition inventory.c:1450
HudScript HES_StatusStarPoint
HudScript HES_StatusHP_es
HudScript HES_StatusCoinSparkle
HudScript HES_StatusFP_fr
HudScript HES_StatusTimes
HudScript HES_StatusHP_fr
HudScript HES_StatusFP_es
HudScript HES_StatusHeart
HudScript HES_StatusFlower
#define gCurrentLanguage
Definition variables.h:119

Referenced by load_demo_battle(), and load_map_by_IDs().

◆ status_bar_draw_number()

void status_bar_draw_number ( s32 iconID,
s32 startX,
s32 startY,
s32 value,
s32 numDigits )

Definition at line 623 of file inventory.c.

623 {
624 s8 digits[4];
625 s32 drawX, drawY;
627 s32 digit;
628 s32 i;
629
631 drawX = startX + 8;
632 drawY = startY + 8;
636
637 // Write each digit of the input number into the digits array
638 for (i = 0; i < numDigits; i++) {
639 digit = value % 10;
640 digits[(numDigits - i) - 1] = digit;
641 value /= 10;
642 }
643
644 drawX += 13;
646
647 for (i = 0; i < numDigits; i++, drawX += 8) {
648 digit = digits[i];
649
650 // Once we have encountered our first non-zero digit, we need to keep drawing the remaining digits
651 if (digit != 0 || keepDrawing || (i == numDigits - 1)) {
657 }
658 }
659}
s32 b32
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_draw_next(s32 id)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
HudScript * TimesHudScript
Definition partners.c:146
HudScript * DigitHudScripts[10]
Definition partners.c:142

Referenced by update_status_bar().

◆ status_bar_draw_stat()

void status_bar_draw_stat ( s32 id,
s32 startX,
s32 startY,
s32 currentValue,
s32 maxValue )

Definition at line 661 of file inventory.c.

661 {
662 s8 digits[4];
664 s32 digit;
665 s32 numDigits = 2;
666 s32 drawX;
667 s32 drawY;
668 s32 i = 0;
669 s32 baseX = startX + 8;
670 s32 baseY = startY + 8;
671
676
677 for (i = 0; i < numDigits; i++) {
678 s32 num = currentValue % 10;
679 digits[numDigits - i - 1] = num;
680 currentValue /= 10;
681 }
682
683 drawX = baseX;
684 drawY = baseY;
686 for (i = 0; i < numDigits; i++, drawX += 8) {
687 digit = digits[i];
688 if (digit != 0 || keepDrawing || i == numDigits - 1) {
694 }
695 }
696
697 for (i = 0; i < numDigits; i++) {
698 digits[numDigits - i - 1] = maxValue % 10;
699 maxValue /= 10;
700 }
701
702 drawX = baseX + 26;
703 drawY = baseY;
705 for (i = 0; i < numDigits; i++, drawX += 8) {
706 digit = digits[i];
707 if (digit != 0 || keepDrawing || i == numDigits - 1) {
713 }
714 }
715}
HudScript * SlashHudScript
Definition partners.c:147

Referenced by update_status_bar().

◆ update_status_bar()

void update_status_bar ( void )

Definition at line 717 of file inventory.c.

717 {
721 s32 sp50;
723 s32 i;
724 s32 x;
725 s32 y;
726 s32 showStat;
727 s32 id;
728 s32 limit;
729 s32 s7;
730 s32 s1;
731 s32 spBars;
732 s32 maxStarPower;
733
738 ) {
739 return;
740 }
741
742 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->coins != statusBar->displayCoins) {
744 }
745
746 // update coin counter (+1 coin per frame for each 5-coin delta)
747 i = playerData->coins - statusBar->displayCoins;
748 if (i < 0) {
749 i = (i - 4) / 5;
750 } else {
751 i = (i + 4) / 5;
752 }
753 statusBar->displayCoins += i;
754
755 // show the status bar if HP has changed
756 if (statusBar->displayHP != playerData->curHP && !statusBar->ignoreChanges) {
757 if (statusBar->hidden) {
758 statusBar->showTimer = 70;
759 statusBar->hidden = FALSE;
760 statusBar->unk_3B = FALSE;
761 } else {
762 statusBar->showTimer = 70;
763 }
764 }
765
766 // show the status bar if FP has changed
767 if (statusBar->displayFP != playerData->curFP && !statusBar->ignoreChanges) {
768 if (statusBar->hidden) {
769 statusBar->showTimer = 70;
770 statusBar->hidden = FALSE;
771 statusBar->unk_3B = FALSE;
772 } else {
773 statusBar->showTimer = 70;
774 }
775 }
776
777 // show the status bar if star power has changed
778 if (statusBar->displayStarPower != playerData->starPower && !statusBar->ignoreChanges) {
779 if (statusBar->hidden) {
780 statusBar->showTimer = 70;
781 statusBar->hidden = FALSE;
782 statusBar->unk_3B = FALSE;
783 } else {
784 statusBar->showTimer = 70;
785 }
786 }
787
788 // sync displayed HP toward true HP
789 if (statusBar->displayHP != playerData->curHP) {
790 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curHP < statusBar->displayHP) {
792 }
793 if (statusBar->displayHP < playerData->curHP) {
794 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
795 if (gGameStatusPtr->frameCounter % 4 == 0) {
796 statusBar->displayHP++;
798 }
799 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
800 statusBar->displayHP++;
801 }
802 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
803 statusBar->displayHP--;
804 }
805 }
806
807 // sync displayed FP toward true FP
808 if (statusBar->displayFP != playerData->curFP) {
809 if (gGameStatusPtr->context == CONTEXT_WORLD && playerData->curFP < statusBar->displayFP) {
811 }
812 if (statusBar->displayFP < playerData->curFP) {
813 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
814 if (gGameStatusPtr->frameCounter % 4 == 0) {
815 statusBar->displayFP++;
817 }
818 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
819 statusBar->displayFP++;
820 }
821 } else if (gGameStatusPtr->frameCounter % 4 == 0) {
822 statusBar->displayFP--;
823 }
824 }
825
826 // sync displayed star power toward true star power
827 if (statusBar->displayStarPower != playerData->starPower) {
828 if (statusBar->displayStarPower < playerData->starPower) {
829 statusBar->displayStarPower += 10;
830 if (statusBar->displayStarPower > playerData->starPower) {
831 statusBar->displayStarPower = playerData->starPower;
832 }
833 } else {
834 statusBar->displayStarPower -= 10;
835 if (statusBar->displayStarPower < playerData->starPower) {
836 statusBar->displayStarPower = playerData->starPower;
837 }
838 }
839 }
840
841 if (statusBar->disabled) {
842 return;
843 }
844
845 if (statusBar->alwaysShown && statusBar->hidden && playerStatus->inputDisabledCount == 0) {
846 statusBar->showTimer = 42;
847 statusBar->hidden = FALSE;
848 statusBar->unk_3B = FALSE;
849 }
850
851 switch (statusBar->hidden) {
852 case FALSE:
853 statusBar->drawPosY += 10;
854 if (statusBar->drawPosY >= FULLY_EXTENDED_Y) {
855 statusBar->drawPosY = FULLY_EXTENDED_Y;
856 if (statusBar->unk_3C && statusBar->unk_3B && playerStatus->actionState != ACTION_STATE_IDLE) {
857 statusBar->showTimer = 0;
858 }
859 if (statusBar->showTimer != 0) {
860 statusBar->showTimer--;
861 } else {
862 if (!statusBar->ignoreChanges) {
863 if (!statusBar->unk_3B || playerStatus->actionState != ACTION_STATE_IDLE) {
865 statusBar->hidden = TRUE;
866 statusBar->showTimer = 0;
867 statusBar->unk_3C = FALSE;
868 }
869 }
870 }
871 }
872 }
873 break;
874 case TRUE:
875 statusBar->drawPosY -= 5;
876 if (statusBar->drawPosY < FULLY_RETRACTED_Y) {
877 statusBar->drawPosY = FULLY_RETRACTED_Y;
878 if (!statusBar->ignoreChanges) {
879 if (playerStatus->actionState != ACTION_STATE_IDLE) {
880 statusBar->showTimer = 0;
882 statusBar->showTimer = 0;
883 } else {
884 statusBar->showTimer++;
885 }
886
887 if (statusBar->showTimer >= 240 && gGameStatusPtr->context == CONTEXT_WORLD) {
888 statusBar->showTimer = 210;
889 statusBar->hidden = FALSE;
890 statusBar->unk_3B = TRUE;
891 statusBar->unk_3C = TRUE;
892 }
893 }
894 }
895 break;
896 }
897
899 x = statusBar->drawPosX;
900 y = statusBar->drawPosY;
901 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);
902 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);
903
904 if (statusBar->hpBlinkTimeLeft > 0) {
905 statusBar->hpBlinkTimeLeft--;
906 if (statusBar->hpBlinkTimeLeft == 0) {
908 }
909 }
910
911 showStat = TRUE;
912 if (statusBar->hpBlinking != BLINK_OFF) {
913 if (statusBar->hpBlinkAnimTime > 8) {
914 showStat = FALSE;
915 if (statusBar->hpBlinkAnimTime > 12) {
916 statusBar->hpBlinkAnimTime = 0;
917 showStat = TRUE;
918 }
919 }
920 statusBar->hpBlinkAnimTime++;
921 }
922
923 if (showStat) {
924 id = statusBar->hpIconHIDs[0];
925 x = statusBar->drawPosX + 22;
926 y = statusBar->drawPosY + 13;
929
930 id = statusBar->hpIconHIDs[1];
931 x = statusBar->drawPosX + 37;
932 y = statusBar->drawPosY + 13;
935
936 x = statusBar->drawPosX + 48;
937 y = statusBar->drawPosY + 8;
938 status_bar_draw_stat(statusBar->hpTimesHID, x, y, statusBar->displayHP, playerData->curMaxHP);
939 }
940
941 if (statusBar->fpBlinkTimeLeft > 0) {
942 statusBar->fpBlinkTimeLeft--;
943 if (statusBar->fpBlinkTimeLeft == 0) {
945 }
946 }
947
948 showStat = TRUE;
949 if (statusBar->fpBlinking != BLINK_OFF) {
950 if (statusBar->fpBlinkAnimTime > 8) {
951 showStat = FALSE;
952 if (statusBar->fpBlinkAnimTime > 12) {
953 statusBar->fpBlinkAnimTime = 0;
954 showStat = TRUE;
955 }
956 }
957 statusBar->fpBlinkAnimTime++;
958 }
959
960 if (showStat) {
961 id = statusBar->fpIconHIDs[0];
962 x = statusBar->drawPosX + 110;
963 y = statusBar->drawPosY + 13;
966
967 id = statusBar->fpIconHIDs[1];
968 x = statusBar->drawPosX + 125;
969 y = statusBar->drawPosY + 13;
972
973 x = statusBar->drawPosX + 136;
974 y = statusBar->drawPosY + 8;
975 status_bar_draw_stat(statusBar->fpTimesHID, x, y, statusBar->displayFP, playerData->curMaxFP);
976 }
977
978 if (playerData->level >= 27) {
979 playerData->starPoints = 0;
980 }
981
982 showStat = TRUE;
983 if (statusBar->starpointsBlinking != BLINK_OFF) {
984 if (statusBar->starpointsBlinkAnimTime > 8) {
985 if (statusBar->starpointsBlinkAnimTime <= 12) {
986 showStat = FALSE;
987 } else {
988 statusBar->starpointsBlinkAnimTime = 0;
989 }
990 }
991 statusBar->starpointsBlinkAnimTime++;
992 }
993
994 if (showStat) {
995 id = statusBar->spIconHID;
996 x = statusBar->drawPosX + 195;
997 y = statusBar->drawPosY + 14;
1000
1001 id = statusBar->spShineHID;
1002 x = statusBar->drawPosX + 195;
1003 y = statusBar->drawPosY + 9;
1006
1007 x = statusBar->drawPosX + 200;
1008 y = statusBar->drawPosY + 8;
1009 status_bar_draw_number(statusBar->spTimesHID, x, y, playerData->starPoints, 2);
1010 }
1011
1012 if (statusBar->coinsBlinkTimeLeft > 0) {
1013 statusBar->coinsBlinkTimeLeft--;
1014 if (statusBar->coinsBlinkTimeLeft == 0) {
1016 }
1017 }
1018
1019 showStat = TRUE;
1020 if (statusBar->coinsBlinking != BLINK_OFF) {
1021 if (statusBar->coinsBlinkAnimTime > 8) {
1022 showStat = FALSE;
1023 if (statusBar->coinsBlinkAnimTime > 12) {
1024 statusBar->coinsBlinkAnimTime = 0;
1025 showStat = TRUE;
1026 }
1027 }
1028 statusBar->coinsBlinkAnimTime++;
1029 }
1030
1031 if (showStat) {
1032 id = statusBar->coinIconHID;
1033 x = statusBar->drawPosX + 244;
1034 y = statusBar->drawPosY + 14;
1037
1038 id = statusBar->coinSparkleHID;
1039 x = statusBar->drawPosX + 244;
1040 y = statusBar->drawPosY + 14;
1043
1044 x = statusBar->drawPosX + 247;
1045 y = statusBar->drawPosY + 8;
1046 status_bar_draw_number(statusBar->coinTimesHID, x, y, statusBar->displayCoins, 3);
1047 }
1048
1049 id = statusBar->starIconHID;
1050 showStat = TRUE;
1051 if (statusBar->starPowerBlinking != BLINK_OFF) {
1052 if (statusBar->starPowerBlinkCounter > 5) {
1053 if (statusBar->starPowerBlinkCounter <= 8) {
1054 showStat = FALSE;
1055 } else {
1056 statusBar->starPowerBlinkCounter = 0;
1057 showStat = TRUE;
1058 }
1059 }
1060 statusBar->starPowerBlinkCounter++;
1061 }
1062
1063 x = statusBar->drawPosX + 20;
1064 y = statusBar->drawPosY + 28;
1065
1066 spBars = statusBar->displayStarPower / SP_PER_BAR;
1067 limit = statusBar->displayStarPower % SP_PER_BAR;
1068 limit /= 32;
1069 limit += spBars * 8;
1070 if (statusBar->shimmerState == STATUS_SHIMMER_BEGIN) {
1071 spBars = playerData->starPower / SP_PER_BAR;
1072 limit = playerData->starPower % SP_PER_BAR;
1073 limit = limit / 32;
1074 limit += spBars * 8;
1075 star_power_shimmer_start(0, x + limit * 25 / 10, y, 1.0f);
1076 statusBar->shimmerState = STATUS_SHIMMER_ON;
1077 }
1078
1080 if (statusBar->shimmerState != STATUS_SHIMMER_OFF) {
1081 if (statusBar->shimmerTime != 0) {
1082 statusBar->shimmerTime--;
1083 } else {
1084 statusBar->shimmerState = STATUS_SHIMMER_OFF;
1085 }
1086 // creates a stipple pattern repeating 5x zero, 5x one, ...
1087 if ((statusBar->shimmerTime / 5) & 1) {
1089 }
1090 maxStarPower = statusBar->shimmerLimit; // required to match
1091 // added together, these just equal shimmerLimit
1092 s7 = statusBar->shimmerLimit % 8;
1093 s7 += (statusBar->shimmerLimit / 8) * 8;
1094 } else {
1095 s7 = limit;
1096 }
1097
1098 i = 0;
1099 sp50 = 0;
1100 s1 = 0;
1101
1102 if (statusBar->starPowerBlinking != BLINK_OFF) {
1103 if (!showStat) {
1104 s32 limit = statusBar->powBarsToBlink * 8;
1105 if (sp50 < limit) {
1106 while (TRUE) {
1107 i++; s1++; if (i >= limit) { break; }
1108 i++; s1++; if (i >= limit) { break; }
1109 i++; s1++; if (i >= limit) { break; }
1110 i++; s1++; if (i >= limit) { break; }
1111 i++; s1++; if (i >= limit) { break; }
1112 i++; s1++; if (i >= limit) { break; }
1113 i++; s1++; if (i >= limit) { break; }
1114 i++;
1115 s1 = 0;
1116 sp50++;
1117 if (i >= limit) {
1118 break;
1119 }
1120 }
1121 }
1122 }
1123 }
1124
1125 while (TRUE) {
1126 if (i >= limit || i >= s7 && !showAddedBar) {
1127 break;
1128 }
1129 i++;
1130
1134
1135 s1++;
1136 if (i >= limit || i >= s7 && !showAddedBar) {
1137 break;
1138 }
1139 i++;
1141
1144 s1++;
1145 if (i >= limit || i >= s7 && !showAddedBar) {
1146 break;
1147 }
1148 i++;
1152 s1++;
1153 if (i >= limit || i >= s7 && !showAddedBar) {
1154 break;
1155 }
1156 i++;
1160 s1++;
1161 if (i >= limit || i >= s7 && !showAddedBar) {
1162 break;
1163 }
1164 i++;
1168 s1++;
1169
1170 if (i >= limit || i >= s7 && !showAddedBar) {
1171 break;
1172 }
1173 i++;
1177 s1++;
1178
1179 if (i >= limit || i >= s7 && !showAddedBar) {
1180 break;
1181 }
1182 i++;
1186 s1++;
1187
1188 if (i >= limit || i >= s7 && !showAddedBar) {
1189 break;
1190 }
1191 i++;
1193 hud_element_set_render_pos(id, x + 12 + sp50 * 20, y);
1195
1196 s1 = 0;
1197 sp50++;
1198 if (i >= limit || i >= s7 && !showAddedBar) {
1199 break;
1200 }
1201 }
1202
1203 maxStarPower = playerData->maxStarPower;
1204 limit = maxStarPower * 8;
1205 while (TRUE) {
1206 if (i >= limit) {
1207 break;
1208 }
1209 if (s1 == 0) {
1210 i++;
1214 if (i >= limit) {
1215 break;
1216 }
1217 s1 = 1;
1218 }
1219 if (s1 == 1) {
1220 i++;
1224 if (i >= limit) {
1225 break;
1226 }
1227 s1 = 2;
1228 }
1229 if (s1 == 2) {
1230 i++;
1234 if (i >= limit) {
1235 break;
1236 }
1237 s1 = 3;
1238 }
1239 if (s1 == 3) {
1240 i++;
1244 if (i >= limit) {
1245 break;
1246 }
1247 s1 = 4;
1248 }
1249 if (s1 == 4) {
1250 i++;
1254 if (i >= limit) {
1255 break;
1256 }
1257 s1 = 5;
1258 }
1259 if (s1 == 5) {
1260 i++;
1264 if (i >= limit) {
1265 break;
1266 }
1267 s1 = 6;
1268 }
1269 if (s1 == 6) {
1270 i++;
1274 if (i >= limit) {
1275 break;
1276 }
1277 s1 = 7;
1278 }
1279
1280 if (s1 == 7) {
1281 i++;
1283 hud_element_set_render_pos(id, x + 12 + sp50 * 20, y);
1285 if (i >= limit) {
1286 break;
1287 }
1288 }
1289 s1 = 0;
1290 sp50++;
1291 }
1292
1295}
#define draw_box
@ WINDOW_STYLE_5
Definition enums.h:6374
@ WINDOW_STYLE_6
Definition enums.h:6375
@ PEACH_FLAG_IS_PEACH
Definition enums.h:2488
@ STORY_EPILOGUE
Definition enums.h:234
@ PS_FLAG_NO_STATIC_COLLISION
Definition enums.h:3051
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
@ INTRO_PART_0
Definition enums.h:3551
@ SOUND_FLOWER_PICKUP
Definition enums.h:927
@ SOUND_HEART_PICKUP
Definition enums.h:924
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ DEMO_STATE_NONE
Definition enums.h:3534
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
void star_power_shimmer_update(void)
void star_power_shimmer_start(s32, f32, f32, f32)
void star_power_shimmer_draw(void)
void status_bar_start_blinking_hp(void)
Definition inventory.c:1540
void status_bar_start_blinking_fp(void)
Definition inventory.c:1563
void status_bar_stop_blinking_hp(void)
Definition inventory.c:1553
HudScript * SPStarHudScripts[]
Definition partners.c:152
HudScript HES_StatusStarEmpty
HudScript * SPIncrementHudScripts[]
Definition partners.c:148
s32 StatusBarSPIncrementOffsets[]
Definition partners.c:156
void status_bar_stop_blinking_fp(void)
Definition inventory.c:1576
void status_bar_draw_number(s32 iconID, s32 startX, s32 startY, s32 value, s32 numDigits)
Definition inventory.c:623
void status_bar_stop_blinking_coins(void)
Definition inventory.c:1598
void status_bar_draw_stat(s32 id, s32 startX, s32 startY, s32 currentValue, s32 maxValue)
Definition inventory.c:661
HudScript HES_StatusSPEmptyIncrement
void status_bar_start_blinking_coins(void)
Definition inventory.c:1585
#define FULLY_EXTENDED_Y
Definition inventory.c:5
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
@ GB_StoryProgress
#define SCREEN_WIDTH
Definition macros.h:109
#define SCREEN_HEIGHT
Definition macros.h:110
#define SP_PER_BAR
Definition macros.h:102
Gfx * gMainGfxPos
Definition cam_main.c:14
PlayerStatus gPlayerStatus
Definition 77480.c:38

Referenced by draw_status_ui().

◆ coin_counter_draw_content()

void coin_counter_draw_content ( UNK_TYPE arg0,
s32 posX,
s32 posY )

Definition at line 1297 of file inventory.c.

1297 {
1299 s32 iconIndex;
1300
1301 if ((gPlayerData.coins != statusBar->displayCoins) && ((gGameStatusPtr->frameCounter % 3) == 0)) {
1303 }
1304
1305 iconIndex = statusBar->coinCountTimesHID;
1306 hud_element_set_render_pos(iconIndex, posX + 27, posY + 11);
1308
1309 iconIndex = statusBar->coinCountIconHID;
1310 hud_element_set_render_pos(iconIndex, posX + 15, posY + 11);
1312
1314}
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
Definition enums.h:5392
@ DRAW_NUMBER_STYLE_MONOSPACE
Definition enums.h:5393
@ MSG_PAL_STANDARD
Definition enums.h:5414
@ DRAW_NUMBER_CHARSET_THIN
Definition enums.h:5400
@ SOUND_COIN_PICKUP
Definition enums.h:922
void draw_number(s32 value, s32 x, s32 y, s32 variableWidthChars, s32 palette, s32 opacity, u16 style)
Definition msg.c:2229
void hud_element_draw_clipped(s32 id)

Referenced by show_coin_counter().

◆ update_coin_counter()

void update_coin_counter ( void )

Definition at line 1316 of file inventory.c.

1316 {
1318
1319 if (statusBar->coinCountDisposeTime != 0) {
1321 if ((statusBar->coinCountDisposeTime == 0) && (statusBar->iconIndex12 > -1)) {
1322 hud_element_free(statusBar->iconIndex12);
1323 hud_element_free(statusBar->iconIndex13);
1324 statusBar->iconIndex12 = -1;
1325 }
1327 }
1328
1329 if (statusBar->coinCounterHideDelay == 0) {
1330 return;
1331 }
1332
1333 if ((statusBar->displayCoins == gPlayerData.coins) && (statusBar->coinCounterHideDelay > 30)) {
1334 statusBar->coinCounterHideDelay = 30;
1335 }
1336
1337 if ((statusBar->displayCoins == gPlayerData.coins) || (statusBar->coinCounterHideDelay <= 30)) {
1338 statusBar->coinCounterHideDelay--;
1339 if (statusBar->coinCounterHideDelay != 0) {
1340 return;
1341 }
1342
1344 statusBar->coinCountDisposeTime = 15;
1347 statusBar->iconIndex12 = statusBar->coinCountTimesHID;
1348 statusBar->iconIndex13 = statusBar->coinCountIconHID;
1349 statusBar->displayCoins = gPlayerData.coins;
1350 if (statusBar->prevIgnoreChanges > -1) {
1351 statusBar->ignoreChanges = statusBar->prevIgnoreChanges;
1352 statusBar->prevIgnoreChanges = -1;
1353 }
1354 }
1355}
s8 coinCountDisposeTime
@ WIN_CURRENCY_COUNTER
Definition enums.h:5260
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 set_window_update(s32 panelID, s32)
Definition windows.c:434
void hud_element_free(s32 id)

Referenced by draw_status_ui().

◆ show_coin_counter()

void show_coin_counter ( void )

Definition at line 1357 of file inventory.c.

1357 {
1359 HudElemID hid;
1360
1361 // if a coin counter is already visible, dispose of previous counter and reset state
1364 if (statusBar->iconIndex12 > -1) {
1365 hud_element_free(statusBar->coinCountTimesHID);
1366 hud_element_free(statusBar->coinCountIconHID);
1367 statusBar->iconIndex12 = -1;
1368 }
1369 statusBar->coinCounterHideDelay = 0;
1370 statusBar->coinCountDisposeTime = 0;
1373 }
1374
1375 if (statusBar->coinCounterHideDelay == 0) {
1378 statusBar->coinCountTimesHID = hid = hud_element_create(&HES_MenuTimes);
1380 hud_element_set_tint(hid, 255, 255, 255);
1381 statusBar->coinCountIconHID = hid = hud_element_create(&HES_StatusCoin);
1383 hud_element_set_tint(hid, 255, 255, 255);
1384 statusBar->coinCounterHideDelay = 0;
1385
1386 if (statusBar->prevIgnoreChanges < 0) {
1387 statusBar->prevIgnoreChanges = statusBar->ignoreChanges;
1388 }
1389
1390 statusBar->ignoreChanges = TRUE;
1392 }
1393}
@ WINDOW_PRIORITY_21
Definition enums.h:3187
@ WINDOW_UPDATE_HIDE
Definition enums.h:5311
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 set_window_properties(s32 panelID, s32 posX, s32 posY, s32 width, s32 height, u8, void *drawContents, void *drawContentsArg, s8 parent)
Definition windows.c:373
HudScript HES_MenuTimes
void hud_element_set_tint(s32 id, s32 r, s32 g, s32 b)
void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY)
Definition inventory.c:1297

◆ hide_coin_counter()

void hide_coin_counter ( void )

Definition at line 1395 of file inventory.c.

1395 {
1397
1398 if (ShowingCoinCounter && (statusBar->coinCounterHideDelay == 0)) {
1400 }
1401}
s8 coinCounterHideDelay

◆ hide_coin_counter_immediately()

void hide_coin_counter_immediately ( void )

Definition at line 1403 of file inventory.c.

1403 {
1405
1406 if (ShowingCoinCounter && (statusBar->coinCounterHideDelay == 0)) {
1408 }
1409}

◆ draw_status_ui()

void draw_status_ui ( void )

Definition at line 1421 of file inventory.c.

1421 {
1424
1425 #if DX_DEBUG_MENU
1427 #endif
1428}
void update_coin_counter(void)
Definition inventory.c:1316
void update_status_bar(void)
Definition inventory.c:717

Referenced by btl_draw_ui(), state_drawUI_change_map(), state_drawUI_enter_world(), and state_drawUI_world().

◆ open_status_bar_slowly()

void open_status_bar_slowly ( void )

Definition at line 1430 of file inventory.c.

1430 {
1432
1433 if (statusBar->hidden) {
1434 statusBar->showTimer = 210;
1435 statusBar->hidden = FALSE;
1436 statusBar->unk_3B = TRUE;
1437 }
1438}

Referenced by action_update_hit_fire(), action_update_hit_lava(), and check_input_status_bar().

◆ open_status_bar_quickly()

void open_status_bar_quickly ( void )

Definition at line 1440 of file inventory.c.

1440 {
1442
1443 if (statusBar->hidden) {
1444 statusBar->showTimer = 105;
1445 statusBar->hidden = FALSE;
1446 statusBar->unk_3B = TRUE;
1447 }
1448}

Referenced by create_standard_popup_menu(), and shop_open_item_select_popup().

◆ close_status_bar()

void close_status_bar ( void )

Definition at line 1450 of file inventory.c.

1450 {
1452
1453 if (statusBar->hidden != TRUE) {
1455 statusBar->showTimer = 0;
1456 statusBar->unk_3B = TRUE;
1457 }
1458}

Referenced by check_conversation_trigger(), check_input_status_bar(), destroy_popup_menu(), initialize_status_bar(), and shop_close_item_select_popup().

◆ setup_status_bar_for_world()

void setup_status_bar_for_world ( void )

Definition at line 1460 of file inventory.c.

1460 {
1462
1464 statusBar->ignoreChanges = FALSE;
1465 statusBar->showTimer = 0;
1466 statusBar->hidden = TRUE;
1467 statusBar->unk_3B = FALSE;
1468 statusBar->unk_3C = FALSE;
1469}

Referenced by update_encounters_post_battle().

◆ setup_status_bar_for_battle()

void setup_status_bar_for_battle ( void )

Definition at line 1471 of file inventory.c.

1471 {
1473
1474 statusBar->drawPosY = 0;
1475 statusBar->ignoreChanges = FALSE;
1476 statusBar->showTimer = 210;
1477 statusBar->hidden = FALSE;
1478 statusBar->unk_3B = TRUE;
1479 statusBar->unk_3C = FALSE;
1480}

Referenced by btl_state_update_normal_start().

◆ enable_status_bar_input()

void enable_status_bar_input ( void )

Definition at line 1482 of file inventory.c.

1482 {
1484}

◆ disable_status_bar_input()

void disable_status_bar_input ( void )

Definition at line 1486 of file inventory.c.

1486 {
1488}

◆ can_control_status_bar()

b32 can_control_status_bar ( void )

Definition at line 1491 of file inventory.c.

1491 {
1493 return FALSE;
1494 }
1495
1496 if (gStatusBar.alwaysShown) {
1497 return FALSE;
1498 }
1499
1501 return FALSE;
1502 }
1503
1504 return TRUE;
1505}

Referenced by check_input_status_bar().

◆ status_bar_ignore_changes()

void status_bar_ignore_changes ( void )

Definition at line 1507 of file inventory.c.

1507 {
1509}

Referenced by create_standard_popup_menu(), and shop_open_item_select_popup().

◆ status_bar_show_and_ignore_changes()

void status_bar_show_and_ignore_changes ( void )

Definition at line 1511 of file inventory.c.

1511 {
1513
1515 statusBar->drawPosY = FULLY_EXTENDED_Y;
1516}

◆ status_bar_respond_to_changes()

void status_bar_respond_to_changes ( void )

Definition at line 1518 of file inventory.c.

1518 {
1520}

Referenced by destroy_popup_menu(), shop_close_item_select_popup(), and state_step_unpause().

◆ status_bar_is_ignoring_changes()

s32 status_bar_is_ignoring_changes ( void )

Definition at line 1522 of file inventory.c.

1522 {
1524
1525 return statusBar->alwaysShown + statusBar->ignoreChanges;
1526}

Referenced by create_battle_popup_menu(), create_shop_popup_menu(), and create_standard_popup_menu().

◆ status_bar_always_show_on()

void status_bar_always_show_on ( void )

Definition at line 1528 of file inventory.c.

1528 {
1530}

Referenced by shop_open_item_select_popup().

◆ status_bar_always_show_off()

void status_bar_always_show_off ( void )

Definition at line 1532 of file inventory.c.

1532 {
1534}

Referenced by draw_shop_items(), and shop_close_item_select_popup().

◆ is_status_bar_visible()

s32 is_status_bar_visible ( void )

Definition at line 1536 of file inventory.c.

1536 {
1537 return !gStatusBar.hidden;
1538}

Referenced by check_input_status_bar().

◆ status_bar_start_blinking_hp()

void status_bar_start_blinking_hp ( void )

Definition at line 1540 of file inventory.c.

1540 {
1542
1545 }
1546
1547 if (statusBar->hpBlinking != BLINK_ON) {
1548 statusBar->hpBlinking = BLINK_ON;
1549 statusBar->hpBlinkAnimTime = 0;
1550 }
1551}

Referenced by update_status_bar().

◆ status_bar_stop_blinking_hp()

void status_bar_stop_blinking_hp ( void )

Definition at line 1553 of file inventory.c.

1553 {
1555
1556 if (statusBar->hpBlinking != BLINK_OFF) {
1558 statusBar->hpBlinkAnimTime = 0;
1559 statusBar->hpBlinkTimeLeft = 0;
1560 }
1561}

Referenced by update_status_bar().

◆ status_bar_start_blinking_fp()

void status_bar_start_blinking_fp ( void )

Definition at line 1563 of file inventory.c.

1563 {
1565
1568 }
1569
1570 if (statusBar->fpBlinking != BLINK_ON) {
1571 statusBar->fpBlinking = BLINK_ON;
1572 statusBar->fpBlinkAnimTime = 0;
1573 }
1574}

Referenced by btl_menu_moves_draw_content(), and update_status_bar().

◆ status_bar_stop_blinking_fp()

void status_bar_stop_blinking_fp ( void )

Definition at line 1576 of file inventory.c.

1576 {
1578
1579 if (statusBar->fpBlinking != BLINK_OFF) {
1581 statusBar->fpBlinkAnimTime = 0;
1582 }
1583}

Referenced by btl_menu_moves_draw_content(), btl_submenu_moves_update(), and update_status_bar().

◆ status_bar_start_blinking_sp()

void status_bar_start_blinking_sp ( void )

Definition at line 1608 of file inventory.c.

1608 {
1611
1612 statusBar->powBarsToBlink = playerData->maxStarPower;
1613 if (statusBar->starPowerBlinking != BLINK_ON) {
1614 statusBar->starPowerBlinking = BLINK_ON;
1615 statusBar->starPowerBlinkCounter = 0;
1616 }
1617}

◆ status_bar_stop_blinking_sp()

void status_bar_stop_blinking_sp ( void )

Definition at line 1619 of file inventory.c.

1619 {
1621
1622 if (statusBar->starPowerBlinking != BLINK_OFF) {
1624 statusBar->starPowerBlinkCounter = 0;
1625 }
1626}

Referenced by btl_menu_moves_draw_content(), and btl_submenu_moves_update().

◆ status_bar_start_blinking_sp_bars()

void status_bar_start_blinking_sp_bars ( s32 numBarsToBlink)

Definition at line 1628 of file inventory.c.

1628 {
1630
1632 if (statusBar->starPowerBlinking != BLINK_ON) {
1633 statusBar->starPowerBlinking = BLINK_ON;
1634 statusBar->starPowerBlinkCounter = 0;
1635 }
1636}

Referenced by btl_menu_moves_draw_content().

◆ status_bar_start_blinking_starpoints()

void status_bar_start_blinking_starpoints ( void )

Definition at line 1638 of file inventory.c.

1638 {
1640
1641 if (statusBar->starpointsBlinking != BLINK_ON) {
1643 statusBar->starpointsBlinkAnimTime = 0;
1644 }
1645}

Referenced by btl_state_update_run_away().

◆ status_bar_stop_blinking_starpoints()

void status_bar_stop_blinking_starpoints ( void )

Definition at line 1647 of file inventory.c.

1647 {
1649
1650 if (statusBar->starpointsBlinking != BLINK_OFF) {
1652 statusBar->starpointsBlinkAnimTime = 0;
1653 }
1654}

Referenced by btl_state_update_run_away().

◆ decrement_status_bar_disabled()

◆ increment_status_bar_disabled()

◆ sync_status_bar()

void sync_status_bar ( void )

Definition at line 1670 of file inventory.c.

1670 {
1673
1674 statusBar->displayHP = playerData->curHP;
1675 statusBar->displayFP = playerData->curFP;
1676 statusBar->displayStarPower = playerData->starPower;
1677 statusBar->displayCoins = playerData->coins;
1678 statusBar->displayStarpoints = playerData->starPoints;
1679}

◆ reset_status_bar()

void reset_status_bar ( void )

Definition at line 1681 of file inventory.c.

1681 {
1684 s32 i;
1685
1686 statusBar->drawPosX = 12;
1687 statusBar->drawPosY = FULLY_RETRACTED_Y;
1688 statusBar->hidden = 0;
1689 statusBar->showTimer = 210;
1690 statusBar->unk_3B = FALSE;
1691 statusBar->ignoreChanges = FALSE;
1692 statusBar->openInputDisabled = FALSE;
1693 statusBar->alwaysShown = FALSE;
1694 statusBar->hpBlinking = BLINK_OFF;
1695 statusBar->hpBlinkAnimTime = 0;
1696 statusBar->hpBlinkTimeLeft = 0;
1697 statusBar->fpBlinking = BLINK_OFF;
1698 statusBar->fpBlinkAnimTime = 0;
1699 statusBar->fpBlinkTimeLeft = 0;
1700 statusBar->coinsBlinking = BLINK_OFF;
1701 statusBar->coinsBlinkAnimTime = 0;
1702 statusBar->coinsBlinkTimeLeft = 0;
1703 statusBar->starPowerBlinking = BLINK_OFF;
1704 statusBar->starPowerBlinkCounter = 0;
1705 statusBar->disabled = 0;
1706 statusBar->starpointsBlinking = BLINK_OFF;
1707 statusBar->starpointsBlinkAnimTime = 0;
1708 statusBar->prevIgnoreChanges = -1;
1709 statusBar->displayHP = playerData->curHP;
1710 statusBar->displayFP = playerData->curFP;
1711 statusBar->displayCoins = playerData->coins;
1712 statusBar->displayStarpoints = playerData->starPoints;
1713 statusBar->displayStarPower = playerData->starPower;
1714 statusBar->unk_3C = FALSE;
1715
1716 for (i = 0; i < ARRAY_COUNT(statusBar->hpIconHIDs); i++) {
1717 copy_world_hud_element_ref_to_battle(statusBar->hpIconHIDs[i], statusBar->hpIconHIDs[i]);
1718 }
1719
1720 for (i = 0; i < ARRAY_COUNT(statusBar->fpIconHIDs); i++) {
1721 copy_world_hud_element_ref_to_battle(statusBar->fpIconHIDs[i], statusBar->fpIconHIDs[i]);
1722 }
1723
1724 copy_world_hud_element_ref_to_battle(statusBar->coinIconHID, statusBar->coinIconHID);
1725 copy_world_hud_element_ref_to_battle(statusBar->coinSparkleHID, statusBar->coinSparkleHID);
1731 copy_world_hud_element_ref_to_battle(statusBar->coinTimesHID, statusBar->coinTimesHID);
1732 copy_world_hud_element_ref_to_battle(statusBar->starIconHID, statusBar->starIconHID);
1733}
void copy_world_hud_element_ref_to_battle(s32 worldID, s32 battleID)

Referenced by state_step_battle(), and state_step_pause().

◆ is_ability_active()

s32 is_ability_active ( s32 ability)

Definition at line 1735 of file inventory.c.

1735 {
1737 s32 attackFXArray[6];
1738 s32 attackFXIndex;
1739 s32 badgeItemID;
1740 s32 badgeMoveID;
1741 s32 ret;
1742 s32 i;
1743
1744 ret = 0;
1745 attackFXIndex = 0;
1746
1747 for (i = 0; i < ARRAY_COUNT(attackFXArray); i++) {
1748 attackFXArray[i] = 0;
1749 }
1750
1752 return 0;
1753 }
1754
1755 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
1757 if (badgeItemID == ITEM_NONE)
1758 continue;
1759
1761
1762 switch (ability) {
1765 ret++;
1766 }
1767 break;
1770 ret++;
1771 }
1772 break;
1775 ret++;
1776 }
1777 break;
1778 case ABILITY_HP_PLUS:
1779 if (badgeMoveID == MOVE_HP_PLUS) {
1780 ret++;
1781 }
1782 break;
1783 case ABILITY_DOUBLE_DIP:
1785 ret++;
1786 }
1787 break;
1790 ret++;
1791 }
1792 if (playerData->hasActionCommands) {
1793 ret++;
1794 }
1795 break;
1798 ret++;
1799 }
1800 break;
1803 ret++;
1804 }
1805 break;
1806 case ABILITY_HP_DRAIN:
1807 if (badgeMoveID == MOVE_HP_DRAIN) {
1808 ret++;
1809 }
1810 break;
1813 ret++;
1814 }
1815 break;
1816 case ABILITY_SLOW_GO:
1817 if (badgeMoveID == MOVE_SLOW_GO) {
1818 ret++;
1819 }
1820 break;
1821 case ABILITY_FP_PLUS:
1822 if (badgeMoveID == MOVE_FP_PLUS) {
1823 ret++;
1824 }
1825 break;
1826 case ABILITY_ICE_POWER:
1827 if (badgeMoveID == MOVE_ICE_POWER) {
1828 ret++;
1829 }
1830 break;
1833 ret++;
1834 }
1835 break;
1836 case ABILITY_ATTACK_FX:
1839 ret = -1;
1840 }
1843 ret = -1;
1844 }
1847 ret = -1;
1848 }
1851 ret = -1;
1852 }
1855 ret = -1;
1856 }
1859 ret = -1;
1860 }
1861 break;
1864 ret++;
1865 }
1866 break;
1867 case ABILITY_CHILL_OUT:
1869 ret++;
1870 }
1871 break;
1874 ret++;
1875 }
1876 break;
1877 case ABILITY_ZAP_TAP:
1878 if (badgeMoveID == MOVE_ZAP_TAP) {
1879 ret++;
1880 }
1881 break;
1882 case ABILITY_MEGA_RUSH:
1883 if (badgeMoveID == MOVE_MEGA_RUSH) {
1884 ret++;
1885 }
1886 break;
1887 case ABILITY_BERSERKER:
1888 if (badgeMoveID == MOVE_BERSERKER) {
1889 ret++;
1890 }
1891 break;
1892 case ABILITY_RIGHT_ON:
1893 if (badgeMoveID == MOVE_RIGHT_ON) {
1894 ret++;
1895 }
1896 break;
1899 ret++;
1900 }
1901 break;
1904 ret++;
1905 }
1906 break;
1907 case ABILITY_PAY_OFF:
1908 if (badgeMoveID == MOVE_PAY_OFF) {
1909 ret++;
1910 }
1911 break;
1914 ret++;
1915 }
1916 break;
1917 case ABILITY_POWER_PLUS:
1919 ret++;
1920 }
1921 break;
1922 case ABILITY_REFUND:
1923 if (badgeMoveID == MOVE_REFUND) {
1924 ret++;
1925 }
1926 break;
1927 case ABILITY_POWER_RUSH:
1929 ret++;
1930 }
1931 break;
1934 ret++;
1935 }
1936 break;
1937 case ABILITY_LAST_STAND:
1939 ret++;
1940 }
1941 break;
1942 case ABILITY_CLOSE_CALL:
1944 ret++;
1945 }
1946 break;
1949 ret++;
1950 }
1951 break;
1952 case ABILITY_LUCKY_DAY:
1953 if (badgeMoveID == MOVE_LUCKY_DAY) {
1954 ret++;
1955 }
1956 break;
1959 ret++;
1960 }
1961 break;
1964 ret++;
1965 }
1966 break;
1969 ret++;
1970 }
1971 break;
1974 ret++;
1975 }
1976 break;
1979 ret++;
1980 }
1981 break;
1982 case ABILITY_I_SPY:
1983 if (badgeMoveID == MOVE_I_SPY) {
1984 ret++;
1985 }
1986 break;
1989 ret++;
1990 }
1991 break;
1994 ret++;
1995 }
1996 break;
1999 ret++;
2000 }
2001 break;
2004 ret++;
2005 }
2006 break;
2009 ret++;
2010 }
2011 break;
2014 ret++;
2015 }
2016 break;
2019 ret++;
2020 }
2021 break;
2022 case ABILITY_DEEP_FOCUS:
2024 ret++;
2025 }
2026 break;
2029 ret++;
2030 }
2031 break;
2032 case ABILITY_KAIDEN:
2033 if (badgeMoveID == MOVE_KAIDEN) {
2034 ret++;
2035 }
2036 break;
2039 ret++;
2040 }
2041 break;
2044 ret++;
2045 }
2046 break;
2049 ret++;
2050 }
2051 break;
2052 case ABILITY_PEEKABOO:
2053 if (badgeMoveID == MOVE_PEEKABOO) {
2054 ret++;
2055 }
2056 break;
2059 ret++;
2060 }
2061 break;
2062 }
2063 }
2064
2065 if (ret < 0) {
2067 }
2068 return ret;
2069}
#define rand_int
@ 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_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_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
ItemData gItemTable[]

Referenced by action_command_init_status(), action_hammer_play_hit_fx(), action_update_run(), action_update_spin(), action_update_walk(), adjust_action_command_difficulty(), appendGfx_player_actor(), btl_menu_strats_draw_content(), btl_state_update_begin_player_turn(), btl_state_update_begin_turn(), btl_state_update_celebration(), btl_state_update_end_player_turn(), btl_state_update_first_strike(), btl_state_update_normal_start(), btl_state_update_partner_menu(), btl_state_update_player_move(), btl_state_update_run_away(), btl_state_update_select_target(), calc_enemy_damage_target(), calc_player_damage_enemy(), check_block_input(), check_input_spin(), enforce_hpfp_limits(), entity_HiddenPanel_set_ispy_notification(), get_coin_drop_amount(), inflict_status(), is_actor_health_bar_visible(), is_actortype_health_bar_visible(), load_player_actor(), player_team_is_ability_active(), show_first_strike_message(), spawn_drops(), update_encounters_neutral(), update_encounters_pre_battle(), and update_locomotion_state().

◆ is_partner_ability_active()

s32 is_partner_ability_active ( s32 ability)

Definition at line 2071 of file inventory.c.

2071 {
2072 return 0;
2073}

Referenced by player_team_is_ability_active().

◆ add_coins()

s32 add_coins ( s32 amt)

Definition at line 2075 of file inventory.c.

2075 {
2078
2079 playerData->coins = newCoins;
2080 if (newCoins > 999) {
2081 playerData->coins = 999;
2082 }
2083 if (playerData->coins < 0) {
2084 playerData->coins = 0;
2085 }
2086
2087 if (amt > 0) {
2088 playerData->totalCoinsEarned += amt;
2089 if (playerData->totalCoinsEarned > 99999) {
2090 playerData->totalCoinsEarned = 99999;
2091 }
2092 }
2093 return playerData->coins;
2094}

◆ add_star_points()

s32 add_star_points ( s32 amt)

Definition at line 2096 of file inventory.c.

2096 {
2099
2100 // TODO: probably a macro!
2101 playerData->starPoints = newSP;
2102 if (newSP > 100) {
2103 playerData->starPoints = 100;
2104 }
2105
2106 // TODO: probably a macro!
2107 newSP = playerData->starPoints;
2108 if (newSP < 0) {
2109 playerData->starPoints = 0;
2110 }
2111 return gPlayerData.starPoints;
2112}

◆ add_star_pieces()

s32 add_star_pieces ( s32 amt)

Definition at line 2114 of file inventory.c.

2114 {
2117
2118 newSP += amt;
2119 if (newSP > MAX_STAR_PIECES) {
2121 }
2122 if (newSP < 0) {
2123 newSP = 0;
2124 }
2125 playerData->starPieces = newSP;
2126
2127 if (amt > 0) {
2128 playerData->starPiecesCollected += amt;
2129 }
2130
2131 return playerData->starPieces;
2132}
#define MAX_STAR_PIECES
Definition macros.h:100

◆ increment_max_star_power()

void increment_max_star_power ( void )

Definition at line 2134 of file inventory.c.

◆ set_max_star_power()

void set_max_star_power ( s8 newMax)

Definition at line 2139 of file inventory.c.

◆ add_star_power()

void add_star_power ( s32 amt)

Definition at line 2144 of file inventory.c.

2144 {
2147 s32 maxPower;
2148 s32 newPower;
2149
2151 statusBar->shimmerTime = 60;
2152
2153 if (playerData->starPower < 0) {
2154 statusBar->shimmerLimit = (playerData->starPower + 31) / SP_PER_SEG;
2155 } else {
2156 statusBar->shimmerLimit = playerData->starPower / SP_PER_SEG;
2157 }
2158
2159 playerData->starPower += amt;
2160
2161 maxPower = playerData->maxStarPower * SP_PER_BAR;
2162 if (playerData->starPower > maxPower) {
2163 playerData->starPower = maxPower;
2164 }
2165
2167}
#define SP_PER_SEG
Definition macros.h:103

◆ recover_fp()

s32 recover_fp ( s32 amt)

Recover player FP.

Parameters
amtthe amount to recover, -1 for full, -2 for full and increase max by 1 (unused)
Returns
the new FP value, after recovery has been applied

Definition at line 2169 of file inventory.c.

2169 {
2170 if (amt == -2) {
2173 } else if (amt == -1) {
2175 } else {
2176 if (amt > 0) {
2178 }
2181 }
2182 }
2183 return gPlayerData.curFP;
2184}

Referenced by entity_HeartBlockContent__anim_heal().

◆ recover_hp()

s32 recover_hp ( s32 amt)

Recover player HP.

Parameters
amtthe amount to recover, -1 for full, -2 for full and increase max by 1 (unused)
Returns
the new HP value, after recovery has been applied

Definition at line 2186 of file inventory.c.

2186 {
2187 if (amt == -2) {
2190 } else if (amt == -1) {
2192 } else {
2193 if (amt > 0) {
2195 }
2198 }
2199 }
2200 return gPlayerData.curHP;
2201}

Referenced by entity_HeartBlockContent__anim_heal().

◆ subtract_hp()

void subtract_hp ( s32 amt)

Definition at line 2203 of file inventory.c.

2203 {
2205 s32 newHP = playerData->curHP;
2206
2207 if (amt > 0) {
2208 newHP -= amt;
2209 }
2210 if (amt < 0 || newHP < 1) {
2211 newHP = 1;
2212 }
2213 playerData->curHP = newHP;
2214}

Referenced by action_update_hit_fire(), action_update_hit_lava(), and func_802BC274_E2EBA4().

◆ has_full_hp()

s8 has_full_hp ( void )

Definition at line 2216 of file inventory.c.

2216 {
2218}

◆ has_full_fp()

s8 has_full_fp ( void )

Definition at line 2220 of file inventory.c.

2220 {
2222}

Variable Documentation

◆ ShowingCoinCounter

◆ HidingCoinCounter

BSS b16 HidingCoinCounter

◆ gStatusBar

◆ TimesHudScript

HudScript* TimesHudScript
extern

Definition at line 146 of file partners.c.

Referenced by status_bar_draw_number().

◆ SPIncrementHudScripts

HudScript* SPIncrementHudScripts[]
extern

Definition at line 148 of file partners.c.

148 {
151};
HudScript HES_StatusSPIncrement6
HudScript HES_StatusSPIncrement4
HudScript HES_StatusSPIncrement3
HudScript HES_StatusSPIncrement7
HudScript HES_StatusSPIncrement5
HudScript HES_StatusSPIncrement2
HudScript HES_StatusSPIncrement1

Referenced by update_status_bar().

◆ SPStarHudScripts

HudScript* SPStarHudScripts[]
extern

Definition at line 152 of file partners.c.

154};
HudScript HES_StatusStar1
HudScript HES_StatusStar2
HudScript HES_StatusStar3
HudScript HES_StatusStar7
HudScript HES_StatusStar5
HudScript HES_StatusStar6
HudScript HES_StatusStar4

Referenced by update_status_bar().

◆ StatusBarSPIncrementOffsets

s32 StatusBarSPIncrementOffsets[]
extern

Definition at line 156 of file partners.c.

156{ -1, 1, 2, 4, 5, 7, 8, 0, 0, 0 };

Referenced by update_status_bar().

◆ DigitHudScripts

HudScript* DigitHudScripts[10]
extern

Definition at line 142 of file partners.c.

142 {
145};
HudScript HES_StatusDigit6
HudScript HES_StatusDigit1
HudScript HES_StatusDigit8
HudScript HES_StatusDigit3
HudScript HES_StatusDigit5
HudScript HES_StatusDigit2
HudScript HES_StatusDigit7
HudScript HES_StatusDigit9
HudScript HES_StatusDigit0
HudScript HES_StatusDigit4

Referenced by status_bar_draw_number(), and status_bar_draw_stat().

◆ HES_StatusCoinSparkle

HudScript HES_StatusCoinSparkle
extern

Definition at line 2112 of file global_hud_scripts.c.

2112 {
2121 hs_End
2122};
HudScript HES_CoinSparkleB
HudScript HES_CoinSparkleA
HudScript HES_CoinSparkleC
HudScript HES_CoinSparkleE
HudScript HES_CoinSparkleD
#define hs_RandomBranch(args...)
#define hs_SetTileSize(size)
#define hs_SetVisible
#define hs_End
@ HUD_ELEMENT_SIZE_8x8
Definition hud_element.h:43
#define HS_PTR(sym)

Referenced by initialize_status_bar().

◆ HES_StatusHP

HudScript HES_StatusHP
extern

Definition at line 2014 of file global_hud_scripts.c.

Referenced by initialize_status_bar().

◆ HES_StatusHP_de

HudScript HES_StatusHP_de
extern

Referenced by initialize_status_bar().

◆ HES_StatusHP_fr

HudScript HES_StatusHP_fr
extern

Referenced by initialize_status_bar().

◆ HES_StatusHP_es

HudScript HES_StatusHP_es
extern

Referenced by initialize_status_bar().

◆ HES_StatusHeart

HudScript HES_StatusHeart
extern

Definition at line 2061 of file global_hud_scripts.c.

2061 {
2063 hs_Loop
2066 hs_End
2067};
#define hs_SetRGBA(time, image)
#define hs_Restart
#define hs_Loop
@ HUD_ELEMENT_SIZE_16x16
Definition hud_element.h:44

Referenced by initialize_status_bar().

◆ HES_StatusFP

HudScript HES_StatusFP
extern

Definition at line 2016 of file global_hud_scripts.c.

Referenced by initialize_status_bar().

◆ HES_StatusFP_de

HudScript HES_StatusFP_de
extern

Referenced by initialize_status_bar().

◆ HES_StatusFP_fr

HudScript HES_StatusFP_fr
extern

Referenced by initialize_status_bar().

◆ HES_StatusFP_es

HudScript HES_StatusFP_es
extern

Referenced by initialize_status_bar().

◆ HES_StatusFlower

HudScript HES_StatusFlower
extern

Definition at line 2069 of file global_hud_scripts.c.

Referenced by initialize_status_bar().

◆ HES_StatusStarPoint

◆ HES_StatusStar1

HudScript HES_StatusStar1
extern

Definition at line 2045 of file global_hud_scripts.c.

Referenced by initialize_status_bar().

◆ HES_StatusTimes

HudScript HES_StatusTimes
extern

Definition at line 1990 of file global_hud_scripts.c.

Referenced by initialize_status_bar().

◆ HES_StatusSPShine

HudScript HES_StatusSPShine
extern

Definition at line 762 of file global_hud_scripts.c.

762 {
765 hs_Loop
768 hs_End
769};
@ HUD_ELEMENT_SIZE_24x24
Definition hud_element.h:45
#define hs_UseIA8

Referenced by initialize_status_bar().

◆ HES_StatusSPEmptyIncrement

HudScript HES_StatusSPEmptyIncrement
extern

Definition at line 2043 of file global_hud_scripts.c.

Referenced by update_status_bar().

◆ HES_StatusStarEmpty

HudScript HES_StatusStarEmpty
extern

Definition at line 2059 of file global_hud_scripts.c.

Referenced by update_status_bar().

◆ SlashHudScript

HudScript* SlashHudScript
extern

Definition at line 147 of file partners.c.

Referenced by status_bar_draw_stat().