Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
small_gold_sparkle.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
4extern Gfx D_090002C0_392700[];
5extern Gfx D_09000330_392770[];
6extern Gfx D_09000370_3927B0[];
7extern Gfx D_090003B0_3927F0[];
8extern Gfx D_090003F0_392830[];
9extern Gfx D_09000430_392870[];
10extern Gfx D_09000470_3928B0[];
11
13
14static s32 sPartParams[4 * 5] = {
15 1, 0, 0, 0, 100,
16 2, 4, -2, 0, 100,
17 3, -2, 2, 0, 70,
18 4, 2, 4, 0, 40,
19};
20
24void small_gold_sparkle_appendGfx(void* effect);
25
26EffectInstance* small_gold_sparkle_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
28 EffectInstance* effect;
31 s32 numParts = 5;
32 s32 i;
33
37 bp.unk_00 = 0;
38 bp.renderUI = NULL;
39 bp.effectID = EFFECT_SMALL_GOLD_SPARKLE;
40
41 effect = create_effect_instance(&bp);
42 effect->numParts = numParts;
43
44 data = general_heap_malloc(numParts * sizeof(*data));
45 effect->data.smallGoldSparkle = data;
46 part = data;
47
48 ASSERT(data != NULL);
49
50 part->unk_00 = arg0;
51 part->unk_18 = 0;
52 part->unk_14 = 14;
53 part->unk_08 = arg1;
54 part->unk_0C = arg2;
55 part->unk_10 = arg3;
56
57 part++;
58 for (i = 1; i < numParts; i++, part++) {
59 part->unk_08 = sPartParams[1 + (i - 1) * 5];
60 part->unk_0C = sPartParams[2 + (i - 1) * 5];
61 part->unk_10 = sPartParams[3 + (i - 1) * 5];
62 part->unk_04 = -1;
63 part->unk_20 = sPartParams[0 + (i - 1) * 5];
64 part->unk_1C = (arg4 * sPartParams[4 + (i - 1) * 5]) * 0.01;
65 }
66 return effect;
67}
68
71
74 s32 i;
75
76 part->unk_14--;
77 part->unk_18++;
78
79 if (part->unk_14 < 0) {
80 remove_effect(effect);
81 return;
82 }
83
84 part++;
85 for (i = 1; i < effect->numParts; i++, part++) {
86 if (part->unk_20 > 0) {
87 part->unk_20--;
88 }
89
90 if (part->unk_20 <= 0) {
91 part->unk_04++;
92 if (part->unk_04 >= 10) {
93 part->unk_20 = -1;
94 }
95 }
96 }
97}
98
100 RenderTask renderTask;
101 RenderTask* retTask;
102
104 renderTask.appendGfxArg = effect;
105 renderTask.dist = 10;
107
108 retTask = queue_render_task(&renderTask);
110}
111
113 SmallGoldSparkleFXData* part = ((EffectInstance*)effect)->data.smallGoldSparkle;
114 Matrix4f sp18;
115 Matrix4f sp58;
116 Matrix4f sp98;
117 Mtx* spD8;
118 s32 i;
119
120 guRotateF(sp98, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
123 gDPPipeSync(gMainGfxPos++);
124 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
125 guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10);
127
128 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
129 gSPDisplayList(gMainGfxPos++, D_090002C0_392700);
130 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 15, 255);
131
132 part++;
133 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
134 if (part->unk_20 == 0) {
135 f32 temp_f20 = part->unk_1C;
136
137 guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10);
138 if (temp_f20 != 1.0f) {
139 guScaleF(sp58, temp_f20, temp_f20, 1.0f);
140 guMtxCatF(sp58, sp18, sp18);
141 }
144 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
145 gSPMatrix(gMainGfxPos++, spD8, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
146 gSPDisplayList(gMainGfxPos++, sDlists[part->unk_04 >> 1]);
147 gSPDisplayList(gMainGfxPos++, D_09000470_3928B0);
148 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
149 }
150 }
151
152 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
153 gDPPipeSync(gMainGfxPos++);
154}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define create_effect_instance
#define guScaleF
struct SmallGoldSparkleFXData * smallGoldSparkle
Definition effects.h:2537
EffectData data
Definition effects.h:2605
#define ASSERT(condition)
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx D_090002C0_392700[]
Gfx D_090003F0_392830[]
EffectInstance * small_gold_sparkle_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4)
void small_gold_sparkle_init(EffectInstance *effect)
Gfx D_09000430_392870[]
Gfx D_09000470_3928B0[]
void small_gold_sparkle_appendGfx(void *effect)
Gfx D_09000370_3927B0[]
void small_gold_sparkle_update(EffectInstance *effect)
Gfx D_09000330_392770[]
Gfx D_090003B0_3927F0[]
void small_gold_sparkle_render(EffectInstance *effect)
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
void * appendGfxArg
void(* appendGfx)(void *)
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