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

Go to the source code of this file.

Functions

void chomp_drop_init (EffectInstance *effect)
 
void chomp_drop_update (EffectInstance *effect)
 
void chomp_drop_render (EffectInstance *effect)
 
void chomp_drop_appendGfx (void *effect)
 
EffectInstancechomp_drop_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5, f32 arg6, s32 arg7, f32 arg8, s32 arg9)
 
 EFFECT_DEF_DUST (dust_main)
 

Variables

Gfx D_09001040_398080 []
 
Gfx D_090010E8_398128 []
 
Gfx D_09001190_3981D0 []
 

Function Documentation

◆ chomp_drop_init()

void chomp_drop_init ( EffectInstance * effect)

Definition at line 54 of file chomp_drop.c.

54 {
55}

Referenced by chomp_drop_main().

◆ chomp_drop_update()

void chomp_drop_update ( EffectInstance * effect)

Definition at line 59 of file chomp_drop.c.

59 {
60 ChompDropFXData* data = effect->data.chompDrop;
61 s32 unk40;
62
63 data->unk_40--;
64 data->unk_44++;
65 if (data->unk_40 < 0) {
66 remove_effect(effect);
67 return;
68 }
69
70 unk40 = data->unk_40;
71 switch (data->unk_2C) {
72 case 0:
73 data->unk_24 += (data->unk_18 - data->unk_24) * data->unk_28;
74 data->unk_3C += (data->unk_20 - data->unk_3C) * data->unk_28;
75 data->unk_34 -= 0.02;
76 if (data->unk_34 < 0.0f) {
77 data->unk_30 = 10;
78 data->unk_34 = 0.0f;
79 data->unk_10 = 0.0f;
80 data->unk_2C = 1;
81 }
82 break;
83 case 1:
84 data->unk_30--;
85 if (data->unk_30 <= 0) {
86 data->unk_2C = 2;
87 data->unk_30 = 10;
88 }
89 break;
90 case 2:
91 data->unk_30--;
92 if (data->unk_30 <= 0) {
93 data->unk_2C = 3;
94 }
95 break;
96 case 3:
97 data->unk_10 -= 1.0f;
98 data->unk_08 += data->unk_10;
99 if (data->unk_08 < 0.0f) {
100 data->unk_08 = 0.0f;
101 load_effect(EFFECT_DUST);
102 dust_main(2, data->unk_04 + 5.0f, data->unk_08, data->unk_0C, 30);
103 dust_main(2, data->unk_04 - 5.0f, data->unk_08, data->unk_0C, 30);
104 data->unk_2C = 4;
105 data->unk_30 = 20;
106 }
107 break;
108 case 4:
109 data->unk_30--;
110 if (data->unk_30 <= 0) {
111 data->unk_2C = 5;
112 }
113 break;
114 case 5:
115 if (unk40 < 10) {
116 data->unk_3C = unk40 * 25;
117 }
118 data->unk_34 -= 0.05;
119 break;
120 }
121}
EffectInstance * dust_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4)
Definition dust.c:15
#define remove_effect
#define load_effect
struct ChompDropFXData * chompDrop
Definition effects.h:2541
EffectData data
Definition effects.h:2605

Referenced by chomp_drop_main().

◆ chomp_drop_render()

void chomp_drop_render ( EffectInstance * effect)

Definition at line 123 of file chomp_drop.c.

123 {
124 RenderTask renderTask;
125 RenderTask* retTask;
126
127 renderTask.appendGfx = chomp_drop_appendGfx;
128 renderTask.appendGfxArg = effect;
129 renderTask.dist = -10;
131
132 retTask = queue_render_task(&renderTask);
134}
void chomp_drop_appendGfx(void *effect)
Definition chomp_drop.c:136
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by chomp_drop_main().

◆ chomp_drop_appendGfx()

void chomp_drop_appendGfx ( void * effect)

Definition at line 136 of file chomp_drop.c.

136 {
137 EffectInstance* effectTemp = effect;
138 ChompDropFXData* data = effectTemp->data.chompDrop;
139 f32 temp_f22 = data->unk_34;
140 s32 temp_s7 = data->unk_38;
141 s32 primA = data->unk_3C;
142 s32 temp_s6 = data->unk_44;
143 Matrix4f sp20, sp60;
144 Gfx* savedGfxPos;
145 Vtx_t* vtxTemp;
146 s32 i;
147
148 gDPPipeSync(gMainGfxPos++);
149 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effectTemp)->graphics->data));
150
151 guScaleF(sp20, 0.01f, 0.01f, 0.01f);
152 guPositionF(sp60, 0.0f, 0.0f, 0.0f, data->unk_24, data->unk_04 * 100.0f, data->unk_08 * 100.0f, data->unk_0C * 100.0f);
153 guMtxCatF(sp60, sp20, sp20);
155
157 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
158 gDPSetPrimColor(
159 gMainGfxPos++, 0, 0,
160 (sin_deg(temp_s6 * 30) * 25.0f) + 225.0f,
161 (sin_deg(temp_s6 * 30) * 25.0f) + 225.0f,
162 255,
163 primA
164 );
165
166 if (data->unk_2C == 1) {
167 gSPDisplayList(gMainGfxPos++, D_09001040_398080);
168 gSPDisplayList(gMainGfxPos++, D_09001190_3981D0);
169 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, ((30 - data->unk_30) * 255) / 30);
170 gSPDisplayList(gMainGfxPos++, D_090010E8_398128);
171 gSPDisplayList(gMainGfxPos++, D_09001190_3981D0);
172 } else {
173 if (data->unk_2C > 0) {
174 gSPDisplayList(gMainGfxPos++, D_090010E8_398128);
175 } else {
176 gSPDisplayList(gMainGfxPos++, D_09001040_398080);
177 }
178
179 savedGfxPos = gMainGfxPos + 1;
180 gSPBranchList(gMainGfxPos, gMainGfxPos + 0x41);
181 gMainGfxPos = savedGfxPos;
182 vtxTemp = (Vtx_t*) savedGfxPos;
183
184 for (i = 0; i < 16; i++) {
185 Vtx_t* vtx = &vtxTemp[i * 2];
186 s32 temp_s1 = sin_deg(((temp_s6 * 10) + (i * 60)) + temp_s7) * 500.0f * temp_f22;
187 s32 temp_v0_3 = (i * 400) + (s32) (sin_deg(((temp_s6 * 10) + (i * 6)) + temp_s7) * 200.0f * temp_f22);
188
189 vtx->ob[0] = temp_s1 - 3200;
190 vtx->ob[1] = temp_v0_3;
191 vtx->ob[2] = 0;
192 vtx->tc[0] = 0;
193 vtx->tc[1] = i * 128;
194 vtx++;
195
196 vtx->ob[0] = temp_s1 + 3200;
197 vtx->ob[1] = temp_v0_3;
198 vtx->ob[2] = 0;
199 vtx->tc[0] = 2048;
200 vtx->tc[1] = i * 128;
201 }
202
203 gMainGfxPos += 0x40;
204 gSPVertex(gMainGfxPos++, vtxTemp, 32, 0);
205
206 for (i = 0; i < 15; i++) {
207 s32 i2 = i * 2;
208 gSP2Triangles(gMainGfxPos++,
209 i2 , i2 + 2, i2 + 1, i2,
210 i2 + 1, i2 + 2, i2 + 3, i2);
211 };
212 }
213
214 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
215 gDPPipeSync(gMainGfxPos++);
216}
Gfx D_09001040_398080[]
Gfx D_090010E8_398128[]
Gfx D_09001190_3981D0[]
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define sin_deg
#define guMtxCatF
#define guPositionF
#define guScaleF
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by chomp_drop_render().

◆ chomp_drop_main()

EffectInstance * chomp_drop_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
s32 arg5,
f32 arg6,
s32 arg7,
f32 arg8,
s32 arg9 )

Definition at line 13 of file chomp_drop.c.

15{
17 EffectInstance* effect;
18 ChompDropFXData* data;
19 s32 numParts = 1;
20
24 bp.unk_00 = 0;
25 bp.renderUI = NULL;
26 bp.effectID = EFFECT_CHOMP_DROP;
27
28 effect = create_effect_instance(&bp);
29 effect->numParts = numParts;
30 data = effect->data.chompDrop = general_heap_malloc(numParts * sizeof(*data));
31 ASSERT(effect->data.chompDrop != NULL);
32
33 data->unk_00 = arg0;
34 data->unk_04 = arg1;
35 data->unk_08 = arg2;
36 data->unk_0C = arg3;
37 data->unk_28 = arg8;
38 data->unk_14 = arg4;
39 data->unk_1C = arg5;
40 data->unk_18 = arg6;
41 data->unk_34 = 1.0f;
42 data->unk_20 = arg7;
43 data->unk_38 = rand_int(360);
44 data->unk_40 = arg9;
45 data->unk_44 = 0;
46 data->unk_3C = arg5;
47 data->unk_24 = arg4;
48 data->unk_10 = 0;
49 data->unk_2C = 0;
50
51 return effect;
52}
void chomp_drop_update(EffectInstance *effect)
Definition chomp_drop.c:59
void chomp_drop_render(EffectInstance *effect)
Definition chomp_drop.c:123
void chomp_drop_init(EffectInstance *effect)
Definition chomp_drop.c:54
#define general_heap_malloc
#define rand_int
#define create_effect_instance
#define ASSERT(condition)
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

◆ EFFECT_DEF_DUST()

EFFECT_DEF_DUST ( dust_main )

Variable Documentation

◆ D_09001040_398080

Gfx D_09001040_398080[]
extern

Referenced by chomp_drop_appendGfx().

◆ D_090010E8_398128

Gfx D_090010E8_398128[]
extern

Referenced by chomp_drop_appendGfx().

◆ D_09001190_3981D0

Gfx D_09001190_3981D0[]
extern

Referenced by chomp_drop_appendGfx().