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

Go to the source code of this file.

Functions

void stars_spread_init (EffectInstance *effect)
 
void stars_spread_update (EffectInstance *effect)
 
void stars_spread_render (EffectInstance *effect)
 
void stars_spread_appendGfx (void *effect)
 
void stars_spread_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5)
 

Variables

Gfx D_09000440_360E70 []
 
Gfx D_090004F0_360F20 []
 

Function Documentation

◆ stars_spread_init()

void stars_spread_init ( EffectInstance * effect)

Definition at line 63 of file stars_spread.c.

63 {
64}

Referenced by stars_spread_main().

◆ stars_spread_update()

void stars_spread_update ( EffectInstance * effect)

Definition at line 66 of file stars_spread.c.

66 {
67 StarsSpreadFXData* part = effect->data.starsSpread;
68 s32 unk_24;
69 s32 unk_2C;
70 s32 i;
71
72 part->unk_28++;
73 part->unk_24--;
74
75 if (part->unk_24 < 0) {
76 remove_effect(effect);
77 return;
78 }
79
80 unk_24 = part->unk_24;
81 unk_2C = part->unk_2C;
82
83 part++;
84 for (i = 1; i < effect->numParts; i++, part++) {
85 if (unk_24 >= 6) {
86 part->unk_10 *= 0.8;
87 part->unk_14 *= 0.8;
88 part->unk_18 *= 0.8;
89 }
90
91 if (unk_24 < 5) {
92 part->unk_20 *= 0.8;
93 part->unk_10 *= 0.7;
94 part->unk_14 *= 0.7;
95 part->unk_18 *= 0.7;
96 }
97
98 if (unk_24 * 2 < unk_2C) {
99 part->unk_30 += -part->unk_30 * 0.2;
100 }
101
102 part->unk_04 += part->unk_10;
103 part->unk_08 += part->unk_14;
104 part->unk_0C = 0;
105 part->unk_1C += part->unk_20;
106 }
107}
#define remove_effect
struct StarsSpreadFXData * starsSpread
Definition effects.h:2509
EffectData data
Definition effects.h:2605

Referenced by stars_spread_main().

◆ stars_spread_render()

void stars_spread_render ( EffectInstance * effect)

Definition at line 109 of file stars_spread.c.

109 {
110 RenderTask renderTask;
111 RenderTask* retTask;
112
114 renderTask.appendGfxArg = effect;
115 renderTask.dist = 0;
117
118 retTask = queue_render_task(&renderTask);
120}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_PASS_THROUGH
Definition enums.h:3306
void stars_spread_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by stars_spread_main().

◆ stars_spread_appendGfx()

void stars_spread_appendGfx ( void * effect)

Definition at line 122 of file stars_spread.c.

122 {
123 StarsSpreadFXData* part = ((EffectInstance*)effect)->data.starsSpread;
124 Gfx* dlist = D_090004F0_360F20;
125 Matrix4f sp18;
126 Matrix4f sp58;
127 s32 i;
128
129 gDPPipeSync(gMainGfxPos++);
130 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
131 gSPDisplayList(gMainGfxPos++, D_09000440_360E70);
132
133 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
134 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
135 guMtxCatF(sp58, sp18, sp18);
137
138 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
139 gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 220, 40, 230);
140
141 part++;
142 for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
143 guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
144 guRotateF(sp58, part->unk_1C, 0.0f, 0.0f, 1.0f);
145 guMtxCatF(sp58, sp18, sp18);
146 guScaleF(sp58, part->unk_30, part->unk_30, 1.0f);
147 guMtxCatF(sp58, sp18, sp18);
149
150 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
151 gSPDisplayList(gMainGfxPos++, dlist);
152 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
153 }
154
155 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
156}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx D_090004F0_360F20[]
Gfx D_09000440_360E70[]
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 stars_spread_render().

◆ stars_spread_main()

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

Definition at line 12 of file stars_spread.c.

19 {
21 EffectInstance* effect;
23 s32 i;
24
25 arg4++;
26
30 bp.unk_00 = 0;
31 bp.renderUI = NULL;
32 bp.effectID = EFFECT_STARS_SPREAD;
33
34 effect = create_effect_instance(&bp);
35 effect->numParts = arg4;
36 part = effect->data.starsSpread = general_heap_malloc(arg4 * sizeof(*part));
37 ASSERT(effect->data.starsSpread != NULL);
38
39 mem_clear(part, arg4 * sizeof(*part));
40
41 part->unk_24 = arg5;
42 part->unk_28 = 0;
43 part->unk_2C = arg5;
44 part->unk_00 = arg0;
45 part->unk_04 = arg1;
46 part->unk_08 = arg2;
47 part->unk_0C = arg3;
48
49 part++;
50 for (i = 1; i < arg4; i++, part++) {
51 part->unk_04 = 0;
52 part->unk_08 = 0;
53 part->unk_0C = 0;
54 part->unk_10 = sin_deg((i - 1) * 360 / (arg4 - 1)) * 8.0;
55 part->unk_14 = cos_deg((i - 1) * 360 / (arg4 - 1)) * 8.0;
56 part->unk_18 = 0;
57 part->unk_1C = 0;
58 part->unk_20 = 20.0f;
59 part->unk_30 = 1.0f;
60 }
61}
#define general_heap_malloc
#define sin_deg
#define cos_deg
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
void stars_spread_render(EffectInstance *effect)
void stars_spread_init(EffectInstance *effect)
void stars_spread_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

Referenced by fire_flower_update().

Variable Documentation

◆ D_09000440_360E70

Gfx D_09000440_360E70[]
extern

Referenced by stars_spread_appendGfx().

◆ D_090004F0_360F20

Gfx D_090004F0_360F20[]
extern

Referenced by stars_spread_appendGfx().