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

Go to the source code of this file.

Functions

void floating_flower_init (EffectInstance *effect)
 
void floating_flower_update (EffectInstance *effect)
 
void floating_flower_render (EffectInstance *effect)
 
void floating_flower_appendGfx (void *effect)
 
void floating_flower_main (s32 type, f32 posX, f32 posY, f32 posZ, s32 duration)
 

Variables

s32 D_E001A610 = 0
 
Gfx D_090002F0_330750 []
 

Function Documentation

◆ floating_flower_init()

void floating_flower_init ( EffectInstance * effect)

Definition at line 75 of file floating_flower.c.

75 {
76}

Referenced by floating_flower_main().

◆ floating_flower_update()

void floating_flower_update ( EffectInstance * effect)

Definition at line 78 of file floating_flower.c.

78 {
80 s32 type = data->type;
81
82 if (data->timeLeft < 150) {
83 data->vel.x -= 0.001;
84 data->pos.x += data->vel.x;
85 data->pos.z += data->vel.z;
86 data->rot.x += data->angularVel.x;
87 if (type == 0) {
88 if (data->rot.x < 10.0f) {
89 data->rot.x = 10.0f;
90 data->angularVel.x = -data->angularVel.x;
91 }
92 if (data->rot.x > 45.0f) {
93 data->rot.x = 45.0f;
94 data->angularVel.x = -data->angularVel.x;
95 }
96 }
97 data->rot.y += data->angularVel.y;
98 if (type == 0) {
99 data->vel.y = 1.4f;
100 } else {
101 data->vel.y = 1.0f;
102 }
103 } else {
104 data->jerkY += 0.0007;
105 data->accelY += data->jerkY;
106 data->vel.y += data->accelY;
107 if (data->vel.y > 1.0f) {
108 data->vel.y = 1.0f;
109 }
110 }
111
112 if (type == 1) {
113 data->unk_40 += data->unk_3C;
114 if (data->unk_40 >= 20) {
115 data->unk_40 = 20;
116 data->unk_3C = -1;
117 } else if (data->unk_40 <= 0) {
118 data->unk_40 = 0;
119 data->unk_3C = type;
120 }
121 }
122 data->pos.y += data->vel.y;
123 data->timeLeft--;
124 data->lifetime++;
125 if (data->timeLeft < 0) {
126 remove_effect(effect);
127 }
128}
#define remove_effect
struct FloatingFlowerFXData * floatingFlower
Definition effects.h:2477
EffectData data
Definition effects.h:2605

Referenced by floating_flower_main().

◆ floating_flower_render()

void floating_flower_render ( EffectInstance * effect)

Definition at line 130 of file floating_flower.c.

130 {
131 RenderTask renderTask;
132 RenderTask* retTask;
133
135 renderTask.appendGfxArg = effect;
136 renderTask.dist = 0;
138
139 retTask = queue_render_task(&renderTask);
141}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void floating_flower_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by floating_flower_main().

◆ floating_flower_appendGfx()

void floating_flower_appendGfx ( void * effect)

Definition at line 143 of file floating_flower.c.

143 {
144 Matrix4f mtxTransform, mtxUnused;
145 EffectInstance* effectTemp = effect;
146 FloatingFlowerFXData* part = effectTemp->data.floatingFlower;
147 u32 alpha;
148 u8 rgb, a;
149
150 gDPPipeSync(gMainGfxPos++);
151 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data));
152
153 guPositionF(mtxTransform, part->rot.x, part->rot.y, 0.0f, 1.0f, part->pos.x, part->pos.y, part->pos.z);
155
156 a = alpha = 255;
157
158 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
159
162 alpha -= a;
163 }
164
165 if (alpha != 0) {
166 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, alpha);
167 gSPDisplayList(gMainGfxPos++, D_090002F0_330750);
168 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
169 }
170}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
Color_RGB8 rgb
Definition demo_api.c:16
#define guMtxF2L
#define guPositionF
#define mdl_get_shroud_tint_params
struct EffectGraphics * graphics
Definition effects.h:2606
@ ENV_TINT_SHROUD
Definition enums.h:4387
Gfx D_090002F0_330750[]
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
u8 * gBackgroundTintModePtr
Definition model.c:105
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by floating_flower_render().

◆ floating_flower_main()

void floating_flower_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
s32 duration )

Definition at line 13 of file floating_flower.c.

13 {
15 EffectInstance* effect;
17 s32 numParts = 1;
18 f32 phi_f6;
19
20 bp.unk_00 = 0;
24 bp.renderUI = NULL;
25 bp.effectID = EFFECT_FLOATING_FLOWER;
26
27 effect = create_effect_instance(&bp);
28 effect->numParts = 1;
29 part = effect->data.floatingFlower = general_heap_malloc(numParts * sizeof(*part));
30
31 ASSERT(effect->data.floatingFlower != NULL);
32
33 part->type = type;
34 part->pos.x = posX;
35 part->pos.y = posY + 10.0f;
36 part->pos.z = posZ;
37 part->vel.x = 0.0f;
38 part->vel.y = 0.0f;
39 part->vel.z = 0.0f;
40
41 if (type == 0) {
42 part->vel.z = 0;
43 part->rot.x = 0.0f;
44 part->rot.y = 0.0f;
45 part->accelY = 0.12f;
46 part->jerkY = -0.0152f;
47 part->angularVel.x = 3.0f;
48 if (D_E001A610 != 0) {
49 phi_f6 = -10.0f;
50 } else {
51 phi_f6 = 10.0f;
52 }
53 part->angularVel.y = phi_f6;
54 part->timeLeft = duration;
55 } else {
56 part->accelY = 0.12f;
57 part->jerkY = -0.0152f;
58 part->rot.x = (rand_int(1) * 30) - 15;
59 part->rot.y = rand_int(360);
60 part->angularVel.x = 0;
61 part->angularVel.y = (rand_int(1) * 8) - 4;
62 part->timeLeft = duration;
63 part->lifetime = 0;
64 part->unk_44 = rand_int(10);
65 part->unk_40 = rand_int(20);
66 part->unk_3C = (rand_int(1) * 2) - 1;
67 }
68
69 D_E001A610++;
70 if (D_E001A610 > 1) {
71 D_E001A610 = 0;
72 }
73}
#define general_heap_malloc
#define rand_int
#define create_effect_instance
#define ASSERT(condition)
void floating_flower_update(EffectInstance *effect)
void floating_flower_init(EffectInstance *effect)
void floating_flower_render(EffectInstance *effect)
s32 D_E001A610
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_E001A610

s32 D_E001A610 = 0

Definition at line 4 of file floating_flower.c.

Referenced by floating_flower_main().

◆ D_090002F0_330750

Gfx D_090002F0_330750[]
extern