Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
spirit_card.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
effects_internal.h
"
3
4
extern
Gfx
D_09003F98_3FE448
[];
5
extern
Gfx
D_09004010_3FE4C0
[];
6
extern
Gfx
D_09004088_3FE538
[];
7
extern
Gfx
D_09004100_3FE5B0
[];
8
extern
Gfx
D_09004178_3FE628
[];
9
extern
Gfx
D_090041F0_3FE6A0
[];
10
extern
Gfx
D_09004268_3FE718
[];
11
extern
Gfx
D_090042E0_3FE790
[];
12
extern
Gfx
D_09004360_3FE810
[];
13
extern
Gfx
D_09004458_3FE908
[];
14
extern
Gfx
D_09004508_3FE9B8
[];
15
extern
Gfx
D_09004600_3FEAB0
[];
16
17
Gfx*
D_E0112630
[] = {
D_09004458_3FE908
,
D_09004600_3FEAB0
};
18
Gfx*
D_E0112638
[] = {
D_09004360_3FE810
,
D_09004508_3FE9B8
};
19
Gfx*
D_E0112640
[] = {
20
D_09003F98_3FE448
,
D_09004010_3FE4C0
,
D_09004088_3FE538
,
D_09004100_3FE5B0
,
21
D_09004178_3FE628
,
D_090041F0_3FE6A0
,
D_09004268_3FE718
22
};
23
24
void
spirit_card_init
(
EffectInstance
* effect);
25
void
spirit_card_update
(
EffectInstance
* effect);
26
void
spirit_card_render
(
EffectInstance
* effect);
27
void
spirit_card_appendGfx
(
void
* effect);
28
29
EFFECT_DEF_RING_BLAST
(
ring_blast_main
);
30
EFFECT_DEF_MISC_PARTICLES
(
misc_particles_main
);
31
32
EffectInstance
*
spirit_card_main
(
33
s32 arg0,
34
f32 arg1,
35
f32 arg2,
36
f32 arg3,
37
f32 arg4,
38
s32 arg5)
39
{
40
EffectBlueprint
bp;
41
EffectInstance
* effect;
42
SpiritCardFXData
* data;
43
s32 numParts = 1;
44
45
bp.
init
=
spirit_card_init
;
46
bp.
update
=
spirit_card_update
;
47
bp.
renderWorld
=
spirit_card_render
;
48
bp.
unk_00
= 0;
49
bp.
renderUI
= NULL;
50
bp.
effectID
= EFFECT_SPIRIT_CARD;
51
52
effect =
create_effect_instance
(&bp);
53
effect->
numParts
= numParts;
54
data = effect->
data
.
spiritCard
=
general_heap_malloc
(numParts *
sizeof
(*data));
55
ASSERT
(effect->
data
.
spiritCard
!= NULL);
56
57
data->
unk_00
= arg0;
58
data->
unk_14
= 0;
59
if
(arg5 <= 0) {
60
data->
unk_10
= 1000;
61
}
else
{
62
data->
unk_10
= arg5;
63
}
64
data->
pos
.
x
= arg1;
65
data->
pos
.
y
= arg2;
66
data->
pos
.
z
= arg3;
67
data->
unk_18
= arg4;
68
data->
yaw
= 0;
69
data->
chapter
= 0;
70
data->
unk_20
= 30.0f;
71
72
if
(arg0 == 0) {
73
load_effect
(EFFECT_RING_BLAST);
74
ring_blast_main
(1, data->
pos
.
x
, data->
pos
.
y
, data->
pos
.
z
, 3.0f, 30);
75
}
76
77
if
(arg0 < 2) {
78
load_effect
(EFFECT_MISC_PARTICLES);
79
data->
child
=
misc_particles_main
(3, arg1, arg2 - arg4 * 30.0f, arg3, arg4 * 30.0f, arg4 * 50.0f, 1.0f, 16, 0);
80
}
else
{
81
data->
child
= NULL;
82
}
83
84
return
effect;
85
}
86
87
void
spirit_card_init
(
EffectInstance
* effect) {
88
}
89
90
void
spirit_card_update
(
EffectInstance
* effect) {
91
SpiritCardFXData
* data = effect->
data
.
spiritCard
;
92
93
if
(effect->
flags
&
FX_INSTANCE_FLAG_DISMISS
) {
94
effect->
flags
&= ~FX_INSTANCE_FLAG_DISMISS;
95
data->
unk_10
= 16;
96
}
97
98
if
(data->
unk_10
< 1000) {
99
data->
unk_10
--;
100
}
101
102
data->
unk_14
++;
103
104
if
(data->
unk_10
< 0) {
105
remove_effect
(effect);
106
if
(data->
child
!= NULL) {
107
data->
child
->
flags
|=
FX_INSTANCE_FLAG_DISMISS
;
108
}
109
}
else
if
(data->
unk_10
>= 16 && data->
child
!= NULL) {
110
data->
child
->
data
.
miscParticles
->
scaleX
= data->
unk_18
* 30.0f;
111
data->
child
->
data
.
miscParticles
->
scaleY
= data->
unk_18
* 50.0f;
112
data->
child
->
data
.
miscParticles
->
pos
.
x
= data->
pos
.
x
;
113
data->
child
->
data
.
miscParticles
->
pos
.
y
= data->
pos
.
y
- data->
unk_18
* 30.0f;
114
data->
child
->
data
.
miscParticles
->
pos
.
z
= data->
pos
.
z
;
115
}
116
}
117
118
void
spirit_card_render
(
EffectInstance
* effect) {
119
RenderTask
renderTask;
120
RenderTask
* retTask;
121
122
renderTask.
appendGfx
=
spirit_card_appendGfx
;
123
renderTask.
appendGfxArg
= effect;
124
renderTask.
dist
= 10;
125
renderTask.
renderMode
=
RENDER_MODE_SURFACE_XLU_LAYER1
;
126
127
retTask =
queue_render_task
(&renderTask);
128
retTask->
renderMode
|=
RENDER_TASK_FLAG_REFLECT_FLOOR
;
129
}
130
131
void
func_E0112330
(s32 arg0,
SpiritCardFXData
* data) {
132
f32 temp;
133
Matrix4f
sp20;
134
Matrix4f
sp60;
135
136
if
(arg0 == 0) {
137
temp =
gCameras
[
gCurrentCameraID
].
curYaw
;
138
}
else
{
139
temp = 0.0f;
140
}
141
142
guPositionF
(sp20, 0.0f, data->
yaw
- temp, 0.0f, data->
unk_18
, data->
pos
.
x
+ 2.0f, data->
pos
.
y
, data->
pos
.
z
+ 2.0f);
143
guRotateF
(sp60, data->
unk_20
, 0.0f, 0.0f, 1.0f);
144
guMtxCatF
(sp60, sp20, sp20);
145
guTranslateF
(sp60, 0.0f, 0.0f, -2.0f);
146
guMtxCatF
(sp60, sp20, sp20);
147
guMtxF2L
(sp20, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
148
149
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
150
}
151
152
void
spirit_card_appendGfx
(
void
* effect) {
153
SpiritCardFXData
* data = ((
EffectInstance
*)effect)->data.spiritCard;
154
s32 unk_00 = data->
unk_00
;
155
156
gDPPipeSync(
gMainGfxPos
++);
157
gSPSegment(
gMainGfxPos
++, 0x09,
VIRTUAL_TO_PHYSICAL
(((
EffectInstance
*)effect)->graphics->data));
158
gSPDisplayList(
gMainGfxPos
++,
D_090042E0_3FE790
);
159
gDPSetEnvColor(
gMainGfxPos
++, 0, 0, 0, 255);
160
161
if
(unk_00 < 2) {
162
func_E0112330
(0, data);
163
164
gSPDisplayList(
gMainGfxPos
++,
D_E0112638
[0]);
165
gSPDisplayList(
gMainGfxPos
++,
D_E0112640
[data->
chapter
]);
166
gSPDisplayList(
gMainGfxPos
++,
D_E0112630
[0]);
167
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
168
}
169
170
gDPPipeSync(
gMainGfxPos
++);
171
}
DisplayContext::matrixStack
Mtx matrixStack[0x200]
Definition
common_structs.h:2191
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:132
Vec3f::z
f32 z
Definition
common_structs.h:102
Vec3f::x
f32 x
Definition
common_structs.h:100
Vec3f::y
f32 y
Definition
common_structs.h:101
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
guPositionF
#define guPositionF
Definition
effect_shims.h:65
load_effect
#define load_effect
Definition
effect_shims.h:59
create_effect_instance
#define create_effect_instance
Definition
effect_shims.h:49
SpiritCardFXData::unk_10
s32 unk_10
Definition
effects.h:2227
SpiritCardFXData::unk_20
f32 unk_20
Definition
effects.h:2231
EffectInstance::flags
s32 flags
Definition
effects.h:2602
SpiritCardFXData::unk_18
f32 unk_18
Definition
effects.h:2229
SpiritCardFXData::pos
Vec3f pos
Definition
effects.h:2226
SpiritCardFXData::chapter
u8 chapter
Definition
effects.h:2234
MiscParticlesFXData::scaleX
f32 scaleX
Definition
effects.h:2047
EffectData::miscParticles
struct MiscParticlesFXData * miscParticles
Definition
effects.h:2578
SpiritCardFXData::unk_14
s32 unk_14
Definition
effects.h:2228
MiscParticlesFXData::pos
Vec3f pos
Definition
effects.h:2046
MiscParticlesFXData::scaleY
f32 scaleY
Definition
effects.h:2048
EffectData::spiritCard
struct SpiritCardFXData * spiritCard
Definition
effects.h:2587
EffectInstance::numParts
s32 numParts
Definition
effects.h:2604
SpiritCardFXData::child
struct EffectInstance * child
Definition
effects.h:2230
SpiritCardFXData::yaw
f32 yaw
Definition
effects.h:2232
EffectInstance::data
EffectData data
Definition
effects.h:2605
SpiritCardFXData::unk_00
s32 unk_00
Definition
effects.h:2225
EffectInstance
Definition
effects.h:2601
SpiritCardFXData
Definition
effects.h:2224
effects_internal.h
ASSERT
#define ASSERT(condition)
Definition
effects_internal.h:7
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_LAYER1
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition
enums.h:3282
misc_particles_main
EffectInstance * misc_particles_main(s32 variation, f32 posX, f32 posY, f32 posZ, f32 scaleX, f32 scaleY, f32 arg6, s32 numParticles, s32 duration)
Definition
misc_particles.c:46
ring_blast_main
void ring_blast_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5)
Definition
ring_blast.c:15
VIRTUAL_TO_PHYSICAL
#define VIRTUAL_TO_PHYSICAL(addr)
Definition
macros.h:47
spirit_card_update
void spirit_card_update(EffectInstance *effect)
Definition
spirit_card.c:90
D_09004458_3FE908
Gfx D_09004458_3FE908[]
spirit_card_appendGfx
void spirit_card_appendGfx(void *effect)
Definition
spirit_card.c:152
D_09003F98_3FE448
Gfx D_09003F98_3FE448[]
D_09004178_3FE628
Gfx D_09004178_3FE628[]
D_090041F0_3FE6A0
Gfx D_090041F0_3FE6A0[]
D_09004010_3FE4C0
Gfx D_09004010_3FE4C0[]
EFFECT_DEF_RING_BLAST
EFFECT_DEF_RING_BLAST(ring_blast_main)
D_090042E0_3FE790
Gfx D_090042E0_3FE790[]
D_E0112640
Gfx * D_E0112640[]
Definition
spirit_card.c:19
D_E0112638
Gfx * D_E0112638[]
Definition
spirit_card.c:18
spirit_card_main
EffectInstance * spirit_card_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition
spirit_card.c:32
D_09004088_3FE538
Gfx D_09004088_3FE538[]
spirit_card_render
void spirit_card_render(EffectInstance *effect)
Definition
spirit_card.c:118
spirit_card_init
void spirit_card_init(EffectInstance *effect)
Definition
spirit_card.c:87
D_09004268_3FE718
Gfx D_09004268_3FE718[]
D_09004600_3FEAB0
Gfx D_09004600_3FEAB0[]
D_09004100_3FE5B0
Gfx D_09004100_3FE5B0[]
D_09004508_3FE9B8
Gfx D_09004508_3FE9B8[]
D_E0112630
Gfx * D_E0112630[]
Definition
spirit_card.c:17
D_09004360_3FE810
Gfx D_09004360_3FE810[]
func_E0112330
void func_E0112330(s32 arg0, SpiritCardFXData *data)
Definition
spirit_card.c:131
EFFECT_DEF_MISC_PARTICLES
EFFECT_DEF_MISC_PARTICLES(misc_particles_main)
Camera::curYaw
f32 curYaw
Definition
common_structs.h:800
EffectBlueprint
Definition
effects.h:2649
EffectBlueprint::renderUI
void(* renderUI)(EffectInstance *effectInst)
Definition
effects.h:2655
EffectBlueprint::effectID
s32 effectID
Definition
effects.h:2651
EffectBlueprint::init
void(* init)(EffectInstance *effectInst)
Definition
effects.h:2652
EffectBlueprint::update
void(* update)(EffectInstance *effectInst)
Definition
effects.h:2653
EffectBlueprint::unk_00
s32 unk_00
Definition
effects.h:2650
EffectBlueprint::renderWorld
void(* renderWorld)(EffectInstance *effectInst)
Definition
effects.h:2654
RenderTask
Definition
common_structs.h:1507
RenderTask::renderMode
s32 renderMode
Definition
common_structs.h:1508
RenderTask::appendGfxArg
void * appendGfxArg
Definition
common_structs.h:1510
RenderTask::appendGfx
void(* appendGfx)(void *)
Definition
common_structs.h:1511
RenderTask::dist
s32 dist
Definition
common_structs.h:1509
gCameras
Camera gCameras[4]
Definition
cam_main.c:17
gMainGfxPos
Gfx * gMainGfxPos
Definition
cam_main.c:15
gMatrixListPos
u16 gMatrixListPos
Definition
main_loop.c:45
gCurrentCameraID
s32 gCurrentCameraID
Definition
cam_math.c:4
gDisplayContext
DisplayContext * gDisplayContext
Definition
cam_main.c:16
src
effects
spirit_card.c
Generated by
1.10.0