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

Go to the source code of this file.

Functions

void dust_init (EffectInstance *effect)
 
void dust_render (EffectInstance *effect)
 
void dust_update (EffectInstance *effect)
 
void dust_appendGfx (void *effect)
 
EffectInstancedust_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4)
 

Variables

Gfx D_09000CC0_33FCC0 []
 
Gfx D_09000D68_33FD68 []
 
Gfx D_09000E18_33FE18 []
 
Gfx D_09000E38_33FE38 []
 
Gfx D_09000E58_33FE58 []
 

Function Documentation

◆ dust_init()

void dust_init ( EffectInstance * effect)

Definition at line 84 of file dust.c.

84 {
85}

Referenced by dust_main().

◆ dust_render()

void dust_render ( EffectInstance * effect)

Definition at line 115 of file dust.c.

115 {
116 RenderTask renderTask;
117 RenderTask* retTask;
118
119 renderTask.appendGfx = dust_appendGfx;
120 renderTask.appendGfxArg = effect;
121 renderTask.dist = 0;
123
124 retTask = queue_render_task(&renderTask);
126}
void dust_appendGfx(void *effect)
Definition dust.c:128
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by dust_main().

◆ dust_update()

void dust_update ( EffectInstance * effect)

Definition at line 87 of file dust.c.

87 {
88 s32 i;
89 s32 unk00;
90 DustFXData* part = effect->data.dust;
91
92 part->unk_2C--;
93 if (part->unk_2C < 0) {
94 remove_effect(effect);
95 return;
96 }
97
98 unk00 = part->unk_00;
99 if (part->unk_2C < 24) {
100 part->unk_18 *= 0.9;
101 }
102
103 part++;
104 for (i = 1; i < effect->numParts; i++, part++) {
105 part->unk_10 += part->unk_14;
106 part->unk_08 += part->unk_10;
107 if (unk00 < 2) {
108 part->unk_24 += 0.005;
109 }
110 part->unk_1C += part->unk_24;
111 part->unk_20 += part->unk_28;
112 }
113}
#define remove_effect
f32 unk_14
Definition effects.h:300
f32 unk_24
Definition effects.h:304
f32 unk_1C
Definition effects.h:302
struct DustFXData * dust
Definition effects.h:2485
f32 unk_08
Definition effects.h:297
s32 unk_2C
Definition effects.h:306
f32 unk_28
Definition effects.h:305
f32 unk_20
Definition effects.h:303
s32 unk_00
Definition effects.h:295
f32 unk_10
Definition effects.h:299
EffectData data
Definition effects.h:2605
s32 unk_18
Definition effects.h:301

Referenced by dust_main().

◆ dust_appendGfx()

void dust_appendGfx ( void * effect)

Definition at line 128 of file dust.c.

128 {
129 DustFXData* part = ((EffectInstance*)effect)->data.dust;
130 s32 unk_00;
131 Matrix4f sp18;
132 Matrix4f sp58;
133 Matrix4f sp98;
134 Mtx* matrix;
135 s32 i;
136
137 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
138 gSPDisplayList(gMainGfxPos++, part->unk_00 == 0 ? D_09000CC0_33FCC0 : D_09000D68_33FD68);
139 gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_30, part->unk_34, part->unk_38, part->unk_18);
140 gDPSetEnvColor(gMainGfxPos++, part->unk_3C, part->unk_40, part->unk_44, 0);
141
142 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
143 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
144 guMtxCatF(sp58, sp18, sp98);
145
146 unk_00 = part->unk_00;
147 part++;
148 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
150
151 guScaleF(sp18, part->unk_20, part->unk_1C, part->unk_20);
152 guMtxF2L(sp18, matrix);
153 guTranslateF(sp58, part->unk_04, part->unk_08, part->unk_0C);
154 guMtxCatF(sp58, sp98, sp18);
156
157 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
158 gSPMatrix(gMainGfxPos++, matrix, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
159
160 if (unk_00 < 2) {
161 gSPDisplayList(gMainGfxPos++, (i % 2) ? D_09000E18_33FE18 : D_09000E38_33FE38);
162 } else {
163 gSPDisplayList(gMainGfxPos++, D_09000E58_33FE58);
164 }
165
166 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
167 }
168}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
Gfx D_09000CC0_33FCC0[]
Gfx D_09000D68_33FD68[]
Gfx D_09000E58_33FE58[]
Gfx D_09000E38_33FE38[]
Gfx D_09000E18_33FE18[]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
s32 unk_44
Definition effects.h:312
s32 unk_30
Definition effects.h:307
s32 unk_40
Definition effects.h:311
s32 unk_3C
Definition effects.h:310
f32 unk_04
Definition effects.h:296
s32 unk_38
Definition effects.h:309
f32 unk_0C
Definition effects.h:298
s32 unk_34
Definition effects.h:308
#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 dust_render().

◆ dust_main()

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

Definition at line 15 of file dust.c.

15 {
17 EffectBlueprint* bpPtr = &bp;
18 EffectInstance* effect;
19 DustFXData* part;
20 s32 numParts;
21 s32 i;
22
23 if (arg0 < 2) {
24 numParts = 5;
25 } else {
26 numParts = 4;
27 }
28
29 bp.init = dust_init;
32 bp.unk_00 = 0;
33 bp.renderUI = NULL;
34 bp.effectID = EFFECT_DUST;
35
36 effect = create_effect_instance(bpPtr);
37 effect->numParts = numParts;
38 part = effect->data.dust = general_heap_malloc(numParts * sizeof(*part));
39 ASSERT(effect->data.dust != NULL);
40
41 part->unk_00 = arg0;
42 part->unk_04 = arg1;
43 part->unk_08 = arg2;
44 part->unk_0C = arg3;
45 part->unk_2C = arg4;
46 part->unk_18 = 255;
47 part->unk_30 = 160;
48 part->unk_34 = 160;
49 part->unk_38 = 140;
50 part->unk_3C = 160;
51 part->unk_40 = 160;
52 part->unk_44 = 140;
53
54 part++;
55 for (i = 1; i < numParts; i++, part++) {
56 part->unk_04 = rand_int(200) - 100;
57 part->unk_08 = rand_int(50);
58 part->unk_0C = 0;
59 part->unk_14 = 0;
60 part->unk_1C = 1.0f;
61 part->unk_20 = 1.0f;
62 part->unk_10 = -1.0f;
63 part->unk_24 = rand_int(10) / 200;
64 switch (arg0) {
65 case 0:
66 part->unk_28 = part->unk_24 * 0.1;
67 break;
68 case 1:
69 part->unk_28 = part->unk_24 * 0.2;
70 break;
71 default:
72 part->unk_24 = 0.4f;
73 part->unk_28 = 0.4f;
74 part->unk_10 = 0;
75 part->unk_04 = (rand_int(40) - 20) * 0.1;
76 part->unk_08 = (rand_int(40) - 20) * 0.1;
77 break;
78 }
79 }
80
81 return effect;
82}
void dust_init(EffectInstance *effect)
Definition dust.c:84
void dust_update(EffectInstance *effect)
Definition dust.c:87
void dust_render(EffectInstance *effect)
Definition dust.c:115
#define general_heap_malloc
#define rand_int
#define create_effect_instance
#define ASSERT(condition)
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 chomp_drop_update(), and floating_rock_update().

Variable Documentation

◆ D_09000CC0_33FCC0

Gfx D_09000CC0_33FCC0[]
extern

Referenced by dust_appendGfx().

◆ D_09000D68_33FD68

Gfx D_09000D68_33FD68[]
extern

Referenced by dust_appendGfx().

◆ D_09000E18_33FE18

Gfx D_09000E18_33FE18[]
extern

Referenced by dust_appendGfx().

◆ D_09000E38_33FE38

Gfx D_09000E38_33FE38[]
extern

Referenced by dust_appendGfx().

◆ D_09000E58_33FE58

Gfx D_09000E58_33FE58[]
extern

Referenced by dust_appendGfx().