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

Go to the source code of this file.

Data Structures

struct  QuizmoAudiencePositonOffsets
 

Functions

void quizmo_audience_appendGfx (void *effect)
 
void quizmo_audience_init (EffectInstance *effect)
 
void quizmo_audience_update (EffectInstance *effect)
 
void quizmo_audience_render (EffectInstance *effect)
 
EffectInstancequizmo_audience_main (s32 arg0, f32 posX, f32 posY, f32 posZ)
 
void func_E00A8318 (void)
 

Variables

Gfx D_09002EE0_3AA680 []
 
Gfx D_09002F18_3AA6B8 []
 
Gfx D_09002F50_3AA6F0 []
 
Gfx D_09002F88_3AA728 []
 
Gfx D_09002FC0_3AA760 []
 
Gfx D_09002FF8_3AA798 []
 
Gfx D_09003030_3AA7D0 []
 
Gfx D_09003068_3AA808 []
 
Gfx D_090030A0_3AA840 []
 
Gfx D_090030D8_3AA878 []
 
Gfx D_09003110_3AA8B0 []
 
Gfx * quizmo_audience_renderAudienceMember []
 
Vec2b quizmo_audience_horizontalPosOffsets []
 
Vec2b quizmo_audience_verticalPosOffsets []
 
QuizmoAudiencePositonOffsets quizmo_audience_positionOffsets []
 

Data Structure Documentation

◆ QuizmoAudiencePositonOffsets

struct QuizmoAudiencePositonOffsets
Data Fields
Vec2b * offsets
u8 count

Function Documentation

◆ quizmo_audience_appendGfx()

void quizmo_audience_appendGfx ( void * effect)

Definition at line 183 of file quizmo_audience.c.

183 {
184 Matrix4f sp18;
185 Matrix4f sp58;
186 QuizmoAudienceFXData* data = ((EffectInstance*)effect)->data.quizmoAudience;
187 s32 primColor = data->primColor;
188 s32 i;
189
190 gDPPipeSync(gMainGfxPos++);
191 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
192
193 guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z);
194 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
195 guMtxCatF(sp58, sp18, sp18);
197
199 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
200 gDPSetPrimColor(gMainGfxPos++, 0, 0, primColor, primColor, primColor, 255);
201 gSPDisplayList(gMainGfxPos++, D_09003110_3AA8B0);
202
203 for (i = 0; i < MAX_QUIZMO_AUDIENCE; i++) {
204 guTranslateF(sp18, data->compX[i], data->compY[i], 0.0f);
206
208 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
210 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
211 }
212
213 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
214 gDPPipeSync(gMainGfxPos++);
215}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define MAX_QUIZMO_AUDIENCE
Definition effects.h:1419
Gfx D_09003110_3AA8B0[]
Gfx * quizmo_audience_renderAudienceMember[]
#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_audience_render().

◆ quizmo_audience_init()

void quizmo_audience_init ( EffectInstance * effect)

Definition at line 114 of file quizmo_audience.c.

114 {
115}

Referenced by quizmo_audience_main().

◆ quizmo_audience_update()

void quizmo_audience_update ( EffectInstance * effect)

Definition at line 117 of file quizmo_audience.c.

117 {
120 s32 posIdx;
121 s32 i;
122
123 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
124 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
125 data->timeLeft = 30;
126 }
127
128 if (data->timeLeft < 100) {
129 data->timeLeft--;
130 }
131
132 data->lifeTime++;
133 if (data->timeLeft < 0) {
134 remove_effect(effect);
135 return;
136 }
137
138 if (data->timeLeft < 16) {
139 data->primColor = data->timeLeft * 16;
140 }
141
142 for (i = 0; i < MAX_QUIZMO_AUDIENCE; i++) {
143 switch (data->compState[i]) {
144 case 0:
145 if (rand_int(10) == 10) {
146 data->compState[i] = 1;
147 data->compType[i] = rand_int(1);
148 data->compPosIdx[i] = 0;
149 data->compMoveMagnitude[i] = (rand_int(50) * 0.01) + 0.5;
150 }
151 break;
152 case 1:
153 posIdx = data->compPosIdx[i];
154 unkStruct = &quizmo_audience_positionOffsets[data->compType[i]];
155 if (data->compPosIdx[i] >= unkStruct->count) {
156 data->compState[i] = 0;
157 } else {
158 data->compX[i] = unkStruct->offsets[posIdx].x * data->compMoveMagnitude[i];
159 data->compY[i] = unkStruct->offsets[posIdx].y * data->compMoveMagnitude[i];
160 data->compPosIdx[i]++;
161 }
162 break;
163 }
164 }
165}
#define remove_effect
#define rand_int
struct QuizmoAudienceFXData * quizmoAudience
Definition effects.h:2548
f32 compMoveMagnitude[10]
Definition effects.h:1430
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
QuizmoAudiencePositonOffsets quizmo_audience_positionOffsets[]

Referenced by quizmo_audience_main().

◆ quizmo_audience_render()

void quizmo_audience_render ( EffectInstance * effect)

Definition at line 167 of file quizmo_audience.c.

167 {
168 RenderTask renderTask;
169 RenderTask* retTask;
170
172 renderTask.appendGfxArg = effect;
173 renderTask.dist = 0;
175
176 retTask = queue_render_task(&renderTask);
178}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void quizmo_audience_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by quizmo_audience_main().

◆ quizmo_audience_main()

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

Definition at line 78 of file quizmo_audience.c.

78 {
79 EffectBlueprint effectBp;
80 EffectInstance* effect;
82 s32 numParts = 1;
83 s32 i;
84
85 effectBp.init = quizmo_audience_init;
88 effectBp.unk_00 = 0;
89 effectBp.renderUI = NULL;
90 effectBp.effectID = EFFECT_QUIZMO_AUDIENCE;
91
92 effect = create_effect_instance(&effectBp);
93 effect->numParts = numParts;
94
95 data = effect->data.quizmoAudience = general_heap_malloc(numParts * sizeof(*data));
96 ASSERT(data != NULL);
97
98 data->timeLeft = 100;
99 data->unk_00 = arg0;
100 data->primColor = 255;
101 data->pos.x = posX;
102 data->pos.y = posY;
103 data->pos.z = posZ;
104 data->lifeTime = 0;
105
106 for (i = 0; i < ARRAY_COUNT(data->compState); i++) {
107 data->compState[i] = 0;
108 data->compX[i] = data->compY[i] = 0.0f;
109 }
110
111 return effect;
112}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void quizmo_audience_init(EffectInstance *effect)
void quizmo_audience_update(EffectInstance *effect)
void quizmo_audience_render(EffectInstance *effect)
#define ARRAY_COUNT(arr)
Definition macros.h:40
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_E00A8318()

void func_E00A8318 ( void )

Definition at line 180 of file quizmo_audience.c.

180 {
181}

Variable Documentation

◆ D_09002EE0_3AA680

Gfx D_09002EE0_3AA680[]
extern

◆ D_09002F18_3AA6B8

Gfx D_09002F18_3AA6B8[]
extern

◆ D_09002F50_3AA6F0

Gfx D_09002F50_3AA6F0[]
extern

◆ D_09002F88_3AA728

Gfx D_09002F88_3AA728[]
extern

◆ D_09002FC0_3AA760

Gfx D_09002FC0_3AA760[]
extern

◆ D_09002FF8_3AA798

Gfx D_09002FF8_3AA798[]
extern

◆ D_09003030_3AA7D0

Gfx D_09003030_3AA7D0[]
extern

◆ D_09003068_3AA808

Gfx D_09003068_3AA808[]
extern

◆ D_090030A0_3AA840

Gfx D_090030A0_3AA840[]
extern

◆ D_090030D8_3AA878

Gfx D_090030D8_3AA878[]
extern

◆ D_09003110_3AA8B0

Gfx D_09003110_3AA8B0[]
extern

◆ quizmo_audience_renderAudienceMember

Gfx* quizmo_audience_renderAudienceMember[]

◆ quizmo_audience_horizontalPosOffsets

Vec2b quizmo_audience_horizontalPosOffsets[]
Initial value:
= {
{0, 0},
{1, 0},
{2, 0},
{2, 0},
{3, 0},
{3, 0},
{3, 0},
{2, 0},
{2, 0},
{1, 0},
{1, 0},
{0, 0},
{0, 0},
{-1, 0},
{-2, 0},
{-2, 0},
{-3, 0},
{-3, 0},
{-3, 0},
{-2, 0},
{-2, 0},
{-1, 0},
{-1, 0},
{0, 0},
}

Definition at line 26 of file quizmo_audience.c.

26 {
27 {0, 0},
28 {1, 0},
29 {2, 0},
30 {2, 0},
31 {3, 0},
32 {3, 0},
33 {3, 0},
34 {2, 0},
35 {2, 0},
36 {1, 0},
37 {1, 0},
38 {0, 0},
39 {0, 0},
40 {-1, 0},
41 {-2, 0},
42 {-2, 0},
43 {-3, 0},
44 {-3, 0},
45 {-3, 0},
46 {-2, 0},
47 {-2, 0},
48 {-1, 0},
49 {-1, 0},
50 {0, 0},
51};

◆ quizmo_audience_verticalPosOffsets

Vec2b quizmo_audience_verticalPosOffsets[]
Initial value:
= {
{0, 0},
{0, 1},
{0, 2},
{0, 2},
{0, 3},
{0, 3},
{0, 3},
{0, 2},
{0, 2},
{0, 1},
{0, 1},
{0, 0},
}

Definition at line 53 of file quizmo_audience.c.

53 {
54 {0, 0},
55 {0, 1},
56 {0, 2},
57 {0, 2},
58 {0, 3},
59 {0, 3},
60 {0, 3},
61 {0, 2},
62 {0, 2},
63 {0, 1},
64 {0, 1},
65 {0, 0},
66};

◆ quizmo_audience_positionOffsets