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

Go to the source code of this file.

Functions

void falling_leaves_init (EffectInstance *effect)
 
void falling_leaves_render (EffectInstance *effect)
 
void falling_leaves_update (EffectInstance *effect)
 
void falling_leaves_appendGfx (void *effect)
 
void falling_leaves_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3)
 

Variables

Gfx D_09001100_3601E0 []
 
Gfx D_090011B0_360290 []
 

Function Documentation

◆ falling_leaves_init()

void falling_leaves_init ( EffectInstance * effect)

Definition at line 52 of file falling_leaves.c.

52 {
53}

Referenced by falling_leaves_main().

◆ falling_leaves_render()

void falling_leaves_render ( EffectInstance * effect)

Definition at line 111 of file falling_leaves.c.

111 {
112 RenderTask renderTask;
113 RenderTask* retTask;
114
116 renderTask.appendGfxArg = effect;
117 renderTask.dist = 0;
119
120 retTask = queue_render_task(&renderTask);
122}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void falling_leaves_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by falling_leaves_main().

◆ falling_leaves_update()

void falling_leaves_update ( EffectInstance * effect)

Definition at line 55 of file falling_leaves.c.

55 {
57 s32 unk_00 = part->unk_00;
58 s32 unk_28;
59 f32 temp;
60 s32 i;
61
62 if (part->unk_2C >= 5 && part->unk_2C <= 14 &&
64 {
65 return;
66 }
67
68 part->unk_28--;
69 part->unk_2C++;
70 if (part->unk_2C > 324000) {
71 part->unk_2C = 256;
72 }
73
74 unk_28 = part->unk_28;
75 if (unk_28 < 0) {
76 remove_effect(effect);
77 return;
78 }
79
80 if (part->unk_2C < 10) {
81 part->unk_24 += (255 - part->unk_24) * 0.3;
82 }
83
84 if (unk_28 < 10) {
85 part->unk_24 *= 0.8;
86 }
87
88 part++;
89 for (i = 1; i < effect->numParts; i++, part++) {
90 temp = sin_deg(2.0f * part->unk_18) * 0.2;
91
92 part->unk_14 += -0.05f;
93 part->unk_10 += temp;
94
95 if (unk_00 == 0) {
96 part->unk_10 *= 0.94;
97 part->unk_14 *= sin_deg(part->unk_18) * 0.05 + 0.95;
98 } else {
99 part->unk_14 += -0.05f;
100 part->unk_10 *= 0.92;
101 }
102
103 part->unk_1C += rand_int(50) - 25.0f;
104 part->unk_18 += sin_deg(part->unk_1C) * 10.0f;
105 part->unk_20 += cos_deg(part->unk_1C * 0.5f) * 10.0f;
106 part->unk_04 += part->unk_10;
107 part->unk_08 += part->unk_14;
108 }
109}
#define sin_deg
#define remove_effect
#define rand_int
#define cos_deg
EffectData data
Definition effects.h:2605
struct FallingLeavesFXData * fallingLeaves
Definition effects.h:2508
@ ACTION_STATE_IDLE
Definition enums.h:2426
PlayerStatus gPlayerStatus
Definition 77480.c:39

Referenced by falling_leaves_main().

◆ falling_leaves_appendGfx()

void falling_leaves_appendGfx ( void * effect)

Definition at line 124 of file falling_leaves.c.

124 {
125 FallingLeavesFXData* part = ((EffectInstance*)effect)->data.fallingLeaves;
126 Matrix4f sp18;
127 Matrix4f sp58;
128 Matrix4f sp98;
129 s32 i;
130
131 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
132 gSPDisplayList(gMainGfxPos++, D_09001100_3601E0);
133 gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24);
134
135 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
136 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
137 guMtxCatF(sp58, sp18, sp98);
138
139 part++;
140 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
141 guTranslateF(sp58, part->unk_04, part->unk_08, part->unk_0C);
142 guMtxCatF(sp58, sp98, sp18);
143 guRotateF(sp58, part->unk_18, 0.0f, 0.0f, 1.0f);
144 guMtxCatF(sp58, sp18, sp18);
145 guRotateF(sp58, part->unk_20, 0.0f, 1.0f, 0.0f);
146 guMtxCatF(sp58, sp18, sp18);
148
149 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
150 gSPDisplayList(gMainGfxPos++, D_090011B0_360290);
151 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
152 }
153}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
Gfx D_090011B0_360290[]
Gfx D_09001100_3601E0[]
#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 falling_leaves_render().

◆ falling_leaves_main()

void falling_leaves_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3 )

Definition at line 12 of file falling_leaves.c.

12 {
14 EffectInstance* effect;
16 s32 numParts = 5;
17 s32 i;
18
22 bp.unk_00 = 0;
23 bp.renderUI = NULL;
24 bp.effectID = EFFECT_FALLING_LEAVES;
25
26 effect = create_effect_instance(&bp);
27 effect->numParts = numParts;
28 part = effect->data.fallingLeaves = general_heap_malloc(numParts * sizeof(*part));
29 ASSERT(effect->data.fallingLeaves != NULL);
30
31 part->unk_00 = arg0;
32 part->unk_04 = arg1;
33 part->unk_08 = arg2;
34 part->unk_0C = arg3;
35 part->unk_28 = 100;
36 part->unk_2C = 0;
37 part->unk_24 = 0;
38
39 part++;
40 for (i = 1; i < numParts; i++, part++) {
41 part->unk_04 = rand_int(30) - 15;
42 part->unk_08 = 0;
43 part->unk_0C = rand_int(30) - 15;
44 part->unk_18 = rand_int(360);
45 part->unk_20 = rand_int(360);
46 part->unk_1C = rand_int(100) / 10;
47 part->unk_10 = 0;
48 part->unk_14 = 0;
49 }
50}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void falling_leaves_render(EffectInstance *effect)
void falling_leaves_init(EffectInstance *effect)
void falling_leaves_update(EffectInstance *effect)
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_09001100_3601E0

Gfx D_09001100_3601E0[]
extern

◆ D_090011B0_360290

Gfx D_090011B0_360290[]
extern