From fb91fc49a32cfb75892abf2b0f4889222f9d2061 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 15 Oct 2020 19:47:14 +1100 Subject: [PATCH] - processMovement(): Add commentary around avel constants used within function and how they came to be. Also clean up some left-over code. --- source/core/gameinput.cpp | 33 ++++++++++++++++++++++++++++++--- source/exhumed/src/input.cpp | 5 ----- source/games/duke/src/input.cpp | 10 ++++------ source/sw/src/input.cpp | 3 ++- source/sw/src/player.cpp | 2 +- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 38e58ef3d..e8a7043b5 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -77,6 +77,33 @@ fixed_t getincangleq16(fixed_t a, fixed_t na) // //--------------------------------------------------------------------------- +/* +// Running speed. +Blood: 92 / 4 * 2 * 30 = 1380; +Duke: 15 * 2 * 2 * 30 = 1800; +SW: 28 * 1.40625 * 40 = 1575; // Precisely, ((((28 * 12) + ((28 * 12) / 4)) * 3) / 32) * 40 +Average: 1585.; + +// Normal speed. +Blood: 92 / 4 * 30 = 690; +Duke: 15 * 2 * 30 = 900; +SW: 18 * 1.40625 * 40 = 1012.5; // Precisely, (((((12 + 6) * 12) + (((12 + 6) * 12) / 4)) * 3) / 32) * 40 +Average: 867.5; + +// Preamble. +Blood: N/A; +Duke: 5 * 2 * 30 = 300; +SW: 3 * 1.40625 * 40 = 168.75; // Precisely, ((((3 * 12) + ((3 * 12) / 4)) * 3) / 32) * 40 +Average: 234.375; +Ratio: 867.5 / 234.375 = (2776. / 750.); + +// Turbo turn time. +Blood: 24 * 30 = 720; +Duke: 128 / 8 * 30 = 450; +SW: 128 / 8 * 40 = 600; +Average: 590.; +*/ + void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt, bool const allowstrafe, double const turnscale) { // set up variables @@ -84,8 +111,8 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn int const keymove = gi->playerKeyMove() << running; int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1; float const mousevelscale = keymove / 160.f; - double const angtodegscale = 45. / 256.; - double const hidspeed = ((running ? 43375. / 27. : 867.5) / GameTicRate) * angtodegscale; + double const angtodegscale = 360. / 2048.; + double const hidspeed = ((running ? 1585. : 867.5) / GameTicRate) * angtodegscale; // process mouse and initial controller input. if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe) @@ -127,7 +154,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn int const turnheldamt = 120 / GameTicRate; double const turboturntime = 590. / GameTicRate; double turnamount = hidspeed * turnscale; - double preambleturn = turnamount * (92. / 347.); + double preambleturn = turnamount * (750. / 2776.); // allow Exhumed to use its legacy values given the drastic difference from the other games. if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn) diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index 1f48cb7a9..e803281a3 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -25,9 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -static int turn; -static int counter; - short nInputStack = 0; short bStackNode[kMaxPlayers]; @@ -152,8 +149,6 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) void GameInterface::clearlocalinputstate() { localInput = {}; - turn = 0; - counter = 0; } END_PS_NS diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 9f8a07bca..6c470c8c0 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -499,18 +499,16 @@ void hud_input(int snum) enum { - TURBOTURNTIME = (TICRATE/8), // 7 + TURBOTURNTIME = (TICRATE/8), // 7 NORMALTURN = 15, PREAMBLETURN = 5, NORMALKEYMOVE = 40, MAXVEL = ((NORMALKEYMOVE*2)+10), MAXSVEL = ((NORMALKEYMOVE*2)+10), - MAXANGVEL = 1024, - MAXHORIZVEL = 256, - ONEEIGHTYSCALE = 4, + MAXANGVEL = 1024, // 127 + MAXHORIZVEL = 256, // 127 - MOTOTURN = 20, - MAXVELMOTO = 120, + MAXVELMOTO = 120 }; //--------------------------------------------------------------------------- diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index f711d8283..2a2454347 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -58,7 +58,7 @@ InitTimingVars(void) MoveSkip4 = 1; // start slightly offset so these } - +#if 0 enum { TURBOTURNTIME = (120 / 8), @@ -71,6 +71,7 @@ enum MAXANGVEL = 100, MAXHORIZVEL = 128 }; +#endif //--------------------------------------------------------------------------- // diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 8cd57ecae..b71d8255e 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1538,7 +1538,7 @@ DoPlayerTurnBoat(PLAYERp pp, float avel) } else { - avel *= 1.4; + avel *= synctics * 0.65625; } if (avel != 0)