Factor out setting baslayer timer from game into G_InitTimer().

git-svn-id: https://svn.eduke32.com/eduke32@3485 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-02-16 18:52:56 +00:00
parent 1bdc416e5f
commit 5e84185d6e
4 changed files with 16 additions and 32 deletions

View file

@ -7561,6 +7561,16 @@ void G_SetViewportShrink(int32_t dir)
G_UpdateScreenArea();
}
void G_InitTimer(int32_t ticspersec)
{
if (g_timerTicsPerSecond != ticspersec)
{
uninittimer();
inittimer(ticspersec);
g_timerTicsPerSecond = ticspersec;
}
}
void G_HandleLocalKeys(void)
{
int32_t i,ch;
@ -7707,27 +7717,15 @@ void G_HandleLocalKeys(void)
#if 0
if (KB_KeyPressed(sc_kpad_Plus))
{
if (g_timerTicsPerSecond != 240)
{
uninittimer();
inittimer(240);
g_timerTicsPerSecond = 240;
}
G_InitTimer(240);
}
else if (KB_KeyPressed(sc_kpad_Minus))
{
if (g_timerTicsPerSecond != 60)
{
uninittimer();
inittimer(60);
g_timerTicsPerSecond = 60;
}
G_InitTimer(60);
}
else if (g_timerTicsPerSecond != 120)
{
uninittimer();
inittimer(120);
g_timerTicsPerSecond = 120;
G_InitTimer(120);
}
#endif

View file

@ -321,6 +321,7 @@ void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
int32_t app_main(int32_t argc,const char **argv);
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
void G_InitTimer(int32_t ticpersec);
static inline int32_t G_GetTeamPalette(int32_t team)
{

View file

@ -2238,15 +2238,7 @@ nullquote:
case CON_INITTIMER:
insptr++;
{
int32_t j = Gv_GetVarX(*insptr++);
if (g_timerTicsPerSecond == j)
continue;
uninittimer();
inittimer((g_timerTicsPerSecond = j));
}
G_InitTimer(Gv_GetVarX(*insptr++));
continue;
case CON_TIME:

View file

@ -1158,20 +1158,13 @@ static int32_t osdcmd_restorestate(const osdfuncparm_t *parm)
#ifdef DEBUGGINGAIDS
static int32_t osdcmd_inittimer(const osdfuncparm_t *parm)
{
int32_t j;
if (parm->numparms != 1)
{
OSD_Printf("%dHz timer\n",g_timerTicsPerSecond);
return OSDCMD_SHOWHELP;
}
j = Batol(parm->parms[0]);
if (g_timerTicsPerSecond == j)
return OSDCMD_OK;
uninittimer();
inittimer(j);
g_timerTicsPerSecond = j;
G_InitTimer(Batol(parm->parms[0]));
OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK;