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

Go to the source code of this file.

Macros

#define RGBA_BUF_SIZE   32
 
#define RGBA_BUF_SIZE   32
 

Functions

void gfx_init_state (void)
 
s32 gfx_frame_filter_pass_0 (const u16 *frameBuffer0, const u16 *frameBuffer1, s32 y, s32 x, Color_RGBA8 *out)
 
void gfx_frame_filter_pass_1 (Color_RGBA8 *filterBuf0, Color_RGBA8 filterBuf1, u16 *out)
 
void func_80027600 (Color_RGBA8 *arg0, s16 *out)
 
void func_80027774 (u16 *frameBuffer0, u16 *frameBuffer1, u16 *zBuffer)
 
void gfx_transfer_frame_to_depth (u16 *frameBuffer0, u16 *frameBuffer1, u16 *zBuffer)
 
void func_80027BAC (s32 arg0, s32 arg1)
 
void gfx_draw_background (void)
 Logic for the drawing the scene background.
 

Variables

s32 gPauseBackgroundFade
 
Vp D_80074200
 
Gfx D_80074210 []
 
Gfx D_80074230 []
 

Macro Definition Documentation

◆ RGBA_BUF_SIZE [1/2]

#define RGBA_BUF_SIZE   32

◆ RGBA_BUF_SIZE [2/2]

#define RGBA_BUF_SIZE   32

Function Documentation

◆ gfx_init_state()

void gfx_init_state ( void )

Definition at line 34 of file background_gfx.c.

34 {
35 gSPSegment(gMainGfxPos++, 0x00, 0x0);
36 gSPDisplayList(gMainGfxPos++, OS_K0_TO_PHYSICAL(D_80074230));
37 gSPDisplayList(gMainGfxPos++, OS_K0_TO_PHYSICAL(D_80074210));
38}
Gfx D_80074230[]
Gfx D_80074210[]
Gfx * gMainGfxPos
Definition cam_main.c:15

Referenced by appendGfx_reset_tile_pattern(), and gfx_task_background().

◆ gfx_frame_filter_pass_0()

s32 gfx_frame_filter_pass_0 ( const u16 * frameBuffer0,
const u16 * frameBuffer1,
s32 y,
s32 x,
Color_RGBA8 * out )

Definition at line 40 of file background_gfx.c.

40 {
41 s32 pixel = SCREEN_WIDTH * y + x;
42
43 out->a = (frameBuffer1[pixel] >> 2) & 0xF;
44 out->r = UNPACK_PAL_R(frameBuffer0[pixel]);
45 out->g = UNPACK_PAL_G(frameBuffer0[pixel]);
46 out->b = UNPACK_PAL_B(frameBuffer0[pixel]);
47}
#define UNPACK_PAL_B(color)
Definition macros.h:269
#define UNPACK_PAL_R(color)
Definition macros.h:267
#define SCREEN_WIDTH
Definition macros.h:105
#define UNPACK_PAL_G(color)
Definition macros.h:268

Referenced by func_80027774(), and gfx_transfer_frame_to_depth().

◆ gfx_frame_filter_pass_1()

void gfx_frame_filter_pass_1 ( Color_RGBA8 * filterBuf0,
Color_RGBA8 filterBuf1,
u16 * out )

Definition at line 49 of file background_gfx.c.

49 {
50 #define RGBA_BUF_SIZE 32
51 Color_RGBA8 sp0;
52 Color_RGBA8 sp8;
53 Color_RGBA8 final;
54 u8 rs[RGBA_BUF_SIZE];
55 u8 gs[RGBA_BUF_SIZE];
56 u8 bs[RGBA_BUF_SIZE];
57 s32 i;
58
59 sp8 = filterBuf1;
60 sp0 = filterBuf1;
61
62 for (i = 0; i < RGBA_BUF_SIZE; i++) {
63 rs[i] = 0;
64 gs[i] = 0;
65 bs[i] = 0;
66 }
67
68 for (i = 0; i < 6; i++) {
69 if (filterBuf0[i].a == 8) {
70 rs[filterBuf0[i].r]++;
71 gs[filterBuf0[i].g]++;
72 bs[filterBuf0[i].b]++;
73 }
74 }
75
76 for (i = 0; i < RGBA_BUF_SIZE; i++) {
77 if (rs[i] != 0) {
78 rs[i]--;
79 break;
80 }
81 }
82 for (; i < RGBA_BUF_SIZE; i++) {
83 if (rs[i] != 0) {
84 break;
85 }
86 }
87 if (sp0.r > i) {
88 sp0.r = i;
89 }
90
91 for (i = 0; i < RGBA_BUF_SIZE; i++) {
92 if (gs[i] != 0) {
93 gs[i]--;
94 break;
95 }
96 }
97 for (; i < RGBA_BUF_SIZE; i++) {
98 if (gs[i] != 0) {
99 break;
100 }
101 }
102 if (sp0.g > i) {
103 sp0.g = i;
104 }
105
106 for (i = 0; i < RGBA_BUF_SIZE; i++) {
107 if (bs[i] != 0) {
108 bs[i]--;
109 break;
110 }
111 }
112 for (; i < RGBA_BUF_SIZE; i++) {
113 if (bs[i] != 0) {
114 break;
115 }
116 }
117 if (sp0.b > i) {
118 sp0.b = i;
119 }
120
121 for (i = RGBA_BUF_SIZE - 1; i >= 0; i--) {
122 if (rs[i] != 0) {
123 break;
124 }
125 }
126 if (sp8.r < i) {
127 sp8.r = i;
128 }
129
130 for (i = RGBA_BUF_SIZE - 1; i >= 0; i--) {
131 if (gs[i] != 0) {
132 break;
133 }
134 }
135 if (sp8.g < i) {
136 sp8.g = i;
137 }
138
139 for (i = RGBA_BUF_SIZE - 1; i >= 0; i--) {
140 if (bs[i] != 0) {
141 break;
142 }
143 }
144 if (sp8.b < i) {
145 sp8.b = i;
146 }
147
148 final.r = (sp8.r + sp0.r) - filterBuf1.r;
149 final.g = (sp8.g + sp0.g) - filterBuf1.g;
150 final.b = (sp8.b + sp0.b) - filterBuf1.b;
151
152 final.r = ((filterBuf1.r * filterBuf1.a) + (final.r * (8 - filterBuf1.a))) >> 3;
153 final.g = ((filterBuf1.g * filterBuf1.a) + (final.g * (8 - filterBuf1.a))) >> 3;
154 final.b = ((filterBuf1.b * filterBuf1.a) + (final.b * (8 - filterBuf1.a))) >> 3;
155
156 *out = (final.r << 11) + (final.g << 6) + (final.b << 1) + 1;
157 #undef RGBA_BUF_SIZE
158}
#define RGBA_BUF_SIZE

Referenced by gfx_transfer_frame_to_depth().

◆ func_80027600()

void func_80027600 ( Color_RGBA8 * arg0,
s16 * out )

Definition at line 160 of file background_gfx.c.

160 {
161 #define RGBA_BUF_SIZE 32
162 Color_RGBA8 final;
163 u8 rs[RGBA_BUF_SIZE];
164 u8 gs[RGBA_BUF_SIZE];
165 u8 bs[RGBA_BUF_SIZE];
166 s32 i;
167 s32 sum;
168
169 for (i = 0; i < RGBA_BUF_SIZE; i++) {
170 rs[i] = 0;
171 gs[i] = 0;
172 bs[i] = 0;
173 }
174
175 for (i = 0; i < 9; i++) {
176 rs[arg0[i].r]++;
177 gs[arg0[i].g]++;
178 bs[arg0[i].b]++;
179 }
180
181 sum = 0;
182 for (i = 0; i < RGBA_BUF_SIZE; i++) {
183 sum += rs[i];
184 if (sum >= 5) {
185 break;
186 }
187 }
188 final.r = i;
189
190 sum = 0;
191 for (i = 0; i < RGBA_BUF_SIZE; i++) {
192 sum += gs[i];
193 if (sum >= 5) {
194 break;
195 }
196 }
197 final.g = i;
198
199 sum = 0;
200 for (i = 0; i < RGBA_BUF_SIZE; i++) {
201 sum += bs[i];
202 if (sum >= 5) {
203 break;
204 }
205 }
206 final.b = i;
207
208 *out = (final.r << 11) + (final.g << 6) + (final.b << 1) + 1;
209 #undef RGBA_BUF_SIZE
210}

Referenced by func_80027774().

◆ func_80027774()

void func_80027774 ( u16 * frameBuffer0,
u16 * frameBuffer1,
u16 * zBuffer )

Definition at line 212 of file background_gfx.c.

212 {
213 Color_RGBA8 filterBuf0[9];
214 s32 x, y;
215
216 for (y = 1; y < SCREEN_HEIGHT - 1; y++) {
217 for (x = 1; x < SCREEN_WIDTH - 1; x++) {
218
219 /*
220 The application of gfx_frame_filter_pass_0 is done to the following pixels, where x is the current pixel.
221 ...
222 .x.
223 ...
224 */
225 if (
226 (((frameBuffer1[(SCREEN_WIDTH * y) + x - 1] >> 2) & 0xF) < 8) ||
227 (((frameBuffer1[(SCREEN_WIDTH * y) + x + 0] >> 2) & 0xF) < 8) ||
228 (((frameBuffer1[(SCREEN_WIDTH * y) + x + 1] >> 2) & 0xF) < 8))
229 {
230 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x - 1, &filterBuf0[0]);
231 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x, &filterBuf0[1]);
232 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x + 1, &filterBuf0[2]);
233 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y , x - 1, &filterBuf0[3]);
234 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y , x, &filterBuf0[4]);
235 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y , x + 1, &filterBuf0[5]);
236 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y + 1, x - 1, &filterBuf0[6]);
237 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y + 1, x, &filterBuf0[7]);
238 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y + 1, x + 1, &filterBuf0[8]);
239 func_80027600(filterBuf0, &zBuffer[(SCREEN_WIDTH * y) + x]);
240 } else {
241 zBuffer[(SCREEN_WIDTH * y) + x] = frameBuffer0[(SCREEN_WIDTH * y) + x] | 1;
242 }
243 }
244 }
245}
void func_80027600(Color_RGBA8 *arg0, s16 *out)
s32 gfx_frame_filter_pass_0(const u16 *frameBuffer0, const u16 *frameBuffer1, s32 y, s32 x, Color_RGBA8 *out)
#define SCREEN_HEIGHT
Definition macros.h:106

◆ gfx_transfer_frame_to_depth()

void gfx_transfer_frame_to_depth ( u16 * frameBuffer0,
u16 * frameBuffer1,
u16 * zBuffer )

Definition at line 248 of file background_gfx.c.

248 {
249 Color_RGBA8 filterBuf0[6];
250 Color_RGBA8 filterBuf1;
251 s32 y;
252 s32 x;
253
254 for (y = 1; y < SCREEN_HEIGHT - 1; y++) {
255 for (x = 2; x < SCREEN_WIDTH - 2; x++) {
256 s32 pixel = SCREEN_WIDTH * y + x;
257
258 /*
259 The application of gfx_frame_filter_pass_0 is done to the following pixels, where x is the current pixel.
260 . .
261 . x .
262 . .
263 */
264 //TODO emulator test -- find which ones have bad performance here
265 #if !DX_PAUSE_LAG_FIX
266 if (((frameBuffer1[pixel] >> 2) & 0xF) < 8) {
267 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x - 1, &filterBuf0[0]);
268 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y - 1, x + 1, &filterBuf0[1]);
269 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y, x - 2, &filterBuf0[2]);
270 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y, x + 2, &filterBuf0[3]);
271 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y + 1, x - 1, &filterBuf0[4]);
272 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y + 1, x + 1, &filterBuf0[5]);
273 gfx_frame_filter_pass_0(frameBuffer0, frameBuffer1, y, x, &filterBuf1);
274 gfx_frame_filter_pass_1(filterBuf0, filterBuf1, &zBuffer[pixel]);
275 } else {
276 // Don't apply any filters to the edges of the screen
277 zBuffer[pixel] = frameBuffer0[pixel] | 1;
278 }
279 #else
280 zBuffer[pixel] = frameBuffer0[pixel] | 1;
281 #endif
282 }
283 }
284}
void gfx_frame_filter_pass_1(Color_RGBA8 *filterBuf0, Color_RGBA8 filterBuf1, u16 *out)

Referenced by gfx_draw_background().

◆ func_80027BAC()

void func_80027BAC ( s32 arg0,
s32 arg1 )

Definition at line 286 of file background_gfx.c.

286 {
287 s32 i;
288 s32 temp = 24; // todo figure out why this is needed and can't be used elsewhere
289
290 gDPPipeSync(gMainGfxPos++);
291 gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
292 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, arg1);
293 gDPSetCycleType(gMainGfxPos++, G_CYC_COPY);
294 gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
295 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
296 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
297 gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
298
299 for (i = 0; i < 40; i++) {
300 gDPLoadTextureTile(gMainGfxPos++, arg0 + (0xF00 * i), G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH,
301 SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH - 1, 5, 0, G_TX_NOMIRROR | G_TX_WRAP,
302 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
303 gSPTextureRectangle(gMainGfxPos++, 0, i * temp, 0x04FC, (i * 24) + 20, G_TX_RENDERTILE, 0, 0, 0x1000, 0x0400);
304 gDPPipeSync(gMainGfxPos++);
305 }
306}

◆ gfx_draw_background()

void gfx_draw_background ( void )

Logic for the drawing the scene background.

In normal operation, it draws the regular background. While opening pause menu, it does the following:

  • Extracts coverage from the current framebuffer and saves it to nuGfxCfb[1] on the first frame.
  • Copies the current framebuffer to the depth buffer to save it and applies a filter on the saved framebuffer based on the saved coverage values one frame later.
  • Draws the saved framebuffer to the current framebuffer while the pause screen is opened, fading it in over time.
Bug
In 1-cycle mode, the two combiner cycles should be identical. Using Texel1 here in the second cycle, which is the actual cycle of the combiner used on hardware in 1-cycle mode, actually samples the next pixel's texel value instead of the current pixel's. This results in a one-pixel offset.
Bug
Due to the previous issue with the incorrect second cycle combiner, the devs added a 1-pixel offset to texture coordinates in this texrect to compensate for the combiner error.

Definition at line 314 of file background_gfx.c.

314 {
315 Camera* camera;
316 s32 bgRenderState;
317 s32 backgroundMinX;
318 s32 backgroundMaxX;
319 s32 backgroundMinY;
320 s32 backgroundMaxY;
321 s32 viewportStartX;
322 s32 i;
323 s32 a = SCREEN_COPY_TILE_HEIGHT << 2;
324
325 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
326
327 camera = &gCameras[gCurrentCameraID];
329
330 switch (bgRenderState) {
332 // Save coverage to nunGfxCfb[1] using the VISCVG render mode
333 gDPPipeSync(gMainGfxPos++);
334 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, nuGfxCfb[1]);
335 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
336 gDPSetBlendColor(gMainGfxPos++, 0x80, 0x80, 0x80, 0xFF);
337 gDPSetPrimDepth(gMainGfxPos++, 0xFFFF, 0xFFFF);
338 gDPSetDepthSource(gMainGfxPos++, G_ZS_PRIM);
339 gDPSetRenderMode(gMainGfxPos++, G_RM_VISCVG, G_RM_VISCVG2);
340 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
341 gDPPipeSync(gMainGfxPos++);
342 gDPSetDepthSource(gMainGfxPos++, G_ZS_PIXEL);
343 gGameStatusPtr->backgroundFlags &= ~BACKGROUND_RENDER_STATE_MASK;
345 break;
347 // Save the framebuffer into the depth buffer and run a filter on it based on the saved coverage values
348 gfx_transfer_frame_to_depth(nuGfxCfb[0], nuGfxCfb[1], nuGfxZBuffer); // applies filters to the framebuffer
350 gGameStatusPtr->backgroundFlags &= ~BACKGROUND_RENDER_STATE_MASK;
352 // fallthrough
354 // Draw the saved framebuffer to the background, fading in at a rate of 16 opacity per frame until reaching 128 opacity
356 if (gPauseBackgroundFade > 128) {
358 }
359
360 gDPPipeSync(gMainGfxPos++);
361 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
362 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
363 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
364 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, nuGfxCfb_ptr);
365 gDPSetFillColor(gMainGfxPos++, PACK_FILL_COLOR(0, 0, 0, 1));
366 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
367 gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
368 gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
369 gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
370 gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
374 gDPSetCombineMode(gMainGfxPos++, PM_CC_43, PM_CC_44);
375 gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, gPauseBackgroundFade);
376 gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
377
378 for (i = 0; i < 40; i++) {
379 gDPLoadTextureTile(gMainGfxPos++, nuGfxZBuffer + (i * SCREEN_WIDTH * SCREEN_COPY_TILE_HEIGHT), G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH,
380 SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH - 1, SCREEN_COPY_TILE_HEIGHT - 1, 0, G_TX_NOMIRROR | G_TX_WRAP,
381 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
384 gSPTextureRectangle(gMainGfxPos++,
385 // ulx, uly, lrx, lry
386 0 << 2, i * a, SCREEN_WIDTH << 2, a + (i * (SCREEN_COPY_TILE_HEIGHT << 2)),
387 // tile
388 G_TX_RENDERTILE,
389 // s, t, dsdx, dtdy
390 -1 << 5, 0 << 5, 1 << 10, 1 << 10);
391 gDPPipeSync(gMainGfxPos++);
392 }
393 break;
394 default:
395 // Draw the scene's background as normal
397 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
398 return;
399 }
400
401 gDPSetDepthImage(gMainGfxPos++, OS_K0_TO_PHYSICAL(nuGfxZBuffer));
402 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
403 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
404 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, OS_K0_TO_PHYSICAL(nuGfxZBuffer));
405 gDPSetFillColor(gMainGfxPos++, PACK_FILL_DEPTH(G_MAXFBZ, 0));
406 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
407 gDPPipeSync(gMainGfxPos++);
408 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
409 gDPSetFillColor(gMainGfxPos++, PACK_FILL_COLOR(camera->bgColor[0], camera->bgColor[1], camera->bgColor[2], 1));
410
411 backgroundMinX = gGameStatusPtr->backgroundMinX;
412 backgroundMaxX = backgroundMinX + gGameStatusPtr->backgroundMaxX;
413 backgroundMinY = gGameStatusPtr->backgroundMinY;
414 backgroundMaxY = backgroundMinY + gGameStatusPtr->backgroundMaxY;
415 viewportStartX = camera->viewportStartX;
416
417 if (backgroundMinX < viewportStartX) {
418 backgroundMinX = viewportStartX;
419 }
420
421 if (backgroundMinY < camera->viewportStartY) {
422 backgroundMinY = camera->viewportStartY;
423 }
424
425 if (backgroundMaxX > viewportStartX + camera->viewportW) {
426 backgroundMaxX = viewportStartX + camera->viewportW;
427 }
428
429 if (backgroundMaxY > camera->viewportStartY + camera->viewportH) {
430 backgroundMaxY = camera->viewportStartY + camera->viewportH;
431 }
432
433 if (backgroundMinX < 0) {
434 backgroundMinX = 0;
435 }
436
437 if (backgroundMinY < 0) {
438 backgroundMinY = 0;
439 }
440
441 if (backgroundMaxX < 1) {
442 backgroundMaxX = 1;
443 }
444
445 if (backgroundMaxY < 1) {
446 backgroundMaxY = 1;
447 }
448
449 if (backgroundMinX > SCREEN_WIDTH - 1) {
450 backgroundMinX = SCREEN_WIDTH - 1;
451 }
452
453 if (backgroundMinY > SCREEN_HEIGHT - 1) {
454 backgroundMinY = SCREEN_HEIGHT - 1;
455 }
456
457 if (backgroundMaxX > SCREEN_WIDTH) {
458 backgroundMaxX = SCREEN_WIDTH;
459 }
460
461 if (backgroundMaxY > SCREEN_HEIGHT) {
462 backgroundMaxY = SCREEN_HEIGHT;
463 }
464
466 gDPFillRectangle(gMainGfxPos++, backgroundMinX, backgroundMinY, backgroundMaxX - 1, backgroundMaxY - 1);
467 } else {
469 }
470
471 gDPPipeSync(gMainGfxPos++);
472 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
473 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
474 gDPSetFillColor(gMainGfxPos++, PACK_FILL_COLOR(0, 0, 0, 1));
475 gDPPipeSync(gMainGfxPos++);
476
477 if (backgroundMinY > 0) {
478 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, backgroundMinY - 1);
479 gDPNoOp(gMainGfxPos++);
480 }
481
482 if (backgroundMinX > 0) {
483 gDPFillRectangle(gMainGfxPos++, 0, backgroundMinY, backgroundMinX - 1, backgroundMaxY - 1);
484 gDPNoOp(gMainGfxPos++);
485 }
486
487 if (backgroundMaxX < SCREEN_WIDTH) {
488 gDPFillRectangle(gMainGfxPos++, backgroundMaxX, backgroundMinY, SCREEN_WIDTH - 1, backgroundMaxY - 1);
489 gDPNoOp(gMainGfxPos++);
490 }
491
492 if (backgroundMaxY < SCREEN_HEIGHT) {
493 gDPFillRectangle(gMainGfxPos++, 0, backgroundMaxY, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
494 gDPNoOp(gMainGfxPos++);
495 }
496 break;
497 }
498 gDPPipeSync(gMainGfxPos++);
499}
s32 gPauseBackgroundFade
Definition main_loop.c:48
void gfx_transfer_frame_to_depth(u16 *frameBuffer0, u16 *frameBuffer1, u16 *zBuffer)
u16 * nuGfxCfb_ptr
Definition cam_main.c:14
@ BACKGROUND_FLAG_TEXTURE
Definition enums.h:6285
@ BACKGROUND_RENDER_STATE_MASK
Definition enums.h:6290
@ BACKGROUND_RENDER_STATE_FILTER_PAUSED
Definition enums.h:6288
@ BACKGROUND_RENDER_STATE_BEGIN_PAUSED
Definition enums.h:6287
@ BACKGROUND_RENDER_STATE_SHOW_PAUSED
Definition enums.h:6289
@ GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME
Definition enums.h:4322
void appendGfx_background_texture(void)
Definition background.c:62
u16 * nuGfxZBuffer
Definition main.c:46
u16 ** nuGfxCfb
Definition main_loop.c:13
#define PM_CC_43
Definition macros.h:469
#define SCREEN_COPY_TILE_HEIGHT
Definition macros.h:123
#define PACK_FILL_DEPTH(z, dz)
Definition macros.h:164
#define PM_CC_44
Definition macros.h:470
#define PACK_FILL_COLOR(r, g, b, a)
Definition macros.h:163
s16 bgColor[3]
s16 viewportStartX
s16 viewportStartY
s32 gOverrideFlags
Definition main_loop.c:11
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Camera gCameras[4]
Definition cam_main.c:17
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by gfx_task_background().

Variable Documentation

◆ gPauseBackgroundFade

s32 gPauseBackgroundFade
extern

Definition at line 48 of file main_loop.c.

Referenced by gfx_draw_background().

◆ D_80074200

Vp D_80074200
Initial value:
= {
.vp = {
.vscale = {640, 480, 511, 0},
.vtrans = {640, 480, 511, 0},
}
}

Definition at line 11 of file background_gfx.c.

11 {
12 .vp = {
13 .vscale = {640, 480, 511, 0},
14 .vtrans = {640, 480, 511, 0},
15 }
16};

◆ D_80074210

Gfx D_80074210[]
Initial value:
= {
gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsDPSetColorDither(G_CD_BAYER),
gsSPEndDisplayList(),
}

Definition at line 18 of file background_gfx.c.

18 {
19 gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
20 gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
21 gsDPSetColorDither(G_CD_BAYER),
22 gsSPEndDisplayList(),
23};

Referenced by gfx_init_state().

◆ D_80074230

Gfx D_80074230[]
Initial value:
= {
gsSPViewport(&D_80074200),
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0040F9FA),
gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH),
gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_OFF),
gsSPEndDisplayList(),
}
Vp D_80074200

Definition at line 25 of file background_gfx.c.

25 {
26 gsSPViewport(&D_80074200),
27 gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
28 G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0040F9FA),
29 gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH),
30 gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_OFF),
31 gsSPEndDisplayList(),
32};

Referenced by gfx_init_state().