Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
footprint.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
5
10void footprint_appendGfx(void* effect);
11
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);
19 guMtxF2L(sp18, &part->mtx);
20}
21
22void footprint_main(f32 x, f32 y, f32 z, f32 angle, b32 isLeft) {
24 EffectInstance* effect;
26 s32 numParts = 1;
27 s32 i;
30 f32 sense = isLeft ? 1.0 : -1.0;
31
32 bp.unk_00 = 0;
33 bp.init = footprint_init;
34 bp.update = footprint_update;
35 bp.renderScene = footprint_render;
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}
74
76}
77
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;
91 part->alpha -= 2;
92 }
93 }
94 }
95
96 if (!cond) {
97 remove_effect(effect);
98 }
99}
100
113
115 remove_effect(effect);
116}
117
118void footprint_appendGfx(void* effect) {
119 EffectInstance* effectInst = effect;
120 FootprintFXData* part = effectInst->data.footprint;
121 s32 i;
122
124 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectInst->shared->graphics));
125
126 for (i = 0; i < effectInst->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);
135 gSPDisplayList(gMainGfxPos++, dlist);
137 }
138 }
140}
BSS s32 PopupMenu_SelectedIndex
Mtx matrixStack[0x200]
s32 b32
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define clamp_angle
#define cos_deg
#define create_effect_instance
#define mem_clear
struct FootprintFXData * footprint
Definition effects.h:2476
EffectInstanceDataPtr data
Definition effects.h:2605
#define ASSERT(condition)
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_PASS_THROUGH
Definition enums.h:3306
void footprint_main(f32 x, f32 y, f32 z, f32 angle, b32 isLeft)
Definition footprint.c:22
void footprint_render(EffectInstance *effect)
Definition footprint.c:101
Gfx D_09000240_32FD90[]
void footprint_init(EffectInstance *effect)
Definition footprint.c:75
void footprint_update(EffectInstance *effect)
Definition footprint.c:78
void footprint_appendGfx(void *effect)
Definition footprint.c:118
void func_E00183BC(EffectInstance *effect)
Definition footprint.c:114
void func_E0018000(FootprintFXData *part)
Definition footprint.c:12
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
void(* appendGfx)(void *)
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16