Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
squirt.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 D_802A9760_42A480 [] = { 300, 300, 265, 220, 175, 175 }
 
s32 D_802A9778_42A498 [] = { 300, 300, 265, 220, 175, 175 }
 
s32 actionCmdTableSquirt []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 75 of file squirt.c.

75 {
76 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
77 BattleStatus* battleStatus = &gBattleStatus;
78 s32 id;
79 s32 mashMeterCutoff;
80 s32 cutoff;
81 s32 temp;
82
83 switch (actionCommandStatus->state) {
84 case 0:
86
87 id = actionCommandStatus->hudElements[0];
88 if (actionCommandStatus->showHud) {
90 }
91 hud_element_set_alpha(id, 255);
92
93 id = actionCommandStatus->hudElements[1];
94 hud_element_set_alpha(id, 255);
95 if (actionCommandStatus->showHud) {
97 }
98
99 actionCommandStatus->state = 1;
100 break;
101 case 1:
103
104 actionCommandStatus->hudPosX += 20;
105 if (actionCommandStatus->hudPosX > 50) {
106 actionCommandStatus->hudPosX = 50;
107 }
108
109 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX,
110 actionCommandStatus->hudPosY);
111 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX,
112 actionCommandStatus->hudPosY + 28);
113 break;
114 case 10:
116
117 if (actionCommandStatus->prepareTime != 0) {
118 actionCommandStatus->prepareTime--;
119 break;
120 }
121
122 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown);
123 actionCommandStatus->barFillLevel = 0;
124 actionCommandStatus->unk_5C = 0;
125 actionCommandStatus->frameCounter = actionCommandStatus->duration;
127 actionCommandStatus->state = 11;
128 // fallthrough
129 case 11:
131 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
132 temp = actionCommandStatus->barFillLevel / cutoff;
133 if (actionCommandStatus->unk_5C == 0) {
134 if (!(battleStatus->curButtonsDown & BUTTON_A)) {
135 actionCommandStatus->barFillLevel -= D_802A9760_42A480[temp / 20];
136 if (actionCommandStatus->barFillLevel < 0) {
137 actionCommandStatus->barFillLevel = 0;
138 }
139 } else {
140 actionCommandStatus->barFillLevel += D_802A9778_42A498[temp / 20] * battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 100;
141 if (actionCommandStatus->barFillLevel > 10000) {
142 actionCommandStatus->barFillLevel = 10000;
143 actionCommandStatus->unk_5C = 1;
144 }
145 }
146 } else {
147 actionCommandStatus->barFillLevel -= 250;
148 if (actionCommandStatus->barFillLevel <= 0) {
149 actionCommandStatus->barFillLevel = 0;
150 actionCommandStatus->unk_5C = 0;
151 }
152 }
153
154 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
156 id = actionCommandStatus->hudElements[0];
157 if (temp < 80) {
160 }
161 } else {
164 }
165 }
166
167 if (actionCommandStatus->frameCounter != 0) {
168 actionCommandStatus->frameCounter--;
169 return;
170 }
171
172 if (actionCommandStatus->barFillLevel == 0) {
173 battleStatus->actionSuccess = -1;
174 } else {
175 battleStatus->actionSuccess = battleStatus->actionQuality;
176 }
177
178 cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
179 if (cutoff / 2 < battleStatus->actionQuality) {
180 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
181 } else {
182 battleStatus->actionResult = ACTION_RESULT_MINUS_4;
183 }
184
185 if (battleStatus->actionSuccess == 100) {
187 }
190 actionCommandStatus->frameCounter = 5;
191 actionCommandStatus->state = 12;
192 break;
193 case 12:
194 if (actionCommandStatus->frameCounter != 0) {
195 actionCommandStatus->frameCounter--;
196 } else {
198 }
199 break;
200 }
201}
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_PressAButton
HudScript HES_AButtonDown
s32 D_802A9778_42A498[]
Definition squirt.c:7
s32 D_802A9760_42A480[]
Definition squirt.c:6
@ BUTTON_A
Definition enums.h:2790
@ SOUND_LOOP_CHARGE_BAR
Definition enums.h:1646
@ ACTION_RESULT_SUCCESS
Definition enums.h:1968
@ ACTION_RESULT_MINUS_4
Definition enums.h:1964
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)
HudScript * hud_element_get_script(s32 id)
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
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 203 of file squirt.c.

203 {
204 s32 x, y;
205 s32 id;
206 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
207
208 hud_element_draw_clipped(actionCommandStatus->hudElements[0]);
209 id = actionCommandStatus->hudElements[1];
211 hud_element_get_render_pos(id, &x, &y);
212 if (actionCommandStatus->unk_5C == 0) {
213 draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1);
214 } else {
216 }
217}
void draw_mash_meter_multicolor_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor)
Definition action_cmd.c:231
void draw_mash_meter_mode_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor, s32 colorMode)
Definition action_cmd.c:241
@ MASH_METER_MODE_ONE_COLOR
Definition action_cmd.h:33
void hud_element_get_render_pos(s32 id, s32 *x, s32 *y)
void hud_element_draw_clipped(s32 id)

◆ free()

void N free ( void )

Variable Documentation

◆ D_802A9760_42A480

s32 D_802A9760_42A480[] = { 300, 300, 265, 220, 175, 175 }

Definition at line 6 of file squirt.c.

6{ 300, 300, 265, 220, 175, 175 };

Referenced by update().

◆ D_802A9778_42A498

s32 D_802A9778_42A498[] = { 300, 300, 265, 220, 175, 175 }

Definition at line 7 of file squirt.c.

7{ 300, 300, 265, 220, 175, 175 };

Referenced by update().

◆ actionCmdTableSquirt

s32 actionCmdTableSquirt[]
extern

Definition at line 42 of file action_cmd.c.

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