Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ice_pillar.c File Reference

Go to the source code of this file.

Functions

void ice_pillar_init (EffectInstance *effect)
 
void ice_pillar_update (EffectInstance *effect)
 
void ice_pillar_render (EffectInstance *effect)
 
void ice_pillar_appendGfx (void *effect)
 
 EFFECT_DEF_MISC_PARTICLES (misc_particles_main)
 
 EFFECT_DEF_ICE_SHARD (ice_shard_main)
 
 EFFECT_DEF_COLD_BREATH (cold_breath_main)
 
EffectInstanceice_pillar_main (s32 arg0, f32 x, f32 y, f32 z, f32 scale, s32 arg5)
 

Variables

Gfx D_09001000_40B1C0 []
 
Gfx D_090011A8_40B368 []
 
Gfx D_090011C8_40B388 []
 
Gfx D_090011E8_40B3A8 []
 
Gfx D_09001208_40B3C8 []
 
Gfx * D_E011E7F0 [] = { D_090011A8_40B368, D_090011C8_40B388, D_090011E8_40B3A8, D_09001208_40B3C8 }
 
Gfx * D_E011E800 [] = { D_09001000_40B1C0 }
 

Function Documentation

◆ ice_pillar_init()

void ice_pillar_init ( EffectInstance * effect)

Definition at line 70 of file ice_pillar.c.

70 {
71}

Referenced by ice_pillar_main().

◆ ice_pillar_update()

void ice_pillar_update ( EffectInstance * effect)

Definition at line 73 of file ice_pillar.c.

73 {
74 IcePillarFXData* data = effect->data.icePillar;
75 s32 timeLeft;
76 s32 lifeTime;
77 s32 i;
78
79 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
80 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
81 data->timeLeft = 16;
82 }
83
84 if (data->timeLeft < 1000) {
85 data->timeLeft--;
86 }
87
88 data->lifeTime++;
89
90 if (data->timeLeft < 0) {
91 load_effect(EFFECT_ICE_SHARD);
92
93 for (i = 0; i < 20; i++) {
94 EffectInstance* iceShard;
95
96 iceShard = ice_shard_main(
97 (i % 2) + 2,
98 (data->pos.x + rand_int(20)) - 10.0f,
99 data->pos.y + (rand_int(40) * data->scale),
100 data->pos.z + 3.0f,
101 (data->scale * ((rand_int(10) * 0.7 * 0.1) + 0.3)),
102 i + 30
103 );
104 iceShard->data.iceShard->animFrame = rand_int(10) * 0.1;
105 iceShard->data.iceShard->animRate = (rand_int(30) * 0.01) + 0.1;
106 iceShard->data.iceShard->rot = rand_int(359);
107 iceShard->data.iceShard->angularVel = rand_int(20);
108 iceShard->data.iceShard->vel.x = rand_int(10) - 5;
109 iceShard->data.iceShard->vel.y = rand_int(10) - 5;
110 iceShard->data.iceShard->vel.z = 0;
111 iceShard->data.iceShard->gravAccel = -0.1f;
112 }
114 remove_effect(effect);
115 return;
116 }
117
118 timeLeft = data->timeLeft;
119 lifeTime = data->lifeTime;
120
121 data->unk_25--;
122 if (data->unk_25 < 0) {
123 data->unk_25 = rand_int(60) + 8;
124 }
125
126 if (data->unk_25 < 8) {
127 data->unk_24 = data->unk_25 / 2;
128 } else {
129 data->unk_24 = 0;
130 }
131
132 if (timeLeft > 16 && (lifeTime % 16) == 0) {
133 load_effect(EFFECT_COLD_BREATH);
134 cold_breath_main(2, data->pos.x, data->pos.y + (data->scale * 40.0f), data->pos.z, data->scale, 30);
135 }
136 data->miscParticles->data.miscParticles->pos.x = data->pos.x;
137 data->miscParticles->data.miscParticles->pos.y = data->pos.y + 10.0f;
138 data->miscParticles->data.miscParticles->pos.z = data->pos.z;
139}
EffectInstance * cold_breath_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 scale, s32 duration)
Definition cold_breath.c:79
#define remove_effect
#define rand_int
#define load_effect
struct MiscParticlesFXData * miscParticles
Definition effects.h:2578
struct EffectInstance * miscParticles
Definition effects.h:2359
struct IcePillarFXData * icePillar
Definition effects.h:2593
struct IceShardFXData * iceShard
Definition effects.h:2586
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
EffectInstance * ice_shard_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 scale, s32 duration)
Definition ice_shard.c:16

Referenced by ice_pillar_main().

◆ ice_pillar_render()

void ice_pillar_render ( EffectInstance * effect)

Definition at line 141 of file ice_pillar.c.

141 {
142 RenderTask renderTask;
143 RenderTask* retTask;
144
145 renderTask.appendGfx = ice_pillar_appendGfx;
146 renderTask.appendGfxArg = effect;
147 renderTask.dist = 5;
149
150 retTask = queue_render_task(&renderTask);
152}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void ice_pillar_appendGfx(void *effect)
Definition ice_pillar.c:154
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by ice_pillar_main().

◆ ice_pillar_appendGfx()

void ice_pillar_appendGfx ( void * effect)

Definition at line 154 of file ice_pillar.c.

154 {
155 IcePillarFXData* data = ((EffectInstance*)effect)->data.icePillar;
156 s32 alpha = data->prim.a;
157 Matrix4f sp10, sp50;
158 Camera* camera;
159
160 gDPPipeSync(gMainGfxPos++);
161 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
162
163 camera = &gCameras[gCurrentCameraID];
164 guTranslateF(sp10, data->pos.x, data->pos.y, data->pos.z);
165 guScaleF(sp50, data->scale, data->scale, data->scale);
166 guMtxCatF(sp50, sp10, sp10);
168
170 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
171 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
172 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->prim.r, data->prim.g, data->prim.b, alpha);
173 gDPSetEnvColor(gMainGfxPos++, data->env.r, data->env.g, data->env.b, data->env.a);
174 gSPDisplayList(gMainGfxPos++, D_E011E800[0]);
175 gSPDisplayList(gMainGfxPos++, D_E011E7F0[data->unk_24]);
176 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
177}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Color_RGBA8 prim
Definition effects.h:2353
Color_RGBA8 env
Definition effects.h:2354
Gfx * D_E011E7F0[]
Definition ice_pillar.c:15
Gfx * D_E011E800[]
Definition ice_pillar.c:16
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Mtx * mtxBillboard
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

Referenced by ice_pillar_render().

◆ EFFECT_DEF_MISC_PARTICLES()

EFFECT_DEF_MISC_PARTICLES ( misc_particles_main )

◆ EFFECT_DEF_ICE_SHARD()

EFFECT_DEF_ICE_SHARD ( ice_shard_main )

◆ EFFECT_DEF_COLD_BREATH()

EFFECT_DEF_COLD_BREATH ( cold_breath_main )

◆ ice_pillar_main()

EffectInstance * ice_pillar_main ( s32 arg0,
f32 x,
f32 y,
f32 z,
f32 scale,
s32 arg5 )

Definition at line 22 of file ice_pillar.c.

22 {
23 EffectBlueprint effectBp;
24 EffectInstance* effect;
25 IcePillarFXData* data;
26 s32 numParts = 1;
27
28 effectBp.init = ice_pillar_init;
29 effectBp.update = ice_pillar_update;
31 effectBp.unk_00 = 0;
32 effectBp.renderUI = NULL;
33 effectBp.effectID = EFFECT_ICE_PILLAR;
34
35 effect = create_effect_instance(&effectBp);
36 effect->numParts = numParts;
37
38 data = effect->data.icePillar = general_heap_malloc(numParts * sizeof(*data));
39 ASSERT(data != NULL);
40
41 data->unk_00 = arg0;
42 data->lifeTime = 0;
43 if (arg5 <= 0) {
44 data->timeLeft = 1000;
45 } else {
46 data->timeLeft = arg5;
47 }
48
49 data->prim.a = 255;
50 data->pos.x = x;
51 data->pos.y = y;
52 data->pos.z = z;
53 data->scale = scale;
54 data->prim.r = 255;
55 data->prim.g = 255;
56 data->prim.b = 255;
57 data->env.r = 240;
58 data->env.g = 255;
59 data->env.b = 255;
60 data->env.a = 255;
61 data->unk_24 = data->unk_25 = 0;
62
63 load_effect(EFFECT_MISC_PARTICLES);
64 data->miscParticles = misc_particles_main(1, x, y + 10.0f, z, 32.0f, 30.0f, scale, 4, 0);
65
66 load_effect(EFFECT_COLD_BREATH);
67 return effect;
68}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void ice_pillar_init(EffectInstance *effect)
Definition ice_pillar.c:70
void ice_pillar_render(EffectInstance *effect)
Definition ice_pillar.c:141
void ice_pillar_update(EffectInstance *effect)
Definition ice_pillar.c:73
EffectInstance * misc_particles_main(s32 variation, f32 posX, f32 posY, f32 posZ, f32 scaleX, f32 scaleY, f32 arg6, s32 numParticles, s32 duration)
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

Variable Documentation

◆ D_09001000_40B1C0

Gfx D_09001000_40B1C0[]
extern

◆ D_090011A8_40B368

Gfx D_090011A8_40B368[]
extern

◆ D_090011C8_40B388

Gfx D_090011C8_40B388[]
extern

◆ D_090011E8_40B3A8

Gfx D_090011E8_40B3A8[]
extern

◆ D_09001208_40B3C8

Gfx D_09001208_40B3C8[]
extern

◆ D_E011E7F0

Definition at line 15 of file ice_pillar.c.

Gfx D_090011E8_40B3A8[]
Gfx D_09001208_40B3C8[]
Gfx D_090011C8_40B388[]
Gfx D_090011A8_40B368[]

Referenced by ice_pillar_appendGfx().

◆ D_E011E800

Gfx* D_E011E800[] = { D_09001000_40B1C0 }

Definition at line 16 of file ice_pillar.c.

Gfx D_09001000_40B1C0[]

Referenced by ice_pillar_appendGfx().