Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
radial_shimmer.c File Reference

Go to the source code of this file.

Functions

void radial_shimmer_init (EffectInstance *effect)
 
void radial_shimmer_update (EffectInstance *effect)
 
void radial_shimmer_render (EffectInstance *effect)
 
void radial_shimmer_appendGfx (void *effect)
 
EffectInstanceradial_shimmer_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
 

Variables

Gfx D_09003428_36A188 []
 
Gfx D_09003508_36A268 []
 
Gfx D_090035E8_36A348 []
 
Gfx D_090036C8_36A428 []
 
Gfx D_09003830_36A590 []
 
Gfx D_090038B8_36A618 []
 
Gfx D_090039A8_36A708 []
 
Gfx D_09003A88_36A7E8 []
 
Gfx * D_E0066C50 []
 
Gfx * D_E0066C8C []
 
s32 D_E0066CC8 []
 

Function Documentation

◆ radial_shimmer_init()

void radial_shimmer_init ( EffectInstance * effect)

Definition at line 203 of file radial_shimmer.c.

203 {
204}

Referenced by radial_shimmer_main().

◆ radial_shimmer_update()

void radial_shimmer_update ( EffectInstance * effect)

Definition at line 206 of file radial_shimmer.c.

206 {
207 RadialShimmerFXData* part = effect->data.radialShimmer;
208 s32 unk_28;
209 f32 outX;
210 f32 outY;
211 f32 outZ;
212 f32 outS;
213 s32 i;
214
215 part->timeLeft--;
216 part->lifeTime++;
217
218 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
219 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
220 part->timeLeft = 16;
221 }
222
223 if (part->timeLeft < 0) {
224 remove_effect(effect);
225 return;
226 }
227
228 unk_28 = part->timeLeft;
229
230 if (part->lifeTime <= 10) {
231 part->unk_24 = (part->lifeTime * 255) / 10;
232 }
233
234 if (unk_28 < 6) {
235 part->unk_24 = (unk_28 * 255) / 6;
236 }
237
238 if (unk_28 < 10 && part->unk_00 == 4) {
239 part->unk_1C *= 0.7;
240 }
241
242 part->unk_1C = part->unk_20;
243
244 transform_point(&gCameras[gCurrentCameraID].mtxPerspective[0], part->unk_04, part->unk_08, part->unk_0C,
245 1.0f, &outX, &outY, &outZ, &outS);
246
247 outS = 1.0f / outS;
248 outX *= outS;
249 outY *= outS;
250 outZ *= outS;
251
252 part->unk_10 = outX;
253 part->unk_14 = outY;
254 part->unk_18 = 0.0f;
255
256 for (i = 0; i < effect->numParts; i++, part++) {
257 part->unk_58 += part->unk_5C;
258 part->unk_50 += part->unk_54;
259 part->unk_40 += part->unk_44;
260 part->unk_30 += part->unk_34;
261 part->unk_38 += part->unk_3C;
262 part->unk_48 += part->unk_4C;
263
264 if (part->unk_40 < 0.0f) {
265 part->unk_40 += 512.0f;
266 }
267
268 if (part->unk_48 < 0.0f) {
269 part->unk_48 += 512.0f;
270 }
271 }
272}
#define transform_point
#define remove_effect
struct RadialShimmerFXData * radialShimmer
Definition effects.h:2515
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
Camera gCameras[4]
Definition cam_main.c:17
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by radial_shimmer_main().

◆ radial_shimmer_render()

void radial_shimmer_render ( EffectInstance * effect)

Definition at line 274 of file radial_shimmer.c.

274 {
275 RenderTask renderTask;
276 RenderTask* retTask;
277
279 renderTask.appendGfxArg = effect;
280 renderTask.dist = 0;
282
283 retTask = queue_render_task(&renderTask);
285}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void radial_shimmer_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by radial_shimmer_main().

◆ radial_shimmer_appendGfx()

void radial_shimmer_appendGfx ( void * effect)

Definition at line 287 of file radial_shimmer.c.

287 {
288 Matrix4f sp20, sp60;
289 u16 spA0;
290 EffectInstance* effectTemp = effect;
291 RadialShimmerFXData* dataOrig = effectTemp->data.radialShimmer;
292 RadialShimmerFXData* data = effectTemp->data.radialShimmer;
293 Camera* camera = &gCameras[gCurrentCameraID];
294 s32 temp_f0;
295 s32 temp_f2;
296 s32 temp_f4;
297 s32 temp_f6;
298 Gfx* dlist2;
299 Gfx* dlist1;
300 s32 temp_s5;
301 s32 temp_t1;
302 s32 var_a3;
303 s32 alpha;
304 s32 other;
305 s32 t1;
306 s32 t2;
307 s32 i;
308
309 temp_s5 = data->unk_00;
310 dlist1 = D_E0066C8C[temp_s5];
311 dlist2 = D_E0066C50[temp_s5];
312
313 gDPPipeSync(gMainGfxPos++);
314 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
315
316 guTranslateF(sp20, data->unk_10, data->unk_14, data->unk_18);
317 guScaleF(sp60, data->unk_1C, data->unk_1C, 1.0f);
318 guMtxCatF(sp60, sp20, sp20);
319 guPerspectiveF(sp60, &spA0, data->unk_60, (f32) camera->viewportW / camera->viewportH, 4.0f, 16384.0f, 1.0f);
320 guMtxCatF(sp60, sp20, sp20);
322
324 G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
325
326 guTranslateF(sp20, 0.0f, 0.0f, data->unk_64);
328
330 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
331 alpha = data->unk_24;
332 gDPSetEnvColor(gMainGfxPos++, data->unk_6B, data->unk_6C, data->unk_6D, 127);
333 gSPDisplayList(gMainGfxPos++, dlist1);
334
335 for (i = 0; i < effectTemp->numParts; i++, data++) {
336 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_68, data->unk_69, data->unk_6A, alpha);
337
338 switch (temp_s5) {
339 case 0:
340 case 1:
341 other = 0x3F;
342 var_a3 = 0x1FF;
343 break;
344 case 8:
345 other = 0x3F;
346 var_a3 = 0x7F;
347 break;
348 case 11:
349 other = 0x3F;
350 var_a3 = 0xFF;
351 break;
352 default:
353 other = 0x3F;
354 var_a3 = 0x1FF;
355 break;
356 }
357
358 temp_f0 = data->unk_30;
359 temp_f2 = data->unk_40;
360 temp_f4 = data->unk_38;
361 temp_f6 = data->unk_48;
362
363 gDPSetTileSize(gMainGfxPos++, 0, temp_f0, temp_f2, temp_f0 + other * 4, temp_f2 + var_a3 * 4);
364 gDPSetTileSize(gMainGfxPos++, G_TX_MIRROR, temp_f4, temp_f6, temp_f4 + other * 4, temp_f6 + var_a3 * 4);
365 gSPDisplayList(gMainGfxPos++, dlist2);
366 }
367
368 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
370 G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
371 gDPPipeSync(gMainGfxPos++);
372}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guPerspectiveF
#define guScaleF
Gfx * D_E0066C50[]
Gfx * D_E0066C8C[]
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by radial_shimmer_render().

◆ radial_shimmer_main()

EffectInstance * radial_shimmer_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
s32 arg5 )

Definition at line 35 of file radial_shimmer.c.

35 {
37 EffectInstance* effect;
39 s32 numParts = 1;
40 s32 arg5_2 = arg5;
41
45 bp.unk_00 = 0;
46 bp.renderUI = NULL;
47 bp.effectID = EFFECT_RADIAL_SHIMMER;
48
49 effect = create_effect_instance(&bp);
50 effect->numParts = numParts;
51 data = effect->data.radialShimmer = general_heap_malloc(numParts * sizeof(*data));
52 ASSERT(effect->data.radialShimmer != NULL);
53
54 data->unk_00 = arg0;
55 data->timeLeft = arg5_2;
56 data->unk_24 = data->lifeTime = 0;
57 data->unk_10 = arg1;
58 data->unk_14 = arg2;
59 data->unk_18 = arg3;
60 data->unk_04 = arg1;
61 data->unk_08 = arg2;
62 data->unk_0C = arg3;
63 data->unk_20 = arg4;
64 data->unk_68 = 255;
65 data->unk_69 = 255;
66 data->unk_6A = 0;
67 data->unk_6B = 255;
68 data->unk_6C = 255;
69 data->unk_6D = 255;
70 data->unk_5C = 4.0f;
71 data->unk_1C = 10.0f;
72 data->unk_60 = 50.0f;
73 data->unk_40 = data->unk_44 = 0.0f;
74 data->unk_48 = data->unk_4C = 0.0f;
75 data->unk_30 = data->unk_34 = 0.0f;
76 data->unk_38 = data->unk_3C = 0.0f;
77 data->unk_50 = data->unk_58 = 0.0f;
78 data->unk_54 = 0.0f;
79 data->unk_64 = 0.0f;
80
81 switch (arg0) {
82 case 0:
83 case 1:
84 data->unk_40 = 128.0f;
85 data->unk_44 = 128.0f / arg5_2;
86 data->unk_60 = 70.0f;
87 data->unk_64 = -100.0f;
88 break;
89 case 2:
90 data->unk_34 = 7.0f;
91 data->unk_44 = -3.0f;
92 data->unk_3C = 3.0f;
93 data->unk_4C = -7.0f;
94 break;
95 case 3:
96 data->unk_68 = 235;
97 data->unk_69 = 235;
98 data->unk_6A = 235;
99 data->unk_40 = 256.0f;
100 data->unk_48 = 256.0f;
101 data->unk_34 = 7.0f;
102 data->unk_44 = -3.0f;
103 data->unk_3C = -3.0f;
104 data->unk_4C = -4.0f;
105 break;
106 case 4:
107 data->unk_68 = 20;
108 data->unk_69 = 200;
109 data->unk_6A = 32;
110 data->unk_34 = 7.0f;
111 data->unk_44 = -3.0f;
112 data->unk_3C = -3.0f;
113 data->unk_4C = -5.0f;
114 break;
115 case 5:
116 data->unk_34 = 7.0f;
117 data->unk_44 = 3.0f;
118 data->unk_3C = 3.0f;
119 data->unk_4C = 5.0f;
120 break;
121 case 6:
122 data->unk_68 = 235;
123 data->unk_69 = 235;
124 data->unk_6A = 235;
125 data->unk_34 = 7.0f;
126 data->unk_44 = 3.0f;
127 data->unk_3C = -3.0f;
128 data->unk_4C = 4.0f;
129 break;
130 case 7:
131 data->unk_68 = 255;
132 data->unk_69 = 100;
133 data->unk_6A = 32;
134 data->unk_34 = 7.0f;
135 data->unk_44 = 3.0f;
136 data->unk_3C = -3.0f;
137 data->unk_4C = 5.0f;
138 break;
139 case 8:
140 data->unk_68 = 215;
141 data->unk_69 = 208;
142 data->unk_6A = 0;
143 data->unk_6B = 215;
144 data->unk_6C = 255;
145 data->unk_6D = 0;
146 data->unk_34 = 7.0f;
147 data->unk_44 = -3.0f;
148 data->unk_3C = -3.0f;
149 data->unk_4C = -2.0f;
150 break;
151 case 9:
152 data->unk_40 = 128.0f;
153 data->unk_44 = 128.0f / arg5_2;
154 data->unk_64 = -100.0f;
155 break;
156 case 10:
157 data->unk_68 = 0;
158 data->unk_69 = 32;
159 data->unk_6A = 255;
160 data->unk_68 = 7;
161 data->unk_69 = 0;
162 data->unk_6A = 216;
163 data->unk_6B = 228;
164 data->unk_6C = 255;
165 data->unk_6D = 0;
166 data->unk_34 = 7.0f;
167 data->unk_44 = -3.0f;
168 data->unk_3C = -3.0f;
169 data->unk_4C = -2.0f;
170 break;
171 case 11:
172 data->unk_68 = 7;
173 data->unk_69 = 0;
174 data->unk_6A = 216;
175 data->unk_6B = 228;
176 data->unk_6C = 255;
177 data->unk_6D = 0;
178 data->unk_34 = 7.0f;
179 data->unk_44 = 8.0f;
180 data->unk_3C = -3.0f;
181 data->unk_4C = 6.0f;
182 break;
183 case 12:
184 case 13:
185 data->unk_34 = 7.0f;
186 data->unk_44 = -3.0f;
187 data->unk_3C = -5.0f;
188 data->unk_4C = -4.0f;
189 break;
190 case 14:
191 default:
192 data->unk_40 = 4.0f;
193 data->unk_34 = 7.0f;
194 data->unk_4C = 3.5f;
195 data->unk_60 = 20.0f;
196 data->unk_64 = -106.0f;
197 break;
198 }
199
200 return effect;
201}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void radial_shimmer_update(EffectInstance *effect)
void radial_shimmer_init(EffectInstance *effect)
void radial_shimmer_render(EffectInstance *effect)
void(* renderUI)(EffectInstance *effectInst)
Definition effects.h:2655
void(* init)(EffectInstance *effectInst)
Definition effects.h:2652
void(* update)(EffectInstance *effectInst)
Definition effects.h:2653
void(* renderWorld)(EffectInstance *effectInst)
Definition effects.h:2654

Variable Documentation

◆ D_09003428_36A188

Gfx D_09003428_36A188[]
extern

◆ D_09003508_36A268

Gfx D_09003508_36A268[]
extern

◆ D_090035E8_36A348

Gfx D_090035E8_36A348[]
extern

◆ D_090036C8_36A428

Gfx D_090036C8_36A428[]
extern

◆ D_09003830_36A590

Gfx D_09003830_36A590[]
extern

◆ D_090038B8_36A618

Gfx D_090038B8_36A618[]
extern

◆ D_090039A8_36A708

Gfx D_090039A8_36A708[]
extern

◆ D_09003A88_36A7E8

Gfx D_09003A88_36A7E8[]
extern

◆ D_E0066C50

◆ D_E0066C8C

◆ D_E0066CC8

s32 D_E0066CC8[]
Initial value:
= {
0xFFC59CFF, 0x9CFFFF73, 0xD6FF9CFF, 0xFFC57BFF, 0xB4FFDE73, 0xFFFF949C
}

Definition at line 31 of file radial_shimmer.c.

31 {
32 0xFFC59CFF, 0x9CFFFF73, 0xD6FF9CFF, 0xFFC57BFF, 0xB4FFDE73, 0xFFFF949C
33};