- migrated Exhumed to a local ticker as well.

gameclock is history - all games now run on a timer that increments once per tick under their own control and not independently of the ticker routine.
This commit is contained in:
Christoph Oelckers 2020-09-02 21:42:12 +02:00
parent a222a7d7c9
commit b1a3080671
5 changed files with 26 additions and 19 deletions

View file

@ -985,13 +985,7 @@ void viewDrawScreen(bool sceneonly)
PLAYER *pPSprite = &gPlayer[gMe->pSprite->type-kDudePlayer1]; PLAYER *pPSprite = &gPlayer[gMe->pSprite->type-kDudePlayer1];
if (IsPlayerSprite(gMe->pSprite) && pPSprite->hand == 1) if (IsPlayerSprite(gMe->pSprite) && pPSprite->hand == 1)
{ {
//static int lastClock;
gChoke.animateChoke(160, zn, (int)gInterpolate); gChoke.animateChoke(160, zn, (int)gInterpolate);
//if ((gGameClock % 5) == 0 && gGameClock != lastClock)
//{
// gChoke.swayV(pPSprite);
//}
//lastClock = gGameClock;
} }
#if 0 #if 0
if (byte_1A76C6) if (byte_1A76C6)

View file

@ -96,8 +96,6 @@ GameInterface* gi;
int myconnectindex, numplayers; int myconnectindex, numplayers;
int connecthead, connectpoint2[MAXMULTIPLAYERS]; int connecthead, connectpoint2[MAXMULTIPLAYERS];
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. 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;
uint64_t gameclockstart;
int lastTic; int lastTic;
int automapMode; int automapMode;

View file

@ -879,12 +879,12 @@ void TextOverlay::DisplayText()
} }
} }
bool TextOverlay::AdvanceCinemaText(int gameclock) bool TextOverlay::AdvanceCinemaText(int clock)
{ {
if (nHeight + nCrawlY > 0 || CDplaying()) if (nHeight + nCrawlY > 0 || CDplaying())
{ {
nCrawlY-= (gameclock - lastclock) / 15.; // do proper interpolation. nCrawlY-= (clock - lastclock) / 15.; // do proper interpolation.
lastclock = gameclock; lastclock = clock;
return true; return true;
} }

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "view.h" #include "view.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include <string.h> #include <string.h>
#include "v_video.h"
BEGIN_PS_NS BEGIN_PS_NS
@ -91,20 +92,33 @@ static int32_t nonsharedtimer;
void CheckKeys2() void CheckKeys2()
{ {
static int nonsharedtimer;
int ms = screen->FrameTime;
int interval;
if (nonsharedtimer > 0 || ms < nonsharedtimer)
{
interval = ms - nonsharedtimer;
}
else
{
interval = 0;
}
nonsharedtimer = screen->FrameTime;
if (System_WantGuiCapture())
return;
if (automapMode != am_off) if (automapMode != am_off)
{ {
int const timerOffset = (gameclock - nonsharedtimer); double j = interval * (120. / 1000);
nonsharedtimer += timerOffset;
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
lMapZoom += mulscale6(timerOffset, max<int>(lMapZoom, 256)); lMapZoom += (int)fmulscale6(j, max(lMapZoom, 256));
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
lMapZoom -= mulscale6(timerOffset, max<int>(lMapZoom, 256)); lMapZoom -= (int)fmulscale6(j, max(lMapZoom, 256));
lMapZoom = clamp(lMapZoom, 48, 2048); lMapZoom = clamp(lMapZoom, 48, 2048);
} }
if (PlayerList[nLocalPlayer].nHealth <= 0) if (PlayerList[nLocalPlayer].nHealth <= 0)
{ {
SetAirFrame(); SetAirFrame();

View file

@ -404,6 +404,7 @@ void DrawView(double smoothRatio, bool sceneonly)
if (nFreeze == 2) if (nFreeze == 2)
{ {
int myclock = leveltime + mulscale16(4, (int)smoothRatio);
if (nHeadStage == 4) if (nHeadStage == 4)
{ {
nHeadStage = 5; nHeadStage = 5;
@ -422,7 +423,7 @@ void DrawView(double smoothRatio, bool sceneonly)
if (bSubTitles) if (bSubTitles)
{ {
subtitleOverlay.Start(gameclock); subtitleOverlay.Start(myclock);
if (currentLevel->levelNumber == 1) if (currentLevel->levelNumber == 1)
subtitleOverlay.ReadyCinemaText(0); subtitleOverlay.ReadyCinemaText(0);
else else
@ -432,7 +433,7 @@ void DrawView(double smoothRatio, bool sceneonly)
} }
else if (nHeadStage == 5) else if (nHeadStage == 5)
{ {
if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(gameclock)) || inputState.CheckAllInput()) if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(myclock)) || inputState.CheckAllInput())
{ {
inputState.ClearAllInput(); inputState.ClearAllInput();
EndLevel = 2; EndLevel = 2;