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
4
extern
Gfx
D_09001200_3A1F60
[];
5
extern
Gfx
D_090012A8_3A2008
[];
6
extern
Gfx
D_09001490_3A21F0
[];
7
extern
Gfx
D_090014B0_3A2210
[];
8
extern
Gfx
D_090014D0_3A2230
[];
9
extern
Gfx
D_090014F0_3A2250
[];
10
extern
Gfx
D_09001510_3A2270
[];
11
12
Gfx
*
D_E009EDF0
[] = {
D_09001490_3A21F0
};
13
Gfx
*
D_E009EDF4
[] = {
D_090014B0_3A2210
};
14
Gfx
*
D_E009EDF8
[] = {
D_090014D0_3A2230
};
15
Gfx
*
D_E009EDFC
[] = {
D_090014F0_3A2250
};
16
17
void
radiating_energy_orb_init
(
EffectInstance
* effect);
18
void
radiating_energy_orb_update
(
EffectInstance
* effect);
19
void
radiating_energy_orb_render
(
EffectInstance
* effect);
20
void
radiating_energy_orb_appendGfx
(
void
* effect);
21
22
EffectInstance
*
radiating_energy_orb_main
(
23
s32
arg0
,
24
f32
arg1
,
25
f32
arg2
,
26
f32
arg3
,
27
f32
arg4
,
28
s32
arg5
29
) {
30
EffectBlueprint
bp
;
31
EffectInstance
* effect;
32
RadiatingEnergyOrbFXData
*
part
;
33
s32 numParts = 6;
34
s32 i;
35
36
bp
.
unk_00
= 0;
37
bp
.init =
radiating_energy_orb_init
;
38
bp
.update =
radiating_energy_orb_update
;
39
bp
.renderScene =
radiating_energy_orb_render
;
40
bp
.renderUI =
NULL
;
41
bp
.effectID =
EFFECT_RADIATING_ENERGY_ORB
;
42
43
effect =
create_effect_instance
(&
bp
);
44
effect->
numParts
= numParts;
45
part
= effect->
data
.
radiatingEnergyOrb
=
general_heap_malloc
(numParts *
sizeof
(*
part
));
46
ASSERT
(effect->
data
.
radiatingEnergyOrb
!=
NULL
);
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
71
void
radiating_energy_orb_init
(
EffectInstance
* effect) {
72
}
73
74
void
radiating_energy_orb_update
(
EffectInstance
* effect) {
75
RadiatingEnergyOrbFXData
*
part
= effect->
data
.
radiatingEnergyOrb
;
76
s32 unk_18;
77
s32 unk_1C;
78
s32 i;
79
80
if
(effect->
flags
&
FX_INSTANCE_FLAG_DISMISS
) {
81
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
118
void
radiating_energy_orb_render
(
EffectInstance
* effect) {
119
RenderTask
renderTask
;
120
RenderTask
*
retTask
;
121
122
renderTask
.
appendGfx
=
radiating_energy_orb_appendGfx
;
123
renderTask
.appendGfxArg = effect;
124
renderTask
.dist = 10;
125
renderTask
.renderMode =
RENDER_MODE_SURFACE_XLU_LAYER3
;
126
127
retTask
=
queue_render_task
(&
renderTask
);
128
retTask
->renderMode |=
RENDER_TASK_FLAG_REFLECT_FLOOR
;
129
}
130
131
void
radiating_energy_orb_appendGfx
(
void
* effect) {
132
RadiatingEnergyOrbFXData
*
part
= ((
EffectInstance
*)effect)->data.radiatingEnergyOrb;
133
Camera
*
camera
= &
gCameras
[
gCurrentCameraID
];
134
s32 unk_1C =
part
->unk_1C;
135
s32
unk_14
=
part
->unk_14;
136
s32
temp_s2
= unk_1C & 1;
137
Matrix4f
sp18
;
138
Matrix4f
sp58
;
139
Matrix4f
unused;
140
s32 i;
141
142
if
(
temp_s2
) {
143
unk_14
*= 0.95;
144
}
145
146
gDPPipeSync
(
gMainGfxPos
++);
147
gSPSegment
(
gMainGfxPos
++, 0x09,
VIRTUAL_TO_PHYSICAL
(((
EffectInstance
*)effect)->shared->graphics));
148
149
guTranslateF
(
sp18
,
part
->unk_08,
part
->unk_0C,
part
->unk_10);
150
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
151
152
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_LOAD
|
G_MTX_MODELVIEW
);
153
gSPMatrix
(
gMainGfxPos
++,
camera
->mtxBillboard,
G_MTX_NOPUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
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);
157
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
158
159
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
160
gSPDisplayList
(
gMainGfxPos
++,
D_090012A8_3A2008
);
161
gSPDisplayList
(
gMainGfxPos
++,
D_09001510_3A2270
);
162
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
163
gSPDisplayList
(
gMainGfxPos
++,
D_09001200_3A1F60
);
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);
171
gDPSetCombineMode
(
gMainGfxPos
++,
PM_CC_07
,
PM_CC_07
);
172
173
guRotateF
(
sp18
,
part
->unk_20, 0.0f, 0.0f, 1.0f);
174
guTranslateF
(
sp58
,
part
->unk_2C, 0.0f, 0.0f);
175
guMtxCatF
(
sp58
,
sp18
,
sp18
);
176
guScaleF
(
sp58
, scale, scale, scale);
177
guMtxCatF
(
sp58
,
sp18
,
sp18
);
178
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
179
180
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
181
gSPDisplayList
(
gMainGfxPos
++,
D_E009EDFC
[0]);
182
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
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);
186
guMtxCatF
(
sp58
,
sp18
,
sp18
);
187
guScaleF
(
sp58
, 2.3 - scale, 2.3 - scale, 2.3 - scale);
188
guMtxCatF
(
sp58
,
sp18
,
sp18
);
189
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
190
191
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
192
gSPDisplayList
(
gMainGfxPos
++,
D_E009EDF8
[0]);
193
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
194
gDPSetPrimColor
(
gMainGfxPos
++, 0, 0, 255, 0, 255, (
part
->unk_14 *
unk_14
) >> 9);
195
gDPSetEnvColor
(
gMainGfxPos
++, 255, 128, 255, 0);
196
gDPSetCombineMode
(
gMainGfxPos
++,
PM_CC_4D
,
PM_CC_4D
);
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);
200
guMtxCatF
(
sp58
,
sp18
,
sp18
);
201
guTranslateF
(
sp58
, 20.0f, 0.0f, 0.0f);
202
guMtxCatF
(
sp58
,
sp18
,
sp18
);
203
guScaleF
(
sp58
, (
part
->unk_2C - 60.0f) * 0.05 + 1.0, 2.0 - (
part
->unk_2C - 60.0f) * 0.05, 1.0f);
204
guMtxCatF
(
sp58
,
sp18
,
sp18
);
205
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
206
207
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
208
gSPDisplayList
(
gMainGfxPos
++,
D_E009EDF4
[0]);
209
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
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);
214
guMtxCatF
(
sp58
,
sp18
,
sp18
);
215
guTranslateF
(
sp58
, 15.0f, 0.0f, 0.0f);
216
guMtxCatF
(
sp58
,
sp18
,
sp18
);
217
guScaleF
(
sp58
, (
part
->unk_2C - 60.0f) * 0.1 + 2.0, 1.0f, 1.0f);
218
guMtxCatF
(
sp58
,
sp18
,
sp18
);
219
guMtxF2L
(
sp18
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
220
221
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
222
gSPDisplayList
(
gMainGfxPos
++,
D_E009EDF0
[0]);
223
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
224
}
225
}
226
227
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
228
}
PopupMenu_SelectedIndex
BSS s32 PopupMenu_SelectedIndex
Definition
8a860_len_3f30.c:84
DisplayContext::matrixStack
Mtx matrixStack[0x200]
Definition
common_structs.h:2192
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:133
unk_14
s8 unk_14
Definition
demo_api.c:19
general_heap_malloc
#define general_heap_malloc
Definition
effect_shims.h:51
guRotateF
#define guRotateF
Definition
effect_shims.h:42
queue_render_task
#define queue_render_task
Definition
effect_shims.h:48
guMtxF2L
#define guMtxF2L
Definition
effect_shims.h:47
guTranslateF
#define guTranslateF
Definition
effect_shims.h:43
guMtxCatF
#define guMtxCatF
Definition
effect_shims.h:46
remove_effect
#define remove_effect
Definition
effect_shims.h:50
rand_int
#define rand_int
Definition
effect_shims.h:53
cos_deg
#define cos_deg
Definition
effect_shims.h:56
create_effect_instance
#define create_effect_instance
Definition
effect_shims.h:49
guScaleF
#define guScaleF
Definition
effect_shims.h:45
EffectInstanceDataPtr::radiatingEnergyOrb
struct RadiatingEnergyOrbFXData * radiatingEnergyOrb
Definition
effects.h:2543
EffectInstance::flags
s32 flags
Definition
effects.h:2602
EffectInstance::data
EffectInstanceDataPtr data
Definition
effects.h:2605
RadiatingEnergyOrbFXData::unk_00
char unk_00[4]
Definition
effects.h:1351
EffectInstance::numParts
s32 numParts
Definition
effects.h:2604
EffectInstance
Definition
effects.h:2601
RadiatingEnergyOrbFXData
Definition
effects.h:1350
effects_internal.h
ASSERT
#define ASSERT(condition)
Definition
effects_internal.h:8
FX_INSTANCE_FLAG_DISMISS
@ FX_INSTANCE_FLAG_DISMISS
Definition
enums.h:3517
RENDER_TASK_FLAG_REFLECT_FLOOR
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition
enums.h:3318
RENDER_MODE_SURFACE_XLU_LAYER3
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition
enums.h:3299
radiating_energy_orb_appendGfx
void radiating_energy_orb_appendGfx(void *effect)
Definition
radiating_energy_orb.c:131
D_E009EDF0
Gfx * D_E009EDF0[]
Definition
radiating_energy_orb.c:12
D_090014F0_3A2250
Gfx D_090014F0_3A2250[]
D_E009EDF4
Gfx * D_E009EDF4[]
Definition
radiating_energy_orb.c:13
D_09001200_3A1F60
Gfx D_09001200_3A1F60[]
radiating_energy_orb_main
EffectInstance * radiating_energy_orb_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition
radiating_energy_orb.c:22
radiating_energy_orb_update
void radiating_energy_orb_update(EffectInstance *effect)
Definition
radiating_energy_orb.c:74
D_09001490_3A21F0
Gfx D_09001490_3A21F0[]
D_E009EDFC
Gfx * D_E009EDFC[]
Definition
radiating_energy_orb.c:15
D_E009EDF8
Gfx * D_E009EDF8[]
Definition
radiating_energy_orb.c:14
D_09001510_3A2270
Gfx D_09001510_3A2270[]
D_090012A8_3A2008
Gfx D_090012A8_3A2008[]
D_090014D0_3A2230
Gfx D_090014D0_3A2230[]
radiating_energy_orb_init
void radiating_energy_orb_init(EffectInstance *effect)
Definition
radiating_energy_orb.c:71
D_090014B0_3A2210
Gfx D_090014B0_3A2210[]
radiating_energy_orb_render
void radiating_energy_orb_render(EffectInstance *effect)
Definition
radiating_energy_orb.c:118
PM_CC_07
#define PM_CC_07
Definition
macros.h:286
VIRTUAL_TO_PHYSICAL
#define VIRTUAL_TO_PHYSICAL(addr)
Definition
macros.h:47
PM_CC_4D
#define PM_CC_4D
Definition
macros.h:487
Camera
Definition
common_structs.h:749
EffectBlueprint
Definition
effects.h:2649
RenderTask
Definition
common_structs.h:1508
RenderTask::appendGfx
void(* appendGfx)(void *)
Definition
common_structs.h:1512
gCameras
Camera gCameras[4]
Definition
cam_main.c:16
gMainGfxPos
Gfx * gMainGfxPos
Definition
cam_main.c:14
gMatrixListPos
u16 gMatrixListPos
Definition
main_loop.c:44
gCurrentCameraID
s32 gCurrentCameraID
Definition
cam_math.c:5
gDisplayContext
DisplayContext * gDisplayContext
Definition
cam_main.c:15
src
effects
radiating_energy_orb.c
Generated by
1.10.0