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

Go to the source code of this file.

Functions

void flashing_box_shockwave_init (EffectInstance *effect)
 
void flashing_box_shockwave_update (EffectInstance *effect)
 
void flashing_box_shockwave_render (EffectInstance *effect)
 
void flashing_box_shockwave_appendGfx (void *effect)
 
EffectInstanceflashing_box_shockwave_main (s32 type, f32 posX, f32 posY, f32 posZ, f32 sizeX, f32 sizeY)
 

Variables

Gfx D_09000600_3936A0 []
 
Gfx D_090008E8_393988 []
 
Gfx D_09000950_3939F0 []
 
Gfx D_09000FF8_394098 []
 

Function Documentation

◆ flashing_box_shockwave_init()

void flashing_box_shockwave_init ( EffectInstance * effect)

Definition at line 83 of file flashing_box_shockwave.c.

83 {
84}

Referenced by flashing_box_shockwave_main().

◆ flashing_box_shockwave_update()

void flashing_box_shockwave_update ( EffectInstance * effect)

Definition at line 86 of file flashing_box_shockwave.c.

86 {
88
89 if (data->timeLeft < 100) {
90 data->timeLeft--;
91 }
92
93 data->lifetime++;
94
95 if (data->timeLeft < 0) {
96 remove_effect(effect);
97 return;
98 }
99
100 if (data->type == FX_SHOCK_OVERLAY_MEGA_SHOCK) {
101 if (data->lifetime < 21) {
102 data->unk_24 *= 1.1;
103 }
104 } else {
105 // interp toward 8.0
106 data->unk_24 += (8.0 - data->unk_24) * 0.05;
107 }
108
109 data->unk_14 *= 0.9;
110
111 if (data->timeLeft < 5) {
112 data->unk_18 *= 0.8;
113 }
114
115 if (data->lifetime >= 7) {
116 data->unk_10 -= 13;
117 if (data->unk_10 < 0) {
118 data->unk_10 = 0;
119 }
120 }
121}
#define remove_effect
@ FX_SHOCK_OVERLAY_MEGA_SHOCK
Definition effects.h:1265
EffectData data
Definition effects.h:2605
struct ShockOverlayFXData * flashingBoxShockwave
Definition effects.h:2538

Referenced by flashing_box_shockwave_main().

◆ flashing_box_shockwave_render()

void flashing_box_shockwave_render ( EffectInstance * effect)

Definition at line 123 of file flashing_box_shockwave.c.

123 {
124 RenderTask renderTask;
125 RenderTask* retTask;
126
128 renderTask.appendGfxArg = effect;
129 renderTask.dist = 10;
131
132 retTask = queue_render_task(&renderTask);
133}
#define queue_render_task
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition enums.h:3299
void flashing_box_shockwave_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by flashing_box_shockwave_main().

◆ flashing_box_shockwave_appendGfx()

void flashing_box_shockwave_appendGfx ( void * effect)

Definition at line 135 of file flashing_box_shockwave.c.

135 {
136 ShockOverlayFXData* data = ((EffectInstance*)effect)->data.flashingBoxShockwave;
137 s32 type = data->type;
138 s32 time = data->lifetime;
139 Matrix4f mtxTransform;
140 Matrix4f mtxUnkScale;
141 Matrix4f mtxCamRot;
142
143 guRotateF(mtxCamRot, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
144
145 gDPPipeSync(gMainGfxPos++);
146 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
147
148 guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z);
149 guMtxCatF(mtxCamRot, mtxTransform, mtxTransform);
151
152 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
153 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primCol.r, data->primCol.g, data->primCol.b, data->unk_18);
154 gDPSetEnvColor(gMainGfxPos++, data->envCol.r, data->envCol.g, data->envCol.b, 0);
155
156 if ((type == FX_SHOCK_OVERLAY_SHOCK_HIT || type == FX_SHOCK_OVERLAY_LIGHTNING_WORLD) && time % 2) {
157 guScaleF(mtxTransform, data->scaleX, data->scaleY, 15.0f / 14);
159
160 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
161 gSPDisplayList(gMainGfxPos++, D_09000600_3936A0);
162 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, time * 8, time * 8, time * 8 + 128, time * 8 + 128);
163 gSPDisplayList(gMainGfxPos++, D_090008E8_393988);
164 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
165 }
166
169 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 0, data->unk_14);
170 }
171
172 guTranslateF(mtxTransform, 0.0f, data->scaleY, 0.0f);
173 guScaleF(mtxUnkScale, data->unk_24 * 0.25, data->unk_24 * 0.25, 1.0f);
174 guMtxCatF(mtxUnkScale, mtxTransform, mtxTransform);
176
177 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
178 gSPDisplayList(gMainGfxPos++, D_09000950_3939F0);
179 gSPDisplayList(gMainGfxPos++, D_09000FF8_394098);
180 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
181 }
182
183 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
184}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
@ FX_SHOCK_OVERLAY_SHOCK_HIT
Definition effects.h:1263
@ FX_SHOCK_OVERLAY_LIGHTNING_WORLD
Definition effects.h:1264
@ FX_SHOCK_OVERLAY_LIGHTNING_BATTLE
Definition effects.h:1266
Gfx D_09000950_3939F0[]
Gfx D_09000600_3936A0[]
Gfx D_090008E8_393988[]
Gfx D_09000FF8_394098[]
#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 flashing_box_shockwave_render().

◆ flashing_box_shockwave_main()

EffectInstance * flashing_box_shockwave_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
f32 sizeX,
f32 sizeY )

Definition at line 14 of file flashing_box_shockwave.c.

21 {
23 EffectInstance* effect;
25 s32 numParts = 1;
26
30 bp.unk_00 = 0;
31 bp.renderUI = NULL;
32 bp.effectID = EFFECT_FLASHING_BOX_SHOCKWAVE;
33
34 effect = create_effect_instance(&bp);
35 effect->numParts = numParts;
36 data = effect->data.flashingBoxShockwave = general_heap_malloc(numParts * sizeof(*data));
37 ASSERT(effect->data.flashingBoxShockwave != NULL);
38
39 data->type = type;
40 data->pos.x = posX;
41 data->pos.y = posY;
42 data->pos.z = posZ;
43
44 data->lifetime = 0;
45 data->timeLeft = 30;
46
47 data->unk_10 = 255;
48 data->unk_14 = 255;
49 data->unk_18 = 255;
50
51 if (type == FX_SHOCK_OVERLAY_MEGA_SHOCK) {
52 data->unk_24 = 1.0f;
53 } else {
54 data->unk_24 = 0.0f;
55 }
56 data->scaleX = sizeX * 0.5;
57 data->scaleY = sizeY * 0.5;
58
59 switch (type) {
63 data->primCol.r = 255;
64 data->primCol.g = 255;
65 data->primCol.b = 0;
66 data->envCol.r = 255;
67 data->envCol.g = 255;
68 data->envCol.b = 255;
69 break;
71 data->primCol.r = 70;
72 data->primCol.g = 180;
73 data->primCol.b = 120;
74 data->envCol.r = 255;
75 data->envCol.g = 255;
76 data->envCol.b = 255;
77 break;
78 }
79
80 return effect;
81}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void flashing_box_shockwave_update(EffectInstance *effect)
void flashing_box_shockwave_init(EffectInstance *effect)
void flashing_box_shockwave_render(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 lightning_main().

Variable Documentation

◆ D_09000600_3936A0

Gfx D_09000600_3936A0[]
extern

◆ D_090008E8_393988

Gfx D_090008E8_393988[]
extern

◆ D_09000950_3939F0

Gfx D_09000950_3939F0[]
extern

◆ D_09000FF8_394098

Gfx D_09000FF8_394098[]
extern