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

Go to the source code of this file.

Functions

void big_snowflakes_init (EffectInstance *effect)
 
void big_snowflakes_update (EffectInstance *effect)
 
void big_snowflakes_render (EffectInstance *effect)
 
void big_snowflakes_appendGfx (void *effect)
 
void big_snowflakes_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3)
 

Variables

Gfx D_09000900_3641C0 []
 
Gfx D_090009E8_3642A8 []
 
Gfx D_09000A10_3642D0 []
 
Gfx * D_E0060730 [] = { D_090009E8_3642A8, D_09000A10_3642D0 }
 
Gfx * D_E0060738 [] = { D_09000900_3641C0, D_09000900_3641C0 }
 

Function Documentation

◆ big_snowflakes_init()

void big_snowflakes_init ( EffectInstance * effect)

Definition at line 60 of file big_snowflakes.c.

60 {
61}

Referenced by big_snowflakes_main().

◆ big_snowflakes_update()

void big_snowflakes_update ( EffectInstance * effect)

Definition at line 63 of file big_snowflakes.c.

63 {
65 s32 unk_28;
66 s32 i;
67
68 data->unk_28--;
69 data->unk_2C++;
70 if (data->unk_28 < 0) {
71 remove_effect(effect);
72 return;
73 }
74
75 unk_28 = data->unk_28;
76 if (data->unk_2C < 10) {
77 data->unk_24 += (255 - data->unk_24) * 0.3;
78 }
79 if (unk_28 < 10) {
80 data->unk_24 *= 0.8;
81 }
82
83 data++;
84 for (i = 1; i < effect->numParts; i++, data++) {
85 data->unk_10 += (f32) (sin_deg(2.0f * data->unk_18) * 0.2);
86 data->unk_14 += -0.05f;
87 data->unk_10 *= 0.92;
88 data->unk_14 += -0.05f;
89 data->unk_1C += effect_simple_rand(50, unk_28 + (i * 20)) - 25;
90 data->unk_18 += sin_deg(data->unk_1C) * 10.0f;
91 data->unk_20 += cos_deg(data->unk_1C * 0.5f) * 10.0f;
92 data->unk_04 += data->unk_10;
93 data->unk_08 += data->unk_14;
94 }
95}
#define sin_deg
#define remove_effect
#define cos_deg
struct BigSnowflakesFXData * bigSnowflakes
Definition effects.h:2512
EffectData data
Definition effects.h:2605
s32 effect_simple_rand(s32, s32)

Referenced by big_snowflakes_main().

◆ big_snowflakes_render()

void big_snowflakes_render ( EffectInstance * effect)

Definition at line 97 of file big_snowflakes.c.

97 {
98 RenderTask renderTask;
99 RenderTask* retTask;
100
102 renderTask.appendGfxArg = effect;
103 renderTask.dist = 0;
105
106 retTask = queue_render_task(&renderTask);
108}
void big_snowflakes_appendGfx(void *effect)
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by big_snowflakes_main().

◆ big_snowflakes_appendGfx()

void big_snowflakes_appendGfx ( void * effect)

Definition at line 110 of file big_snowflakes.c.

110 {
111 BigSnowflakesFXData* data = ((EffectInstance*)effect)->data.bigSnowflakes;
112 Matrix4f sp18;
113 Matrix4f sp58;
114 Matrix4f sp98;
115 Gfx* dlist = D_E0060738[0];
116 s32 i;
117
118 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
119 gSPDisplayList(gMainGfxPos++, dlist);
120 gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, data->unk_24);
121
122 guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C);
123 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
124 guMtxCatF(sp58, sp18, sp98);
125
126 data++;
127 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, data++) {
128 Gfx* dlist2 = D_E0060730[i & 1]; // should be able to be i % 2 (ARRAY_COUNT(D_E0060730))
129
130 guTranslateF(sp58, data->unk_04, data->unk_08, data->unk_0C);
131 guMtxCatF(sp58, sp98, sp18);
132
133 if (!(i & 1)) {
134 guRotateF(sp58, data->unk_18, 0.0f, 0.0f, 1.0f);
135 guMtxCatF(sp58, sp18, sp18);
136 guRotateF(sp58, data->unk_20, 0.0f, 1.0f, 0.0f);
137 guMtxCatF(sp58, sp18, sp18);
138 }
140
141 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
142 gSPDisplayList(gMainGfxPos++, dlist2);
143 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
144 }
145}
Gfx * D_E0060738[]
Gfx * D_E0060730[]
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 big_snowflakes_render().

◆ big_snowflakes_main()

void big_snowflakes_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3 )

Definition at line 16 of file big_snowflakes.c.

16 {
18 EffectInstance* effect;
20 s32 numParts = 9;
21 s32 i;
22
23 bp.unk_00 = 0;
27 bp.renderUI = NULL;
28 bp.effectID = EFFECT_BIG_SNOWFLAKES;
29
30 effect = create_effect_instance(&bp);
31 effect->numParts = numParts;
32
33 data = general_heap_malloc(effect->numParts * sizeof(*data));
34 effect->data.bigSnowflakes = data;
35
36 ASSERT(data != NULL);
37
38 mem_clear(data, numParts * sizeof(*data));
39 data->unk_00 = arg0;
40 data->unk_04 = arg1;
41 data->unk_08 = arg2;
42 data->unk_0C = arg3;
43 data->unk_28 = 30;
44 data->unk_2C = 0;
45 data->unk_24 = 0;
46
47 data++;
48 for (i = 1; i < numParts; i++, data++) {
49 data->unk_04 = effect_rand_int(10) - 5;
50 data->unk_08 = effect_rand_int(10) + 5;
51 data->unk_0C = 10.0f;
52 data->unk_18 = effect_rand_int(360);
53 data->unk_20 = effect_rand_int(360);
54 data->unk_1C = effect_rand_int(100) / 10;
55 data->unk_10 = 0;
56 data->unk_14 = 2.0f;
57 }
58}
void big_snowflakes_render(EffectInstance *effect)
void big_snowflakes_update(EffectInstance *effect)
void big_snowflakes_init(EffectInstance *effect)
#define general_heap_malloc
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
s32 effect_rand_int(s32)
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_09000900_3641C0

Gfx D_09000900_3641C0[]
extern

◆ D_090009E8_3642A8

Gfx D_090009E8_3642A8[]
extern

◆ D_09000A10_3642D0

Gfx D_09000A10_3642D0[]
extern

◆ D_E0060730

Gfx* D_E0060730[] = { D_090009E8_3642A8, D_09000A10_3642D0 }

Definition at line 8 of file big_snowflakes.c.

Gfx D_09000A10_3642D0[]
Gfx D_090009E8_3642A8[]

Referenced by big_snowflakes_appendGfx().

◆ D_E0060738

Gfx* D_E0060738[] = { D_09000900_3641C0, D_09000900_3641C0 }

Definition at line 9 of file big_snowflakes.c.

Gfx D_09000900_3641C0[]

Referenced by big_snowflakes_appendGfx().