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

Go to the source code of this file.

Functions

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

Variables

s32 D_802A9852_4292C0 [] = { 0, 25, 50, 75, 75, 0, 0, 0 }
 
BSS s32 air_lift_bss_0
 
s32 actionCmdTableAirLift []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 89 of file air_lift.c.

89 {
90 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
91 BattleStatus* battleStatus = &gBattleStatus;
92 s32 id;
93
94 switch (actionCommandStatus->state) {
95 case 0:
97
98 id = actionCommandStatus->hudElements[0];
99 hud_element_set_alpha(id, 255);
100 if (actionCommandStatus->showHud) {
102 }
103
104 id = actionCommandStatus->hudElements[1];
105 hud_element_set_alpha(id, 255);
106 if (actionCommandStatus->showHud) {
108 }
109
110 actionCommandStatus->state = 1;
111 break;
112 case 1:
114
115 if (actionCommandStatus->hudPrepareTime != 0) {
116 actionCommandStatus->hudPrepareTime--;
117 return;
118 }
119
120 actionCommandStatus->hudPosX += 20;
121 if (actionCommandStatus->hudPosX > 50) {
122 actionCommandStatus->hudPosX = 50;
123 }
124
125 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
126 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
127 break;
128 case 10:
130
131 if (actionCommandStatus->prepareTime != 0) {
132 actionCommandStatus->prepareTime--;
133 return;
134 }
135
136 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
137 air_lift_bss_0 = 1;
138 actionCommandStatus->frameCounter = actionCommandStatus->duration;
140 actionCommandStatus->state = 11;
141 // fallthrough
142 case 11:
144 if (!actionCommandStatus->isBarFilled) {
145 if (actionCommandStatus->unk_5A != 0) {
146 s32 a = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
147
148 actionCommandStatus->barFillLevel -= D_802A9852_4292C0[actionCommandStatus->barFillLevel / a / 20];
149 if (actionCommandStatus->barFillLevel < 0) {
150 actionCommandStatus->barFillLevel = 0;
151 }
152 } else {
153 actionCommandStatus->barFillLevel -= 10;
154 if (actionCommandStatus->barFillLevel < 0) {
155 actionCommandStatus->barFillLevel = 0;
156 }
157 }
158 }
159
160 if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) {
161 if (actionCommandStatus->unk_5A != 0) {
162 s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty];
163 s32 b = actionCommandStatus->unk_5A * 820;
164
165 actionCommandStatus->barFillLevel += (a * b) / 10000;
166 } else {
167 actionCommandStatus->barFillLevel += 100;
168 if (actionCommandStatus->barFillLevel >= 500) {
169 actionCommandStatus->barFillLevel = 500;
170 }
171 }
172
173 }
174
175 if (actionCommandStatus->barFillLevel > 10000) {
176 actionCommandStatus->barFillLevel = 10000;
177 actionCommandStatus->isBarFilled = TRUE;
178 id = actionCommandStatus->hudElements[2];
179 hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28);
181 }
182
183 battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100;
184 if (battleStatus->actionQuality < battleStatus->actionSuccess) {
185 battleStatus->actionQuality = battleStatus->actionSuccess;
186 }
188
189 if (actionCommandStatus->frameCounter != 0) {
190 actionCommandStatus->frameCounter--;
191 return;
192 }
193
194 if (actionCommandStatus->unk_5A == 0) {
195 battleStatus->actionQuality = 0;
196 }
197
198 battleStatus->actionSuccess = battleStatus->actionQuality;
199 if (rand_int(99) < battleStatus->actionSuccess) {
200 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
201 battleStatus->actionSuccess = 1;
202 } else {
203 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
204 battleStatus->actionSuccess = -1;
205 }
206
207 if (battleStatus->actionSuccess == 1) {
209 }
212 actionCommandStatus->frameCounter = 20;
213 actionCommandStatus->state = 12;
214 break;
215 case 12:
216 if (actionCommandStatus->unk_5A == 0) {
217 actionCommandStatus->barFillLevel -= 100;
218 if (actionCommandStatus->barFillLevel < 0) {
219 actionCommandStatus->barFillLevel = 0;
220 }
221 }
222 if (actionCommandStatus->frameCounter != 0) {
223 actionCommandStatus->frameCounter--;
224 return;
225 }
227 break;
228 }
229}
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
@ ACTION_COMMAND_MODE_NOT_LEARNED
Definition action_cmd.h:38
BSS s32 air_lift_bss_0
Definition air_lift.c:9
s32 D_802A9852_4292C0[]
Definition air_lift.c:7
#define rand_int
@ BUTTON_A
Definition enums.h:2790
@ 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.
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
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 231 of file air_lift.c.

231 {
232 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
233 s32 hudX;
234 s32 hudY;
235 s32 hudElement1;
236
238 hud_element_draw_clipped(actionCommandStatus->hudElements[0]);
239 }
240
241 hudElement1 = actionCommandStatus->hudElements[1];
242 hud_element_draw_clipped(hudElement1);
243 hud_element_get_render_pos(hudElement1, &hudX, &hudY);
244
245 if (air_lift_bss_0 == 0) {
246 draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 1);
247 } else if (!actionCommandStatus->isBarFilled) {
248 draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 4);
249 } else {
250 draw_mash_meter_blink_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 4);
251 }
252
253 hud_element_draw_clipped(actionCommandStatus->hudElements[2]);
254}
void draw_mash_meter_blink_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor)
Definition action_cmd.c:251
void draw_mash_meter_multicolor_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor)
Definition action_cmd.c:231
void hud_element_get_render_pos(s32 id, s32 *x, s32 *y)
void hud_element_draw_clipped(s32 id)

Variable Documentation

◆ D_802A9852_4292C0

s32 D_802A9852_4292C0[] = { 0, 25, 50, 75, 75, 0, 0, 0 }

Definition at line 7 of file air_lift.c.

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

Referenced by update().

◆ air_lift_bss_0

BSS s32 air_lift_bss_0

Definition at line 9 of file air_lift.c.

Referenced by draw(), and update().

◆ actionCmdTableAirLift

s32 actionCmdTableAirLift[]
extern

Definition at line 40 of file action_cmd.c.

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