From 55f688b13f2ede3541003790ae2da12f4dd2507f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 08:00:50 +1000 Subject: [PATCH 01/12] - SW: Rename `q16horz` to `q16horiz` and `q16aimvel` to `q16horz` for consistency and to avoid confusion down the track. --- source/core/packet.h | 2 +- source/sw/src/input.cpp | 18 +++++++++--------- source/sw/src/network.cpp | 12 ++++++------ source/sw/src/player.cpp | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/core/packet.h b/source/core/packet.h index 2727a960b..15f0afb0d 100644 --- a/source/core/packet.h +++ b/source/core/packet.h @@ -173,7 +173,7 @@ struct InputPacket int16_t fvel; fix16_t q16avel; fix16_t q16horz; - fix16_t q16aimvel; // only used by SW + fix16_t q16horiz; // only used by SW fix16_t q16ang; // only used by SW // Making this a union lets some constructs fail. Since these names are transitional only the added memory use doesn't really matter. diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 06e386318..05d610851 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -75,7 +75,7 @@ double elapsedInputTicks; double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000.0 / elapsedInputTicks); } void DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel); -void DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel); +void DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16horz); void GameInterface::ResetFollowPos(bool) @@ -195,7 +195,7 @@ getinput(InputPacket *loc, SWBOOL tied) keymove = 0; int32_t svel = 0, vel = 0; - fix16_t q16aimvel = 0, q16angvel = 0; + fix16_t q16horz = 0, q16angvel = 0; if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { @@ -209,14 +209,14 @@ getinput(InputPacket *loc, SWBOOL tied) } if (mouseaim) - q16aimvel = fix16_ssub(q16aimvel, fix16_from_float(info.mousey / aimvelScale)); + q16horz = fix16_ssub(q16horz, fix16_from_float(info.mousey / aimvelScale)); else vel -= (info.mousey * ticrateScale) * 8.f; if (in_mouseflip) - q16aimvel = -q16aimvel; + q16horz = -q16horz; - q16aimvel -= fix16_from_dbl(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); + q16horz -= fix16_from_dbl(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); svel -= info.dx * keymove; vel -= info.dz * keymove; @@ -276,13 +276,13 @@ getinput(InputPacket *loc, SWBOOL tied) vel += -keymove; q16angvel = fix16_clamp(q16angvel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL)); - q16aimvel = fix16_clamp(q16aimvel, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); + q16horz = fix16_clamp(q16horz, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); void DoPlayerTeleportPause(PLAYERp pp); if (PedanticMode) { q16angvel = fix16_floor(q16angvel); - q16aimvel = fix16_floor(q16aimvel); + q16horz = fix16_floor(q16horz); } else { @@ -291,7 +291,7 @@ getinput(InputPacket *loc, SWBOOL tied) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) DoPlayerTurn(pp, &pp->camq16ang, q16angvel); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->camq16horiz, q16aimvel); + DoPlayerHorizon(pp, &pp->camq16horiz, q16horz); pp->oq16ang += pp->camq16ang - prevcamq16ang; pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; } @@ -315,7 +315,7 @@ getinput(InputPacket *loc, SWBOOL tied) } loc->q16avel += q16angvel; - loc->q16aimvel += q16aimvel; + loc->q16horz += q16horz; if (!CommEnabled) { diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index e1fa0c5f9..673c7cb0c 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -80,9 +80,9 @@ typedef struct int32_t fvel; int32_t svel; fix16_t q16avel; - fix16_t q16aimvel; - fix16_t q16ang; fix16_t q16horz; + fix16_t q16ang; + fix16_t q16horiz; int32_t bits; } SW_AVERAGE_PACKET; @@ -200,9 +200,9 @@ UpdateInputs(void) AveragePacket.fvel += loc.fvel; AveragePacket.svel += loc.svel; AveragePacket.q16avel += loc.q16avel; - AveragePacket.q16aimvel += loc.q16aimvel; + AveragePacket.q16horz += loc.q16horz; AveragePacket.q16ang = Player[myconnectindex].camq16ang; - AveragePacket.q16horz = Player[myconnectindex].camq16horiz; + AveragePacket.q16horiz = Player[myconnectindex].camq16horiz; SET(AveragePacket.bits, loc.bits); Bmemset(&loc, 0, sizeof(loc)); @@ -222,9 +222,9 @@ UpdateInputs(void) loc.fvel = AveragePacket.fvel / MovesPerPacket; loc.svel = AveragePacket.svel / MovesPerPacket; loc.q16avel = fix16_div(AveragePacket.q16avel, fix16_from_int(MovesPerPacket)); - loc.q16aimvel = fix16_div(AveragePacket.q16aimvel, fix16_from_int(MovesPerPacket)); + loc.q16horz = fix16_div(AveragePacket.q16horz, fix16_from_int(MovesPerPacket)); loc.q16ang = AveragePacket.q16ang; - loc.q16horz = AveragePacket.q16horz; + loc.q16horiz = AveragePacket.q16horiz; loc.bits = AveragePacket.bits; memset(&AveragePacket, 0, sizeof(AveragePacket)); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index bfe7944e6..a186c6695 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1911,7 +1911,7 @@ PlayerAutoLook(PLAYERp pp) extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; void -DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) +DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16horz) { int i; #define HORIZ_SPEED (16) @@ -1922,7 +1922,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) if (!PedanticMode && (pq16horiz == &pp->q16horiz)) { SET(pp->Flags2, PF2_INPUT_CAN_AIM); - pp->q16horiz = pp->input.q16horz; + pp->q16horiz = pp->input.q16horiz; if ((pp == &Player[myconnectindex]) || (pp == ppp)) // No coop view? pp->oq16horiz = pp->q16horiz; return; @@ -1932,9 +1932,9 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) if (cl_slopetilting) PlayerAutoLook(pp); - if (q16aimvel) + if (q16horz) { - pp->q16horizbase += q16aimvel; + pp->q16horizbase += q16horz; SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); } @@ -2717,7 +2717,7 @@ DoPlayerMove(PLAYERp pp) DoPlayerSetWadeDepth(pp); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA)) { @@ -2925,7 +2925,7 @@ DoPlayerMoveBoat(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); } void DoTankTreads(PLAYERp pp) @@ -3404,7 +3404,7 @@ DoPlayerMoveTank(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); DoTankTreads(pp); } @@ -3421,7 +3421,7 @@ DoPlayerMoveTurret(PLAYERp pp) OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->sop->xmid, pp->sop->ymid); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); } void @@ -3998,7 +3998,7 @@ DoPlayerClimb(PLAYERp pp) sp->z = pp->posz + PLAYER_HEIGHT; changespritesect(pp->PlayerSprite, pp->cursectnum); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); + DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); if (FAF_ConnectArea(pp->cursectnum)) { @@ -7426,7 +7426,7 @@ void ChopsCheck(PLAYERp pp) { if (!M_Active() && !TEST(pp->Flags, PF_DEAD) && !pp->sop_riding && numplayers <= 1) { - if ((pp->input.bits|pp->input.fvel|pp->input.svel|pp->input.q16avel|pp->input.q16aimvel) || + if ((pp->input.bits|pp->input.fvel|pp->input.svel|pp->input.q16avel|pp->input.q16horz) || TEST(pp->Flags, PF_CLIMBING|PF_FALLING|PF_DIVING)) { // Hit a input key or other reason to stop chops From 3e79e7b63fb34bfd41c21027b06c86f9316a5551 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 15:54:49 +1000 Subject: [PATCH 02/12] - Duke: Fix bug where player wasn't cracking knuckles after 777 idle tics while `cl_syncinput` was 1. * Use opportunity to replace the literal constant of `777` with an enum. --- source/games/duke/src/constants.h | 6 ++++++ source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 14 ++++++-------- source/games/duke/src/player_r.cpp | 10 +++++----- source/games/duke/src/player_w.cpp | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 64822083a..f92d01249 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -425,6 +425,12 @@ enum TRIPBOMB_TIMER = 2 }; +// Miscellaenous constants in use throughout the game. +enum +{ + CRACK_TIME = 777 +}; + // World tour enum EFlamethrowerState { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 701d92123..b4d2fec61 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -732,7 +732,7 @@ void playerCrouch(int snum) if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { p->posz += (2048 + 768); - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index d3b8a5d1c..1c1b617f7 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -112,7 +112,7 @@ void shoot_d(int i, int atwith) sz = ps[p].posz + ps[p].pyoff + (4 << 8); sa = ps[p].getang(); - ps[p].crack_time = 777; + ps[p].crack_time = CRACK_TIME; } else @@ -1352,7 +1352,7 @@ int doincrements_d(struct player_struct* p) if (p->crack_time == 0) { p->knuckle_incs = 1; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1586,7 +1586,7 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz, if (GetGameVarID(g_iReturnVarID, pi, snum) == 0) { p->posz -= j; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1598,7 +1598,7 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz, if (GetGameVarID(g_iReturnVarID, pi, snum) == 0) { p->posz += j; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1945,7 +1945,7 @@ static void fireweapon(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) { @@ -2787,8 +2787,6 @@ void processinput_d(int snum) // may still be needed later for demo recording applylook(snum, 1, sb_avel); - - p->crack_time = 777; } if (p->spritebridge == 0) @@ -2832,7 +2830,7 @@ void processinput_d(int snum) if (p->posxv || p->posyv || sb_fvel || sb_svel) { - p->crack_time = 777; + p->crack_time = CRACK_TIME; k = sintable[p->bobcounter & 2047] >> 12; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 882a935fc..be78fb476 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -107,7 +107,7 @@ void shoot_r(int i, int atwith) sz = ps[p].posz + ps[p].pyoff + (4 << 8); sa = ps[p].getang(); - if (isRRRA()) ps[p].crack_time = 777; + if (isRRRA()) ps[p].crack_time = CRACK_TIME; } else { @@ -1284,7 +1284,7 @@ int doincrements_r(struct player_struct* p) if (p->crack_time == 0) { p->knuckle_incs = 1; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -2612,7 +2612,7 @@ static void fireweapon(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) { @@ -3699,7 +3699,7 @@ void processinput_r(int snum) applylook(snum, 1, sb_avel); - p->crack_time = 777; + p->crack_time = CRACK_TIME; } if (p->spritebridge == 0) @@ -3725,7 +3725,7 @@ void processinput_r(int snum) if (p->posxv || p->posyv || sb_fvel || sb_svel) { - p->crack_time = 777; + p->crack_time = CRACK_TIME; k = sintable[p->bobcounter & 2047] >> 12; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index cc23579be..47761a891 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -144,7 +144,7 @@ void fireweapon_ww(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) { From 65a54361b46a5eede8f5abff5a3011a78adf2e84 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 15:55:32 +1000 Subject: [PATCH 03/12] - Duke: Apply same fix in 3e79e7b63fb34bfd41c21027b06c86f9316a5551 for RR, accidentally missed. --- source/games/duke/src/player_r.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index be78fb476..cf9ca5844 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3698,8 +3698,6 @@ void processinput_r(int snum) // may still be needed later for demo recording applylook(snum, 1, sb_avel); - - p->crack_time = CRACK_TIME; } if (p->spritebridge == 0) From a2b51edcdb5c3771fa9f56dbcf7cc1146420c197 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 16:09:18 +1000 Subject: [PATCH 04/12] - Duke: Delete enum created in 3e79e7b63fb34bfd41c21027b06c86f9316a5551 and move `CRACK_TIME` to `miscConstants`. * Didn't have a very good look, apparently... --- source/games/duke/src/constants.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index f92d01249..26c96e051 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -408,6 +408,8 @@ enum miscConstants MAXTORCHSECTORS = 64, MAXGEOSECTORS = 64, + CRACK_TIME = 777, + DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, }; @@ -425,12 +427,6 @@ enum TRIPBOMB_TIMER = 2 }; -// Miscellaenous constants in use throughout the game. -enum -{ - CRACK_TIME = 777 -}; - // World tour enum EFlamethrowerState { From 8bb13bc4c25e21d94b095c42a12b0750399f2505 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 17:29:40 +1000 Subject: [PATCH 05/12] - InputState: Exclude volume keys from setting `AnyKeyStatus` to true. --- source/common/console/keydef.h | 3 +++ source/core/inputstate.cpp | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/source/common/console/keydef.h b/source/common/console/keydef.h index d85adefac..2cbdf621b 100644 --- a/source/common/console/keydef.h +++ b/source/common/console/keydef.h @@ -53,6 +53,9 @@ enum EKeyCodes KEY_PGUP = 0xc9, // DIK_PRIOR KEY_PGDN = 0xd1, // DIK_NEXT + KEY_VOLUMEDOWN = 0xAE, // DIK_VOLUMEDOWN + KEY_VOLUMEUP = 0xB0, // DIK_VOLUMEUP + KEY_FIRSTMOUSEBUTTON = 0x100, KEY_MOUSE1 = 0x100, KEY_MOUSE2 = 0x101, diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index d24afb35a..c4b7c71f8 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -86,14 +86,32 @@ void InputState::GetMouseDelta(ControlInfo * info) // //========================================================================== +static int exclKeys[] = { KEY_VOLUMEDOWN, KEY_VOLUMEUP }; + void InputState::AddEvent(const event_t *ev) { if (ev->type == EV_KeyDown || ev->type == EV_KeyUp) { int key = ev->data1; bool state = ev->type == EV_KeyDown; + bool ignore = false; KeyStatus[key] = (uint8_t)state; - if (state && !(key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT)) + + // Check if key is to be excluded from setting AnyKeyStatus. + for (int i = 0; i < 2; i++) + { + if (exclKeys[i] == key) + { + ignore = true; + break; + } + } + if (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT) + { + ignore = true; + } + + if (state && !ignore) AnyKeyStatus = true; } } From 0c55c3983c2af4347e73c0b40daa533af20a2733 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 22:47:18 +1000 Subject: [PATCH 06/12] - Duke: Fix potential interpolation issues for RR's shotgun observed while working on something else. --- source/games/duke/src/player_r.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index cf9ca5844..9e3223e3c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2994,7 +2994,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect) S_PlayActorSound(SHOTGUN_COCK, pi); break; case 38: - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->shotgun_state[0] = 0; p->shotgun_state[1] = 0; return; @@ -3006,7 +3006,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect) { case 16: checkavailweapon(p); - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->shotgun_state[0] = 1; p->shotgun_state[1] = 0; return; From 97feb483ab1c78cc6d88b891c80e5fa481afb9a2 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 28 Aug 2020 15:27:16 +1000 Subject: [PATCH 07/12] - Set frame-time as close to the buffer swap as possible, and calculate smoothratio for Duke/SW as late as possible. * Micro-optimisation, but was getting a very occasional jitter in Duke 3D that seems to have gone with this. --- source/build/src/engine.cpp | 1 + source/core/gamecontrol.cpp | 1 - source/games/duke/src/gameloop.cpp | 3 +-- source/sw/src/game.cpp | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 42ce85175..01086eb35 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -2724,6 +2724,7 @@ void videoNextPage(void) { g_beforeSwapTime = I_msTimeF(); videoShowFrame(0); + I_SetFrameTime(); omdtims = mdtims; mdtims = I_msTime(); diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 2f53733b4..14b69bf59 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -941,7 +941,6 @@ void app_loop() TickSubsystems(); twod->SetSize(screen->GetWidth(), screen->GetHeight()); twodpsp.SetSize(screen->GetWidth(), screen->GetHeight()); - I_SetFrameTime(); handleevents(); updatePauseStatus(); diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index c0ec5f9bc..5c3dd9455 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -353,8 +353,6 @@ bool GameTicker() } } - double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio; - gameupdatetime.Unclock(); if (ps[myconnectindex].gm & (MODE_EOL | MODE_RESTART)) @@ -370,6 +368,7 @@ bool GameTicker() drawtime.Reset(); drawtime.Clock(); S_Update(); + double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio; displayrooms(screenpeek, smoothRatio); displayrest(smoothRatio); drawtime.Unclock(); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index edf851112..dd9a5ba29 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -788,11 +788,11 @@ void GameTicker(void) MoveTicker(); } - smoothratio = I_GetTimeFrac() * MaxSmoothRatio; - // Get input again to update q16ang/q16horiz. if (!PedanticMode) getinput(&loc, TRUE); + + smoothratio = I_GetTimeFrac() * MaxSmoothRatio; } drawscreen(Player + screenpeek, smoothratio); From ea2790ce089822f07ee59f1a2ea0618e7c314b44 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 28 Aug 2020 15:29:41 +1000 Subject: [PATCH 08/12] - Duke: Switch game tic back to a while loop. I didn't mean to commit it this way in ab0623597189652871c26e58f94a9810edfdded2. * I doubt anyone will be running this on a system where computing a tic might take longer than a tic, but it's more consistent with the other games and is what it was. --- source/games/duke/src/gameloop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 5c3dd9455..1710bea81 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -327,7 +327,7 @@ bool GameTicker() int const currentTic = I_GetTime(); gameclock = I_GetBuildTime(); - if (playrunning() && currentTic - lastTic >= 1) + while (playrunning() && currentTic - lastTic >= 1) { lastTic = currentTic; From d73bf62465f115a9cab498460e9fb527e7021ad2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 28 Aug 2020 08:25:51 +0200 Subject: [PATCH 09/12] Revert "- Set frame-time as close to the buffer swap as possible, and calculate smoothratio for Duke/SW as late as possible." This reverts commit 97feb483ab1c78cc6d88b891c80e5fa481afb9a2. --- source/build/src/engine.cpp | 1 - source/core/gamecontrol.cpp | 1 + source/games/duke/src/gameloop.cpp | 3 ++- source/sw/src/game.cpp | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 01086eb35..42ce85175 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -2724,7 +2724,6 @@ void videoNextPage(void) { g_beforeSwapTime = I_msTimeF(); videoShowFrame(0); - I_SetFrameTime(); omdtims = mdtims; mdtims = I_msTime(); diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 14b69bf59..2f53733b4 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -941,6 +941,7 @@ void app_loop() TickSubsystems(); twod->SetSize(screen->GetWidth(), screen->GetHeight()); twodpsp.SetSize(screen->GetWidth(), screen->GetHeight()); + I_SetFrameTime(); handleevents(); updatePauseStatus(); diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 1710bea81..18a79650e 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -353,6 +353,8 @@ bool GameTicker() } } + double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio; + gameupdatetime.Unclock(); if (ps[myconnectindex].gm & (MODE_EOL | MODE_RESTART)) @@ -368,7 +370,6 @@ bool GameTicker() drawtime.Reset(); drawtime.Clock(); S_Update(); - double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio; displayrooms(screenpeek, smoothRatio); displayrest(smoothRatio); drawtime.Unclock(); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index dd9a5ba29..edf851112 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -788,11 +788,11 @@ void GameTicker(void) MoveTicker(); } + smoothratio = I_GetTimeFrac() * MaxSmoothRatio; + // Get input again to update q16ang/q16horiz. if (!PedanticMode) getinput(&loc, TRUE); - - smoothratio = I_GetTimeFrac() * MaxSmoothRatio; } drawscreen(Player + screenpeek, smoothratio); From 536e7455f2c9cf8431249f85852566f90edffa6b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 28 Aug 2020 08:44:44 +0200 Subject: [PATCH 10/12] - moved I_StartFrame to the top of the loop and cleaned up baselayer.hj --- source/blood/src/blood.cpp | 3 ++- source/build/include/baselayer.h | 15 -------------- source/build/include/build.h | 1 - source/build/src/engine.cpp | 34 ++------------------------------ source/build/src/engine_priv.h | 1 - source/build/src/mdsprite.cpp | 10 ++++++++++ source/core/gamecontrol.cpp | 6 ++---- source/core/gamestruct.h | 1 - source/exhumed/src/view.cpp | 2 -- 9 files changed, 16 insertions(+), 57 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 35aa17956..85c77fd17 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -823,8 +823,9 @@ static void gameTicker() else { netCheckSync(); + auto beforeSwapTime = I_msTimeF(); viewDrawScreen(); - g_gameUpdateAndDrawTime = g_beforeSwapTime/* I_msTimeF()*/ - gameUpdateStartTime; + g_gameUpdateAndDrawTime = beforeSwapTime/* I_msTimeF()*/ - gameUpdateStartTime; } } diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 5cd62e6fb..ec8ff74ee 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -15,27 +15,12 @@ #include "zstring.h" #include "vectors.h" -extern int32_t swapcomplete; - EXTERN_CVAR(Bool, r_usenewaspect) // video extern int32_t newaspect_enable; -extern int32_t r_fpgrouscan; -extern int32_t setaspect_new_use_dimen; -extern int32_t xres, yres, bpp; -int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced); -int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs); -void videoGetModes(void); void videoShowFrame(int32_t); -int32_t videoUpdatePalette(int32_t start, int32_t num); - -extern int32_t qsetmode; - -#define in3dmode() (qsetmode==200) - -extern int32_t g_logFlushWindow; #include "gamestruct.h" #endif // baselayer_h_ diff --git a/source/build/include/build.h b/source/build/include/build.h index 12857cb38..172874b1b 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -646,7 +646,6 @@ void vox_undefine(int32_t const); void vox_deinit(); int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daupscaledydim, int32_t dabpp, int32_t daupscalefactor); -void videoNextPage(void); void videoSetCorrectedAspect(); void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2); void renderSetAspect(int32_t daxrange, int32_t daaspect); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 42ce85175..a6b24995b 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -83,7 +83,6 @@ static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1; CVAR(Bool, r_usenewaspect, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); int32_t newaspect_enable=0; -int32_t r_fpgrouscan = 1; int32_t globalflags; static int8_t tempbuf[MAXWALLS]; @@ -350,7 +349,6 @@ int16_t globalpicnum; static int32_t globaly1, globalx2; int16_t sectorborder[256]; -int32_t ydim16, qsetmode = 0; int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0; int32_t halfxdim16, midydim16; @@ -2681,15 +2679,9 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups daupscaledxdim = max(320, daupscaledxdim); daupscaledydim = max(200, daupscaledydim); - if (in3dmode() && - (xres == daupscaledxdim) && (yres == daupscaledydim) && (bpp == dabpp)) - return 0; - Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." " (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); - j = bpp; - rendmode = REND_POLYMOST; upscalefactor = 1; @@ -2713,26 +2705,9 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } - qsetmode = 200; return 0; } -// -// nextpage -// -void videoNextPage(void) -{ - g_beforeSwapTime = I_msTimeF(); - videoShowFrame(0); - - omdtims = mdtims; - mdtims = I_msTime(); - - for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i) - if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) - spriteext[i].mdanimtims += mdtims - omdtims; -} - // // qloadkvx // @@ -3718,8 +3693,6 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * con p2->y = dmulscale14(p.y, dacos, p.x, dasin) + pivot.y; } -int32_t setaspect_new_use_dimen = 0; - void videoSetCorrectedAspect() { if (/*r_usenewaspect &&*/ newaspect_enable && videoGetRenderMode() != REND_POLYMER) @@ -3730,11 +3703,8 @@ void videoSetCorrectedAspect() int32_t yx = (65536 * 5) / 4; int32_t vr, y, x; - const int32_t xd = setaspect_new_use_dimen ? xdimen : xdim; - const int32_t yd = setaspect_new_use_dimen ? ydimen : ydim; - - x = xd; - y = yd; + x = xdim; + y = ydim; vr = divscale16(x*3, y*4); diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index ffcdeea54..a72f8b50f 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -109,7 +109,6 @@ extern int16_t searchbottomwall, searchisbottom; extern char inpreparemirror; extern int16_t sectorborder[256]; -extern int32_t qsetmode; extern int32_t hitallsprites; extern int32_t xb1[MAXWALLSB]; diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 4b34165f0..6e4cbb921 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1677,6 +1677,16 @@ static void mdfree(mdmodel_t *vm) if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; } } +static void updateModelInterpolation() +{ + // sigh... + omdtims = mdtims; + mdtims = I_msTime(); + + for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i) + if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) + spriteext[i].mdanimtims += mdtims - omdtims; +} #endif //---------------------------------------- MD LIBRARY ENDS ---------------------------------------- diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 2f53733b4..c1605d4ab 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -91,11 +91,9 @@ CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) } // The last remains of sdlayer.cpp -double g_beforeSwapTime; GameInterface* gi; int myconnectindex, numplayers; int connecthead, connectpoint2[MAXMULTIPLAYERS]; -int32_t xres = -1, yres = -1, bpp = 0; auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. int gameclock; int lastTic; @@ -938,10 +936,10 @@ void app_loop() { try { + I_SetFrameTime(); TickSubsystems(); twod->SetSize(screen->GetWidth(), screen->GetHeight()); twodpsp.SetSize(screen->GetWidth(), screen->GetHeight()); - I_SetFrameTime(); handleevents(); updatePauseStatus(); @@ -962,7 +960,7 @@ void app_loop() soundEngine->UpdateSounds(I_GetTime()); Mus_UpdateMusic(); // must be at the end. - videoNextPage(); + videoShowFrame(0); videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend. } catch (CRecoverableError& err) diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 506cfd8e5..7ae7977b7 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -96,7 +96,6 @@ struct GameInterface }; extern GameInterface* gi; -extern double g_beforeSwapTime; void ImGui_Begin_Frame(); diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index 246bed98b..91b45676e 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -222,9 +222,7 @@ static void analyzesprites() void ResetView() { - //videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0); EraseScreen(overscanindex); - //videoUpdatePalette(0, 256); #ifdef USE_OPENGL videoTintBlood(0, 0, 0); #endif From 847fa48724f8eefae26d52e1f6c5ab599ba5e84f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 28 Aug 2020 09:06:49 +0200 Subject: [PATCH 11/12] - cleaned out the remaining parts of baselayer.h In particular this means to remove the option to disable widescreen aspect ratios. The way this was handled makes no sense with the current render backend. The aspect ratio code will have to be redone entirely to properly obey the backend's settings. --- source/blood/src/blood.cpp | 1 - source/blood/src/blood.h | 1 + source/blood/src/common_game.h | 1 - source/blood/src/controls.cpp | 1 - source/blood/src/osdcmd.cpp | 1 - source/blood/src/sound.cpp | 1 - source/blood/src/view.cpp | 8 +------- source/build/include/baselayer.h | 27 --------------------------- source/build/include/polymost.h | 1 - source/build/src/animvpx.cpp | 1 - source/build/src/clip.cpp | 2 +- source/build/src/defs.cpp | 1 - source/build/src/engine.cpp | 16 +++------------- source/build/src/mdsprite.cpp | 2 +- source/build/src/mhk.cpp | 2 +- source/build/src/polymost.cpp | 1 + source/build/src/scriptfile.cpp | 2 +- source/build/src/voxmodel.cpp | 1 - source/core/inputstate.cpp | 1 + source/core/menu/imagescroller.cpp | 1 - source/core/menu/savegamemanager.cpp | 1 + source/core/palette.cpp | 1 + source/exhumed/src/cd.cpp | 1 - source/exhumed/src/exhumed.cpp | 1 - source/exhumed/src/exhumed.h | 3 +-- source/exhumed/src/gameloop.cpp | 1 - source/exhumed/src/movie.cpp | 1 - source/exhumed/src/sound.cpp | 1 - source/exhumed/src/view.cpp | 18 +++++------------- source/games/duke/src/duke3d.h | 2 -- source/games/duke/src/game.cpp | 1 - source/games/duke/src/game_misc.cpp | 1 - source/games/duke/src/gameloop.cpp | 2 +- source/games/duke/src/prediction.cpp | 1 - source/games/duke/src/render.cpp | 1 - source/glbackend/glbackend.cpp | 1 + source/glbackend/glbackend.h | 2 +- source/sw/src/draw.cpp | 14 ++++---------- source/sw/src/game.cpp | 4 ---- source/sw/src/game.h | 2 +- source/sw/src/network.cpp | 1 - 41 files changed, 27 insertions(+), 105 deletions(-) delete mode 100644 source/build/include/baselayer.h diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 85c77fd17..974d2a411 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "build.h" #include "mmulti.h" #include "compat.h" -#include "baselayer.h" #include "common.h" #include "common_game.h" #include "g_input.h" diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index b447e4692..f610508be 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "misc.h" #include "db.h" #include "mapinfo.h" +#include "gamestruct.h" BEGIN_BLD_NS diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 0a5c2cce2..13829966f 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- #pragma once -#include "baselayer.h" #include "build.h" #include "common.h" diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 384c515ef..96d1a2da8 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" // Must come before everything else! #include "compat.h" -#include "baselayer.h" #include "mmulti.h" #include "gamecontrol.h" #include "common_game.h" diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 4f33ef771..41754ce10 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" // Must come before everything else! #include "build.h" -#include "baselayer.h" #include "compat.h" #include "mmulti.h" #include "common_game.h" diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index 34cc797a8..e7fdb1037 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "common_game.h" #include "levels.h" #include "sound.h" -#include "baselayer.h" #include "raze_music.h" #include "raze_sound.h" #include "gamecontrol.h" diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index fdd9012cb..6160c986d 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -690,11 +690,7 @@ void viewDrawScreen(bool sceneonly) int yxAspect = yxaspect; int viewingRange = viewingrange; - if (r_usenewaspect) - { - newaspect_enable = 1; - videoSetCorrectedAspect(); - } + videoSetCorrectedAspect(); int v1 = Blrintf(double(viewingrange) * tan(r_fov * (PI / 360.))); @@ -1004,8 +1000,6 @@ void viewDrawScreen(bool sceneonly) bDeliriumOld = bDelirium && gDeliriumBlur; - if (r_usenewaspect) - newaspect_enable = 0; renderSetAspect(viewingRange, yxAspect); int nClipDist = gView->pSprite->clipdist << 2; int ve8, vec, vf0, vf4; diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h deleted file mode 100644 index ec8ff74ee..000000000 --- a/source/build/include/baselayer.h +++ /dev/null @@ -1,27 +0,0 @@ -// Base services interface declaration -// for the Build Engine -// by Jonathon Fowler (jf@jonof.id.au) - -#pragma once - -#ifndef baselayer_h_ -#define baselayer_h_ - -#include "compat.h" -#include "c_dispatch.h" -#include "c_cvars.h" -#include "inputstate.h" -#include "printf.h" -#include "zstring.h" -#include "vectors.h" - -EXTERN_CVAR(Bool, r_usenewaspect) - -// video -extern int32_t newaspect_enable; - -void videoShowFrame(int32_t); - -#include "gamestruct.h" -#endif // baselayer_h_ - diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index 2e10d3c8b..b981c149a 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -2,7 +2,6 @@ # define polymost_h_ -#include "baselayer.h" // glinfo #include "mdsprite.h" void Polymost_CacheHitList(uint8_t* hash); diff --git a/source/build/src/animvpx.cpp b/source/build/src/animvpx.cpp index 7d675a448..6bb8ea98d 100644 --- a/source/build/src/animvpx.cpp +++ b/source/build/src/animvpx.cpp @@ -5,7 +5,6 @@ #include "compat.h" #include "compat.h" -#include "baselayer.h" #include "build.h" #include "matrix.h" diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 64d89e213..d54587e64 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -7,9 +7,9 @@ // by the EDuke32 team (development@voidpoint.com) #include "build.h" -#include "baselayer.h" #include "clip.h" #include "engine_priv.h" +#include "printf.h" static int16_t clipnum; diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 06a25e50b..5c68b5f50 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -8,7 +8,6 @@ #include "build.h" #include "compat.h" #include "engine_priv.h" -#include "baselayer.h" #include "scriptfile.h" #include "common.h" diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a6b24995b..082bfb570 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -9,7 +9,6 @@ #define engine_c_ #include "gl_load.h" -#include "baselayer.h" #include "build.h" #include "imagehelpers.h" @@ -28,6 +27,8 @@ #include "version.h" #include "earcut.hpp" #include "gamestate.h" +#include "inputstate.h" +#include "printf.h" #ifdef USE_OPENGL # include "mdsprite.h" @@ -79,10 +80,6 @@ static int32_t beforedrawrooms = 1; static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1; -// r_usenewaspect is the cvar, newaspect_enable to trigger the new behaviour in the code -CVAR(Bool, r_usenewaspect, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); -int32_t newaspect_enable=0; - int32_t globalflags; static int8_t tempbuf[MAXWALLS]; @@ -2141,10 +2138,8 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } } - if (r_usenewaspect) + renderSetAspect(oviewingrange, oyxaspect); - else - renderSetAspect(65536, divscale16(ydim*320, xdim*200)); } //////////////////// LOADING AND SAVING ROUTINES //////////////////// @@ -3695,8 +3690,6 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * con void videoSetCorrectedAspect() { - if (/*r_usenewaspect &&*/ newaspect_enable && videoGetRenderMode() != REND_POLYMER) - { // In DOS the game world is displayed with an aspect of 1.28 instead 1.333, // meaning we have to stretch it by a factor of 1.25 instead of 1.2 // to get perfect squares @@ -3709,9 +3702,6 @@ void videoSetCorrectedAspect() vr = divscale16(x*3, y*4); renderSetAspect(vr, yx); - } - else - renderSetAspect(65536, divscale16(ydim*320, xdim*200)); } // diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 6e4cbb921..9e48ce9c8 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -5,7 +5,6 @@ #include "compat.h" #include "build.h" #include "pragmas.h" -#include "baselayer.h" #include "engine_priv.h" #include "polymost.h" #include "mdsprite.h" @@ -18,6 +17,7 @@ #include "flatvertices.h" #include "texturemanager.h" #include "hw_renderstate.h" +#include "printf.h" #include "../../glbackend/glbackend.h" static int32_t curextra=MAXTILES; diff --git a/source/build/src/mhk.cpp b/source/build/src/mhk.cpp index d90f74919..4f54b9cff 100644 --- a/source/build/src/mhk.cpp +++ b/source/build/src/mhk.cpp @@ -1,8 +1,8 @@ #include "compat.h" #include "build.h" -#include "baselayer.h" #include "scriptfile.h" +#include "printf.h" usermaphack_t g_loadedMapHack; // used only for the MD4 part diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 1647bbe8c..7fc99d42c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -21,6 +21,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken #include "palettecontainer.h" #include "texturemanager.h" #include "hw_renderstate.h" +#include "printf.h" CVAR(Bool, hw_detailmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, hw_glowmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) diff --git a/source/build/src/scriptfile.cpp b/source/build/src/scriptfile.cpp index c6e485269..48af3576b 100644 --- a/source/build/src/scriptfile.cpp +++ b/source/build/src/scriptfile.cpp @@ -7,10 +7,10 @@ #include "compat.h" #include "scriptfile.h" -#include "baselayer.h" #include "compat.h" #include "common.h" #include "filesystem.h" +#include "printf.h" #define ISWS(x) ((x == ' ') || (x == '\t') || (x == '\r') || (x == '\n')) diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 625cfff4b..bf63aa450 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -5,7 +5,6 @@ #include "compat.h" #include "build.h" #include "pragmas.h" -#include "baselayer.h" #include "engine_priv.h" #include "polymost.h" #include "mdsprite.h" diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index c4b7c71f8..da0121b96 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -38,6 +38,7 @@ #include "gamecvars.h" #include "v_video.h" #include "statusbar.h" +#include "gamestruct.h" //========================================================================== // diff --git a/source/core/menu/imagescroller.cpp b/source/core/menu/imagescroller.cpp index b7c0158db..882dbc7bf 100644 --- a/source/core/menu/imagescroller.cpp +++ b/source/core/menu/imagescroller.cpp @@ -39,7 +39,6 @@ #include "d_event.h" #include "menu.h" #include "v_draw.h" -#include "baselayer.h" #include "gamecontrol.h" #include "build.h" #include "zstring.h" diff --git a/source/core/menu/savegamemanager.cpp b/source/core/menu/savegamemanager.cpp index 66b20c4c4..c554b59db 100644 --- a/source/core/menu/savegamemanager.cpp +++ b/source/core/menu/savegamemanager.cpp @@ -52,6 +52,7 @@ #include "build.h" #include "serializer.h" #include "findfile.h" +#include "inputstate.h" FSavegameManager savegameManager; diff --git a/source/core/palette.cpp b/source/core/palette.cpp index 561731caa..c303734e8 100644 --- a/source/core/palette.cpp +++ b/source/core/palette.cpp @@ -44,6 +44,7 @@ #include "m_swap.h" #include "v_colortables.h" #include "v_font.h" +#include "printf.h" #include "../../glbackend/glbackend.h" LookupTableInfo lookups; diff --git a/source/exhumed/src/cd.cpp b/source/exhumed/src/cd.cpp index bef5d2dd6..8c6b677ed 100644 --- a/source/exhumed/src/cd.cpp +++ b/source/exhumed/src/cd.cpp @@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" #include "build.h" #include "compat.h" -#include "baselayer.h" #include "engine.h" #include "sound.h" #include "exhumed.h" diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 9881842b1..0b7958f24 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -17,7 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //------------------------------------------------------------------------- #include "ns.h" #include "compat.h" -#include "baselayer.h" #include "common.h" #include "engine.h" #include "exhumed.h" diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 47bfa58db..765d2ab66 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define __exhumed_h__ #include "compat.h" -#include "baselayer.h" #include "v_text.h" #include "printf.h" #include "gamecvars.h" @@ -290,7 +289,7 @@ struct GameInterface : ::GameInterface bool CanSave() override; ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; } void clearlocalinputstate() override; - void QuitToTitle(); + void QuitToTitle() override; FString statFPS() override; ::GameStats getStats() override; diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index 1668218d0..7491d2af4 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -17,7 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //------------------------------------------------------------------------- #include "ns.h" #include "compat.h" -#include "baselayer.h" #include "common.h" #include "engine.h" #include "exhumed.h" diff --git a/source/exhumed/src/movie.cpp b/source/exhumed/src/movie.cpp index ecc5d1fc7..bb18ea182 100644 --- a/source/exhumed/src/movie.cpp +++ b/source/exhumed/src/movie.cpp @@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "names.h" #include #include -#include "baselayer.h" #include "c_bind.h" #include "sound.h" #include "v_2ddrawer.h" diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index 5325b296c..96bf57e53 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ns.h" #include "mmulti.h" #include "compat.h" -#include "baselayer.h" #include "build.h" #include "engine.h" #include "exhumed.h" diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index 91b45676e..29c7e05dc 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -358,14 +358,9 @@ void DrawView(double smoothRatio, bool sceneonly) int const viewingRange = viewingrange; int const vr = Blrintf(65536.f * tanf(r_fov * (fPI / 360.f))); - if (r_usenewaspect) - { - newaspect_enable = 1; - videoSetCorrectedAspect(); - renderSetAspect(mulscale16(vr, viewingrange), yxaspect); - } - else - renderSetAspect(vr, yxaspect); + + videoSetCorrectedAspect(); + renderSetAspect(mulscale16(vr, viewingrange), yxaspect); if (HavePLURemap()) { @@ -400,11 +395,8 @@ void DrawView(double smoothRatio, bool sceneonly) } } - if (r_usenewaspect) - { - newaspect_enable = 0; - renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); - } + + renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); if (nFreeze) { diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 4a1f7db1e..4ebde4370 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -1,8 +1,6 @@ #ifndef duke3d_h_ #define duke3d_h_ -// JBF -#include "baselayer.h" #include "build.h" #include "compat.h" diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 7fc48316f..be647e44e 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -31,7 +31,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "ns.h" // Must come before everything else! #include "duke3d.h" -#include "baselayer.h" #include "m_argv.h" #include "mapinfo.h" #include "texturemanager.h" diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 9a1a30e89..8c5b57b4d 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -32,7 +32,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "ns.h" // Must come before everything else! #include "duke3d.h" -#include "baselayer.h" #include "m_argv.h" #include "mapinfo.h" #include "texturemanager.h" diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 18a79650e..0b1b096a9 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -31,10 +31,10 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "gamestate.h" #include "duke3d.h" #include "sbar.h" -#include "baselayer.h" #include "m_argv.h" #include "mapinfo.h" #include "texturemanager.h" +#include "glbackend/glbackend.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index da408e7f0..9a4f0e70e 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -30,7 +30,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "duke3d.h" #include "sbar.h" -#include "baselayer.h" #include "m_argv.h" #include "mapinfo.h" #include "texturemanager.h" diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 7b636886c..6e99a2249 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -483,7 +483,6 @@ void displayrooms(int snum, double smoothratio) g_visibility = p->visibility; - newaspect_enable = 1; videoSetCorrectedAspect(); sect = p->cursectnum; diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 16bb3937a..3e3d62218 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -48,6 +48,7 @@ #include "hw_viewpointbuffer.h" #include "hw_renderstate.h" #include "hw_cvars.h" +#include "gamestruct.h" CVAR(Bool, gl_texture, true, 0) diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index 5ed5e2b38..66b7f3dc0 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -362,5 +362,5 @@ void renderSetVisibility(float v); void renderBeginScene(); void renderFinishScene(); void DrawRateStuff(); - +void videoShowFrame(int32_t); void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha = 1); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 64a629406..a282b4d45 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1796,11 +1796,8 @@ drawscreen(PLAYERp pp, double smoothratio) JS_DrawCameras(pp, tx, ty, tz); } - if (r_usenewaspect) - { - newaspect_enable = 1; - videoSetCorrectedAspect(); - } + + videoSetCorrectedAspect(); renderSetAspect(Blrintf(float(viewingrange)* tanf(r_fov* (fPI / 360.f))), yxaspect); OverlapDraw = TRUE; DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum); @@ -1822,11 +1819,8 @@ drawscreen(PLAYERp pp, double smoothratio) post_analyzesprites(); renderDrawMasks(); - if (r_usenewaspect) - { - newaspect_enable = 0; - renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); - } + + renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); UpdatePanel(smoothratio); #define SLIME 2305 diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index edf851112..eb7bc6f29 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -29,10 +29,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define MAIN #define QUIET #include "build.h" -#include "baselayer.h" - -#include "baselayer.h" - #include "names2.h" #include "panel.h" #include "game.h" diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 33e268378..21a158999 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -38,7 +38,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "build.h" #include "compat.h" -#include "baselayer.h" #include "mmulti.h" #include "mytypes.h" @@ -49,6 +48,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "c_cvars.h" #include "mapinfo.h" #include "gamecontrol.h" +#include "gamestruct.h" #include "packet.h" EXTERN_CVAR(Bool, sw_ninjahack) diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 673c7cb0c..0e5475d69 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "build.h" -#include "baselayer.h" #include "mmulti.h" #include "gamecontrol.h" From c47b60e1930ea3bd8dd64deaffe70236eab72db7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 29 Aug 2020 08:16:05 +1000 Subject: [PATCH 12/12] - Fix compile regression from 847fa48724f8eefae26d52e1f6c5ab599ba5e84f. Fixes #283. --- source/build/src/animvpx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/build/src/animvpx.cpp b/source/build/src/animvpx.cpp index 6bb8ea98d..55e7492e5 100644 --- a/source/build/src/animvpx.cpp +++ b/source/build/src/animvpx.cpp @@ -6,7 +6,7 @@ #include "compat.h" #include "build.h" - +#include "printf.h" #include "matrix.h" #include "../../glbackend/glbackend.h" #include "textures.h"