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

Go to the source code of this file.

Functions

void moving_cloud_init (EffectInstance *effect)
 
void moving_cloud_update (EffectInstance *effect)
 
void moving_cloud_render (EffectInstance *effect)
 
void moving_cloud_appendGfx (void *effect)
 
EffectInstancemoving_cloud_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8)
 

Variables

Gfx D_09000100_3E1DD0 []
 
Gfx D_090001E8_3E1EB8 []
 
Gfx * D_E00E8630 [] = { D_090001E8_3E1EB8 }
 
Gfx * D_E00E8634 [] = { D_09000100_3E1DD0 }
 

Function Documentation

◆ moving_cloud_init()

void moving_cloud_init ( EffectInstance * effect)

Definition at line 115 of file moving_cloud.c.

115 {
116}

Referenced by moving_cloud_main().

◆ moving_cloud_update()

void moving_cloud_update ( EffectInstance * effect)

Definition at line 118 of file moving_cloud.c.

118 {
119 MovingCloudFXData* data = effect->data.movingCloud;
120 s32 unk_00 = data->unk_00;
121 s32 unk_1C;
122
123 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
124 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
125 data->unk_1C = 16;
126 }
127
128 if (data->unk_1C < 1000) {
129 data->unk_1C--;
130 }
131
132 data->unk_20++;
133
134 if (data->unk_1C < 0) {
135 remove_effect(effect);
136 return;
137 }
138
139 unk_1C = data->unk_1C;
140
141 if (unk_00 == 0 || unk_00 == 2) {
142 if (data->unk_20 < 16) {
143 data->unk_30 = data->unk_20 * 16 + 15;
144 } else {
145 data->unk_30 = 255;
146 }
147 if (unk_1C < 16) {
148 data->unk_30 = unk_1C * 16;
149 }
150 } else {
151 if (data->unk_20 < 4) {
152 data->unk_30 = data->unk_20 * 64 + 63;
153 } else {
154 data->unk_30 = 255;
155 }
156 if (unk_1C < 4) {
157 data->unk_30 = unk_1C * 64;
158 }
159 }
160
161 data->unk_04 += data->unk_10;
162 data->unk_08 += data->unk_14;
163 data->unk_0C += data->unk_18;
164}
#define remove_effect
struct MovingCloudFXData * movingCloud
Definition effects.h:2580
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by moving_cloud_main().

◆ moving_cloud_render()

void moving_cloud_render ( EffectInstance * effect)

Definition at line 166 of file moving_cloud.c.

166 {
167 RenderTask renderTask;
168 RenderTask* retTask;
169
171 renderTask.appendGfxArg = effect;
172 renderTask.dist = 10;
174
175 retTask = queue_render_task(&renderTask);
177}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void moving_cloud_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by moving_cloud_main().

◆ moving_cloud_appendGfx()

void moving_cloud_appendGfx ( void * effect)

Definition at line 179 of file moving_cloud.c.

179 {
180 MovingCloudFXData* data = ((EffectInstance*)effect)->data.movingCloud;
181 Camera* camera = &gCameras[gCurrentCameraID];
182 s32 unk_30 = data->unk_30;
183 Matrix4f sp10;
184 Matrix4f sp50;
185
186 gDPPipeSync(gMainGfxPos++);
187 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
188
189 guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C);
190 guScaleF(sp50, data->unk_44, data->unk_44, data->unk_44);
191 guMtxCatF(sp50, sp10, sp10);
193
194 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
195 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
196 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_24, data->unk_28, data->unk_2C, unk_30);
197 gDPSetEnvColor(gMainGfxPos++, data->unk_34, data->unk_38, data->unk_3C, data->unk_40);
198 gSPDisplayList(gMainGfxPos++, D_E00E8634[0]);
199 gSPDisplayList(gMainGfxPos++, D_E00E8630[0]);
200 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
201}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Gfx * D_E00E8634[]
Definition moving_cloud.c:8
Gfx * D_E00E8630[]
Definition moving_cloud.c:7
#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

Referenced by moving_cloud_render().

◆ moving_cloud_main()

EffectInstance * moving_cloud_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
f32 arg5,
f32 arg6,
f32 arg7,
f32 arg8 )

Definition at line 15 of file moving_cloud.c.

25 {
27 EffectInstance* effect;
29 s32 numParts = 1;
30 f32 var_f12;
31 f32 temp_f20;
32 f32 temp_f22;
33 f32 temp_f24;
34 s32 var_v0;
35
39 bp.unk_00 = 0;
40 bp.renderUI = NULL;
41 bp.effectID = EFFECT_MOVING_CLOUD;
42
43 effect = create_effect_instance(&bp);
44 effect->numParts = numParts;
45 data = effect->data.movingCloud = general_heap_malloc(numParts * sizeof(*data));
46 ASSERT(effect->data.movingCloud != NULL);
47
48 data->unk_00 = arg0;
49 data->unk_20 = 0;
50
51 temp_f24 = arg4 - arg1;
52 temp_f22 = arg5 - arg2;
53 temp_f20 = arg6 - arg3;
54 var_f12 = SQ(temp_f24) + SQ(temp_f22) + SQ(temp_f20);
55
56 if (var_f12 != 0.0f) {
57 var_f12 = sqrtf(var_f12);
58 }
59
60 if (arg7 > 0.0f) {
61 var_v0 = var_f12 / arg7;
62 } else {
63 var_v0 = 0;
64 }
65
66 if (var_v0 != 0) {
67 var_f12 = 1.0f / var_v0;
68 data->unk_10 = temp_f24 * var_f12;
69 data->unk_14 = temp_f22 * var_f12;
70 data->unk_18 = temp_f20 * var_f12;
71 } else {
72 data->unk_10 = 0.0f;
73 data->unk_14 = 0.0f;
74 data->unk_18 = 0.0f;
75 }
76
77 if (var_v0 < 0) {
78 data->unk_1C = 1000;
79 } else {
80 data->unk_1C = var_v0;
81 }
82
83 data->unk_30 = 0;
84 data->unk_04 = arg1;
85 data->unk_08 = arg2;
86 data->unk_0C = arg3;
87 data->unk_44 = arg8;
88
89 switch (arg0) {
90 case 0:
91 case 2:
92 data->unk_24 = 215;
93 data->unk_28 = 215;
94 data->unk_2C = 185;
95 data->unk_34 = 215;
96 data->unk_38 = 200;
97 data->unk_3C = 100;
98 data->unk_40 = 255;
99 break;
100 case 1:
101 default:
102 data->unk_24 = 255;
103 data->unk_28 = 255;
104 data->unk_2C = 255;
105 data->unk_34 = 220;
106 data->unk_38 = 245;
107 data->unk_3C = 255;
108 data->unk_40 = 255;
109 break;
110 }
111
112 return effect;
113}
#define general_heap_malloc
#define sqrtf
#define create_effect_instance
#define ASSERT(condition)
void moving_cloud_update(EffectInstance *effect)
void moving_cloud_init(EffectInstance *effect)
void moving_cloud_render(EffectInstance *effect)
#define SQ(x)
Definition macros.h:166
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_09000100_3E1DD0

Gfx D_09000100_3E1DD0[]
extern

◆ D_090001E8_3E1EB8

Gfx D_090001E8_3E1EB8[]
extern

◆ D_E00E8630

Gfx* D_E00E8630[] = { D_090001E8_3E1EB8 }

Definition at line 7 of file moving_cloud.c.

Gfx D_090001E8_3E1EB8[]

Referenced by moving_cloud_appendGfx().

◆ D_E00E8634

Gfx* D_E00E8634[] = { D_09000100_3E1DD0 }

Definition at line 8 of file moving_cloud.c.

Gfx D_09000100_3E1DD0[]

Referenced by moving_cloud_appendGfx().