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

Go to the source code of this file.

Functions

void aura_appendGfx (void *argEffect)
 
void aura_init (EffectInstance *effect)
 
void aura_update (EffectInstance *effect)
 
void aura_render (EffectInstance *effect)
 
void aura_main (s32 type, f32 posX, f32 posY, f32 posZ, f32 scale, EffectInstance **outEffect)
 
void func_E007684C (void)
 
void func_E0076854 (void)
 

Variables

Gfx D_09002000_379F80 []
 
Gfx D_090020E8_37A068 []
 
Gfx D_090021D0_37A150 []
 
Gfx D_090023B0_37A330 []
 
Gfx D_090023C8_37A348 []
 
Gfx D_090023E0_37A360 []
 
Gfx D_090023F8_37A378 []
 
Gfx D_09002410_37A390 []
 
Gfx D_09002428_37A3A8 []
 
Gfx D_09002440_37A3C0 []
 
Gfx D_09002458_37A3D8 []
 
Gfx * D_E0076E90 []
 
Gfx * D_E0076EA0 []
 
Gfx * D_E0076EB0 []
 
Gfx * D_E0076EC0 []
 
Gfx * D_E0076ED0 []
 

Function Documentation

◆ aura_appendGfx()

void aura_appendGfx ( void * argEffect)

Definition at line 295 of file aura.c.

295 {
296 Matrix4f translateMtx, tempMtx, transformMtx;
297 EffectInstance* effect = argEffect;
298 AuraFXData* data = effect->data.aura;
299 s32 type = data->type;
300 s32 primA = data->primA;
301 s32 v1, v2;
302
303 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data));
304 gSPDisplayList(gMainGfxPos++, D_E0076ED0[type]);
305
306 guTranslateF(translateMtx, data->posB.x, data->posB.y, data->posB.z);
307 if (type == FX_AURA_BLUE) {
308 guRotateF(tempMtx, data->renderYaw, 0.0f, 1.0f, 0.0f);
309 } else {
310 guRotateF(tempMtx, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
311 }
312 guMtxCatF(tempMtx, translateMtx, transformMtx);
313 guScaleF(tempMtx, data->scale.x, data->scale.y, 1.0f);
314 guMtxCatF(tempMtx, transformMtx, transformMtx);
315 if (type == FX_AURA_CAPTURE) {
316 guTranslateF(tempMtx, (-(data->scale.x - data->unk_24) / data->unk_24) * 10.0f, 0.0f, 0.0f);
317 guMtxCatF(tempMtx, transformMtx, transformMtx);
318 }
320
321 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
322 gSPDisplayList(gMainGfxPos++, D_E0076EC0[type]);
323 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
324
325 guTranslateF(translateMtx, data->posA.x, data->posA.y, data->posA.z);
326 if (type == FX_AURA_BLUE) {
327 guRotateF(tempMtx, data->renderYaw, 0.0f, 1.0f, 0.0f);
328 } else {
329 guRotateF(tempMtx, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
330 }
331 guMtxCatF(tempMtx, translateMtx, transformMtx);
332 guScaleF(tempMtx, data->scale.x, data->scale.y, 1.0f);
333 guMtxCatF(tempMtx, transformMtx, transformMtx);
334 if (type == FX_AURA_CAPTURE) {
335 guTranslateF(tempMtx, (-(data->scale.x - data->unk_24) / data->unk_24) * 10.0f, 0.0f, 0.0f);
336 guMtxCatF(tempMtx, transformMtx, transformMtx);
337 }
339
340 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
341 gSPDisplayList(gMainGfxPos++, D_E0076EB0[type]);
342 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
343
344 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primR, data->primG, data->primB, primA);
345 gDPSetEnvColor(gMainGfxPos++, data->envR, data->envG, data->engB, data->engA);
346
347 v1 = data->unk_34 * 4.0f;
348 v2 = data->unk_40 * 4.0f;
349
350 gDPSetTileSize(gMainGfxPos++, 1, v1, v2, v1 + 124, v2 + 508);
351 gSPDisplayList(gMainGfxPos++, D_E0076E90[type]);
352
353 v1 = data->unk_4C * 4.0f;
354 v2 = data->unk_58 * 4.0f;
355
356 gDPSetTileSize(gMainGfxPos++, 1, v1 + 30, v2 + 30, v1 + 282, v2 + 538);
357 gSPDisplayList(gMainGfxPos++, D_E0076EA0[type]);
358 gDPPipeSync(gMainGfxPos++);
359}
Gfx * D_E0076EA0[]
Definition aura.c:23
Gfx * D_E0076EB0[]
Definition aura.c:30
Gfx * D_E0076ED0[]
Definition aura.c:44
Gfx * D_E0076E90[]
Definition aura.c:16
Gfx * D_E0076EC0[]
Definition aura.c:37
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Vec3f posB
Definition effects.h:995
f32 renderYaw
Definition effects.h:1013
Vec2f scale
Definition effects.h:996
Vec3f posA
Definition effects.h:994
@ FX_AURA_CAPTURE
Definition effects.h:986
@ FX_AURA_BLUE
Definition effects.h:988
struct EffectGraphics * graphics
Definition effects.h:2606
struct AuraFXData * aura
Definition effects.h:2523
f32 unk_24
Definition effects.h:997
s32 primA
Definition effects.h:998
EffectData data
Definition effects.h:2605
#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 aura_render().

◆ aura_init()

void aura_init ( EffectInstance * effect)

Definition at line 184 of file aura.c.

184 {
185}

Referenced by aura_main().

◆ aura_update()

void aura_update ( EffectInstance * effect)

Definition at line 187 of file aura.c.

187 {
188 AuraFXData* data;
189 s32 type;
190 s32 fadeTime;
191 s32 lifeTime;
192
193 data = effect->data.aura;
194 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
195 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
196 data->fadeTime = 5;
197 }
198
199 data->lifeTime++;
200 if (data->lifeTime > 90*60*60) {
201 data->lifeTime = 256;
202 }
203
204 if (data->fadeTime <= 10) {
205 data->fadeTime--;
206 }
207
208 if (data->fadeTime < 0) {
209 remove_effect(effect);
210 return;
211 }
212
213 type = data->type;
214 fadeTime = data->fadeTime;
215 lifeTime = data->lifeTime;
216
217 if (type < FX_AURA_BLUE) {
218 if (lifeTime <= 10) {
219 data->primA += (128 - data->primA) * 0.5;
220 }
221 } else {
222 if (lifeTime <= 10) {
223 data->primA = (lifeTime * 255) / 10;
224 }
225 }
226
227 if (fadeTime < 10) {
228 data->primA *= 0.5;
229 }
230
231 if (type == FX_AURA_CAPTURE) {
232 data->unk_38 += (data->unk_3C - data->unk_38) * 0.02;
233 data->unk_44 += (data->unk_48 - data->unk_44) * 0.02;
234 data->scale.x += (data->unk_24 - data->scale.x) * 0.04;
235 data->scale.y += (data->unk_24 - data->scale.y) * 0.04;
236 } else {
237 data->unk_38 += (data->unk_3C - data->unk_38) * 0.02;
238 data->unk_44 += (data->unk_48 - data->unk_44) * 0.02;
239 data->unk_50 += (data->unk_54 - data->unk_50) * 0.02;
240 data->unk_5C += (data->unk_60 - data->unk_5C) * 0.02;
241 }
242
243 data->unk_34 += data->unk_38;
244 if (data->unk_34 < 0.0f) {
245 data->unk_34 += 64.0f;
246 } else if (data->unk_34 > 64.0f) {
247 data->unk_34 -= 64.0f;
248 }
249
250 data->unk_40 += data->unk_44;
251 if (data->unk_40 < 0.0f) {
252 data->unk_40 += 128.0f;
253 } else if (data->unk_40 > 128.0f) {
254 data->unk_40 -= 128.0f;
255 }
256
257 data->unk_4C += data->unk_50;
258 if (data->unk_4C < 0.0f) {
259 data->unk_4C += 64.0f;
260 } else if (data->unk_4C > 64.0f) {
261 data->unk_4C -= 64.0f;
262 }
263
264 data->unk_58 += data->unk_5C;
265 if (data->unk_58 < 0.0f) {
266 data->unk_58 += 128.0f;
267 } else if (data->unk_58 > 128.0f) {
268 data->unk_58 -= 128.0f;
269 }
270
271 data->posB.x += (data->posA.x - data->posB.x) * 0.1;
272 data->posB.y += (data->posA.y - data->posB.y) * 0.1;
273 data->posB.z += (data->posA.z - data->posB.z) * 0.1;
274}
#define remove_effect
s32 fadeTime
Definition effects.h:999
s32 lifeTime
Definition effects.h:1000
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by aura_main().

◆ aura_render()

void aura_render ( EffectInstance * effect)

Definition at line 276 of file aura.c.

276 {
277 RenderTask renderTask;
278 RenderTask* retTask;
279
280 renderTask.appendGfx = aura_appendGfx;
281 renderTask.appendGfxArg = effect;
282 renderTask.dist = 0;
284
285 retTask = queue_render_task(&renderTask);
287}
void aura_appendGfx(void *argEffect)
Definition aura.c:295
#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 aura_main().

◆ aura_main()

void aura_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
f32 scale,
EffectInstance ** outEffect )

Definition at line 56 of file aura.c.

56 {
58 EffectBlueprint* bpPtr = &bp;
59 EffectInstance* effect;
60 AuraFXData* part;
61 s32 numParts = 1;
62 f32 zero;
63
64 bp.init = aura_init;
67 bp.unk_00 = 0;
68 bp.renderUI = NULL;
69 bp.effectID = EFFECT_AURA;
70
71 effect = create_effect_instance(bpPtr);
72 effect->numParts = numParts;
73
74 part = effect->data.aura = general_heap_malloc(numParts * sizeof(*part));
75
76 ASSERT(effect->data.aura != NULL);
77
78 part->renderYaw = 0.0f;
79
80 zero = 0.0f;
81 part->unk_40 = zero;
82 part->unk_34 = zero;
83 part->unk_58 = zero;
84 part->unk_4C = zero;
85
86 part->fadeTime = 100;
87 part->type = type;
88 part->lifeTime = 0;
89 part->primA = 0;
90 part->posA.x = posX;
91 part->posA.y = posY;
92 part->posA.z = posZ;
93
94 switch (type) {
95 case 0:
96 part->primR = 75;
97 part->primG = 75;
98 part->primB = 75;
99 part->envR = 255;
100 part->envG = 247;
101 part->engB = 155;
102 part->engA = 0;
103 part->scale.x = scale * 2.0;
104 part->scale.y = scale * 0.6;
105 part->unk_24 = scale;
106 part->unk_38 = -0.9f;
107 part->unk_44 = 0.04f;
108 part->unk_3C = 0.04f;
109 part->unk_48 = 0.9f;
110 part->unk_50 = -0.9f;
111 part->unk_5C = 0.04f;
112 part->unk_54 = 0.04f;
113 part->unk_60 = 0.9f;
114 break;
115 case 1:
116 part->primR = 75;
117 part->primG = 75;
118 part->primB = 75;
119 part->envR = 255;
120 part->envG = 0;
121 part->engB = 0;
122 part->engA = 0;
123 part->scale.x = scale;
124 part->scale.y = scale;
125 part->unk_24 = scale;
126 part->unk_38 = zero;
127 part->unk_50 = zero;
128 part->unk_44 = 0.04f;
129 part->unk_3C = 0.04f;
130 part->unk_48 = 0.9f;
131 part->unk_5C = 0.04f;
132 part->unk_54 = 0.04f;
133 part->unk_60 = 0.9f;
134 break;
135 case 2:
136 part->primR = 25;
137 part->primG = 121;
138 part->primB = 142;
139 part->envR = 34;
140 part->engB = 255;
141 part->envG = 0;
142 part->engA = 81;
143 part->scale.x = scale;
144 part->scale.y = scale;
145 part->unk_24 = scale;
146 part->unk_38 = zero;
147 part->unk_50 = zero;
148 part->unk_44 = 0.04f;
149 part->unk_3C = 0.2f;
150 part->unk_48 = 1.3f;
151 part->unk_5C = 0.04f;
152 part->unk_54 = 0.16f;
153 part->unk_60 = 1.04f;
154 break;
155 default:
156 part->primR = 179;
157 part->primG = 169;
158 part->primB = 85;
159 part->envR = 34;
160 part->engB = 255;
161 part->envG = 0;
162 part->engA = 63;
163 part->scale.x = scale;
164 part->scale.y = scale;
165 part->unk_24 = scale;
166 part->unk_38 = 0.0f;
167 part->unk_50 = 0.0f;
168 part->unk_44 = 0.04f;
169 part->unk_3C = 0.1f;
170 part->unk_48 = 1.7f;
171 part->unk_5C = 0.04f;
172 part->unk_54 = 0.08f;
173 part->unk_60 = 1.36f;
174 break;
175 }
176
177 part->posB.x = part->posA.x;
178 part->posB.y = part->posA.y;
179 part->posB.z = part->posA.z;
180
181 *outEffect = effect;
182}
void aura_render(EffectInstance *effect)
Definition aura.c:276
void aura_init(EffectInstance *effect)
Definition aura.c:184
void aura_update(EffectInstance *effect)
Definition aura.c:187
#define general_heap_malloc
#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

◆ func_E007684C()

void func_E007684C ( void )

Definition at line 289 of file aura.c.

289 {
290}

◆ func_E0076854()

void func_E0076854 ( void )

Definition at line 292 of file aura.c.

292 {
293}

Variable Documentation

◆ D_09002000_379F80

Gfx D_09002000_379F80[]
extern

◆ D_090020E8_37A068

Gfx D_090020E8_37A068[]
extern

◆ D_090021D0_37A150

Gfx D_090021D0_37A150[]
extern

◆ D_090023B0_37A330

Gfx D_090023B0_37A330[]
extern

◆ D_090023C8_37A348

Gfx D_090023C8_37A348[]
extern

◆ D_090023E0_37A360

Gfx D_090023E0_37A360[]
extern

◆ D_090023F8_37A378

Gfx D_090023F8_37A378[]
extern

◆ D_09002410_37A390

Gfx D_09002410_37A390[]
extern

◆ D_09002428_37A3A8

Gfx D_09002428_37A3A8[]
extern

◆ D_09002440_37A3C0

Gfx D_09002440_37A3C0[]
extern

◆ D_09002458_37A3D8

Gfx D_09002458_37A3D8[]
extern

◆ D_E0076E90

Gfx* D_E0076E90[]

◆ D_E0076EA0

◆ D_E0076EB0

◆ D_E0076EC0

◆ D_E0076ED0

Gfx* D_E0076ED0[]