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
4extern Gfx D_09003F98_3FE448[];
5extern Gfx D_09004010_3FE4C0[];
6extern Gfx D_09004088_3FE538[];
7extern Gfx D_09004100_3FE5B0[];
8extern Gfx D_09004178_3FE628[];
9extern Gfx D_090041F0_3FE6A0[];
10extern Gfx D_09004268_3FE718[];
11extern Gfx D_090042E0_3FE790[];
12extern Gfx D_09004360_3FE810[];
13extern Gfx D_09004458_3FE908[];
14extern Gfx D_09004508_3FE9B8[];
15extern Gfx D_09004600_3FEAB0[];
16
23
27void spirit_card_appendGfx(void* effect);
28
31
33 s32 arg0,
34 f32 arg1,
35 f32 arg2,
36 f32 arg3,
37 f32 arg4,
38 s32 arg5)
39{
41 EffectInstance* effect;
42 SpiritCardFXData* data;
43 s32 numParts = 1;
44
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
88}
89
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) {
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
119 RenderTask renderTask;
120 RenderTask* retTask;
121
122 renderTask.appendGfx = spirit_card_appendGfx;
123 renderTask.appendGfxArg = effect;
124 renderTask.dist = 10;
126
127 retTask = queue_render_task(&renderTask);
129}
130
131void func_E0112330(s32 arg0, SpiritCardFXData* data) {
132 f32 temp;
133 Matrix4f sp20;
134 Matrix4f sp60;
135
136 if (arg0 == 0) {
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);
148
149 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
150}
151
152void 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}
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 guPositionF
#define load_effect
#define create_effect_instance
struct MiscParticlesFXData * miscParticles
Definition effects.h:2578
struct SpiritCardFXData * spiritCard
Definition effects.h:2587
struct EffectInstance * child
Definition effects.h:2230
EffectData 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_LAYER1
Definition enums.h:3282
EffectInstance * misc_particles_main(s32 variation, f32 posX, f32 posY, f32 posZ, f32 scaleX, f32 scaleY, f32 arg6, s32 numParticles, s32 duration)
void ring_blast_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5)
Definition ring_blast.c:15
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
void spirit_card_update(EffectInstance *effect)
Definition spirit_card.c:90
Gfx D_09004458_3FE908[]
void spirit_card_appendGfx(void *effect)
Gfx D_09003F98_3FE448[]
Gfx D_09004178_3FE628[]
Gfx D_090041F0_3FE6A0[]
Gfx D_09004010_3FE4C0[]
EFFECT_DEF_RING_BLAST(ring_blast_main)
Gfx D_090042E0_3FE790[]
Gfx * D_E0112640[]
Definition spirit_card.c:19
Gfx * D_E0112638[]
Definition spirit_card.c:18
EffectInstance * spirit_card_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition spirit_card.c:32
Gfx D_09004088_3FE538[]
void spirit_card_render(EffectInstance *effect)
void spirit_card_init(EffectInstance *effect)
Definition spirit_card.c:87
Gfx D_09004268_3FE718[]
Gfx D_09004600_3FEAB0[]
Gfx D_09004100_3FE5B0[]
Gfx D_09004508_3FE9B8[]
Gfx * D_E0112630[]
Definition spirit_card.c:17
Gfx D_09004360_3FE810[]
void func_E0112330(s32 arg0, SpiritCardFXData *data)
EFFECT_DEF_MISC_PARTICLES(misc_particles_main)
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