Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
egg_missile.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "effects.h"
4#include "entity.h"
5#include "ld_addrs.h"
6#include "sprite/player.h"
7#include "include_asset.h"
8
9#define NAMESPACE battle_item_egg_missile
10
12
13API_CALLABLE(N(func_802A123C_71CF1C)) {
14 Bytecode* args = script->ptrReadPos;
15 s32 x = evt_get_variable(script, *args++);
16 s32 y = evt_get_variable(script, *args++);
17 s32 z = evt_get_variable(script, *args++);
18
19 fx_smoke_ring(0, x, y, z);
20 fx_explosion(0, x, y + 20, z);
21
22 return ApiStatus_DONE2;
23}
24
26
27static s32 _pad = 0;
28
29#include "battle/move/item/egg_missile1.png.h"
30INCLUDE_IMG("battle/move/item/egg_missile1.png", battle_item_egg_missile1_png);
31INCLUDE_PAL("battle/move/item/egg_missile1.pal", battle_item_egg_missile1_pal);
32
33#include "battle/move/item/egg_missile2.png.h"
34INCLUDE_IMG("battle/move/item/egg_missile2.png", battle_item_egg_missile2_png);
35INCLUDE_PAL("battle/move/item/egg_missile2.pal", battle_item_egg_missile2_pal);
36
37#include "battle/move/item/egg_missile3.png.h"
38INCLUDE_IMG("battle/move/item/egg_missile3.png", battle_item_egg_missile3_png);
39INCLUDE_PAL("battle/move/item/egg_missile3.pal", battle_item_egg_missile3_pal);
40
41#include "battle/move/item/egg_missile4.png.h"
42INCLUDE_IMG("battle/move/item/egg_missile4.png", battle_item_egg_missile4_png);
43INCLUDE_PAL("battle/move/item/egg_missile4.pal", battle_item_egg_missile4_pal);
44
45Vtx N(EggMissileVtx)[] = {
46 { .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
47 { .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
48 { .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
49 { .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
50};
51
52Gfx N(Frame1Gfx)[] = {
53 gsDPPipeSync(),
54 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
55 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
56 gsDPSetTexturePersp(G_TP_PERSP),
57 gsDPSetTextureDetail(G_TD_CLAMP),
58 gsDPSetTextureLOD(G_TL_TILE),
59 gsDPSetTextureLUT(G_TT_NONE),
60 gsDPSetTextureFilter(G_TF_AVERAGE),
61 gsDPSetTextureConvert(G_TC_FILT),
62 gsDPSetTextureLUT(G_TT_RGBA16),
63 gsDPLoadTLUT_pal16(0, battle_item_egg_missile1_pal),
64 gsDPLoadTextureTile_4b(battle_item_egg_missile1_png, G_IM_FMT_CI, battle_item_egg_missile1_png_width, battle_item_egg_missile1_png_height, 0, 0, battle_item_egg_missile1_png_width - 1, battle_item_egg_missile1_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
65 gsSPClearGeometryMode(G_LIGHTING),
66 gsSPClearGeometryMode(G_SHADING_SMOOTH),
67 gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
68 gsSP1Triangle(0, 1, 2, 0),
69 gsSP1Triangle(0, 2, 3, 0),
70 gsDPPipeSync(),
71 gsSPEndDisplayList(),
72};
73
74Gfx N(Frame2Gfx)[] = {
75 gsDPPipeSync(),
76 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
77 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
78 gsDPSetTexturePersp(G_TP_PERSP),
79 gsDPSetTextureDetail(G_TD_CLAMP),
80 gsDPSetTextureLOD(G_TL_TILE),
81 gsDPSetTextureLUT(G_TT_NONE),
82 gsDPSetTextureFilter(G_TF_AVERAGE),
83 gsDPSetTextureConvert(G_TC_FILT),
84 gsDPSetTextureLUT(G_TT_RGBA16),
85 gsDPLoadTLUT_pal16(0, battle_item_egg_missile2_pal),
86 gsDPLoadTextureTile_4b(battle_item_egg_missile2_png, G_IM_FMT_CI, battle_item_egg_missile2_png_width, 0, 0, 0, battle_item_egg_missile2_png_width - 1, battle_item_egg_missile2_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
87 gsSPClearGeometryMode(G_LIGHTING),
88 gsSPClearGeometryMode(G_SHADING_SMOOTH),
89 gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
90 gsSP1Triangle(0, 1, 2, 0),
91 gsSP1Triangle(0, 2, 3, 0),
92 gsDPPipeSync(),
93 gsSPEndDisplayList(),
94};
95
96Gfx N(Frame3Gfx)[] = {
97 gsDPPipeSync(),
98 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
99 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
100 gsDPSetTexturePersp(G_TP_PERSP),
101 gsDPSetTextureDetail(G_TD_CLAMP),
102 gsDPSetTextureLOD(G_TL_TILE),
103 gsDPSetTextureLUT(G_TT_NONE),
104 gsDPSetTextureFilter(G_TF_AVERAGE),
105 gsDPSetTextureConvert(G_TC_FILT),
106 gsDPSetTextureLUT(G_TT_RGBA16),
107 gsDPLoadTLUT_pal16(0, battle_item_egg_missile3_pal),
108 gsDPLoadTextureTile_4b(battle_item_egg_missile3_png, G_IM_FMT_CI, battle_item_egg_missile3_png_width, 0, 0, 0, battle_item_egg_missile3_png_width - 1, battle_item_egg_missile3_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
109 gsSPClearGeometryMode(G_LIGHTING),
110 gsSPClearGeometryMode(G_SHADING_SMOOTH),
111 gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
112 gsSP1Triangle(0, 1, 2, 0),
113 gsSP1Triangle(0, 2, 3, 0),
114 gsDPPipeSync(),
115 gsSPEndDisplayList(),
116};
117
118Gfx N(Frame4Gfx)[] = {
119 gsDPPipeSync(),
120 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
121 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
122 gsDPSetTexturePersp(G_TP_PERSP),
123 gsDPSetTextureDetail(G_TD_CLAMP),
124 gsDPSetTextureLOD(G_TL_TILE),
125 gsDPSetTextureLUT(G_TT_NONE),
126 gsDPSetTextureFilter(G_TF_AVERAGE),
127 gsDPSetTextureConvert(G_TC_FILT),
128 gsDPSetTextureLUT(G_TT_RGBA16),
129 gsDPLoadTLUT_pal16(0, battle_item_egg_missile4_pal),
130 gsDPLoadTextureTile_4b(battle_item_egg_missile4_png, G_IM_FMT_CI, battle_item_egg_missile4_png_width, 0, 0, 0, battle_item_egg_missile4_png_width - 1, battle_item_egg_missile4_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
131 gsSPClearGeometryMode(G_LIGHTING),
132 gsSPClearGeometryMode(G_SHADING_SMOOTH),
133 gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
134 gsSP1Triangle(0, 1, 2, 0),
135 gsSP1Triangle(0, 2, 3, 0),
136 gsDPPipeSync(),
137 gsSPEndDisplayList(),
138};
139
140EntityModelScript N(EMS_EggMissile) = {
142 ems_Draw(N(Frame1Gfx), 2)
143 ems_Draw(N(Frame2Gfx), 2)
144 ems_Draw(N(Frame3Gfx), 2)
146 ems_End
147};
148
150
151EvtScript N(EVS_UseItem) = {
152 SetConst(LVarA, ITEM_EGG_MISSILE)
153 ExecWait(N(UseItemWithEffect))
154 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
155 Call(MoveBattleCamOver, 15)
156 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Throw)
158 Wait(3)
159 Call(CreateVirtualEntity, LVarA, Ref(N(EMS_EggMissile)))
160 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
161 Add(LVar0, 20)
162 Add(LVar1, 42)
163 Add(LVar2, 5)
165 Call(InitTargetIterator)
166 Call(SetGoalToTarget, ACTOR_SELF)
167 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
168 Thread
169 Set(LVar0, 0)
170 Loop(18)
171 Add(LVar0, 60)
173 Wait(1)
174 EndLoop
177 Add(LVar2, 5)
181 Call(N(func_802A123C_71CF1C), LVar0, LVar1, LVar2)
182 Thread
183 Call(StartRumble, BTL_RUMBLE_HIT_EXTREME)
184 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.75))
185 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.5))
186 Call(ShakeCam, CAM_BATTLE, 0, 4, Float(1.2))
187 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.45))
189 Call(GetItemPower, ITEM_EGG_MISSILE, LVar0, LVar1)
191 ExecWait(N(PlayerGoHome))
192 Return
193 End
194};
Bytecode EvtScript[]
EntityModelScript unusedModelScript
s32 EntityModelScript[]
Definition entity.h:7
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition entity.h:56
#define ems_Restart
Definition entity.h:49
#define ems_SetRenderMode(mode)
Definition entity.h:51
#define ems_End
Definition entity.h:47
#define ems_Draw(dlist, holdTime)
Definition entity.h:48
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4825
@ SOUND_EGG_MISSILE_BLAST
Definition enums.h:1325
@ SOUND_THROW
Definition enums.h:1311
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
@ BTL_RUMBLE_HIT_EXTREME
Definition enums.h:4257
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_BLAST
Definition enums.h:2860
@ DAMAGE_TYPE_FIRE
Definition enums.h:2852
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
#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
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus CreateVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityJumpGravity(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus DeleteVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus GetItemPower(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityJumpTo(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityRotation(Evt *script, b32 isInitialCall)
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#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 ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:51
#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 LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#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