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

Go to the source code of this file.

Functions

void embers_init (EffectInstance *effect)
 
void embers_update (EffectInstance *effect)
 
void embers_render (EffectInstance *effect)
 
void embers_appendGfx (void *effect)
 
EffectInstanceembers_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7, s32 arg8, f32 arg9, f32 argA)
 
void func_E00E05F8 (void)
 

Variables

Gfx D_09000280_3DC1C0 []
 
Gfx D_090003B0_3DC2F0 []
 
Gfx * D_E00E0A40 [] = { D_090003B0_3DC2F0, D_09000280_3DC1C0 }
 
f32 D_E00E0A48 []
 

Function Documentation

◆ embers_init()

void embers_init ( EffectInstance * effect)

Definition at line 92 of file embers.c.

92 {
93}

Referenced by embers_main().

◆ embers_update()

void embers_update ( EffectInstance * effect)

Definition at line 95 of file embers.c.

95 {
96 EmbersFXData* part = effect->data.embers;
97 f32 unk_10;
98 f32 unk_14;
99 s32 time;
100 f32 unk_68;
101 f32 unk_6C;
102 s32 i;
103
104 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
105 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
106 part->timeLeft = 16;
107 }
108
109 if (part->timeLeft < 1000) {
110 part->timeLeft--;
111 }
112
113 part->lifetime++;
114 if (part->lifetime > 324000) {
115 part->lifetime = 256;
116 }
117
118 if (part->timeLeft < 0) {
119 remove_effect(effect);
120 return;
121 }
122
123 time = part->lifetime;
124
125 if (part->timeLeft < 16) {
126 part->unk_2C = part->timeLeft * 16;
127 }
128
129 if (time < 16) {
130 part->unk_2C = time * 16 + 15;
131 }
132
133 unk_10 = part->unk_10;
134 unk_14 = part->unk_14;
135 unk_68 = part->unk_68;
136 unk_6C = part->unk_6C;
137
138 part++;
139 for (i = 1; i < effect->numParts; i++, part++) {
140 part->unk_64++;
141 if (part->unk_64 >= 30) {
142 part->unk_64 = 0;
143 }
144
145 if (part->unk_64 >= 0) {
146 if (part->unk_64 == 0) {
147 part->unk_04 = rand_int(unk_10) - unk_10 * 0.5;
148 part->unk_08 = rand_int(unk_14);
149 part->unk_0C = 0.0f;
150 part->unk_44 = (f32) (rand_int(20) - 10) * 0.05;
151 part->unk_48 = (rand_int(40) - 1) * unk_68 * 0.05;
152 part->unk_4C = 0.0f;
153 part->unk_50 = (f32) (rand_int(20) - 10) * 0.05;
154 part->unk_54 = (rand_int(30) - 1) * unk_6C * 0.05;
155 part->unk_58 = 0.0f;
156 part->unk_5C = rand_int(15);
157 part->unk_60 = rand_int(15);
158 }
159 part->unk_40 = D_E00E0A48[part->unk_64];
160 part->unk_04 += part->unk_44;
161 part->unk_08 += part->unk_48;
162 part->unk_0C += part->unk_4C;
163 part->unk_5C += 0.1;
164 part->unk_60 += 0.3;
165 part->unk_44 += (part->unk_50 - part->unk_44) * 0.04;
166 part->unk_48 += (part->unk_54 - part->unk_48) * 0.04;
167 part->unk_4C += (part->unk_58 - part->unk_4C) * 0.04;
168 }
169 }
170}
s8 unk_14
Definition demo_api.c:19
#define remove_effect
#define rand_int
struct EmbersFXData * embers
Definition effects.h:2576
EffectData data
Definition effects.h:2605
f32 D_E00E0A48[]
Definition embers.c:9
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by embers_main().

◆ embers_render()

void embers_render ( EffectInstance * effect)

Definition at line 172 of file embers.c.

172 {
173 RenderTask renderTask;
174 RenderTask* retTask;
175
176 renderTask.appendGfx = embers_appendGfx;
177 renderTask.appendGfxArg = effect;
178 renderTask.dist = 10;
180
181 retTask = queue_render_task(&renderTask);
183}
#define queue_render_task
void embers_appendGfx(void *effect)
Definition embers.c:188
@ 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 embers_main().

◆ embers_appendGfx()

void embers_appendGfx ( void * effect)

Definition at line 188 of file embers.c.

188 {
189 EmbersFXData* part = ((EffectInstance*)effect)->data.embers;
190 Camera* camera = &gCameras[gCurrentCameraID];
191 s32 unk_2C = part->unk_2C;
192 Matrix4f sp10;
193 Matrix4f sp50;
194 s32 i;
195
196 gDPPipeSync(gMainGfxPos++);
197 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
198
199 guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C);
200 guScaleF(sp50, part->unk_40, part->unk_40, part->unk_40);
201 guMtxCatF(sp50, sp10, sp10);
203
204 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
205 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
206 gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_20, part->unk_24, part->unk_28, unk_2C);
207 gDPSetEnvColor(gMainGfxPos++, part->unk_30, part->unk_34, part->unk_38, part->unk_3C);
208 gSPDisplayList(gMainGfxPos++, D_E00E0A40[1]);
209
210 part++;
211 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
212 if (part->unk_64 >= 0) {
213 guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C);
215
216 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
217 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, (i % 4) * 16 * 4, 15 * 4, ((i % 4) * 16 + 15) * 4);
218 gDPSetTileSize(gMainGfxPos++, 1, (s32) part->unk_5C * 4, (s32) part->unk_60 * 4, ((s32) part->unk_5C + 15) * 4, ((s32) part->unk_60 + 15) * 4);
219 gSPDisplayList(gMainGfxPos++, D_E00E0A40[0]);
220 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
221 }
222 }
223
224 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
225}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Gfx * D_E00E0A40[]
Definition embers.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 embers_render().

◆ embers_main()

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

Definition at line 22 of file embers.c.

34 {
36 EffectInstance* effect;
37 EmbersFXData* part;
38 s32 numParts;
39 f32 temp1;
40 s32 i;
41
42 arg7++;
43
44 bp.init = embers_init;
47 bp.unk_00 = 0;
48 bp.renderUI = NULL;
49 bp.effectID = EFFECT_EMBERS;
50
51 effect = create_effect_instance(&bp);
52 effect->numParts = arg7;
53 part = effect->data.embers = general_heap_malloc(arg7 * sizeof(*part));
54 ASSERT(effect->data.embers != NULL);
55
56 part->unk_00 = arg0;
57 part->lifetime = 0;
58 if (arg8 <= 0) {
59 part->timeLeft = 1000;
60 } else {
61 part->timeLeft = arg8;
62 }
63 part->unk_2C = 0;
64 part->unk_04 = arg1;
65 part->unk_08 = arg2;
66 part->unk_0C = arg3;
67 part->unk_40 = arg6;
68 part->unk_10 = arg4;
69 part->unk_14 = arg5;
70 part->unk_68 = arg9;
71 part->unk_6C = argA;
72 part->unk_20 = 127;
73 part->unk_24 = 0;
74 part->unk_28 = 0;
75 part->unk_30 = 127;
76 part->unk_34 = 127;
77 part->unk_38 = 0;
78 part->unk_3C = 255;
79
80 temp1 = 30.0f / (arg7 - 1);
81 temp1 *= 0.5;
82
83 part++;
84 for (i = 1; i < arg7; i++, part++) {
85 s32 temp_f0 = -(f32) i * temp1;
86 part->unk_64 = temp_f0 - 1;
87 }
88
89 return effect;
90}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void embers_render(EffectInstance *effect)
Definition embers.c:172
void embers_init(EffectInstance *effect)
Definition embers.c:92
void embers_update(EffectInstance *effect)
Definition embers.c:95
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_E00E05F8()

void func_E00E05F8 ( void )

Definition at line 185 of file embers.c.

185 {
186}

Variable Documentation

◆ D_09000280_3DC1C0

Gfx D_09000280_3DC1C0[]
extern

◆ D_090003B0_3DC2F0

Gfx D_090003B0_3DC2F0[]
extern

◆ D_E00E0A40

Gfx* D_E00E0A40[] = { D_090003B0_3DC2F0, D_09000280_3DC1C0 }

Definition at line 7 of file embers.c.

Gfx D_09000280_3DC1C0[]
Gfx D_090003B0_3DC2F0[]

Referenced by embers_appendGfx().

◆ D_E00E0A48

f32 D_E00E0A48[]
Initial value:
= {
0.01f, 0.05f, 0.1f, 0.2f, 0.35f, 0.5f,
0.65f, 0.8f, 0.95f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 0.95f, 0.8f, 0.65f,
0.5f, 0.35f, 0.2f, 0.1f, 0.05f, 0.01f
}

Definition at line 9 of file embers.c.

9 {
10 0.01f, 0.05f, 0.1f, 0.2f, 0.35f, 0.5f,
11 0.65f, 0.8f, 0.95f, 1.0f, 1.0f, 1.0f,
12 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
13 1.0f, 1.0f, 1.0f, 0.95f, 0.8f, 0.65f,
14 0.5f, 0.35f, 0.2f, 0.1f, 0.05f, 0.01f
15};

Referenced by embers_update().