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

Go to the source code of this file.

Functions

void N update (void)
 
void N draw (void)
 
void N free (void)
 

Variables

s32 actionCmdTableBodySlam []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 61 of file body_slam.c.

61 {
62 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
63 BattleStatus* battleStatus = &gBattleStatus;
64 s32 id;
65 s32 phi_v0;
66
67 switch (actionCommandStatus->state) {
68 case 0:
70
71 id = actionCommandStatus->hudElements[0];
72 hud_element_set_alpha(id, 255);
73 if (actionCommandStatus->showHud) {
75 }
76
77 id = actionCommandStatus->hudElements[1];
78 hud_element_set_alpha(id, 255);
79 if (actionCommandStatus->showHud) {
81 }
82
83 id = actionCommandStatus->hudElements[2];
84 hud_element_set_alpha(id, 255);
85 if (actionCommandStatus->showHud) {
87 }
88
89 id = actionCommandStatus->hudElements[3];
90 hud_element_set_alpha(id, 255);
91 if (actionCommandStatus->showHud) {
93 }
94
95 actionCommandStatus->state = 1;
96 break;
97 case 1:
99 actionCommandStatus->hudPosX += 20;
100 if (actionCommandStatus->hudPosX > 50) {
101 actionCommandStatus->hudPosX = 50;
102 }
103 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
104 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
105 hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 41, actionCommandStatus->hudPosY + 22);
106 hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 42, actionCommandStatus->hudPosY + 24);
107 break;
108 case 10:
110 if (actionCommandStatus->prepareTime != 0) {
111 actionCommandStatus->prepareTime--;
112 return;
113 }
114 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown);
115 actionCommandStatus->barFillLevel = 0;
116 actionCommandStatus->thresholdLevel = 0;
117 actionCommandStatus->frameCounter = actionCommandStatus->duration;
119 actionCommandStatus->state = 11;
120 case 11:
122
123 if (battleStatus->curButtonsDown & BUTTON_A) {
124 actionCommandStatus->barFillLevel += 154;
125 actionCommandStatus->thresholdLevel += 154;
126 } else {
127 actionCommandStatus->frameCounter = 0;
128 }
129
130 if (actionCommandStatus->barFillLevel >= 10000) {
131 actionCommandStatus->barFillLevel = 10000;
132 hud_element_set_script(actionCommandStatus->hudElements[2], &HES_TimingReady);
133 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButton);
134 if (!actionCommandStatus->isBarFilled) {
136 actionCommandStatus->isBarFilled = TRUE;
137 }
138 }
139
140 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
142 if (actionCommandStatus->frameCounter != 0) {
143 actionCommandStatus->frameCounter--;
144 return;
145 }
146
147 if (actionCommandStatus->thresholdLevel < 10000) {
148 battleStatus->actionSuccess = -1;
149 } else if (actionCommandStatus->thresholdLevel - (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 154) >= 10309) {
150 battleStatus->actionSuccess = -1;
151 } else {
152 battleStatus->actionSuccess = 1;
153 }
154
155 battleStatus->actionResult = ACTION_RESULT_FAIL;
156 if (battleStatus->actionSuccess == 1) {
158 }
161 actionCommandStatus->frameCounter = 5;
162 actionCommandStatus->state = 12;
163 break;
164 case 12:
165 if (actionCommandStatus->frameCounter != 0) {
166 actionCommandStatus->frameCounter--;
167 return;
168 }
170 break;
171 }
172}
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_AButton
HudScript HES_TimingReady
HudScript HES_AButtonDown
@ BUTTON_A
Definition enums.h:2790
@ SOUND_TIMING_BAR_GO
Definition enums.h:953
@ SOUND_LOOP_CHARGE_BAR
Definition enums.h:1646
@ ACTION_RESULT_FAIL
Definition enums.h:1967
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.
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
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 174 of file body_slam.c.

174 {
175 s32 x, y;
176 s32 hudElement;
177
179 hudElement = gActionCommandStatus.hudElements[1];
180 hud_element_draw_clipped(hudElement);
181 hud_element_get_render_pos(hudElement, &x, &y);
185}
void draw_mash_meter_multicolor(s32 posX, s32 posY, s32 fillValue)
Definition action_cmd.c:226
void hud_element_get_render_pos(s32 id, s32 *x, s32 *y)
void hud_element_draw_clipped(s32 id)

◆ free()

Variable Documentation

◆ actionCmdTableBodySlam

s32 actionCmdTableBodySlam[]
extern

Definition at line 39 of file action_cmd.c.

39{ 9, 8, 7, 6, 5, 4, 3, 2 };