- redid the timer for the automap zoom

Add more precision and uncouple from the game timer
This commit is contained in:
Christoph Oelckers 2020-08-31 19:18:53 +02:00
parent 45a22eb3cd
commit 2bf368d49b
3 changed files with 19 additions and 17 deletions

View File

@ -242,6 +242,7 @@ void Display()
case GS_LEVEL:
if (gametic != 0)
{
screen->FrameTime = I_msTimeFS();
screen->BeginFrame();
screen->SetSceneRenderTarget(gl_ssao != 0);
twodpsp.Clear();

View File

@ -107,7 +107,6 @@ void GameInterface::Ticker()
{
exitlevel();
}
nonsharedkeys(); // this must go elsewhere later!
}
//---------------------------------------------------------------------------
@ -164,6 +163,7 @@ void GameInterface::Startup()
void GameInterface::Render()
{
nonsharedkeys(); // automap zoom
drawtime.Reset();
drawtime.Clock();
videoSetBrightness(thunder_brightness);

View File

@ -36,6 +36,7 @@ source as it is released.
#include "ns.h"
#include "global.h"
#include "gamecontrol.h"
#include "v_video.h"
BEGIN_DUKE_NS
@ -59,34 +60,35 @@ void GameInterface::ResetFollowPos(bool message)
}
//---------------------------------------------------------------------------
//
// handles UI side input not handled via CCMDs or CVARs.
// Most of what's in here needs to be offloaded to CCMDs
//
//
//---------------------------------------------------------------------------
void nonsharedkeys(void)
{
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)
{
int j;
if (nonsharedtimer > 0 || gameclock < nonsharedtimer)
{
j = gameclock - nonsharedtimer;
nonsharedtimer += j;
}
else
{
j = 0;
nonsharedtimer = gameclock;
}
double j = interval * (120./1000);
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
ps[myconnectindex].zoom += mulscale6(j, max(ps[myconnectindex].zoom, 256));
ps[myconnectindex].zoom += (int)fmulscale6(j, max(ps[myconnectindex].zoom, 256));
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
ps[myconnectindex].zoom -= mulscale6(j, max(ps[myconnectindex].zoom, 256));
ps[myconnectindex].zoom -= (int)fmulscale6(j, max(ps[myconnectindex].zoom, 256));
ps[myconnectindex].zoom = clamp(ps[myconnectindex].zoom, 48, 2048);
}
@ -1127,7 +1129,6 @@ void GameInterface::GetInput(InputPacket* packet)
void GameInterface::clearlocalinputstate()
{
loc = {};
nonsharedtimer = 0;
turnheldtime = 0;
lastcontroltime = 0;
lastCheck = 0;