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;
36 /* 0x8 */ s32 activeElementID;
37 /* 0xC */ s32 removingElementID;
38} HudComplexStatusIcon; // size = 0x10
39
40typedef struct HudSimpleStatusIcon {
41 /* 0x0 */ s8 active;
42 /* 0x1 */ s8 removing;
43 /* 0x4 */ s32 activeElementID;
44} HudSimpleStatusIcon; // size = 0x8
45
46typedef struct HudStatusIcon {
47 /* 0x00 */ s32 flags;
48 /* 0x04 */ Vec3f worldPos;
49 /* 0x10 */ s32 status1Radius;
50 /* 0x14 */ s32 status1OffsetY;
51 /* 0x18 */ s32 status2Radius;
52 /* 0x1C */ s32 status2OffsetY;
53 /* 0x20 */ s32 status3Radius;
54 /* 0x24 */ s32 status3OffsetY;
55 /* 0x28 */ s32 status4Radius;
56 /* 0x2C */ s32 status4OffsetY;
57 /* 0x30 */ s32 offsetY;
58 /* 0x34 */ s32 offsetX;
64 /* 0x80 */ s32 prevIndexBoostJump;
66 /* 0x8C */ s32 prevIndexBoostHammer;
71} HudStatusIcon; // size = 0xB0
72
73#if !VERSION_JP
74s16 D_80078160[] = { 28, 40 };
75s16 D_80078164[] = { 0, -2 };
76#endif
77
78s32 D_80078168[] = {
79 MSG_Menus_Merlee_IncreaseCoins,
80 MSG_Menus_Merlee_Exhausted,
81};
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);
122void update_all_status_icons(void* popup);
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++) {
129 PopupMessage* popup = &D_800A0BC0[i];
130 popup->active = FALSE;
131 popup->data.icons = NULL;
132 }
133
136}
137
138void func_80045B10(void) {
139 s32 i;
140
141 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
142 PopupMessage* popup = &D_800A0BC0[i];
143 if (popup->data.icons != NULL) {
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++) {
154 PopupMessage* popup = &D_800A0BC0[i];
155 if (popup->active && popup->updateFunc != NULL) {
156 popup->updateFunc(popup);
157 }
158 }
159}
160
161void func_80045BC8(void) {
162 s32 i;
163
164 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
165 PopupMessage* popup = &D_800A0BC0[i];
166 if (popup->active && popup->renderWorldFunc != NULL) {
167 popup->renderWorldFunc(popup);
168 }
169 }
170}
171
173 s32 i;
174
175 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
176 PopupMessage* popup = &D_800A0BC0[i];
177 if (popup->active && popup->renderUIFunc != NULL) {
178 popup->renderUIFunc(popup);
179 }
180 }
181}
182
184 s32 i;
185
186 for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) {
187 PopupMessage* popup = &D_800A0BC0[i];
188 if (!popup->active) {
189 popup->active = TRUE;
190 return popup;
191 }
192 }
193
194 return NULL;
195}
196
198 if (popup->data.icons != NULL) {
199 heap_free(popup->data.icons);
200 popup->data.icons = NULL;
201 }
202 popup->active = FALSE;
203}
204
205void show_merlee_message(s16 messageIndex, s16 duration) {
207
208 if (popup != NULL) {
211 popup->needsInit = TRUE;
212 popup->unk_00 = 0;
213 popup->renderWorldFunc = NULL;
214 popup->messageIndex = messageIndex;
215 popup->duration = duration;
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;
231 break;
234 popup->duration = 0;
235 }
236 if (popup->duration != 0) {
237 popup->duration--;
238 } else {
240 }
241 break;
244 break;
246 closeMessage = TRUE;
247 break;
248 }
249
250 if (closeMessage) {
252 D_800A0F40 = 0;
254 }
255}
256
257void draw_merlee_message_string(PopupMessage* popup, s32 posX, s32 posY) {
258#if VERSION_JP
259 s32 messageID;
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;
286 s32 messageID;
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;
316 s32 messageID;
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);
325 set_window_properties(WIN_BTL_POPUP, xPos, 80, width, D_80078160[get_msg_lines(messageID) - 1], 0, draw_merlee_message_string, popup, -1);
327 }
328#endif
329}
330
332 return D_800A0F40;
333}
334
336 int i;
337 HudStatusIcon* icons;
339
340 if (popup != NULL) {
342 popup->unk_00 = 0;
343 popup->renderWorldFunc = NULL;
345 popup->data.icons = general_heap_malloc(MAX_ICONS * sizeof(HudStatusIcon));
346 icons = D_800A0F44 = popup->data.icons;
347 ASSERT(icons != NULL);
348
349 for (i = 0; i < MAX_ICONS; i++, icons++)
350 icons->flags = 0;
351 }
352}
353
354void update_all_status_icons(void* data) {
355 PopupMessage* popup = data;
356 HudStatusIcon* icon;
357 int i;
358 s32 elementID;
359
360 for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) {
361 if (icon->flags == 0) {
362 continue;
363 }
364
366 switch (icon->status1.active) {
367 case STATUS_KEY_SLEEP:
369 break;
372 break;
373 case STATUS_KEY_DIZZY:
375 break;
376 case STATUS_KEY_FEAR:
378 break;
379 case STATUS_KEY_STOP:
381 break;
384 break;
387 break;
390 break;
391 default:
393 break;
394 }
398 }
399
400 switch (icon->status1.removingTask) {
402 break;
404 switch (icon->status1.removing) {
405 case STATUS_KEY_SLEEP:
407 break;
410 break;
411 case STATUS_KEY_DIZZY:
413 break;
414 case STATUS_KEY_FEAR:
416 break;
417 case STATUS_KEY_STOP:
419 break;
422 break;
425 break;
428 break;
429 default:
431 break;
432 }
433
434 icon->status1.frameCounter = 10;
436 break;
437
439 if (icon->status1.frameCounter != 0) {
440 icon->status1.frameCounter--;
441 } else {
442 icon->status1.removing = 0;
445 }
446 break;
447 }
448
450 switch (icon->status2.active) {
453 break;
454 default:
456 break;
457 }
458
462 }
463
464 switch (icon->status2.removingTask) {
466 break;
468 switch (icon->status2.removing) {
471 break;
472 default:
474 break;
475 }
476
477 icon->status2.frameCounter = 20;
479 break;
481 if (icon->status2.frameCounter != 0) {
482 icon->status2.frameCounter--;
483 } else {
484 icon->status2.removing = 0;
487 }
488 break;
489 }
490
492 switch (icon->status3.active) {
495 break;
496 default:
498 break;
499 }
500
504 }
505
506 switch (icon->status3.removingTask) {
508 break;
510 switch (icon->status3.removing) {
513 break;
514 default:
516 break;
517 }
518
519 icon->status3.frameCounter = 20;
521 break;
523 if (icon->status3.frameCounter != 0) {
524 icon->status3.frameCounter--;
525 } else {
526 icon->status3.removing = 0;
529 }
530 break;
531 }
532
538 }
539
540 switch (icon->status4.removingTask) {
542 break;
545 icon->status4.frameCounter = 20;
547 break;
549 if (icon->status4.frameCounter != 0) {
550 icon->status4.frameCounter--;
551 } else {
552 icon->status4.removing = 0;
555 }
556 break;
557 }
558
559 if (icon->boostJump.removing) {
560 if (icon->boostJump.removing == 1) {
561 s32 index = icon->prevIndexBoostJump;
562
564 hud_element_free(index);
565 icon->boostJump.removing = 0;
566 }
567 }
568 }
569
570 if (icon->boostHammer.removing) {
571 if (icon->boostHammer.removing == 1) {
572 s32 index = icon->prevIndexBoostHammer;
573
575 hud_element_free(index);
576 icon->boostHammer.removing = 0;
577 }
578 }
579 }
580 }
581}
582
583void draw_all_status_icons(void* data) {
584 PopupMessage* popup = data;
585 HudStatusIcon* icon;
586 s32 elementId;
587 f32 x, y, z;
588 s32 screenX, screenY, screenZ;
589 s32 isActiveDrawn, iconCounter;
590 s32 offsetY;
591 Camera* camera = &gCameras[gCurrentCameraID];
592 int i;
593
594 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, SCREEN_WIDTH - 12, SCREEN_HEIGHT - 20);
595 gDPPipeSync(gMainGfxPos++);
596 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
597 gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
598 gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
599 gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
600 gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
601 gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
602 gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
603 gDPNoOp(gMainGfxPos++);
604 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
605 gDPSetAlphaDither(gMainGfxPos++, G_AD_DISABLE);
606 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
607
608 for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) {
609 if (icon->flags == 0) {
610 continue;
611 }
612
613 iconCounter = 0;
614 isActiveDrawn = 0;
616 if (icon->flags & STATUS_ICON_FLAG_DEBUFF) {
620
621 x = icon->worldPos.x;
622 y = icon->worldPos.y + icon->status1OffsetY;
623 z = icon->worldPos.z;
624
625 add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90));
626 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
627 elementId = icon->status1.activeElementID;
628 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
629 hud_element_draw_next(elementId);
630 iconCounter = 1;
631 isActiveDrawn = 1;
632 }
633 }
634
637 ) {
639
640 if (isActiveDrawn == 0) {
641 iconCounter++;
642 }
643
644 x = icon->worldPos.x;
645 y = icon->worldPos.y + icon->status1OffsetY;
646 z = icon->worldPos.z;
647
648 add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90));
649 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
650 elementId = icon->status1.removingElementID;
651 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
652 hud_element_draw_next(elementId);
653 }
654
655 isActiveDrawn = 0;
657 if (icon->flags & STATUS_ICON_FLAG_STATIC) {
661
662 offsetY = 0;
663 if (iconCounter == 0) {
664 offsetY = -17;
665 }
666
667 x = icon->worldPos.x;
668 y = icon->worldPos.y + icon->status2OffsetY + offsetY;
669 z = icon->worldPos.z;
670
671 add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90));
672 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
673 elementId = icon->status2.activeElementID;
674 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
675 hud_element_draw_next(elementId);
676
677 iconCounter++;
678 isActiveDrawn = 1;
679 }
680 }
681
684 ) {
686
687 offsetY = 0;
688 if (iconCounter == 0) {
689 offsetY = -17;
690 }
691 if (isActiveDrawn == 0) {
692 iconCounter++;
693 }
694
695 x = icon->worldPos.x;
696 y = icon->worldPos.y + icon->status2OffsetY + offsetY;
697 z = icon->worldPos.z;
698
699 add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90));
700 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
701 elementId = icon->status2.removingElementID;
702 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
703 hud_element_draw_next(elementId);
704 }
705
706 isActiveDrawn = 0;
712
713 offsetY = 0;
714 if (iconCounter == 1) {
715 offsetY = -17;
716 } if (iconCounter == 0) {
717 offsetY = -34;
718 }
719
720 x = icon->worldPos.x;
721 y = icon->worldPos.y + icon->status3OffsetY + offsetY;
722 z = icon->worldPos.z;
723
724 add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90));
725 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
726 elementId = icon->status3.activeElementID;
727 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
728 hud_element_draw_next(elementId);
729 iconCounter++;
730 isActiveDrawn = 1;
731 }
732 }
733
736 ) {
738
739 offsetY = 0;
740 if (iconCounter == 1) {
741 offsetY = -17;
742 }
743 if (iconCounter == 0) {
744 offsetY = -34;
745 }
746 if (isActiveDrawn == 0) {
747 iconCounter++;
748 }
749
750 x = icon->worldPos.x;
751 y = icon->worldPos.y + icon->status3OffsetY + offsetY;
752 z = icon->worldPos.z;
753
754 add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90));
755 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
756 elementId = icon->status3.removingElementID;
757 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
758 hud_element_draw_next(elementId);
759 }
760
761 isActiveDrawn = 0;
767
768 offsetY = 0;
769 if (iconCounter == 2) {
770 offsetY = -17;
771 }
772 if (iconCounter == 1) {
773 offsetY = -34;
774 }
775 if (iconCounter == 0) {
776 offsetY = -51;
777 }
778
779 x = icon->worldPos.x;
780 y = icon->worldPos.y + icon->status4OffsetY + offsetY;
781 z = icon->worldPos.z;
782
783 add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90));
784 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
785 elementId = icon->status4.activeElementID;
786 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
787 hud_element_draw_next(elementId);
788 iconCounter++;
789 isActiveDrawn = 1;
790 }
791 }
792
795 ) {
797
798 offsetY = 0;
799 if (iconCounter == 2) {
800 offsetY = -17;
801 }
802 if (iconCounter == 1) {
803 offsetY = -34;
804 }
805 if (iconCounter == 0) {
806 offsetY = -51;
807 }
808 if (isActiveDrawn == 0) {
809 iconCounter++;
810 }
811
812 x = icon->worldPos.x;
813 y = icon->worldPos.y + icon->status4OffsetY + offsetY;
814 z = icon->worldPos.z;
815
816 add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90));
817 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
818 elementId = icon->status4.removingElementID;
819 hud_element_set_render_pos(elementId, screenX - 8, screenY - 8);
820 hud_element_draw_next(elementId);
821 }
822
823 do {
824 if (icon->boostJump.active) {
829
830 x = icon->worldPos.x;
831 z = icon->worldPos.z;
832
833 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
834 elementId = icon->boostJump.activeElementID;
835 hud_element_set_render_pos(elementId, screenX + 2, screenY - 12);
836 hud_element_draw_next(elementId);
837 }
838 }
839 } while (0);
840
841 if (icon->boostJump.removing) {
843
844 x = icon->worldPos.x;
845 z = icon->worldPos.z;
846
847 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
848 elementId = icon->prevIndexBoostJump;
849 hud_element_set_render_pos(elementId, screenX + 2, screenY - 12);
850 hud_element_draw_next(elementId);
851 }
852
853 do {
854 if (icon->boostHammer.active) {
859
860 x = icon->worldPos.x;
861 z = icon->worldPos.z;
862
863 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
864 elementId = icon->boostHammer.activeElementID;
865 hud_element_set_render_pos(elementId, screenX + 2, screenY - 12);
866 hud_element_draw_next(elementId);
867 }
868 }
869 } while (0);
870
871 if (icon->boostHammer.removing) {
873
874 x = icon->worldPos.x;
875 z = icon->worldPos.z;
876
877 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
878 elementId = icon->prevIndexBoostHammer;
879 hud_element_set_render_pos(elementId, screenX + 2, screenY - 12);
880 hud_element_draw_next(elementId);
881 }
882
883 do {
884 if (icon->boostPartner.active) {
889
890 x = icon->worldPos.x;
891 z = icon->worldPos.z;
892
893 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
894 elementId = icon->boostPartner.activeElementID;
895 hud_element_set_render_pos(elementId, screenX + 2, screenY - 12);
896 hud_element_draw_next(elementId);
897 }
898 }
899 } while (0);
900
901 do {
902 if (icon->surprise.active) {
903 if (icon->flags & STATUS_ICON_FLAG_SURPRISE) {
907
908 x = icon->worldPos.x;
909 z = icon->worldPos.z;
910
911 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
912 elementId = icon->surprise.activeElementID;
913 hud_element_set_render_pos(elementId, screenX + 2, screenY - 15);
914 hud_element_draw_next(elementId);
915 }
916 }
917 } while (0);
918
919 do {
920 if (icon->peril.active) {
921 if (icon->flags & STATUS_ICON_FLAG_PERIL) {
925
926 x = icon->worldPos.x;
927 z = icon->worldPos.z;
928
929 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
930 elementId = icon->peril.activeElementID;
931 hud_element_set_render_pos(elementId, screenX + 2, screenY - 16);
932 hud_element_draw_next(elementId);
933 }
934 }
935 } while (0);
936
937 do {
938 if (icon->danger.active) {
939 if (icon->flags & STATUS_ICON_FLAG_DANGER) {
943
944 x = icon->worldPos.x;
945 z = icon->worldPos.z;
946
947 get_screen_coords(gCurrentCameraID, x, icon->worldPos.y + icon->offsetY, z, &screenX, &screenY, &screenZ);
948 elementId = icon->danger.activeElementID;
949 hud_element_set_render_pos(elementId, screenX + 2, screenY - 16);
950 hud_element_draw_next(elementId);
951 }
952 }
953 } while (0);
954 }
955}
956
958 s32 i;
959 HudStatusIcon* icon;
960
961 for (icon = D_800A0F44, i = 0; i < MAX_ICONS; icon++, i++) {
962 if (icon->flags == 0) {
963 break;
964 }
965 }
966
967 ASSERT(i < MAX_ICONS);
968
970
973 }
974
975 icon->worldPos.x = 0;
976 icon->worldPos.y = 0;
977 icon->worldPos.z = 0;
978
979 icon->status1Radius = 0;
980 icon->status1OffsetY = 0;
981 icon->status2Radius = 0;
982 icon->status2OffsetY = 0;
983 icon->status3Radius = 0;
984 icon->status3OffsetY = 0;
985 icon->status4Radius = 0;
986 icon->status4OffsetY = 0;
987 icon->status1.active = 0;
988 icon->status1.removing = 0;
989 icon->status1.activeTask = 0;
990 icon->status1.removingTask = 0;
991 icon->status2.active = 0;
992 icon->status2.removing = 0;
993 icon->status2.activeTask = 0;
994 icon->status2.removingTask = 0;
995 icon->status3.active = 0;
996 icon->status3.removing = 0;
997 icon->status3.activeTask = 0;
998 icon->status3.removingTask = 0;
999 icon->status4.active = 0;
1000 icon->status4.removing = 0;
1001 icon->status4.activeTask = 0;
1002 icon->status4.removingTask = 0;
1003 icon->boostJump.active = 0;
1004 icon->boostJump.removing = 0;
1005 icon->boostHammer.active = 0;
1006 icon->boostHammer.removing = 0;
1007 icon->boostPartner.active = 0;
1008 icon->surprise.active = 0;
1009 icon->peril.active = 0;
1010 icon->danger.active = 0;
1011
1012 return i;
1013}
1014
1015void remove_all_status_icons(s32 iconID) {
1016 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1017
1018 remove_status_debuff(iconID);
1019 remove_status_static(iconID);
1028 statusIcon->flags = 0;
1029}
1030
1031void set_status_icons_properties(s32 iconID, f32 x, f32 y, f32 z, s32 arg, s32 arg2, s32 radius, s32 offsetY) {
1032 HudStatusIcon* icon = &D_800A0F44[iconID];
1033
1034 icon->worldPos.x = x;
1035 icon->worldPos.y = y;
1036 icon->worldPos.z = z;
1037 icon->status1Radius = radius + 17;
1038 icon->status1OffsetY = offsetY;
1039 icon->status2Radius = radius + 17;
1040 icon->status2OffsetY = offsetY + 17;
1041 icon->status3Radius = radius + 17;
1042 icon->status3OffsetY = offsetY + 34;
1043 icon->status4Radius = radius + 17;
1044 icon->status4OffsetY = offsetY + 51;
1045}
1046
1047void set_status_icons_offset(s32 iconID, s32 offsetY, s32 offsetX) {
1048 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1049
1050 statusIcon->offsetY = offsetY;
1051 statusIcon->offsetX = offsetX;
1052}
1053
1054void create_status_debuff(s32 iconID, s32 statusID) {
1055 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1056
1057 statusIcon->flags &= ~STATUS_ICON_FLAG_DEBUFF;
1058 if (statusIcon->status1.active != statusID) {
1059 remove_status_debuff(iconID);
1060 statusIcon->status1.active = statusID;
1062 }
1063}
1064
1065void remove_status_debuff(s32 iconID) {
1066 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1067
1068 if (statusIcon->status1.active && !statusIcon->status1.removing) {
1069 statusIcon->status1.removing = statusIcon->status1.active;
1071 statusIcon->status1.active = 0;
1073 statusIcon->status1.frameCounter = 10;
1074 statusIcon->status1.removingElementID = statusIcon->status1.activeElementID;
1075 }
1076}
1077
1078void enable_status_debuff(s32 iconID) {
1079 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1080
1081 statusIcon->flags |= STATUS_ICON_FLAG_DEBUFF;
1082}
1083
1084void create_status_static(s32 iconID, s32 statusID) {
1085 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1086
1087 statusIcon->flags &= ~STATUS_ICON_FLAG_STATIC;
1088 if (statusIcon->status2.active != statusID) {
1089 remove_status_static(iconID);
1090 statusIcon->status2.active = statusID;
1091 statusIcon->status2.activeTask = 1;
1092 }
1093}
1094
1095void remove_status_static(s32 iconID) {
1096 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1097
1098 if (statusIcon->status2.active && !statusIcon->status2.removing) {
1099 statusIcon->status2.removing = statusIcon->status2.active;
1100 statusIcon->status2.removingTask = TRUE;
1101 statusIcon->status2.active = FALSE;
1102 statusIcon->status2.activeTask = FALSE;
1103 statusIcon->status2.frameCounter = 10;
1104 statusIcon->status2.removingElementID = statusIcon->status2.activeElementID;
1105 }
1106}
1107
1108void enable_status_static(s32 iconID) {
1109 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1110
1111 statusIcon->flags |= STATUS_ICON_FLAG_STATIC;
1112}
1113
1114void create_status_transparent(s32 iconID, s32 statusID) {
1115 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1116
1117 statusIcon->flags &= ~STATUS_ICON_FLAG_TRANSPARENT;
1118 if (statusIcon->status3.active != statusID) {
1120 statusIcon->status3.active = statusID;
1121 statusIcon->status3.activeTask = 1;
1122 }
1123}
1124
1126 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1127
1128 if (statusIcon->status3.active && !statusIcon->status3.removing) {
1129 statusIcon->status3.removing = statusIcon->status3.active;
1130 statusIcon->status3.removingTask = TRUE;
1131 statusIcon->status3.active = FALSE;
1132 statusIcon->status3.activeTask = FALSE;
1133 statusIcon->status3.frameCounter = 10;
1134 statusIcon->status3.removingElementID = statusIcon->status3.activeElementID;
1135 }
1136}
1137
1139 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1140
1141 statusIcon->flags |= STATUS_ICON_FLAG_TRANSPARENT;
1142}
1143
1144void create_status_chill_out(s32 iconID) {
1145 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1146
1147 statusIcon->flags &= ~STATUS_ICON_FLAG_STATUS_CHILL_OUT;
1148 if (!statusIcon->status4.active) {
1149 statusIcon->status4.active = TRUE;
1150 statusIcon->status4.activeTask = TRUE;
1151 }
1152}
1153
1154void remove_status_chill_out(s32 iconID) {
1155 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1156
1157 if (statusIcon->status4.active && !statusIcon->status4.removing) {
1158 statusIcon->status4.removing = statusIcon->status4.active;
1159 statusIcon->status4.removingTask = TRUE;
1160 statusIcon->status4.active = FALSE;
1161 statusIcon->status4.activeTask = FALSE;
1162 statusIcon->status4.frameCounter = 10;
1163 statusIcon->status4.removingElementID = statusIcon->status4.activeElementID;
1164 }
1165}
1166
1167void enable_status_chill_out(s32 iconID) {
1168 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1169
1171}
1172
1174 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1175 s32 hudElement;
1176
1177 statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_JUMP;
1178 if (!statusIcon->boostJump.active) {
1179 statusIcon->boostJump.active = TRUE;
1183 statusIcon->boostJump.activeElementID = hudElement;
1184 }
1185}
1186
1188 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1189
1190 if (statusIcon->boostJump.active) {
1191 s32 hudElemIndex = statusIcon->boostJump.activeElementID;
1192 statusIcon->boostJump.active = FALSE;
1193 statusIcon->boostJump.removing = TRUE;
1194 statusIcon->prevIndexBoostJump = hudElemIndex;
1196 }
1197}
1198
1200 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1201
1202 statusIcon->flags |= STATUS_ICON_FLAG_BOOST_JUMP;
1203}
1204
1206 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1207 s32 hudElement;
1208
1209 statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_HAMMER;
1210 if (!statusIcon->boostHammer.active) {
1211 statusIcon->boostHammer.active = TRUE;
1215 statusIcon->boostHammer.activeElementID = hudElement;
1216 }
1217}
1218
1220 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1221
1222 if (statusIcon->boostHammer.active) {
1223 s32 hudElemIndex = statusIcon->boostHammer.activeElementID;
1224 statusIcon->boostHammer.active = FALSE;
1225 statusIcon->boostHammer.removing = FALSE;
1226 statusIcon->prevIndexBoostHammer = hudElemIndex;
1228 }
1229}
1230
1232 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1233
1234 statusIcon->flags |= STATUS_ICON_FLAG_BOOST_HAMMER;
1235}
1236
1238 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1239 s32 hudElement;
1240
1241 statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_PARTNER;
1242 if (!statusIcon->boostPartner.active) {
1243 statusIcon->boostPartner.active = TRUE;
1244 hudElement = hud_element_create(&HES_BoostPartner);
1247 statusIcon->boostPartner.activeElementID = hudElement;
1248 }
1249}
1250
1252 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1253
1254 if (statusIcon->boostPartner.active) {
1255 statusIcon->boostPartner.active = FALSE;
1257 }
1258}
1259
1261 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1262
1264}
1265
1267 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1268 s32 hudElement;
1269
1270 statusIcon->flags &= ~STATUS_ICON_FLAG_SURPRISE;
1271 if (!statusIcon->surprise.active) {
1272 statusIcon->surprise.active = TRUE;
1273 hudElement = hud_element_create(&HES_Surprise);
1276 statusIcon->surprise.activeElementID = hudElement;
1277 }
1278}
1279
1281 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1282
1283 if (statusIcon->surprise.active) {
1284 statusIcon->surprise.active = FALSE;
1286 }
1287}
1288
1290 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1291
1292 statusIcon->flags |= STATUS_ICON_FLAG_SURPRISE;
1293}
1294
1296 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1297 s32 hudElement;
1298
1299 statusIcon->flags &= ~STATUS_ICON_FLAG_PERIL;
1300 if (!statusIcon->peril.active) {
1301 statusIcon->peril.active = TRUE;
1302 hudElement = hud_element_create(&HES_Peril);
1305 statusIcon->peril.activeElementID = hudElement;
1306 }
1307}
1308
1310 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1311
1312 if (statusIcon->peril.active) {
1313 statusIcon->peril.active = FALSE;
1315 }
1316}
1317
1319 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1320
1321 statusIcon->flags |= STATUS_ICON_FLAG_PERIL;
1322}
1323
1325 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1326 s32 hudElement;
1327
1328 statusIcon->flags &= ~STATUS_ICON_FLAG_DANGER;
1329 if (!statusIcon->danger.active) {
1330 statusIcon->danger.active = TRUE;
1331 hudElement = hud_element_create(&HES_Danger);
1334 statusIcon->danger.activeElementID = hudElement;
1335 }
1336}
1337
1339 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1340
1341 if (statusIcon->danger.active) {
1342 statusIcon->danger.active = FALSE;
1344 }
1345}
1346
1348 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1349
1350 statusIcon->flags |= STATUS_ICON_FLAG_DANGER;
1351}
1352
u32 pressedButtons[4]
PopupMessageCallback updateFunc
PopupMessageCallback renderUIFunc
PopupMessageCallback renderWorldFunc
union PopupMessage::@39 data
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:4155
@ BTL_MSG_STATE_POPUP_POST_DELAY
Definition enums.h:4154
@ BTL_MSG_STATE_INIT
Definition enums.h:4150
@ BTL_MSG_STATE_POPUP_PRE_DELAY
Definition enums.h:4152
@ BTL_MSG_STATE_POPUP_DELAY
Definition enums.h:4153
@ BUTTON_A
Definition enums.h:2790
@ BUTTON_B
Definition enums.h:2789
@ WINDOW_PRIORITY_0
Definition enums.h:3182
@ MSG_PAL_0F
Definition enums.h:5420
@ WINDOW_UPDATE_SHOW
Definition enums.h:5311
@ WINDOW_UPDATE_HIDE
Definition enums.h:5312
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2210
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ CONTEXT_BATTLE
Definition enums.h:3530
@ CONTEXT_WORLD
Definition enums.h:3529
@ WIN_BTL_POPUP
Definition enums.h:5250
s32 create_worker_world(WorldArgs, WorldArgs)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:410
void set_window_update(s32 panelID, s32)
Definition windows.c:434
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:1979
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)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
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:74
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:80
@ HUD_ELEMENT_FLAG_ANIMATION_FINISHED
Definition hud_element.h:75
s32 HudScript[]
Definition hud_element.h:9
#define SCREEN_WIDTH
Definition macros.h:105
#define BSS
Definition macros.h:7
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define SCREEN_HEIGHT
Definition macros.h:106
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
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
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:32
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
s32 gCurrentCameraID
Definition cam_math.c:4