Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
stop_watch.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
effects_internal.h
"
3
4
typedef
struct
UnkStruct
{
5
/* 0x00 */
s32
unk_00
;
6
/* 0x04 */
s32
unk_04
;
7
/* 0x08 */
s32
unk_08
;
8
}
UnkStruct
;
// size = 0xC
9
10
extern
Gfx
D_09001000_3CC890
[];
11
12
u8
D_E00C49D0
[] = { 120, 80, 40, 60 };
13
14
u8
D_E00C49D4
[] = {
15
255, 255, 255, 198, 138, 130, 130, 130, 130, 130,
16
175, 215, 250, 255, 255, 255, 255
17
};
18
19
u8
D_E00C49E8
[] = {
20
130, 130, 130, 130, 130, 165, 213, 255, 255, 255,
21
255, 255, 255, 225, 198, 159, 130
22
};
23
24
u8
D_E00C49FC
[] = {
25
130, 196, 255, 255, 255, 255, 255, 255, 202, 144,
26
130, 130, 130, 130, 130, 130, 130
27
};
28
29
UnkStruct
D_E00C4A10
[] = {
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
};
41
42
void
stop_watch_init
(
EffectInstance
* effect);
43
void
stop_watch_update
(
EffectInstance
* effect);
44
void
stop_watch_render
(
EffectInstance
* effect);
45
void
stop_watch_appendGfx
(
void
* effect);
46
47
EffectInstance
*
stop_watch_main
(
48
s32
arg0
,
49
f32
arg1
,
50
f32
arg2
,
51
f32
arg3
,
52
f32
arg4
,
53
s32
arg5
54
) {
55
EffectBlueprint
bp
;
56
StopWatchFXData
* data;
57
EffectInstance
* effect;
58
s32 numParts = 1;
59
s32 i;
60
61
bp
.init =
stop_watch_init
;
62
bp
.update =
stop_watch_update
;
63
bp
.renderScene =
stop_watch_render
;
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
}
104
105
void
stop_watch_init
(
EffectInstance
* effect) {
106
}
107
108
void
stop_watch_update
(
EffectInstance
* effect) {
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
}
164
165
void
stop_watch_render
(
EffectInstance
* effect) {
166
RenderTask
renderTask
;
167
RenderTask
*
retTask
;
168
169
renderTask
.
appendGfx
=
stop_watch_appendGfx
;
170
renderTask
.appendGfxArg = effect;
171
renderTask
.dist = 10;
172
renderTask
.renderMode =
RENDER_MODE_CLOUD_NO_ZCMP
;
173
174
retTask
=
queue_render_task
(&
renderTask
);
175
}
176
177
void
func_E00C4300
(
void
) {
178
}
179
180
void
stop_watch_appendGfx
(
void
* effect) {
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)->shared->graphics));
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
);
197
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
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);
206
gMainGfxPos
= &
gMainGfxPos
[65];
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);
235
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
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]);
252
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
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
}
PopupMenu_SelectedIndex
BSS s32 PopupMenu_SelectedIndex
Definition
8a860_len_3f30.c:84
DisplayContext::matrixStack
Mtx matrixStack[0x200]
Definition
common_structs.h:2192
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:133
unk_14
s8 unk_14
Definition
demo_api.c:19
general_heap_malloc
#define general_heap_malloc
Definition
effect_shims.h:51
queue_render_task
#define queue_render_task
Definition
effect_shims.h:48
guMtxF2L
#define guMtxF2L
Definition
effect_shims.h:47
sin_deg
#define sin_deg
Definition
effect_shims.h:55
guTranslateF
#define guTranslateF
Definition
effect_shims.h:43
guMtxCatF
#define guMtxCatF
Definition
effect_shims.h:46
remove_effect
#define remove_effect
Definition
effect_shims.h:50
guPositionF
#define guPositionF
Definition
effect_shims.h:65
create_effect_instance
#define create_effect_instance
Definition
effect_shims.h:49
guScaleF
#define guScaleF
Definition
effect_shims.h:45
D_E00C49D4
u8 D_E00C49D4[]
Definition
stop_watch.c:14
stop_watch_init
void stop_watch_init(EffectInstance *effect)
Definition
stop_watch.c:105
stop_watch_update
void stop_watch_update(EffectInstance *effect)
Definition
stop_watch.c:108
D_09001000_3CC890
Gfx D_09001000_3CC890[]
stop_watch_appendGfx
void stop_watch_appendGfx(void *effect)
Definition
stop_watch.c:180
D_E00C49FC
u8 D_E00C49FC[]
Definition
stop_watch.c:24
D_E00C49E8
u8 D_E00C49E8[]
Definition
stop_watch.c:19
stop_watch_render
void stop_watch_render(EffectInstance *effect)
Definition
stop_watch.c:165
D_E00C4A10
UnkStruct D_E00C4A10[]
Definition
stop_watch.c:29
func_E00C4300
void func_E00C4300(void)
Definition
stop_watch.c:177
stop_watch_main
EffectInstance * stop_watch_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition
stop_watch.c:47
D_E00C49D0
u8 D_E00C49D0[]
Definition
stop_watch.c:12
StopWatchFXData::unk_00
s32 unk_00
Definition
effects.h:1684
EffectInstance::flags
s32 flags
Definition
effects.h:2602
StopWatchFXData::unk_30
f32 unk_30
Definition
effects.h:1696
StopWatchFXData::unk_D4
f32 unk_D4[10]
Definition
effects.h:1701
StopWatchFXData::unk_24
s32 unk_24
Definition
effects.h:1693
EffectInstance::data
EffectInstanceDataPtr data
Definition
effects.h:2605
StopWatchFXData::unk_04
f32 unk_04
Definition
effects.h:1685
StopWatchFXData::unk_2C
s32 unk_2C
Definition
effects.h:1695
EffectInstance::effectID
s32 effectID
Definition
effects.h:2603
StopWatchFXData::unk_14
s32 unk_14
Definition
effects.h:1689
StopWatchFXData::unk_84
f32 unk_84[10]
Definition
effects.h:1699
StopWatchFXData::unk_14C
s32 unk_14C[10]
Definition
effects.h:1704
EffectInstance::numParts
s32 numParts
Definition
effects.h:2604
StopWatchFXData::unk_28
f32 unk_28
Definition
effects.h:1694
StopWatchFXData::unk_1C
s32 unk_1C
Definition
effects.h:1691
StopWatchFXData::unk_20
s32 unk_20
Definition
effects.h:1692
StopWatchFXData::unk_34
f32 unk_34[10]
Definition
effects.h:1697
StopWatchFXData::unk_10
s32 unk_10
Definition
effects.h:1688
StopWatchFXData::unk_0C
f32 unk_0C
Definition
effects.h:1687
StopWatchFXData::unk_5C
f32 unk_5C[10]
Definition
effects.h:1698
StopWatchFXData::unk_08
f32 unk_08
Definition
effects.h:1686
StopWatchFXData::unk_124
s32 unk_124[10]
Definition
effects.h:1703
StopWatchFXData::unk_18
s32 unk_18
Definition
effects.h:1690
StopWatchFXData::unk_AC
f32 unk_AC[10]
Definition
effects.h:1700
EffectInstanceDataPtr::stopWatch
struct StopWatchFXData * stopWatch
Definition
effects.h:2562
StopWatchFXData::unk_FC
f32 unk_FC[10]
Definition
effects.h:1702
EffectInstance
Definition
effects.h:2601
StopWatchFXData
Definition
effects.h:1683
effects_internal.h
ASSERT
#define ASSERT(condition)
Definition
effects_internal.h:8
FX_INSTANCE_FLAG_DISMISS
@ FX_INSTANCE_FLAG_DISMISS
Definition
enums.h:3517
RENDER_MODE_CLOUD_NO_ZCMP
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition
enums.h:3311
VIRTUAL_TO_PHYSICAL
#define VIRTUAL_TO_PHYSICAL(addr)
Definition
macros.h:47
Camera
Definition
common_structs.h:749
EffectBlueprint
Definition
effects.h:2649
RenderTask
Definition
common_structs.h:1508
RenderTask::appendGfx
void(* appendGfx)(void *)
Definition
common_structs.h:1512
gCameras
Camera gCameras[4]
Definition
cam_main.c:17
gMainGfxPos
Gfx * gMainGfxPos
Definition
cam_main.c:15
gMatrixListPos
u16 gMatrixListPos
Definition
main_loop.c:45
gCurrentCameraID
s32 gCurrentCameraID
Definition
cam_math.c:4
gDisplayContext
DisplayContext * gDisplayContext
Definition
cam_main.c:16
UnkStruct::unk_04
s32 unk_04
Definition
motion_blur_flame.c:13
UnkStruct::unk_08
f32 unk_08
Definition
motion_blur_flame.c:14
UnkStruct::unk_00
s32 unk_00
Definition
motion_blur_flame.c:12
UnkStruct::unk_08
s32 unk_08
Definition
stop_watch.c:7
UnkStruct
Definition
chapter_change.c:5
src
effects
stop_watch.c
Generated by
1.10.0