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

Go to the source code of this file.

Data Structures

struct  UnkVec2s
 

Functions

void N update (void)
 

Variables

UnkVec2s D_802A99D2_42ED72 []
 
s32 D_802A99E4_42ED84 []
 
s32 D_802A99F4_42ED94 []
 
s32 D_802A9A08_42EDA8 []
 
s32 D_802A9A20_42EDC0 []
 
s32 actionCmdTableSmack []
 

Data Structure Documentation

◆ UnkVec2s

struct UnkVec2s
Data Fields
s16 unk_0
s16 unk_2

Function Documentation

◆ update()

void N update ( void )

Definition at line 86 of file smack.c.

86 {
87 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
88 BattleStatus* battleStatus = &gBattleStatus;
89 Actor* partnerActor = battleStatus->partnerActor;
90
91 s32 mashMeterCutoff;
92 s32 hudElement;
93
94 switch (actionCommandStatus->state) {
95 case 0:
97 hudElement = actionCommandStatus->hudElements[0];
98 hud_element_set_alpha(hudElement, 255);
99 if (actionCommandStatus->showHud) {
101 }
102 hudElement = actionCommandStatus->hudElements[1];
103 hud_element_set_alpha(hudElement, 255);
104 if (actionCommandStatus->showHud) {
106 }
107 actionCommandStatus->state = 1;
108 break;
109 case 1:
111 if (actionCommandStatus->hudPrepareTime != 0) {
112 actionCommandStatus->hudPrepareTime--;
113 break;
114 }
115
116 actionCommandStatus->hudPosX += 20;
117 if (actionCommandStatus->hudPosX > 50) {
118 actionCommandStatus->hudPosX = 50;
119 }
120
121 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX,
122 actionCommandStatus->hudPosY);
123 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX,
124 actionCommandStatus->hudPosY + 28);
125 break;
126 case 10:
128 if (actionCommandStatus->prepareTime != 0) {
129 actionCommandStatus->prepareTime--;
130 break;
131 }
132 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft);
133 actionCommandStatus->barFillLevel = 0;
134 battleStatus->unk_85 = 0;
135 actionCommandStatus->unk_5C = 0;
136 actionCommandStatus->frameCounter = actionCommandStatus->duration;
138 actionCommandStatus->state = 11;
139
140 // fallthrough
141 case 11:
143 if (!actionCommandStatus->isBarFilled) {
144 s32 index;
145 mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
146 actionCommandStatus->barFillLevel -=
147 D_802A99D2_42ED72[actionCommandStatus->barFillLevel / mashMeterCutoff / 20].unk_2;
148
149 if (actionCommandStatus->barFillLevel < 0) {
150 actionCommandStatus->barFillLevel = 0;
151 }
152
153 if (!actionCommandStatus->isBarFilled) {
154 if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) {
155 actionCommandStatus->unk_5C = TRUE;
156 }
157
158 if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) {
159 if (actionCommandStatus->targetWeakness == 0) {
160 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 13;
161 } else {
162 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850 / 100;
163 }
164
165 actionCommandStatus->unk_5C = 0;
166 }
167
168 if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) {
169 actionCommandStatus->barFillLevel -= battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 11;
170 }
171 }
172 }
173
174 if (actionCommandStatus->barFillLevel < 0) {
175 actionCommandStatus->barFillLevel = 0;
176 }
177
178 if (actionCommandStatus->barFillLevel > 10000) {
179 hudElement = actionCommandStatus->hudElements[2];
180 actionCommandStatus->barFillLevel = 10000;
181 actionCommandStatus->isBarFilled = TRUE;
182 hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50,
183 actionCommandStatus->hudPosY + 28);
185 }
186
187 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
189
190 switch (partnerActor->actorBlueprint->level) {
192 if (battleStatus->actionQuality >= D_802A99E4_42ED84[battleStatus->unk_85]) {
193 battleStatus->unk_85++;
194 }
195
196 if (battleStatus->unk_85 > 0) {
197 if (battleStatus->actionQuality < D_802A99E4_42ED84[battleStatus->unk_85 - 1]) {
198 battleStatus->unk_85--;
199 }
200 }
201 break;
203 if (battleStatus->actionQuality >= D_802A99F4_42ED94[battleStatus->unk_85]) {
204 battleStatus->unk_85++;
205 }
206
207 if (battleStatus->unk_85 > 0) {
208 if (battleStatus->actionQuality < D_802A99F4_42ED94[battleStatus->unk_85 - 1]) {
209 battleStatus->unk_85--;
210 }
211 }
212 break;
214 if (actionCommandStatus->targetWeakness == 0) {
215 if (battleStatus->actionQuality >= D_802A9A08_42EDA8[battleStatus->unk_85]) {
216 battleStatus->unk_85++;
217 }
218
219 if (battleStatus->unk_85 > 0) {
220 if (battleStatus->actionQuality < D_802A9A08_42EDA8[battleStatus->unk_85 - 1]) {
221 battleStatus->unk_85--;
222 }
223 }
224 } else {
225 if (battleStatus->actionQuality >= D_802A9A20_42EDC0[battleStatus->unk_85]) {
226 battleStatus->unk_85++;
227 }
228
229 if (battleStatus->unk_85 > 0) {
230 if (battleStatus->actionQuality < D_802A9A20_42EDC0[battleStatus->unk_85 - 1]) {
231 battleStatus->unk_85--;
232 }
233 }
234 }
235 break;
236 }
237
238 if (actionCommandStatus->frameCounter == 0) {
239 s32 mashMeterCutoff;
240
241 if (actionCommandStatus->barFillLevel == 0) {
242 battleStatus->actionSuccess = -1;
243 } else {
244 mashMeterCutoff = actionCommandStatus->barFillLevel;
245 battleStatus->actionSuccess = mashMeterCutoff / 100;
246 }
247
248 mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
249 if (mashMeterCutoff < battleStatus->actionSuccess) {
250 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
251 } else {
252 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
253 }
254
255 if (battleStatus->actionSuccess == 100) {
257 }
258
261 actionCommandStatus->frameCounter = 5;
262 actionCommandStatus->state = 12;
263 break;
264 }
265
266 actionCommandStatus->frameCounter--;
267 break;
268 case 12:
269 if (actionCommandStatus->frameCounter != 0) {
270 actionCommandStatus->frameCounter--;
271 break;
272 }
274 break;
275 }
276}
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_StickMashLeft
struct ActorBlueprint * actorBlueprint
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ BUTTON_STICK_RIGHT
Definition enums.h:2794
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_RANK_SUPER
Definition enums.h:2019
@ PARTNER_RANK_ULTRA
Definition enums.h:2020
@ 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.
@ 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 D_802A9A08_42EDA8[]
Definition smack.c:27
UnkVec2s D_802A99D2_42ED72[]
Definition smack.c:11
s32 D_802A9A20_42EDC0[]
Definition smack.c:31
s32 D_802A99F4_42ED94[]
Definition smack.c:23
s32 D_802A99E4_42ED84[]
Definition smack.c:19
s16 unk_2
Definition smack.c:8
struct Actor * partnerActor
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

Variable Documentation

◆ D_802A99D2_42ED72

UnkVec2s D_802A99D2_42ED72[]
Initial value:
= {
{ 0x00, 0x00 },
{ 0x00, 0x19 },
{ 0x00, 0x32 },
{ 0x00, 0x4B },
{ 0x00, 0x4B },
}

Definition at line 11 of file smack.c.

11 {
12 { 0x00, 0x00 },
13 { 0x00, 0x19 },
14 { 0x00, 0x32 },
15 { 0x00, 0x4B },
16 { 0x00, 0x4B },
17};

Referenced by update().

◆ D_802A99E4_42ED84

s32 D_802A99E4_42ED84[]
Initial value:
= {
0x28, 0x46, 0x63, 0xC8,
}

Definition at line 19 of file smack.c.

19 {
20 0x28, 0x46, 0x63, 0xC8,
21};

Referenced by update().

◆ D_802A99F4_42ED94

s32 D_802A99F4_42ED94[]
Initial value:
= {
0x23, 0x3C, 0x50, 0x63, 0xC8,
}

Definition at line 23 of file smack.c.

23 {
24 0x23, 0x3C, 0x50, 0x63, 0xC8,
25};

Referenced by update().

◆ D_802A9A08_42EDA8

s32 D_802A9A08_42EDA8[]
Initial value:
= {
0x23, 0x23, 0x3C, 0x50, 0x63, 0xC8,
}

Definition at line 27 of file smack.c.

27 {
28 0x23, 0x23, 0x3C, 0x50, 0x63, 0xC8,
29};

Referenced by update().

◆ D_802A9A20_42EDC0

s32 D_802A9A20_42EDC0[]
Initial value:
= {
0x23, 0x3C, 0x50, 0x63, 0xC8, 0x00,
}

Definition at line 31 of file smack.c.

31 {
32 0x23, 0x3C, 0x50, 0x63, 0xC8, 0x00,
33};

Referenced by update().

◆ actionCmdTableSmack

s32 actionCmdTableSmack[]
extern

Definition at line 45 of file action_cmd.c.

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