- processMovement(): Add commentary around avel constants used within function and how they came to be. Also clean up some left-over code.

This commit is contained in:
Mitchell Richters 2020-10-15 19:47:14 +11:00
parent 76e4661eea
commit fb91fc49a3
5 changed files with 37 additions and 16 deletions

View file

@ -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)

View file

@ -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

View file

@ -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
};
//---------------------------------------------------------------------------

View file

@ -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
//---------------------------------------------------------------------------
//

View file

@ -1538,7 +1538,7 @@ DoPlayerTurnBoat(PLAYERp pp, float avel)
}
else
{
avel *= 1.4;
avel *= synctics * 0.65625;
}
if (avel != 0)