Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hos_01.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
3
4#define NAMESPACE A(hos_01)
5
6u16 N(StarPhaseAngles)[16] = {};
7
8void N(build_gfx_yellow_stars)(s32 index) {
9 Vtx* firstVertex;
10 Vtx* copiedVertices;
11 s32 numVertices;
12 s32 i;
13 s32 temp3;
14
15 index--;
16 mdl_get_copied_vertices(index, &firstVertex, &copiedVertices, &numVertices);
17
18 for (i = 0; i < numVertices; i++) {
19 Vtx* vtx = &copiedVertices[i];
20 s16 temp1 = (sins(N(StarPhaseAngles)[index] * (i % 3 + 1) + i) + 0x8000) / 2;
21 s32 temp2 = temp1 * 155;
22 vtx->v.cn[0] = temp2 / 0x8000 + 100;
23 vtx->v.cn[1] = temp2 / 0x8000 + 100;
24
25 temp3 = sins(N(StarPhaseAngles)[index] / 0x8000 * (((i / 2) % 3 + 1) << 15) + N(StarPhaseAngles)[index] / 0x4000 * 0x8000 + i) + 0x8000;
26 vtx->v.cn[2] = vtx->v.cn[0] * temp3 / 0x10000;
27 }
28
29 gSPDisplayList(gMainGfxPos++, mdl_get_copied_gfx(index));
30 N(StarPhaseAngles)[index] += (s32)RAD_TO_BINANG(25.1898);
31}
32
33void N(build_gfx_blue_stars)(s32 index) {
34 Vtx* firstVertex;
35 Vtx* copiedVertices;
36 s32 numVertices;
37 s32 i;
38 s32 temp3;
39
40 index--;
41 mdl_get_copied_vertices(index, &firstVertex, &copiedVertices, &numVertices);
42
43 for (i = 0; i < numVertices; i++) {
44 u8* colors = copiedVertices[i].v.cn;
45 s16 temp1 = (sins(N(StarPhaseAngles)[index] * (i % 3 + 1) + i) + 0x8000) / 2;
46 colors[0] = temp1 * 155 / 0x8000 + 48.62745098039216;
47 colors[1] = temp1 * 155 / 0x8000 + 89.41176470588236;
48
49 temp3 = sins(N(StarPhaseAngles)[index] / 0x8000 * (((i / 2) % 3 + 1) << 15) + N(StarPhaseAngles)[index] / 0x4000 * 0x8000 + i) + 0x8000;
50 colors[2] = colors[0] * temp3 / 0x10000 + 99.6078431372549;
51 }
52
53 gSPDisplayList(gMainGfxPos++, mdl_get_copied_gfx(index));
54 N(StarPhaseAngles)[index] += (s32)RAD_TO_BINANG(25.1898);
55}
56
57void N(build_gfx_green_stars)(s32 index) {
58 Vtx* firstVertex;
59 Vtx* copiedVertices;
60 s32 numVertices;
61 s32 i;
62 s32 temp3;
63
64 index--;
65 mdl_get_copied_vertices(index, &firstVertex, &copiedVertices, &numVertices);
66
67 for (i = 0; i < numVertices; i++) {
68 u8* colors = copiedVertices[i].v.cn;
69 s16 temp1 = (sins(N(StarPhaseAngles)[index] * (i % 3 + 1) + i) + 0x8000) / 2;
70 colors[0] = temp1 * 155 / 0x8000 + 67.45098039215686;
71 colors[1] = temp1 * 155 / 0x8000 + 100.0;
72
73 temp3 = sins(N(StarPhaseAngles)[index] / 0x8000 * (((i / 2) % 3 + 1) << 15) + N(StarPhaseAngles)[index] / 0x4000 * 0x8000 + i) + 0x8000;
74 colors[2] = colors[0] * temp3 / 0x10000 + 59.21568627450981;
75 }
76
77 gSPDisplayList(gMainGfxPos++, mdl_get_copied_gfx(index));
78 N(StarPhaseAngles)[index] += (s32)RAD_TO_BINANG(25.1898);
79}
80
81void N(build_gfx_pink_stars)(s32 index) {
82 Vtx* firstVertex;
83 Vtx* copiedVertices;
84 s32 numVertices;
85 s32 i;
86 s32 temp3;
87
88 index--;
89 mdl_get_copied_vertices(index, &firstVertex, &copiedVertices, &numVertices);
90
91 for (i = 0; i < numVertices; i++) {
92 u8* colors = copiedVertices[i].v.cn;
93 s16 temp1 = (sins(N(StarPhaseAngles)[index] * (i % 3 + 1) + i) + 0x8000) / 2;
94 colors[0] = temp1 * 155 / 0x8000 + 100.0;
95 colors[1] = temp1 * 155 / 0x8000 + 80.3921568627451;
96
97 temp3 = sins(N(StarPhaseAngles)[index] / 0x8000 * (((i / 2) % 3 + 1) << 15) + N(StarPhaseAngles)[index] / 0x4000 * 0x8000 + i) + 0x8000;
98 colors[2] = colors[0] * temp3 / 0x10000 + 96.07843137254902;
99 }
100
101 gSPDisplayList(gMainGfxPos++, mdl_get_copied_gfx(index));
102 N(StarPhaseAngles)[index] += (s32)RAD_TO_BINANG(25.1898);
103}
104
105EvtScript N(EVS_PreBattle) = {
106 Call(SetSpriteShading, SHADING_NONE)
107
112
117
122
127
132
137
142
147
152
157
158 Thread
163 Set(LVar0, 0)
164 Set(LVar1, 0)
165 Set(LVar2, 0)
166 Set(LVar3, 0)
167 Loop(0)
168 Add(LVar0, 80)
169 Add(LVar1, -150)
170 IfGt(LVar0, 0x8000)
171 Add(LVar0, -0x8000)
172 EndIf
173 IfLt(LVar1, -0x8000)
174 Add(LVar1, 0x8000)
175 EndIf
176 Add(LVar2, -50)
177 Add(LVar3, 100)
178 IfLt(LVar2, -0x8000)
179 Add(LVar2, 0x8000)
180 EndIf
181 IfGt(LVar3, 0x8000)
182 Add(LVar3, -0x8000)
183 EndIf
186 Wait(1)
187 EndLoop
189 Thread
190 Label(2)
191 Call(MakeLerp, -7, 7, 30, EASING_COS_IN_OUT)
192 Label(0)
200 Wait(1)
201 IfEq(LVar1, 1)
202 Goto(0)
203 EndIf
204 Call(MakeLerp, 7, -7, 30, EASING_COS_IN_OUT)
205 Label(1)
213 Wait(1)
214 IfEq(LVar1, 1)
215 Goto(1)
216 EndIf
217 Goto(2)
219 Thread
220 Label(3)
221 Call(MakeLerp, 7, -7, 30, EASING_COS_IN_OUT)
222 Label(4)
228 Wait(1)
229 IfEq(LVar1, 1)
230 Goto(4)
231 EndIf
232 Call(MakeLerp, -7, 7, 30, EASING_COS_IN_OUT)
233 Label(5)
239 Wait(1)
240 IfEq(LVar1, 1)
241 Goto(5)
242 EndIf
243 Goto(3)
245 Return
246 End
247};
248
249EvtScript N(EVS_PostBattle) = {
250 Return
251 End
252};
253
254s32 N(ForegroundModels)[] = {
257};
258
259Stage NAMESPACE = {
260 .texture = "hos_tex",
261 .shape = "hos_bt01_shape",
262 .hit = "hos_bt01_hit",
263 .bg = "hos_bg",
264 .preBattle = &N(EVS_PreBattle),
265 .postBattle = &N(EVS_PostBattle),
266 .foregroundModelList = N(ForegroundModels),
267};
#define MODEL_o349
#define MODEL_o332
#define MODEL_o333
#define MODEL_o341
#define MODEL_o338
#define MODEL_o343
#define MODEL_o354
Bytecode EvtScript[]
#define MODEL_o353
#define MODEL_o344
@ TEX_PANNER_MAIN
Definition enums.h:4415
@ TEX_PANNER_0
Definition enums.h:4398
@ TEX_PANNER_AUX
Definition enums.h:4416
@ ENV_TINT_UNCHANGED
Definition enums.h:4383
@ MODEL_FLAG_HAS_LOCAL_VERTEX_COPY
Definition enums.h:4364
@ EASING_COS_IN_OUT
Definition enums.h:520
@ CUSTOM_GFX_1
Definition enums.h:4422
@ CUSTOM_GFX_A
Definition enums.h:4431
@ CUSTOM_GFX_2
Definition enums.h:4423
@ CUSTOM_GFX_4
Definition enums.h:4425
@ CUSTOM_GFX_5
Definition enums.h:4426
@ CUSTOM_GFX_3
Definition enums.h:4424
@ CUSTOM_GFX_9
Definition enums.h:4430
@ CUSTOM_GFX_8
Definition enums.h:4429
@ CUSTOM_GFX_6
Definition enums.h:4427
@ CUSTOM_GFX_7
Definition enums.h:4428
@ VTX_COPY_2
Definition enums.h:4442
@ VTX_COPY_5
Definition enums.h:4445
@ VTX_COPY_8
Definition enums.h:4448
@ VTX_COPY_9
Definition enums.h:4449
@ VTX_COPY_7
Definition enums.h:4447
@ VTX_COPY_0
Definition enums.h:4440
@ VTX_COPY_3
Definition enums.h:4443
@ VTX_COPY_6
Definition enums.h:4446
@ VTX_COPY_4
Definition enums.h:4444
@ VTX_COPY_1
Definition enums.h:4441
#define MODEL_o334
Gfx * mdl_get_copied_gfx(s32 copyIndex)
Definition model.c:4086
void mdl_get_copied_vertices(s32 copyIndex, Vtx **firstVertex, Vtx **copiedVertices, s32 *numCopied)
Definition model.c:4077
void N build_gfx_green_stars(s32 index)
Definition hos_01.inc.c:57
void N build_gfx_blue_stars(s32 index)
Definition hos_01.inc.c:33
void N build_gfx_pink_stars(s32 index)
Definition hos_01.inc.c:81
void N build_gfx_yellow_stars(s32 index)
Definition hos_01.inc.c:8
#define MODEL_o336
#define MODEL_o347
#define MODEL_o352
#define MODEL_o357
#define MODEL_o361
#define MODEL_o346
#define MODEL_o363
#define MODEL_o345
#define MODEL_o362
#define MODEL_o355
ApiStatus SetCustomGfxBuilders(Evt *script, b32 isInitialCall)
ApiStatus SetModelCustomGfx(Evt *script, b32 isInitialCall)
ApiStatus SetSpriteShading(Evt *script, b32 isInitialCall)
ApiStatus TranslateModel(Evt *script, b32 isInitialCall)
Translates the given model's position.
ApiStatus UpdateLerp(Evt *script, b32 isInitialCall)
ApiStatus SetTexPanOffset(Evt *script, b32 isInitialCall)
Sets offsets for texture panners.
ApiStatus SetModelFlags(Evt *script, b32 isInitialCall)
Sets flags for models.
ApiStatus MakeLerp(Evt *script, b32 isInitialCall)
ApiStatus MakeLocalVertexCopy(Evt *script, b32 isInitialCall)
ApiStatus SetTexPanner(Evt *script, b32 isInitialCall)
Sets a model's pannerID and sets the texture pan flag.
#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 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 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 RAD_TO_BINANG(x)
Definition macros.h:133
#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 LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217
#define STAGE_MODEL_LIST_END
Definition battle.h:8
Gfx * gMainGfxPos
Definition cam_main.c:15