Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
JumpSupport.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
4#include "sprite/player.h"
5
6s32 N(D_802A10F0)[] = {
7 9, 3, 9, 3, 9, 3, 8, 3,
8 7, 3, 6, 2, 5, 2, 4, 2,
9};
10
11API_CALLABLE(N(CalcJumpReboundTime)) {
13 Actor* playerActor = battleStatus->playerActor;
14 f32 posX = playerActor->curPos.x;
15 f32 posY = playerActor->curPos.y;
16 f32 posZ = playerActor->curPos.z;
17 f32 goalX = playerActor->state.goalPos.x;
18 f32 goalY = playerActor->state.goalPos.y;
19 f32 goalZ = playerActor->state.goalPos.z;
20
21 script->varTable[0] = (dist3D(posX, posY, posZ, goalX, goalY, goalZ) * 15.0f) / 100.0f;
22
23 if (script->varTable[0] > 20) {
24 script->varTable[0] = 20;
25 }
26
27 if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED) {
28 if (script->varTable[0] < 6) {
29 script->varTable[0] = 6;
30 }
31 } else if (script->varTable[0] < 12) {
32 script->varTable[0] = 12;
33 }
34
35 return ApiStatus_DONE2;
36}
37
40 Loop(5)
44 EndIf
45 Wait(1)
47 Return
48 End
49};
50
54 Sub(LVar0, 40)
58 Sub(LVar3, Float(70.0))
61 EndIf
71 Return
72 End
73};
74
75// calculate time for a jump attack based on player and target positions
82 Else
85 EndIf
86 // 15 + (abs(goalX - actorX) - 20) / 10.588
87 Sub(LVar6, 20)
88 DivF(LVar6, Float(10.588))
89 AddF(LVar6, 15)
91 Return
92 End
93};
94
95// calculate time for a jump attack based on player and target positions
96// this variation is only used for first strikes with Super Boots
102 Sub(LVar6, LVar7)
103 Else
104 Sub(LVar7, LVar6)
105 Set(LVar6, LVar7)
106 EndIf
107 // 15 + (abs(goalX - actorX) - 20) / 22.5
108 Sub(LVar6, 20)
109 DivF(LVar6, Float(22.5))
110 AddF(LVar6, 15)
111 Set(LVarA, LVar6)
112 Return
113 End
114};
115
116// calculate time for a jump attack based on player and target positions
117// this variation is only used for first strikes with Ultra Boots
123 Sub(LVar6, LVar7)
124 Else
125 Sub(LVar7, LVar6)
126 Set(LVar6, LVar7)
127 EndIf
128 // 22 + (abs(goalX - actorX) - 20) / 18.0
129 Sub(LVar6, 20)
130 DivF(LVar6, Float(18.0))
131 AddF(LVar6, 22)
132 Set(LVarA, LVar6)
133 Return
134 End
135};
136
137// normal dismount after successful follow-up hit
143 // jump to position 40 units ahead of home
146 Add(LVar0, 40)
152 // small second jump 20 units back
154 Wait(1)
155 Call(AddGoalPos, ACTOR_PLAYER, -20, 0, 0)
156 Call(PlayerHopToGoal, 6, 0, 2)
158 Wait(5)
159 // walk home
166 Return
167 End
168};
169
170// weak dismount after unsuccessful Power/Mega Jump
176 // jump to position 50 units behind player
178 Sub(LVar0, 50)
179 Set(LVar1, 0)
185 // small second jump 30 units back
187 Wait(1)
188 Call(AddGoalPos, ACTOR_PLAYER, -30, 0, 0)
189 Call(PlayerHopToGoal, 6, 0, 2)
191 Wait(2)
192 // walk home
199 Return
200 End
201};
202
208 // jump to position 40 units behind player
210 Sub(LVar0, 40)
211 Set(LVar1, 0)
217 // small second jump 20 units back
219 Wait(1)
220 Call(AddGoalPos, ACTOR_PLAYER, -20, 0, 0)
221 Call(PlayerHopToGoal, 6, 0, 2)
223 Wait(2)
224 // walk home
231 Return
232 End
233};
234
235// Unused
241 // jump to position 60 units behind player
243 Sub(LVar0, 60)
244 Set(LVar1, 0)
251 Wait(1)
252 // small second jump 20 units back
253 Call(AddGoalPos, ACTOR_PLAYER, -20, 0, 0)
254 Call(PlayerHopToGoal, 6, 0, 2)
256 Wait(2)
257 // walk home
264 Return
265 End
266};
267
268// Unused
269// dismount after hit bouncing all the way to home position
276 // jump to position 60 units ahead of home
279 Add(LVar0, 60)
280 Set(LVar1, 0)
287 Call(ShakeCam, CAM_BATTLE, 0, 4, Float(1.0))
289 // small second jump 30 units back
290 Call(AddGoalPos, ACTOR_PLAYER, -30, 0, 0)
291 Call(PlayerHopToGoal, 8, 0, 2)
293 Call(ShakeCam, CAM_BATTLE, 0, 4, Float(1.0))
295 // small third jump 20 units back
296 Call(AddGoalPos, ACTOR_PLAYER, -20, 0, 0)
298 Call(PlayerHopToGoal, 6, 0, 2)
300 Call(ShakeCam, CAM_BATTLE, 0, 4, Float(1.0))
302 // final small jump to home position (10 units)
304 Call(PlayerHopToGoal, 4, 0, 2)
306 Return
307 End
308};
309
314 Wait(2)
316 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0))
320 Wait(10)
322 Wait(20)
326 // walk home
334 Return
335 End
336};
337
338// load the action command
349 Return
350 End
351};
352
353// Incomplete and unused variation of EVS_JumpSupport_ApproachAndJump at one point intended for Super Jump
360 Set(LVarB, LVarA)
361 Add(LVarB, 14)
362 Add(LVarB, -3)
368 Wait(7)
371 CaseGt(0)
376 Return
377 End
378};
379
380// Incomplete and unused variation of EVS_JumpSupport_ApproachAndJump at one point intended for Ultra Jump
387 Set(LVarB, LVarA)
388 Sub(LVarB, 4)
389 Add(LVarB, -3)
396 Set(LVar9, 0)
398 IfGt(LVar0, 0)
399 Set(LVar9, 1)
403 Wait(2)
410 Goto(10)
411 Else
416 Goto(10)
417 EndIf
418 Label(10)
419 Return
420 End
421};
BSS s32 PopupMenu_SelectedIndex
@ AC_DIFFICULTY_3
Definition action_cmd.h:45
@ AC_MODE_NOT_LEARNED
Definition action_cmd.h:60
ActorState state
Vec3f curPos
Bytecode EvtScript[]
@ ACTION_COMMAND_JUMP
Definition enums.h:3473
@ BUTTON_A
Definition enums.h:2790
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3577
@ PLAYER_ULTRA_JUMP_2
Definition enums.h:4314
@ PLAYER_ULTRA_JUMP_0
Definition enums.h:4312
@ PLAYER_ULTRA_JUMP_1
Definition enums.h:4313
@ PLAYER_SUPER_JUMP_0
Definition enums.h:4302
@ PLAYER_SUPER_JUMP_1
Definition enums.h:4303
@ BTL_CAM_PLAYER_MISTAKE
Definition enums.h:4850
@ BTL_CAM_PLAYER_SUPER_JUMP_MIDAIR
Definition enums.h:4858
@ BTL_CAM_PLAYER_UNUSED_ULTRA_JUMP
Definition enums.h:4860
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4824
@ BTL_CAM_PLAYER_JUMP_MIDAIR
Definition enums.h:4855
@ BTL_CAM_PLAYER_ULTRA_JUMP_MIDAIR
Definition enums.h:4859
@ BTL_CAM_PLAYER_ATTACK_APPROACH
Definition enums.h:4847
@ PLAYER_BASIC_JUMP_0
Definition enums.h:4294
@ SOUND_TRIP
Definition enums.h:784
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_BLUR_RESET
Definition enums.h:6414
@ CAM_BATTLE
Definition enums.h:1801
#define ApiStatus_DONE2
Definition evt.h:118
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz)
Definition 43F0.c:676
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define LVar6
Definition macros.h:154
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define DivF(VAR, FLOAT_VALUE)
Definition macros.h:386
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define AddF(VAR, FLOAT_VALUE)
Definition macros.h:383
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar5
Definition macros.h:153
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define LVar7
Definition macros.h:155
#define BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#define LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define CaseGt(RVAR)
Marks the start of a switch case that executes only if LVAR <= RVAR. It also marks the end of any pre...
Definition macros.h:328
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217
BattleStatus gBattleStatus
Definition battle.c:11