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

Go to the source code of this file.

Functions

void func_E0018000 (FootprintFXData *part)
 
void footprint_init (EffectInstance *effect)
 
void footprint_update (EffectInstance *effect)
 
void footprint_render (EffectInstance *effect)
 
void footprint_appendGfx (void *effect)
 
void footprint_main (f32 x, f32 y, f32 z, f32 angle, b32 isLeft)
 
void func_E00183BC (EffectInstance *effect)
 

Variables

Gfx D_09000240_32FD90 []
 

Function Documentation

◆ func_E0018000()

void func_E0018000 ( FootprintFXData * part)

Definition at line 12 of file footprint.c.

12 {
13 Matrix4f sp18;
14 Matrix4f sp58;
15
16 guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
17 guRotateF(sp58, part->rot.y, 0.0f, 1.0f, 0.0f);
18 guMtxCatF(sp58, sp18, sp18);
19 guMtxF2L(sp18, &part->mtx);
20}
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF

Referenced by footprint_update().

◆ footprint_init()

void footprint_init ( EffectInstance * effect)

Definition at line 75 of file footprint.c.

75 {
76}

Referenced by footprint_main().

◆ footprint_update()

void footprint_update ( EffectInstance * effect)

Definition at line 78 of file footprint.c.

78 {
79 FootprintFXData* part = effect->data.footprint;
80 s32 cond = FALSE;
81 s32 i;
82
83 for (i = 0; i < effect->numParts; i++, part++) {
84 if (part->alive) {
85 part->lifetime--;
86 if (part->lifetime <= 0) {
87 part->alive = FALSE;
88 } else {
89 cond = TRUE;
90 func_E0018000(part);
91 part->alpha -= 2;
92 }
93 }
94 }
95
96 if (!cond) {
97 remove_effect(effect);
98 }
99}
#define remove_effect
struct FootprintFXData * footprint
Definition effects.h:2476
EffectData data
Definition effects.h:2605
void func_E0018000(FootprintFXData *part)
Definition footprint.c:12

Referenced by footprint_main().

◆ footprint_render()

void footprint_render ( EffectInstance * effect)

Definition at line 101 of file footprint.c.

101 {
102 RenderTask renderTask;
103 RenderTask* retTask;
104
105 renderTask.appendGfx = footprint_appendGfx;
106 renderTask.appendGfxArg = effect;
107 renderTask.dist = 0;
109
110 retTask = queue_render_task(&renderTask);
112}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_PASS_THROUGH
Definition enums.h:3306
void footprint_appendGfx(void *effect)
Definition footprint.c:118
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by footprint_main().

◆ footprint_appendGfx()

void footprint_appendGfx ( void * effect)

Definition at line 118 of file footprint.c.

118 {
119 EffectInstance* effectTemp = effect;
120 FootprintFXData* part = effectTemp->data.footprint;
121 s32 i;
122
123 gDPPipeSync(gMainGfxPos++);
124 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data));
125
126 for (i = 0; i < effectTemp->numParts; i++, part++) {
127 if (part->alive) {
128 Gfx* dlist = D_09000240_32FD90;
129
131
132 gDPSetPrimColor(gMainGfxPos++, 0, 0, 112, 96, 24, part->alpha);
134 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
135 gSPDisplayList(gMainGfxPos++, dlist);
136 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
137 }
138 }
139 gDPPipeSync(gMainGfxPos++);
140}
Mtx matrixStack[0x200]
struct EffectGraphics * graphics
Definition effects.h:2606
Gfx D_09000240_32FD90[]
#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 footprint_render().

◆ footprint_main()

void footprint_main ( f32 x,
f32 y,
f32 z,
f32 angle,
b32 isLeft )

Definition at line 22 of file footprint.c.

22 {
24 EffectInstance* effect;
25 FootprintFXData* part;
26 s32 numParts = 1;
27 s32 i;
28 f32 temp_f20;
29 f32 temp_f20_2;
30 f32 sense = isLeft ? 1.0 : -1.0;
31
32 bp.unk_00 = 0;
36 bp.renderUI = NULL;
37 bp.effectID = EFFECT_FOOTPRINT;
38
39 effect = create_effect_instance(&bp);
40 effect->numParts = 1;
41 part = general_heap_malloc(numParts * sizeof(*part));
42 effect->data.footprint = part;
43
44 ASSERT(effect->data.footprint != NULL);
45
46 mem_clear(part, numParts * sizeof(*part));
47
48 for (i = 0; i < numParts; i++, part++) {
49 part->alive = TRUE;
50 part->unk_7C = 0;
51 part->pos.x = x;
52 part->pos.y = y;
53 part->pos.z = z;
54 part->alpha = 255;
55 part->scale.x = 1.0f;
56 part->scale.y = 1.0f;
57 part->scale.z = 1.0f;
58 part->unk_70 = 0;
59 part->unk_80 = 0;
60 part->unk_84 = 0;
61 part->lifetime = 100;
62 part->rot.x = 0.0f;
63 part->rot.y = angle + (sense * 30.0f) - 15.0f;
64 part->rot.z = 0.0f;
65 temp_f20 = clamp_angle(angle);
66 part->unk_90 = sin_deg(temp_f20);
67 part->unk_94 = cos_deg(temp_f20);
68 temp_f20_2 = (temp_f20 + 45.0f) - (sense * 180.0f);
69 part->pos.x += sin_deg(temp_f20_2) * 5.0f;
70 part->pos.z += cos_deg(temp_f20_2) * 5.0f;
71 part->alpha = 200;
72 }
73}
#define general_heap_malloc
#define sin_deg
#define clamp_angle
#define cos_deg
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
void footprint_render(EffectInstance *effect)
Definition footprint.c:101
void footprint_init(EffectInstance *effect)
Definition footprint.c:75
void footprint_update(EffectInstance *effect)
Definition footprint.c:78
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

◆ func_E00183BC()

void func_E00183BC ( EffectInstance * effect)

Definition at line 114 of file footprint.c.

114 {
115 remove_effect(effect);
116}

Variable Documentation

◆ D_09000240_32FD90

Gfx D_09000240_32FD90[]
extern

Referenced by footprint_appendGfx().