Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stars_burst.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
6
8 254, 172, 172,
9 254, 172, 213,
10 254, 180, 154,
11 213, 180, 254,
12 180, 180, 254,
13 180, 221, 254,
14 180, 254, 254,
15 180, 254, 213,
16 180, 254, 180,
17 213, 254, 180,
18 254, 254, 180,
19 254, 213, 172,
20};
21
25void stars_burst_appendGfx(void* effect);
26
28 s32 arg0,
29 f32 arg1,
30 f32 arg2,
31 f32 arg3,
32 f32 arg4,
33 f32 arg5,
34 s32 arg6
35) {
38 EffectInstance* effect;
40 s32 numParts = arg6;
41 f32 temp;
42 s32 i;
43
44 if (arg6 != 0) {
45 numParts++;
46
47 bpPtr->init = stars_burst_init;
48 bpPtr->update = stars_burst_update;
49 bpPtr->renderScene = stars_burst_render;
50 bpPtr->unk_00 = 0;
51 bpPtr->renderUI = nullptr;
52 bpPtr->effectID = EFFECT_STARS_BURST;
53
55 effect->numParts = numParts;
56 part = effect->data.starsBurst = general_heap_malloc(numParts * sizeof(*part));
57 ASSERT(effect->data.starsBurst != nullptr);
58
59 part->unk_00 = arg0;
60 part->unk_04 = arg1;
61 part->unk_08 = arg2;
62 part->unk_0C = arg3;
63 part->unk_34 = 0;
64 part->unk_30 = 30;
65 part->unk_2C = 255;
66
67 part++;
68 for (i = 1; i < numParts; i++, part++) {
69 temp = rand_int(10) * 0.25f + 5.0f;
70
71 part->unk_00 = arg0;
72 part->unk_04 = arg1;
73 part->unk_08 = arg2;
74 part->unk_0C = arg3;
75 part->unk_10 = cos_deg(arg5 + (i & 2) * (i / 2) * 4) * sin_deg(arg4);
76 part->unk_14 = sin_deg(arg5 + (i & 2) * (i / 2) * 4);
77 part->unk_18 = cos_deg(arg5 + (i & 2) * (i / 2) * 4) * cos_deg(arg4);
78 part->unk_28 = temp;
79 part->unk_24 = temp / 10.0;
80 }
81 }
82}
83
85}
86
89 s32 unk_30;
90 s32 i;
91
92 part->unk_30--;
93 part->unk_34++;
94
95 if (part->unk_30 < 0) {
96 remove_effect(effect);
97 return;
98 }
99
100 unk_30 = part->unk_30;
101 if (unk_30 < 10) {
102 part->unk_2C *= 0.8;
103 }
104
105 part++;
106 for (i = 1; i < effect->numParts; i++, part++) {
107 part->unk_04 += part->unk_28 * part->unk_10;
108 part->unk_08 += part->unk_28 * part->unk_14;
109 part->unk_0C += part->unk_28 * part->unk_18;
110 part->unk_28 *= 0.9;
111 if (unk_30 < 10) {
112 part->unk_24 += part->unk_28 / 10.0;
113 }
114 }
115}
116
129
130void stars_burst_appendGfx(void* effect) {
131 StarsBurstFXData* part = ((EffectInstance*)effect)->data.starsBurst;
132 Gfx* dlist = D_090005E0_343620;
133 s32 unk_2C;
136 s32 baseIdx;
137 s32 i;
138
140 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics));
142
143 unk_2C = part->unk_2C;
144
145 baseIdx = (part->unk_34 - 1) * 3;
146 baseIdx %= 36;
147
148 part++;
149 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
150 s32 rIdx = baseIdx + i * 3;
151 s32 gIdx = baseIdx + 1 + i * 3;
152 s32 bIdx = baseIdx + 2 + i * 3;
153
154 gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E0042780[rIdx % 36], D_E0042780[gIdx % 36], D_E0042780[bIdx % 36], unk_2C);
155
156 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
157 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
159 guScaleF(sp58, part->unk_24, part->unk_24, 1.0f);
162
164 gSPDisplayList(gMainGfxPos++, dlist);
166 }
167}
BSS s32 PopupMenu_SelectedIndex
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define rand_int
#define cos_deg
#define create_effect_instance
#define guScaleF
EffectInstanceDataPtr data
Definition effects.h:2605
struct StarsBurstFXData * starsBurst
Definition effects.h:2497
#define ASSERT(condition)
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3352
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3345
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:46
void stars_burst_render(EffectInstance *effect)
void stars_burst_init(EffectInstance *effect)
Definition stars_burst.c:84
Gfx D_090004C0_343500[]
u8 D_E0042780[]
Definition stars_burst.c:7
Gfx D_090005E0_343620[]
void stars_burst_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 arg6)
Definition stars_burst.c:27
void stars_burst_update(EffectInstance *effect)
Definition stars_burst.c:87
void stars_burst_appendGfx(void *effect)
void(* appendGfx)(void *)
Camera gCameras[4]
Definition cam_main.c:16
Gfx * gMainGfxPos
Definition cam_main.c:14
u16 gMatrixListPos
Definition main_loop.c:44
s32 gCurrentCameraID
Definition cam_math.c:5
DisplayContext * gDisplayContext
Definition cam_main.c:15