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

Go to the source code of this file.

Functions

void emote_init (EffectInstance *effect)
 
void emote_update (EffectInstance *effect)
 
void emote_render (EffectInstance *effect)
 
void emote_appendGfx (void *effect)
 
void func_E0020000 (EmoteFXData *part, s32 arg1)
 
void emote_main (s32 arg0, Npc *arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7, EffectInstance **arg8)
 

Variables

Gfx D_09002170_336DE0 []
 
Gfx D_09002238_336EA8 []
 
Gfx D_090022E0_336F50 []
 
Gfx D_09002308_336F78 []
 
Gfx D_090023B0_337020 []
 
Gfx D_090023D8_337048 []
 
Gfx D_09002480_3370F0 []
 
Gfx D_090024A8_337118 []
 
Gfx D_09002550_3371C0 []
 
Gfx D_09002578_3371E8 []
 
Gfx * D_E0020C90 [] = { D_090022E0_336F50, NULL, D_090023B0_337020, D_09002480_3370F0, D_09002550_3371C0 }
 
Gfx * D_E0020CA4 [] = { D_09002238_336EA8, NULL, D_09002308_336F78, D_090023D8_337048, D_090024A8_337118 }
 
s8 D_E0020CB8 [40]
 
s8 D_E0020CE0 [28]
 
s8 D_E0020CFC [40]
 
s8 D_E0020D24 [12] = { 0, 0, 1, 1, 2, 2, 3, 3, -13, 0, 0, 0 }
 
s8 D_E0020D30 [80]
 
s8 * D_E0020D80 [5] = { D_E0020CB8, D_E0020CE0, D_E0020CFC, D_E0020D24, D_E0020D30 }
 
u8 D_E0020D94 []
 

Function Documentation

◆ emote_init()

void emote_init ( EffectInstance * effect)

Definition at line 147 of file emote.c.

147 {
148}

Referenced by emote_main().

◆ emote_update()

void emote_update ( EffectInstance * effect)

Definition at line 150 of file emote.c.

150 {
151 EmoteFXData* part = effect->data.emote;
152 s32 temp_a0 = D_E0020D80[part->unk_30][part->unk_34];
153 s32 type = part->unk_00;
154
155 part->unk_34++;
156 part->unk_38 = temp_a0;
157 if (part->unk_38 < 0) {
158 if (part->unk_38 != -1) {
159 part->unk_30 = -part->unk_38 - 10;
160 part->unk_34 = 0;
161 part->unk_38 = D_E0020D80[part->unk_30][0];
162 part->unk_34 = 1;
163 } else {
164 remove_effect(effect);
165 return;
166 }
167 }
168
169 if (part->unk_2C < 10000) {
170 part->unk_2C--;
171 }
172
173 if (part->unk_2C < 0) {
174 remove_effect(effect);
175 return;
176 }
177
178 if (part->unk_3C != NULL) {
179 if (type == 1) {
180 s32 i;
181
182 for (i = 0; i < effect->numParts; i++, part++) {
183 func_E0020000(part, i);
184 }
185 } else {
186 func_E0020000(part, 1);
187 }
188 }
189}
#define remove_effect
struct EmoteFXData * emote
Definition effects.h:2480
Npc * unk_3C
Definition effects.h:215
EffectData data
Definition effects.h:2605
s8 * D_E0020D80[5]
Definition emote.c:41
void func_E0020000(EmoteFXData *part, s32 arg1)
Definition emote.c:58

Referenced by emote_main().

◆ emote_render()

void emote_render ( EffectInstance * effect)

Definition at line 191 of file emote.c.

191 {
192 RenderTask renderTask;
193 RenderTask* retTask;
194
195 renderTask.appendGfx = emote_appendGfx;
196 renderTask.appendGfxArg = effect;
197 renderTask.dist = 0;
199
200 retTask = queue_render_task(&renderTask);
202}
#define queue_render_task
void emote_appendGfx(void *effect)
Definition emote.c:204
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by emote_main().

◆ emote_appendGfx()

void emote_appendGfx ( void * effect)

Definition at line 204 of file emote.c.

204 {
205 EmoteFXData* part = ((EffectInstance*)effect)->data.emote;
206 s32 type = part->unk_00;
207 s32 unk_38;
208 Gfx* dlist;
209 Gfx* dlist2;
210 Mtx* matrix;
211 s32 w;
212 s32 h;
213 s32 uls;
214 s32 ult;
215 s32 idx;
216 Matrix4f sp18;
217 Matrix4f sp58;
218 s32 i;
219
220 gDPPipeSync(gMainGfxPos++);
221 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
222
223 if (type != 1) {
224 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
225 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
226 guMtxCatF(sp58, sp18, sp18);
227
229
231 guScaleF(sp58, 1.0f, 0.8f, 1.0f);
232 guMtxCatF(sp58, sp18, sp18);
233 guRotateF(sp58, part->unk_24, 0.0f, 0.0f, 1.0f);
234 guMtxCatF(sp58, sp18, sp18);
236
237 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
238 gSPDisplayList(gMainGfxPos++, D_09002170_336DE0);
239 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
240 } else {
241 if (part->unk_38 == 0) {
242 for (i = 0; i < 3; i++, part++) {
243 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
244 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
245 guMtxCatF(sp58, sp18, sp18);
246 guRotateF(sp58, part->unk_24, 0.0f, 0.0f, 1.0f);
247 guMtxCatF(sp58, sp18, sp18);
248 guScaleF(sp58, part->unk_28, part->unk_28, 1.0f);
249 guMtxCatF(sp58, sp18, sp18);
251
252 gDPSetPrimColor(gMainGfxPos++, 0, 0, 235, 28, 0, 255);
253 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
254 gSPDisplayList(gMainGfxPos++, D_09002578_3371E8);
255 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
256 }
257 }
258
259 return;
260 }
261
262 gSPMatrix(gMainGfxPos++, matrix, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
263
264 unk_38 = part->unk_38;
265 dlist = D_E0020CA4[type];
266 dlist2 = D_E0020C90[type];
267
268 switch (type) {
269 case 0:
270 w = 16;
271 h = 16;
272 uls = 128 - unk_38 * 16;
273 ult = 0;
274 gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 0, 0, 255);
275 break;
276 case 2:
277 w = 32;
278 h = 48;
279 uls = 128 - unk_38 * 32;
280 ult = 0;
281 gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 0, 0, 255);
282 break;
283 case 3:
284 w = 32;
285 h = 32;
286 uls = 128 - unk_38 * 32;
287 ult = 0;
288 idx = (part->unk_2C * 3) % (ARRAY_COUNT(D_E0020D94) / 3);
289 gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E0020D94[idx], D_E0020D94[idx + 1], D_E0020D94[idx + 2], 255);
290 break;
291 case 4:
292 w = 32;
293 h = 8;
294 uls = 128 - unk_38 * 32;
295 ult = 0;
296 break;
297 }
298
299 if (dlist != NULL) {
300 gSPDisplayList(gMainGfxPos++, dlist);
301 }
302
303 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, uls * 4, ult * 4, (uls + w) * 4, (ult + h) * 4);
304
305 if (dlist2 != NULL) {
306 gSPDisplayList(gMainGfxPos++, dlist2);
307 }
308
309 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
310}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
u8 D_E0020D94[]
Definition emote.c:43
Gfx * D_E0020C90[]
Definition emote.c:15
Gfx D_09002170_336DE0[]
Gfx D_09002578_3371E8[]
Gfx * D_E0020CA4[]
Definition emote.c:17
#define ARRAY_COUNT(arr)
Definition macros.h:40
#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 emote_render().

◆ func_E0020000()

void func_E0020000 ( EmoteFXData * part,
s32 arg1 )

Definition at line 58 of file emote.c.

58 {
59 f32 unk_1C = part->unk_1C;
60 f32 unk_20 = part->unk_20;
61 Npc* npc = part->unk_3C;
62 Matrix4f sp18;
63 f32 sin;
64 f32 cos;
65
66 sin = sin_deg(gCameras[gCurrentCameraID].curYaw);
67 cos = cos_deg(gCameras[gCurrentCameraID].curYaw);
68 guRotateF(sp18, -(unk_1C - 20.0f + arg1 * 20), sin, 0.0f, -cos);
69
70 if (npc == PTR_LIST_END) {
71 part->unk_04 = gPlayerStatus.pos.x + part->unk_10 + sp18[1][0] * (unk_20 + 16.0f);
72 part->unk_08 = gPlayerStatus.pos.y + part->unk_14 + sp18[1][1] * (unk_20 + 16.0f);
73 part->unk_0C = gPlayerStatus.pos.z + part->unk_18 + sp18[1][2] * (unk_20 + 16.0f);
74 } else if (npc != NULL) {
75 part->unk_04 = npc->pos.x + part->unk_10 + sp18[1][0] * (unk_20 + 16.0f);
76 part->unk_08 = npc->pos.y + part->unk_14 + sp18[1][1] * (unk_20 + 16.0f);
77 part->unk_0C = npc->pos.z + part->unk_18 + sp18[1][2] * (unk_20 + 16.0f);
78 } else {
79 part->unk_04 = part->unk_10 + sp18[1][0] * (unk_20 + 16.0f);
80 part->unk_08 = part->unk_14 + sp18[1][1] * (unk_20 + 16.0f);
81 part->unk_0C = part->unk_18 + sp18[1][2] * (unk_20 + 16.0f);
82 }
83
84 part->unk_24 = unk_1C - 20.0f + arg1 * 20;
85 part->unk_28 = (unk_20 / 12.0f) * 0.5f + 0.5;
86}
#define sin_deg
#define cos_deg
#define PTR_LIST_END
Definition macros.h:42
Vec3f pos
PlayerStatus gPlayerStatus
Definition 77480.c:39

Referenced by emote_main(), and emote_update().

◆ emote_main()

void emote_main ( s32 arg0,
Npc * arg1,
f32 arg2,
f32 arg3,
f32 arg4,
f32 arg5,
f32 arg6,
s32 arg7,
EffectInstance ** arg8 )

Definition at line 88 of file emote.c.

88 {
90 EffectBlueprint* bpPtr = &bp;
91 EmoteFXData* data;
92 EffectInstance* effect;
93 s32 numParts;
94
95 if (arg0 == 1) {
96 numParts = 3;
97 } else {
98 numParts = 1;
99 }
100
101 bp.unk_00 = 0;
102 bp.init = emote_init;
103 bp.update = emote_update;
105 bp.renderUI = NULL;
106 bp.effectID = EFFECT_EMOTE;
107
108 effect = create_effect_instance(bpPtr);
109 effect->numParts = numParts;
110 data = effect->data.emote = general_heap_malloc(numParts * sizeof(*data));
111
112 ASSERT(effect->data.emote != NULL);
113 data->unk_3C = arg1;
114 data->unk_00 = arg0;
115 data->unk_30 = arg0;
116
117 if (arg7 <= 0) {
118 arg7 = 10000;
119 }
120 data->unk_2C = arg7;
121 data->unk_34 = 0;
122
123 if (arg0 == 1) {
124 s32 i;
125
126 for (i = 0; i < numParts; i++, data++) {
127 data->unk_10 = arg2;
128 data->unk_14 = arg3;
129 data->unk_18 = arg4;
130 data->unk_1C = arg6;
131 data->unk_20 = arg5;
132 data->unk_3C = arg1;
133 func_E0020000(data, i);
134 }
135 } else {
136 data->unk_10 = arg2;
137 data->unk_14 = arg3;
138 data->unk_18 = arg4;
139 data->unk_1C = arg6;
140 data->unk_20 = arg5;
141 data->unk_3C = arg1;
142 func_E0020000(data, 1);
143 }
144 *arg8 = effect;
145}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void emote_render(EffectInstance *effect)
Definition emote.c:191
void emote_update(EffectInstance *effect)
Definition emote.c:150
void emote_init(EffectInstance *effect)
Definition emote.c:147
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_09002170_336DE0

Gfx D_09002170_336DE0[]
extern

Referenced by emote_appendGfx().

◆ D_09002238_336EA8

Gfx D_09002238_336EA8[]
extern

◆ D_090022E0_336F50

Gfx D_090022E0_336F50[]
extern

◆ D_09002308_336F78

Gfx D_09002308_336F78[]
extern

◆ D_090023B0_337020

Gfx D_090023B0_337020[]
extern

◆ D_090023D8_337048

Gfx D_090023D8_337048[]
extern

◆ D_09002480_3370F0

Gfx D_09002480_3370F0[]
extern

◆ D_090024A8_337118

Gfx D_090024A8_337118[]
extern

◆ D_09002550_3371C0

Gfx D_09002550_3371C0[]
extern

◆ D_09002578_3371E8

Gfx D_09002578_3371E8[]
extern

Referenced by emote_appendGfx().

◆ D_E0020C90

Definition at line 15 of file emote.c.

Gfx D_090022E0_336F50[]
Gfx D_090023B0_337020[]
Gfx D_09002480_3370F0[]
Gfx D_09002550_3371C0[]

Referenced by emote_appendGfx().

◆ D_E0020CA4

Definition at line 17 of file emote.c.

Gfx D_090023D8_337048[]
Gfx D_09002238_336EA8[]
Gfx D_09002308_336F78[]
Gfx D_090024A8_337118[]

Referenced by emote_appendGfx().

◆ D_E0020CB8

s8 D_E0020CB8[40]
Initial value:
= {
0, 0, 1, 2, 3, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-1, 0
}

Definition at line 19 of file emote.c.

19 {
20 0, 0, 1, 2, 3, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
21 -1, 0
22};

◆ D_E0020CE0

s8 D_E0020CE0[28]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, 0, 0, 0
}

Definition at line 24 of file emote.c.

24 {
25 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, 0, 0, 0
26};

◆ D_E0020CFC

s8 D_E0020CFC[40]
Initial value:
= {
0, 0, 2, 1, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1,
0, 0
}

Definition at line 28 of file emote.c.

28 {
29 0, 0, 2, 1, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1,
30 0, 0
31};

◆ D_E0020D24

s8 D_E0020D24[12] = { 0, 0, 1, 1, 2, 2, 3, 3, -13, 0, 0, 0 }

Definition at line 33 of file emote.c.

33{ 0, 0, 1, 1, 2, 2, 3, 3, -13, 0, 0, 0 };

◆ D_E0020D30

s8 D_E0020D30[80]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, -1, 0
}

Definition at line 35 of file emote.c.

35 {
36 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
37 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
38 3, 3, -1, 0
39};

◆ D_E0020D80

s8* D_E0020D80[5] = { D_E0020CB8, D_E0020CE0, D_E0020CFC, D_E0020D24, D_E0020D30 }

Definition at line 41 of file emote.c.

s8 D_E0020CFC[40]
Definition emote.c:28
s8 D_E0020D24[12]
Definition emote.c:33
s8 D_E0020CB8[40]
Definition emote.c:19
s8 D_E0020CE0[28]
Definition emote.c:24
s8 D_E0020D30[80]
Definition emote.c:35

Referenced by emote_update().

◆ D_E0020D94

u8 D_E0020D94[]
Initial value:
= {
64, 0, 0,
32, 0, 32,
0, 0, 64,
0, 32, 32,
0, 64, 0,
32, 32, 0,
0, 0, 0
}

Definition at line 43 of file emote.c.

43 {
44 64, 0, 0,
45 32, 0, 32,
46 0, 0, 64,
47 0, 32, 32,
48 0, 64, 0,
49 32, 32, 0,
50 0, 0, 0
51};

Referenced by emote_appendGfx().