Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hieroglyphs.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
4extern Gfx D_09001000_3DDD50[];
5extern Vtx_t D_090010A8_3DDDF8[];
6
8
9u8 D_E00E29F4[] = {
10 120, 130, 140, 150, 160, 170, 180, 190, 200, 200,
11 190, 180, 170, 160, 150, 140, 130
12};
13
14u8 D_E00E2A08[] = {
15 170, 160, 150, 140, 130, 120, 130, 140, 150, 160,
16 170, 180, 190, 200, 200, 190, 180
17};
18
19u8 D_E00E2A1C[] = {
20 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
21 255, 255, 255, 255, 255, 255, 255
22};
23
27void hieroglyphs_appendGfx(void* effect);
28
29EffectInstance* hieroglyphs_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 timeLeft) {
30 EffectBlueprint effectBp;
31 EffectInstance* effect;
33 s32 numParts = 1;
34
35 effectBp.init = hieroglyphs_init;
36 effectBp.update = hieroglyphs_update;
38 effectBp.unk_00 = 0;
39 effectBp.renderUI = NULL;
40 effectBp.effectID = EFFECT_HIEROGLYPHS;
41
42 effect = create_effect_instance(&effectBp);
43 effect->numParts = numParts;
44
45 data = effect->data.hieroglyphs = general_heap_malloc(numParts * sizeof(*data));
46 ASSERT(data != NULL);
47
48 data->unk_00 = arg0;
49 data->lifeTime = 0;
50 if (timeLeft <= 0) {
51 data->timeLeft = 1000;
52 } else {
53 data->timeLeft = timeLeft;
54 }
55 data->unk_24 = 0;
56 data->pos.x = posX;
57 data->pos.y = posY;
58 data->pos.z = posZ;
59 data->unk_38 = arg4;
60 data->unk_18 = 70;
61 data->unk_1C = 180;
62 data->unk_20 = 120;
63 data->unk_28 = 20;
64 data->unk_2C = 230;
65 data->unk_30 = 50;
66 data->unk_34 = 255;
67
68 return effect;
69}
70
72}
73
75 HieroglyphsFXData* data = effect->data.hieroglyphs;
76 s32 temp_a2;
77
78 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
79 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
80 data->timeLeft = 16;
81 }
82
83 if (data->timeLeft < 1000) {
84 data->timeLeft--;
85 }
86 temp_a2 = ++data->lifeTime;
87 if (data->timeLeft < 0) {
88 remove_effect(effect);
89 return;
90 }
91 if (data->timeLeft < 16) {
92 data->unk_24 = data->timeLeft * 16;
93 }
94 if (temp_a2 < 16) {
95 data->unk_24 = (temp_a2 * 16) + 15;
96 }
97}
98
100 RenderTask renderTask;
101 RenderTask* retTask;
102
103 renderTask.appendGfx = hieroglyphs_appendGfx;
104 renderTask.appendGfxArg = effect;
105 renderTask.dist = 10;
107
108 retTask = queue_render_task(&renderTask);
110}
111
112void func_E00E2210(void) {
113}
114
115void hieroglyphs_appendGfx(void* effect) {
116 HieroglyphsFXData* data = ((EffectInstance*)effect)->data.hieroglyphs;
117 Camera* camera = &gCameras[gCurrentCameraID];
118 s32 lifeTime = data->lifeTime;
119 s32 unk_24 = data->unk_24;
120 Gfx* savedGfxPos;
121 Matrix4f sp20;
122 Matrix4f sp60;
123 s32 i;
124
125 gDPPipeSync(gMainGfxPos++);
126 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
127
128 guTranslateF(sp20, data->pos.x, data->pos.y, data->pos.z);
129 guScaleF(sp60, data->unk_38, data->unk_38, data->unk_38);
130 guMtxCatF(sp60, sp20, sp20);
132
133 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
134 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
135 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, unk_24);
136 gDPSetEnvColor(gMainGfxPos++, data->unk_28, data->unk_2C, data->unk_30, data->unk_34);
137 gSPDisplayList(gMainGfxPos++, D_E00E29F0[0]);
138 gSPBranchList(gMainGfxPos, gMainGfxPos + 52);
139
140 savedGfxPos = gMainGfxPos + 1;
141
142 gDPSetTileSize(savedGfxPos, G_TX_RENDERTILE,
143 (lifeTime * 2 ) * 4, 0,
144 (lifeTime * 2 + 127) * 4, 31 * 4);
145 gMainGfxPos += 2;
146
147 guRotateF(sp20, 20.0f, 1.0f, 0.0f, 0.0f);
148 guPositionF(sp60, 0.0f, sin_deg(lifeTime * 8 + 78.75) * -30.0f, 0.0f, 1.0f, 6.0f, 0.0f, 0.0f);
149 guMtxCatF(sp60, sp20, sp20);
151
152 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
153
154 for (i = 0; i < 16; i++) {
155 f32 angle = i * 48 + lifeTime * 8;
156
157 guPositionF(sp20, 0.0f, sin_deg(angle) * 30.0f, 6.0f, (f32) i * 0.01 + 1.0, 8.0f, 0.0f, 0.0f);
159
160 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
161 gSPVertex(gMainGfxPos++, &D_090010A8_3DDDF8[i * 2], 2, i * 2);
162 }
163
164 for (i = 0; i < 15; i++) {
165 s32 i2 = i * 2;
166 gSP2Triangles(gMainGfxPos++,
167 i2 , i2 + 2, i2 + 1, i2,
168 i2 + 1, i2 + 2, i2 + 3, i2);
169 }
170
171 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
172 gSPEndDisplayList(gMainGfxPos++);
173
174 for (i = 0; i < 2; i++) {
175 s32 idx = (lifeTime + i * 4) % 17;
176
177 guPositionF(sp20, 0.0f, 0.0f, -0x11A + i * 0x24, 1.0f, 0.0f, 0.0f, 0.0f);
179
180 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
181 gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E00E29F4[idx], D_E00E2A08[idx], D_E00E2A1C[idx], data->unk_24);
182 gDPSetEnvColor(gMainGfxPos++, 255, 255, 255, 0);
183 gSPDisplayList(gMainGfxPos++, savedGfxPos);
184 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
185 }
186
187 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
188}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define guPositionF
#define create_effect_instance
#define guScaleF
struct HieroglyphsFXData * hieroglyphs
Definition effects.h:2577
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
u8 D_E00E29F4[]
Definition hieroglyphs.c:9
void hieroglyphs_update(EffectInstance *effect)
Definition hieroglyphs.c:74
void hieroglyphs_render(EffectInstance *effect)
Definition hieroglyphs.c:99
void hieroglyphs_init(EffectInstance *effect)
Definition hieroglyphs.c:71
void hieroglyphs_appendGfx(void *effect)
u8 D_E00E2A1C[]
Definition hieroglyphs.c:19
Gfx D_09001000_3DDD50[]
u8 D_E00E2A08[]
Definition hieroglyphs.c:14
Vtx_t D_090010A8_3DDDF8[]
Gfx * D_E00E29F0[]
Definition hieroglyphs.c:7
EffectInstance * hieroglyphs_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 timeLeft)
Definition hieroglyphs.c:29
void func_E00E2210(void)
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
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