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

Go to the source code of this file.

Functions

void ring_blast_init (EffectInstance *effect)
 
void ring_blast_update (EffectInstance *effect)
 
void ring_blast_render (EffectInstance *effect)
 
void ring_blast_appendGfx (void *effect)
 
void ring_blast_main (s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5)
 

Variables

Gfx D_09001040_3583E0 []
 
Gfx D_090010F8_358498 []
 
Gfx * D_E0048A00 [] = { D_090010F8_358498, D_090010F8_358498 }
 
Gfx * D_E0048A08 [] = { D_09001040_3583E0, D_09001040_3583E0 }
 

Function Documentation

◆ ring_blast_init()

void ring_blast_init ( EffectInstance * effect)

Definition at line 52 of file ring_blast.c.

52 {
53}

Referenced by ring_blast_main().

◆ ring_blast_update()

void ring_blast_update ( EffectInstance * effect)

Definition at line 55 of file ring_blast.c.

55 {
56 RingBlastFXData* data = effect->data.ringBlast;
57
58 data->unk_20 = data->lifeTime * 8.0f / data->unk_1C;
59
60 data->lifeTime++;
61 data->timeLeft--;
62
63 if (data->timeLeft < 0) {
64 remove_effect(effect);
65 return;
66 }
67 data->unk_24 += data->unk_28;
68 if (data->unk_00 == 0) {
69 data->unk_10 += 0.1;
70 }
71}
#define remove_effect
struct RingBlastFXData * ringBlast
Definition effects.h:2500
EffectData data
Definition effects.h:2605

Referenced by ring_blast_main().

◆ ring_blast_render()

void ring_blast_render ( EffectInstance * effect)

Definition at line 73 of file ring_blast.c.

73 {
74 RenderTask renderTask;
75 RenderTask* retTask;
76
78 renderTask.appendGfxArg = effect;
79 renderTask.dist = 0;
81
82 retTask = queue_render_task(&renderTask);
84}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_PASS_THROUGH
Definition enums.h:3306
void ring_blast_appendGfx(void *effect)
Definition ring_blast.c:86
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by ring_blast_main().

◆ ring_blast_appendGfx()

void ring_blast_appendGfx ( void * effect)

Definition at line 86 of file ring_blast.c.

86 {
87 RingBlastFXData* data = ((EffectInstance*)effect)->data.ringBlast;
88 s32 unk_00 = data->unk_00;
89 s32 unk_20_s32 = data->unk_20;
90 s32 envAlpha = (data->unk_20 - unk_20_s32) * 256.0f;
91 s32 cond = (unk_20_s32 == 7);
92 Gfx* dlist = D_E0048A00[unk_00];
93 Gfx* dlist2 = D_E0048A08[unk_00];
94 Matrix4f sp20;
95 Matrix4f sp60;
96
97 gDPPipeSync(gMainGfxPos++);
98 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
99 gSPDisplayList(gMainGfxPos++, dlist2);
100
101 guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z);
102 guRotateF(sp60, data->unk_24, 0.0f, 0.0f, 1.0f);
103 guMtxCatF(sp60, sp20, sp20);
105
106 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
107
108 if (unk_00 == 0) {
109 f32 var_f4 = 1.0f;
110
111 if (data->unk_20 > 5.0f) {
112 var_f4 = 1.0f - (data->unk_20 - 5.0f);
113 if (var_f4 < 0.0f) {
114 var_f4 = 0.0f;
115 }
116 }
117
118 gDPSetPrimColor(gMainGfxPos++, 0, 0, var_f4 * 255.0f, var_f4 * 18.0f, var_f4 * 59.0f, 0);
119 gDPSetEnvColor(gMainGfxPos++, var_f4 * 255.0f, var_f4 * 53.0f, var_f4 * 24.0f, envAlpha);
120 gDPSetKeyR(gMainGfxPos++, var_f4 * 211.0f, 0, 0);
121 gDPSetKeyGB(gMainGfxPos++, var_f4 * 255.0f, 0, 0, var_f4 * 216.0f, 0, 0);
122 gDPSetCombineMode(gMainGfxPos++, PM_CC_4A, PM_CC_4B);
123 } else {
124 gDPSetCombineMode(gMainGfxPos++, PM_CC_4A, PM_CC_4C);
125 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 40, 127);
126 gDPSetEnvColor(gMainGfxPos++, 255, 255, 139, envAlpha);
127 }
128
129 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE,
130 (unk_20_s32 * 32 ) * 4, 0,
131 (unk_20_s32 * 32 + 32) * 4, 32 * 4);
132
133 if (cond) {
134 gDPSetTileSize(gMainGfxPos++, 1,
135 (unk_20_s32 * 32 + 32) * 4, 32 * 4,
136 (unk_20_s32 * 32 + 64) * 4, 64 * 4);
137 } else {
138 gDPSetTileSize(gMainGfxPos++, 1,
139 (unk_20_s32 * 32 + 32) * 4, 0,
140 (unk_20_s32 * 32 + 64) * 4, 32 * 4);
141 }
142
143 gSPDisplayList(gMainGfxPos++, dlist);
144 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
145}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guMtxCatF
#define guPositionF
Gfx * D_E0048A08[]
Definition ring_blast.c:8
Gfx * D_E0048A00[]
Definition ring_blast.c:7
#define PM_CC_4A
Definition macros.h:480
#define PM_CC_4B
Definition macros.h:481
#define PM_CC_4C
Definition macros.h:482
#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 ring_blast_render().

◆ ring_blast_main()

void ring_blast_main ( s32 arg0,
f32 posX,
f32 posY,
f32 posZ,
f32 arg4,
s32 arg5 )

Definition at line 15 of file ring_blast.c.

15 {
16 EffectBlueprint effectBp;
17 EffectInstance* effect;
18 RingBlastFXData* data;
19 s32 numParts = 1;
20
21 effectBp.init = ring_blast_init;
22 effectBp.update = ring_blast_update;
24 effectBp.unk_00 = 0;
25 effectBp.renderUI = NULL;
26 effectBp.effectID = EFFECT_RING_BLAST;
27
28 effect = create_effect_instance(&effectBp);
29 effect->numParts = numParts;
30 data = effect->data.ringBlast = general_heap_malloc(numParts * sizeof(*data));
31
32 ASSERT(data != NULL);
33 mem_clear(data, numParts * sizeof(*data));
34
35 data->timeLeft = arg5;
36 data->lifeTime = 0;
37 data->unk_1C = arg5;
38 data->unk_20 = 0;
39 data->unk_00 = arg0;
40 data->pos.x = posX;
41 data->pos.y = posY;
42 data->pos.z = posZ;
43 data->unk_10 = arg4;
44 data->unk_24 = 0;
45 if (arg0 == 0) {
46 data->unk_28 = 0;
47 return;
48 }
49 data->unk_28 = 40;
50}
#define general_heap_malloc
#define create_effect_instance
#define mem_clear
#define ASSERT(condition)
void ring_blast_init(EffectInstance *effect)
Definition ring_blast.c:52
void ring_blast_render(EffectInstance *effect)
Definition ring_blast.c:73
void ring_blast_update(EffectInstance *effect)
Definition ring_blast.c:55
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 spirit_card_main().

Variable Documentation

◆ D_09001040_3583E0

Gfx D_09001040_3583E0[]
extern

◆ D_090010F8_358498

Gfx D_090010F8_358498[]
extern

◆ D_E0048A00

Gfx* D_E0048A00[] = { D_090010F8_358498, D_090010F8_358498 }

Definition at line 7 of file ring_blast.c.

Gfx D_090010F8_358498[]

Referenced by ring_blast_appendGfx().

◆ D_E0048A08

Gfx* D_E0048A08[] = { D_09001040_3583E0, D_09001040_3583E0 }

Definition at line 8 of file ring_blast.c.

Gfx D_09001040_3583E0[]

Referenced by ring_blast_appendGfx().