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

Go to the source code of this file.

Functions

void landing_dust_init (EffectInstance *effect)
 
void landing_dust_update (EffectInstance *effect)
 
void landing_dust_render (EffectInstance *effect)
 
void landing_dust_appendGfx (void *effect)
 
void func_E000C000 (LandingDustFXData *part)
 
void func_E000C094 (LandingDustFXData *part)
 
void func_E000C0C8 (LandingDustFXData *part)
 
void landing_dust_main (s32 type, f32 x, f32 y, f32 z, f32 angle)
 

Variables

Gfx D_09002780_32B620 []
 
Gfx D_09002868_32B708 []
 
Gfx D_09002950_32B7F0 []
 
Gfx D_09002A38_32B8D8 []
 
Gfx D_09002B20_32B9C0 []
 
Gfx D_09002B40_32B9E0 []
 
Gfx D_09002B60_32BA00 []
 

Function Documentation

◆ landing_dust_init()

void landing_dust_init ( EffectInstance * effect)

Definition at line 212 of file landing_dust.c.

212 {
213}

Referenced by landing_dust_main().

◆ landing_dust_update()

void landing_dust_update ( EffectInstance * effect)

Definition at line 215 of file landing_dust.c.

215 {
216 LandingDustFXData* data = effect->data.landingDust;
217
218 data->unk_40 = D_E000CD24[data->unk_38][data->unk_3C++];
219
220 if (data->unk_40 < 0) {
221 remove_effect(effect);
222 } else {
223 s32 type = data->type;
224 s32 i;
225
226 data++;
227
228 for (i = 1; i < effect->numParts; i++, data++) {
229 switch (type) {
230 case 0:
231 case 1:
232 func_E000C000(data);
233 break;
234 case 2:
235 break;
236 case 3:
237 func_E000C094(data);
238 break;
239 case 4:
240 func_E000C0C8(data);
241 break;
242 }
243 }
244 }
245}
#define remove_effect
struct LandingDustFXData * landingDust
Definition effects.h:2470
EffectData data
Definition effects.h:2605
void func_E000C000(LandingDustFXData *part)
void func_E000C0C8(LandingDustFXData *part)
void func_E000C094(LandingDustFXData *part)

Referenced by landing_dust_main().

◆ landing_dust_render()

void landing_dust_render ( EffectInstance * effect)

Definition at line 247 of file landing_dust.c.

247 {
248 RenderTask renderTask;
249 RenderTask* retTask;
250
252 renderTask.appendGfxArg = effect;
253 renderTask.dist = 0;
255
256 retTask = queue_render_task(&renderTask);
258}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_PASS_THROUGH
Definition enums.h:3306
void landing_dust_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by landing_dust_main().

◆ landing_dust_appendGfx()

void landing_dust_appendGfx ( void * effect)

Definition at line 260 of file landing_dust.c.

260 {
261 LandingDustFXData* part = ((EffectInstance*)effect)->data.landingDust;
262 s32 type = part->type;
263 s32 temp_t0 = part->unk_40;
264 Matrix4f mtx1;
265 Matrix4f mtx2;
266 Matrix4f mtx3;
267 s32 spD8;
268 s32 spDC;
269 s32 temp_lo;
270 s32 envAlpha;
271 Gfx* dlist1;
272 Gfx* dlist2;
273 s32 phi_a0;
274 s32 temp;
275 s32 i;
276
277 envAlpha = (temp_t0 & 0x38) * 4;
278
279 dlist1 = sDlists[type];
280 dlist2 = sDlists2[type];
281
282 gDPPipeSync(gMainGfxPos++);
283 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
284 gSPDisplayList(gMainGfxPos++, dlist2);
285
286 spD8 = temp_t0 & 7;
287 spDC = temp_t0 & 0x40;
288
289 guTranslateF(mtx1, part->x, part->y, part->z);
290 guRotateF(mtx2, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
291 guMtxCatF(mtx2, mtx1, mtx3);
293
294 gSPMatrix(gMainGfxPos++,
295 &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
296
297 switch (type) {
298 case 0:
299 case 1:
300 gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 222, 222, 110);
301 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, envAlpha);
302 break;
303 case 2:
304 case 3:
305 case 4:
306 gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 222, 222, 130);
307 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, envAlpha);
308 break;
309 }
310
311 if (type == 0) {
312 phi_a0 = 24;
313 } else {
314 phi_a0 = 32;
315 }
316
317 temp_lo = spD8 * phi_a0;
318 temp = temp_lo + phi_a0;
319
320 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, temp_lo * 4, 0, temp * 4, phi_a0 * 4);
321
322 if (spDC) {
323 gDPSetTileSize(gMainGfxPos++, 1, temp * 4, phi_a0 * 4, (temp_lo + (phi_a0 * 2)) * 4, phi_a0 * 8);
324 } else {
325 gDPSetTileSize(gMainGfxPos++, 1, temp * 4, 0, (temp_lo + (phi_a0 * 2)) * 4, phi_a0 * 4);
326 }
327
328 if (type == 2) {
329 gSPDisplayList(gMainGfxPos++, dlist1);
330 }
331
332 part++;
333
334 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
335 guTranslateF(mtx1, part->x, part->y, part->z);
338 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
339 gSPDisplayList(gMainGfxPos++, dlist1);
340 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
341 }
342
343 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
344 gDPPipeSync(gMainGfxPos++);
345}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
s32 gCurrentCameraID
Definition cam_math.c:4
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by landing_dust_render().

◆ func_E000C000()

void func_E000C000 ( LandingDustFXData * part)

Definition at line 44 of file landing_dust.c.

44 {
45 part->unk_18 += part->unk_1C;
46 part->unk_14 += part->unk_18;
47 part->unk_10 += part->unk_14;
48 part->x += part->unk_10 * part->unk_30;
49 part->z += part->unk_10 * part->unk_34;
50 part->unk_28 += part->unk_2C;
51 part->unk_24 += part->unk_28;
52 part->unk_20 += part->unk_24;
53 part->y += part->unk_20;
54}

Referenced by landing_dust_update().

◆ func_E000C094()

void func_E000C094 ( LandingDustFXData * part)

Definition at line 56 of file landing_dust.c.

56 {
57 part->y += part->unk_20;
58 part->unk_20 += part->unk_24;
59 part->unk_24 *= part->unk_28;
60}

Referenced by landing_dust_update().

◆ func_E000C0C8()

void func_E000C0C8 ( LandingDustFXData * part)

Definition at line 62 of file landing_dust.c.

62 {
63 part->x += part->unk_10 * part->unk_30;
64 part->y += part->unk_20;
65 part->z += part->unk_10 * part->unk_34;
66 part->unk_20 += part->unk_24;
67 part->unk_10 *= part->unk_14;
68 part->unk_24 *= part->unk_28;
69 part->unk_20 *= part->unk_2C;
70}

Referenced by landing_dust_update().

◆ landing_dust_main()

void landing_dust_main ( s32 type,
f32 x,
f32 y,
f32 z,
f32 angle )

Definition at line 72 of file landing_dust.c.

72 {
74 EffectBlueprint* bpPtr = &bp;
75 EffectInstance* effect;
77 f32 theta;
78 f32 temp_f20_2;
79 s32 numParts;
80 s32 i;
81
82 switch (type) {
83 case 2:
84 numParts = 1;
85 break;
86 case 3:
87 numParts = 4;
88 break;
89 case 4:
90 numParts = 9;
91 break;
92 default:
93 numParts = 3;
94 break;
95 }
96
97 bpPtr->init = landing_dust_init;
100 bpPtr->unk_00 = 0;
101 bpPtr->renderUI = NULL;
102 bpPtr->effectID = EFFECT_LANDING_DUST;
103
104 effect = create_effect_instance(bpPtr);
105 effect->numParts = numParts;
106
107 data = general_heap_malloc(numParts * sizeof(*data));
108 effect->data.landingDust = data;
109 ASSERT(effect->data.landingDust != NULL);
110
111 mem_clear(data, numParts * sizeof(*data));
112
113 switch (type) {
114 case 0:
115 case 1:
116 data->unk_38 = 0;
117 break;
118 case 3:
119 data->unk_38 = 2;
120 break;
121 case 2:
122 case 4:
123 data->unk_38 = 3;
124 break;
125 }
126
127 data->unk_3C = 0;
128 data->type = type;
129 data->x = x;
130 data->y = y;
131 data->z = z;
132
133 data++;
134
135 switch (type) {
136 case 0:
137 case 1:
138 for (i = 1; i < numParts; i++, data++) {
139 data->unk_10 = -3.0f;
140 data->unk_14 = 0.29999998f;
141 data->unk_18 = 0;
142 data->unk_1C = 0;
143 data->unk_20 = 1.75f;
144 data->unk_24 = -0.16f;
145 data->unk_28 = 0.0f;
146 data->unk_2C = 0.0f;
147 data->x = 0.0f;
148 data->y = 0.0f;
149 data->z = 4.0f;
150 theta = clamp_angle(90 + (180 * (i - 1)));
151 data->unk_30 = sin_deg(theta);
152 data->unk_34 = cos_deg(theta);
153 }
154 break;
155 case 2:
156 break;
157 case 3:
158 for (i = 1; i < numParts; i++, data++) {
159 switch (i - 1) {
160 case 0:
161 theta = 135.0f;
162 data->x = -sin_deg(theta) * 25.0f;
163 data->y = 0.0f;
164 data->z = -cos_deg(theta) * 25.0f;
165 data->unk_24 = -0.04f;
166 data->unk_28 = 0.94f;
167 data->unk_20 = 0.95f;
168 break;
169 case 1:
170 theta = -135.0f;
171 data->x = -sin_deg(theta) * 25.0f;
172 data->y = 4.0f;
173 data->z = -cos_deg(theta) * 25.0f;
174 data->unk_24 = -0.04f;
175 data->unk_28 = 0.94f;
176 data->unk_20 = 0.84999996f;
177 break;
178 case 2:
179 theta = 20.0f;
180 data->x = -sin_deg(theta) * 25.0f;
181 data->y = 10.0f;
182 data->z = -cos_deg(theta) * 25.0f;
183 data->unk_24 = -0.04f;
184 data->unk_28 = 0.94f;
185 data->unk_20 = 0.75f;
186 break;
187
188 }
189 data->unk_30 = 0.0f;
190 data->unk_34 = 0.0f;
191 }
192 break;
193 case 4:
194 for (i = 1; i < numParts; i++, data++) {
195 data->unk_10 = -3.0f;
196 data->unk_14 = 0.93f;
197 data->unk_20 = 0.0f;
198 data->unk_24 = 0.099999994f;
199 data->unk_28 = 0.94f;
200 data->unk_2C = 0.94f;
201 theta = angle + ((i - 1) * 360 / (numParts - 1));
202 data->x = -sin_deg(theta) * 10.0f;
203 data->y = 0.0f;
204 data->z = -cos_deg(theta) * 10.0f;
205 data->unk_30 = sin_deg(theta);
206 data->unk_34 = cos_deg(theta);
207 }
208 break;
209 }
210}
#define general_heap_malloc
#define sin_deg
#define clamp_angle
#define cos_deg
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
void landing_dust_render(EffectInstance *effect)
void landing_dust_init(EffectInstance *effect)
void landing_dust_update(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

Referenced by star_update().

Variable Documentation

◆ D_09002780_32B620

Gfx D_09002780_32B620[]
extern

◆ D_09002868_32B708

Gfx D_09002868_32B708[]
extern

◆ D_09002950_32B7F0

Gfx D_09002950_32B7F0[]
extern

◆ D_09002A38_32B8D8

Gfx D_09002A38_32B8D8[]
extern

◆ D_09002B20_32B9C0

Gfx D_09002B20_32B9C0[]
extern

◆ D_09002B40_32B9E0

Gfx D_09002B40_32B9E0[]
extern

◆ D_09002B60_32BA00

Gfx D_09002B60_32BA00[]
extern