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

Go to the source code of this file.

Functions

void something_rotating_init (EffectInstance *effect)
 
void something_rotating_update (EffectInstance *effect)
 
void something_rotating_render (EffectInstance *effect)
 
void something_rotating_appendGfx (void *effect)
 
EffectInstancesomething_rotating_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
 
void func_E01166E8 (s32 arg0, SomethingRotatingFXData *part)
 

Variables

Gfx D_09003F98_3FE448 []
 
Gfx D_09004010_3FE4C0 []
 
Gfx D_09004088_3FE538 []
 
Gfx D_09004100_3FE5B0 []
 
Gfx D_09004178_3FE628 []
 
Gfx D_090041F0_3FE6A0 []
 
Gfx D_09004268_3FE718 []
 
Gfx D_090042E0_3FE790 []
 
Gfx D_09004360_3FE810 []
 
Gfx D_09004458_3FE908 []
 
Gfx D_09004508_3FE9B8 []
 
Gfx D_09004600_3FEAB0 []
 
Gfx * D_E0116C60 [] = { D_09004458_3FE908 }
 
Gfx * D_E0116C64 [] = { D_09004600_3FEAB0 }
 
Gfx * D_E0116C68 [] = { D_09004360_3FE810 }
 
Gfx * D_E0116C6C [] = { D_09004508_3FE9B8 }
 
Gfx * D_E0116C70 []
 
Color_RGB8 D_E0116C8C []
 
s16 D_E0116CA4 []
 
u8 D_E0116CF8 []
 
u8 D_E0116D08 []
 
u8 D_E0116D3C []
 
u8 D_E0116D6C []
 

Function Documentation

◆ something_rotating_init()

void something_rotating_init ( EffectInstance * effect)

Definition at line 133 of file something_rotating.c.

133 {
134}

Referenced by something_rotating_main().

◆ something_rotating_update()

void something_rotating_update ( EffectInstance * effect)

Definition at line 136 of file something_rotating.c.

136 {
138 f32 x = part->pos.x;
139 f32 y = part->pos.y;
140 f32 z = part->pos.z;
141 s32 unk_14;
142 s32 unk_14_2;
143 f32 factor;
144 f32 angle1;
145 s32 i;
146
147 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
148 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
149 part->unk_10 = 32;
150 }
151
152 if (part->unk_10 < 1000) {
153 part->unk_10--;
154 }
155
156 part->unk_14++;
157
158 if (part->unk_10 < 0) {
159 remove_effect(effect);
160 return;
161 }
162
163 unk_14 = part->unk_14;
164 part->unk_20 = 90.0f;
165 angle1 = 90.0f;
166
167 part++;
168 for (i = 1; i < effect->numParts; i++, part++) {
169 f32 angle2 = unk_14 * 4.0f + (f32) i * 51.43;
170 f32 temp_f24 = sin_deg(angle2);
171 f32 temp_f22 = part->unk_2C;
172
173 part->pos.x = x + temp_f22 * sin_deg(angle1) * temp_f24;
174 part->pos.y = y + temp_f22 * cos_deg(angle2);
175 part->pos.z = z + temp_f22 * cos_deg(angle1) * temp_f24;
176
177 switch (part->state) {
178 case 1:
179 part->unk_14 = 0;
180 part->state++;
181 // fallthrough
182 case 2:
183 unk_14_2 = part->unk_14;
184
185 if (unk_14_2 < ARRAY_COUNT(D_E0116CA4)) {
186 part->unk_20 = D_E0116CA4[unk_14_2];
187 } else {
189 }
190 if (unk_14_2 < ARRAY_COUNT(D_E0116CF8)) {
191 part->primAlpha = D_E0116CF8[unk_14_2];
192 } else {
194 }
195 if (unk_14_2 < ARRAY_COUNT(D_E0116D08)) {
196 part->unk_25 = D_E0116D08[unk_14_2];
197 } else {
199 }
200
201 if (unk_14_2 < ARRAY_COUNT(D_E0116D3C)) {
202 factor = D_E0116D3C[unk_14_2];
203 } else {
204 factor = D_E0116D3C[ARRAY_COUNT(D_E0116D3C) - 1];
205 }
206
207 factor *= 0.0039215686; // 1 / 255
208 part->env.r = factor * D_E0116C8C[i - 1].r;
209 part->env.g = factor * D_E0116C8C[i - 1].g;
210 part->env.b = factor * D_E0116C8C[i - 1].b;
211
212 if (unk_14_2 < ARRAY_COUNT(D_E0116D6C)) {
213 part->unk_18 = (f32) D_E0116D6C[unk_14_2] * 0.01;
214 } else {
215 part->unk_18 = (f32) D_E0116D6C[ARRAY_COUNT(D_E0116D6C) - 1] * 0.01;
216 }
217
218 break;
219 case 3:
220 part->unk_14 = 0;
221 part->state++;
222 // fallthrough
223 case 4:
224 unk_14_2 = part->unk_14;
225
226 if (unk_14_2 < 18) {
227 part->unk_2C = (sin_deg(90 - unk_14_2 * 10) + 1.0f) * 50.0f * 0.5;
228 } else {
229 part->unk_2C = 0.0f;
230 part->state++;
231 }
232
233 break;
234 case 5:
235 break;
236 }
237
238 part->unk_14++;
239 }
240}
s8 unk_14
Definition demo_api.c:19
#define sin_deg
#define remove_effect
#define cos_deg
struct SomethingRotatingFXData * somethingRotating
Definition effects.h:2589
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
#define ARRAY_COUNT(arr)
Definition macros.h:40
s16 D_E0116CA4[]
u8 D_E0116D08[]
u8 D_E0116CF8[]
Color_RGB8 D_E0116C8C[]
u8 D_E0116D6C[]
u8 D_E0116D3C[]

Referenced by something_rotating_main().

◆ something_rotating_render()

void something_rotating_render ( EffectInstance * effect)

Definition at line 242 of file something_rotating.c.

242 {
243 RenderTask renderTask;
244 RenderTask* retTask;
245
247 renderTask.appendGfxArg = effect;
248 renderTask.dist = 10;
250
251 retTask = queue_render_task(&renderTask);
253}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
void something_rotating_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by something_rotating_main().

◆ something_rotating_appendGfx()

void something_rotating_appendGfx ( void * effect)

Definition at line 281 of file something_rotating.c.

281 {
282 SomethingRotatingFXData* data = ((EffectInstance*)effect)->data.somethingRotating;
283 s32 unk_14 = data->unk_14;
284 s32 l, t;
285 s32 i;
286
287 gDPPipeSync(gMainGfxPos++);
288 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
289
290 gSPDisplayList(gMainGfxPos++, D_090042E0_3FE790);
291 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 255);
292
293 data++;
294 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, data++) {
295 if (data->state != 5) {
296 func_E01166E8(1, data);
297 if (data->primAlpha != 255) {
298 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, data->primAlpha);
299 gDPSetEnvColor(gMainGfxPos++, data->env.r, data->env.g, data->env.b, 0x78);
300 gSPDisplayList(gMainGfxPos++, D_E0116C6C[0]);
301
302 l = ((unk_14 * 4.0f) * 100.0f) * (1.0 / 1024);
303 t = ((unk_14 * 4.0f) * 40.0f) * (1.0 / 1024);
304 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, l, t, l + 0xFC, t + 0xFC);
305
306 l = ((unk_14 * 4.0f) * 200.0f) * (1.0 / 1024);
307 t = ((unk_14 * 4.0f) * 90.0f) * (1.0 / 1024);
308 gDPSetTileSize(gMainGfxPos++, 1, l, t, l + 0xFC, t + 0xFC);
309 gSPDisplayList(gMainGfxPos++, D_E0116C64[0]);
310 } else {
311 gSPDisplayList(gMainGfxPos++, D_E0116C68[0]);
312 gDPSetEnvColor(gMainGfxPos++, data->env.r, data->env.g, data->env.b, data->unk_25);
313 gSPDisplayList(gMainGfxPos++, D_E0116C70[i - 1]);
314 gSPDisplayList(gMainGfxPos++, D_E0116C60[0]);
315 }
316 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
317 }
318 }
319}
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * D_E0116C6C[]
Gfx * D_E0116C68[]
Gfx D_090042E0_3FE790[]
Gfx * D_E0116C64[]
void func_E01166E8(s32 arg0, SomethingRotatingFXData *part)
Gfx * D_E0116C70[]
Gfx * D_E0116C60[]
Gfx * gMainGfxPos
Definition cam_main.c:15

Referenced by something_rotating_render().

◆ something_rotating_main()

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

Definition at line 76 of file something_rotating.c.

83 {
85 EffectInstance* effect;
87 s32 numParts = 8;
88 s32 i;
89
93 bp.unk_00 = 0;
94 bp.renderUI = NULL;
95 bp.effectID = EFFECT_SOMETHING_ROTATING;
96
97 effect = create_effect_instance(&bp);
98 effect->numParts = numParts;
99 part = effect->data.somethingRotating = general_heap_malloc(numParts * sizeof(*part));
100 ASSERT(effect->data.somethingRotating != NULL);
101
102 part->unk_00 = arg0;
103 part->unk_14 = 0;
104 if (arg5 <= 0) {
105 part->unk_10 = 1000;
106 } else {
107 part->unk_10 = arg5;
108 }
109 part->pos.x = arg1;
110 part->pos.y = arg2;
111 part->pos.z = arg3;
112 part->unk_18 = arg4;
113 part->unk_1C = 30.0f;
114 part->unk_20 = 0;
115
116 part++;
117 for (i = 1; i < numParts; i++, part++) {
118 part->primAlpha = 0;
119 part->unk_18 = arg4 * 0.5;
120 part->env.r = 255;
121 part->env.g = 255;
122 part->env.b = 0;
123 part->unk_25 = 0;
124 part->unk_1C = 30.0f;
125 part->unk_20 = 0;
126 part->state = 0;
127 part->unk_2C = 50.0f;
128 }
129
130 return effect;
131}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void something_rotating_update(EffectInstance *effect)
void something_rotating_init(EffectInstance *effect)
void something_rotating_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

◆ func_E01166E8()

void func_E01166E8 ( s32 arg0,
SomethingRotatingFXData * part )

Definition at line 255 of file something_rotating.c.

255 {
256 f32 temp;
257 Matrix4f sp20;
258 Matrix4f sp60;
259
260 if (arg0 == 0) {
262 } else {
263 temp = 0.0f;
264 }
265
266 guPositionF(sp20, 0.0f, part->unk_20 - temp, 0.0f, part->unk_18,
267 part->pos.x + 2.0f,
268 part->pos.y,
269 part->pos.z + 2.0f
270 );
271 guRotateF(sp60, part->unk_1C, 0.0f, 0.0f, 1.0f);
272 guMtxCatF(sp60, sp20, sp20);
273 guTranslateF(sp60, 0.0f, 0.0f, -2.0f);
274 guMtxCatF(sp60, sp20, sp20);
276
278 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
279}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guPositionF
Camera gCameras[4]
Definition cam_main.c:17
u16 gMatrixListPos
Definition main_loop.c:45
s32 gCurrentCameraID
Definition cam_math.c:4
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by something_rotating_appendGfx().

Variable Documentation

◆ D_09003F98_3FE448

Gfx D_09003F98_3FE448[]
extern

◆ D_09004010_3FE4C0

Gfx D_09004010_3FE4C0[]
extern

◆ D_09004088_3FE538

Gfx D_09004088_3FE538[]
extern

◆ D_09004100_3FE5B0

Gfx D_09004100_3FE5B0[]
extern

◆ D_09004178_3FE628

Gfx D_09004178_3FE628[]
extern

◆ D_090041F0_3FE6A0

Gfx D_090041F0_3FE6A0[]
extern

◆ D_09004268_3FE718

Gfx D_09004268_3FE718[]
extern

◆ D_090042E0_3FE790

Gfx D_090042E0_3FE790[]
extern

◆ D_09004360_3FE810

Gfx D_09004360_3FE810[]
extern

◆ D_09004458_3FE908

Gfx D_09004458_3FE908[]
extern

◆ D_09004508_3FE9B8

Gfx D_09004508_3FE9B8[]
extern

◆ D_09004600_3FEAB0

Gfx D_09004600_3FEAB0[]
extern

◆ D_E0116C60

Gfx* D_E0116C60[] = { D_09004458_3FE908 }

Definition at line 17 of file something_rotating.c.

Gfx D_09004458_3FE908[]

Referenced by something_rotating_appendGfx().

◆ D_E0116C64

Gfx* D_E0116C64[] = { D_09004600_3FEAB0 }

Definition at line 19 of file something_rotating.c.

Gfx D_09004600_3FEAB0[]

Referenced by something_rotating_appendGfx().

◆ D_E0116C68

Gfx* D_E0116C68[] = { D_09004360_3FE810 }

Definition at line 21 of file something_rotating.c.

Gfx D_09004360_3FE810[]

Referenced by something_rotating_appendGfx().

◆ D_E0116C6C

Gfx* D_E0116C6C[] = { D_09004508_3FE9B8 }

Definition at line 23 of file something_rotating.c.

Gfx D_09004508_3FE9B8[]

Referenced by something_rotating_appendGfx().

◆ D_E0116C70

Gfx* D_E0116C70[]
Initial value:
= {
}
Gfx D_09003F98_3FE448[]
Gfx D_09004178_3FE628[]
Gfx D_090041F0_3FE6A0[]
Gfx D_09004010_3FE4C0[]
Gfx D_09004088_3FE538[]
Gfx D_09004268_3FE718[]
Gfx D_09004100_3FE5B0[]

Definition at line 25 of file something_rotating.c.

Referenced by something_rotating_appendGfx().

◆ D_E0116C8C

Color_RGB8 D_E0116C8C[]
Initial value:
= {
{ 255, 224, 65 },
{ 244, 227, 72 },
{ 211, 220, 22 },
{ 152, 214, 222 },
{ 211, 138, 239 },
{ 231, 174, 219 },
{ 255, 200, 11 },
{ 0, 0, 0 }
}

Definition at line 31 of file something_rotating.c.

31 {
32 { 255, 224, 65 },
33 { 244, 227, 72 },
34 { 211, 220, 22 },
35 { 152, 214, 222 },
36 { 211, 138, 239 },
37 { 231, 174, 219 },
38 { 255, 200, 11 },
39 { 0, 0, 0 }
40};

Referenced by something_rotating_update().

◆ D_E0116CA4

s16 D_E0116CA4[]
Initial value:
= {
0, 60, 120, 180, 240, 300,
0, 60, 120, 180, 240, 300,
0, 60, 120, 180, 240, 300,
0, 60, 120, 180, 240, 300,
0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 345, 353, 357, 359,
0
}

Definition at line 42 of file something_rotating.c.

42 {
43 0, 60, 120, 180, 240, 300,
44 0, 60, 120, 180, 240, 300,
45 0, 60, 120, 180, 240, 300,
46 0, 60, 120, 180, 240, 300,
47 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 345, 353, 357, 359,
48 0
49};

Referenced by something_rotating_update().

◆ D_E0116CF8

u8 D_E0116CF8[]
Initial value:
= {
2, 20, 40, 60, 80, 100, 120, 160, 180, 200, 220, 240, 255
}

Definition at line 51 of file something_rotating.c.

51 {
52 2, 20, 40, 60, 80, 100, 120, 160, 180, 200, 220, 240, 255
53};

Referenced by something_rotating_update().

◆ D_E0116D08

u8 D_E0116D08[]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 40, 60, 80, 100, 120, 160, 180, 200, 220, 240, 255
}

Definition at line 55 of file something_rotating.c.

55 {
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 0, 0, 20, 40, 60, 80, 100, 120, 160, 180, 200, 220, 240, 255
58};

Referenced by something_rotating_update().

◆ D_E0116D3C

u8 D_E0116D3C[]
Initial value:
= {
255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128
}

Definition at line 60 of file something_rotating.c.

60 {
61 255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
62 255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
63 255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128,
64 255, 255, 255, 255, 255, 255, 255, 225, 185, 165, 148, 128
65};

Referenced by something_rotating_update().

◆ D_E0116D6C

u8 D_E0116D6C[]
Initial value:
= {
50, 80, 100, 105, 107, 108, 108, 108, 108, 108, 108, 107, 105, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50
}

Definition at line 67 of file something_rotating.c.

67 {
68 50, 80, 100, 105, 107, 108, 108, 108, 108, 108, 108, 107, 105, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50
69};

Referenced by something_rotating_update().