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

Go to the source code of this file.

Functions

void fright_jar_init (EffectInstance *effect)
 
void fright_jar_update (EffectInstance *effect)
 
void fright_jar_render (EffectInstance *effect)
 
void fright_jar_appendGfx (void *effect)
 
EffectInstancefright_jar_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
 
void func_E00C2214 (void)
 

Variables

s32 D_09000000_3C1BA0
 
s32 D_09002020_3C3BC0
 
Vtx D_09004040_3C5BE0 [][22]
 
Gfx D_09008BE0_3CA780 []
 
u8 D_E00C2990 []
 

Function Documentation

◆ fright_jar_init()

void fright_jar_init ( EffectInstance * effect)

Definition at line 63 of file fright_jar.c.

63 {
64}

Referenced by fright_jar_main().

◆ fright_jar_update()

void fright_jar_update ( EffectInstance * effect)

Definition at line 66 of file fright_jar.c.

66 {
67 FrightJarFXData* data = effect->data.frightJar;
68 s32 unk_10;
69
70 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
71 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
72 data->unk_10 = 16;
73 }
74
75 if (data->unk_10 < 1000) {
76 data->unk_10--;
77 }
78
79 data->unk_14++;
80
81 if (data->unk_10 < 0) {
82 remove_effect(effect);
83 return;
84 }
85
86 unk_10 = data->unk_10;
87
88 if (data->unk_14 < 16) {
89 data->unk_24 = data->unk_14 * 16 + 15;
90 } else {
91 data->unk_24 = 255;
92 }
93
94 if (unk_10 < 16) {
95 data->unk_24 = unk_10 * 16;
96 }
97}
#define remove_effect
struct FrightJarFXData * frightJar
Definition effects.h:2561
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by fright_jar_main().

◆ fright_jar_render()

void fright_jar_render ( EffectInstance * effect)

Definition at line 99 of file fright_jar.c.

99 {
100 RenderTask renderTask;
101 RenderTask* retTask;
102
103 renderTask.appendGfx = fright_jar_appendGfx;
104 renderTask.appendGfxArg = effect;
105 renderTask.dist = 10;
107
108 retTask = queue_render_task(&renderTask);
110}
#define queue_render_task
void fright_jar_appendGfx(void *effect)
Definition fright_jar.c:115
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by fright_jar_main().

◆ fright_jar_appendGfx()

void fright_jar_appendGfx ( void * effect)

Definition at line 115 of file fright_jar.c.

115 {
116 FrightJarFXData* data = ((EffectInstance*)effect)->data.frightJar;
117 Camera* camera = &gCameras[gCurrentCameraID];
118 s32 unk_14 = data->unk_14;
119 s32 unk_24 = data->unk_24;
120 u32 alpha;
121 s32 idx;
122 Matrix4f sp10;
123 Matrix4f sp50;
124 s32 i;
125
126 gDPPipeSync(gMainGfxPos++);
127 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
128
129 guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C);
130 guScaleF(sp50, -data->unk_28, data->unk_28, data->unk_28);
131 guMtxCatF(sp50, sp10, sp10);
133
134 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
135 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
136 gSPDisplayList(gMainGfxPos++, D_09008BE0_3CA780);
137
138 idx = 54 - unk_14;
139 if (idx < 0) {
140 idx = 0;
141 }
142
143 gSPVertex(gMainGfxPos++, &D_09004040_3C5BE0[idx], 22, 0);
144
145 alpha = D_E00C2990[unk_14 % 16];
146 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, alpha);
147
148 for (i = 0; i < 10; i++) {
149 s32 temp1;
150 f32 temp2;
151 f32 temp3;
152
153 if (i < 5) {
154 temp1 = i * 12;
155 } else {
156 temp1 = i * 12 + 4;
157 }
158
159 temp2 = i * 0.1f;
160 temp3 = unk_24 * (1.0f - temp2) * 2.0f;
161
162 if (temp3 > 255.0f) {
163 temp3 = 255.0f;
164 }
165
166 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, temp3);
167 gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 64, &D_09002020_3C3BC0);
168 gDPSetTile(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 8, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14);
169 gDPLoadSync(gMainGfxPos++);
170 gDPLoadTile(gMainGfxPos++, G_TX_LOADTILE, 0, temp1 * 4, 254, (temp1 + 15) * 4);
171 gDPPipeSync(gMainGfxPos++);
172 gDPSetTile(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 8, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14);
173 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, temp1 * 4, 508, (temp1 + 15) * 4);
174 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, temp2 * 128.0f * 4.0f, 2000, 2000);
175 gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 64, &D_09000000_3C1BA0);
176 gDPSetTile(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 8, 0x80, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14);
177 gDPLoadSync(gMainGfxPos++);
178 gDPLoadTile(gMainGfxPos++, G_TX_LOADTILE, 0, temp1 * 4, 254, (temp1 + 15) * 4);
179 gDPPipeSync(gMainGfxPos++);
180 gDPSetTile(gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 8, 0x80, 1, 1, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14, G_TX_NOMIRROR | G_TX_CLAMP, 7, 14);
181 gDPSetTileSize(gMainGfxPos++, 1, 0, temp1 * 4, 508, (temp1 + 15) * 4);
182 gDPSetTileSize(gMainGfxPos++, 1, 0, temp2 * 128.0f * 4.0f, 2000, 2000);
183
184 switch (i) {
185 case 0:
186 gSP2Triangles(gMainGfxPos++, 0, 1, 2, 0, 0, 2, 3, 0);
187 break;
188 case 1:
189 gSP2Triangles(gMainGfxPos++, 1, 4, 5, 0, 1, 5, 2, 0);
190 break;
191 case 2:
192 gSP2Triangles(gMainGfxPos++, 4, 6, 7, 0, 4, 7, 5, 0);
193 break;
194 case 3:
195 gSP2Triangles(gMainGfxPos++, 6, 8, 9, 0, 6, 9, 7, 0);
196 break;
197 case 4:
198 gSP2Triangles(gMainGfxPos++, 8, 10, 11, 0, 8, 11, 9, 0);
199 break;
200 case 5:
201 gSP2Triangles(gMainGfxPos++, 10, 12, 13, 0, 10, 13, 11, 0);
202 break;
203 case 6:
204 gSP2Triangles(gMainGfxPos++, 12, 14, 15, 0, 12, 15, 13, 0);
205 break;
206 case 7:
207 gSP2Triangles(gMainGfxPos++, 14, 16, 17, 0, 14, 17, 15, 0);
208 break;
209 case 8:
210 gSP2Triangles(gMainGfxPos++, 16, 18, 19, 0, 16, 19, 17, 0);
211 break;
212 case 9:
213 gSP2Triangles(gMainGfxPos++, 18, 20, 21, 0, 18, 21, 19, 0);
214 break;
215 }
216
217 gDPPipeSync(gMainGfxPos++);
218 }
219
220 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
221}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
s8 unk_14
Definition demo_api.c:19
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
s32 D_09000000_3C1BA0
Vtx D_09004040_3C5BE0[][22]
s32 D_09002020_3C3BC0
Gfx D_09008BE0_3CA780[]
u8 D_E00C2990[]
Definition fright_jar.c:9
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Mtx * mtxBillboard
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 fright_jar_render().

◆ fright_jar_main()

EffectInstance * fright_jar_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
s32 arg5 )

Definition at line 19 of file fright_jar.c.

26 {
28 EffectInstance* effect;
29 FrightJarFXData* data;
30 s32 numParts = 1;
31
35 bp.unk_00 = 0;
36 bp.renderUI = NULL;
37 bp.effectID = EFFECT_FRIGHT_JAR;
38
39 effect = create_effect_instance(&bp);
40 effect->numParts = numParts;
41 data = effect->data.frightJar = general_heap_malloc(numParts * sizeof(*data));
42 ASSERT(effect->data.frightJar != NULL);
43
44 data->unk_00 = arg0;
45 data->unk_14 = 0;
46 if (arg5 <= 0) {
47 data->unk_10 = 1000;
48 } else {
49 data->unk_10 = arg5;
50 }
51 data->unk_24 = 0;
52 data->unk_04 = arg1;
53 data->unk_08 = arg2;
54 data->unk_0C = arg3;
55 data->unk_18 = 70;
56 data->unk_1C = 180;
57 data->unk_20 = 120;
58 data->unk_28 = arg4 * 0.1;
59
60 return effect;
61}
#define general_heap_malloc
#define create_effect_instance
void fright_jar_init(EffectInstance *effect)
Definition fright_jar.c:63
void fright_jar_update(EffectInstance *effect)
Definition fright_jar.c:66
void fright_jar_render(EffectInstance *effect)
Definition fright_jar.c:99
#define ASSERT(condition)
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

◆ func_E00C2214()

void func_E00C2214 ( void )

Definition at line 112 of file fright_jar.c.

112 {
113}

Variable Documentation

◆ D_09000000_3C1BA0

s32 D_09000000_3C1BA0
extern

Referenced by fright_jar_appendGfx().

◆ D_09002020_3C3BC0

s32 D_09002020_3C3BC0
extern

Referenced by fright_jar_appendGfx().

◆ D_09004040_3C5BE0

Vtx D_09004040_3C5BE0[][22]
extern

Referenced by fright_jar_appendGfx().

◆ D_09008BE0_3CA780

Gfx D_09008BE0_3CA780[]
extern

Referenced by fright_jar_appendGfx().

◆ D_E00C2990

u8 D_E00C2990[]
Initial value:
= {
0xFF, 0xFF, 0xDC, 0xBE, 0xA0, 0x78, 0x50, 0x28,
0x00, 0x00, 0x28, 0x50, 0x78, 0xA0, 0xBE, 0xDC
}

Definition at line 9 of file fright_jar.c.

9 {
10 0xFF, 0xFF, 0xDC, 0xBE, 0xA0, 0x78, 0x50, 0x28,
11 0x00, 0x00, 0x28, 0x50, 0x78, 0xA0, 0xBE, 0xDC
12};

Referenced by fright_jar_appendGfx().