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

Go to the source code of this file.

Functions

void recover_init (EffectInstance *effect)
 
void recover_update (EffectInstance *effect)
 
void recover_render (EffectInstance *effect)
 
void func_E008042C (EffectInstance *effect)
 
void func_E0080448 (EffectInstance *effect)
 
EffectInstancerecover_main (s32 type, f32 posX, f32 posY, f32 posZ, s32 duration)
 

Variables

Gfx D_09003200_385000 []
 
Gfx D_09003298_385098 []
 
Gfx D_09003330_385130 []
 
Gfx D_090033D0_3851D0 []
 
Gfx D_090033F0_3851F0 []
 
Gfx D_09003410_385210 []
 
Gfx D_09003430_385230 []
 
Gfx D_09003450_385250 []
 
Gfx D_09003470_385270 []
 
Gfx D_09003490_385290 []
 
Gfx D_090034B0_3852B0 []
 
Gfx D_090034D0_3852D0 []
 
Gfx D_09003540_385340 []
 
Gfx D_09003580_385380 []
 
Gfx D_090035C0_3853C0 []
 
Gfx D_09003600_385400 []
 
Gfx D_09003640_385440 []
 
Gfx D_09003680_385480 []
 
Gfx D_090036C0_3854C0 []
 
Gfx D_09003700_385500 []
 
Gfx D_09003740_385540 []
 
Gfx D_09003780_385580 []
 
Gfx D_090037C0_3855C0 []
 
Gfx D_09003800_385600 []
 
Gfx * D_E0080AC0 []
 
f32 D_E0080AF0 [] = { 0.25f, 0.5f, 0.75f, 1.0f, 0.9f, 1.1f, 1.0f }
 
f32 D_E0080B0C [] = { 0.25f, 0.5f, 0.75f, 1.0f, 1.2f, 0.9f, 1.0f }
 

Function Documentation

◆ recover_init()

void recover_init ( EffectInstance * effect)

Definition at line 107 of file recover.c.

107 {
108}

Referenced by recover_main().

◆ recover_update()

void recover_update ( EffectInstance * effect)

Definition at line 110 of file recover.c.

110 {
111 RecoverFXData* part = effect->data.recover;
112 s32 time;
113 s32 i;
114
115 part->timeLeft--;
116 part->lifetime++;
117
118 if (part->timeLeft < 0) {
119 remove_effect(effect);
120 return;
121 }
122
123 time = part->timeLeft;
124
125 part++;
126 for (i = 1; i < effect->numParts; i++, part++) {
127 s32 unk_2C_2 = part->timeLeft;
128
129 if (part->unk_34 <= 0 || --part->unk_34 <= 0) {
130 if (unk_2C_2 >= 7) {
131 part->scaleY = 1.0f;
132 part->scaleX = 1.0f;
133 } else {
134 part->scaleX = D_E0080AF0[unk_2C_2];
135 part->scaleY = D_E0080B0C[unk_2C_2];
136 }
137
138 part->pos.x += part->vel.x;
139 part->pos.y += part->vel.y;
140 part->pos.z += part->vel.z;
141 part->angle = sin_deg(i * 38 + time * 12) * -30.0f;
142 part->offsetX = cos_deg(i * 38 + time * 12) * 8.0f;
143
144 if (time < 20) {
145 part->offsetX *= (f32) time * 0.05;
146 part->angle *= (f32) time * 0.05;
147 }
148
149 if (time < 10) {
150 part->alpha = time * 25;
151 part->vel.y *= 0.9;
152 }
153
154 part->timeLeft++;
155 }
156 }
157}
#define sin_deg
#define remove_effect
#define cos_deg
EffectData data
Definition effects.h:2605
struct RecoverFXData * recover
Definition effects.h:2528
f32 D_E0080AF0[]
Definition recover.c:34
f32 D_E0080B0C[]
Definition recover.c:36

Referenced by recover_main().

◆ recover_render()

void recover_render ( EffectInstance * effect)

Definition at line 159 of file recover.c.

159 {
160}

Referenced by recover_main().

◆ func_E008042C()

void func_E008042C ( EffectInstance * effect)

Definition at line 162 of file recover.c.

162 {
163 func_E0080448(effect);
164}
void func_E0080448(EffectInstance *effect)
Definition recover.c:166

Referenced by recover_main().

◆ func_E0080448()

void func_E0080448 ( EffectInstance * effect)

Definition at line 166 of file recover.c.

166 {
167 RecoverFXData* part = ((EffectInstance*)effect)->data.recover;
168 s32 i;
169 s32 type;
170 s32 unk_40;
171 s32 unk_44 = part->unk_44;
172 Matrix4f sp18;
173 Matrix4f sp58;
174 Matrix4f sp98;
175
176 gDPPipeSync(gMainGfxPos++);
177 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
178
179 guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
180 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
181 guMtxCatF(sp58, sp18, sp98);
183
184 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
185
186 type = part->type;
187 unk_40 = part->unk_40;
188
189 part++;
190 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
191 if (part->unk_34 <= 0) {
192 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, part->alpha);
193
194 if (part->alpha == 255) {
195 gDPSetRenderMode(gMainGfxPos++, AA_EN | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM), AA_EN | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM));
196 gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
197 } else {
198 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
199 gDPSetCombineMode(gMainGfxPos++, PM_CC_49, PM_CC_49);
200 }
201
202 gSPDisplayList(gMainGfxPos++, (type == 0 || type == 2) ?
203 (unk_44 == 0 ? D_09003200_385000 : D_09003298_385098) :
205
206 guTranslateF(sp18, part->pos.x + part->offsetX, part->pos.y, part->pos.z);
207 guScaleF(sp58, part->scaleX, part->scaleY, 1.0f);
208 guMtxCatF(sp58, sp18, sp18);
210
211 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
212
213 guRotateF(sp18, part->angle, 0.0f, 0.0f, 1.0f);
215
216 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
217
218 if (i == 1 && type != 2) {
219 gSPDisplayList(gMainGfxPos++, D_090033D0_3851D0);
220 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
221 gSPDisplayList(gMainGfxPos++, D_090034D0_3852D0);
222
223 if (unk_40 < 10 && unk_44 == 0) {
224 gSPDisplayList(gMainGfxPos++, D_E0080AC0[unk_40]);
225 gSPDisplayList(gMainGfxPos++, type == 0 ? D_09003410_385210 : D_09003470_385270);
226 } else {
227 s32 ones = unk_40 % 10;
228 s32 tens = unk_44 == 0 ? (unk_40 / 10) : 10;
229
230 gSPDisplayList(gMainGfxPos++, D_E0080AC0[ones]);
231 gSPDisplayList(gMainGfxPos++, type == 0 ? D_09003450_385250 : D_090034B0_3852B0);
232 gSPDisplayList(gMainGfxPos++, D_E0080AC0[tens]);
233 gSPDisplayList(gMainGfxPos++, type == 0 ? D_09003430_385230 : D_09003490_385290);
234 }
235 } else {
236 gSPDisplayList(gMainGfxPos++, D_090033F0_3851F0);
237 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
238 }
239
240 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
241 }
242 }
243
244 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
245}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Gfx D_090034D0_3852D0[]
Gfx D_09003410_385210[]
Gfx D_09003450_385250[]
Gfx D_09003490_385290[]
Gfx D_09003200_385000[]
Gfx D_09003470_385270[]
Gfx D_09003298_385098[]
Gfx D_090033D0_3851D0[]
Gfx D_09003330_385130[]
Gfx D_090034B0_3852B0[]
Gfx * D_E0080AC0[]
Definition recover.c:29
Gfx D_090033F0_3851F0[]
Gfx D_09003430_385230[]
#define PM_CC_49
Definition macros.h:478
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
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 func_E008042C().

◆ recover_main()

EffectInstance * recover_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
s32 duration )

Definition at line 44 of file recover.c.

44 {
46 EffectInstance* effect;
47 RecoverFXData* part;
48 s32 numParts = 2;
49 s32 i;
50
51 bp.init = recover_init;
55 bp.unk_00 = 0;
56 bp.effectID = EFFECT_RECOVER;
57
58 effect = create_effect_instance(&bp);
59 effect->numParts = numParts;
60 part = effect->data.recover = general_heap_malloc(numParts * sizeof(*part));
61 ASSERT(effect->data.recover != NULL);
62
63 part->type = type;
64 part->pos.x = posX;
65 part->pos.y = posY;
66 part->pos.z = posZ;
67 part->timeLeft = 46;
68 part->lifetime = 0;
69 if (duration < 0) {
70 part->unk_44 = 1;
71 duration = -duration;
72 } else {
73 part->unk_44 = 0;
74 }
75 part->unk_40 = duration;
76
77 part++;
78 for (i = 1; i < numParts; i++, part++) {
79 part->pos.x = 0.0f;
80 part->pos.y = 0.0f;
81 part->pos.z = 0.0f;
82 part->offsetX = 0;
83 part->vel.x = 0;
84 part->vel.z = 0;
85 part->unk_20 = 0;
86 part->angle = 0;
87 if (i == 1) {
88 part->pos.x = 0.0f;
89 part->unk_34 = 0;
90 part->scaleX = 0.0f;
91 part->scaleY = 0.0f;
92 part->vel.y = 1.4f;
93 } else {
94 part->vel.y = 1.4f;
95 part->unk_34 = i + 10;
96 part->scaleX = 0.0f;
97 part->scaleY = 0.0f;
98 part->pos.x = ((i & 1) * 2 - 1) * ((i - 1) >> 1) * 4;
99 }
100 part->timeLeft = 0;
101 part->alpha = 255;
102 }
103
104 return effect;
105}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void recover_render(EffectInstance *effect)
Definition recover.c:159
void recover_update(EffectInstance *effect)
Definition recover.c:110
void func_E008042C(EffectInstance *effect)
Definition recover.c:162
void recover_init(EffectInstance *effect)
Definition recover.c:107
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_09003200_385000

Gfx D_09003200_385000[]
extern

Referenced by func_E0080448().

◆ D_09003298_385098

Gfx D_09003298_385098[]
extern

Referenced by func_E0080448().

◆ D_09003330_385130

Gfx D_09003330_385130[]
extern

Referenced by func_E0080448().

◆ D_090033D0_3851D0

Gfx D_090033D0_3851D0[]
extern

Referenced by func_E0080448().

◆ D_090033F0_3851F0

Gfx D_090033F0_3851F0[]
extern

Referenced by func_E0080448().

◆ D_09003410_385210

Gfx D_09003410_385210[]
extern

Referenced by func_E0080448().

◆ D_09003430_385230

Gfx D_09003430_385230[]
extern

Referenced by func_E0080448().

◆ D_09003450_385250

Gfx D_09003450_385250[]
extern

Referenced by func_E0080448().

◆ D_09003470_385270

Gfx D_09003470_385270[]
extern

Referenced by func_E0080448().

◆ D_09003490_385290

Gfx D_09003490_385290[]
extern

Referenced by func_E0080448().

◆ D_090034B0_3852B0

Gfx D_090034B0_3852B0[]
extern

Referenced by func_E0080448().

◆ D_090034D0_3852D0

Gfx D_090034D0_3852D0[]
extern

Referenced by func_E0080448().

◆ D_09003540_385340

Gfx D_09003540_385340[]
extern

◆ D_09003580_385380

Gfx D_09003580_385380[]
extern

◆ D_090035C0_3853C0

Gfx D_090035C0_3853C0[]
extern

◆ D_09003600_385400

Gfx D_09003600_385400[]
extern

◆ D_09003640_385440

Gfx D_09003640_385440[]
extern

◆ D_09003680_385480

Gfx D_09003680_385480[]
extern

◆ D_090036C0_3854C0

Gfx D_090036C0_3854C0[]
extern

◆ D_09003700_385500

Gfx D_09003700_385500[]
extern

◆ D_09003740_385540

Gfx D_09003740_385540[]
extern

◆ D_09003780_385580

Gfx D_09003780_385580[]
extern

◆ D_090037C0_3855C0

Gfx D_090037C0_3855C0[]
extern

◆ D_09003800_385600

Gfx D_09003800_385600[]
extern

◆ D_E0080AC0

Gfx* D_E0080AC0[]

◆ D_E0080AF0

f32 D_E0080AF0[] = { 0.25f, 0.5f, 0.75f, 1.0f, 0.9f, 1.1f, 1.0f }

Definition at line 34 of file recover.c.

34{ 0.25f, 0.5f, 0.75f, 1.0f, 0.9f, 1.1f, 1.0f };

Referenced by recover_update().

◆ D_E0080B0C

f32 D_E0080B0C[] = { 0.25f, 0.5f, 0.75f, 1.0f, 1.2f, 0.9f, 1.0f }

Definition at line 36 of file recover.c.

36{ 0.25f, 0.5f, 0.75f, 1.0f, 1.2f, 0.9f, 1.0f };

Referenced by recover_update().