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

Go to the source code of this file.

Functions

 INCLUDE_IMG ("battle/action_cmd/whirlwind_1.png", battle_action_cmd_whirlwind_1_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_1.pal", battle_action_cmd_whirlwind_1_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_2.png", battle_action_cmd_whirlwind_2_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_2.pal", battle_action_cmd_whirlwind_2_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_3.png", battle_action_cmd_whirlwind_3_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_3.pal", battle_action_cmd_whirlwind_3_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_4.png", battle_action_cmd_whirlwind_4_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_4.pal", battle_action_cmd_whirlwind_4_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_5.png", battle_action_cmd_whirlwind_5_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_5.pal", battle_action_cmd_whirlwind_5_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_6.png", battle_action_cmd_whirlwind_6_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_6.pal", battle_action_cmd_whirlwind_6_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_7.png", battle_action_cmd_whirlwind_7_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_7.pal", battle_action_cmd_whirlwind_7_pal)
 
 INCLUDE_IMG ("battle/action_cmd/whirlwind_bubble.png", battle_action_cmd_whirlwind_bubble_png)
 
 INCLUDE_PAL ("battle/action_cmd/whirlwind_bubble.pal", battle_action_cmd_whirlwind_bubble_pal)
 
void N update (void)
 
void N draw (void)
 
void N free (void)
 

Variables

HudScript HES_Whirlwind1 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_1, 24, 24)
 
HudScript HES_Whirlwind2 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_2, 24, 24)
 
HudScript HES_Whirlwind3 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_3, 24, 24)
 
HudScript HES_Whirlwind4 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_4, 24, 24)
 
HudScript HES_Whirlwind5 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_5, 24, 24)
 
HudScript HES_Whirlwind6 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_6, 24, 24)
 
HudScript HES_Whirlwind7 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_7, 24, 24)
 
HudScript HES_WhirlwindBubble
 
s32 D_802AA844_4254B4 [] = { 0, 25, 50, 75, 100, 100 }
 
s32 D_802AA85C_4254CC [] = { 50, 50, 50, 50, 75, 75, 75, 100, 100, 100, 100 }
 
HudScriptD_802AA888_4254F8 []
 
HudScriptD_802AA8A0_425510 []
 
s32 D_802AA8B4_425524 [] = { 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 }
 
s32 actionCmdTableWhirlwind []
 

Function Documentation

◆ INCLUDE_IMG() [1/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_1.png" ,
battle_action_cmd_whirlwind_1_png  )

◆ INCLUDE_PAL() [1/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_1.pal" ,
battle_action_cmd_whirlwind_1_pal  )

◆ INCLUDE_IMG() [2/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_2.png" ,
battle_action_cmd_whirlwind_2_png  )

◆ INCLUDE_PAL() [2/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_2.pal" ,
battle_action_cmd_whirlwind_2_pal  )

◆ INCLUDE_IMG() [3/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_3.png" ,
battle_action_cmd_whirlwind_3_png  )

◆ INCLUDE_PAL() [3/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_3.pal" ,
battle_action_cmd_whirlwind_3_pal  )

◆ INCLUDE_IMG() [4/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_4.png" ,
battle_action_cmd_whirlwind_4_png  )

◆ INCLUDE_PAL() [4/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_4.pal" ,
battle_action_cmd_whirlwind_4_pal  )

◆ INCLUDE_IMG() [5/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_5.png" ,
battle_action_cmd_whirlwind_5_png  )

◆ INCLUDE_PAL() [5/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_5.pal" ,
battle_action_cmd_whirlwind_5_pal  )

◆ INCLUDE_IMG() [6/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_6.png" ,
battle_action_cmd_whirlwind_6_png  )

◆ INCLUDE_PAL() [6/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_6.pal" ,
battle_action_cmd_whirlwind_6_pal  )

◆ INCLUDE_IMG() [7/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_7.png" ,
battle_action_cmd_whirlwind_7_png  )

◆ INCLUDE_PAL() [7/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_7.pal" ,
battle_action_cmd_whirlwind_7_pal  )

◆ INCLUDE_IMG() [8/8]

INCLUDE_IMG ( "battle/action_cmd/whirlwind_bubble.png" ,
battle_action_cmd_whirlwind_bubble_png  )

◆ INCLUDE_PAL() [8/8]

INCLUDE_PAL ( "battle/action_cmd/whirlwind_bubble.pal" ,
battle_action_cmd_whirlwind_bubble_pal  )

◆ update()

void N update ( void )

Definition at line 151 of file whirlwind.c.

151 {
152 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
153 BattleStatus* battleStatus = &gBattleStatus;
154 s32 id;
155 s32 cutoff;
156 s32 temp;
157 s32 amt;
158
159 switch (actionCommandStatus->state) {
160 case 0:
162
163 id = actionCommandStatus->hudElements[0];
164 if (actionCommandStatus->showHud) {
166 }
167 hud_element_set_alpha(id, 255);
168
169 id = actionCommandStatus->hudElements[1];
170 hud_element_set_alpha(id, 255);
171 if (actionCommandStatus->showHud) {
173 }
174
175 id = actionCommandStatus->hudElements[2];
176 hud_element_set_alpha(id, 255);
177 if (actionCommandStatus->showHud) {
179 }
180
181 id = actionCommandStatus->hudElements[3];
182 hud_element_set_alpha(id, 255);
183 if (actionCommandStatus->showHud) {
185 }
186
187 actionCommandStatus->state = 1;
188 break;
189 case 1:
191 actionCommandStatus->hudPosX += 20;
192 if (actionCommandStatus->hudPosX > 50) {
193 actionCommandStatus->hudPosX = 50;
194 }
195 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
196 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
197 hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 54, actionCommandStatus->hudPosY + 23);
198 hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 60, actionCommandStatus->hudPosY + 23);
199 break;
200 case 10:
202 if (actionCommandStatus->prepareTime != 0) {
203 actionCommandStatus->prepareTime--;
204 return;
205 }
206 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
207 actionCommandStatus->barFillLevel = 0;
208 actionCommandStatus->state = 11;
209 actionCommandStatus->frameCounter = actionCommandStatus->duration;
210 case 11:
212 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
213 temp = actionCommandStatus->barFillLevel / cutoff;
214 if (actionCommandStatus->targetWeakness == 0) {
215 amt = D_802AA844_4254B4[temp / 20];
216 } else {
217 amt = D_802AA85C_4254CC[temp / 10];
218 }
219 actionCommandStatus->barFillLevel -= amt;
220
221 if (actionCommandStatus->barFillLevel < 0) {
222 actionCommandStatus->barFillLevel = 0;
223 }
224
225 if (!actionCommandStatus->berserkerEnabled) {
226 if (battleStatus->curButtonsPressed & BUTTON_A) {
227 s32 amt;
228
229 if (actionCommandStatus->targetWeakness == 0) {
230 amt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 5;
231 } else {
232 amt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 6;
233 }
234 actionCommandStatus->barFillLevel += amt;
235 }
236 } else {
237 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 4;
238 actionCommandStatus->barFillLevel += rand_int(battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 4);
239 }
240
241 if (actionCommandStatus->barFillLevel > cutoff * 100) {
242 actionCommandStatus->barFillLevel = cutoff * 100;
243 }
244 if (!actionCommandStatus->targetWeakness) {
245 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 2000;
246 } else {
247 battleStatus->actionQuality = D_802AA8B4_425524[actionCommandStatus->barFillLevel / 1000];
248 }
249
250 if (actionCommandStatus->frameCounter != 0) {
251 actionCommandStatus->frameCounter--;
252 return;
253 }
254 battleStatus->actionResult = ACTION_RESULT_NONE;
255 battleStatus->actionSuccess = battleStatus->actionQuality;
257 actionCommandStatus->frameCounter = 5;
258 actionCommandStatus->state = 12;
259 break;
260 case 12:
261 if (actionCommandStatus->frameCounter != 0) {
262 actionCommandStatus->frameCounter--;
263 return;
264 }
266 break;
267 }
268}
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void action_command_free(void)
Definition action_cmd.c:446
HudScript HES_MashAButton
s32 D_802AA8B4_425524[]
Definition whirlwind.c:61
s32 D_802AA844_4254B4[]
Definition whirlwind.c:49
s32 D_802AA85C_4254CC[]
Definition whirlwind.c:51
#define rand_int
@ BUTTON_A
Definition enums.h:2790
@ ACTION_RESULT_NONE
Definition enums.h:1963
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

◆ draw()

void N draw ( void )

Definition at line 270 of file whirlwind.c.

270 {
271 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
272 BattleStatus* battleStatus = &gBattleStatus;
273 s32 x, y;
274 s32 id;
275
276 if (!actionCommandStatus->berserkerEnabled) {
277 hud_element_draw_clipped(actionCommandStatus->hudElements[0]);
278 }
279 id = actionCommandStatus->hudElements[1];
281 hud_element_get_render_pos(id, &x, &y);
282
283 draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1);
284 hud_element_draw_clipped(actionCommandStatus->hudElements[3]);
285 id = actionCommandStatus->hudElements[2];
286 if (!actionCommandStatus->targetWeakness) {
287 if (D_802AA888_4254F8[battleStatus->actionQuality] != hud_element_get_script(id)) {
289 }
290 } else {
291 if (D_802AA8A0_425510[battleStatus->actionQuality] != hud_element_get_script(id)) {
293 }
294 }
296}
void draw_mash_meter_multicolor_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor)
Definition action_cmd.c:231
HudScript * D_802AA888_4254F8[]
Definition whirlwind.c:53
HudScript * D_802AA8A0_425510[]
Definition whirlwind.c:57
void hud_element_get_render_pos(s32 id, s32 *x, s32 *y)
HudScript * hud_element_get_script(s32 id)
void hud_element_draw_clipped(s32 id)

◆ free()

Variable Documentation

◆ HES_Whirlwind1

HudScript HES_Whirlwind1 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_1, 24, 24)

Definition at line 32 of file whirlwind.c.

◆ HES_Whirlwind2

HudScript HES_Whirlwind2 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_2, 24, 24)

Definition at line 34 of file whirlwind.c.

◆ HES_Whirlwind3

HudScript HES_Whirlwind3 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_3, 24, 24)

Definition at line 36 of file whirlwind.c.

◆ HES_Whirlwind4

HudScript HES_Whirlwind4 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_4, 24, 24)

Definition at line 38 of file whirlwind.c.

◆ HES_Whirlwind5

HudScript HES_Whirlwind5 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_5, 24, 24)

Definition at line 40 of file whirlwind.c.

◆ HES_Whirlwind6

HudScript HES_Whirlwind6 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_6, 24, 24)

Definition at line 42 of file whirlwind.c.

◆ HES_Whirlwind7

HudScript HES_Whirlwind7 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_7, 24, 24)

Definition at line 44 of file whirlwind.c.

◆ HES_WhirlwindBubble

HudScript HES_WhirlwindBubble
Initial value:
= HES_TEMPLATE_CI_CUSTOM_SIZE(battle_action_cmd_whirlwind_bubble,
battle_action_cmd_whirlwind_bubble_png_width, battle_action_cmd_whirlwind_bubble_png_height)
#define HES_TEMPLATE_CI_CUSTOM_SIZE(name, sizeX, sizeY)
Basic HudScript used for static CI images, setting size with hs_SetCustomSize.

Definition at line 46 of file whirlwind.c.

◆ D_802AA844_4254B4

s32 D_802AA844_4254B4[] = { 0, 25, 50, 75, 100, 100 }

Definition at line 49 of file whirlwind.c.

49{ 0, 25, 50, 75, 100, 100 };

Referenced by update().

◆ D_802AA85C_4254CC

s32 D_802AA85C_4254CC[] = { 50, 50, 50, 50, 75, 75, 75, 100, 100, 100, 100 }

Definition at line 51 of file whirlwind.c.

51{ 50, 50, 50, 50, 75, 75, 75, 100, 100, 100, 100 };

Referenced by update().

◆ D_802AA888_4254F8

HudScript* D_802AA888_4254F8[]
Initial value:
= {
}
HudScript HES_Whirlwind6
Definition whirlwind.c:42
HudScript HES_Whirlwind4
Definition whirlwind.c:38
HudScript HES_Whirlwind2
Definition whirlwind.c:34
HudScript HES_Whirlwind7
Definition whirlwind.c:44
HudScript HES_Whirlwind3
Definition whirlwind.c:36
HudScript HES_Whirlwind5
Definition whirlwind.c:40

Definition at line 53 of file whirlwind.c.

Referenced by draw().

◆ D_802AA8A0_425510

HudScript* D_802AA8A0_425510[]
Initial value:

Definition at line 57 of file whirlwind.c.

Referenced by draw().

◆ D_802AA8B4_425524

s32 D_802AA8B4_425524[] = { 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 }

Definition at line 61 of file whirlwind.c.

61{ 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 };

Referenced by update().

◆ actionCmdTableWhirlwind

s32 actionCmdTableWhirlwind[]
extern

Definition at line 32 of file action_cmd.c.

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