- Exhumed: Unify game with single timer instead of getting forward/side velocity at 120Hz.

* Player movement is close, but not exactly as it was. Requires more work if it is to be considered.

# Conflicts:
#	source/exhumed/src/exhumed.cpp
#	source/exhumed/src/ps_input.h
This commit is contained in:
Mitchell Richters 2020-08-26 17:19:50 +10:00 committed by Christoph Oelckers
parent f90d953ab5
commit 0c300c181f
9 changed files with 4 additions and 64 deletions

View file

@ -60,7 +60,6 @@ enum {
kSectLava = 0x4000, kSectLava = 0x4000,
}; };
extern int ogameclock;
extern int initx; extern int initx;
extern int inity; extern int inity;
extern int initz; extern int initz;
@ -114,10 +113,6 @@ void GrabMap();
void UpdateMap(); void UpdateMap();
void DrawMap(); void DrawMap();
// network
extern short nNetMoveFrames;
// random // random
void InitRandom(); void InitRandom();

View file

@ -30,7 +30,6 @@ BEGIN_PS_NS
void resettiming() void resettiming()
{ {
ogameclock = -1;
gameclock = 0; gameclock = 0;
lastTic = -1; lastTic = -1;
} }

View file

@ -125,7 +125,6 @@ int nNetPlayerCount = 0;
short nClockVal; short nClockVal;
short nRedTicks; short nRedTicks;
short bInMove;
short nAlarmTicks; short nAlarmTicks;
short nButtonColor; short nButtonColor;
short nEnergyChan; short nEnergyChan;
@ -150,7 +149,6 @@ short nCodeIndex = 0;
//short nScreenWidth = 320; //short nScreenWidth = 320;
//short nScreenHeight = 200; //short nScreenHeight = 200;
int moveframes;
int flash; int flash;
int totalmoves; int totalmoves;
@ -466,14 +464,11 @@ void GameMove(void)
// loc_120E9: // loc_120E9:
totalmoves++; totalmoves++;
moveframes--;
} }
void GameTicker() void GameTicker()
{ {
bInMove = true;
int const currentTic = I_GetTime(); int const currentTic = I_GetTime();
gameclock = I_GetBuildTime(); gameclock = I_GetBuildTime();
@ -483,12 +478,9 @@ void GameTicker()
} }
else else
{ {
while ((gameclock - ogameclock) >= 1 || !bInMove) while (!EndLevel && currentTic - lastTic >= 1)
{ {
ogameclock = I_GetBuildTime(); lastTic = currentTic;
if (!((int)ogameclock & 3) && moveframes < 4)
moveframes++;
int lLocalButtons = GetLocalInput(); // shouldn't this be placed in localInput? int lLocalButtons = GetLocalInput(); // shouldn't this be placed in localInput?
PlayerInterruptKeys(); PlayerInterruptKeys();
@ -516,22 +508,14 @@ void GameTicker()
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz; sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
while (!EndLevel && currentTic - lastTic >= 1)
{
lastTic = currentTic;
leveltime++; leveltime++;
GameMove(); GameMove();
} }
}
if (nPlayerLives[nLocalPlayer] <= 0) { if (nPlayerLives[nLocalPlayer] <= 0) {
startmainmenu(); startmainmenu();
} }
} }
bInMove = false;
} }
int32_t r_maxfpsoffset = 0;
void ExitGame() void ExitGame()
@ -740,7 +724,6 @@ static SavegameHelper sgh("exhumed",
SV(nEnergyChan), SV(nEnergyChan),
SV(lCountDown), SV(lCountDown),
SV(nEnergyTowers), SV(nEnergyTowers),
SV(moveframes),
SV(totalmoves), SV(totalmoves),
SV(nCurBodyNum), SV(nCurBodyNum),
SV(nBodyTotal), SV(nBodyTotal),

View file

@ -144,8 +144,6 @@ extern char sHollyStr[];
extern int selectedlevelnew; extern int selectedlevelnew;
extern int GameAction; extern int GameAction;
extern int moveframes;
extern int nNetPlayerCount; extern int nNetPlayerCount;
extern int htimer; extern int htimer;
@ -203,7 +201,6 @@ extern short nClockVal;
extern short bSlipMode; extern short bSlipMode;
extern int bVanilla; extern int bVanilla;
extern short bInMove;
#define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE) #define POWERSLAVE (g_gameType & GAMEFLAG_POWERSLAVE)
#define EXHUMED (g_gameType & GAMEFLAG_EXHUMED) #define EXHUMED (g_gameType & GAMEFLAG_EXHUMED)

View file

@ -38,8 +38,6 @@ enum
kTagRamses = 61, kTagRamses = 61,
}; };
int ogameclock = 0;
int initx, inity, initz; int initx, inity, initz;
short inita, initsect; short inita, initsect;
@ -197,8 +195,6 @@ void InitLevel(int level)
totalmoves = 0; totalmoves = 0;
GrabPalette(); GrabPalette();
ResetMoveFifo(); ResetMoveFifo();
moveframes = 0;
bInMove = false;
nPlayerDAng = 0; nPlayerDAng = 0;
lPlayerXVel = 0; lPlayerXVel = 0;
lPlayerYVel = 0; lPlayerYVel = 0;
@ -228,12 +224,6 @@ void InitNewGame()
InitPlayerInventory(nPlayer); InitPlayerInventory(nPlayer);
} }
nNetMoves = 0;
// PINK SECTION
UpdateInputs();
nNetMoves = 1;
} }
void SetBelow(short nCurSector, short nBelowSector) void SetBelow(short nCurSector, short nBelowSector)

View file

@ -30,8 +30,6 @@ BEGIN_PS_NS
int WeaponToSend, BitsToSend; int WeaponToSend, BitsToSend;
int nNetMoves = 0;
short nInputStack = 0; short nInputStack = 0;
short bStackNode[kMaxPlayers]; short bStackNode[kMaxPlayers];
@ -106,24 +104,6 @@ void SendInput()
} }
short nNetMoveFrames = 0;
void UpdateInputs()
{
nNetMoveFrames = moveframes;
if (nNetPlayerCount)
{
//UpdateNetInputs();
nNetMoves++;
if (!nNetMoves) {
nNetMoves++;
}
}
}
void CheckKeys() void CheckKeys()
{ {
// go to 3rd person view? // go to 3rd person view?

View file

@ -47,8 +47,8 @@ struct PlayerSave
short nAngle; short nAngle;
}; };
fix16_t lPlayerXVel = 0; int lPlayerXVel = 0;
fix16_t lPlayerYVel = 0; int lPlayerYVel = 0;
fix16_t nPlayerDAng = 0; fix16_t nPlayerDAng = 0;
short obobangle = 0, bobangle = 0; short obobangle = 0, bobangle = 0;
short bPlayerPan = 0; short bPlayerPan = 0;

View file

@ -38,15 +38,12 @@ struct PlayerInput
void InitInput(); void InitInput();
void UpdateInputs();
void ClearSpaceBar(short nPlayer); void ClearSpaceBar(short nPlayer);
int GetLocalInput(); int GetLocalInput();
extern PlayerInput sPlayerInput[]; extern PlayerInput sPlayerInput[];
extern InputPacket localInput; extern InputPacket localInput;
extern int nNetMoves;
extern int lLocalCodes; extern int lLocalCodes;
END_PS_NS END_PS_NS

View file

@ -60,7 +60,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
pSky->yscale = 65536; pSky->yscale = 65536;
parallaxtype = 2; parallaxtype = 2;
g_visibility = 2048; g_visibility = 2048;
ogameclock = gameclock;
GameAction = 1000; GameAction = 1000;
if (currentLevel->levelNumber > 15) if (currentLevel->levelNumber > 15)