diff --git a/Makefile b/Makefile index 1c7ae02e3..c85e70f09 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ROMID ?= ntsc-final # # If enabled, all further options are ignored and are set automatically. -MATCHING = 1 +MATCHING = 0 # COMPILER - Choose which compiler to use. # diff --git a/src/game/activemenutick.c b/src/game/activemenutick.c index ba51426b3..27654a88a 100644 --- a/src/game/activemenutick.c +++ b/src/game/activemenutick.c @@ -1045,7 +1045,7 @@ void amTick(void) } if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { - if ((buttonsstate & R_TRIG) || (buttonsstate & L_TRIG)) { + if ((buttonsstate & R_TRIG) || (buttonsstate & 0)) { stayopen = true; } @@ -1057,7 +1057,7 @@ void amTick(void) stayopen = true; } - if ((buttonsstate & R_TRIG) || (buttonsstate & L_TRIG)) { + if ((buttonsstate & R_TRIG) || (buttonsstate & 0)) { g_AmMenus[g_AmIndex].allbots = true; } } @@ -1095,19 +1095,19 @@ void amTick(void) column = 2; } - if (buttonsstate & U_JPAD) { + if (buttonsstate & 0) { row = 0; } - if (buttonsstate & D_JPAD) { + if (buttonsstate & 0) { row = 2; } - if (buttonsstate & L_JPAD) { + if (buttonsstate & 0) { column = 0; } - if (buttonsstate & R_JPAD) { + if (buttonsstate & 0) { column = 2; } @@ -1152,19 +1152,19 @@ void amTick(void) column = 2; } - if (buttonsstate2 & U_JPAD) { + if (buttonsstate2 & 0) { row = 0; } - if (buttonsstate2 & D_JPAD) { + if (buttonsstate2 & 0) { row = 2; } - if (buttonsstate2 & L_JPAD) { + if (buttonsstate2 & 0) { column = 0; } - if (buttonsstate2 & R_JPAD) { + if (buttonsstate2 & 0) { column = 2; } diff --git a/src/game/bondbike.c b/src/game/bondbike.c index e77da21cc..f46c58956 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -208,8 +208,8 @@ void bbikeApplyMoveData(struct movedata *data) || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_13 || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_11) && !lvIsPaused()) { - data->digitalstepleft = joyCountButtonsOnSpecificSamples(0, contnum, L_JPAD | L_CBUTTONS); - data->digitalstepright = joyCountButtonsOnSpecificSamples(0, contnum, R_JPAD | R_CBUTTONS); + data->digitalstepleft = joyCountButtonsOnSpecificSamples(0, contnum, 0 | L_CBUTTONS); + data->digitalstepright = joyCountButtonsOnSpecificSamples(0, contnum, 0 | R_CBUTTONS); } // Forward/back diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 96dd95937..0a129a4a7 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -736,7 +736,7 @@ void eyespyProcessInput(bool allowbuttons) exitpressed = c1buttons & R_TRIG; activatepressed = c1buttons & B_BUTTON; } else if (controlmode <= CONTROLMODE_14) { - aimpressed = c1buttons & (L_TRIG | R_TRIG); + aimpressed = c1buttons & (0 | R_TRIG); shootpressed = c1buttons & Z_TRIG; exitpressed = c1buttons & A_BUTTON; activatepressed = c1buttons & B_BUTTON; @@ -816,18 +816,18 @@ void eyespyProcessInput(bool allowbuttons) forwardspeed = c1sticky; } - ascendspeed = (c1buttons & (U_CBUTTONS | U_JPAD) ? 1 : 0) - (c1buttons & (D_CBUTTONS | D_JPAD) ? 1 : 0); - sidespeed = (c1buttons & (R_CBUTTONS | R_JPAD) ? 1 : 0) - (c1buttons & (L_CBUTTONS | L_JPAD) ? 1 : 0); + ascendspeed = (c1buttons & (U_CBUTTONS | 0) ? 1 : 0) - (c1buttons & (D_CBUTTONS | 0) ? 1 : 0); + sidespeed = (c1buttons & (R_CBUTTONS | 0) ? 1 : 0) - (c1buttons & (L_CBUTTONS | 0) ? 1 : 0); } else if (controlmode <= CONTROLMODE_14) { if (aimpressed) { domovecentre = false; pitchspeed = c1sticky; } else { ascendspeed = c1sticky * 0.25f; - forwardspeed = (c1buttons & (U_CBUTTONS | U_JPAD) ? 24.0f : 0) - (c1buttons & (D_CBUTTONS | D_JPAD) ? 24.0f : 0); + forwardspeed = (c1buttons & (U_CBUTTONS | 0) ? 24.0f : 0) - (c1buttons & (D_CBUTTONS | 0) ? 24.0f : 0); } - sidespeed = (c1buttons & (R_CBUTTONS | R_JPAD) ? 1 : 0) - (c1buttons & (L_CBUTTONS | L_JPAD) ? 1 : 0); + sidespeed = (c1buttons & (R_CBUTTONS | 0) ? 1 : 0) - (c1buttons & (L_CBUTTONS | 0) ? 1 : 0); } else if (controlmode == CONTROLMODE_21 || controlmode == CONTROLMODE_23) { forwardspeed = c1sticky; diff --git a/src/game/bondmove.c b/src/game/bondmove.c index e8e554b7c..221825844 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1091,10 +1091,10 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { shootbuttons = A_BUTTON; aimbuttons = Z_TRIG; - invbuttons = L_TRIG | R_TRIG; + invbuttons = 0 | R_TRIG; } else { shootbuttons = Z_TRIG; - aimbuttons = L_TRIG | R_TRIG; + aimbuttons = 0 | R_TRIG; invbuttons = A_BUTTON; } @@ -1132,23 +1132,23 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i // Handle side stepping if (g_Vars.currentplayer->insightaimmode == false) { if (allowc1buttons) { - movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); - movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); + movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (0 | L_CBUTTONS)); + movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (0 | R_CBUTTONS)); } } else { // This doesn't appear to be r-leaning. // R-leaning still works when these are commented. - if (c1buttons & (L_JPAD | L_CBUTTONS)) { + if (c1buttons & (0 | L_CBUTTONS)) { movedata.unk30 = 1; } - if (c1buttons & (R_JPAD | R_CBUTTONS)) { + if (c1buttons & (0 | R_CBUTTONS)) { movedata.unk34 = 1; } } - movedata.digitalstepforward = !g_Vars.currentplayer->insightaimmode && (c1buttons & (U_JPAD | U_CBUTTONS)); - movedata.digitalstepback = !g_Vars.currentplayer->insightaimmode && (c1buttons & (D_JPAD | D_CBUTTONS)); + movedata.digitalstepforward = !g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | U_CBUTTONS)); + movedata.digitalstepback = !g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | D_CBUTTONS)); movedata.canlookahead = false; movedata.cannaturalpitch = !g_Vars.currentplayer->insightaimmode; movedata.speedvertadown = 0; @@ -1165,17 +1165,17 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } else { // 1.1 or 1.3 - if (c1buttons & (L_JPAD | L_CBUTTONS)) { + if (c1buttons & (0 | L_CBUTTONS)) { movedata.unk30 = 1; } - if (c1buttons & (R_JPAD | R_CBUTTONS)) { + if (c1buttons & (0 | R_CBUTTONS)) { movedata.unk34 = 1; } if (!g_Vars.currentplayer->insightaimmode && allowc1buttons) { - movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); - movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); + movedata.digitalstepleft = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (0 | L_CBUTTONS)); + movedata.digitalstepright = joyCountButtonsOnSpecificSamples(aimoffhist, contpad1, c1allowedbuttons & (0 | R_CBUTTONS)); } movedata.digitalstepforward = false; @@ -1184,11 +1184,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i movedata.cannaturalpitch = false; // Looking up/down - if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (U_JPAD | U_CBUTTONS))) { + if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | U_CBUTTONS))) { movedata.speedvertadown = 1; } - if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (D_JPAD | D_CBUTTONS))) { + if (!g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | D_CBUTTONS))) { movedata.speedvertaup = 1; } @@ -1320,8 +1320,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i // Handle manual zoom in and out (sniper, farsight and horizon scanner) if (canmanualzoom && g_Vars.currentplayer->insightaimmode) { increment = 1; - zoomout = c1buttons & (D_JPAD | D_CBUTTONS); - zoomin = c1buttons & (U_JPAD | U_CBUTTONS); + zoomout = c1buttons & (0 | D_CBUTTONS); + zoomin = c1buttons & (0 | U_CBUTTONS); // @bug? Should this be HAND_RIGHT? if (bgunGetWeaponNum(HAND_LEFT) == WEAPON_FARSIGHT) { @@ -1341,7 +1341,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i if (allowc1buttons) { for (i = 0; i < numsamples; i++) { if (!canmanualzoom && aimonhist[i]) { - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_JPAD | U_CBUTTONS))) { + if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (0 | U_CBUTTONS))) { if (movedata.crouchdown) { movedata.crouchdown--; } else { @@ -1351,7 +1351,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->aimtaptime = -1; } - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS))) { + if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (0 | D_CBUTTONS))) { if (movedata.crouchup) { movedata.crouchup--; } else { @@ -1391,14 +1391,14 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i && g_Vars.coopplayernum <= -1) { movedata.eyesshut = g_Vars.currentplayer->insightaimmode && !canmanualzoom - && joyGetButtons(contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS)); + && joyGetButtons(contpad1, c1allowedbuttons & (0 | D_CBUTTONS)); } if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT) { - movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_CBUTTONS | R_CBUTTONS | L_JPAD | R_JPAD)); + movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_CBUTTONS | R_CBUTTONS | 0 | 0)); } else { - movedata.rleanleft = g_Vars.currentplayer->insightaimmode && (c1buttons & (L_JPAD | L_CBUTTONS)); - movedata.rleanright = g_Vars.currentplayer->insightaimmode && (c1buttons & (R_JPAD | R_CBUTTONS)); + movedata.rleanleft = g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | L_CBUTTONS)); + movedata.rleanright = g_Vars.currentplayer->insightaimmode && (c1buttons & (0 | R_CBUTTONS)); } // Handle mine detonation diff --git a/src/game/bondview.c b/src/game/bondview.c index cfc0f99f0..974cffcba 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -1259,32 +1259,32 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) // Up if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; \ - if (buttonsdown & (U_JPAD | U_CBUTTONS)) { \ + if (buttonsdown & (0 | U_CBUTTONS)) { \ brightness += 20; \ } \ - if (buttonsthisframe & (U_JPAD | U_CBUTTONS)) { \ + if (buttonsthisframe & (0 | U_CBUTTONS)) { \ brightness += 20; \ } \ gDPSetPrimColor(gdl++, 0, 0, 0, brightness, 0, 0xff); \ } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (U_JPAD | U_CBUTTONS)) { + if (buttonsdown & (0 | U_CBUTTONS)) { brightness += 63; } - if (buttonsthisframe & (U_JPAD | U_CBUTTONS)) { + if (buttonsthisframe & (0 | U_CBUTTONS)) { brightness += 63; \ } \ gDPSetPrimColor(gdl++, 0, 0, 0x10, 0x20, brightness, 0xff); } else { brightness = 20; - if (buttonsdown & (U_JPAD | U_CBUTTONS)) { + if (buttonsdown & (0 | U_CBUTTONS)) { brightness += 20; } - if (buttonsthisframe & (U_JPAD | U_CBUTTONS)) { + if (buttonsthisframe & (0 | U_CBUTTONS)) { brightness += 20; \ } \ gDPSetPrimColor(gdl++, 0, 0, brightness, brightness >> 2, 0, 0xff); @@ -1297,10 +1297,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (D_JPAD | D_CBUTTONS)) { \ + if (buttonsdown & (0 | D_CBUTTONS)) { \ brightness += 20; \ } \ - if (buttonsthisframe & (D_JPAD | D_CBUTTONS)) { + if (buttonsthisframe & (0 | D_CBUTTONS)) { brightness += 20; } @@ -1308,11 +1308,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (D_JPAD | D_CBUTTONS)) { + if (buttonsdown & (0 | D_CBUTTONS)) { brightness += 63; } - if (buttonsthisframe & (D_JPAD | D_CBUTTONS)) { + if (buttonsthisframe & (0 | D_CBUTTONS)) { brightness += 63; } @@ -1320,11 +1320,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (D_JPAD | D_CBUTTONS)) { + if (buttonsdown & (0 | D_CBUTTONS)) { brightness += 20; } - if (buttonsthisframe & (D_JPAD | D_CBUTTONS)) { + if (buttonsthisframe & (0 | D_CBUTTONS)) { brightness += 20; } @@ -1338,10 +1338,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (L_JPAD | L_CBUTTONS)) { \ + if (buttonsdown & (0 | L_CBUTTONS)) { \ brightness += 20; \ } \ - if (buttonsthisframe & (L_JPAD | L_CBUTTONS)) { + if (buttonsthisframe & (0 | L_CBUTTONS)) { brightness += 20; } @@ -1349,11 +1349,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (L_JPAD | L_CBUTTONS)) { + if (buttonsdown & (0 | L_CBUTTONS)) { brightness += 63; } - if (buttonsthisframe & (L_JPAD | L_CBUTTONS)) { + if (buttonsthisframe & (0 | L_CBUTTONS)) { brightness += 63; } @@ -1361,11 +1361,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (L_JPAD | L_CBUTTONS)) { + if (buttonsdown & (0 | L_CBUTTONS)) { brightness += 20; } - if (buttonsthisframe & (L_JPAD | L_CBUTTONS)) { + if (buttonsthisframe & (0 | L_CBUTTONS)) { brightness += 20; } @@ -1379,10 +1379,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (R_JPAD | R_CBUTTONS)) { \ + if (buttonsdown & (0 | R_CBUTTONS)) { \ brightness += 20; \ } \ - if (buttonsthisframe & (R_JPAD | R_CBUTTONS)) { + if (buttonsthisframe & (0 | R_CBUTTONS)) { brightness += 20; } @@ -1390,11 +1390,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (R_JPAD | R_CBUTTONS)) { + if (buttonsdown & (0 | R_CBUTTONS)) { brightness += 63; } - if (buttonsthisframe & (R_JPAD | R_CBUTTONS)) { + if (buttonsthisframe & (0 | R_CBUTTONS)) { brightness += 63; } @@ -1402,11 +1402,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (R_JPAD | R_CBUTTONS)) { + if (buttonsdown & (0 | R_CBUTTONS)) { brightness += 20; } - if (buttonsthisframe & (R_JPAD | R_CBUTTONS)) { + if (buttonsthisframe & (0 | R_CBUTTONS)) { brightness += 20; } @@ -1420,10 +1420,10 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { brightness = 20; - if (buttonsdown & (L_TRIG | R_TRIG)) { \ + if (buttonsdown & (0 | R_TRIG)) { \ brightness += 20; \ } \ - if (buttonsthisframe & (L_TRIG | R_TRIG)) { + if (buttonsthisframe & (0 | R_TRIG)) { brightness += 20; } @@ -1431,11 +1431,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { brightness = 127; - if (buttonsdown & (L_TRIG | R_TRIG)) { + if (buttonsdown & (0 | R_TRIG)) { brightness += 63; } - if (buttonsthisframe & (L_TRIG | R_TRIG)) { + if (buttonsthisframe & (0 | R_TRIG)) { brightness += 63; } @@ -1443,11 +1443,11 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) } else { brightness = 20; - if (buttonsdown & (L_TRIG | R_TRIG)) { + if (buttonsdown & (0 | R_TRIG)) { brightness += 20; } - if (buttonsthisframe & (L_TRIG | R_TRIG)) { + if (buttonsthisframe & (0 | R_TRIG)) { brightness += 20; } diff --git a/src/game/credits.c b/src/game/credits.c index 4acfbc1fd..d3bf4de5f 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -684,7 +684,7 @@ void creditsTickParticles(void) } } else { #if VERSION >= VERSION_NTSC_1_0 - if (RANDOMFRAC() < 0.007f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) { + if (RANDOMFRAC() < 0.007f && joyGetButtons(0, 0 | R_TRIG) == 0) { g_CreditsData->particlecolourindex1 = random() % 4; g_CreditsData->particlecolourweight = 0; } @@ -697,7 +697,7 @@ void creditsTickParticles(void) } #if VERSION >= VERSION_NTSC_1_0 - if (RANDOMFRAC() < 0.002f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) { + if (RANDOMFRAC() < 0.002f && joyGetButtons(0, 0 | R_TRIG) == 0) { g_CreditsData->particlemovetype = random() % 5; } #else @@ -1681,7 +1681,7 @@ void creditsTick(void) static u32 type = 0xffff; #if VERSION >= VERSION_NTSC_1_0 - if (joyGetButtonsPressedThisFrame(0, L_TRIG)) { + if (joyGetButtonsPressedThisFrame(0, 0)) { creditsCreatePendingBgLayers(0xffffffff); } #endif @@ -1721,7 +1721,7 @@ void creditsTick(void) if (g_CreditsData->slidesenabled) { creditsTickSlide(); - } else if (RANDOMFRAC() < 0.01f && !joyGetButtons(0, L_TRIG | R_TRIG)) { + } else if (RANDOMFRAC() < 0.01f && !joyGetButtons(0, 0 | R_TRIG)) { creditsCreatePendingBgLayers(0xffffffff); } diff --git a/src/game/lv.c b/src/game/lv.c index 02f4c28a6..4c048d23d 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -950,6 +950,155 @@ void lvFindThreats(void) } } +u8 g_LvShowRates = 0; +u8 g_LvAntialias = 1; +u8 g_LvRateIndex = 59; +u8 g_LvFrameRates[60]; + +void lvRecordRate(void) +{ + g_LvFrameRates[g_LvRateIndex] = OS_CPU_COUNTER / g_Vars.diffframet; + + g_LvRateIndex++; + + if (g_LvRateIndex >= 60) { + g_LvRateIndex = 0; + } +} + +Gfx *func0f153134(Gfx *gdl); + +Gfx *lvPrintRateGraph(Gfx *gdl) +{ + s32 i; + s32 top = 10; + s32 bottom = 70; + s32 x; + s32 y; + + gdl = func0f153134(gdl); + + // graph data + gdl = textSetPrimColour(gdl, 0x00ff00a0); + + for (i = 0; i < 60; i++) { + s32 index = (g_LvRateIndex + i) % 60; + + x = 10 + i * 2; + y = top + 60 - g_LvFrameRates[index]; + + gDPFillRectangleScaled(gdl++, x, y, x + 2, bottom); + } + + gdl = text0f153838(gdl); + + // grid lines + gdl = textSetPrimColour(gdl, 0x000000a0); + + gDPFillRectangleScaled(gdl++, 10, 10, 130, 11); + gDPFillRectangleScaled(gdl++, 10, 20, 130, 21); + gDPFillRectangleScaled(gdl++, 10, 30, 130, 31); + gDPFillRectangleScaled(gdl++, 10, 40, 130, 41); + gDPFillRectangleScaled(gdl++, 10, 50, 130, 51); + gDPFillRectangleScaled(gdl++, 10, 60, 130, 61); + gDPFillRectangleScaled(gdl++, 10, 70, 130, 71); + + // labels + gdl = func0f0d479c(gdl); + + if (g_FontHandelGothicXs) { + x = 120 + 15; + y = 7; + gdl = textRender(gdl, &x, &y, "60", g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + + x = 120 + 15; + y = 37; + gdl = textRender(gdl, &x, &y, "30", g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + } + + return gdl; +} + +Gfx *lvPrintRateText(Gfx *gdl) +{ + if (g_FontHandelGothicXs) { + char buffer[64]; + s32 x = 10; + s32 y = 80; + s32 i; + s32 sum = 0; + s32 count = 0; + u32 min = 0xffffffff; + u32 max = 0; + + for (i = 0; i < 60; i++) { + if (g_LvFrameRates[i]) { + sum += g_LvFrameRates[i]; + count++; + + if (g_LvFrameRates[i] < min) { + min = g_LvFrameRates[i]; + } + + if (g_LvFrameRates[i] > max) { + max = g_LvFrameRates[i]; + } + } + } + + if (count) { + x = 10; + sprintf(buffer, "min %d", min); + gdl = textRender(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + + x = 50; + sprintf(buffer, "max %d", max); + gdl = textRender(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + + x = 90; + sprintf(buffer, "avg %d", sum / count); + gdl = textRender(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + + x = 130; + sprintf(buffer, "cur %d\n\n", (s32) (OS_CPU_COUNTER / g_Vars.diffframet)); + gdl = textRender(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + } + + x = 10; + sprintf(buffer, "Antialias %s\n", g_LvAntialias ? "on" : "off"); + gdl = textRender(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0); + } + + return gdl; +} + +Gfx *lvPrint(Gfx *gdl) +{ + if (joyGetButtonsPressedThisFrame(0, L_TRIG)) { + g_LvShowRates = 1 - g_LvShowRates; + } + + if (joyGetButtonsPressedThisFrame(0, U_JPAD)) { + g_LvAntialias = 1 - g_LvAntialias; + viUpdateMode(); + } + + lvRecordRate(); + + if (g_LvShowRates) { + g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + + gdl = text0f153628(gdl); + gdl = lvPrintRateGraph(gdl); + gdl = lvPrintRateText(gdl); + gdl = text0f153780(gdl); + + g_ScaleX = 1; + } + + return gdl; +} + /** * Renders a complete frame for all players, and also does some other game logic * that really doesn't belong here. @@ -1724,6 +1873,8 @@ Gfx *lvRender(Gfx *gdl) } #endif + gdl = lvPrint(gdl); + return gdl; } diff --git a/src/game/menu.c b/src/game/menu.c index 32d1239f4..ecf6c3fb1 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -2139,7 +2139,7 @@ Gfx *menuRenderModels(Gfx *gdl, struct menu840 *thing, s32 arg2) modelGetRootPosition(&thing->bodymodel, &oldpos); - if (joyGetButtons(0, L_TRIG)) { + if (joyGetButtons(0, 0)) { modelSetRootPosition(&thing->bodymodel, &newpos); } } @@ -6802,7 +6802,7 @@ void menuProcessInput(void) inputs.shoulder = 1; } - if (buttons & L_TRIG) { + if (buttons & 0) { inputs.shoulder = 1; } @@ -6846,35 +6846,35 @@ void menuProcessInput(void) xtapdir = 1; } - if (buttons & U_JPAD) { + if (buttons & 0) { yhelddir = -1; } - if (buttonsnow & U_JPAD) { + if (buttonsnow & 0) { ytapdir = -1; } - if (buttons & D_JPAD) { + if (buttons & 0) { yhelddir = 1; } - if (buttonsnow & D_JPAD) { + if (buttonsnow & 0) { ytapdir = 1; } - if (buttons & L_JPAD) { + if (buttons & 0) { xhelddir = -1; } - if (buttonsnow & L_JPAD) { + if (buttonsnow & 0) { xtapdir = -1; } - if (buttons & R_JPAD) { + if (buttons & 0) { xhelddir = 1; } - if (buttonsnow & R_JPAD) { + if (buttonsnow & 0) { xtapdir = 1; } } diff --git a/src/game/player.c b/src/game/player.c index ff69e373d..f9847ac8e 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3824,7 +3824,7 @@ void playerTick(bool arg0) explode = true; } - if (joyGetButtons(contpad1, B_BUTTON | Z_TRIG | L_TRIG | R_TRIG)) { + if (joyGetButtons(contpad1, B_BUTTON | Z_TRIG | 0 | R_TRIG)) { slow = true; } } else { @@ -3832,7 +3832,7 @@ void playerTick(bool arg0) explode = true; } - if (joyGetButtons(contpad1, A_BUTTON | B_BUTTON | L_TRIG | R_TRIG)) { + if (joyGetButtons(contpad1, A_BUTTON | B_BUTTON | 0 | R_TRIG)) { slow = true; } } @@ -4396,7 +4396,7 @@ void playerTick(bool arg0) if (!lvIsPaused() && arg0 - && joyGetButtonsPressedThisFrame(contpad1, A_BUTTON | B_BUTTON | Z_TRIG | START_BUTTON | L_TRIG | R_TRIG)) { + && joyGetButtonsPressedThisFrame(contpad1, A_BUTTON | B_BUTTON | Z_TRIG | START_BUTTON | 0 | R_TRIG)) { var8007074c = 2; if (playerIsFadeComplete()) { diff --git a/src/lib/sched.c b/src/lib/sched.c index dc813e789..543dc15fe 100644 --- a/src/lib/sched.c +++ b/src/lib/sched.c @@ -594,6 +594,8 @@ OSScTask *__scTaskReady(OSScTask *t) return 0; } +extern u8 g_LvAntialias; + /* * __scTaskComplete checks to see if the task is complete (all RCP * operations have been performed) and sends the done message to the @@ -620,6 +622,7 @@ s32 __scTaskComplete(OSSched *sc, OSScTask *t) || var8008dd60[1 - var8005ce74]->fldRegs[0].origin != var8008dcc0[1 - var8005ce74].fldRegs[0].origin || var8008dd60[1 - var8005ce74]->fldRegs[1].origin != var8008dcc0[1 - var8005ce74].fldRegs[1].origin) { s32 mask = osSetIntMask(0x80401); + u32 features; *var8008dd60[1 - var8005ce74] = var8008dcc0[1 - var8005ce74]; @@ -629,7 +632,16 @@ s32 __scTaskComplete(OSSched *sc, OSScTask *t) osViBlack(g_ViUnblackTimer); osViSetXScale(g_ViXScalesBySlot[1 - var8005ce74]); osViSetYScale(g_ViYScalesBySlot[1 - var8005ce74]); - osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); + + features = OS_VI_GAMMA_OFF; + + if (g_LvAntialias) { + features |= OS_VI_DITHER_FILTER_ON; + } else { + features |= OS_VI_DITHER_FILTER_OFF; + } + + osViSetSpecialFeatures(features); } g_SchedViModesPending[1 - var8005ce74] = false; diff --git a/src/lib/vi.c b/src/lib/vi.c index fdd79b828..b384e3259 100644 --- a/src/lib/vi.c +++ b/src/lib/vi.c @@ -257,11 +257,14 @@ void viBlack(bool black) g_ViUnblackTimer = black; } +extern u8 g_LvAntialias; + void vi00009ed4(void) { s32 prevmask; s32 offset; s32 reg; + u32 features; if (g_ViShakeTimer != 0) { g_ViShakeTimer--; @@ -292,7 +295,16 @@ void vi00009ed4(void) osViBlack(g_ViUnblackTimer); osViSetXScale(g_ViXScalesBySlot[1 - var8005ce74]); osViSetYScale(g_ViYScalesBySlot[1 - var8005ce74]); - osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); + + features = OS_VI_GAMMA_OFF; + + if (g_LvAntialias) { + features |= OS_VI_DITHER_FILTER_ON; + } else { + features |= OS_VI_DITHER_FILTER_OFF; + } + + osViSetSpecialFeatures(features); } #if MATCHING