Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
overlay.h File Reference

Go to the source code of this file.

Data Structures

struct  ScreenOverlay
 

Functions

void _render_transition_stencil (u8, f32, ScreenOverlay *)
 
void appendGfx_screen_transition_stencil (s32, s32, f32, s32, s32, s32, s32, s32)
 
void appendGfx_darkness_stencil (s32, s32, s32, f32, f32)
 

Data Structure Documentation

◆ ScreenOverlay

struct ScreenOverlay
Data Fields
Color_RGB8 color
char unk_03
s32 screenPos[2][2]
f32 alpha

Function Documentation

◆ _render_transition_stencil()

void _render_transition_stencil ( u8 stencilType,
f32 progress,
ScreenOverlay * overlay )

Definition at line 172 of file screen_overlays.c.

172 {
173 Camera* camera = &gCameras[gCurrentCameraID];
174 u8 colR, colG, colB;
175 s32 x1, y1, x2, y2;
176 f32 alpha;
177 s16 v0;
178 s16 s0;
179 Mtx* matrixStack = gDisplayContext->matrixStack;
180
181 if (progress == 0.0f) {
182 return;
183 }
184
185 if (overlay != NULL) {
186 colR = overlay->color.r;
187 colG = overlay->color.g;
188 colB = overlay->color.b;
189 x1 = overlay->screenPos[0][0];
190 y1 = overlay->screenPos[0][1];
191 x2 = overlay->screenPos[1][0];
192 y2 = overlay->screenPos[1][1];
193 alpha = overlay->alpha;
194 } else {
195 colR = colG = colB = 0;
196 x1 = y1 = x2 = y2 = 0;
197 alpha = 0.0f;
198 }
199
200 switch (stencilType) {
202 gDPPipeSync(gMainGfxPos++);
203 gDPSetColorDither(gMainGfxPos++, G_CD_MAGICSQ);
204 gDPSetAlphaDither(gMainGfxPos++, G_AD_PATTERN);
205 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
206 if (progress == 255.0f) {
207 gDPSetRenderMode(gMainGfxPos++, CVG_DST_SAVE | G_RM_OPA_SURF, CVG_DST_SAVE | G_RM_OPA_SURF2);
208 } else {
209 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
210 }
211 gDPSetCombineMode(gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
212 gDPSetPrimColor(gMainGfxPos++, 0, 0, colR, colG, colB, progress);
213 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
214 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
215 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
216 return;
218 gDPPipeSync(gMainGfxPos++);
219 gDPSetColorDither(gMainGfxPos++, G_CD_MAGICSQ);
220 gDPSetAlphaDither(gMainGfxPos++, G_AD_PATTERN);
221 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
222 if (progress == 255.0f) {
223 gDPSetRenderMode(gMainGfxPos++, CVG_DST_SAVE | G_RM_OPA_SURF, CVG_DST_SAVE | G_RM_OPA_SURF2);
224 } else {
225 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
226 }
227 gDPSetCombineMode(gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
228 gDPSetPrimColor(gMainGfxPos++, 0, 0, colR, colG, colB, progress);
229 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
230 gDPFillRectangle(gMainGfxPos++, camera->viewportStartX, camera->viewportStartY,
231 camera->viewportStartX + camera->viewportW, camera->viewportStartY + camera->viewportH);
232 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
233 return;
234 }
235
236 guOrtho(&matrixStack[gMatrixListPos], 0.0f, 320.0f, 0.0f, 240.0f, -1000.0f, 1000.0f, 1.0f);
237 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
238
239 switch (stencilType) {
241 gSPDisplayList(gMainGfxPos++, Gfx_LoadStencilTex_Mario);
242 appendGfx_screen_transition_stencil(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, progress, colR, colG, colB, progress * alpha / 255.0f, gCurrentCameraID);
243 break;
245 gSPDisplayList(gMainGfxPos++, Gfx_LoadStencilTex_Mario);
246 appendGfx_screen_transition_stencil(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, progress, colR, colG, colB, progress * alpha / 255.0f, -1);
247 break;
249 gSPDisplayList(gMainGfxPos++, Gfx_LoadStencilTex_Star);
250 appendGfx_screen_transition_stencil(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, progress, colR, colG, colB, progress * alpha / 255.0f, gCurrentCameraID);
251 break;
253 gSPDisplayList(gMainGfxPos++, Gfx_LoadStencilTex_Star);
254 appendGfx_screen_transition_stencil(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, progress, colR, colG, colB, progress * alpha / 255.0f, -1);
255 break;
258 appendGfx_screen_transition_stencil(x1, y1, progress, 0, 0, 0, 0, gCurrentCameraID);
259 break;
262 appendGfx_screen_transition_stencil(x1, y1, progress, 0, 0, 0, 0, -1);
263 break;
264 case OVERLAY_TYPE_2:
265 s0 = progress;
266 guTranslate(&matrixStack[gMatrixListPos], 80.0f, 120.0f, 0.0f);
267 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
268 guScale(&matrixStack[gMatrixListPos], (1.0f - s0 / 255.0f) * 0.8, (1.0f - s0 / 255.0f) * 0.8, 1.0f);
269 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
270 guRotate(&matrixStack[gMatrixListPos], s0 * 0.5f, 0.0f, 0.0f, 1.0f);
271 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
272 gSPDisplayList(gMainGfxPos++, D_8014E8F0);
273 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
274
275 guTranslate(&matrixStack[gMatrixListPos], 240.0f, 120.0f, 0.0f);
276 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
277 guScale(&matrixStack[gMatrixListPos], (1.0f - s0 / 255.0f) * 0.8, (1.0f - s0 / 255.0f) * 0.8, 1.0f);
278 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
279 guRotate(&matrixStack[gMatrixListPos], s0 * 0.5f, 0.0f, 0.0f, 1.0f);
280 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
281 gSPDisplayList(gMainGfxPos++, D_8014E8F0);
282 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
283
284 guTranslate(&matrixStack[gMatrixListPos], 0.0f, 0.0f, 0.0f);
285 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
286 gSPDisplayList(gMainGfxPos++, D_8014EA48);
287 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
288 break;
289 case OVERLAY_TYPE_9:
290 s0 = progress;
291 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 0);
292 guTranslate(&matrixStack[gMatrixListPos], x1, SCREEN_HEIGHT - y1, 0.0f);
293 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
294 guScale(&matrixStack[gMatrixListPos], (1.0f - s0 / 255.0f) * 0.8, (1.0f - s0 / 255.0f) * 0.8, 1.0f);
295 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
296 guRotate(&matrixStack[gMatrixListPos], -s0, 0.0f, 0.0f, 1.0f);
297 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
298 gSPDisplayList(gMainGfxPos++, D_8014E8F0);
299 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
300
301 guTranslate(&matrixStack[gMatrixListPos], x2, SCREEN_HEIGHT - y2, 0.0f);
302 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
303 guScale(&matrixStack[gMatrixListPos], (1.0f - s0 / 255.0f) * 0.8, (1.0f - s0 / 255.0f) * 0.8, 1.0f);
304 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
305 guRotate(&matrixStack[gMatrixListPos], -s0, 0.0f, 0.0f, 1.0f);
306 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
307 gSPDisplayList(gMainGfxPos++, D_8014E8F0);
308 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
309
310 guTranslate(&matrixStack[gMatrixListPos], 0.0f, 0.0f, 0.0f);
311 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
312 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, alpha);
313 gSPDisplayList(gMainGfxPos++, D_8014E9A8);
314 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
315 break;
317 s0 = progress;
318 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 0);
319 guTranslate(&matrixStack[gMatrixListPos], x1, SCREEN_HEIGHT - y1, 0.0f);
320 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
321 guScale(&matrixStack[gMatrixListPos], (1.0f - s0 / 255.0f) * 0.8, (1.0f - s0 / 255.0f) * 0.8, 1.0f);
322 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
323 guRotate(&matrixStack[gMatrixListPos], (f32)(-s0) * 0.5, 0.0f, 0.0f, 1.0f);
324 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
325 gSPDisplayList(gMainGfxPos++, D_8014E8F0);
326 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
327
328 guTranslate(&matrixStack[gMatrixListPos], 0.0f, 0.0f, 0.0f);
329 gSPMatrix(gMainGfxPos++, &matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
330 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, alpha);
331 gSPDisplayList(gMainGfxPos++, D_8014E9A8);
332 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
333 v0 = progress + 40;
334 if (progress > 170) {
335 v0 = 170;
336 }
338 break;
341 appendGfx_darkness_stencil(TRUE, x2, y2, alpha, progress);
342 break;
343 case OVERLAY_BLUR:
344 draw_prev_frame_buffer_at_screen_pos(x1, y1, x2, y2, progress);
345 break;
348 appendGfx_darkness_stencil(FALSE, x1, y1, alpha, progress);
349 break;
350 case OVERLAY_INTRO_1:
351 case OVERLAY_INTRO_2:
352 break;
353 }
354
355 gSPMatrix(gMainGfxPos++, &gDisplayContext->camPerspMatrix[gCurrentCameraID], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
356}
Mtx matrixStack[0x200]
#define draw_prev_frame_buffer_at_screen_pos
#define guTranslate
@ OVERLAY_VIEWPORT_STAR
Definition enums.h:2393
@ OVERLAY_BLUR
Definition enums.h:2400
@ OVERLAY_SCREEN_MARIO
Definition enums.h:2395
@ OVERLAY_VIEWPORT_MARIO
Definition enums.h:2392
@ OVERLAY_START_BATTLE
Definition enums.h:2398
@ OVERLAY_SCREEN_SPOTLIGHT
Definition enums.h:2394
@ OVERLAY_SCREEN_COLOR
Definition enums.h:2388
@ OVERLAY_VIEWPORT_COLOR
Definition enums.h:2389
@ OVERLAY_INTRO_2
Definition enums.h:2403
@ OVERLAY_INTRO_1
Definition enums.h:2402
@ OVERLAY_BATTLE_DARKNESS
Definition enums.h:2401
@ OVERLAY_TYPE_2
Definition enums.h:2390
@ OVERLAY_WORLD_DARKNESS
Definition enums.h:2399
@ OVERLAY_VIEWPORT_SPOTLIGHT
Definition enums.h:2391
@ OVERLAY_TYPE_9
Definition enums.h:2397
@ OVERLAY_SCREEN_STAR
Definition enums.h:2396
Color_RGB8 color
Definition overlay.h:7
void appendGfx_darkness_stencil(s32, s32, s32, f32, f32)
s32 screenPos[2][2]
Definition overlay.h:9
void appendGfx_screen_transition_stencil(s32, s32, f32, s32, s32, s32, s32, s32)
Gfx D_8014E8F0[]
Gfx D_8014EA48[]
Gfx Gfx_LoadStencilTex_Star[]
Gfx Gfx_LoadStencilTex_BlurryCircle[]
Gfx Gfx_LoadStencilTex_SharpCircle[]
Gfx D_8014E9A8[]
Gfx Gfx_LoadStencilTex_Mario[]
#define SCREEN_WIDTH
Definition macros.h:105
#define SCREEN_HEIGHT
Definition macros.h:106
s16 viewportStartX
s16 viewportStartY
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 gfx_draw_frame(), render_screen_overlay_backUI(), and render_screen_overlay_frontUI().

◆ appendGfx_screen_transition_stencil()

void appendGfx_screen_transition_stencil ( s32 arg0,
s32 arg1,
f32 progress,
s32 primR,
s32 primG,
s32 primB,
s32 primA,
s32 camID )

Definition at line 246 of file screen_render_util.c.

246 {
247 s32 x1, y1, x2, y2, t5, t6;
248 f32 texScale;
249
250 if (camID >= 0) {
251 x1 = gCameras[camID].viewportStartX;
252 y1 = gCameras[camID].viewportStartY;
253 x2 = gCameras[camID].viewportStartX + gCameras[camID].viewportW;
254 y2 = gCameras[camID].viewportStartY + gCameras[camID].viewportH;
255 t5 = x1;
256 t6 = y1;
257 } else {
258 x1 = 0;
259 y1 = 0;
260 x2 = SCREEN_WIDTH;
261 y2 = SCREEN_HEIGHT;
262 t5 = 0;
263 t6 = 0;
264 }
265
266 if (progress == 0.0f) {
267 return;
268 }
269
270 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);
271 if (progress == 255.0f) {
273 }
274 gDPSetPrimColor(gMainGfxPos++, 0, 0, primR, primG, primB, primA);
275 texScale = (255.0f - progress) * 10.5f / 255.0f + 0.09; // range from
276 gSPTextureRectangle(gMainGfxPos++, x1 * 4, y1 * 4, x2 * 4, y2 * 4, G_TX_RENDERTILE,
277 (t5 - arg0) * 32.0f / texScale + 16.0f + 1024.0f, (t6 - arg1) * 32.0f / texScale + 16.0f + 1024.0f,
278 1024.0f / texScale, 1024.0f / texScale);
279 gDPPipeSync(gMainGfxPos++);
280}
#define PM_CC_PRIM_FULL_ALPHA
Definition macros.h:283

Referenced by _render_transition_stencil().

◆ appendGfx_darkness_stencil()

void appendGfx_darkness_stencil ( s32 isWorld,
s32 posX,
s32 posY,
f32 alpha,
f32 progress )

Definition at line 129 of file screen_render_util.c.

129 {
130 Camera* camera = &gCameras[gCurrentCameraID];
131 f32 texScale, f24;
132 s32 i;
133
134 if (alpha == 0.0f) {
135 return;
136 }
137
138 if (!isWorld) {
139 texScale = (255.0f - alpha) * 10.0f / 255.0f + 0.14;
140 } else {
141 texScale = 0.5f;
142 texScale = (255.0f - alpha) * 9.5f / 255.0f + texScale;
143 posX += (camera->viewportW / 2 - posX) * (255.0f - alpha) / 255.0f;
144 posY += (camera->viewportH / 2 - posY) * (255.0f - alpha) / 255.0f;
145 }
146
147 guOrtho(&gDisplayContext->matrixStack[gMatrixListPos], -16.0f, 0.0f, 0.0f, 16.0f, -1000.0f, 1000.0f, 1.0f);
148 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
149 gDPSetAlphaDither(gMainGfxPos++, G_AD_PATTERN);
150 gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
151 gDPSetTexturePersp(gMainGfxPos++, G_TP_PERSP);
152 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 64, osVirtualToPhysical(nuGfxZBuffer));
153 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, 64, 64);
154 gSPViewport(gMainGfxPos++, &DarknessStencilViewport);
155 gDPSetCombineMode(gMainGfxPos++, PM_CC_CONST_1, PM_CC_CONST_1);
156 guRotate(&gDisplayContext->matrixStack[gMatrixListPos], 0.0f, 0.0f, 0.0f, 1.0f);
157 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
158 gSPDisplayList(gMainGfxPos++, Gfx_DarknessStencilQuad);
159 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
160 gDPPipeSync(gMainGfxPos++);
161 gDPSetCombineMode(gMainGfxPos++, PM_CC_56, PM_CC_56);
162
163 for (i = 0; i < 2; i++) {
164 f32 f20;
165 f32 f2;
166 s32 s0 = 255;
167
168 if (i == 0) {
169 f20 = 0.9 - sin_deg(gGameStatusPtr->frameCounter) * 0.05;
170 } else {
171 f20 = 0.9 - sin_deg(gGameStatusPtr->frameCounter * 2 + i * 40) * 0.07;
172 }
173 f2 = 0;
174 if (s0 > 255) {
175 s0 = 255;
176 }
177
178 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, s0);
179 guRotate(&gDisplayContext->matrixStack[gMatrixListPos], i * 70 + f2, 0.0f, 0.0f, 1.0f);
180 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
181 guScale(&gDisplayContext->matrixStack[gMatrixListPos], f20, f20, 1.0f);
182 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
183 gSPDisplayList(gMainGfxPos++, Gfx_DarknessStencilQuad);
184 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
185 }
186
187 gDPPipeSync(gMainGfxPos++);
188 gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
189 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_I, G_IM_SIZ_8b, 64, osVirtualToPhysical(nuGfxZBuffer));
190 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, 64, 64);
191 gDPSetCombineMode(gMainGfxPos++, PM_CC_0F, PM_CC_0F);
192
193 for (i = 0; i < 4; i++) {
194 gDPLoadTextureTile(gMainGfxPos++, osVirtualToPhysical(&nuGfxZBuffer[i * 2048]), G_IM_FMT_RGBA, G_IM_SIZ_32b, 64, 16, 0, 0, 63, 15, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
195 gDPPipeSync(gMainGfxPos++);
196 gSPTextureRectangle(gMainGfxPos++, 0, (i * 16) * 4, 64 * 4, (i * 16 + 16) * 4, G_TX_RENDERTILE, 0, 0, 0x400, 0x400);
197 gDPPipeSync(gMainGfxPos++);
198 }
199
200 gDPLoadTextureTile(gMainGfxPos++, osVirtualToPhysical(nuGfxZBuffer), G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, 0, 63, 63,
201 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, 15, 15);
202 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, 0, 0x01FC, 0x01FC);
203 gDPPipeSync(gMainGfxPos++);
204
205 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
206 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
207 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 64, osVirtualToPhysical(nuGfxZBuffer));
208 gDPSetFillColor(gMainGfxPos++, GPACK_ZDZ(G_MAXFBZ, 0)<<16 | GPACK_ZDZ(G_MAXFBZ, 0));
209 gDPFillRectangle(gMainGfxPos++, 0, 0, 63, 63);
210 gDPPipeSync(gMainGfxPos++);
211
212 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
213 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
214 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
215 gDPSetColorDither(gMainGfxPos++, G_CD_MAGICSQ);
216 gDPSetAlphaDither(gMainGfxPos++, G_AD_PATTERN);
217 gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
218 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
219
220 if (alpha != 255.0f || isWorld == 1) {
221 gDPSetCombineMode(gMainGfxPos++, PM_CC_57, PM_CC_57);
222 } else {
223 gDPSetCombineMode(gMainGfxPos++, PM_CC_58, PM_CC_58);
224 }
225 alpha *= 0.5f;
226 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, alpha * 0.5f * progress / 255.0f);
227 gDPSetEnvColor(gMainGfxPos++, 255, 255, 255, (255.0f - alpha * 0.5f) * progress / 255.0f);
228
229 if (!isWorld) {
230 gSPTextureRectangle(gMainGfxPos++,
231 camera->viewportStartX * 4, camera->viewportStartY * 4,
232 (camera->viewportStartX + camera->viewportW) * 4, (camera->viewportStartY + camera->viewportH) * 4,
233 G_TX_RENDERTILE,
234 (12 - posX) * 32.0f / texScale + 16.0f + 1024.0f, (19 - posY) * 32.0f / texScale + 16.0f + 1024.0f,
235 1024.0f / texScale, 1024.0f / texScale);
236 } else {
237 gSPTextureRectangle(gMainGfxPos++,
238 camera->viewportStartX * 4, camera->viewportStartY * 4,
239 (camera->viewportStartX + camera->viewportW) * 4, (camera->viewportStartY + camera->viewportH) * 4,
240 G_TX_RENDERTILE,
241 (9 - posX) * 32.0f / texScale + 1024.0f, (32 - posY) * 32.0f / texScale + 1024.0f,
242 1024.0f / texScale, 1024.0f / texScale);
243 }
244}
u16 * nuGfxCfb_ptr
Definition cam_main.c:14
#define sin_deg
u16 * nuGfxZBuffer
Definition main.c:46
Gfx Gfx_DarknessStencilQuad[]
Vp DarknessStencilViewport
#define PM_CC_CONST_1
Definition macros.h:511
#define PM_CC_58
Definition macros.h:497
#define PM_CC_0F
Definition macros.h:292
#define PM_CC_57
Definition macros.h:496
#define PM_CC_56
Definition macros.h:495
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by _render_transition_stencil().