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

Go to the source code of this file.

Functions

void fire_flower_appendGfx (void *effect)
 
void fire_flower_init (EffectInstance *effect)
 
void fire_flower_update (EffectInstance *effect)
 
void fire_flower_render (EffectInstance *effect)
 
EffectInstancefire_flower_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4)
 
 EFFECT_DEF_STARS_SPREAD (stars_spread_main)
 

Variables

char D_09000000_3803A0 [][0x200]
 
Gfx D_09000D40_3810E0 []
 
Gfx D_09000DE0_381180 []
 
Gfx D_09000EB8_381258 []
 
Gfx D_09000ED8_381278 []
 
Gfx D_09000EF8_381298 []
 
s8 D_E007EC30 [] = { 50, 60, 70, 80, 90, 100, 105, 100 }
 

Function Documentation

◆ fire_flower_appendGfx()

void fire_flower_appendGfx ( void * effect)

Definition at line 203 of file fire_flower.c.

203 {
204 FireFlowerFXData* part = ((EffectInstance*)effect)->data.fireFlower;
205 s32 unk_34 = part->unk_34;
206 f32 unk_30 = part->unk_30;
207 s32 unk_04 = part->unk_04;
208 f32 unk_28 = part->unk_28;
209 f32 unk_2C = part->unk_2C;
210 Matrix4f sp18;
211 Matrix4f sp58;
212 s32 i;
213
214 gDPPipeSync(gMainGfxPos++);
215 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
216
217 guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
218 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
219 guMtxCatF(sp58, sp18, sp18);
221
222 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
223 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 0, 0, part->unk_3C);
224 gDPSetEnvColor(gMainGfxPos++, 255, 0, 0, part->unk_38);
225
226 if ((u32) (unk_04 - 4) < 3U) {
227 guTranslateF(sp18, 0.0f, 16.0f, 0.0f);
229
230 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
231 gSPDisplayList(gMainGfxPos++, D_09000DE0_381180);
232
233 part++;
234 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
235 if (part->unk_40.z == 0) {
236 guRotateF(sp18, part->unk_24, 0.0f, 0.0f, 1.0f);
237 guTranslateF(sp58, part->pos.x, part->pos.y, part->pos.z);
238 guMtxCatF(sp58, sp18, sp18);
240
241 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
242 gSPDisplayList(gMainGfxPos++, part->unk_00 != 0 ? D_09000ED8_381278 : D_09000EB8_381258);
243 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
244 }
245 }
246
247 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
248 }
249
250 gSPDisplayList(gMainGfxPos++, D_09000D40_3810E0);
251 gDPLoadTextureTile_4b(
252 gMainGfxPos++, D_09000000_3803A0[3 - unk_34],
253 G_IM_FMT_CI, 32, 0, 0, 0, 31, 31, 0,
254 G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP,
255 5, 5, G_TX_NOLOD, G_TX_NOLOD);
256 gDPLoadMultiTile_4b(
257 gMainGfxPos++, D_09000000_3803A0[2 - unk_34],
258 0x0080, 1, G_IM_FMT_CI, 32, 0, 0, 0, 31, 31, 0,
259 G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP,
260 5, 5, G_TX_NOLOD, G_TX_NOLOD);
261
262 guTranslateF(sp18, unk_2C, 0.0f, 0.0f);
263 guScaleF(sp58, unk_30, unk_30, unk_30);
264 guMtxCatF(sp58, sp18, sp18);
265 guRotateF(sp58, unk_28, 0.0f, 1.0f, 0.0f);
266 guMtxCatF(sp58, sp18, sp18);
268
269 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
270 gSPDisplayList(gMainGfxPos++, D_09000EF8_381298);
271 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
272 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
273}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Gfx D_09000D40_3810E0[]
Gfx D_09000ED8_381278[]
Gfx D_09000DE0_381180[]
Gfx D_09000EB8_381258[]
Gfx D_09000EF8_381298[]
char D_09000000_3803A0[][0x200]
#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 fire_flower_render().

◆ fire_flower_init()

void fire_flower_init ( EffectInstance * effect)

Definition at line 77 of file fire_flower.c.

77 {
78}

Referenced by fire_flower_main().

◆ fire_flower_update()

void fire_flower_update ( EffectInstance * effect)

Definition at line 82 of file fire_flower.c.

82 {
83 FireFlowerFXData* part = effect->data.fireFlower;
84 s32 unk_04;
85 s32 unk_40X;
86 s32 i;
87
88 part->unk_40.y++;
89 part->unk_40.x++;
90
91 unk_04 = part->unk_04;
92 unk_40X = part->unk_40.x;
93
94 if (unk_04 == 7) {
95 remove_effect(effect);
96 return;
97 }
98
99 switch (unk_04) {
100 case 0:
101 load_effect(EFFECT_STARS_SPREAD);
102 stars_spread_main(0, part->pos.x - 10.0f, part->pos.y, part->pos.z, 7, 20);
103 part->unk_34 = 0;
104 part->unk_38 = 0;
105 part->unk_40.x = 0;
106 part->unk_04++;
107 break;
108 case 1:
109 if (unk_40X >= ARRAY_COUNT(D_E007EC30)) {
110 part->unk_40.x = 0;
111 part->unk_04++;
112 } else {
113 part->unk_30 = D_E007EC30[unk_40X - 1] * 0.01;
114 part->unk_34 = 0;
115 part->unk_38 = 0;
116 }
117 break;
118 case 2:
119 if (unk_40X >= 2) {
120 part->unk_40.x = 0;
121 part->unk_04++;
122 } else {
123 part->unk_34 = 1;
124 }
125 break;
126 case 3:
127 if (unk_40X >= 15) {
128 part->unk_40.x = 0;
129 part->unk_04++;
130 } else {
131 part->unk_34 = 2;
132 }
133 break;
134 case 4:
135 if (unk_40X >= 45) {
136 part->unk_40.x = 0;
137 part->unk_04++;
138 } else {
139 part->unk_34 = 3;
140 part->unk_2C = 0;
141 if (unk_40X % 2) {
142 part->unk_30 = 1.0f;
143 } else {
144 part->unk_30 = 1.05f;
145 }
146 }
147 break;
148 case 5:
149 if (unk_40X >= 10) {
150 part->unk_40.x = 0;
151 part->unk_04++;
152 } else {
153 part->unk_34 = 0;
154 part->unk_2C = -10.0f;
155 }
156 break;
157 case 6:
158 part->unk_28 += 36.0f;
159 part->unk_34 = 0;
160 part->unk_3C *= 0.9;
161 if (part->unk_28 >= 720.0f) {
162 part->unk_28 = 720.0f;
163 part->unk_04++;
164 }
165 break;
166 }
167
168 unk_04 = part->unk_04;
169 part++;
170
171 if (unk_04 == 4 || unk_04 == 5 || unk_04 == 6) {
172 for (i = 1; i < effect->numParts; i++, part++) {
173 if (part->unk_40.z <= 0 || --part->unk_40.z <= 0) {
174 part->unk_18 += part->unk_20;
175 part->pos.x += part->unk_14;
176 part->pos.y += part->unk_18;
177 part->pos.z += part->unk_1C;
178
179 if (unk_04 == 4 && part->pos.x > 200.0f) {
180 part->pos.x = 0;
181 part->pos.y = 0;
182 part->unk_18 = 0;
183 part->pos.z = 0;
184 }
185 }
186 }
187 }
188}
#define remove_effect
#define load_effect
s8 D_E007EC30[]
Definition fire_flower.c:11
struct FireFlowerFXData * fireFlower
Definition effects.h:2527
EffectData data
Definition effects.h:2605
#define ARRAY_COUNT(arr)
Definition macros.h:40
void stars_spread_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5)

Referenced by fire_flower_main().

◆ fire_flower_render()

void fire_flower_render ( EffectInstance * effect)

Definition at line 190 of file fire_flower.c.

190 {
191 RenderTask renderTask;
192 RenderTask* retTask;
193
194 renderTask.appendGfx = fire_flower_appendGfx;
195 renderTask.appendGfxArg = effect;
196 renderTask.dist = 0;
198
199 retTask = queue_render_task(&renderTask);
201}
#define queue_render_task
void fire_flower_appendGfx(void *effect)
@ 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 fire_flower_main().

◆ fire_flower_main()

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

Definition at line 18 of file fire_flower.c.

18 {
20 EffectBlueprint* bpPtr = &bp;
21 EffectInstance* effect;
22 FireFlowerFXData* part;
23 Vec3i* partData;
24 s32 numParts = 31;
25 s32 i;
26
27 bp.unk_00 = 0;
31 bp.renderUI = NULL;
32 bp.effectID = EFFECT_FIRE_FLOWER;
33
34 effect = create_effect_instance(&bp);
35 effect->numParts = numParts;
36 part = general_heap_malloc(numParts * sizeof(*part));
37 effect->data.fireFlower = part;
38
39 ASSERT(effect->data.fireFlower != NULL);
40
41 part->unk_04 = 0;
42 part->unk_00 = arg0;
43 part->pos.x = arg1;
44 part->pos.y = arg2;
45 part->pos.z = arg3;
46 part->unk_40.x = arg4;
47 part->unk_40.y = 0;
48 part->unk_34 = 0;
49 part->unk_38 = 0;
50 part->unk_28 = 0;
51
52 part->unk_3C = 255;
53 part->unk_30 = 0.5f;
54 part->unk_2C = -10.0f;
55
56 part++;
57
58 for (i = 1; i < numParts; i++, part++) {
59 partData = &part->unk_40;
60 part->unk_00 = 1;
61 part->pos.x = 0;
62 part->pos.y = 0;
63 part->pos.z = 0;
64 part->unk_14 = 8.0f;
65 part->unk_18 = 0;
66 part->unk_1C = effect_rand_int(20) - 8;
67 part->unk_20 = (effect_rand_int(10) - 5) * 0.05;
68 part->unk_24 = effect_rand_int(80) + 5;
69 part->unk_3C = 255;
70 partData->z = i - 1;
71 partData->x = 10;
72 }
73
74 return effect;
75}
#define general_heap_malloc
#define create_effect_instance
void fire_flower_init(EffectInstance *effect)
Definition fire_flower.c:77
void fire_flower_render(EffectInstance *effect)
void fire_flower_update(EffectInstance *effect)
Definition fire_flower.c:82
#define ASSERT(condition)
s32 effect_rand_int(s32)
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

◆ EFFECT_DEF_STARS_SPREAD()

EFFECT_DEF_STARS_SPREAD ( stars_spread_main )

Variable Documentation

◆ D_09000000_3803A0

char D_09000000_3803A0[][0x200]
extern

Referenced by fire_flower_appendGfx().

◆ D_09000D40_3810E0

Gfx D_09000D40_3810E0[]
extern

Referenced by fire_flower_appendGfx().

◆ D_09000DE0_381180

Gfx D_09000DE0_381180[]
extern

Referenced by fire_flower_appendGfx().

◆ D_09000EB8_381258

Gfx D_09000EB8_381258[]
extern

Referenced by fire_flower_appendGfx().

◆ D_09000ED8_381278

Gfx D_09000ED8_381278[]
extern

Referenced by fire_flower_appendGfx().

◆ D_09000EF8_381298

Gfx D_09000EF8_381298[]
extern

Referenced by fire_flower_appendGfx().

◆ D_E007EC30

s8 D_E007EC30[] = { 50, 60, 70, 80, 90, 100, 105, 100 }

Definition at line 11 of file fire_flower.c.

11{ 50, 60, 70, 80, 90, 100, 105, 100 };

Referenced by fire_flower_update().