Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
quizmo_stage.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
effects_internal.h
"
3
4
extern
Gfx
D_09000218_398DD8
[];
5
extern
Gfx
D_09001518_39A0D8
[];
6
extern
Mtx
D_09004148_39CD08
[];
7
extern
Gfx
D_09006D48_39F908
[];
8
extern
Gfx
D_09006DA0_39F960
[];
9
extern
Gfx
D_09006E28_39F9E8
[];
10
extern
Gfx
D_09006F20_39FAE0
[];
11
extern
Gfx
D_09006FB0_39FB70
[];
12
extern
Gfx
D_09006FD8_39FB98
[];
13
extern
Gfx
D_09007030_39FBF0
[];
14
extern
Gfx
D_09007090_39FC50
[];
15
extern
Gfx
D_090070E8_39FCA8
[];
16
extern
Gfx
D_09007230_39FDF0
[];
17
18
void
quizmo_stage_init
(
EffectInstance
* effect);
19
void
quizmo_stage_update
(
EffectInstance
* effect);
20
void
quizmo_stage_render
(
EffectInstance
* effect);
21
void
quizmo_stage_appendGfx
(
void
* effect);
22
23
EffectInstance
*
quizmo_stage_main
(s32 arg0, f32 posX, f32 posY, f32 posZ) {
24
EffectBlueprint
effectBp;
25
EffectInstance
* effect;
26
QuizmoStageFXData
* data;
27
s32 numParts = 1;
28
29
effectBp.
init
=
quizmo_stage_init
;
30
effectBp.
update
=
quizmo_stage_update
;
31
effectBp.
renderWorld
=
quizmo_stage_render
;
32
effectBp.
unk_00
= 0;
33
effectBp.
renderUI
= NULL;
34
effectBp.
effectID
= EFFECT_QUIZMO_STAGE;
35
36
effect =
create_effect_instance
(&effectBp);
37
effect->
numParts
= numParts;
38
39
data = effect->
data
.
quizmoStage
=
general_heap_malloc
(numParts *
sizeof
(*data));
40
ASSERT
(data != NULL);
41
42
data->
vanishTimer
= 100;
43
data->
microphoneRaiseAmt
= 255;
44
data->
rearWallRaiseAmt
= 255;
45
data->
leftWallRaiseAmt
= 255;
46
data->
rightWallRaiseAmt
= 255;
47
data->
podiumRaiseAmt
= 255;
48
data->
lightScrollIncrement
= 64;
49
data->
unk_00
= arg0;
50
data->
origin
.
x
= posX;
51
data->
origin
.
y
= posY;
52
data->
origin
.
z
= posZ;
53
data->
lightScrollAmt
= 0;
54
data->
lightScrollDelay
= 15;
55
data->
unkEffectMode
= 0;
56
data->
lifetime
= 0;
57
58
return
effect;
59
}
60
61
void
quizmo_stage_init
(
EffectInstance
* effect) {
62
}
63
64
void
quizmo_stage_update
(
EffectInstance
*effect) {
65
QuizmoStageFXData
*data = effect->
data
.
quizmoStage
;
66
s32 lifeTime;
67
68
if
(effect->
flags
&
FX_INSTANCE_FLAG_DISMISS
) {
69
effect->
flags
&= ~FX_INSTANCE_FLAG_DISMISS;
70
data->
vanishTimer
= 30;
71
}
72
73
if
(data->
vanishTimer
< 100) {
74
data->
vanishTimer
--;
75
}
76
77
data->
lifetime
++;
78
lifeTime = data->
lifetime
;
79
80
if
(data->
vanishTimer
< 0) {
81
remove_effect
(effect);
82
return
;
83
}
84
if
(data->
vanishTimer
< 16) {
85
data->
microphoneRaiseAmt
= data->
vanishTimer
* 16;
86
}
87
if
((lifeTime % data->
lightScrollDelay
) == 0) {
88
data->
lightScrollAmt
+= data->
lightScrollIncrement
;
89
if
(data->
lightScrollAmt
>= 1025) {
90
data->
lightScrollAmt
-= 1024;
91
}
92
}
93
}
94
95
void
quizmo_stage_render
(
EffectInstance
* effect) {
96
RenderTask
renderTask;
97
RenderTask
* retTask;
98
99
renderTask.
appendGfx
=
quizmo_stage_appendGfx
;
100
renderTask.
appendGfxArg
= effect;
101
renderTask.
dist
= 0;
102
renderTask.
renderMode
=
RENDER_MODE_SURFACE_OPA
;
103
104
retTask =
queue_render_task
(&renderTask);
105
retTask->
renderMode
|=
RENDER_TASK_FLAG_REFLECT_FLOOR
;
106
}
107
108
void
quizmo_stage_appendGfx
(
void
* effect) {
109
QuizmoStageFXData
* data = ((
EffectInstance
*)effect)->data.quizmoStage;
110
s32 microphoneRaiseAmt = data->
microphoneRaiseAmt
;
111
Matrix4f
sp18;
112
Matrix4f
sp58;
113
114
gDPPipeSync(
gMainGfxPos
++);
115
gSPSegment(
gMainGfxPos
++, 0x09,
VIRTUAL_TO_PHYSICAL
(((
EffectInstance
*)effect)->graphics->data));
116
117
guTranslateF
(sp18, data->
origin
.
x
, data->
origin
.
y
, data->
origin
.
z
);
118
guRotateF
(sp58, -
gCameras
[
gCurrentCameraID
].curYaw, 0.0f, 1.0f, 0.0f);
119
guMtxCatF
(sp58, sp18, sp18);
120
guMtxF2L
(sp18, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
121
122
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
123
gDPSetPrimColor(
gMainGfxPos
++, 0, 0, microphoneRaiseAmt, microphoneRaiseAmt, microphoneRaiseAmt, 255);
124
gDPSetCombineMode(
gMainGfxPos
++, G_CC_MODULATEIA,
PM_CC2_MULTIPLY_PRIM
);
125
gSPDisplayList(
gMainGfxPos
++,
D_09007230_39FDF0
);
126
127
if
(data->
unk_3C
!= 255) {
128
gSPMatrix(
gMainGfxPos
++, &
D_09004148_39CD08
[2], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
129
130
guRotateF
(sp18, (data->
rearWallRaiseAmt
* 180) / 255 - 180, 1.0f, 0.0f, 0.0f);
131
guMtxF2L
(sp18, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
132
133
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
134
gSPDisplayList(
gMainGfxPos
++,
D_09006E28_39F9E8
);
135
gSPDisplayList(
gMainGfxPos
++,
D_09001518_39A0D8
);
136
gDPSetTileSize(
gMainGfxPos
++, G_TX_RENDERTILE, data->
lightScrollAmt
, 0, data->
lightScrollAmt
+ 252, 60);
137
gSPDisplayList(
gMainGfxPos
++,
D_09006DA0_39F960
);
138
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
139
gSPMatrix(
gMainGfxPos
++, &
D_09004148_39CD08
[0], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
140
141
guRotateF
(sp18, 90 - (data->
leftWallRaiseAmt
* 90) / 255, 0.0f, 0.0f, 1.0f);
142
guMtxF2L
(sp18, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
143
144
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
145
gSPDisplayList(
gMainGfxPos
++,
D_09006FB0_39FB70
);
146
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
147
gSPMatrix(
gMainGfxPos
++, &
D_09004148_39CD08
[1], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
148
149
guRotateF
(sp18, (data->
rightWallRaiseAmt
* 90) / 255 - 90, 0.0f, 0.0f, 1.0f);
150
guMtxF2L
(sp18, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
151
152
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
153
gSPDisplayList(
gMainGfxPos
++,
D_09006F20_39FAE0
);
154
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
155
gSPDisplayList(
gMainGfxPos
++,
D_090070E8_39FCA8
);
156
gSPDisplayList(
gMainGfxPos
++,
D_09007030_39FBF0
);
157
gSPDisplayList(
gMainGfxPos
++,
D_09001518_39A0D8
);
158
gDPSetTileSize(
gMainGfxPos
++, G_TX_RENDERTILE, data->
lightScrollAmt
, 0, data->
lightScrollAmt
+ 252, 60);
159
gSPDisplayList(
gMainGfxPos
++,
D_09006FD8_39FB98
);
160
gSPMatrix(
gMainGfxPos
++, &
D_09004148_39CD08
[3], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
161
162
guRotateF
(sp18, 90 - (data->
podiumRaiseAmt
* 90) / 255, 1.0f, 0.0f, 0.0f);
163
guMtxF2L
(sp18, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
164
165
gSPMatrix(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
166
gSPDisplayList(
gMainGfxPos
++,
D_09006D48_39F908
);
167
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
168
gSPDisplayList(
gMainGfxPos
++,
D_09000218_398DD8
);
169
gSPDisplayList(
gMainGfxPos
++,
D_09007090_39FC50
);
170
}
171
172
gSPPopMatrix(
gMainGfxPos
++, G_MTX_MODELVIEW);
173
gDPPipeSync(
gMainGfxPos
++);
174
}
DisplayContext::matrixStack
Mtx matrixStack[0x200]
Definition
common_structs.h:2191
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:132
Vec3f::z
f32 z
Definition
common_structs.h:102
Vec3f::x
f32 x
Definition
common_structs.h:100
Vec3f::y
f32 y
Definition
common_structs.h:101
general_heap_malloc
#define general_heap_malloc
Definition
effect_shims.h:51
guRotateF
#define guRotateF
Definition
effect_shims.h:42
queue_render_task
#define queue_render_task
Definition
effect_shims.h:48
guMtxF2L
#define guMtxF2L
Definition
effect_shims.h:47
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
create_effect_instance
#define create_effect_instance
Definition
effect_shims.h:49
QuizmoStageFXData::unk_3C
s32 unk_3C
Definition
effects.h:1346
QuizmoStageFXData::lightScrollDelay
s32 lightScrollDelay
Definition
effects.h:1344
QuizmoStageFXData::leftWallRaiseAmt
s32 leftWallRaiseAmt
Definition
effects.h:1339
QuizmoStageFXData::unkEffectMode
s32 unkEffectMode
Definition
effects.h:1345
EffectInstance::flags
s32 flags
Definition
effects.h:2602
QuizmoStageFXData::unk_00
s32 unk_00
Definition
effects.h:1333
QuizmoStageFXData::lightScrollAmt
s32 lightScrollAmt
Definition
effects.h:1342
QuizmoStageFXData::vanishTimer
s32 vanishTimer
Definition
effects.h:1334
QuizmoStageFXData::rightWallRaiseAmt
s32 rightWallRaiseAmt
Definition
effects.h:1340
EffectData::quizmoStage
struct QuizmoStageFXData * quizmoStage
Definition
effects.h:2542
QuizmoStageFXData::origin
Vec3f origin
Definition
effects.h:1336
QuizmoStageFXData::lightScrollIncrement
s32 lightScrollIncrement
Definition
effects.h:1343
QuizmoStageFXData::podiumRaiseAmt
s32 podiumRaiseAmt
Definition
effects.h:1341
QuizmoStageFXData::lifetime
s32 lifetime
Definition
effects.h:1335
EffectInstance::numParts
s32 numParts
Definition
effects.h:2604
QuizmoStageFXData::microphoneRaiseAmt
s32 microphoneRaiseAmt
Definition
effects.h:1337
QuizmoStageFXData::rearWallRaiseAmt
s32 rearWallRaiseAmt
Definition
effects.h:1338
EffectInstance::data
EffectData data
Definition
effects.h:2605
EffectInstance
Definition
effects.h:2601
QuizmoStageFXData
Definition
effects.h:1332
effects_internal.h
ASSERT
#define ASSERT(condition)
Definition
effects_internal.h:7
FX_INSTANCE_FLAG_DISMISS
@ FX_INSTANCE_FLAG_DISMISS
Definition
enums.h:3517
RENDER_TASK_FLAG_REFLECT_FLOOR
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition
enums.h:3318
RENDER_MODE_SURFACE_OPA
@ RENDER_MODE_SURFACE_OPA
Definition
enums.h:3264
D_09007090_39FC50
Gfx D_09007090_39FC50[]
D_09006DA0_39F960
Gfx D_09006DA0_39F960[]
D_09004148_39CD08
Mtx D_09004148_39CD08[]
Definition
quizmo_stage.c:31
D_09000218_398DD8
Gfx D_09000218_398DD8[]
D_09006FB0_39FB70
Gfx D_09006FB0_39FB70[]
quizmo_stage_render
void quizmo_stage_render(EffectInstance *effect)
Definition
quizmo_stage.c:95
D_09007030_39FBF0
Gfx D_09007030_39FBF0[]
D_09006FD8_39FB98
Gfx D_09006FD8_39FB98[]
D_090070E8_39FCA8
Gfx D_090070E8_39FCA8[]
D_09006F20_39FAE0
Gfx D_09006F20_39FAE0[]
quizmo_stage_init
void quizmo_stage_init(EffectInstance *effect)
Definition
quizmo_stage.c:61
quizmo_stage_main
EffectInstance * quizmo_stage_main(s32 arg0, f32 posX, f32 posY, f32 posZ)
Definition
quizmo_stage.c:23
D_09006E28_39F9E8
Gfx D_09006E28_39F9E8[]
D_09001518_39A0D8
Gfx D_09001518_39A0D8[]
D_09007230_39FDF0
Gfx D_09007230_39FDF0[]
quizmo_stage_appendGfx
void quizmo_stage_appendGfx(void *effect)
Definition
quizmo_stage.c:108
D_09006D48_39F908
Gfx D_09006D48_39F908[]
quizmo_stage_update
void quizmo_stage_update(EffectInstance *effect)
Definition
quizmo_stage.c:64
PM_CC2_MULTIPLY_PRIM
#define PM_CC2_MULTIPLY_PRIM
Definition
macros.h:305
VIRTUAL_TO_PHYSICAL
#define VIRTUAL_TO_PHYSICAL(addr)
Definition
macros.h:47
EffectBlueprint
Definition
effects.h:2649
EffectBlueprint::renderUI
void(* renderUI)(EffectInstance *effectInst)
Definition
effects.h:2655
EffectBlueprint::effectID
s32 effectID
Definition
effects.h:2651
EffectBlueprint::init
void(* init)(EffectInstance *effectInst)
Definition
effects.h:2652
EffectBlueprint::update
void(* update)(EffectInstance *effectInst)
Definition
effects.h:2653
EffectBlueprint::unk_00
s32 unk_00
Definition
effects.h:2650
EffectBlueprint::renderWorld
void(* renderWorld)(EffectInstance *effectInst)
Definition
effects.h:2654
RenderTask
Definition
common_structs.h:1507
RenderTask::renderMode
s32 renderMode
Definition
common_structs.h:1508
RenderTask::appendGfxArg
void * appendGfxArg
Definition
common_structs.h:1510
RenderTask::appendGfx
void(* appendGfx)(void *)
Definition
common_structs.h:1511
RenderTask::dist
s32 dist
Definition
common_structs.h:1509
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
src
effects
quizmo_stage.c
Generated by
1.10.0