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

Go to the source code of this file.

Data Structures

struct  UnkStruct
 

Functions

void stop_watch_init (EffectInstance *effect)
 
void stop_watch_update (EffectInstance *effect)
 
void stop_watch_render (EffectInstance *effect)
 
void stop_watch_appendGfx (void *effect)
 
EffectInstancestop_watch_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
 
void func_E00C4300 (void)
 

Variables

Gfx D_09001000_3CC890 []
 
u8 D_E00C49D0 [] = { 120, 80, 40, 60 }
 
u8 D_E00C49D4 []
 
u8 D_E00C49E8 []
 
u8 D_E00C49FC []
 
UnkStruct D_E00C4A10 []
 

Data Structure Documentation

◆ UnkStruct

struct UnkStruct
Data Fields
Gfx * displayList
s16 x
s16 y
s16 width
s16 height
s32 unk_00
s32 unk_04
f32 unk_08
f32 unk_0C
s32 unk_10
s32 unk_14
u8 unk_00
u8 unk_01
u8 unk_02
u8 unk_03
Gfx * unk_04
Gfx * unk_08
s32 unk_08
s8 unk_00
s8 unk_01
s16 unk_02
s16 unk_04
s16 unk_06
u8 sizeScale
char unk_09[1]

Function Documentation

◆ stop_watch_init()

void stop_watch_init ( EffectInstance * effect)

Definition at line 105 of file stop_watch.c.

105 {
106}

Referenced by stop_watch_main().

◆ stop_watch_update()

void stop_watch_update ( EffectInstance * effect)

Definition at line 108 of file stop_watch.c.

108 {
109 StopWatchFXData* data = effect->data.stopWatch;
110 s32 unk_10;
111 s32 unk_14;
112 s32 i;
113
114 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
115 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
116 data->unk_10 = 64;
117 }
118
119 if (data->unk_10 < 1000) {
120 data->unk_10--;
121 }
122
123 data->unk_14++;
124
125 if (data->unk_10 < 0) {
126 remove_effect(effect);
127 return;
128 }
129
130 unk_10 = data->unk_10;
131 unk_14 = data->unk_14;
132
133 if (unk_10 < 64) {
134 data->unk_30 -= 0.05;
135 if (data->unk_30 < 0.0f) {
136 data->unk_30 = 0.0f;
137 }
138 }
139
140 if (unk_10 < 32) {
141 data->unk_2C += 128;
142 if (data->unk_2C > 255) {
143 data->unk_2C = 255;
144 }
145 data->unk_30 = 0.0f;
146 }
147
148 if (unk_10 < 16) {
149 data->unk_24 = unk_10 * 16;
150 }
151 if (unk_14 < 16) {
152 data->unk_24 = unk_14 * 16 + 15;
153 }
154
155 for (i = 0; i < 10; i++) {
156 if (data->unk_14C[i] == 0 || --data->unk_14C[i] == 0) {
157 data->unk_124[i] += 8;
158 if (data->unk_124[i] > 255) {
159 data->unk_124[i] = 255;
160 }
161 }
162 }
163}
s8 unk_14
Definition demo_api.c:19
#define remove_effect
struct StopWatchFXData * stopWatch
Definition effects.h:2562
s32 unk_14C[10]
Definition effects.h:1704
s32 unk_124[10]
Definition effects.h:1703
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by stop_watch_main().

◆ stop_watch_render()

void stop_watch_render ( EffectInstance * effect)

Definition at line 165 of file stop_watch.c.

165 {
166 RenderTask renderTask;
167 RenderTask* retTask;
168
169 renderTask.appendGfx = stop_watch_appendGfx;
170 renderTask.appendGfxArg = effect;
171 renderTask.dist = 10;
173
174 retTask = queue_render_task(&renderTask);
175}
#define queue_render_task
void stop_watch_appendGfx(void *effect)
Definition stop_watch.c:180
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by stop_watch_main().

◆ stop_watch_appendGfx()

void stop_watch_appendGfx ( void * effect)

Definition at line 180 of file stop_watch.c.

180 {
181 StopWatchFXData* data = ((EffectInstance*)effect)->data.stopWatch;
182 Camera* camera = &gCameras[gCurrentCameraID];
183 s32 unk_14 = data->unk_14;
184 s32 unk_24 = data->unk_24;
185 Vtx_t* vtxBuffer;
186 Gfx* savedGfxPos;
187 Matrix4f sp20;
188 Matrix4f sp60;
189 s32 i;
190
191 gDPPipeSync(gMainGfxPos++);
192 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
193
194 guTranslateF(sp20, data->unk_04, data->unk_08, data->unk_0C);
195 guScaleF(sp60, data->unk_28, data->unk_28, data->unk_28);
196 guMtxCatF(sp60, sp20, sp20);
198
199 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
200 gSPMatrix(gMainGfxPos++, camera->mtxBillboard, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
201 gSPDisplayList(gMainGfxPos++, D_09001000_3CC890);
202 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, data->unk_2C);
203 gSPBranchList(gMainGfxPos, &gMainGfxPos[65]);
204
205 vtxBuffer = (Vtx_t*) (gMainGfxPos + 1);
207
208 for (i = 0; i < 16; i++) {
209 Vtx_t* vtx = &vtxBuffer[i * 2];
210 f32 unk_30 = data->unk_30;
211 s32 temp_s1 = sin_deg(unk_14 * 10 + i * 60) * 500.0f * unk_30;
212 s32 temp_f0 = sin_deg(unk_14 * 10 + i * 6) * 200.0f * unk_30;
213
214 vtx->ob[0] = temp_s1 - 3200;
215 vtx->ob[1] = i * 400 + temp_f0 - 3000;
216 vtx->ob[2] = 0;
217 vtx->tc[0] = 0;
218 vtx->tc[1] = i * 128;
219
220 vtx++;
221
222 vtx->ob[0] = temp_s1 + 3200;
223 vtx->ob[1] = i * 400 + temp_f0 - 3000;
224 vtx->ob[2] = 0;
225 vtx->tc[0] = 2048;
226 vtx->tc[1] = i * 128;
227 }
228
229 gSPBranchList(gMainGfxPos, &gMainGfxPos[20]);
230
231 gMainGfxPos++;
232 savedGfxPos = gMainGfxPos;
233
234 guScaleF(sp20, 0.01f, 0.01f, 0.01f);
236
237 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
238 gSPVertex(gMainGfxPos++, vtxBuffer, 32, 0);
239
240 for (i = 0; i < 15; i++) {
241 s32 i2 = i * 2;
242 gSP2Triangles(gMainGfxPos++,
243 i2 , i2 + 2, i2 + 1, i2,
244 i2 + 1, i2 + 2, i2 + 3, i2);
245 }
246
247 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
248 gSPEndDisplayList(gMainGfxPos++);
249
250 for (i = 0; i < 10; i++) {
251 guPositionF(sp20, data->unk_AC[i], data->unk_D4[i], data->unk_FC[i], D_E00C49D0[i % 4] * 0.01, data->unk_34[i], data->unk_5C[i], data->unk_84[i]);
253
254 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
255 gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E00C49D4[i], D_E00C49E8[i], D_E00C49FC[i], unk_24 * data->unk_124[i] / 255);
256 gSPDisplayList(gMainGfxPos++, savedGfxPos);
257 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
258 }
259
260 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
261}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define guPositionF
#define guScaleF
u8 D_E00C49D4[]
Definition stop_watch.c:14
Gfx D_09001000_3CC890[]
u8 D_E00C49FC[]
Definition stop_watch.c:24
u8 D_E00C49E8[]
Definition stop_watch.c:19
u8 D_E00C49D0[]
Definition stop_watch.c:12
f32 unk_D4[10]
Definition effects.h:1701
f32 unk_84[10]
Definition effects.h:1699
f32 unk_34[10]
Definition effects.h:1697
f32 unk_5C[10]
Definition effects.h:1698
f32 unk_AC[10]
Definition effects.h:1700
f32 unk_FC[10]
Definition effects.h:1702
#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 stop_watch_render().

◆ stop_watch_main()

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

Definition at line 47 of file stop_watch.c.

54 {
56 StopWatchFXData* data;
57 EffectInstance* effect;
58 s32 numParts = 1;
59 s32 i;
60
64 bp.unk_00 = 0;
65 bp.renderUI = NULL;
66 bp.effectID = EFFECT_STOP_WATCH;
67
68 effect = create_effect_instance(&bp);
69 effect->numParts = numParts;
70 data = effect->data.stopWatch = general_heap_malloc(numParts * sizeof(*data));
71 ASSERT(effect->data.stopWatch != NULL);
72
73 data->unk_00 = arg0;
74 data->unk_14 = 0;
75 if (arg5 <= 0) {
76 data->unk_10 = 1000;
77 } else {
78 data->unk_10 = arg5;
79 }
80 data->unk_24 = 0;
81 data->unk_04 = arg1;
82 data->unk_08 = arg2;
83 data->unk_0C = arg3;
84 data->unk_28 = arg4;
85 data->unk_18 = 70;
86 data->unk_1C = 180;
87 data->unk_20 = 120;
88 data->unk_2C = 0;
89 data->unk_30 = 1.0f;
90
91 for (i = 0; i < 10; i++) {
92 data->unk_34[i] = D_E00C4A10[i].unk_00;
93 data->unk_5C[i] = D_E00C4A10[i].unk_04;
94 data->unk_84[i] = 0;
95 data->unk_AC[i] = 0;
96 data->unk_D4[i] = 0;
97 data->unk_FC[i] = 0;
98 data->unk_124[i] = 0;
99 data->unk_14C[i] = D_E00C4A10[i].unk_08;
100 }
101
102 return effect;
103}
#define general_heap_malloc
#define create_effect_instance
void stop_watch_init(EffectInstance *effect)
Definition stop_watch.c:105
void stop_watch_update(EffectInstance *effect)
Definition stop_watch.c:108
void stop_watch_render(EffectInstance *effect)
Definition stop_watch.c:165
UnkStruct D_E00C4A10[]
Definition stop_watch.c:29
#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_E00C4300()

void func_E00C4300 ( void )

Definition at line 177 of file stop_watch.c.

177 {
178}

Variable Documentation

◆ D_09001000_3CC890

Gfx D_09001000_3CC890[]
extern

Referenced by stop_watch_appendGfx().

◆ D_E00C49D0

u8 D_E00C49D0[] = { 120, 80, 40, 60 }

Definition at line 12 of file stop_watch.c.

12{ 120, 80, 40, 60 };

Referenced by stop_watch_appendGfx().

◆ D_E00C49D4

u8 D_E00C49D4[]
Initial value:
= {
255, 255, 255, 198, 138, 130, 130, 130, 130, 130,
175, 215, 250, 255, 255, 255, 255
}

Definition at line 14 of file stop_watch.c.

14 {
15 255, 255, 255, 198, 138, 130, 130, 130, 130, 130,
16 175, 215, 250, 255, 255, 255, 255
17};

Referenced by stop_watch_appendGfx().

◆ D_E00C49E8

u8 D_E00C49E8[]
Initial value:
= {
130, 130, 130, 130, 130, 165, 213, 255, 255, 255,
255, 255, 255, 225, 198, 159, 130
}

Definition at line 19 of file stop_watch.c.

19 {
20 130, 130, 130, 130, 130, 165, 213, 255, 255, 255,
21 255, 255, 255, 225, 198, 159, 130
22};

Referenced by stop_watch_appendGfx().

◆ D_E00C49FC

u8 D_E00C49FC[]
Initial value:
= {
130, 196, 255, 255, 255, 255, 255, 255, 202, 144,
130, 130, 130, 130, 130, 130, 130
}

Definition at line 24 of file stop_watch.c.

24 {
25 130, 196, 255, 255, 255, 255, 255, 255, 202, 144,
26 130, 130, 130, 130, 130, 130, 130
27};

Referenced by stop_watch_appendGfx().

◆ D_E00C4A10

UnkStruct D_E00C4A10[]
Initial value:
= {
{ -50, -70, 5 },
{ 80, -90, 20 },
{ 20, -50, 45 },
{ -80, 30, 10 },
{ 30, 0, 35 },
{ 120, -30, 50 },
{ 10, 50, 30 },
{ 100, 30, 15 },
{ 40, 100, 40 },
{ 140, 90, 25 }
}

Definition at line 29 of file stop_watch.c.

29 {
30 { -50, -70, 5 },
31 { 80, -90, 20 },
32 { 20, -50, 45 },
33 { -80, 30, 10 },
34 { 30, 0, 35 },
35 { 120, -30, 50 },
36 { 10, 50, 30 },
37 { 100, 30, 15 },
38 { 40, 100, 40 },
39 { 140, 90, 25 }
40};

Referenced by stop_watch_main().