diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 63bdd31fd..7a5205824 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -69,7 +69,6 @@ BEGIN_BLD_NS void InitCheats(); bool bNoDemo = false; -bool gameRestart; int gNetPlayers; int gQuitRequest; int gChokeCounter = 0; @@ -100,6 +99,8 @@ void EndLevel(void) void StartLevel(MapRecord* level) { if (!level) return; + gFrameCount = 0; + gFrameClock = 0; STAT_Update(0); EndLevel(); gInput = {}; @@ -142,7 +143,6 @@ void StartLevel(MapRecord* level) wsrand(dbReadMapCRC(currentLevel->LabelName())); gKillMgr.Clear(); gSecretMgr.Clear(); - gLevelTime = 0; automapping = 1; int modernTypesErased = 0; @@ -239,15 +239,12 @@ void StartLevel(MapRecord* level) sfxSetReverb(0); ambInit(); Net_ClearFifo(); - gFrameCount = 0; gChokeCounter = 0; M_ClearMenus(); // viewSetMessage(""); viewSetErrorMessage(""); - gameclock = 0; paused = 0; levelTryPlayMusic(); - gFrameClock = 0; gChoke.reset(); } @@ -261,15 +258,6 @@ static void commonTicker() FireProcess(); ClearBitString(gotpic, 2342); } - // This is single player only. - if (gameRestart) - { - gameRestart = false; - levelRestart(); - gamestate = GS_LEVEL; - return; - } - if (gStartNewGame) { auto sng = gStartNewGame; @@ -331,6 +319,7 @@ void GameInterface::Ticker() } viewClearInterpolations(); + if (!(paused || (gGameOptions.nGameType == 0 && M_Active()))) { thinktime.Reset(); @@ -370,7 +359,6 @@ void GameInterface::Ticker() } thinktime.Unclock(); - gLevelTime++; gFrameCount++; gFrameClock += 4; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 9a1d8a2ac..a783fdc74 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -123,13 +123,13 @@ void GetInputInternal(InputPacket &inputParm) static int32_t turnHeldTime; static int32_t lastInputClock; // MED - int32_t const elapsedTics = gameclock - lastInputClock; + int32_t const elapsedTics = gFrameClock - lastInputClock; // Blood's q16mlook scaling is different from the other games, therefore use the below constant to attenuate // the speed to match the other games. float const mlookScale = 3.25f; - lastInputClock = gameclock; + lastInputClock = gFrameClock; if (turnLeft || turnRight) turnHeldTime += elapsedTics; diff --git a/source/blood/src/globals.cpp b/source/blood/src/globals.cpp index 886456409..c517b7a51 100644 --- a/source/blood/src/globals.cpp +++ b/source/blood/src/globals.cpp @@ -35,7 +35,6 @@ BEGIN_BLD_NS bool bVanilla = false; int gFrameClock; int gFrameCount; -//int volatile gGameClock; static const char *_module; static int _line; diff --git a/source/blood/src/globals.h b/source/blood/src/globals.h index 4dce8e78d..5b784e21f 100644 --- a/source/blood/src/globals.h +++ b/source/blood/src/globals.h @@ -32,7 +32,6 @@ BEGIN_BLD_NS extern int gFrameClock; extern int gFrameCount; -//extern int gGameClock; extern bool bVanilla; #define MAXPLAYERNAME 16 diff --git a/source/blood/src/levels.cpp b/source/blood/src/levels.cpp index bce54c4d2..2a19ce3ec 100644 --- a/source/blood/src/levels.cpp +++ b/source/blood/src/levels.cpp @@ -54,8 +54,6 @@ int gSkill = 2; int gEpisodeCount; int gNextLevel; // fixme: let this contain a full level number. -int gLevelTime; - char BloodIniFile[BMAX_PATH] = "BLOOD.INI"; bool bINIOverride = false; IniFile *BloodINI; @@ -235,11 +233,6 @@ void levelEndLevel(int arg) } } -void levelRestart(void) -{ - gStartNewGame = currentLevel; -} - void levelTryPlayMusic() { FString buffer; diff --git a/source/blood/src/levels.h b/source/blood/src/levels.h index a711881bc..6c5c7ad63 100644 --- a/source/blood/src/levels.h +++ b/source/blood/src/levels.h @@ -85,7 +85,6 @@ extern bool bINIOverride; extern int gEpisodeCount; extern int gNextLevel; extern bool gGameStarted; -extern int gLevelTime; void levelInitINI(const char *pzIni); void levelOverrideINI(const char *pzIni); @@ -98,7 +97,6 @@ void CheckKeyAbend(const char *pzSection, const char *pzKey); void levelLoadDefaults(void); // arg: 0 is normal exit, 1 is secret level void levelEndLevel(int arg); -void levelRestart(void); void levelTryPlayMusic(); END_BLD_NS diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 41940dd4d..a29bcfe5e 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -504,7 +504,6 @@ bool GameInterface::LoadGame(FSaveGameNode* node) for (int i = 0; i < gNetPlayers; i++) playerSetRace(&gPlayer[i], gPlayer[i].lifeMode); viewSetErrorMessage(""); - gFrameCount = 0; Net_ClearFifo(); paused = 0; gamestate = GS_LEVEL; @@ -598,7 +597,6 @@ void MyLoadSave::Load(void) Read(gotsector, sizeof(gotsector)); Read(&gFrameClock, sizeof(gFrameClock)); Read(&gFrameCount, sizeof(gFrameCount)); - Read(&gLevelTime, sizeof(gLevelTime)); Read(&paused, sizeof(paused)); Read(baseWall, sizeof(baseWall[0])*numwalls); Read(baseSprite, sizeof(baseSprite[0])*nNumSprites); @@ -687,7 +685,6 @@ void MyLoadSave::Save(void) Write(gotsector, sizeof(gotsector)); Write(&gFrameClock, sizeof(gFrameClock)); Write(&gFrameCount, sizeof(gFrameCount)); - Write(&gLevelTime, sizeof(gLevelTime)); Write(&paused, sizeof(paused)); Write(baseWall, sizeof(baseWall[0])*numwalls); Write(baseSprite, sizeof(baseSprite[0])*nNumSprites); diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 0dfbd6967..14bd39cff 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -50,8 +50,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -extern bool gameRestart; - PROFILE gProfile[kMaxPlayers]; PLAYER gPlayer[kMaxPlayers]; @@ -1370,7 +1368,7 @@ void ProcessInput(PLAYER *pPlayer) playerReset(pPlayer); if (gGameOptions.nGameType == 0 && numplayers == 1) { - gameRestart = 1; + gStartNewGame = currentLevel; } else playerStart(pPlayer->nPlayer); diff --git a/source/blood/src/sbar.cpp b/source/blood/src/sbar.cpp index 1bb2eea62..e1e342bfd 100644 --- a/source/blood/src/sbar.cpp +++ b/source/blood/src/sbar.cpp @@ -222,7 +222,7 @@ private: stats.font = SmallFont; stats.letterColor = CR_DARKRED; stats.standardColor = CR_DARKGRAY; - stats.time = Scale(gLevelTime, 1000, kTicsPerSec); + stats.time = Scale(gFrameCount, 1000, kTicsPerSec); if (automapMode == am_full) { diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 9691d27bc..f1b5d2cfa 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -224,7 +224,7 @@ void InitStatusBar(void) } GameStats GameInterface::getStats() { - return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gLevelTime / kTicsPerSec, gPlayer[myconnectindex].fragCount }; + return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gFrameCount / kTicsPerSec, gPlayer[myconnectindex].fragCount }; } void viewDrawMapTitle(void) @@ -234,9 +234,9 @@ void viewDrawMapTitle(void) int const fadeStartTic = kTicsPerSec; int const fadeEndTic = int(1.5f*kTicsPerSec); - if (gLevelTime > fadeEndTic) + if (gFrameCount > fadeEndTic) return; - int const alpha = 255 - clamp((gLevelTime-fadeStartTic)*255/(fadeEndTic-fadeStartTic), 0, 255); + int const alpha = 255 - clamp((gFrameCount-fadeStartTic)*255/(fadeEndTic-fadeStartTic), 0, 255); if (alpha != 0) { @@ -762,7 +762,7 @@ void viewDrawScreen(bool sceneonly) tmp--; } PLAYER* pOther = &gPlayer[i]; - //othercameraclock = gGameClock; + //othercameraclock = gFrameClock + mulscale16(4, (int)gInterpolate);; if (!tileData(4079)) { TileFiles.tileCreate(4079, 128, 128);