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  {
  AC_JUMP_STATE_0 = 0 , AC_JUMP_STATE_1 = 1 , AC_JUMP_STATE_10 = 10 , AC_JUMP_STATE_11 = 11 ,
  AC_JUMP_STATE_CLEANUP = 12
}
 

Functions

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

Variables

s32 actionCmdTableJump []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AC_JUMP_STATE_0 
AC_JUMP_STATE_1 
AC_JUMP_STATE_10 
AC_JUMP_STATE_11 
AC_JUMP_STATE_CLEANUP 

Definition at line 8 of file jump.c.

8 {
14};
@ AC_JUMP_STATE_CLEANUP
Definition jump.c:13
@ AC_JUMP_STATE_1
Definition jump.c:10
@ AC_JUMP_STATE_0
Definition jump.c:9
@ AC_JUMP_STATE_11
Definition jump.c:12
@ AC_JUMP_STATE_10
Definition jump.c:11

Function Documentation

◆ update()

void N update ( void )

Definition at line 87 of file jump.c.

87 {
88 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
89 BattleStatus* battleStatus = &gBattleStatus;
90 s32 hudElement;
91 s32 successWindow;
92
93 switch (actionCommandStatus->state) {
94 case AC_JUMP_STATE_0:
97 }
98 actionCommandStatus->state = AC_JUMP_STATE_1;
99 break;
100 case AC_JUMP_STATE_1:
101 if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) {
103 }
104
105 actionCommandStatus->hudPosX += 20;
106 if (actionCommandStatus->hudPosX > 50) {
107 actionCommandStatus->hudPosX = 50;
108 }
109
110 hudElement = actionCommandStatus->hudElements[0];
111 hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY);
112 if (actionCommandStatus->showHud) {
114 }
115
116 if (actionCommandStatus->autoSucceed) {
117 hudElement = actionCommandStatus->hudElements[1];
118 hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY);
119 if (actionCommandStatus->showHud) {
121 break;
122 }
123 }
124 break;
125 case AC_JUMP_STATE_10:
126 if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) {
128 }
129
130 successWindow = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty];
131 if (((actionCommandStatus->prepareTime - successWindow) - 2) <= 0) {
132 hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown);
133 }
134 if ((battleStatus->curButtonsPressed & BUTTON_A) && !actionCommandStatus->autoSucceed) {
135 actionCommandStatus->wrongButtonPressed = TRUE;
136 battleStatus->actionResult = ACTION_RESULT_EARLY;
137 }
138 if ((actionCommandStatus->prepareTime - successWindow) > 0) {
139 actionCommandStatus->prepareTime -= 1;
140 break;
141 }
142
143 actionCommandStatus->frameCounter = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty];
144 battleStatus->actionSuccess = -1;
145 actionCommandStatus->state = AC_JUMP_STATE_11;
146 // fall through
147 case AC_JUMP_STATE_11:
148 if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) {
150 }
151 if (battleStatus->actionCommandMode >= ACTION_COMMAND_MODE_TUTORIAL) {
152 if (actionCommandStatus->frameCounter == 0) {
153 break;
154 }
155 } else {
156 if (battleStatus->actionSuccess >= 0) {
157 hudElement = actionCommandStatus->hudElements[0];
158 if (actionCommandStatus->showHud) {
160 }
161 }
162 }
163
164 if (battleStatus->actionSuccess < 0) {
165 if (((battleStatus->curButtonsPressed & BUTTON_A) &&
166 !actionCommandStatus->wrongButtonPressed) ||
167 actionCommandStatus->autoSucceed) {
168 battleStatus->actionSuccess = 1;
169 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
171 }
172 }
173
174 if (actionCommandStatus->frameCounter == 0) {
175 if (battleStatus->actionSuccess == 1) {
177 }
178 if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) {
180 }
181 actionCommandStatus->frameCounter = 5;
182 actionCommandStatus->state = AC_JUMP_STATE_CLEANUP;
183 break;
184 }
185 actionCommandStatus->frameCounter--;
186 break;
188 if (actionCommandStatus->frameCounter != 0) {
189 actionCommandStatus->frameCounter--;
190 break;
191 }
193 break;
194 }
195}
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_AButtonDown
@ ACTION_COMMAND_MODE_TUTORIAL
Definition action_cmd.h:40
@ BUTTON_A
Definition enums.h:2790
@ BS_FLAGS1_2000
Definition enums.h:3582
@ 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:74
s32 * actionCmdDifficultyTable
BattleStatus gBattleStatus
Definition battle.c:11

◆ draw()

void N draw ( void )

Definition at line 197 of file jump.c.

197 {
201 }
202}
@ DEMO_BTL_FLAG_ENABLED
Definition enums.h:3543
void hud_element_draw_clipped(s32 id)
GameStatus * gGameStatusPtr
Definition main_loop.c:32

◆ free()

void N free ( void )

Definition at line 204 of file jump.c.

Variable Documentation

◆ actionCmdTableJump

s32 actionCmdTableJump[]
extern

Definition at line 28 of file action_cmd.c.

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