Introduce FBALLOC and SCREEN constants for dimensions

This commit is contained in:
Ryan Dwyer committed 2023-05-14 13:00:29 +10:00
1 parent 73fc947f44
commit 8559aeed1f
12 files changed
+169 -143

No files matched your search

+6 -6
View File
@@ -962,7 +962,7 @@ Gfx *amRenderText(Gfx *gdl, char *text, u32 colour, s16 left, s16 top)
x = left - (textwidth / 2);
y = top - 4;
gdl = textRenderProjected(gdl, &x, &y, text, g_AmFont1, g_AmFont2, colour, 320, 240, 0, 0);
gdl = textRenderProjected(gdl, &x, &y, text, g_AmFont1, g_AmFont2, colour, SCREEN_320, SCREEN_240, 0, 0);
return gdl;
}
@@ -1037,12 +1037,12 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
#if VERSION >= VERSION_JPN_FINAL
gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
0x000000ff, 320, 240, 0, 0);
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
#else
gdl = textRender(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1,
0x000000ff, 320, 240, 0, 0);
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f);
textMeasure(&textheight, &textwidth, weaponname, g_AmFont1, g_AmFont2, 0);
@@ -1059,7 +1059,7 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
#endif
gdl = textRender(gdl, &x, &y, weaponname, g_AmFont1, g_AmFont2, -1,
0x000000ff, 320, 240, 0, 0);
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
#endif
g_Vars.currentplayer->commandingaibot = g_MpAllChrPtrs[buddynum];
@@ -1087,10 +1087,10 @@ Gfx *amRenderAibotInfo(Gfx *gdl, s32 buddynum)
#if VERSION >= VERSION_JPN_FINAL
gdl = func0f1574d0jf(gdl, &x, &y, title, g_AmFont1, g_AmFont2, -1,
0x000000ff, 320, 240, 0, 0);
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
#else
gdl = textRender(gdl, &x, &y, title, g_AmFont1, g_AmFont2, -1,
0x000000ff, 320, 240, 0, 0);
0x000000ff, SCREEN_320, SCREEN_240, 0, 0);
#endif
}
+14 -14
View File
@@ -62,7 +62,7 @@ Gfx *bview0f141864(Gfx *gdl, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5)
s32 value = viGetWidth() * arg2 + arg4;
gDPPipeSync(gdl++);
gDPSetTextureImage(gdl++, G_IM_FMT_I, G_IM_SIZ_8b, 320, value * 2 + arg1);
gDPSetTextureImage(gdl++, G_IM_FMT_I, G_IM_SIZ_8b, SCREEN_320, value * 2 + arg1);
gDPLoadSync(gdl++);
gDPLoadBlock(gdl++, arg3, 0, 0, arg5 - 1, 0);
@@ -102,13 +102,13 @@ Gfx *bviewCopyPixels(Gfx *gdl, u16 *fb, s32 top, u32 tile, s32 arg4, f32 arg5, s
s32 numparts;
s32 lrs[1];
if (width > 320) {
if (width > SCREEN_WIDTH_LO) {
numparts = 2;
lrs[0] = width / numparts;
image = (uintptr_t) &fb[viGetWidth() * top + left] & 0x00ffffff;
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, image);
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_320, image);
gDPLoadBlock(gdl++, tile, 0, 0, width / numparts - 1, 0);
gSPTextureRectangle(gdl++,
left << 2,
@@ -125,7 +125,7 @@ Gfx *bviewCopyPixels(Gfx *gdl, u16 *fb, s32 top, u32 tile, s32 arg4, f32 arg5, s
image = (uintptr_t) &fb[viGetWidth() * top + left] & 0x00ffffff;
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, image);
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_320, image);
gDPLoadBlock(gdl++, tile, 0, 0, lrs[0] - 1, 0);
gSPTextureRectangle(gdl++,
@@ -143,7 +143,7 @@ Gfx *bviewCopyPixels(Gfx *gdl, u16 *fb, s32 top, u32 tile, s32 arg4, f32 arg5, s
image = (uintptr_t) &fb[viGetWidth() * top + left] & 0x00ffffff;
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, image);
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_320, image);
gDPLoadBlock(gdl++, tile, 0, 0, width2 - 1, 0);
numparts = (s32) (1024.0f / arg5);
@@ -614,7 +614,7 @@ Gfx *bviewDrawFisheye(Gfx *gdl, u32 colour, u32 alpha, s32 shuttertime60, s8 sta
if (hit == EYESPYHIT_DAMAGE) {
alpha2 = (random() % 120) + 120;
colour = 0xff333300 | (alpha2 & 0xff);
f22 = ((random() % 32) + 220.0f) * (1.0f / 256.0f);
f22 = ((random() % 32) + (f32) FBALLOC_HEIGHT) * (1.0f / 256.0f);
gDPSetEnvColorViaWord(gdl++, colour);
} else {
@@ -837,9 +837,9 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl)
u32 colourglow;
#if PAL
s32 scale = 1;
f32 palscale = viewwidth > 320 ? 1.4f : 1.0f;
f32 palscale = viewwidth > SCREEN_WIDTH_LO ? 1.4f : 1.0f;
#else
s32 scale = viewwidth > 320 ? 2 : 1;
s32 scale = viewwidth > SCREEN_WIDTH_LO ? 2 : 1;
#endif
#if VERSION >= VERSION_NTSC_1_0
bool vsplit = false;
@@ -1775,9 +1775,9 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl)
value = 17 - value;
if (viewheight == 220) {
if (viewheight == FBALLOC_HEIGHT) {
yoffset = 10;
} else if (viewheight == 180) {
} else if (viewheight == 180) { // screen size: wide
barheight--;
yoffset = -8;
} else {
@@ -1796,7 +1796,7 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl)
// Speed bars (left side)
y = viewtop + 58;
if (viewheight == 180) {
if (viewheight == 180) { // screen size: wide
y += 5;
}
@@ -1865,7 +1865,7 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl)
y = viewtop + 46;
if (viewheight == 180) {
if (viewheight == 180) { // screen size: wide
y += 5;
}
@@ -2167,7 +2167,7 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
// Rendering a line that overlaps the semicircle
// in the middle of the screen
f32 f0 = a0;
s32 semicirclewidth = sqrtf(sqinnerradius - (s32) (f0 * f0)) * (viewwidth / 320.0f);
s32 semicirclewidth = sqrtf(sqinnerradius - (s32) (f0 * f0)) * (viewwidth / (f32) SCREEN_WIDTH_LO);
s32 semicircleright = viewcentrex + semicirclewidth;
s32 rightsidewidth = viewwidth - semicircleright;
@@ -2534,7 +2534,7 @@ Gfx *bviewDrawIrBinoculars(Gfx *gdl)
s32 sqytocentre = ytocentre * ytocentre;
if (sqytocentre < sqradius) {
s32 xoffset = (viewwidth / 320.0f) * sqrtf(sqradius - sqytocentre);
s32 xoffset = (viewwidth / (f32) SCREEN_WIDTH_LO) * sqrtf(sqradius - sqytocentre);
// Left side
if (leftx - xoffset > viewleft) {
+1 -1
View File
@@ -74,7 +74,7 @@ Gfx *getitle0f0155f0(Gfx *gdl, s32 arg1, u8 arg2)
{
u16 perspnorm;
guPerspective(&var8009cc80[var80062410], &perspnorm, 60, 320.0f / 240.0f, 100, 5000, 1);
guPerspective(&var8009cc80[var80062410], &perspnorm, 60, (f32) SCREEN_320 / (f32) SCREEN_240, 100, 5000, 1);
gSPPerspNormalize(gdl++, perspnorm);
}
+2 -1
View File
@@ -1450,6 +1450,7 @@ void menuPushDialog(struct menudialogdef *dialogdef)
sibling = dialogdef->nextsibling;
while (sibling && layer->numsiblings < 5) {
// @bug:
// If this limit were to be reached, the game would soft lock
// because sibling is incremented inside the if-statement block.
if (g_Menus[g_MpPlayerNum].numdialogs < ARRAYCOUNT(g_Menus[0].dialogs)) {
@@ -1463,7 +1464,7 @@ void menuPushDialog(struct menudialogdef *dialogdef)
menuOpenDialog(sibling, dialog, &g_Menus[g_MpPlayerNum]);
dialog->dstx = dialog->x = -320;
dialog->dstx = dialog->x = -SCREEN_320;
dialog->dsty = dialog->y = (viGetHeight() - dialog->height) / 2;
dialog->type = 0;
+13 -13
View File
@@ -49,7 +49,7 @@ void menugfxCreateBlur(void)
s32 dsty;
#if PAL
s32 fbwidthinbytes = viGetWidth() * 2;
f32 scale = viGetWidth() / 320.0f;
f32 scale = viGetWidth() / (f32) SCREEN_WIDTH_LO;
#else
s32 fbwidthinbytes = PXTOBYTES(viGetWidth());
#endif
@@ -154,14 +154,14 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3)
*(u16 *)&vertices[0].x = arg2;
*(u16 *)&vertices[0].y = arg3;
vertices[0].z = -10;
*(u16 *)&vertices[1].x = arg2 + 320 * 10u + 40;
*(u16 *)&vertices[1].x = arg2 + SCREEN_320 * 10u + 40;
*(u16 *)&vertices[1].y = arg3;
vertices[1].z = -10;
*(u16 *)&vertices[2].x = arg2 + 320 * 10u + 40;
*(u16 *)&vertices[2].y = arg3 + 240 * 10u + 50;
*(u16 *)&vertices[2].x = arg2 + SCREEN_320 * 10u + 40;
*(u16 *)&vertices[2].y = arg3 + SCREEN_240 * 10u + 50;
vertices[2].z = -10;
*(u16 *)&vertices[3].x = arg2;
*(u16 *)&vertices[3].y = arg3 + 240 * 10u + 50;
*(u16 *)&vertices[3].y = arg3 + SCREEN_240 * 10u + 50;
vertices[3].z = -10;
#elif PAL
width = viGetWidth() * 10;
@@ -183,25 +183,25 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3)
*(u16 *)&vertices[0].x = arg2;
*(u16 *)&vertices[0].y = arg3;
vertices[0].z = -10;
*(u16 *)&vertices[1].x = arg2 + 320 * 10u + 40;
*(u16 *)&vertices[1].x = arg2 + SCREEN_320 * 10u + 40;
*(u16 *)&vertices[1].y = arg3;
vertices[1].z = -10;
*(u16 *)&vertices[2].x = arg2 + 320 * 10u + 40;
*(u16 *)&vertices[2].y = arg3 + 240 * 10u + 50;
*(u16 *)&vertices[2].x = arg2 + SCREEN_320 * 10u + 40;
*(u16 *)&vertices[2].y = arg3 + SCREEN_240 * 10u + 50;
vertices[2].z = -10;
*(u16 *)&vertices[3].x = arg2;
*(u16 *)&vertices[3].y = arg3 + 240 * 10u + 50;
*(u16 *)&vertices[3].y = arg3 + SCREEN_240 * 10u + 50;
vertices[3].z = -10;
#endif
vertices[0].s = 0;
vertices[0].t = 0;
vertices[1].s = 1280;
vertices[1].s = SCREEN_320 * 4;
vertices[1].t = 0;
vertices[2].s = 1280;
vertices[2].t = 960;
vertices[2].s = SCREEN_320 * 4;
vertices[2].t = SCREEN_320 * 3;
vertices[3].s = 0;
vertices[3].t = 960;
vertices[3].t = SCREEN_320 * 3;
vertices[0].colour = 0;
vertices[1].colour = 0;
+1 -1
View File
@@ -49,7 +49,7 @@ s32 func0f0e5ce0(s32 value)
if (value < var800711a4) {
var800711a0++;
if (var800711a0 > 320) {
if (var800711a0 > SCREEN_320) {
var800711a0 = 0;
}
}
+29 -32
View File
@@ -114,34 +114,31 @@ s16 g_SpawnPoints[MAX_SPAWNPOINTS];
s32 g_NumSpawnPoints;
struct vimode g_ViModes[] = {
// fbwidth
// | fbheight
// | | width
// | | | yscale
// | | | | xscale
// | | | | | fullheight
// | | | | | | fulltop
// | | | | | | | wideheight
// | | | | | | | | widetop
// | | | | | | | | | cinemaheight
// | | | | | | | | | | cinematop
// | | | | | | | | | | |
// fbwidth
// | fbheight
// | | width
// | | | yscale
// | | | | xscale
// | | | | | fullheight
// | | | | | | fulltop
// | | | | | | | wideheight
// | | | | | | | | widetop
// | | | | | | | | | cinemaheight
// | | | | | | | | | | cinematop
// | | | | | | | | | | |
#if VERSION >= VERSION_JPN_FINAL
{ 320, 220, 320, 1, 1, 220, 0, 180, 20, 136, 42 }, // default
{ 640, 220, 640, 0.5, 1, 220, 0, 180, 20, 136, 42 }, // hi-res
#elif VERSION >= VERSION_PAL_FINAL
{ 320, 266, 320, 1, 1, 266, 0, 212, 20, 168, 42 }, // default
{ 448, 266, 448, 0.71428567171097, 1, 266, 0, 212, 20, 168, 42 }, // hi-res
{ SCREEN_WIDTH_LO, SCREEN_HEIGHT_LO, SCREEN_WIDTH_LO, 1, VIMODE_LO, SCREEN_HEIGHT_LO, 0, 180, 20, 136, 42 }, // default
{ SCREEN_WIDTH_HI, SCREEN_HEIGHT_HI, SCREEN_WIDTH_HI, 0.5, VIMODE_LO, SCREEN_HEIGHT_HI, 0, 180, 20, 136, 42 }, // hi-res
#elif VERSION >= VERSION_PAL_BETA
{ 320, 252, 320, 1, 1, 252, 0, 212, 20, 168, 42 }, // default
{ 448, 252, 448, 0.71428567171097, 1, 252, 0, 212, 20, 168, 42 }, // hi-res
{ SCREEN_WIDTH_LO, SCREEN_HEIGHT_LO, SCREEN_WIDTH_LO, 1, VIMODE_LO, SCREEN_HEIGHT_LO, 0, 212, 20, 168, 42 }, // default
{ SCREEN_WIDTH_HI, SCREEN_HEIGHT_HI, SCREEN_WIDTH_HI, 0.71428567171097, VIMODE_LO, SCREEN_HEIGHT_HI, 0, 212, 20, 168, 42 }, // hi-res
#else
{ 320, 220, 320, 1, 1, 220, 0, 180, 20, 136, 42 }, // default
{ 640, 220, 640, 0.5, 1, 220, 0, 180, 20, 136, 42 }, // hi-res
{ 320, 480, 320, 2, 2, 440, 20, 360, 60, 272, 104 }, // unused
{ 440, 330, 440, 1, 1, 330, 0, 330, 0, 330, 0 }, // unused
{ 440, 240, 440, 0.72727274894714, 1, 220, 0, 180, 0, 136, 0 }, // unused
{ 400, 300, 400, 1, 2, 300, 0, 300, 0, 300, 0 }, // unused
{ SCREEN_WIDTH_LO, SCREEN_HEIGHT_LO, SCREEN_WIDTH_LO, 1, VIMODE_LO, SCREEN_HEIGHT_LO, 0, 180, 20, 136, 42 }, // default
{ SCREEN_WIDTH_HI, SCREEN_HEIGHT_HI, SCREEN_WIDTH_HI, 0.5, VIMODE_LO, SCREEN_HEIGHT_HI, 0, 180, 20, 136, 42 }, // hi-res
{ 320, 480, 320, 2, VIMODE_HI, 440, 20, 360, 60, 272, 104 }, // unused
{ 440, 330, 440, 1, VIMODE_LO, 330, 0, 330, 0, 330, 0 }, // unused
{ 440, 240, 440, (1.0f / 1.375f), VIMODE_LO, 220, 0, 180, 0, 136, 0 }, // unused
{ 400, 300, 400, 1, VIMODE_HI, 300, 0, 300, 0, 300, 0 }, // unused
#endif
};
@@ -2735,17 +2732,17 @@ void playerResetLoResIf4Mb(void)
{
if (IS4MB()) {
#if VERSION >= VERSION_PAL_BETA
g_ViModes[VIRES_LO].fbwidth = 320;
g_ViModes[VIRES_LO].fbheight = 220;
g_ViModes[VIRES_LO].width = 320;
g_ViModes[VIRES_LO].fbwidth = FBALLOC_WIDTH_LO;
g_ViModes[VIRES_LO].fbheight = FBALLOC_HEIGHT_LO;
g_ViModes[VIRES_LO].width = FBALLOC_WIDTH_LO;
g_ViModes[VIRES_LO].yscale = 1;
g_ViModes[VIRES_LO].xscale = 1;
g_ViModes[VIRES_LO].fullheight = 220;
g_ViModes[VIRES_LO].xscale = VIMODE_LO;
g_ViModes[VIRES_LO].fullheight = FBALLOC_HEIGHT_LO;
g_ViModes[VIRES_LO].fulltop = 0;
#else
g_ViModes[VIRES_LO].fbheight = 220;
g_ViModes[VIRES_LO].fbheight = FBALLOC_HEIGHT_LO;
g_ViModes[VIRES_LO].fulltop = 0;
g_ViModes[VIRES_LO].fullheight = 220;
g_ViModes[VIRES_LO].fullheight = FBALLOC_HEIGHT_LO;
#endif
g_ViModes[VIRES_LO].wideheight = 180;
+6 -6
View File
@@ -476,15 +476,15 @@ void playermgrAllocatePlayer(s32 index)
g_Vars.players[index]->lastroomforoffset = -1;
g_Vars.players[index]->c_screenwidth = 320;
g_Vars.players[index]->c_screenheight = PAL ? 272 : 240;
g_Vars.players[index]->c_screenwidth = SCREEN_320;
g_Vars.players[index]->c_screenheight = PAL ? 272 : SCREEN_240;
g_Vars.players[index]->c_screenleft = 0;
g_Vars.players[index]->c_screentop = 0;
g_Vars.players[index]->c_perspnear = 10;
g_Vars.players[index]->c_perspfovy = 46;
g_Vars.players[index]->c_perspaspect = 1;
g_Vars.players[index]->c_halfwidth = 160;
g_Vars.players[index]->c_halfheight = PAL ? 136 : 120;
g_Vars.players[index]->c_halfwidth = SCREEN_320 / 2;
g_Vars.players[index]->c_halfheight = (PAL ? 272 : SCREEN_240) / 2;
g_Vars.players[index]->c_scalex = 1;
g_Vars.players[index]->c_scaley = 1;
g_Vars.players[index]->c_recipscalex = 1;
@@ -514,8 +514,8 @@ void playermgrAllocatePlayer(s32 index)
g_Vars.players[index]->screenxminf = 0;
g_Vars.players[index]->screenyminf = 0;
g_Vars.players[index]->screenxmaxf = 320;
g_Vars.players[index]->screenymaxf = PAL ? 272 : 240;
g_Vars.players[index]->screenxmaxf = SCREEN_320;
g_Vars.players[index]->screenymaxf = PAL ? 272 : SCREEN_240;
g_Vars.players[index]->gunsightoff = 0;
g_Vars.players[index]->unk1834 = 0;
+5 -5
View File
@@ -8306,11 +8306,11 @@ void titleInitSkip(void)
if (IS4MB()) {
g_TitleNextStage = STAGE_4MBMENU;
viSetAspect(PAL ? 1.7316017150879f : 1.4545454978943f);
viSetSize(320, 220);
viSetBufSize(320, 220);
playermgrSetViewSize(320, 220);
viSetViewSize(320, 220);
viSetAspect(PAL ? 1.7316017150879f : ((f32) FBALLOC_WIDTH_LO / (f32) FBALLOC_HEIGHT_LO));
viSetSize(FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO);
viSetBufSize(FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO);
playermgrSetViewSize(FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO);
viSetViewSize(FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO);
}
mainChangeToStage(g_TitleNextStage);
+11 -8
View File
@@ -44,24 +44,27 @@ void zbufReset(s32 stagenum)
* missions because the player can switch to hi-res mid game. For normal
* multiplayer this is wasteful but there's plenty of memory. For coop and anti
* this is also wasteful, and memory is tight. They could have saved 137.5 KB.
*
* The allocation sizes need to enforce a minimum because the allocation is also
* used by lighting initialisation code.
*/
void zbufAllocate(void)
{
if (IS4MB()) {
g_ZbufWidth = 320;
g_ZbufWidth = MAX(320, FBALLOC_WIDTH_LO);
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
g_ZbufHeight = 110;
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO) / 2;
} else {
g_ZbufHeight = 220;
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_LO);
}
} else {
g_ZbufWidth = 640;
g_ZbufWidth = MAX(640, FBALLOC_WIDTH_HI);
if (g_Vars.normmplayerisrunning && PLAYERCOUNT() >= 2) {
g_ZbufHeight = 220;
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
} else {
g_ZbufHeight = 220;
g_ZbufHeight = MAX(220, FBALLOC_HEIGHT_HI);
}
}
@@ -187,7 +190,7 @@ Gfx *zbufDrawArtifactsOffscreen(Gfx *gdl)
gDPPipeSync(gdl++);
gDPSetColorImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, viGetBufWidth(), OS_PHYSICAL_TO_K0(sp44));
gDPSetScissor(gdl++, G_SC_NON_INTERLACE, 0, 0, 320, 240);
gDPSetScissor(gdl++, G_SC_NON_INTERLACE, 0, 0, SCREEN_320, SCREEN_240);
gDPSetCycleType(gdl++, G_CYC_COPY);
gDPSetTile(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, 5, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPSetTile(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0080, 4, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
@@ -217,7 +220,7 @@ Gfx *zbufDrawArtifactsOffscreen(Gfx *gdl)
image = &sp4c[artifacts[i].unk0c.u16_1 * viGetWidth()];
gDPPipeSync(gdl++);
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, image);
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_320, image);
gDPLoadSync(gdl++);
gDPLoadBlock(gdl++, 5, 0, 0, viGetWidth() - 1, 0);
gDPPipeSync(gdl++);
+34
View File
@@ -3509,6 +3509,40 @@
#define SAVEDEVICE_GAMEPAK 4
#define SAVEDEVICE_INVALID 5
// These constants are used when the game references 320 or 240 regardless of region.
// They are sometimes used for things like scissor dimensions, despite never rendering
// to these dimensions.
#define SCREEN_320 320
#define SCREEN_240 240
// The framebuffer allocation sizes are mostly the same between versions.
// Note that the height is the same regardless of lo/hi-res, but we use separate constants.
// FBALLOC_HEIGHT (without the LO/HI suffix) is used when the game references this value
// without knowing the resolution.
#define FBALLOC_WIDTH_LO 320
#define FBALLOC_HEIGHT_LO 220
#define FBALLOC_WIDTH_HI 640
#define FBALLOC_HEIGHT_HI 220
#define FBALLOC_HEIGHT 220
// Dimensions used for rendering
#if VERSION == VERSION_PAL_FINAL
#define SCREEN_WIDTH_LO 320
#define SCREEN_HEIGHT_LO 266
#define SCREEN_WIDTH_HI 448
#define SCREEN_HEIGHT_HI 266
#elif VERSION == VERSION_PAL_BETA
#define SCREEN_WIDTH_LO 320
#define SCREEN_HEIGHT_LO 252
#define SCREEN_WIDTH_HI 448
#define SCREEN_HEIGHT_HI 252
#else
#define SCREEN_WIDTH_LO 320
#define SCREEN_HEIGHT_LO 220
#define SCREEN_WIDTH_HI 640
#define SCREEN_HEIGHT_HI 220
#endif
#define SCREENRATIO_NORMAL 0
#define SCREENRATIO_16_9 1
+47 -56
View File
@@ -31,27 +31,27 @@ u8 g_ViBackIndex;
struct rend_vidat g_ViDataArray[] = {
{
0, 0, 0, 0,
320, 220, // x and y
60, // fovy
1.4545454978943f, // aspect
30, // znear
10000, // zfar
320, 220, // bufx and bufy
320, 220, // viewx and viewy
0, 0, // viewleft and viewtop
true, // usezbuf
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // x and y
60, // fovy
(f32) FBALLOC_WIDTH_LO / (f32) FBALLOC_HEIGHT_LO, // aspect
30, // znear
10000, // zfar
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // bufx and bufy
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // viewx and viewy
0, 0, // viewleft and viewtop
true, // usezbuf
0,
}, {
0, 0, 0, 0,
320, 220, // x and y
60, // fovy
1.4545454978943f, // aspect
30, // znear
10000, // zfar
320, 220, // bufx and bufy
320, 220, // viewx and viewy
0, 0, // viewleft and viewtop
true, // usezbuf
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // x and y
60, // fovy
(f32) FBALLOC_WIDTH_LO / (f32) FBALLOC_HEIGHT_LO, // aspect
30, // znear
10000, // zfar
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // bufx and bufy
FBALLOC_WIDTH_LO, FBALLOC_HEIGHT_LO, // viewx and viewy
0, 0, // viewleft and viewtop
true, // usezbuf
0,
},
};
@@ -74,13 +74,13 @@ void viConfigureForLogos(void)
#if VERSION >= VERSION_PAL_FINAL
if (IS4MB()) {
g_ViDataArray[0].y = 220;
g_ViDataArray[0].bufy = 220;
g_ViDataArray[0].viewy = 220;
g_ViDataArray[0].y = FBALLOC_HEIGHT_LO;
g_ViDataArray[0].bufy = FBALLOC_HEIGHT_LO;
g_ViDataArray[0].viewy = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].y = 220;
g_ViDataArray[1].bufy = 220;
g_ViDataArray[1].viewy = 220;
g_ViDataArray[1].y = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].bufy = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].viewy = FBALLOC_HEIGHT_LO;
var8005d588 = 0;
var8005d58c = 0;
@@ -93,13 +93,13 @@ void viConfigureForLogos(void)
var8005d58c = 0;
if (IS4MB()) {
g_ViDataArray[0].y = 220;
g_ViDataArray[0].bufy = 220;
g_ViDataArray[0].viewy = 220;
g_ViDataArray[0].y = FBALLOC_HEIGHT_LO;
g_ViDataArray[0].bufy = FBALLOC_HEIGHT_LO;
g_ViDataArray[0].viewy = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].y = 220;
g_ViDataArray[1].bufy = 220;
g_ViDataArray[1].viewy = 220;
g_ViDataArray[1].y = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].bufy = FBALLOC_HEIGHT_LO;
g_ViDataArray[1].viewy = FBALLOC_HEIGHT_LO;
}
#endif
}
@@ -145,13 +145,13 @@ void viConfigureForLegal(void)
s32 i;
for (i = 0; i < 2; i++) {
g_ViDataArray[i].x = 320;
g_ViDataArray[i].bufx = 320;
g_ViDataArray[i].viewx = 320;
g_ViDataArray[i].x = FBALLOC_WIDTH_LO;
g_ViDataArray[i].bufx = FBALLOC_WIDTH_LO;
g_ViDataArray[i].viewx = FBALLOC_WIDTH_LO;
g_ViDataArray[i].y = 220;
g_ViDataArray[i].bufy = 220;
g_ViDataArray[i].viewy = 220;
g_ViDataArray[i].y = FBALLOC_HEIGHT_LO;
g_ViDataArray[i].bufy = FBALLOC_HEIGHT_LO;
g_ViDataArray[i].viewy = FBALLOC_HEIGHT_LO;
}
g_Vars.fourmeg2player = false;
@@ -161,13 +161,8 @@ void viConfigureForLegal(void)
#endif
}
const s16 g_ViModeWidths[] = {320, 320, 640};
#if PAL
const s16 g_ViModeHeights[] = {220, 220, 504};
#else
const s16 g_ViModeHeights[] = {220, 220, 440};
#endif
const s16 g_ViModeWidths[] = {FBALLOC_WIDTH_LO, FBALLOC_WIDTH_LO, SCREEN_320 * 2};
const s16 g_ViModeHeights[] = {FBALLOC_HEIGHT_LO, FBALLOC_HEIGHT_LO, (PAL ? 252 : 220) * 2};
/**
* Allocate the colour framebuffers for the given stage.
@@ -192,7 +187,7 @@ void viReset(s32 stagenum)
if (stagenum == STAGE_TITLE || stagenum == STAGE_TEST_OLD) {
if (IS4MB()) {
viSetMode(VIMODE_HI);
fbsize = 640 * 440 * 2;
fbsize = (FBALLOC_WIDTH_LO * 2) * (FBALLOC_HEIGHT_LO * 2) * 2;
} else {
viSetMode(VIMODE_HI);
fbsize = g_ViModeWidths[2] * g_ViModeHeights[2] * 2;
@@ -202,25 +197,21 @@ void viReset(s32 stagenum)
if (1);
fbsize = IS4MB() ? 320 * 220 * 2 : 320 * 220 * 4;
fbsize = IS4MB()
? FBALLOC_WIDTH_LO * FBALLOC_HEIGHT_LO * 2
: FBALLOC_WIDTH_HI * FBALLOC_HEIGHT_HI * 2;
if (IS4MB() && PLAYERCOUNT() == 2) {
// 4MB 2-player: The viewports are 110px tall
#if VERSION >= VERSION_NTSC_1_0
fbsize = 320 * 220;
fbsize = FBALLOC_WIDTH_LO * (FBALLOC_HEIGHT_LO / 2) * 2;
#else
fbsize = 320 * 240;
fbsize = SCREEN_320 * (SCREEN_240 / 2) * 2;
#endif
g_Vars.fourmeg2player = true;
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) {
#if VERSION >= VERSION_JPN_FINAL
fbsize = 320 * 220 * 2;
#elif VERSION >= VERSION_PAL_FINAL
fbsize = 320 * 266 * 2;
#elif VERSION >= VERSION_PAL_BETA
fbsize = 320 * 252 * 2;
#else
fbsize = 320 * 220 * 2;
#endif
// PAL is using its correct size
fbsize = SCREEN_WIDTH_LO * SCREEN_HEIGHT_LO * 2;
}
}