Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
shiny_flare.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
4extern Gfx D_09000240_3D79B0[];
5extern Gfx D_090002E0_3D7A50[];
6
7u8 D_E00DA500[] = {
8 255, 255, 82,
9 255, 255, 82,
10 181, 148, 0,
11 181, 148, 0,
12 255, 255, 214,
13 255, 255, 214,
14 181, 148, 0,
15 181, 148, 0
16};
17
21void shiny_flare_appendGfx(void* effect);
22
23EffectInstance* shiny_flare_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) {
24 EffectBlueprint effectBp;
25 EffectInstance* effect;
26 ShinyFlareFXData* data;
27 s32 numParts = 1;
28
29 effectBp.init = shiny_flare_init;
30 effectBp.update = shiny_flare_update;
32 effectBp.unk_00 = 0;
33 effectBp.renderUI = NULL;
34 effectBp.effectID = EFFECT_SHINY_FLARE;
35 effect = create_effect_instance(&effectBp);
36 effect->numParts = numParts;
37
38 data = effect->data.shinyFlare = general_heap_malloc(numParts * sizeof(*data));
39 ASSERT(data != NULL);
40
41 data->unk_00 = arg0;
42 data->lifeTime = 0;
43 data->timeLeft = 10;
44 data->unk_24 = 255;
45 data->pos.x = arg1;
46 data->pos.y = arg2;
47 data->pos.z = arg3;
48 data->unk_28 = arg4;
49 data->unk_18 = 70;
50 data->unk_1C = 180;
51 data->unk_20 = 120;
52 data->unk_2C = 0;
53
54 return effect;
55}
56
58}
59
61 ShinyFlareFXData *data = effect->data.shinyFlare;
62
63 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
64 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
65 data->timeLeft = 10;
66 }
67 if (data->timeLeft < 1000) {
68 data->timeLeft--;
69 }
70
71 data->lifeTime++;
72 if (data->timeLeft < 0) {
73 remove_effect(effect);
74 return;
75 }
76 if (data->timeLeft < 4) {
77 data->unk_2C *= 0.5;
78 return;
79 }
80
81 data->unk_2C = data->lifeTime * 0.2f + 0.3;
82}
83
85 RenderTask renderTask;
86 RenderTask* retTask;
87
89 renderTask.appendGfxArg = effect;
90 renderTask.dist = 10;
92
93 retTask = queue_render_task(&renderTask);
95}
96
97void func_E00DA228(void) {
98}
99
100void shiny_flare_appendGfx(void* effect) {
101 ShinyFlareFXData* data = ((EffectInstance*)effect)->data.shinyFlare;
102 Camera* camera = &gCameras[gCurrentCameraID];
103 s32 unk_24 = data->unk_24;
104 f32 scale = data->unk_28 * data->unk_2C;
105 s32 idx;
106 Matrix4f sp10;
107 Matrix4f sp50;
108
109 gDPPipeSync(gMainGfxPos++);
110 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
111
112 guTranslateF(sp10, data->pos.x, data->pos.y, data->pos.z);
113 guScaleF(sp50, scale, scale, scale);
114 guMtxCatF(sp50, sp10, sp10);
116
117 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
118 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
119 gSPDisplayList(gMainGfxPos++, D_09000240_3D79B0);
120 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, unk_24);
121
122 idx = data->lifeTime * 3;
123
124 gDPSetPrimColor(gMainGfxPos++, 0, 0,
128 unk_24);
129 gSPDisplayList(gMainGfxPos++, D_090002E0_3D7A50);
130 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
131}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define queue_render_task
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define create_effect_instance
#define guScaleF
struct ShinyFlareFXData * shinyFlare
Definition effects.h:2573
EffectData data
Definition effects.h:2605
#define ASSERT(condition)
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
void shiny_flare_appendGfx(void *effect)
Gfx D_09000240_3D79B0[]
void shiny_flare_update(EffectInstance *effect)
Definition shiny_flare.c:60
Gfx D_090002E0_3D7A50[]
void shiny_flare_render(EffectInstance *effect)
Definition shiny_flare.c:84
void func_E00DA228(void)
Definition shiny_flare.c:97
void shiny_flare_init(EffectInstance *effect)
Definition shiny_flare.c:57
EffectInstance * shiny_flare_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition shiny_flare.c:23
u8 D_E00DA500[]
Definition shiny_flare.c:7
Mtx * mtxBillboard
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
void * appendGfxArg
void(* appendGfx)(void *)
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