Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
radiating_energy_orb.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
10extern Gfx D_09001510_3A2270[];
11
16
20void radiating_energy_orb_appendGfx(void* effect);
21
23 s32 arg0,
24 f32 arg1,
25 f32 arg2,
26 f32 arg3,
27 f32 arg4,
28 s32 arg5
29) {
31 EffectInstance* effect;
33 s32 numParts = 6;
34 s32 i;
35
36 bp.unk_00 = 0;
39 bp.renderScene = radiating_energy_orb_render;
40 bp.renderUI = NULL;
42
43 effect = create_effect_instance(&bp);
44 effect->numParts = numParts;
45 part = effect->data.radiatingEnergyOrb = general_heap_malloc(numParts * sizeof(*part));
47
48 part->unk_04 = arg0;
49 part->unk_1C = 0;
50 if (arg5 <= 0) {
51 part->unk_18 = 100;
52 } else {
53 part->unk_18 = arg5;
54 }
55 part->unk_14 = 0;
56 part->unk_08 = arg1;
57 part->unk_0C = arg2;
58 part->unk_10 = arg3;
59
60 part++;
61 for (i = 1; i < numParts; i++, part++) {
62 part->unk_20 = rand_int(360);
63 part->unk_2C = (i * 2) % 20 + 60;
64 part->unk_28 = rand_int(15) * 0.1 + 0.4;
65 part->unk_30 = rand_int(10) * 0.1 + 0.1;
66 }
67
68 return effect;
69}
70
73
76 s32 unk_18;
77 s32 unk_1C;
78 s32 i;
79
80 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
82 part->unk_18 = 30;
83 }
84
85 if (part->unk_18 < 100) {
86 part->unk_18--;
87 }
88
89 part->unk_1C++;
90
91 if (part->unk_18 < 0) {
92 remove_effect(effect);
93 return;
94 }
95
96 unk_18 = part->unk_18;
97 unk_1C = part->unk_1C;
98
99 if (unk_1C < 21) {
100 part->unk_14 = unk_1C * 12;
101 } else if (unk_18 < 20) {
102 part->unk_14 = unk_18 * 12;
103 }
104
105 part++;
106 for (i = 1; i < effect->numParts; i++, part++) {
107 part->unk_14 = cos_deg((part->unk_2C - 70.0f) * 90.0f / 10.0f) * 255.0f;
108 part->unk_2C += part->unk_30;
109 if (part->unk_2C > 80.0f) {
110 part->unk_2C = 60.0f;
111 part->unk_28 = rand_int(15) * 0.1 + 0.4;
112 part->unk_30 = rand_int(10) * 0.1 + 0.1;
113 part->unk_20 = rand_int(360);
114 }
115 }
116}
117
130
132 RadiatingEnergyOrbFXData* part = ((EffectInstance*)effect)->data.radiatingEnergyOrb;
134 s32 unk_1C = part->unk_1C;
135 s32 unk_14 = part->unk_14;
136 s32 temp_s2 = unk_1C & 1;
139 Matrix4f unused;
140 s32 i;
141
142 if (temp_s2) {
143 unk_14 *= 0.95;
144 }
145
147 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics));
148
149 guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10);
151
154 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 64, 64, unk_14);
155
156 guRotateF(sp18, temp_s2 * 2 + unk_1C, 0.0f, 0.0f, 1.0f);
158
164
165 part++;
166 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
167 f32 scale = part->unk_28;
168
169 if (scale != 0.0f) {
170 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, (part->unk_14 * unk_14) >> 8);
172
173 guRotateF(sp18, part->unk_20, 0.0f, 0.0f, 1.0f);
174 guTranslateF(sp58, part->unk_2C, 0.0f, 0.0f);
176 guScaleF(sp58, scale, scale, scale);
179
183
184 guRotateF(sp18, part->unk_20, 0.0f, 0.0f, 1.0f);
185 guTranslateF(sp58, part->unk_2C + 5.0f, 0.0f, 0.0f);
187 guScaleF(sp58, 2.3 - scale, 2.3 - scale, 2.3 - scale);
190
194 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 0, 255, (part->unk_14 * unk_14) >> 9);
195 gDPSetEnvColor(gMainGfxPos++, 255, 128, 255, 0);
197
198 guRotateF(sp18, part->unk_20 + 14.0f, 0.0f, 0.0f, 1.0f);
199 guRotateF(sp58, (i * 10) % 45 + unk_1C, 0.0f, 1.0f, 0.0f);
201 guTranslateF(sp58, 20.0f, 0.0f, 0.0f);
203 guScaleF(sp58, (part->unk_2C - 60.0f) * 0.05 + 1.0, 2.0 - (part->unk_2C - 60.0f) * 0.05, 1.0f);
206
210 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 64, 64, (part->unk_14 * unk_14) >> 8);
211
212 guRotateF(sp18, part->unk_20 + 34.0f + unk_1C, 0.0f, 0.0f, 1.0f);
213 guRotateF(sp58, i * 35, 0.0f, 1.0f, 0.0f);
215 guTranslateF(sp58, 15.0f, 0.0f, 0.0f);
217 guScaleF(sp58, (part->unk_2C - 60.0f) * 0.1 + 2.0, 1.0f, 1.0f);
220
224 }
225 }
226
228}
BSS s32 PopupMenu_SelectedIndex
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
s8 unk_14
Definition demo_api.c:19
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define rand_int
#define cos_deg
#define create_effect_instance
#define guScaleF
struct RadiatingEnergyOrbFXData * radiatingEnergyOrb
Definition effects.h:2543
EffectInstanceDataPtr data
Definition effects.h:2605
#define ASSERT(condition)
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition enums.h:3299
void radiating_energy_orb_appendGfx(void *effect)
Gfx * D_E009EDF0[]
Gfx D_090014F0_3A2250[]
Gfx * D_E009EDF4[]
Gfx D_09001200_3A1F60[]
EffectInstance * radiating_energy_orb_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
void radiating_energy_orb_update(EffectInstance *effect)
Gfx D_09001490_3A21F0[]
Gfx * D_E009EDFC[]
Gfx * D_E009EDF8[]
Gfx D_09001510_3A2270[]
Gfx D_090012A8_3A2008[]
Gfx D_090014D0_3A2230[]
void radiating_energy_orb_init(EffectInstance *effect)
Gfx D_090014B0_3A2210[]
void radiating_energy_orb_render(EffectInstance *effect)
#define PM_CC_07
Definition macros.h:286
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
#define PM_CC_4D
Definition macros.h:487
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