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

Go to the source code of this file.

Functions

void waterfall_init (EffectInstance *effect)
 
void waterfall_update (EffectInstance *effect)
 
void waterfall_render (EffectInstance *effect)
 
void waterfall_appendGfx (void *effect)
 
EffectInstancewaterfall_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
 
void func_E00B62D8 (void)
 

Variables

Gfx D_09000200_3B7AD0 []
 

Function Documentation

◆ waterfall_init()

void waterfall_init ( EffectInstance * effect)

Definition at line 61 of file waterfall.c.

61 {
62}

Referenced by waterfall_main().

◆ waterfall_update()

void waterfall_update ( EffectInstance * effect)

Definition at line 64 of file waterfall.c.

64 {
65 WaterfallFXData* data = effect->data.waterfall;
66 s32 unk_14;
67 s32 i;
68
69 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
70 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
71 data->unk_10 = 16;
72 }
73
74 if (data->unk_10 < 1000) {
75 data->unk_10--;
76 }
77
78 data->unk_14++;
79
80 if (data->unk_10 < 0) {
81 remove_effect(effect);
82 return;
83 }
84
85 unk_14 = data->unk_14;
86
87 if (data->unk_10 < 16) {
88 data->unk_24 = data->unk_10 * 16;
89 }
90
91 if (unk_14 < 16) {
92 data->unk_24 = unk_14 * 16 + 15;
93 }
94
95 for (i = 0; i < 12; i++) {
96 data->unk_2C[i] += data->unk_5C[i];
97 data->unk_5C[i] += -0.1;
98 if (data->unk_5C[i] > 5.0f) {
99 data->unk_5C[i] += (5.0 - data->unk_5C[i]) * 0.1;
100 }
101 }
102}
s8 unk_14
Definition demo_api.c:19
#define remove_effect
struct WaterfallFXData * waterfall
Definition effects.h:2555
f32 unk_5C[12]
Definition effects.h:1576
f32 unk_2C[12]
Definition effects.h:1575
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by waterfall_main().

◆ waterfall_render()

void waterfall_render ( EffectInstance * effect)

Definition at line 104 of file waterfall.c.

104 {
105 RenderTask renderTask;
106 RenderTask* retTask;
107
108 renderTask.appendGfx = waterfall_appendGfx;
109 renderTask.appendGfxArg = effect;
110 renderTask.dist = 10;
112
113 retTask = queue_render_task(&renderTask);
114}
#define queue_render_task
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)
void waterfall_appendGfx(void *effect)
Definition waterfall.c:119

Referenced by waterfall_main().

◆ waterfall_appendGfx()

void waterfall_appendGfx ( void * effect)

Definition at line 119 of file waterfall.c.

119 {
120 WaterfallFXData* data = ((EffectInstance*)effect)->data.waterfall;
121 Camera* camera = &gCameras[gCurrentCameraID];
122 s32 unk_14 = data->unk_14;
123 s32 unk_24 = data->unk_24;
124 f32 scale = data->unk_28 * 0.1;
125 s32 savedIdx;
126 Vtx_t* vtx;
127 Gfx* savedGfxPos;
128 Matrix4f sp10;
129 Matrix4f sp50;
130 s32 i;
131
132 gDPPipeSync(gMainGfxPos++);
133 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
134
135 guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C);
136 guScaleF(sp50, scale, scale, scale);
137 guMtxCatF(sp50, sp10, sp10);
139
140 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
141 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
142 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, unk_24);
143 gSPDisplayList(gMainGfxPos++, D_09000200_3B7AD0);
144 gSPBranchList(gMainGfxPos, &gMainGfxPos[49]);
145
146 savedGfxPos = gMainGfxPos + 1;
148
149 vtx = (Vtx_t*) savedGfxPos;
150
151 for (i = 0; i < ARRAY_COUNT(data->unk_2C); i++) {
152 vtx->ob[0] = i * 50 - 300;
153 vtx->ob[1] = 600;
154 vtx->ob[2] = 0;
155 vtx->tc[0] = (unk_14 + i * 4) * 32;
156 vtx->tc[1] = (s32) data->unk_2C[i] * 32;
157 vtx->cn[0] = 255;
158 vtx->cn[1] = 255;
159 vtx->cn[2] = 255;
160 vtx->cn[3] = -i * 20 - 1;
161 vtx++;
162
163 vtx->ob[0] = i * 50 - 300;
164 vtx->ob[1] = (data->unk_2C[i] + 60.0f) * 10.0f;
165 vtx->ob[2] = 0;
166 vtx->tc[0] = (unk_14 + i * 4) * 32;
167 vtx->tc[1] = 1024;
168 vtx->cn[0] = 255;
169 vtx->cn[1] = 255;
170 vtx->cn[2] = 255;
171 vtx->cn[3] = -i * 20 - 1;
172 vtx++;
173 }
174
175 savedIdx = i;
176
177 gSPVertex(gMainGfxPos++, savedGfxPos, i * 2, 0);
178
179 for (i = 0; i < savedIdx - 1; i++) {
180 s32 i2 = i * 2;
181 gSP2Triangles(gMainGfxPos++,
182 i2 , i2 + 2, i2 + 1, i2,
183 i2 + 1, i2 + 2, i2 + 3, i2);
184 }
185
186 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
187}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Mtx * mtxBillboard
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
Gfx D_09000200_3B7AD0[]

Referenced by waterfall_render().

◆ waterfall_main()

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

Definition at line 11 of file waterfall.c.

18 {
20 EffectInstance* effect;
21 WaterfallFXData* data;
22 s32 numParts = 1;
23 s32 i;
24
28 bp.unk_00 = 0;
29 bp.renderUI = NULL;
30 bp.effectID = EFFECT_WATERFALL;
31
32 effect = create_effect_instance(&bp);
33 effect->numParts = numParts;
34 data = effect->data.waterfall = general_heap_malloc(numParts * sizeof(*data));
35 ASSERT(effect->data.waterfall != NULL);
36
37 data->unk_00 = arg0;
38 data->unk_14 = 0;
39 if (arg5 <= 0) {
40 data->unk_10 = 1000;
41 } else {
42 data->unk_10 = arg5;
43 }
44 data->unk_24 = 0;
45 data->unk_04 = arg1;
46 data->unk_08 = arg2;
47 data->unk_0C = arg3;
48 data->unk_28 = arg4;
49 data->unk_18 = 20;
50 data->unk_1C = 120;
51 data->unk_20 = 255;
52
53 for (i = 0; i < 12; i++) {
54 data->unk_2C[i] = 0;
55 data->unk_5C[i] = (f32) rand_int(10) * 0.01 + -1.0;
56 }
57
58 return effect;
59}
#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
void waterfall_init(EffectInstance *effect)
Definition waterfall.c:61
void waterfall_render(EffectInstance *effect)
Definition waterfall.c:104
void waterfall_update(EffectInstance *effect)
Definition waterfall.c:64

◆ func_E00B62D8()

void func_E00B62D8 ( void )

Definition at line 116 of file waterfall.c.

116 {
117}

Variable Documentation

◆ D_09000200_3B7AD0

Gfx D_09000200_3B7AD0[]
extern

Referenced by waterfall_appendGfx().