Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stop_leech.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 actionCmdTableStopLeech []
 

Function Documentation

◆ update()

void N update ( void )

Definition at line 69 of file stop_leech.c.

69 {
70 BattleStatus* battleStatus = &gBattleStatus;
71 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
72 s32 hudElement;
73 s16 hudElementX;
74
75 switch (actionCommandStatus->state) {
76 case 0:
78 hudElement = actionCommandStatus->hudElements[0];
79 if (actionCommandStatus->showHud) {
81 }
82 hud_element_set_alpha(hudElement, 0xFF);
83 hudElement = actionCommandStatus->hudElements[1];
84 hud_element_set_alpha(hudElement, 0xFF);
85 if (actionCommandStatus->showHud) {
87 }
88 actionCommandStatus->state = 1;
89 break;
90 case 1:
92 hudElementX = actionCommandStatus->hudPosX + 20;
93 actionCommandStatus->hudPosX = hudElementX;
94 if (hudElementX > 50) {
95 actionCommandStatus->hudPosX = 50;
96 }
97 hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
98 hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28);
99 break;
100 case 10:
102 if (actionCommandStatus->prepareTime != 0) {
103 actionCommandStatus->prepareTime -= 1;
104 break;
105 }
106 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton);
107 actionCommandStatus->barFillLevel = 0;
108 actionCommandStatus->state = 11;
109 actionCommandStatus->frameCounter = actionCommandStatus->duration;
110 case 11:
112 if (!actionCommandStatus->berserkerEnabled) {
113 if (battleStatus->curButtonsPressed & BUTTON_A) {
114 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty];
115 }
116 } else {
117 actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 6;
118 actionCommandStatus->barFillLevel += rand_int((battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]) / 6);
119 }
120 battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100;
121 if (actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals] <= battleStatus->actionQuality) {
122 actionCommandStatus->frameCounter = 0;
123 }
124
125 if (actionCommandStatus->frameCounter == 0) {
127 actionCommandStatus->frameCounter = 5;
128 actionCommandStatus->state = 12;
129 break;
130 }
131 actionCommandStatus->frameCounter -= 1;
132 break;
133 case 12:
134 if (actionCommandStatus->frameCounter != 0) {
135 actionCommandStatus->frameCounter -= 1;
136 break;
137 }
138 battleStatus->actionSuccess = 1;
139 battleStatus->actionResult = ACTION_RESULT_NONE;
141 default:
142 break;
143 }
144}
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void action_command_free(void)
Definition action_cmd.c:446
HudScript HES_MashAButton
#define rand_int
@ BUTTON_A
Definition enums.h:2790
@ ACTION_RESULT_NONE
Definition enums.h:1963
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
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 146 of file stop_leech.c.

146 {
147 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
148 s32 x, y;
149 s32 hudElement;
150
151 if (!actionCommandStatus->berserkerEnabled) {
152 hud_element_draw_clipped(actionCommandStatus->hudElements[0]);
153 }
154
155 hudElement = actionCommandStatus->hudElements[1];
156 hud_element_draw_clipped(hudElement);
157 hud_element_get_render_pos(hudElement, &x, &y);
158 draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 2);
159}
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)

◆ free()

void N free ( void )

Definition at line 161 of file stop_leech.c.

Variable Documentation

◆ actionCmdTableStopLeech

s32 actionCmdTableStopLeech[]
extern

Definition at line 33 of file action_cmd.c.

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