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

Go to the source code of this file.

Functions

void effect_75_init (EffectInstance *effect)
 
void effect_75_update (EffectInstance *effect)
 
void effect_75_render (EffectInstance *effect)
 
void effect_75_appendGfx (void *effect)
 
EffectInstanceeffect_75_main (s32 arg0, f32 posX, f32 posY, f32 posZ, f32 scale, s32 arg5)
 
void func_E00EA664 (void)
 

Variables

Gfx D_09001910_3E4270 []
 
Gfx D_09001A00_3E4360 []
 
Gfx D_09001A20_3E4380 []
 
Gfx * D_E00EAA50 [2] = { D_09001A00_3E4360, D_09001A20_3E4380 }
 
Gfx * D_E00EAA58 [2] = { D_09001910_3E4270, NULL }
 

Function Documentation

◆ effect_75_init()

void effect_75_init ( EffectInstance * effect)

Definition at line 75 of file effect_75.c.

75 {
76}

Referenced by effect_75_main().

◆ effect_75_update()

void effect_75_update ( EffectInstance * effect)

Definition at line 78 of file effect_75.c.

78 {
79 Effect75FXData* data = effect->data.unk_75;
80 s32 unk_14;
81
82 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
83 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
84 data->unk_10 = 0x10;
85 }
86
87 if (data->unk_10 < 1000) {
88 data->unk_10--;
89 }
90
91 data->unk_14++;
92 if (data->unk_14 > 108000) {
93 data->unk_14 = 0;
94 }
95
96 if (data->unk_10 < 0) {
97 remove_effect(effect);
98 return;
99 }
100
101 unk_14 = data->unk_14;
102
103 if (data->unk_10 < 16) {
104 data->unk_24 = data->unk_10 * 16;
105 }
106
107 if (unk_14 < 16) {
108 data->unk_24 = unk_14 * 16 + 15;
109 }
110
111 data->unk_48 += (data->unk_68 - data->unk_48) * 0.1;
112 data->unk_4C += (data->unk_6C - data->unk_4C) * 0.1;
113 data->unk_58 += (data->unk_70 - data->unk_58) * 0.1;
114 data->unk_5C += (data->unk_74 - data->unk_5C) * 0.1;
115 data->unk_60 += (data->unk_78 - data->unk_60) * 0.1;
116 data->unk_64 += (data->unk_7C - data->unk_64) * 0.1;
117
118 data->unk_40 += 2.0f * data->unk_48;
119 data->unk_44 += 2.0f * data->unk_4C;
120 data->unk_50 += 2.0f * data->unk_58;
121 data->unk_54 += 2.0f * data->unk_5C;
122
123 if (data->unk_40 < 0.0f) {
124 data->unk_40 += 256.0f;
125 }
126 if (data->unk_44 < 0.0f) {
127 data->unk_44 += 256.0f;
128 }
129 if (data->unk_50 < 0.0f) {
130 data->unk_50 += 256.0f;
131 }
132 if (data->unk_54 < 0.0f) {
133 data->unk_54 += 256.0f;
134 }
135
136 if (data->unk_40 > 256.0f) {
137 data->unk_40 -= 256.0f;
138 }
139 if (data->unk_44 > 256.0f) {
140 data->unk_44 -= 256.0f;
141 }
142 if (data->unk_50 > 256.0f) {
143 data->unk_50 -= 256.0f;
144 }
145 if (data->unk_54 > 256.0f) {
146 data->unk_54 -= 256.0f;
147 }
148
149 data->unk_34 = data->unk_60
150 + (sin_deg(unk_14 * 20) * (data->unk_64 - data->unk_60)
151 + (data->unk_64 - data->unk_60)) * 0.5;
152}
s8 unk_14
Definition demo_api.c:19
#define sin_deg
#define remove_effect
struct Effect75FXData * unk_75
Definition effects.h:2581
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by effect_75_main().

◆ effect_75_render()

void effect_75_render ( EffectInstance * effect)

Definition at line 154 of file effect_75.c.

154 {
155 Effect75FXData* data = effect->data.unk_75;
156 RenderTask renderTask;
157 RenderTask* renderTaskPtr = &renderTask;
158 RenderTask* retTask;
159 s32 outDist;
160 f32 outX;
161 f32 outY;
162 f32 outZ;
163 f32 outS;
164
165 transform_point(&gCameras[gCurrentCameraID].mtxPerspective[0],
166 data->pos.x, data->pos.y, data->pos.z, 1.0f,
167 &outX, &outY, &outZ, &outS);
168
169 outDist = outZ + 5000;
170 if (outDist < 0) {
171 outDist = 0;
172 } else if (outDist > 10000) {
173 outDist = 10000;
174 }
175
176 if (outS < 0.01 && -0.01 < outS) {
177 outDist = 0;
178 }
179
180 renderTaskPtr->appendGfx = effect_75_appendGfx;
181 renderTaskPtr->dist = -outDist;
182 renderTaskPtr->appendGfxArg = effect;
184
185 retTask = queue_render_task(renderTaskPtr);
187}
void effect_75_appendGfx(void *effect)
Definition effect_75.c:192
#define transform_point
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
void * appendGfxArg
void(* appendGfx)(void *)
Camera gCameras[4]
Definition cam_main.c:17
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by effect_75_main().

◆ effect_75_appendGfx()

void effect_75_appendGfx ( void * effect)

Definition at line 192 of file effect_75.c.

192 {
193 Effect75FXData* data = ((EffectInstance*)effect)->data.unk_75;
194 Camera* camera = &gCameras[gCurrentCameraID];
195 s32 type = data->type;
196 s32 uls0 = data->unk_40 * 4.0f;
197 s32 ult0 = data->unk_44 * 4.0f;
198 s32 uls1 = data->unk_50 * 4.0f;
199 s32 ult1 = data->unk_54 * 4.0f;
200 Matrix4f mtxTransfrom;
201 Matrix4f mtxTemp;
202
203 gDPPipeSync(gMainGfxPos++);
204 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
205
206 guTranslateF(mtxTransfrom, data->pos.x, data->pos.y, data->pos.z);
207 guScaleF(mtxTemp, data->scale, data->scale, data->scale);
208 guMtxCatF(mtxTemp, mtxTransfrom, mtxTransfrom);
209 if (type == 1) {
210 guRotateF(mtxTemp, 180.0f, 0.0f, 0.0f, 1.0f);
211 guMtxCatF(mtxTemp, mtxTransfrom, mtxTransfrom);
212 }
214
215 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
216 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
217 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primCol.r, data->primCol.g, data->primCol.b, data->unk_34);
218 gDPSetEnvColor(gMainGfxPos++, data->envCol.r, data->envCol.g, data->envCol.b, data->unk_24 * data->masterAlpha / 255);
219 gSPDisplayList(gMainGfxPos++, D_E00EAA58[0]);
220 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, uls0, ult0, uls0 + 252, ult0 + 252);
221 gDPSetTileSize(gMainGfxPos++, 1, uls1, ult1, uls1 + 252, ult1 + 252);
222 gSPDisplayList(gMainGfxPos++, D_E00EAA50[type]);
223 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
224}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
Gfx * D_E00EAA50[2]
Definition effect_75.c:8
Gfx * D_E00EAA58[2]
Definition effect_75.c:9
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Color3i primCol
Definition effects.h:2105
Color3i envCol
Definition effects.h:2107
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Mtx * mtxBillboard
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by effect_75_render().

◆ effect_75_main()

EffectInstance * effect_75_main ( s32 arg0,
f32 posX,
f32 posY,
f32 posZ,
f32 scale,
s32 arg5 )

Definition at line 16 of file effect_75.c.

16 {
18 EffectInstance* effect;
19 Effect75FXData* data;
20 s32 numParts = 1;
21 s32 i;
22
26 bp.unk_00 = 0;
27 bp.renderUI = NULL;
28 bp.effectID = EFFECT_75;
29
30 effect = create_effect_instance(&bp);
31 effect->numParts = numParts;
32 data = effect->data.unk_75 = general_heap_malloc(numParts * sizeof(*data));
33 ASSERT(effect->data.unk_75 != NULL);
34
35 data->type = arg0;
36 data->unk_14 = 0;
37 if (arg5 <= 0) {
38 data->unk_10 = 1000;
39 } else {
40 data->unk_10 = arg5;
41 }
42 data->unk_24 = 0;
43 data->pos.x = posX;
44 data->pos.y = posY;
45 data->pos.z = posZ;
46 data->scale = scale;
47 data->primCol.r = 0;
48 data->primCol.g = 180;
49 data->primCol.b = 220;
50 data->envCol.r = 0;
51 data->envCol.g = 0;
52 data->envCol.b = 0;
53 data->unk_34 = 0;
54 data->masterAlpha = 0;
55 data->unk_40 = 0;
56 data->unk_44 = 0;
57 data->unk_50 = 0;
58 data->unk_54 = 0;
59 data->unk_48 = 1.0f;
60 data->unk_68 = 1.0f;
61 data->unk_4C = 0.9f;
62 data->unk_6C = 0.9f;
63 data->unk_58 = -2.0f;
64 data->unk_70 = -2.0f;
65 data->unk_5C = 1.25f;
66 data->unk_74 = 1.25f;
67 data->unk_60 = 190.0f;
68 data->unk_78 = 190.0f;
69 data->unk_64 = 220.0f;
70 data->unk_7C = 220.0f;
71
72 return effect;
73}
void effect_75_init(EffectInstance *effect)
Definition effect_75.c:75
void effect_75_update(EffectInstance *effect)
Definition effect_75.c:78
void effect_75_render(EffectInstance *effect)
Definition effect_75.c:154
#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_E00EA664()

void func_E00EA664 ( void )

Definition at line 189 of file effect_75.c.

189 {
190}

Variable Documentation

◆ D_09001910_3E4270

Gfx D_09001910_3E4270[]
extern

◆ D_09001A00_3E4360

Gfx D_09001A00_3E4360[]
extern

◆ D_09001A20_3E4380

Gfx D_09001A20_3E4380[]
extern

◆ D_E00EAA50

Gfx* D_E00EAA50[2] = { D_09001A00_3E4360, D_09001A20_3E4380 }

Definition at line 8 of file effect_75.c.

Gfx D_09001A20_3E4380[]
Gfx D_09001A00_3E4360[]

Referenced by effect_75_appendGfx().

◆ D_E00EAA58

Gfx* D_E00EAA58[2] = { D_09001910_3E4270, NULL }

Definition at line 9 of file effect_75.c.

9{ D_09001910_3E4270, NULL };
Gfx D_09001910_3E4270[]

Referenced by effect_75_appendGfx().