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

Go to the source code of this file.

Functions

void N update (void)
 

Variables

s32 actionCmdTable0A []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 58 of file 0A.c.

58 {
59 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
60 BattleStatus* battleStatus = &gBattleStatus;
61 s32 id;
62 s32 cutoff;
63
64 switch (actionCommandStatus->state) {
65 case 0:
67
68 id = actionCommandStatus->hudElements[0];
69 hud_element_set_alpha(id, 255);
70 if (actionCommandStatus->showHud) {
72 }
73
74 id = actionCommandStatus->hudElements[1];
75 hud_element_set_alpha(id, 255);
76 if (actionCommandStatus->showHud) {
78 }
79
80 actionCommandStatus->state = 1;
81 break;
82 case 1:
84
85 actionCommandStatus->hudPosX += 20;
86 if (actionCommandStatus->hudPosX > 50) {
87 actionCommandStatus->hudPosX = 50;
88 }
89
90 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
91 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
92 break;
93 case 10:
95
96 if (actionCommandStatus->prepareTime != 0) {
97 actionCommandStatus->prepareTime--;
98 return;
99 }
100
101 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
102 actionCommandStatus->barFillLevel = 0;
103 actionCommandStatus->state = 11;
104 actionCommandStatus->frameCounter = actionCommandStatus->duration;
105 // fallthrough
106 case 11:
108
109 if (battleStatus->curButtonsPressed & BUTTON_A) {
110 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 15;
111 }
112
113 if (actionCommandStatus->barFillLevel >= 10000) {
114 id = actionCommandStatus->hudElements[2];
115 actionCommandStatus->barFillLevel = 10000;
116 actionCommandStatus->isBarFilled = TRUE;
117 hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28);
119 }
120
121 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
122
123 if (actionCommandStatus->frameCounter != 0) {
124 actionCommandStatus->frameCounter--;
125 return;
126 }
127
128 if (actionCommandStatus->barFillLevel == 0) {
129 battleStatus->actionSuccess = -1;
130 } else {
131 battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100;
132 }
133
134 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
135 if (battleStatus->actionSuccess >= cutoff) {
136 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
137 } else {
138 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
139 }
140
141 if (battleStatus->actionSuccess == 100) {
143 }
144
146 actionCommandStatus->frameCounter = 5;
147 actionCommandStatus->state = 12;
148 break;
149 case 12:
150 if (actionCommandStatus->frameCounter != 0) {
151 actionCommandStatus->frameCounter--;
152 return;
153 }
155 break;
156 }
157}
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void func_80269160(void)
Definition action_cmd.c:655
void action_command_free(void)
Definition action_cmd.c:446
HudScript HES_MashAButton
@ BUTTON_A
Definition enums.h:2790
@ ACTION_RESULT_SUCCESS
Definition enums.h:1968
@ ACTION_RESULT_MINUS_2
Definition enums.h:1965
void btl_set_popup_duration(s32 duration)
void hud_element_set_alpha(s32 id, s32 opacity)
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
void hud_element_clear_flags(s32 id, s32 flags)
Turns off the given flags.
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

Variable Documentation

◆ actionCmdTable0A

s32 actionCmdTable0A[]
extern

Definition at line 37 of file action_cmd.c.

37{ 130, 120, 110, 100, 90, 80, 70, 60 };