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

Go to the source code of this file.

Functions

void N update (void)
 

Variables

s32 D_802A9810_428280 [] = { 0, 25, 50, 75, 75, 0, 0, 0 }
 
s32 actionCmdTableBomb []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 60 of file bomb.c.

60 {
61 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
62 BattleStatus* battleStatus = &gBattleStatus;
63 s32 hudElement;
64 s32 mashMeterCutoff;
65
66 switch (actionCommandStatus->state) {
67 case 0:
69 hudElement = actionCommandStatus->hudElements[0];
70 hud_element_set_alpha(hudElement, 255);
71 if (actionCommandStatus->showHud) {
73 }
74
75 hudElement = actionCommandStatus->hudElements[1];
76 hud_element_set_alpha(hudElement, 255);
77 if (actionCommandStatus->showHud) {
79 }
80
81 actionCommandStatus->state = 1;
82 break;
83 case 1:
85
86 actionCommandStatus->hudPosX += 20;
87 if (actionCommandStatus->hudPosX > 50) {
88 actionCommandStatus->hudPosX = 50;
89 }
90
91 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX,
92 actionCommandStatus->hudPosY);
93 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX,
94 actionCommandStatus->hudPosY + 28);
95 break;
96 case 10:
98
99 if (actionCommandStatus->prepareTime != 0) {
100 actionCommandStatus->prepareTime--;
101 break;
102 }
103
104 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
105 actionCommandStatus->barFillLevel = 0;
106 actionCommandStatus->frameCounter = actionCommandStatus->duration;
108 actionCommandStatus->state = 11;
109
110 // fallthrough
111 case 11:
113 if (!actionCommandStatus->isBarFilled) {
114 mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals];
115 actionCommandStatus->barFillLevel -=
116 D_802A9810_428280[actionCommandStatus->barFillLevel / mashMeterCutoff / 20];
117
118 if (actionCommandStatus->barFillLevel < 0) {
119 actionCommandStatus->barFillLevel = 0;
120 }
121 }
122
123 if (battleStatus->curButtonsPressed & BUTTON_A) {
124 switch (actionCommandStatus->targetWeakness) {
125 case 0: {
126 s32 fillOffset = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 235 * 4;
127 actionCommandStatus->barFillLevel += fillOffset / 100;
128 break;
129 }
130 case 1:
131 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 8;
132 break;
133 case 2: {
134 s32 fillOffset = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 185 * 4;
135 actionCommandStatus->barFillLevel += fillOffset / 100;
136 break;
137 }
138 }
139 }
140
141 if (actionCommandStatus->barFillLevel > 10000) {
142 hudElement = actionCommandStatus->hudElements[2];
143 actionCommandStatus->barFillLevel = 10000;
144 actionCommandStatus->isBarFilled = TRUE;
145 hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50,
146 actionCommandStatus->hudPosY + 28);
148 }
149
150 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
152
153 if (actionCommandStatus->frameCounter == 0) {
154 if (actionCommandStatus->barFillLevel == 0) {
155 battleStatus->actionSuccess = -1;
156 } else {
157 battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100;
158 }
159
160 mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1];
161 if (mashMeterCutoff >= battleStatus->actionSuccess) {
162 battleStatus->actionResult = ACTION_RESULT_MINUS_2;
163 } else {
164 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
165 }
166
167 if (battleStatus->actionSuccess == 100) {
169 }
170
173 actionCommandStatus->frameCounter = 5;
174 actionCommandStatus->state = 12;
175 } else {
176 actionCommandStatus->frameCounter--;
177 }
178 break;
179 case 12:
180 if (actionCommandStatus->frameCounter != 0) {
181 actionCommandStatus->frameCounter--;
182 } else {
184 }
185 break;
186 }
187}
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_802A9810_428280[]
Definition bomb.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_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 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

Variable Documentation

◆ D_802A9810_428280

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

Definition at line 6 of file bomb.c.

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

Referenced by update().

◆ actionCmdTableBomb

s32 actionCmdTableBomb[]
extern

Definition at line 38 of file action_cmd.c.

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