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

Go to the source code of this file.

Macros

#define METER_FILL_TICK   100
 

Enumerations

enum  { HIDX_BUTTON = 0 , HIDX_METER = 1 }
 

Functions

void N update (void)
 
void N draw (void)
 
void N free (void)
 

Variables

s32 actionCmdTableStopLeech []
 

Macro Definition Documentation

◆ METER_FILL_TICK

#define METER_FILL_TICK   100

Definition at line 20 of file stop_leech.c.

Referenced by update().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HIDX_BUTTON 
HIDX_METER 

Definition at line 14 of file stop_leech.c.

14 {
15 HIDX_BUTTON = 0,
16 HIDX_METER = 1,
17};
@ HIDX_METER
Definition stop_leech.c:16
@ HIDX_BUTTON
Definition stop_leech.c:15

Function Documentation

◆ update()

void N update ( void )

Definition at line 86 of file stop_leech.c.

86 {
87 BattleStatus* battleStatus = &gBattleStatus;
89 HudElemID hid;
90
91 switch (acs->state) {
92 case AC_STATE_INIT:
94 hid = acs->hudElemIDs[HIDX_BUTTON];
95 if (acs->showHud) {
97 }
98 hud_element_set_alpha(hid, 255);
99 hid = acs->hudElemIDs[HIDX_METER];
100 hud_element_set_alpha(hid, 255);
101 if (acs->showHud) {
103 }
104 acs->state = AC_STATE_APPEAR;
105 break;
106 case AC_STATE_APPEAR:
108 acs->hudPosX = acs->hudPosX + 20;
109 if (acs->hudPosX > 50) {
110 acs->hudPosX = 50;
111 }
114 break;
115 case AC_STATE_START:
117 if (acs->prepareTime != 0) {
118 acs->prepareTime--;
119 break;
120 }
122 acs->meterFillLevel = 0;
123 acs->state = AC_STATE_ACTIVE;
124 acs->stateTimer = acs->duration;
125
126 // fallthrough
127 case AC_STATE_ACTIVE:
129
130 // check for meter-filling input
131 if (!acs->berserkerEnabled) {
132 if (battleStatus->curButtonsPressed & BUTTON_A) {
134 }
135 } else {
138 }
139 battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH;
140
141 // handle filling the meter
142 if (acs->mashMeterCutoffs[acs->mashMeterNumIntervals] <= battleStatus->actionProgress) {
143 acs->stateTimer = 0;
144 }
145
146 if (acs->stateTimer == 0) {
148 acs->stateTimer = 5;
149 acs->state = AC_STATE_DISPOSE;
150 break;
151 }
152 acs->stateTimer--;
153 break;
154 case AC_STATE_DISPOSE:
155 if (acs->stateTimer != 0) {
156 acs->stateTimer--;
157 break;
158 }
159 battleStatus->actionQuality = 1;
160 battleStatus->actionResult = ACTION_RESULT_NONE;
162 default:
163 break;
164 }
165}
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void action_command_free(void)
Definition action_cmd.c:446
HudElemID hudElemIDs[16]
Definition action_cmd.h:83
@ AC_STATE_APPEAR
Definition action_cmd.h:35
@ AC_STATE_DISPOSE
Definition action_cmd.h:38
@ AC_STATE_INIT
Definition action_cmd.h:34
@ AC_STATE_ACTIVE
Definition action_cmd.h:37
@ AC_STATE_START
Definition action_cmd.h:36
#define ONE_PCT_MASH
Definition action_cmd.h:69
#define SCALE_BY_PCT(x, pct)
Definition action_cmd.h:77
HudScript HES_MashAButton
s32 HudElemID
#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:72
#define POPUP_MSG_OFF
Definition battle.h:270
#define POPUP_MSG_ON
Definition battle.h:269
#define METER_FILL_TICK
Definition stop_leech.c:20
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 167 of file stop_leech.c.

167 {
169 s32 hudX, hudY;
170 HudElemID hid;
171
172 if (!acs->berserkerEnabled) {
174 }
175
176 hid = acs->hudElemIDs[HIDX_METER];
178 hud_element_get_render_pos(hid, &hudX, &hudY);
180}
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 )

Variable Documentation

◆ actionCmdTableStopLeech

s32 actionCmdTableStopLeech[]
extern

Definition at line 33 of file action_cmd.c.

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