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

Go to the source code of this file.

Functions

void quizmo_stage_init (EffectInstance *effect)
 
void quizmo_stage_update (EffectInstance *effect)
 
void quizmo_stage_render (EffectInstance *effect)
 
void quizmo_stage_appendGfx (void *effect)
 
EffectInstancequizmo_stage_main (s32 arg0, f32 posX, f32 posY, f32 posZ)
 

Variables

Gfx D_09000218_398DD8 []
 
Gfx D_09001518_39A0D8 []
 
Mtx D_09004148_39CD08 []
 
Gfx D_09006D48_39F908 []
 
Gfx D_09006DA0_39F960 []
 
Gfx D_09006E28_39F9E8 []
 
Gfx D_09006F20_39FAE0 []
 
Gfx D_09006FB0_39FB70 []
 
Gfx D_09006FD8_39FB98 []
 
Gfx D_09007030_39FBF0 []
 
Gfx D_09007090_39FC50 []
 
Gfx D_090070E8_39FCA8 []
 
Gfx D_09007230_39FDF0 []
 

Function Documentation

◆ quizmo_stage_init()

void quizmo_stage_init ( EffectInstance * effect)

Definition at line 61 of file quizmo_stage.c.

61 {
62}

Referenced by quizmo_stage_main().

◆ quizmo_stage_update()

void quizmo_stage_update ( EffectInstance * effect)

Definition at line 64 of file quizmo_stage.c.

64 {
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) {
89 if (data->lightScrollAmt >= 1025) {
90 data->lightScrollAmt -= 1024;
91 }
92 }
93}
#define remove_effect
struct QuizmoStageFXData * quizmoStage
Definition effects.h:2542
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by quizmo_stage_main().

◆ quizmo_stage_render()

void quizmo_stage_render ( EffectInstance * effect)

Definition at line 95 of file quizmo_stage.c.

95 {
96 RenderTask renderTask;
97 RenderTask* retTask;
98
100 renderTask.appendGfxArg = effect;
101 renderTask.dist = 0;
103
104 retTask = queue_render_task(&renderTask);
106}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_OPA
Definition enums.h:3264
void quizmo_stage_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by quizmo_stage_main().

◆ quizmo_stage_appendGfx()

void quizmo_stage_appendGfx ( void * effect)

Definition at line 108 of file quizmo_stage.c.

108 {
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);
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);
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);
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);
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);
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}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
Gfx D_09007090_39FC50[]
Gfx D_09006DA0_39F960[]
Mtx D_09004148_39CD08[]
Gfx D_09000218_398DD8[]
Gfx D_09006FB0_39FB70[]
Gfx D_09007030_39FBF0[]
Gfx D_09006FD8_39FB98[]
Gfx D_090070E8_39FCA8[]
Gfx D_09006F20_39FAE0[]
Gfx D_09006E28_39F9E8[]
Gfx D_09001518_39A0D8[]
Gfx D_09007230_39FDF0[]
Gfx D_09006D48_39F908[]
#define PM_CC2_MULTIPLY_PRIM
Definition macros.h:305
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
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 quizmo_stage_render().

◆ quizmo_stage_main()

EffectInstance * quizmo_stage_main ( s32 arg0,
f32 posX,
f32 posY,
f32 posZ )

Definition at line 23 of file quizmo_stage.c.

23 {
24 EffectBlueprint effectBp;
25 EffectInstance* effect;
27 s32 numParts = 1;
28
29 effectBp.init = quizmo_stage_init;
30 effectBp.update = quizmo_stage_update;
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}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void quizmo_stage_render(EffectInstance *effect)
void quizmo_stage_init(EffectInstance *effect)
void quizmo_stage_update(EffectInstance *effect)
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

Variable Documentation

◆ D_09000218_398DD8

Gfx D_09000218_398DD8[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09001518_39A0D8

Gfx D_09001518_39A0D8[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09004148_39CD08

Mtx D_09004148_39CD08[]
extern

Definition at line 31 of file quizmo_stage.c.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0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0x0,
45 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0xFF, 0xCE, 0x0, 0x0, 0x0, 0xA, 0x0, 0x1,
46 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
47 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
48};

Referenced by quizmo_stage_appendGfx().

◆ D_09006D48_39F908

Gfx D_09006D48_39F908[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09006DA0_39F960

Gfx D_09006DA0_39F960[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09006E28_39F9E8

Gfx D_09006E28_39F9E8[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09006F20_39FAE0

Gfx D_09006F20_39FAE0[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09006FB0_39FB70

Gfx D_09006FB0_39FB70[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09006FD8_39FB98

Gfx D_09006FD8_39FB98[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09007030_39FBF0

Gfx D_09007030_39FBF0[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09007090_39FC50

Gfx D_09007090_39FC50[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_090070E8_39FCA8

Gfx D_090070E8_39FCA8[]
extern

Referenced by quizmo_stage_appendGfx().

◆ D_09007230_39FDF0

Gfx D_09007230_39FDF0[]
extern

Referenced by quizmo_stage_appendGfx().