Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
status_icons.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3#include "hud_element.h"
4#include "message_ids.h"
5
6#define MAX_ICONS (64)
7
22
28
29typedef struct HudComplexStatusIcon {
30 /* 0x0 */ s8 active;
31 /* 0x1 */ s8 removing;
32 /* 0x2 */ s8 activeTask;
33 /* 0x3 */ s8 removingTask;
34 /* 0x4 */ s8 unk_04;
35 /* 0x5 */ s8 frameCounter;
38} HudComplexStatusIcon; // size = 0x10
39
40typedef struct HudSimpleStatusIcon {
41 /* 0x0 */ s8 active;
42 /* 0x1 */ s8 removing;
44} HudSimpleStatusIcon; // size = 0x8
45
72
73#if !VERSION_JP
74s16 D_80078160[] = { 28, 40 };
75s16 D_80078164[] = { 0, -2 };
76#endif
77
82
86
115extern HudScript HES_Peril;
116extern HudScript HES_Danger;
117
118void update_merlee_message(void* popup);
119void draw_merlee_message(void* popup);
120void func_80045BC8(void);
121void init_all_status_icons(void);
123void draw_all_status_icons(void* popup);
124
125void func_80045AC0(void) {
126 s32 i;
127
128 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
130 popup->active = false;
131 popup->data.icons = nullptr;
132 }
133
136}
137
138void func_80045B10(void) {
139 s32 i;
140
141 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
143 if (popup->data.icons != nullptr) {
144 heap_free(popup->data.icons);
145 }
146 popup->active = false;
147 }
148}
149
151 s32 i;
152
153 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
155 if (popup->active && popup->updateFunc != nullptr) {
157 }
158 }
159}
160
161void func_80045BC8(void) {
162 s32 i;
163
164 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
166 if (popup->active && popup->renderWorldFunc != nullptr) {
168 }
169 }
170}
171
173 s32 i;
174
175 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
177 if (popup->active && popup->renderUIFunc != nullptr) {
179 }
180 }
181}
182
184 s32 i;
185
186 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
188 if (!popup->active) {
189 popup->active = true;
190 return popup;
191 }
192 }
193
194 return nullptr;
195}
196
198 if (popup->data.icons != nullptr) {
199 heap_free(popup->data.icons);
200 popup->data.icons = nullptr;
201 }
202 popup->active = false;
203}
204
205void show_merlee_message(s16 messageIndex, s16 duration) {
207
208 if (popup != nullptr) {
209 popup->updateFunc = update_merlee_message;
210 popup->renderUIFunc = draw_merlee_message;
211 popup->needsInit = true;
212 popup->unk_00 = 0;
213 popup->renderWorldFunc = nullptr;
214 popup->messageIndex = messageIndex;
215 popup->duration = duration;
216 popup->showMsgState = BTL_MSG_STATE_INIT;
217 D_800A0F40 = 1;
218 }
219}
220
221void update_merlee_message(void* data) {
222 PopupMessage* popup = data;
223 s32 closeMessage = false;
224
225 switch (popup->showMsgState) {
228 break;
230 popup->showMsgState = BTL_MSG_STATE_POPUP_DELAY;
231 break;
234 popup->duration = 0;
235 }
236 if (popup->duration != 0) {
237 popup->duration--;
238 } else {
240 }
241 break;
243 popup->showMsgState = BTL_MSG_STATE_POPUP_DISPOSE;
244 break;
246 closeMessage = true;
247 break;
248 }
249
250 if (closeMessage) {
252 D_800A0F40 = 0;
254 }
255}
256
258#if VERSION_JP
260
261 posX += 11;
262 posY += 6;
263
264 if (popup->messageIndex >= ARRAY_COUNT(D_80078168)) return;
265 if (popup->messageIndex < 0) return;
266
267 messageID = D_80078168[popup->messageIndex];
268 draw_msg(messageID, posX, posY, 255, MSG_PAL_0F, 0);
269#else
270 s32 messageID = D_80078168[popup->messageIndex];
271
272 posY += 6;
273 posX += 15;
274
275 posY += D_80078164[get_msg_lines(messageID) - 1];
276
277 draw_msg(messageID, posX, posY, 255, MSG_PAL_0F, 0);
278#endif
279}
280
281void draw_merlee_message(void* data) {
282#if VERSION_JP
283 PopupMessage* popup = data;
284 s32 width;
285 s32 height;
287 s32 xPos;
288
289 switch (popup->messageIndex) {
290 case 0:
291 if (popup->needsInit) {
292 popup->needsInit = false;
293 messageID = D_80078168[popup->messageIndex];
294 width = get_msg_width(messageID, 0) + 23;
295 xPos = 160 - (width / 2);
296 height = 45;
299 }
300 break;
301
302 case 1:
303 if (popup->needsInit) {
304 popup->needsInit = false;
305 messageID = D_80078168[popup->messageIndex];
306 width = get_msg_width(messageID, 0) + 23;
307 xPos = 160 - (width / 2);
308 height = 28;
311 }
312 break;
313 }
314#else
315 PopupMessage* popup = data;
317 s32 xPos;
318 s32 width;
319
320 if (popup->needsInit) {
321 popup->needsInit = false;
322 messageID = D_80078168[popup->messageIndex];
323 width = get_msg_width(messageID, 0) + 30;
324 xPos = 160 - (width / 2);
327 }
328#endif
329}
330
332 return D_800A0F40;
333}
334
336 int i;
337 HudStatusIcon* icons;
339
340 if (popup != nullptr) {
341 popup->updateFunc = update_all_status_icons;
342 popup->unk_00 = 0;
343 popup->renderWorldFunc = nullptr;
344 popup->renderUIFunc = draw_all_status_icons;
345 popup->data.icons = general_heap_malloc(MAX_ICONS * sizeof(HudStatusIcon));
346 icons = D_800A0F44 = popup->data.icons;
347 ASSERT(icons != nullptr);
348
349 for (i = 0; i < MAX_ICONS; i++, icons++)
350 icons->flags = 0;
351 }
352}
353
354void update_all_status_icons(void* data) {
357 s32 i;
358
359 for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) {
360 if (icon->flags == 0) {
361 continue;
362 }
363
364 if (icon->status1.activeTask == STATUS_ICON_TASK_LOAD) {
365 switch (icon->status1.active) {
366 case STATUS_KEY_SLEEP:
368 break;
370 elementID = icon->status1.activeElementHID = hud_element_create(&HES_ParalyzedBegin);
371 break;
372 case STATUS_KEY_DIZZY:
373 elementID = icon->status1.activeElementHID = hud_element_create(&HES_DizzyBegin);
374 break;
376 elementID = icon->status1.activeElementHID = hud_element_create(&HES_WeakenedLoop);
377 break;
378 case STATUS_KEY_STOP:
379 elementID = icon->status1.activeElementHID = hud_element_create(&HES_StoppedBegin);
380 break;
382 elementID = icon->status1.activeElementHID = hud_element_create(&HES_PoisonedBegin);
383 break;
385 elementID = icon->status1.activeElementHID = hud_element_create(&HES_ShrunkBegin);
386 break;
388 elementID = icon->status1.activeElementHID = hud_element_create(&HES_FrozenBegin);
389 break;
390 default:
391 elementID = icon->status1.activeElementHID = hud_element_create(&HES_Item_KeyGift);
392 break;
393 }
396 icon->status1.activeTask = STATUS_ICON_TASK_DRAW;
397 }
398
399 switch (icon->status1.removingTask) {
401 break;
403 switch (icon->status1.removing) {
404 case STATUS_KEY_SLEEP:
405 hud_element_set_script(icon->status1.removingElementHID, &HES_AsleepEnd);
406 break;
408 hud_element_set_script(icon->status1.removingElementHID, &HES_ParalyzedEnd);
409 break;
410 case STATUS_KEY_DIZZY:
411 hud_element_set_script(icon->status1.removingElementHID, &HES_DizzyEnd);
412 break;
414 hud_element_set_script(icon->status1.removingElementHID, &HES_WeakenedLoop);
415 break;
416 case STATUS_KEY_STOP:
417 hud_element_set_script(icon->status1.removingElementHID, &HES_StoppedEnd);
418 break;
420 hud_element_set_script(icon->status1.removingElementHID, &HES_PoisonedEnd);
421 break;
423 hud_element_set_script(icon->status1.removingElementHID, &HES_ShrunkEnd);
424 break;
426 hud_element_set_script(icon->status1.removingElementHID, &HES_FrozenEnd);
427 break;
428 default:
429 hud_element_set_script(icon->status1.removingElementHID, &HES_Item_KeyGift);
430 break;
431 }
432
433 icon->status1.frameCounter = 10;
434 icon->status1.removingTask = STATUS_ICON_TASK_DRAW;
435 break;
436
438 if (icon->status1.frameCounter != 0) {
439 icon->status1.frameCounter--;
440 } else {
441 icon->status1.removing = 0;
442 hud_element_free(icon->status1.removingElementHID);
443 icon->status1.removingTask = STATUS_ICON_TASK_NONE;
444 }
445 break;
446 }
447
448 if (icon->status2.activeTask == STATUS_ICON_TASK_LOAD) {
449 switch (icon->status2.active) {
451 elementID = icon->status2.activeElementHID = hud_element_create(&HES_ElectrifiedBegin);
452 break;
453 default:
454 elementID = icon->status2.activeElementHID = hud_element_create(&HES_Item_KeyGift);
455 break;
456 }
457
460 icon->status2.activeTask = STATUS_ICON_TASK_DRAW;
461 }
462
463 switch (icon->status2.removingTask) {
465 break;
467 switch (icon->status2.removing) {
469 hud_element_set_script(icon->status2.removingElementHID, &HES_ElectrifiedEnd);
470 break;
471 default:
472 hud_element_set_script(icon->status2.removingElementHID, &HES_Item_KeyGift);
473 break;
474 }
475
476 icon->status2.frameCounter = 20;
477 icon->status2.removingTask = STATUS_ICON_TASK_DRAW;
478 break;
480 if (icon->status2.frameCounter != 0) {
481 icon->status2.frameCounter--;
482 } else {
483 icon->status2.removing = 0;
484 hud_element_free(icon->status2.removingElementHID);
485 icon->status2.removingTask = STATUS_ICON_TASK_NONE;
486 }
487 break;
488 }
489
490 if (icon->status3.activeTask == STATUS_ICON_TASK_LOAD) {
491 switch (icon->status3.active) {
493 elementID = icon->status3.activeElementHID = hud_element_create(&HES_TransparentBegin);
494 break;
495 default:
496 elementID = icon->status3.activeElementHID = hud_element_create(&HES_Item_KeyGift);
497 break;
498 }
499
502 icon->status3.activeTask = STATUS_ICON_TASK_DRAW;
503 }
504
505 switch (icon->status3.removingTask) {
507 break;
509 switch (icon->status3.removing) {
511 hud_element_set_script(icon->status3.removingElementHID, &HES_TransparentEnd);
512 break;
513 default:
514 hud_element_set_script(icon->status3.removingElementHID, &HES_Item_KeyGift);
515 break;
516 }
517
518 icon->status3.frameCounter = 20;
519 icon->status3.removingTask = STATUS_ICON_TASK_DRAW;
520 break;
522 if (icon->status3.frameCounter != 0) {
523 icon->status3.frameCounter--;
524 } else {
525 icon->status3.removing = 0;
526 hud_element_free(icon->status3.removingElementHID);
527 icon->status3.removingTask = STATUS_ICON_TASK_NONE;
528 }
529 break;
530 }
531
532 if (icon->status4.activeTask == STATUS_ICON_TASK_LOAD) {
533 elementID = icon->status4.activeElementHID = hud_element_create(&HES_WeakenedBegin);
536 icon->status4.activeTask = STATUS_ICON_TASK_DRAW;
537 }
538
539 switch (icon->status4.removingTask) {
541 break;
543 hud_element_set_script(icon->status4.removingElementHID, &HES_WeakenedEnd);
544 icon->status4.frameCounter = 20;
545 icon->status4.removingTask = STATUS_ICON_TASK_DRAW;
546 break;
548 if (icon->status4.frameCounter != 0) {
549 icon->status4.frameCounter--;
550 } else {
551 icon->status4.removing = 0;
552 hud_element_free(icon->status4.removingElementHID);
553 icon->status4.removingTask = STATUS_ICON_TASK_NONE;
554 }
555 break;
556 }
557
558 if (icon->boostJump.removing) {
559 if (icon->boostJump.removing == 1) {
560 s32 index = icon->prevIndexBoostJump;
561
563 hud_element_free(index);
564 icon->boostJump.removing = 0;
565 }
566 }
567 }
568
569 if (icon->boostHammer.removing) {
570 if (icon->boostHammer.removing == 1) {
571 s32 index = icon->prevIndexBoostHammer;
572
574 hud_element_free(index);
575 icon->boostHammer.removing = 0;
576 }
577 }
578 }
579 }
580}
581
582void draw_all_status_icons(void* data) {
585 f32 x, y, z;
588 s32 offsetY;
590 int i;
591
605
606 for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) {
607 if (icon->flags == 0) {
608 continue;
609 }
610
611 iconCounter = 0;
612 isActiveDrawn = 0;
613 if (icon->status1.activeTask == STATUS_ICON_TASK_DRAW) {
614 if (icon->flags & STATUS_ICON_FLAG_DEBUFF) {
615 hud_element_set_flags(icon->status1.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
617 hud_element_clear_flags(icon->status1.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
618
619 x = icon->worldPos.x;
620 y = icon->worldPos.y + icon->status1OffsetY;
621 z = icon->worldPos.z;
622
623 add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90));
625 elementId = icon->status1.activeElementHID;
628 iconCounter = 1;
629 isActiveDrawn = 1;
630 }
631 }
632
633 if (icon->status1.removingTask == STATUS_ICON_TASK_DRAW
635 ) {
636 hud_element_clear_flags(icon->status1.removingElementHID, HUD_ELEMENT_FLAG_DISABLED);
637
638 if (isActiveDrawn == 0) {
639 iconCounter++;
640 }
641
642 x = icon->worldPos.x;
643 y = icon->worldPos.y + icon->status1OffsetY;
644 z = icon->worldPos.z;
645
646 add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90));
648 elementId = icon->status1.removingElementHID;
651 }
652
653 isActiveDrawn = 0;
654 if (icon->status2.activeTask == STATUS_ICON_TASK_DRAW) {
655 if (icon->flags & STATUS_ICON_FLAG_STATIC) {
656 hud_element_set_flags(icon->status2.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
658 hud_element_clear_flags(icon->status2.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
659
660 offsetY = 0;
661 if (iconCounter == 0) {
662 offsetY = -17;
663 }
664
665 x = icon->worldPos.x;
666 y = icon->worldPos.y + icon->status2OffsetY + offsetY;
667 z = icon->worldPos.z;
668
669 add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90));
671 elementId = icon->status2.activeElementHID;
674
675 iconCounter++;
676 isActiveDrawn = 1;
677 }
678 }
679
680 if (icon->status2.removingTask == STATUS_ICON_TASK_DRAW
682 ) {
683 hud_element_clear_flags(icon->status2.removingElementHID, HUD_ELEMENT_FLAG_DISABLED);
684
685 offsetY = 0;
686 if (iconCounter == 0) {
687 offsetY = -17;
688 }
689 if (isActiveDrawn == 0) {
690 iconCounter++;
691 }
692
693 x = icon->worldPos.x;
694 y = icon->worldPos.y + icon->status2OffsetY + offsetY;
695 z = icon->worldPos.z;
696
697 add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90));
699 elementId = icon->status2.removingElementHID;
702 }
703
704 isActiveDrawn = 0;
705 if (icon->status3.activeTask == STATUS_ICON_TASK_DRAW) {
706 if (icon->flags & STATUS_ICON_FLAG_TRANSPARENT) {
707 hud_element_set_flags(icon->status3.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
709 hud_element_clear_flags(icon->status3.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
710
711 offsetY = 0;
712 if (iconCounter == 1) {
713 offsetY = -17;
714 } if (iconCounter == 0) {
715 offsetY = -34;
716 }
717
718 x = icon->worldPos.x;
719 y = icon->worldPos.y + icon->status3OffsetY + offsetY;
720 z = icon->worldPos.z;
721
722 add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90));
724 elementId = icon->status3.activeElementHID;
727 iconCounter++;
728 isActiveDrawn = 1;
729 }
730 }
731
732 if (icon->status3.removingTask == STATUS_ICON_TASK_DRAW
734 ) {
735 hud_element_clear_flags(icon->status3.removingElementHID, HUD_ELEMENT_FLAG_DISABLED);
736
737 offsetY = 0;
738 if (iconCounter == 1) {
739 offsetY = -17;
740 }
741 if (iconCounter == 0) {
742 offsetY = -34;
743 }
744 if (isActiveDrawn == 0) {
745 iconCounter++;
746 }
747
748 x = icon->worldPos.x;
749 y = icon->worldPos.y + icon->status3OffsetY + offsetY;
750 z = icon->worldPos.z;
751
752 add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90));
754 elementId = icon->status3.removingElementHID;
757 }
758
759 isActiveDrawn = 0;
760 if (icon->status4.activeTask == STATUS_ICON_TASK_DRAW) {
762 hud_element_set_flags(icon->status4.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
764 hud_element_clear_flags(icon->status4.activeElementHID, HUD_ELEMENT_FLAG_DISABLED);
765
766 offsetY = 0;
767 if (iconCounter == 2) {
768 offsetY = -17;
769 }
770 if (iconCounter == 1) {
771 offsetY = -34;
772 }
773 if (iconCounter == 0) {
774 offsetY = -51;
775 }
776
777 x = icon->worldPos.x;
778 y = icon->worldPos.y + icon->status4OffsetY + offsetY;
779 z = icon->worldPos.z;
780
781 add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90));
783 elementId = icon->status4.activeElementHID;
786 iconCounter++;
787 isActiveDrawn = 1;
788 }
789 }
790
791 if (icon->status4.removingTask == STATUS_ICON_TASK_DRAW
793 ) {
794 hud_element_clear_flags(icon->status4.removingElementHID, HUD_ELEMENT_FLAG_DISABLED);
795
796 offsetY = 0;
797 if (iconCounter == 2) {
798 offsetY = -17;
799 }
800 if (iconCounter == 1) {
801 offsetY = -34;
802 }
803 if (iconCounter == 0) {
804 offsetY = -51;
805 }
806 if (isActiveDrawn == 0) {
807 iconCounter++;
808 }
809
810 x = icon->worldPos.x;
811 y = icon->worldPos.y + icon->status4OffsetY + offsetY;
812 z = icon->worldPos.z;
813
814 add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90));
816 elementId = icon->status4.removingElementHID;
819 }
820
821 do {
822 if (icon->boostJump.active) {
823 if (icon->flags & STATUS_ICON_FLAG_BOOST_JUMP) {
824 hud_element_set_flags(icon->boostJump.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
826 hud_element_clear_flags(icon->boostJump.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
827
828 x = icon->worldPos.x;
829 z = icon->worldPos.z;
830
831 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
832 elementId = icon->boostJump.activeElementID;
835 }
836 }
837 } while (0);
838
839 if (icon->boostJump.removing) {
841
842 x = icon->worldPos.x;
843 z = icon->worldPos.z;
844
845 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
846 elementId = icon->prevIndexBoostJump;
849 }
850
851 do {
852 if (icon->boostHammer.active) {
853 if (icon->flags & STATUS_ICON_FLAG_BOOST_HAMMER) {
854 hud_element_set_flags(icon->boostHammer.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
856 hud_element_clear_flags(icon->boostHammer.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
857
858 x = icon->worldPos.x;
859 z = icon->worldPos.z;
860
861 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
862 elementId = icon->boostHammer.activeElementID;
865 }
866 }
867 } while (0);
868
869 if (icon->boostHammer.removing) {
871
872 x = icon->worldPos.x;
873 z = icon->worldPos.z;
874
875 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
876 elementId = icon->prevIndexBoostHammer;
879 }
880
881 do {
882 if (icon->boostPartner.active) {
884 hud_element_set_flags(icon->boostPartner.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
886 hud_element_clear_flags(icon->boostPartner.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
887
888 x = icon->worldPos.x;
889 z = icon->worldPos.z;
890
891 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
892 elementId = icon->boostPartner.activeElementID;
895 }
896 }
897 } while (0);
898
899 do {
900 if (icon->surprise.active) {
901 if (icon->flags & STATUS_ICON_FLAG_SURPRISE) {
902 hud_element_set_flags(icon->surprise.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
904 hud_element_clear_flags(icon->surprise.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
905
906 x = icon->worldPos.x;
907 z = icon->worldPos.z;
908
909 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
910 elementId = icon->surprise.activeElementID;
913 }
914 }
915 } while (0);
916
917 do {
918 if (icon->peril.active) {
919 if (icon->flags & STATUS_ICON_FLAG_PERIL) {
923
924 x = icon->worldPos.x;
925 z = icon->worldPos.z;
926
927 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
928 elementId = icon->peril.activeElementID;
931 }
932 }
933 } while (0);
934
935 do {
936 if (icon->danger.active) {
937 if (icon->flags & STATUS_ICON_FLAG_DANGER) {
938 hud_element_set_flags(icon->danger.activeElementID, HUD_ELEMENT_FLAG_DISABLED);
941
942 x = icon->worldPos.x;
943 z = icon->worldPos.z;
944
945 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
946 elementId = icon->danger.activeElementID;
949 }
950 }
951 } while (0);
952 }
953}
954
956 s32 i;
958
959 for (icon = D_800A0F44, i = 0; i < MAX_ICONS; icon++, i++) {
960 if (icon->flags == 0) {
961 break;
962 }
963 }
964
965 ASSERT(i < MAX_ICONS);
966
968
971 }
972
973 icon->worldPos.x = 0;
974 icon->worldPos.y = 0;
975 icon->worldPos.z = 0;
976
977 icon->status1Radius = 0;
978 icon->status1OffsetY = 0;
979 icon->status2Radius = 0;
980 icon->status2OffsetY = 0;
981 icon->status3Radius = 0;
982 icon->status3OffsetY = 0;
983 icon->status4Radius = 0;
984 icon->status4OffsetY = 0;
985 icon->status1.active = 0;
986 icon->status1.removing = 0;
987 icon->status1.activeTask = 0;
988 icon->status1.removingTask = 0;
989 icon->status2.active = 0;
990 icon->status2.removing = 0;
991 icon->status2.activeTask = 0;
992 icon->status2.removingTask = 0;
993 icon->status3.active = 0;
994 icon->status3.removing = 0;
995 icon->status3.activeTask = 0;
996 icon->status3.removingTask = 0;
997 icon->status4.active = 0;
998 icon->status4.removing = 0;
999 icon->status4.activeTask = 0;
1000 icon->status4.removingTask = 0;
1001 icon->boostJump.active = 0;
1002 icon->boostJump.removing = 0;
1003 icon->boostHammer.active = 0;
1004 icon->boostHammer.removing = 0;
1005 icon->boostPartner.active = 0;
1006 icon->surprise.active = 0;
1007 icon->peril.active = 0;
1008 icon->danger.active = 0;
1009
1010 return i;
1011}
1012
1028
1029void set_status_icons_properties(s32 iconID, f32 x, f32 y, f32 z, s32 arg, s32 arg2, s32 radius, s32 offsetY) {
1031
1032 icon->worldPos.x = x;
1033 icon->worldPos.y = y;
1034 icon->worldPos.z = z;
1035 icon->status1Radius = radius + 17;
1036 icon->status1OffsetY = offsetY;
1037 icon->status2Radius = radius + 17;
1038 icon->status2OffsetY = offsetY + 17;
1039 icon->status3Radius = radius + 17;
1040 icon->status3OffsetY = offsetY + 34;
1041 icon->status4Radius = radius + 17;
1042 icon->status4OffsetY = offsetY + 51;
1043}
1044
1045void set_status_icons_offset(s32 iconID, s32 offsetY, s32 offsetX) {
1047
1048 statusIcon->offsetY = offsetY;
1049 statusIcon->offsetX = offsetX;
1050}
1051
1054
1056 if (statusIcon->status1.active != statusID) {
1058 statusIcon->status1.active = statusID;
1059 statusIcon->status1.activeTask = STATUS_ICON_TASK_LOAD;
1060 }
1061}
1062
1065
1066 if (statusIcon->status1.active && !statusIcon->status1.removing) {
1067 statusIcon->status1.removing = statusIcon->status1.active;
1068 statusIcon->status1.removingTask = STATUS_ICON_TASK_LOAD;
1069 statusIcon->status1.active = 0;
1070 statusIcon->status1.activeTask = STATUS_ICON_TASK_NONE;
1071 statusIcon->status1.frameCounter = 10;
1072 statusIcon->status1.removingElementHID = statusIcon->status1.activeElementHID;
1073 }
1074}
1075
1081
1084
1086 if (statusIcon->status2.active != statusID) {
1088 statusIcon->status2.active = statusID;
1089 statusIcon->status2.activeTask = 1;
1090 }
1091}
1092
1095
1096 if (statusIcon->status2.active && !statusIcon->status2.removing) {
1097 statusIcon->status2.removing = statusIcon->status2.active;
1098 statusIcon->status2.removingTask = true;
1099 statusIcon->status2.active = false;
1100 statusIcon->status2.activeTask = false;
1101 statusIcon->status2.frameCounter = 10;
1102 statusIcon->status2.removingElementHID = statusIcon->status2.activeElementHID;
1103 }
1104}
1105
1111
1114
1116 if (statusIcon->status3.active != statusID) {
1118 statusIcon->status3.active = statusID;
1119 statusIcon->status3.activeTask = 1;
1120 }
1121}
1122
1125
1126 if (statusIcon->status3.active && !statusIcon->status3.removing) {
1127 statusIcon->status3.removing = statusIcon->status3.active;
1128 statusIcon->status3.removingTask = true;
1129 statusIcon->status3.active = false;
1130 statusIcon->status3.activeTask = false;
1131 statusIcon->status3.frameCounter = 10;
1132 statusIcon->status3.removingElementHID = statusIcon->status3.activeElementHID;
1133 }
1134}
1135
1141
1144
1146 if (!statusIcon->status4.active) {
1147 statusIcon->status4.active = true;
1148 statusIcon->status4.activeTask = true;
1149 }
1150}
1151
1154
1155 if (statusIcon->status4.active && !statusIcon->status4.removing) {
1156 statusIcon->status4.removing = statusIcon->status4.active;
1157 statusIcon->status4.removingTask = true;
1158 statusIcon->status4.active = false;
1159 statusIcon->status4.activeTask = false;
1160 statusIcon->status4.frameCounter = 10;
1161 statusIcon->status4.removingElementHID = statusIcon->status4.activeElementHID;
1162 }
1163}
1164
1170
1184
1187
1188 if (statusIcon->boostJump.active) {
1190 statusIcon->boostJump.active = false;
1191 statusIcon->boostJump.removing = true;
1192 statusIcon->prevIndexBoostJump = hid;
1194 }
1195}
1196
1202
1216
1219
1220 if (statusIcon->boostHammer.active) {
1222 statusIcon->boostHammer.active = false;
1223 statusIcon->boostHammer.removing = false;
1224 statusIcon->prevIndexBoostHammer = hid;
1226 }
1227}
1228
1234
1248
1251
1252 if (statusIcon->boostPartner.active) {
1254 hud_element_free(statusIcon->boostPartner.activeElementID);
1255 }
1256}
1257
1263
1277
1280
1281 if (statusIcon->surprise.active) {
1282 statusIcon->surprise.active = false;
1283 hud_element_free(statusIcon->surprise.activeElementID);
1284 }
1285}
1286
1292
1306
1309
1310 if (statusIcon->peril.active) {
1311 statusIcon->peril.active = false;
1312 hud_element_free(statusIcon->peril.activeElementID);
1313 }
1314}
1315
1321
1335
1338
1339 if (statusIcon->danger.active) {
1340 statusIcon->danger.active = false;
1341 hud_element_free(statusIcon->danger.activeElementID);
1342 }
1343}
1344
1350
BSS s32 PopupMenu_SelectedIndex
u32 pressedButtons[4]
PopupMessageCallback updateFunc
PopupMessageCallback renderUIFunc
s32 HudElemID
PopupMessageCallback renderWorldFunc
s8 flags
Definition demo_api.c:15
#define general_heap_malloc
#define get_msg_width
#define clamp_angle
#define draw_msg
#define ASSERT(condition)
@ BTL_MSG_STATE_POPUP_DISPOSE
Definition enums.h:3797
@ BTL_MSG_STATE_POPUP_POST_DELAY
Definition enums.h:3796
@ BTL_MSG_STATE_INIT
Definition enums.h:3792
@ BTL_MSG_STATE_POPUP_PRE_DELAY
Definition enums.h:3794
@ BTL_MSG_STATE_POPUP_DELAY
Definition enums.h:3795
@ BUTTON_A
Definition enums.h:2776
@ BUTTON_B
Definition enums.h:2775
@ WINDOW_PRIORITY_0
Definition enums.h:3216
@ MSG_PAL_0F
Definition enums.h:5005
@ WINDOW_UPDATE_SHOW
Definition enums.h:4896
@ WINDOW_UPDATE_HIDE
Definition enums.h:4897
@ STATUS_KEY_PARALYZE
Definition enums.h:2806
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2815
@ STATUS_KEY_STATIC
Definition enums.h:2812
@ STATUS_KEY_SLEEP
Definition enums.h:2807
@ STATUS_KEY_UNUSED
Definition enums.h:2804
@ STATUS_KEY_STOP
Definition enums.h:2809
@ STATUS_KEY_SHRINK
Definition enums.h:2811
@ STATUS_KEY_DIZZY
Definition enums.h:2805
@ STATUS_KEY_POISON
Definition enums.h:2810
@ CONTEXT_BATTLE
Definition enums.h:3563
@ CONTEXT_WORLD
Definition enums.h:3562
@ WIN_BTL_POPUP
Definition enums.h:4835
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:409
void set_window_update(s32 panelID, s32)
Definition windows.c:434
s32 create_worker_scene(void(*updateFunc)(void), void(*renderFunc)(void))
Definition worker.c:32
s32 heap_free(void *ptr)
Definition heap.c:42
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 add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
s32 get_msg_lines(s32 messageID)
Definition msg.c:1981
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_draw_next(s32 id)
HudElemID hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
HudElement * get_hud_element(s32 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_free(s32 id)
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:72
@ HUD_ELEMENT_FLAG_MANUAL_RENDER
Definition hud_element.h:78
@ HUD_ELEMENT_FLAG_ANIMATION_FINISHED
Definition hud_element.h:73
s32 HudScript[]
Definition hud_element.h:9
#define SCREEN_YMAX
Definition macros.h:117
#define BSS
Definition macros.h:6
#define ARRAY_COUNT(arr)
Definition macros.h:39
#define SCREEN_YMIN
Definition macros.h:116
#define SCREEN_XMIN
Definition macros.h:114
#define SCREEN_XMAX
Definition macros.h:115
void set_status_icons_offset(s32 iconID, s32 offsetY, s32 offsetX)
void draw_merlee_message(void *popup)
PopupMessage * get_current_merlee_message(void)
HudSimpleStatusIcon boostPartner
void remove_status_icon_surprise(s32 iconID)
HudComplexStatusIcon status2
void remove_status_debuff(s32 iconID)
s32 D_80078168[]
HudSimpleStatusIcon boostJump
HudElemID removingElementHID
s32 is_merlee_message_done(void)
void draw_merlee_message_string(PopupMessage *popup, s32 posX, s32 posY)
void remove_status_icon_boost_jump(s32 iconID)
void remove_status_icon_boost_partner(s32 iconID)
void update_merlee_message(void *popup)
HudComplexStatusIcon status4
void remove_status_transparent(s32 iconID)
void create_status_transparent(s32 iconID, s32 statusID)
StatusIconTask
@ STATUS_ICON_TASK_DRAW
@ STATUS_ICON_TASK_LOAD
@ STATUS_ICON_TASK_NONE
void enable_status_icon_boost_hammer(s32 iconID)
void enable_status_transparent(s32 iconID)
HudSimpleStatusIcon surprise
s32 prevIndexBoostHammer
HudScript HES_WeakenedEnd
s16 D_80078160[]
const f32 status_icons_rodata_alignment
HudScript HES_StoppedEnd
#define MAX_ICONS
Definition status_icons.c:6
void enable_status_debuff(s32 iconID)
void func_80045AC0(void)
s32 create_status_icon_set(void)
void create_status_static(s32 iconID, s32 statusID)
s16 D_80078164[]
void update_all_status_icons(void *popup)
HudScript HES_DizzyBegin
void remove_status_static(s32 iconID)
HudScript HES_WeakenedBegin
StatusIconFlag
Definition status_icons.c:8
@ STATUS_ICON_FLAG_SURPRISE
@ STATUS_ICON_FLAG_STATIC
@ STATUS_ICON_FLAG_STATUS_CHILL_OUT
@ STATUS_ICON_FLAG_BOOST_PARTNER
@ STATUS_ICON_FLAG_DEBUFF
@ STATUS_ICON_FLAG_BATTLE
@ STATUS_ICON_FLAG_USED
Definition status_icons.c:9
@ STATUS_ICON_FLAG_BOOST_HAMMER
@ STATUS_ICON_FLAG_TRANSPARENT
@ STATUS_ICON_FLAG_DANGER
@ STATUS_ICON_FLAG_BOOST_JUMP
@ STATUS_ICON_FLAG_PERIL
HudScript HES_TransparentEnd
HudScript HES_ElectrifiedBegin
HudScript HES_PoisonedEnd
HudScript HES_PoisonedBegin
BSS PopupMessage D_800A0BC0[32]
HudScript HES_DizzyEnd
HudScript HES_Surprise
void remove_status_icon_peril(s32 iconID)
void create_status_icon_surprise(s32 iconID)
void enable_status_chill_out(s32 iconID)
void func_80045B10(void)
void remove_status_chill_out(s32 iconID)
void enable_status_icon_boost_partner(s32 iconID)
void enable_status_icon_boost_jump(s32 iconID)
HudScript HES_AsleepEnd
HudScript HES_BoostHammerBegin
HudScript HES_Item_KeyGift
HudScript HES_Danger
HudElemID activeElementHID
void create_status_icon_boost_jump(s32 iconID)
void show_merlee_message(s16 messageIndex, s16 duration)
HudScript HES_ParalyzedEnd
void enable_status_static(s32 iconID)
HudScript HES_StoppedBegin
HudScript HES_ShrunkEnd
void remove_status_icon_boost_hammer(s32 iconID)
HudScript HES_ShrunkBegin
HudScript HES_BoostPartner
void draw_merlee_messages(void)
void create_status_debuff(s32 iconID, s32 statusID)
void func_80045BC8(void)
HudSimpleStatusIcon danger
void set_status_icons_properties(s32 iconID, f32 x, f32 y, f32 z, s32 arg, s32 arg2, s32 radius, s32 offsetY)
void draw_all_status_icons(void *popup)
HudSimpleStatusIcon peril
HudScript HES_ParalyzedBegin
void create_status_icon_boost_hammer(s32 iconID)
HudScript HES_AsleepBegin
void update_merlee_messages(void)
void enable_status_icon_peril(s32 iconID)
HudScript HES_BoostJumpEnd
HudScript HES_TransparentBegin
void enable_status_icon_surprise(s32 iconID)
BSS HudStatusIcon * D_800A0F44
HudSimpleStatusIcon boostHammer
HudScript HES_FrozenEnd
HudComplexStatusIcon status1
HudScript HES_BoostJumpBegin
void remove_all_status_icons(s32 iconID)
void init_all_status_icons(void)
void create_status_icon_peril(s32 iconID)
HudScript HES_BoostHammerEnd
void create_status_icon_danger(s32 iconID)
void create_status_chill_out(s32 iconID)
void remove_status_icon_danger(s32 iconID)
void enable_status_icon_danger(s32 iconID)
HudComplexStatusIcon status3
HudScript HES_FrozenBegin
BSS s32 D_800A0F40
void dispose_merlee_message(PopupMessage *popup)
HudScript HES_WeakenedLoop
void create_status_icon_boost_partner(s32 iconID)
HudScript HES_Peril
HudScript HES_ElectrifiedEnd
GameStatus * gGameStatusPtr
Definition main_loop.c:31
Camera gCameras[4]
Definition cam_main.c:16
Gfx * gMainGfxPos
Definition cam_main.c:14
s32 gCurrentCameraID
Definition cam_math.c:5