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

Go to the source code of this file.

Enumerations

enum  { HIDX_BUTTON = 0 , HIDX_RIGHT_ON = 1 }
 

Functions

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

Variables

s32 actionCmdTableJump []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HIDX_BUTTON 
HIDX_RIGHT_ON 

Definition at line 9 of file jump.c.

9 {
10 HIDX_BUTTON = 0,
11 HIDX_RIGHT_ON = 1,
12};
@ HIDX_BUTTON
Definition jump.c:10
@ HIDX_RIGHT_ON
Definition jump.c:11

Function Documentation

◆ update()

void N update ( void )

Definition at line 85 of file jump.c.

85 {
87 BattleStatus* battleStatus = &gBattleStatus;
88 HudElemID hid;
89 s32 successWindow;
90
91 switch (acs->state) {
92 case AC_STATE_INIT:
93 if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) {
95 }
97 break;
98 case AC_STATE_APPEAR:
99 if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) {
101 }
102
103 acs->hudPosX += 20;
104 if (acs->hudPosX > 50) {
105 acs->hudPosX = 50;
106 }
107
108 hid = acs->hudElemIDs[HIDX_BUTTON];
110 if (acs->showHud) {
112 }
113
114 if (acs->autoSucceed) {
115 hid = acs->hudElemIDs[HIDX_RIGHT_ON];
116 hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY);
117 if (acs->showHud) {
119 }
120 }
121 break;
122 case AC_STATE_START:
123 // this state is the time before valid input is allowed
124
125 if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) {
127 }
128
129 // show the A button being pressed two frames before input is allowed
130 successWindow = battleStatus->actionCmdDifficultyTable[acs->difficulty];
131 if (((acs->prepareTime - successWindow) - 2) <= 0) {
133 }
134 // inputs during this state will cause the action to fail
135 if ((battleStatus->curButtonsPressed & BUTTON_A) && !acs->autoSucceed) {
136 acs->wrongButtonPressed = TRUE;
137 battleStatus->actionResult = ACTION_RESULT_EARLY;
138 }
139 // continue until we begin the window for valid input
140 if ((acs->prepareTime - successWindow) > 0) {
141 acs->prepareTime--;
142 break;
143 }
144
145 acs->stateTimer = battleStatus->actionCmdDifficultyTable[acs->difficulty];
146 battleStatus->actionQuality = AC_QUALITY_FAILED;
147 acs->state = AC_STATE_ACTIVE;
148
149 // fallthrough
150 case AC_STATE_ACTIVE:
151 if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) {
153 }
154 if (battleStatus->actionCommandMode >= AC_MODE_TUTORIAL) {
155 if (acs->stateTimer == 0) {
156 break;
157 }
158 } else {
159 if (battleStatus->actionQuality >= 0) {
160 hid = acs->hudElemIDs[HIDX_BUTTON];
161 if (acs->showHud) {
163 }
164 }
165 }
166
167 // valid input is allowed during this state
168 if (battleStatus->actionQuality < 0) {
169 if (((battleStatus->curButtonsPressed & BUTTON_A) && !acs->wrongButtonPressed) || acs->autoSucceed) {
170 battleStatus->actionQuality = 1;
171 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
173 }
174 }
175
176 if (acs->stateTimer == 0) {
177 if (battleStatus->actionQuality == 1) {
179 }
180 if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) {
182 }
183 acs->stateTimer = 5;
184 acs->state = AC_STATE_DISPOSE;
185 break;
186 }
187 acs->stateTimer--;
188 break;
189 case AC_STATE_DISPOSE:
190 if (acs->stateTimer != 0) {
191 acs->stateTimer--;
192 break;
193 }
195 break;
196 }
197}
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void action_command_free(void)
Definition action_cmd.c:446
void increment_action_command_success_count(void)
Definition action_cmd.c:655
#define AC_QUALITY_FAILED
Definition action_cmd.h:66
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
HudScript HES_AButtonDown
@ AC_MODE_TUTORIAL
Definition action_cmd.h:62
s32 HudElemID
@ BUTTON_A
Definition enums.h:2790
@ BS_FLAGS1_2000
Definition enums.h:3581
@ ACTION_RESULT_EARLY
Definition enums.h:1966
@ ACTION_RESULT_SUCCESS
Definition enums.h:1968
void btl_set_popup_duration(s32 duration)
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
void hud_element_set_flags(s32 id, s32 flags)
Turns on the given flags.
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
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 199 of file jump.c.

◆ free()

void N free ( void )

Variable Documentation

◆ actionCmdTableJump

s32 actionCmdTableJump[]
extern

Definition at line 28 of file action_cmd.c.

28{ 7, 6, 5, 4, 3, 2, 1, 0 };