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

Go to the source code of this file.

Macros

#define METER_FILL_TICK   600
 

Enumerations

enum  { HIDX_BUTTON = 0 , HIDX_METER = 1 , HIDX_OK = 2 }
 

Functions

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

Variables

s32 actionCmdTable07 []
 

Macro Definition Documentation

◆ METER_FILL_TICK

#define METER_FILL_TICK   600

Definition at line 26 of file unused_flee.c.

Referenced by update().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HIDX_BUTTON 
HIDX_METER 
HIDX_OK 

Definition at line 19 of file unused_flee.c.

19 {
20 HIDX_BUTTON = 0,
21 HIDX_METER = 1,
22 HIDX_OK = 2,
23};
@ HIDX_METER
Definition unused_flee.c:21
@ HIDX_BUTTON
Definition unused_flee.c:20
@ HIDX_OK
Definition unused_flee.c:22

Function Documentation

◆ btl_message_unlock_box_pos()

void btl_message_unlock_box_pos ( void )

Definition at line 641 of file popup_messages.c.

641 {
643}
BSS b16 BattleMessage_BoxPosLocked

◆ update()

void N update ( void )

Definition at line 96 of file unused_flee.c.

96 {
98 BattleStatus* battleStatus = &gBattleStatus;
99 HudElemID hid;
100
101 switch (acs->state) {
102 case AC_STATE_INIT:
104
105 hid = acs->hudElemIDs[HIDX_BUTTON];
106 if (acs->showHud) {
108 }
109 hud_element_set_alpha(hid, 255);
110
111 hid = acs->hudElemIDs[HIDX_METER];
112 hud_element_set_alpha(hid, 255);
113 if (acs->showHud) {
115 }
116
117 hid = acs->hudElemIDs[HIDX_OK];
118 hud_element_set_alpha(hid, 255);
119 if (acs->showHud) {
121 }
122
123 acs->state = AC_STATE_APPEAR;
124 break;
125 case AC_STATE_APPEAR:
127
128 acs->hudPosX += 20;
129 if (acs->hudPosX > 50) {
130 acs->hudPosX = 50;
131 }
132
135 hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX + 31, acs->hudPosY + 14);
136 break;
137 case AC_STATE_START:
139
140 if (acs->prepareTime != 0) {
141 acs->prepareTime--;
142 return;
143 }
144
146 battleStatus->actionQuality = 0;
147 N(HasStarted) = TRUE;
148 acs->flee.drainDelay = 0;
149 acs->state = AC_STATE_ACTIVE;
150 acs->stateTimer = acs->duration;
151
152 // fallthrough
153 case AC_STATE_ACTIVE:
155
156 // check for meter-filling input
157 if (battleStatus->curButtonsPressed & BUTTON_A) {
158 s32 fillAmt = SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]);
159
160 if (acs->flee.drainDelay == 0) {
161 acs->meterFillLevel += fillAmt;
162 }
163 }
164
165 // handle meter reaching 100%
166 if (acs->meterFillLevel > MAX_MASH_UNITS) {
168 acs->flee.drainDelay = 3;
169 }
170
171 // meter can reset if mashing stops after it's been fully filled
172 if (acs->flee.drainDelay != 0) {
173 acs->flee.drainDelay--;
174 if (acs->flee.drainDelay == 0) {
175 acs->meterFillLevel = 0;
176 battleStatus->actionQuality++;
177 }
178 }
179
180 battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH;
181
182 if (acs->stateTimer != 0) {
183 acs->stateTimer--;
184 return;
185 }
187 acs->stateTimer = 5;
188 acs->state = AC_STATE_DISPOSE;
189 break;
190 case AC_STATE_DISPOSE:
191 if (acs->stateTimer != 0) {
192 acs->stateTimer--;
193 return;
194 }
196 break;
197 }
198}
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
#define MAX_MASH_UNITS
Definition action_cmd.h:75
s32 HudElemID
@ BUTTON_A
Definition enums.h:2790
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
s32 * actionCmdDifficultyTable
#define METER_FILL_TICK
Definition unused_flee.c:26
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 200 of file unused_flee.c.

200 {
202 s32 hudX, hudY;
203 HudElemID hid;
204
206 hid = acs->hudElemIDs[HIDX_METER];
208 hud_element_get_render_pos(hid, &hudX, &hudY);
209
210 if (!N(HasStarted)) {
212 } else {
214 }
215
217}
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()

Variable Documentation

◆ actionCmdTable07

s32 actionCmdTable07[]
extern

Definition at line 34 of file action_cmd.c.

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