Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
thunder_rage.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "effects.h"
4#include "model.h"
5#include "sprite/player.h"
6
7#define NAMESPACE battle_item_thunder_rage
8
10
13
14API_CALLABLE(N(SpawnLightningFX)) {
15 Actor* enemyTarget = get_actor(script->owner1.enemyID);
16 Actor* actor = get_actor(enemyTarget->targetActorID);
17 f32 posY, posX, posZ;
18 s32 scaleX, scaleY;
19
20 if (actor != NULL) {
22
23 posX = actor->curPos.x;
24 posY = actor->curPos.y + (actor->size.y / 10);
25 posZ = actor->curPos.z;
26
27 scaleX = (actor->size.x + (actor->size.x >> 2)) * actor->scalingFactor;
28 scaleY = (actor->size.y - 2) * actor->scalingFactor;
29
30 if (actor->flags & ACTOR_FLAG_HALF_HEIGHT) {
31 posY -= actor->size.y / 2;
32 }
33
34 fx_lightning(rand_int(2) + 3, posX, posY, posZ, scaleX, scaleY);
35
36 return ApiStatus_DONE2;
37 }
38
39 return ApiStatus_DONE2;
40}
41
43
44EvtScript N(EVS_UseItem) = {
45 SetConst(LVarA, ITEM_THUNDER_RAGE)
46 ExecWait(N(UseItemWithEffect))
48 Wait(5)
49 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
50 Call(MoveBattleCamOver, 20)
54 Wait(10)
55 Call(InitTargetIterator)
56 Label(0)
57 Call(SetGoalToTarget, ACTOR_SELF)
58 Call(ItemCheckHit, LVar0, DAMAGE_TYPE_NO_CONTACT, 0, LVar0, 0)
60 Goto(1)
61 EndIf
62 Call(N(SpawnLightningFX))
63 Wait(5)
65 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0))
66 Call(SetGoalToTarget, ACTOR_SELF)
67 Call(GetItemPower, ITEM_THUNDER_RAGE, LVar0, LVar1)
69 Label(1)
70 Wait(5)
71 Call(ChooseNextTarget, ITER_NEXT, LVar0)
73 Goto(0)
74 EndIf
75 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
76 Call(MoveBattleCamOver, 20)
77 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
78 Wait(30)
80 ExecWait(N(PlayerGoHome))
81 Return
82 End
83};
f32 scalingFactor
s16 targetActorID
Vec2bu size
Vec3f curPos
Bytecode EvtScript[]
#define rand_int
@ 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_DEFAULT
Definition enums.h:4824
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4825
@ SOUND_THUNDER_BOLT
Definition enums.h:1173
@ SOUND_LIGHTNING_STRIKE
Definition enums.h:1174
@ BTL_RUMBLE_PLAYER_EXTREME
Definition enums.h:4262
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_HALF_HEIGHT
Definition enums.h:3335
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundLighten(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundDarken(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus GetItemPower(Evt *script, b32 isInitialCall)
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#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 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 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 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 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