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

Go to the source code of this file.

Functions

void N update (void)
 

Variables

s32 D_802A9860_42F680 [8] = { 0, 25, 50, 75, 75, 0, 0, 0 }
 
BSS s32 D_802A98C0
 
s32 actionCmdTableSpinySurge []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 89 of file spiny_surge.c.

89 {
90 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
91 BattleStatus* battleStatus = &gBattleStatus;
92 s32 id;
93 s32 cutoff;
94
95 switch (actionCommandStatus->state) {
96 case 0:
98
99 id = actionCommandStatus->hudElements[0];
100 hud_element_set_alpha(id, 255);
101 if (actionCommandStatus->showHud) {
103 }
104
105 id = actionCommandStatus->hudElements[1];
106 hud_element_set_alpha(id, 255);
107 if (actionCommandStatus->showHud) {
109 }
110
111 actionCommandStatus->state = 1;
112 break;
113 case 1:
115
116 if (actionCommandStatus->hudPrepareTime != 0) {
117 actionCommandStatus->hudPrepareTime--;
118 break;
119 }
120
121 actionCommandStatus->hudPosX += 20;
122 if (actionCommandStatus->hudPosX > 50) {
123 actionCommandStatus->hudPosX = 50;
124 }
125
126 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX,
127 actionCommandStatus->hudPosY);
128 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX,
129 actionCommandStatus->hudPosY + 28);
130 break;
131 case 10:
133
134 if (actionCommandStatus->prepareTime != 0) {
135 actionCommandStatus->prepareTime--;
136 break;
137 }
138
139 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft);
140 actionCommandStatus->unk_5C = 0;
141 D_802A98C0 = 0;
142 actionCommandStatus->frameCounter = actionCommandStatus->duration;
144 actionCommandStatus->state = 11;
145
146 // fallthrough
147 case 11:
149 if (!actionCommandStatus->isBarFilled) {
150 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
151 actionCommandStatus->barFillLevel -=
152 D_802A9860_42F680[actionCommandStatus->barFillLevel / cutoff / 20];
153
154 if (actionCommandStatus->barFillLevel < 0) {
155 actionCommandStatus->barFillLevel = 0;
156 }
157
158 if (!actionCommandStatus->isBarFilled) {
159 if (battleStatus->curButtonsPressed & BUTTON_STICK_LEFT) {
160 actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100;
161 }
162 if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) {
163 actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100;
164 }
165 }
166 }
167
168 if (actionCommandStatus->barFillLevel < 0) {
169 actionCommandStatus->barFillLevel = 0;
170 }
171
172 if (actionCommandStatus->barFillLevel > 10000) {
173 id = actionCommandStatus->hudElements[2];
174 actionCommandStatus->barFillLevel = 10000;
175 actionCommandStatus->isBarFilled = TRUE;
176 hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28);
178 }
179
181 actionCommandStatus->unk_5C = 1;
182 }
184 actionCommandStatus->unk_5C = -1;
185 }
186
187 if (!(D_802A98C0 & BUTTON_STICK_LEFT) &&
188 !(battleStatus->curButtonsDown & BUTTON_STICK_RIGHT) &&
189 actionCommandStatus->unk_5C == 1)
190 {
191 actionCommandStatus->unk_5C = 2;
192 }
193 battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100;
194 D_802A98C0 = battleStatus->curButtonsDown;
195 battleStatus->actionQuality = actionCommandStatus->unk_5C;
196
198
199 if (actionCommandStatus->frameCounter != 0) {
200 actionCommandStatus->frameCounter--;
201 return;
202 }
203
204 if (actionCommandStatus->barFillLevel == 0) {
205 battleStatus->actionSuccess = -1;
206 } else {
207 battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100;
208 }
209
210 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
211 if (cutoff >= battleStatus->actionSuccess) {
212 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
213 } else {
214 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
215 }
216
217 if (battleStatus->actionSuccess == 100) {
219 }
220
223 actionCommandStatus->frameCounter = 5;
224 actionCommandStatus->state = 12;
225 break;
226 case 12:
227 if (actionCommandStatus->frameCounter != 0) {
228 actionCommandStatus->frameCounter--;
229 } else {
231 }
232 break;
233 }
234}
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_StickMashLeft
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ BUTTON_STICK_RIGHT
Definition enums.h:2794
@ SOUND_LOOP_CHARGE_BAR
Definition enums.h:1646
@ 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.
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:74
void sfx_stop_sound(s32 soundID)
Definition sfx.c:507
void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition sfx.c:492
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition sfx.c:458
BSS s32 D_802A98C0
Definition spiny_surge.c:8
s32 D_802A9860_42F680[8]
Definition spiny_surge.c:6
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

Variable Documentation

◆ D_802A9860_42F680

s32 D_802A9860_42F680[8] = { 0, 25, 50, 75, 75, 0, 0, 0 }

Definition at line 6 of file spiny_surge.c.

6{ 0, 25, 50, 75, 75, 0, 0, 0 };

Referenced by update().

◆ D_802A98C0

BSS s32 D_802A98C0

Definition at line 8 of file spiny_surge.c.

Referenced by update().

◆ actionCmdTableSpinySurge

s32 actionCmdTableSpinySurge[]
extern

Definition at line 46 of file action_cmd.c.

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