papermario
Decompilation of Paper Mario
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
background_gfx.c File Reference

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

◆ func_80027600()

void func_80027600 ( Color_RGBA8 * arg0,
s16 * out )

Referenced by func_80027774().

◆ func_80027774()

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

◆ func_80027BAC()

void func_80027BAC ( s32 arg0,
s32 arg1 )

◆ 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.

Referenced by 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 )

◆ gfx_frame_filter_pass_1()

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

◆ gfx_init_state()

void gfx_init_state ( void )

◆ gfx_transfer_frame_to_depth()

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

Referenced by gfx_draw_background().

Variable Documentation

◆ D_80074200

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

◆ 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(),
}

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 background_gfx.c:10

Referenced by gfx_init_state().

◆ gPauseBackgroundFade

s32 gPauseBackgroundFade
extern

Referenced by gfx_draw_background().