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

Go to the source code of this file.

Functions

void sweat_init (EffectInstance *effect)
 
void sweat_update (EffectInstance *effect)
 
void sweat_render (EffectInstance *effect)
 
void sweat_appendGfx (void *effect)
 
void sweat_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 timeLeft)
 

Variables

Gfx D_09000200_35C750 []
 
Gfx D_090002C8_35C818 []
 
Gfx D_09000390_35C8E0 []
 
Gfx D_09000460_35C9B0 []
 

Function Documentation

◆ sweat_init()

void sweat_init ( EffectInstance * effect)

Definition at line 48 of file sweat.c.

48 {
49}

Referenced by sweat_main().

◆ sweat_update()

void sweat_update ( EffectInstance * effect)

Definition at line 51 of file sweat.c.

51 {
52 SweatFXData* data = effect->data.sweat;
53
54 data->timeLeft--;
55 if (data->timeLeft < 0) {
56 remove_effect(effect);
57 return;
58 }
59 data->pos.x += data->unk_18;
60 data->pos.y += data->unk_1C;
61 data->pos.z += data->unk_20;
62 data->unk_1C -= 0.05;
63 data->unk_18 *= 0.94;
64 if (data->unk_1C < -0.1) {
65 data->unk_1C = -0.1f;
66 }
67 data->unk_20 *= 0.94;
68}
#define remove_effect
s32 timeLeft
Definition effects.h:611
Vec3f pos
Definition effects.h:605
struct SweatFXData * sweat
Definition effects.h:2504
EffectData data
Definition effects.h:2605

Referenced by sweat_main().

◆ sweat_render()

void sweat_render ( EffectInstance * effect)

Definition at line 70 of file sweat.c.

70 {
71 RenderTask renderTask;
72 RenderTask* retTask;
73
74 renderTask.appendGfx = sweat_appendGfx;
75 renderTask.appendGfxArg = effect;
76 renderTask.dist = 0;
78
79 retTask = queue_render_task(&renderTask);
81}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)
void sweat_appendGfx(void *effect)
Definition sweat.c:83

Referenced by sweat_main().

◆ sweat_appendGfx()

void sweat_appendGfx ( void * effect)

Definition at line 83 of file sweat.c.

83 {
84 SweatFXData* data = ((EffectInstance*)effect)->data.sweat;
85 Matrix4f sp18;
86 Matrix4f sp58;
87
88 gDPPipeSync(gMainGfxPos++);
89 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
90
91 guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z);
92 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
93 guMtxCatF(sp58, sp18, sp18);
94 guRotateF(sp58, data->unk_10, 0.0f, 0.0f, 1.0f);
95 guMtxCatF(sp58, sp18, sp18);
97
98 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
99
100 if (data->unk_10 > 0.0f) {
101 gSPDisplayList(gMainGfxPos++, data->unk_00 == 0 ? D_09000200_35C750 : D_090002C8_35C818);
102 } else {
103 gSPDisplayList(gMainGfxPos++, data->unk_00 == 0 ? D_09000390_35C8E0 : D_09000460_35C9B0);
104 }
105
106 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
107}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx D_09000200_35C750[]
Gfx D_09000460_35C9B0[]
Gfx D_09000390_35C8E0[]
Gfx D_090002C8_35C818[]
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 sweat_render().

◆ sweat_main()

void sweat_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
f32 arg5,
s32 timeLeft )

Definition at line 14 of file sweat.c.

14 {
15 EffectBlueprint effectBp;
16 EffectInstance* effect;
17 SweatFXData* data;
18 Matrix4f matrix;
19 f32 temp_f2;
20 s32 numParts = 1;
21
22 effectBp.init = (void*)sweat_init;
23 effectBp.update = sweat_update;
24 effectBp.renderWorld = sweat_render;
25 effectBp.unk_00 = 0;
26 effectBp.renderUI = NULL;
27 effectBp.effectID = EFFECT_SWEAT;
28
29 effect = create_effect_instance(&effectBp);
30 effect->numParts = numParts;
31
32 data = effect->data.sweat = general_heap_malloc(numParts * sizeof(*data));
33 ASSERT(data != NULL);
34
35 data->unk_00 = arg0;
36 guRotateF(matrix, -arg5, sin_deg(gCameras[gCurrentCameraID].curYaw), 0.0f, -cos_deg(gCameras[gCurrentCameraID].curYaw));
37 temp_f2 = arg4 + 16.0f;
38 data->pos.x = arg1 + (matrix[1][0] * temp_f2);
39 data->pos.y = arg2 + (matrix[1][1] * temp_f2);
40 data->pos.z = arg3 + (matrix[1][2] * temp_f2);
41 data->unk_18 = matrix[1][0];
42 data->unk_1C = matrix[1][1];
43 data->unk_20 = matrix[1][2];
44 data->unk_10 = arg5;
45 data->timeLeft = timeLeft;
46}
#define general_heap_malloc
#define sin_deg
#define cos_deg
#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
void sweat_render(EffectInstance *effect)
Definition sweat.c:70
void sweat_init(EffectInstance *effect)
Definition sweat.c:48
void sweat_update(EffectInstance *effect)
Definition sweat.c:51

Variable Documentation

◆ D_09000200_35C750

Gfx D_09000200_35C750[]
extern

Referenced by sweat_appendGfx().

◆ D_090002C8_35C818

Gfx D_090002C8_35C818[]
extern

Referenced by sweat_appendGfx().

◆ D_09000390_35C8E0

Gfx D_09000390_35C8E0[]
extern

Referenced by sweat_appendGfx().

◆ D_09000460_35C9B0

Gfx D_09000460_35C9B0[]
extern

Referenced by sweat_appendGfx().