Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
star_storm.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BattleSkolar.h"
4
5#define NAMESPACE battle_move_star_storm
6
8
9API_CALLABLE(N(SpawnShootingStarFX)) {
10 s32 x = -50 - rand_int(200);
11 s32 y = 200;
12 s32 z = rand_int(40);
13
14 if (script->varTable[0] % 4 != 0) {
15 fx_star(FX_STAR_LARGE_BOUNCING, x, y, z, x + (rand_int(50) + y), 0, z, rand_int(10) + 7);
16 } else {
17 fx_star(FX_STAR_SMALL_BOUNCING, x, y, z, x + (rand_int(50) + y), 0, z, rand_int(10) + 7);
18 }
19
20 return ApiStatus_DONE2;
21}
22
23API_CALLABLE(N(SpawnDamageStarsFX)) {
24 Bytecode* args = script->ptrReadPos;
25 s32 x = evt_get_variable(script, *args++);
26 s32 y = evt_get_variable(script, *args++);
27 s32 z = evt_get_variable(script, *args++);
28
29 fx_damage_stars(FX_DAMAGE_STARS_2, x, y, z, 0, -1.0f, 0, 5);
30
31 return ApiStatus_DONE2;
32}
33
34EvtScript N(EVS_UsePower) = {
35 ExecWait(N(EVS_StarPower_WishForSpirit))
36 SetConst(LVar0, ANIM_BattleSkolar_Idle)
37 ExecWait(N(EVS_StarPower_SpiritSummoned))
38 Call(SetNpcAnimation, NPC_BTL_SPIRIT, ANIM_BattleSkolar_Shout)
39 Wait(16)
40 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
41 Thread
42 Set(LVar0, 0)
43 Loop(10)
45 Call(N(SpawnShootingStarFX))
46 Wait(5)
47 Add(LVar0, 1)
49 Call(N(SpawnShootingStarFX))
50 Wait(5)
51 Add(LVar0, 1)
54 Thread
55 Set(LVar0, 0)
56 Wait(50)
57 Loop(10)
59 Add(LVar0, 1)
60 Wait(5)
62 Add(LVar0, 1)
63 Wait(5)
66 Thread
67 Loop(10)
68 Wait(7)
69 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0))
70 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
73 Wait(90)
74 Call(InitTargetIterator)
75 Label(0)
76 Call(SetGoalToTarget, ACTOR_SELF)
77 Call(ItemCheckHit, LVar0, 0, 0, 0, 0)
79 Goto(1)
80 EndIf
81 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
82 Call(N(SpawnDamageStarsFX), LVar0, LVar1, LVar2)
84 Label(1)
85 Wait(10)
86 Call(ChooseNextTarget, ITER_NEXT, LVar0)
88 Goto(0)
89 EndIf
90 Wait(20)
91 ExecWait(N(EVS_StarPower_SpiritDeparts))
92 Call(PlayerYieldTurn)
93 ExecWait(N(EVS_StarPower_EndWish))
94 Return
95 End
96};
Bytecode EvtScript[]
#define rand_int
@ FX_STAR_LARGE_BOUNCING
Definition effects.h:175
@ FX_STAR_SMALL_BOUNCING
Definition effects.h:176
@ FX_DAMAGE_STARS_2
Definition effects.h:358
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4825
@ NPC_BTL_SPIRIT
Definition enums.h:2531
@ SOUND_STAR_BOUNCE_A
Definition enums.h:975
@ SOUND_SHOOTING_STAR_FALL_B
Definition enums.h:974
@ SOUND_SHOOTING_STAR_FALL_A
Definition enums.h:973
@ SOUND_STAR_BOUNCE_B
Definition enums.h:976
@ BTL_RUMBLE_PLAYER_LIGHT
Definition enums.h:4260
@ ACTOR_SELF
Definition enums.h:2084
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_COSMIC
Definition enums.h:2859
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#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 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 ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217
void fx_damage_stars(s32, f32, f32, f32, f32, f32, f32, s32)