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

Go to the source code of this file.

Functions

void N update (void)
 

Variables

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

Function Documentation

◆ update()

void N update ( void )

Definition at line 60 of file dizzy_shell.c.

60 {
61 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
62 BattleStatus* battleStatus = &gBattleStatus;
63 s32 id;
64 s32 cutoff;
65 s32 fillLevel;
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 actionCommandStatus->state = 1;
84 break;
85 case 1:
87 actionCommandStatus->hudPosX += 20;
88 if (actionCommandStatus->hudPosX > 50) {
89 actionCommandStatus->hudPosX = 50;
90 }
91 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
92 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
93 break;
94 case 10:
96 if (actionCommandStatus->prepareTime != 0) {
97 actionCommandStatus->prepareTime--;
98 return;
99 }
100 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
101 actionCommandStatus->barFillLevel = 0;
102 actionCommandStatus->frameCounter = actionCommandStatus->duration;
104 actionCommandStatus->state = 11;
105 case 11:
107 if (!actionCommandStatus->isBarFilled) {
108 if (actionCommandStatus->targetWeakness != 0) {
109 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
110
111 actionCommandStatus->barFillLevel -= D_802A9800_426970[actionCommandStatus->barFillLevel / cutoff / 20];
112 if (actionCommandStatus->barFillLevel < 0) {
113 actionCommandStatus->barFillLevel = 0;
114 }
115 } else {
116 actionCommandStatus->barFillLevel -= 10;
117 if (actionCommandStatus->barFillLevel < 0) {
118 actionCommandStatus->barFillLevel = 0;
119 }
120 }
121 }
122
123 if (battleStatus->curButtonsPressed & BUTTON_A) {
124 s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty];
125 s32 b = actionCommandStatus->targetWeakness * 850;
126 s32 temp_v1_2 = (a * b) / 10000;
127
128 if (temp_v1_2 != 0) {
129 actionCommandStatus->barFillLevel += temp_v1_2;
130 } else {
131 actionCommandStatus->barFillLevel += 100;
132 if (actionCommandStatus->barFillLevel >= 500) {
133 actionCommandStatus->barFillLevel = 500;
134 }
135 }
136 }
137
138 if (actionCommandStatus->barFillLevel >= 10000) {
139 id = actionCommandStatus->hudElements[2];
140 actionCommandStatus->barFillLevel = 10000;
141 actionCommandStatus->isBarFilled = TRUE;
142 hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28);
144 }
145
146 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
148
149 if (actionCommandStatus->frameCounter != 0) {
150 actionCommandStatus->frameCounter--;
151 return;
152 }
153
154 fillLevel = actionCommandStatus->barFillLevel;
155 if (actionCommandStatus->targetWeakness == 0) {
156 fillLevel = 0;
157 }
158
159 if (fillLevel == 0) {
160 battleStatus->actionSuccess = -1;
161 } else {
162 battleStatus->actionSuccess = fillLevel / 100;
163
164 }
165
166 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
167 if (battleStatus->actionSuccess >= cutoff) {
168 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
169 } else {
170 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
171 }
172
173 if (battleStatus->actionSuccess == 100) {
175 }
178 actionCommandStatus->frameCounter = 5;
179 actionCommandStatus->state = 12;
180 break;
181 case 12:
182 if (actionCommandStatus->targetWeakness == 0) {
183 actionCommandStatus->barFillLevel -= 100;
184 if (actionCommandStatus->barFillLevel < 0) {
185 actionCommandStatus->barFillLevel = 0;
186 }
187 }
188
189 if (actionCommandStatus->frameCounter != 0) {
190 actionCommandStatus->frameCounter--;
191 return;
192 }
194 break;
195 }
196}
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
s32 D_802A9800_426970[8]
Definition dizzy_shell.c:7
@ 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

Variable Documentation

◆ D_802A9800_426970

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

Definition at line 7 of file dizzy_shell.c.

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

Referenced by update().

◆ actionCmdTableDizzyShell

s32 actionCmdTableDizzyShell[]
extern

Definition at line 35 of file action_cmd.c.

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