mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
- consolidated the 4 functions for handling the automap zoom.
This commit is contained in:
parent
6e6d74f058
commit
adbedd30c4
9 changed files with 45 additions and 134 deletions
|
@ -491,41 +491,11 @@ void GameInterface::Startup()
|
|||
}
|
||||
|
||||
|
||||
static void nonsharedkeys(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
double j = interval * (120. / 1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
gZoom += (int)fmulscale6(j, max(gZoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
gZoom -= (int)fmulscale6(j, max(gZoom, 256));
|
||||
|
||||
gZoom = clamp(gZoom, 48, 2048);
|
||||
gViewMap.nZoom = gZoom;
|
||||
}
|
||||
}
|
||||
|
||||
void GameInterface::Render()
|
||||
{
|
||||
nonsharedkeys();
|
||||
gZoom = GetAutomapZoom(gZoom);
|
||||
gViewMap.nZoom = gZoom;
|
||||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
viewDrawScreen();
|
||||
|
|
|
@ -1195,3 +1195,42 @@ void GameInterface::FreeLevelData()
|
|||
numsectors = numwalls = 0;
|
||||
currentLevel = nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int GetAutomapZoom(int gZoom)
|
||||
{
|
||||
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 gZoom;
|
||||
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
double j = interval * (120. / 1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
gZoom += (int)fmulscale6(j, max(gZoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
gZoom -= (int)fmulscale6(j, max(gZoom, 256));
|
||||
|
||||
gZoom = clamp(gZoom, 48, 2048);
|
||||
|
||||
}
|
||||
return gZoom;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ void CONFIG_ReadCombatMacros();
|
|||
|
||||
int GameMain();
|
||||
void startmainmenu();
|
||||
int GetAutomapZoom(int gZoom);
|
||||
void updatePauseStatus();
|
||||
void DeferedStartGame(MapRecord* map, int skill);
|
||||
void ChangeLevel(MapRecord* map, int skill);
|
||||
|
|
|
@ -51,7 +51,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_PS_NS
|
||||
|
||||
short nBestLevel;
|
||||
static int32_t nonsharedtimer;
|
||||
|
||||
extern uint8_t nCinemaSeen;
|
||||
|
||||
|
|
|
@ -88,37 +88,11 @@ void SendInput()
|
|||
|
||||
}
|
||||
|
||||
static int32_t nonsharedtimer;
|
||||
|
||||
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;
|
||||
lMapZoom = GetAutomapZoom(lMapZoom);
|
||||
|
||||
if (System_WantGuiCapture())
|
||||
return;
|
||||
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
double j = interval * (120. / 1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
lMapZoom += (int)fmulscale6(j, max(lMapZoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
lMapZoom -= (int)fmulscale6(j, max(lMapZoom, 256));
|
||||
|
||||
lMapZoom = clamp(lMapZoom, 48, 2048);
|
||||
}
|
||||
if (PlayerList[nLocalPlayer].nHealth <= 0)
|
||||
{
|
||||
SetAirFrame();
|
||||
|
|
|
@ -228,7 +228,6 @@ void startnewgame(MapRecord* map, int skill);
|
|||
void setlocalplayerinput(player_struct *pp);
|
||||
int playercolor2lookup(int color);
|
||||
void PlayerColorChanged(void);
|
||||
void nonsharedkeys(void);
|
||||
void apply_seasick(player_struct* p, double scalefactor);
|
||||
void calcviewpitch(player_struct* p, double factor);
|
||||
void sethorizon(int snum, ESyncBits actions, double factor, fixed_t adjustment);
|
||||
|
|
|
@ -146,7 +146,7 @@ void GameInterface::Startup()
|
|||
|
||||
void GameInterface::Render()
|
||||
{
|
||||
nonsharedkeys(); // automap zoom
|
||||
ps[myconnectindex].zoom = GetAutomapZoom(ps[myconnectindex].zoom);
|
||||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
videoSetBrightness(thunder_brightness);
|
||||
|
|
|
@ -41,7 +41,6 @@ source as it is released.
|
|||
BEGIN_DUKE_NS
|
||||
|
||||
// State timer counters.
|
||||
static int nonsharedtimer;
|
||||
static int turnheldtime;
|
||||
static int lastcontroltime;
|
||||
static double lastCheck;
|
||||
|
@ -58,42 +57,6 @@ void GameInterface::ResetFollowPos(bool message)
|
|||
if (message) FTA(automapFollow? QUOTE_MAP_FOLLOW_ON : QUOTE_MAP_FOLLOW_OFF, &ps[myconnectindex]);
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
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)
|
||||
{
|
||||
double j = interval * (120./1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
ps[myconnectindex].zoom += (int)fmulscale6(j, max(ps[myconnectindex].zoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
ps[myconnectindex].zoom -= (int)fmulscale6(j, max(ps[myconnectindex].zoom, 256));
|
||||
|
||||
ps[myconnectindex].zoom = clamp(ps[myconnectindex].zoom, 48, 2048);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// handles all HUD related input, i.e. inventory item selection and activation plus weapon selection.
|
||||
|
|
|
@ -939,39 +939,6 @@ post_analyzesprites(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int nonsharedtimer;
|
||||
|
||||
void
|
||||
ResizeView(PLAYERp pp)
|
||||
{
|
||||
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)
|
||||
{
|
||||
double j = interval * (120. / 1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
zoom += (int)fmulscale6(j, max(zoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
zoom -= (int)fmulscale6(j, max(zoom, 256));
|
||||
|
||||
zoom = clamp(zoom, 48, 2048);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz)
|
||||
|
@ -1911,8 +1878,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
SyncStatMessage();
|
||||
#endif
|
||||
|
||||
// certain input is done here - probably shouldn't be
|
||||
ResizeView(pp);
|
||||
zoom = GetAutomapZoom(zoom);
|
||||
|
||||
restoreinterpolations(); // Stick at end of drawscreen
|
||||
short_restoreinterpolations(); // Stick at end of drawscreen
|
||||
|
|
Loading…
Reference in a new issue