Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
lullaby.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BattleMamar.h"
4#include "sprite/player.h"
5
6#define NAMESPACE battle_move_lullaby
7
9
10API_CALLABLE(N(SpawnMusicNotesFX)) {
11 s32 x, y;
12
13 if (isInitialCall) {
14 script->functionTemp[0] = 0;
15 }
16
17 switch (script->functionTemp[0]) {
18 case 0:
19 script->functionTemp[2] = -80;
20 script->functionTemp[1] = 0;
21 script->functionTemp[0] = 1;
22 case 1:
23 x = script->functionTemp[2];
24 y = 30.0f + 30.0f * sin_rad(DEG_TO_RAD(script->functionTemp[1]));
25 fx_music_note(0, x, y, 50.0f);
26
27 script->functionTemp[2] += 14;
28 script->functionTemp[1] += 20;
29
30 if (script->functionTemp[1] >= 360) {
31 return ApiStatus_DONE2;
32 }
33 }
34 return ApiStatus_BLOCK;
35}
36
37EvtScript N(EVS_UsePower) = {
38 ExecWait(N(EVS_StarPower_WishForSpirit))
39 SetConst(LVar0, ANIM_BattleMamar_Idle)
40 ExecWait(N(EVS_StarPower_SpiritSummoned))
41 Call(SetNpcAnimation, NPC_BTL_SPIRIT, ANIM_BattleMamar_Shout)
42 Wait(16)
43 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
44 Wait(15)
46 Call(N(SpawnMusicNotesFX))
47 Wait(30)
48 Call(InitTargetIterator)
49 Label(0)
50 Call(SetGoalToTarget, ACTOR_SELF)
51 Call(ItemCheckHit, LVar0, 0, 0, 0, 0)
53 Goto(1)
54 EndIf
56 Label(1)
57 Wait(5)
58 Call(ChooseNextTarget, ITER_NEXT, LVar0)
60 Goto(0)
61 EndIf
62 Wait(5)
63 Call(PlayerYieldTurn)
64 ExecWait(N(EVS_StarPower_SpiritDeparts))
65 ExecWait(N(EVS_StarPower_EndWish))
66 Return
67 End
68};
Bytecode EvtScript[]
@ 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
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_LULLABY
Definition enums.h:1307
@ ACTOR_SELF
Definition enums.h:2084
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
Definition enums.h:2880
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
#define ApiStatus_BLOCK
Definition evt.h:116
f32 sin_rad(f32 x)
Definition 43F0.c:713
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
#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 Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#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 DEG_TO_RAD(deg)
Definition macros.h:134
#define DMG_STATUS_KEY(typeFlag, duration, chance)
Definition macros.h:224
#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 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