mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +00:00
- Duke: Migrate away from using totalclock
and use new game-specific gameclock
with underlying timer code in common.
* Build timer still requires initialisation due to multiple `timerSetCallback()` that still need to work. # Conflicts: # source/core/menu/menu.cpp # source/games/duke/src/game.cpp
This commit is contained in:
parent
ab06235971
commit
afb09456e0
25 changed files with 104 additions and 96 deletions
|
@ -69,6 +69,11 @@ static int NSToTic(uint64_t ns)
|
||||||
return static_cast<int>(ns * GameTicRate / 1'000'000'000);
|
return static_cast<int>(ns * GameTicRate / 1'000'000'000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int NSToBuildTic(uint64_t ns)
|
||||||
|
{
|
||||||
|
return static_cast<int>(ns * 120 / 1'000'000'000);
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t TicToNS(int tic)
|
static uint64_t TicToNS(int tic)
|
||||||
{
|
{
|
||||||
return static_cast<uint64_t>(tic) * 1'000'000'000 / GameTicRate;
|
return static_cast<uint64_t>(tic) * 1'000'000'000 / GameTicRate;
|
||||||
|
@ -160,6 +165,11 @@ int I_GetTime()
|
||||||
return NSToTic(CurrentFrameStartTime - FirstFrameStartTime);
|
return NSToTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int I_GetBuildTime()
|
||||||
|
{
|
||||||
|
return NSToBuildTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||||
|
}
|
||||||
|
|
||||||
double I_GetTimeFrac()
|
double I_GetTimeFrac()
|
||||||
{
|
{
|
||||||
int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime);
|
int currentTic = NSToTic(CurrentFrameStartTime - FirstFrameStartTime);
|
||||||
|
|
|
@ -12,6 +12,9 @@ int I_GetTime();
|
||||||
// same, but using nanoseconds
|
// same, but using nanoseconds
|
||||||
uint64_t I_GetTimeNS();
|
uint64_t I_GetTimeNS();
|
||||||
|
|
||||||
|
// Called by Build games in liew of totalclock, returns current time in tics at ticrate of 120.
|
||||||
|
int I_GetBuildTime();
|
||||||
|
|
||||||
double I_GetTimeFrac();
|
double I_GetTimeFrac();
|
||||||
|
|
||||||
// like I_GetTime, except it waits for a new tic before returning
|
// like I_GetTime, except it waits for a new tic before returning
|
||||||
|
|
|
@ -153,7 +153,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
||||||
case SECTOREFFECTOR:
|
case SECTOREFFECTOR:
|
||||||
if(t->lotag == 27 && ud.recstat == 1)
|
if(t->lotag == 27 && ud.recstat == 1)
|
||||||
{
|
{
|
||||||
t->picnum = 11+(((int)totalclock>>3)&1);
|
t->picnum = 11+((gameclock>>3)&1);
|
||||||
t->cstat |= 128;
|
t->cstat |= 128;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -250,7 +250,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
||||||
t->z -= (4<<8);
|
t->z -= (4<<8);
|
||||||
break;
|
break;
|
||||||
case CRYSTALAMMO:
|
case CRYSTALAMMO:
|
||||||
t->shade = (sintable[((int)totalclock<<4)&2047]>>10);
|
t->shade = (sintable[(gameclock<<4)&2047]>>10);
|
||||||
continue;
|
continue;
|
||||||
case VIEWSCREEN:
|
case VIEWSCREEN:
|
||||||
case VIEWSCREEN2:
|
case VIEWSCREEN2:
|
||||||
|
@ -268,10 +268,10 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHRINKSPARK:
|
case SHRINKSPARK:
|
||||||
t->picnum = SHRINKSPARK+( ((int)totalclock>>4)&3 );
|
t->picnum = SHRINKSPARK+( (gameclock>>4)&3 );
|
||||||
break;
|
break;
|
||||||
case GROWSPARK:
|
case GROWSPARK:
|
||||||
t->picnum = GROWSPARK+( ((int)totalclock>>4)&3 );
|
t->picnum = GROWSPARK+( (gameclock>>4)&3 );
|
||||||
break;
|
break;
|
||||||
case RPG:
|
case RPG:
|
||||||
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
|
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
|
||||||
|
@ -646,7 +646,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
||||||
if(t->picnum == EXPLOSION2)
|
if(t->picnum == EXPLOSION2)
|
||||||
{
|
{
|
||||||
ps[screenpeek].visibility = -127;
|
ps[screenpeek].visibility = -127;
|
||||||
lastvisinc = (int)totalclock+32;
|
lastvisinc = gameclock+32;
|
||||||
}
|
}
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -142,7 +142,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
case SECTOREFFECTOR:
|
case SECTOREFFECTOR:
|
||||||
if (t->lotag == 27 && ud.recstat == 1)
|
if (t->lotag == 27 && ud.recstat == 1)
|
||||||
{
|
{
|
||||||
t->picnum = 11 + (((int)totalclock >> 3) & 1);
|
t->picnum = 11 + ((gameclock >> 3) & 1);
|
||||||
t->cstat |= 128;
|
t->cstat |= 128;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -180,7 +180,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
case RESPAWNMARKERRED:
|
case RESPAWNMARKERRED:
|
||||||
case RESPAWNMARKERYELLOW:
|
case RESPAWNMARKERYELLOW:
|
||||||
case RESPAWNMARKERGREEN:
|
case RESPAWNMARKERGREEN:
|
||||||
t->picnum = 861+( ((int)totalclock>>4) & 13);
|
t->picnum = 861+( (gameclock>>4) & 13);
|
||||||
if (s->picnum == RESPAWNMARKERRED)
|
if (s->picnum == RESPAWNMARKERRED)
|
||||||
t->pal = 0;
|
t->pal = 0;
|
||||||
else if (s->picnum == RESPAWNMARKERYELLOW)
|
else if (s->picnum == RESPAWNMARKERYELLOW)
|
||||||
|
@ -247,21 +247,21 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
t->z -= (4<<8);
|
t->z -= (4<<8);
|
||||||
break;
|
break;
|
||||||
case CRYSTALAMMO:
|
case CRYSTALAMMO:
|
||||||
t->shade = (sintable[((int)totalclock<<4)&2047]>>10);
|
t->shade = (sintable[(gameclock<<4)&2047]>>10);
|
||||||
break;
|
break;
|
||||||
case SHRINKSPARK:
|
case SHRINKSPARK:
|
||||||
if ((sprite[s->owner].picnum == CHEER || sprite[s->owner].picnum == CHEERSTAYPUT) && isRRRA())
|
if ((sprite[s->owner].picnum == CHEER || sprite[s->owner].picnum == CHEERSTAYPUT) && isRRRA())
|
||||||
{
|
{
|
||||||
t->picnum = CHEERBLADE+( ((int)totalclock>>4)&3 );
|
t->picnum = CHEERBLADE+( (gameclock>>4)&3 );
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t->picnum = SHRINKSPARK+( ((int)totalclock>>4)&7 );
|
t->picnum = SHRINKSPARK+( (gameclock>>4)&7 );
|
||||||
break;
|
break;
|
||||||
case CHEERBOMB:
|
case CHEERBOMB:
|
||||||
if (isRRRA())
|
if (isRRRA())
|
||||||
{
|
{
|
||||||
t->picnum = CHEERBOMB + (((int)totalclock >> 4) & 3);
|
t->picnum = CHEERBOMB + ((gameclock >> 4) & 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else goto default_case;
|
else goto default_case;
|
||||||
|
@ -269,10 +269,10 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
if(isRRRA())
|
if(isRRRA())
|
||||||
{
|
{
|
||||||
if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 8)
|
if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 8)
|
||||||
t->picnum = RRTILE3500 + (((int)totalclock >> 4) % 6);
|
t->picnum = RRTILE3500 + ((gameclock >> 4) % 6);
|
||||||
else if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 19)
|
else if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 19)
|
||||||
{
|
{
|
||||||
t->picnum = RRTILE5090 + (((int)totalclock >> 4) & 3);
|
t->picnum = RRTILE5090 + ((gameclock >> 4) & 3);
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
}
|
}
|
||||||
else if (sprite[s->owner].picnum == MAMA)
|
else if (sprite[s->owner].picnum == MAMA)
|
||||||
|
@ -288,10 +288,10 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
t->picnum = RRTILE7274 + k;
|
t->picnum = RRTILE7274 + k;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t->picnum = SPIT + (((int)totalclock >> 4) & 3);
|
t->picnum = SPIT + ((gameclock >> 4) & 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t->picnum = SPIT + (((int)totalclock >> 4) & 3);
|
t->picnum = SPIT + ((gameclock >> 4) & 3);
|
||||||
break;
|
break;
|
||||||
case EMPTYBIKE:
|
case EMPTYBIKE:
|
||||||
if (!isRRRA()) goto default_case;
|
if (!isRRRA()) goto default_case;
|
||||||
|
@ -796,12 +796,12 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
if(t->picnum == EXPLOSION2)
|
if(t->picnum == EXPLOSION2)
|
||||||
{
|
{
|
||||||
ps[screenpeek].visibility = -127;
|
ps[screenpeek].visibility = -127;
|
||||||
lastvisinc = (int)totalclock+32;
|
lastvisinc = gameclock+32;
|
||||||
t->pal = 0;
|
t->pal = 0;
|
||||||
}
|
}
|
||||||
else if(t->picnum == FIRELASER)
|
else if(t->picnum == FIRELASER)
|
||||||
{
|
{
|
||||||
t->picnum = FIRELASER+(((int)totalclock>>2)&5);
|
t->picnum = FIRELASER+((gameclock>>2)&5);
|
||||||
}
|
}
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
break;
|
break;
|
||||||
|
@ -897,11 +897,11 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
break;
|
break;
|
||||||
case RRTILE2034:
|
case RRTILE2034:
|
||||||
t->picnum = RRTILE2034+((int)totalclock&1);
|
t->picnum = RRTILE2034+(gameclock&1);
|
||||||
break;
|
break;
|
||||||
case RRTILE2944:
|
case RRTILE2944:
|
||||||
t->shade = -127;
|
t->shade = -127;
|
||||||
t->picnum = RRTILE2944+(((int)totalclock>>2)&4);
|
t->picnum = RRTILE2944+((gameclock>>2)&4);
|
||||||
break;
|
break;
|
||||||
case PLAYERONWATER:
|
case PLAYERONWATER:
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ static bool cheatView(cheatseq_t *)
|
||||||
{
|
{
|
||||||
ps[myconnectindex].over_shoulder_on = 1;
|
ps[myconnectindex].over_shoulder_on = 1;
|
||||||
cameradist = 0;
|
cameradist = 0;
|
||||||
cameraclock = (int)totalclock;
|
cameraclock = gameclock;
|
||||||
}
|
}
|
||||||
//FTA(22,&ps[myconnectindex]); this message makes no sense.
|
//FTA(22,&ps[myconnectindex]); this message makes no sense.
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ static void Menu_DrawCursor(double x, double y, double scale, bool right)
|
||||||
{
|
{
|
||||||
const int frames = isRR() ? 16 : 7;
|
const int frames = isRR() ? 16 : 7;
|
||||||
int picnum;
|
int picnum;
|
||||||
if (!right) picnum = TILE_SPINNINGNUKEICON + (((int)totalclock >> 3) % frames);
|
if (!right) picnum = TILE_SPINNINGNUKEICON + ((gameclock >> 3) % frames);
|
||||||
else picnum = TILE_SPINNINGNUKEICON + frames - 1 - ((frames - 1 + ((int)totalclock >> 3)) % frames);
|
else picnum = TILE_SPINNINGNUKEICON + frames - 1 - ((frames - 1 + (gameclock >> 3)) % frames);
|
||||||
int light = int(224 + 31 * sin((int)totalclock / 20.));
|
int light = int(224 + 31 * sin(gameclock / 20.));
|
||||||
PalEntry pe(255, light, light, light);
|
PalEntry pe(255, light, light, light);
|
||||||
DrawTexture(twod, tileGetTexture(picnum), x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
|
DrawTexture(twod, tileGetTexture(picnum), x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ class DukeMainMenu : public DukeListMenu
|
||||||
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, TAG_DONE);
|
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, TAG_DONE);
|
||||||
if (PLUTOPAK)
|
if (PLUTOPAK)
|
||||||
{
|
{
|
||||||
int light = 224 + 31 * sin(int(totalclock) / 40.);
|
int light = 224 + 31 * sin(gameclock / 40.);
|
||||||
PalEntry pe(255, light, light, light);
|
PalEntry pe(255, light, light, light);
|
||||||
DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
|
DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
|
||||||
else if (state == NIT_SelectedState)
|
else if (state == NIT_SelectedState)
|
||||||
{
|
{
|
||||||
trans = 0;
|
trans = 0;
|
||||||
int light = 224 + 31 * sin(int(totalclock) / 20.);
|
int light = 224 + 31 * sin(gameclock / 20.);
|
||||||
pe = PalEntry(255, light, light, light);
|
pe = PalEntry(255, light, light, light);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -219,7 +219,7 @@ void GameInterface::MenuOpened()
|
||||||
if (ud.multimode < 2)
|
if (ud.multimode < 2)
|
||||||
{
|
{
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
totalclock = ototalclock;
|
//I_FreezeTime(true);
|
||||||
screenpeek = myconnectindex;
|
screenpeek = myconnectindex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,8 +261,8 @@ void GameInterface::MenuClosed()
|
||||||
if (ud.multimode < 2 && ud.recstat != 2)
|
if (ud.multimode < 2 && ud.recstat != 2)
|
||||||
{
|
{
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
totalclock = ototalclock;
|
//I_FreezeTime(false);
|
||||||
cameraclock = (int32_t)totalclock;
|
cameraclock = gameclock;
|
||||||
cameradist = 65536;
|
cameradist = 65536;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ static int GetPlayerColor(int color)
|
||||||
void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
|
void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
|
||||||
{
|
{
|
||||||
int color = TRANSLATION(Translation_Remap, playercolor2lookup(playercolor));
|
int color = TRANSLATION(Translation_Remap, playercolor2lookup(playercolor));
|
||||||
int tile = isRR() ? 3845 + 36 - ((((8 - (totalclock >> 4))) & 7) * 5) : 1441 - ((((4 - (totalclock >> 4))) & 3) * 5);
|
int tile = isRR() ? 3845 + 36 - ((((8 - (gameclock >> 4))) & 7) * 5) : 1441 - ((((4 - (gameclock >> 4))) & 3) * 5);
|
||||||
auto tex = tileGetTexture(tile);
|
auto tex = tileGetTexture(tile);
|
||||||
if (!tex) return;
|
if (!tex) return;
|
||||||
double x = origin.X + 260, y = origin.Y + tex->GetDisplayHeight() * (isRR()? 0.25 : 0.5);
|
double x = origin.X + 260, y = origin.Y + tex->GetDisplayHeight() * (isRR()? 0.25 : 0.5);
|
||||||
|
|
|
@ -350,7 +350,7 @@ static void Startup(void)
|
||||||
SetDispatcher();
|
SetDispatcher();
|
||||||
S_InitSound();
|
S_InitSound();
|
||||||
|
|
||||||
timerInit(GameTicRate);
|
timerInit(TICRATE);
|
||||||
|
|
||||||
loadcons();
|
loadcons();
|
||||||
fi.initactorflags();
|
fi.initactorflags();
|
||||||
|
|
|
@ -149,7 +149,7 @@ void FTA(int q, struct player_struct* p)
|
||||||
if (q < 0 || !(p->gm & MODE_GAME))
|
if (q < 0 || !(p->gm & MODE_GAME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (p->ftq != q || (totalclock - p->ftt > TICRATE && q != QUOTE_DEAD))
|
if (p->ftq != q || (gameclock - p->ftt > TICRATE && q != QUOTE_DEAD))
|
||||||
{
|
{
|
||||||
p->ftq = q;
|
p->ftq = q;
|
||||||
auto qu = quoteMgr.GetQuote(q);
|
auto qu = quoteMgr.GetQuote(q);
|
||||||
|
@ -167,7 +167,7 @@ void FTA(int q, struct player_struct* p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->ftt = totalclock;
|
p->ftt = gameclock;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -639,7 +639,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
|
||||||
{
|
{
|
||||||
auto& pp = ps[p];
|
auto& pp = ps[p];
|
||||||
if (sprite[pp.i].xvel > 16 && pp.on_ground)
|
if (sprite[pp.i].xvel > 16 && pp.on_ground)
|
||||||
i = TILE_APLAYERTOP + (((int)totalclock >> 4) & 3);
|
i = TILE_APLAYERTOP + ((gameclock >> 4) & 3);
|
||||||
else
|
else
|
||||||
i = TILE_APLAYERTOP;
|
i = TILE_APLAYERTOP;
|
||||||
|
|
||||||
|
@ -675,16 +675,16 @@ void cameratext(int i)
|
||||||
drawitem(TILE_CAMCORNER + 1, 24, 163, true, true);
|
drawitem(TILE_CAMCORNER + 1, 24, 163, true, true);
|
||||||
drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true);
|
drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true);
|
||||||
|
|
||||||
if ((int)totalclock & 16)
|
if (gameclock & 16)
|
||||||
drawitem(TILE_CAMLIGHT, 46, 32, false, false);
|
drawitem(TILE_CAMLIGHT, 46, 32, false, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int flipbits = ((int)totalclock << 1) & 48;
|
int flipbits = (gameclock << 1) & 48;
|
||||||
|
|
||||||
for (int x = -64; x < 394; x += 64)
|
for (int x = -64; x < 394; x += 64)
|
||||||
for (int y = 0; y < 200; y += 64)
|
for (int y = 0; y < 200; y += 64)
|
||||||
drawitem(TILE_STATIC, x, y, !!((int)totalclock & 8), !!((int)totalclock & 16));
|
drawitem(TILE_STATIC, x, y, !!(gameclock & 8), !!(gameclock & 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1042,7 +1042,7 @@ int ParseState::parse(void)
|
||||||
resetweapons(g_p);
|
resetweapons(g_p);
|
||||||
|
|
||||||
//cameradist = 0;
|
//cameradist = 0;
|
||||||
//cameraclock = totalclock;
|
//cameraclock = gameclock;
|
||||||
}
|
}
|
||||||
setpal(&ps[g_p]);
|
setpal(&ps[g_p]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -329,11 +329,13 @@ bool GameTicker()
|
||||||
gameupdatetime.Reset();
|
gameupdatetime.Reset();
|
||||||
gameupdatetime.Clock();
|
gameupdatetime.Clock();
|
||||||
|
|
||||||
int currentTic = I_GetTime();
|
int const currentTic = I_GetTime();
|
||||||
|
gameclock = I_GetBuildTime();
|
||||||
|
|
||||||
if (playrunning() && currentTic - lastTic >= 1)
|
if (playrunning() && currentTic - lastTic >= 1)
|
||||||
{
|
{
|
||||||
lastTic = currentTic;
|
lastTic = currentTic;
|
||||||
|
gameclock = currentTic << 2;
|
||||||
|
|
||||||
GetInput();
|
GetInput();
|
||||||
auto const pPlayer = &ps[myconnectindex];
|
auto const pPlayer = &ps[myconnectindex];
|
||||||
|
@ -356,11 +358,10 @@ bool GameTicker()
|
||||||
moveloop();
|
moveloop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!playrunning())
|
|
||||||
{
|
//I_FreezeTime(!playrunning());
|
||||||
ototalclock = totalclock - 1;
|
|
||||||
}
|
double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio;
|
||||||
double const smoothRatio = I_GetTimeFrac() * 65536.;
|
|
||||||
|
|
||||||
gameupdatetime.Unclock();
|
gameupdatetime.Unclock();
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ void GameInterface::RunGameFrame()
|
||||||
default:
|
default:
|
||||||
case GS_STARTUP:
|
case GS_STARTUP:
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
ototalclock = 0;
|
gameclock = 0;
|
||||||
lockclock = 0;
|
lockclock = 0;
|
||||||
|
|
||||||
ps[myconnectindex].ftq = 0;
|
ps[myconnectindex].ftq = 0;
|
||||||
|
|
|
@ -53,7 +53,7 @@ int max_player_health;
|
||||||
int max_armour_amount;
|
int max_armour_amount;
|
||||||
int lasermode;
|
int lasermode;
|
||||||
|
|
||||||
int cameradist = 0, cameraclock = 0;
|
int gameclock = 0, cameradist = 0, cameraclock = 0;
|
||||||
int otherp;
|
int otherp;
|
||||||
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
|
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
|
||||||
ActorInfo actorinfo[MAXTILES];
|
ActorInfo actorinfo[MAXTILES];
|
||||||
|
@ -69,7 +69,6 @@ int gamequit;
|
||||||
int playerswhenstarted;
|
int playerswhenstarted;
|
||||||
int show_shareware;
|
int show_shareware;
|
||||||
int screenpeek;
|
int screenpeek;
|
||||||
ClockTicks ototalclock;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ extern int max_player_health;
|
||||||
extern int max_armour_amount;
|
extern int max_armour_amount;
|
||||||
extern int lasermode;
|
extern int lasermode;
|
||||||
|
|
||||||
|
extern int gameclock;
|
||||||
extern int cameraclock;
|
extern int cameraclock;
|
||||||
extern int cameradist;
|
extern int cameradist;
|
||||||
extern int otherp; // transient helper, MP only
|
extern int otherp; // transient helper, MP only
|
||||||
|
@ -56,7 +57,6 @@ extern int gamequit;
|
||||||
extern int playerswhenstarted;
|
extern int playerswhenstarted;
|
||||||
extern int show_shareware;
|
extern int show_shareware;
|
||||||
extern int screenpeek;
|
extern int screenpeek;
|
||||||
extern ClockTicks ototalclock;
|
|
||||||
|
|
||||||
// Variables that must be saved
|
// Variables that must be saved
|
||||||
extern uint8_t sectorextra[MAXSECTORS]; // these hold fields that were formerly in sprite and sector. Move these back into the base structs!
|
extern uint8_t sectorextra[MAXSECTORS]; // these hold fields that were formerly in sprite and sector. Move these back into the base structs!
|
||||||
|
|
|
@ -77,7 +77,7 @@ void displaymasks_r(int snum)
|
||||||
{
|
{
|
||||||
int pin = 0;
|
int pin = 0;
|
||||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH;
|
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH;
|
||||||
hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (calcSinTableValue(totalclock) / 1024.)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
|
hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (calcSinTableValue(gameclock) / 1024.)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
|
||||||
hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x), (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);
|
hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x), (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);
|
||||||
hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin);
|
hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin);
|
||||||
hud_drawsprite(35, (-1), 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin);
|
hud_drawsprite(35, (-1), 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin);
|
||||||
|
|
|
@ -104,7 +104,7 @@ void nonsharedkeys(void)
|
||||||
{
|
{
|
||||||
ps[myconnectindex].over_shoulder_on = 1;
|
ps[myconnectindex].over_shoulder_on = 1;
|
||||||
cameradist = 0;
|
cameradist = 0;
|
||||||
cameraclock = (int)totalclock;
|
cameraclock = gameclock;
|
||||||
}
|
}
|
||||||
FTA(QUOTE_VIEW_MODE_OFF + ps[myconnectindex].over_shoulder_on, &ps[myconnectindex]);
|
FTA(QUOTE_VIEW_MODE_OFF + ps[myconnectindex].over_shoulder_on, &ps[myconnectindex]);
|
||||||
}
|
}
|
||||||
|
@ -113,15 +113,15 @@ void nonsharedkeys(void)
|
||||||
if (automapMode != am_off)
|
if (automapMode != am_off)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
if (nonsharedtimer > 0 || totalclock < nonsharedtimer)
|
if (nonsharedtimer > 0 || gameclock < nonsharedtimer)
|
||||||
{
|
{
|
||||||
j = (int)totalclock - nonsharedtimer;
|
j = gameclock - nonsharedtimer;
|
||||||
nonsharedtimer += j;
|
nonsharedtimer += j;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
nonsharedtimer = (int)totalclock;
|
nonsharedtimer = gameclock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||||
|
@ -712,8 +712,8 @@ static void checkCrouchToggle(player_struct* p)
|
||||||
|
|
||||||
int getticssincelastupdate()
|
int getticssincelastupdate()
|
||||||
{
|
{
|
||||||
int tics = lastcontroltime == 0 || (int)totalclock < lastcontroltime ? 0 : (int)totalclock - lastcontroltime;
|
int tics = lastcontroltime == 0 || gameclock < lastcontroltime ? 0 : gameclock - lastcontroltime;
|
||||||
lastcontroltime = (int)totalclock;
|
lastcontroltime = gameclock;
|
||||||
return tics;
|
return tics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1265,8 +1265,8 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
||||||
*vy = (*vy) + mulscale16(ny, cameradist);
|
*vy = (*vy) + mulscale16(ny, cameradist);
|
||||||
*vz = (*vz) + mulscale16(nz, cameradist);
|
*vz = (*vz) + mulscale16(nz, cameradist);
|
||||||
|
|
||||||
cameradist = min(cameradist + (((int)totalclock - cameraclock) << 10), 65536);
|
cameradist = min(cameradist + ((gameclock - cameraclock) << 10), 65536);
|
||||||
cameraclock = (int)totalclock;
|
cameraclock = gameclock;
|
||||||
|
|
||||||
updatesectorz(*vx, *vy, *vz, vsectnum);
|
updatesectorz(*vx, *vy, *vz, vsectnum);
|
||||||
|
|
||||||
|
|
|
@ -1485,7 +1485,7 @@ int doincrements_d(struct player_struct* p)
|
||||||
p->knuckle_incs++;
|
p->knuckle_incs++;
|
||||||
if (p->knuckle_incs == 10 && !isWW2GI())
|
if (p->knuckle_incs == 10 && !isWW2GI())
|
||||||
{
|
{
|
||||||
if ((int)totalclock > 1024)
|
if (gameclock > 1024)
|
||||||
if (snum == screenpeek || ud.coop == 1)
|
if (snum == screenpeek || ud.coop == 1)
|
||||||
{
|
{
|
||||||
if (rand() & 1)
|
if (rand() & 1)
|
||||||
|
@ -2162,7 +2162,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
fi.shoot(pi, SHOTSPARK1);
|
fi.shoot(pi, SHOTSPARK1);
|
||||||
S_PlayActorSound(PISTOL_FIRE, pi);
|
S_PlayActorSound(PISTOL_FIRE, pi);
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2221,7 +2221,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
|
|
||||||
S_PlayActorSound(SHOTGUN_FIRE, pi);
|
S_PlayActorSound(SHOTGUN_FIRE, pi);
|
||||||
|
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2274,7 +2274,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
|
|
||||||
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
||||||
fi.shoot(pi, CHAINGUN);
|
fi.shoot(pi, CHAINGUN);
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
|
|
||||||
|
@ -2325,7 +2325,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
// make them visible if not set...
|
// make them visible if not set...
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
}
|
}
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -2339,7 +2339,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
// make them visible if not set...
|
// make them visible if not set...
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
}
|
}
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
}
|
}
|
||||||
|
@ -2358,7 +2358,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
//flashColor = 176 + (252 << 8) + (120 << 16);
|
//flashColor = 176 + (252 << 8) + (120 << 16);
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2366,7 +2366,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
p->okickback_pic = p->kickback_pic = 0;
|
p->okickback_pic = p->kickback_pic = 0;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
}
|
}
|
||||||
else p->kickback_pic++;
|
else p->kickback_pic++;
|
||||||
|
@ -2384,7 +2384,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
(p->kickback_pic & 1))
|
(p->kickback_pic & 1))
|
||||||
{
|
{
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
fi.shoot(pi, RPG);
|
fi.shoot(pi, RPG);
|
||||||
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
|
@ -2394,7 +2394,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
else if (p->kickback_pic & 1)
|
else if (p->kickback_pic & 1)
|
||||||
{
|
{
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
fi.shoot(pi, RPG);
|
fi.shoot(pi, RPG);
|
||||||
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
|
@ -2414,7 +2414,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
p->ammo_amount[p->curr_weapon]--;
|
p->ammo_amount[p->curr_weapon]--;
|
||||||
|
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
fi.shoot(pi, FREEZEBLAST);
|
fi.shoot(pi, FREEZEBLAST);
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
}
|
}
|
||||||
|
@ -2497,7 +2497,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
if (p->kickback_pic == 4)
|
if (p->kickback_pic == 4)
|
||||||
{
|
{
|
||||||
p->ammo_amount[RPG_WEAPON]--;
|
p->ammo_amount[RPG_WEAPON]--;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
fi.shoot(pi, RPG);
|
fi.shoot(pi, RPG);
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
|
|
|
@ -1399,7 +1399,7 @@ int doincrements_r(struct player_struct* p)
|
||||||
}
|
}
|
||||||
S_PlayActorSound(snd, p->i);
|
S_PlayActorSound(snd, p->i);
|
||||||
}
|
}
|
||||||
else if (totalclock > 1024)
|
else if (gameclock > 1024)
|
||||||
if (snum == screenpeek || ud.coop == 1)
|
if (snum == screenpeek || ud.coop == 1)
|
||||||
{
|
{
|
||||||
if (rand() & 1)
|
if (rand() & 1)
|
||||||
|
@ -2851,7 +2851,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
p->noise_radius = 8192;
|
p->noise_radius = 8192;
|
||||||
madenoise(snum);
|
madenoise(snum);
|
||||||
|
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
if (psectlotag != 857)
|
if (psectlotag != 857)
|
||||||
{
|
{
|
||||||
|
@ -2930,7 +2930,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
p->noise_radius = 8192;
|
p->noise_radius = 8192;
|
||||||
madenoise(snum);
|
madenoise(snum);
|
||||||
|
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3041,7 +3041,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
fi.shoot(pi, CHAINGUN);
|
fi.shoot(pi, CHAINGUN);
|
||||||
p->noise_radius = 8192;
|
p->noise_radius = 8192;
|
||||||
madenoise(snum);
|
madenoise(snum);
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
|
|
||||||
if (psectlotag != 857)
|
if (psectlotag != 857)
|
||||||
|
@ -3097,7 +3097,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
||||||
{
|
{
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
||||||
fi.shoot(pi, SHOTSPARK1);
|
fi.shoot(pi, SHOTSPARK1);
|
||||||
p->noise_radius = 16384;
|
p->noise_radius = 16384;
|
||||||
|
@ -3124,7 +3124,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
if (p->kickback_pic == 2 || p->kickback_pic == 4)
|
||||||
{
|
{
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
S_PlayActorSound(CHAINGUN_FIRE, pi);
|
||||||
fi.shoot(pi, CHAINGUN);
|
fi.shoot(pi, CHAINGUN);
|
||||||
p->noise_radius = 16384;
|
p->noise_radius = 16384;
|
||||||
|
@ -3182,7 +3182,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
{
|
{
|
||||||
p->ammo_amount[ALIENBLASTER_WEAPON]--;
|
p->ammo_amount[ALIENBLASTER_WEAPON]--;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
checkavailweapon(p);
|
checkavailweapon(p);
|
||||||
}
|
}
|
||||||
else if (p->kickback_pic == 12)
|
else if (p->kickback_pic == 12)
|
||||||
|
@ -3291,7 +3291,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
p->ammo_amount[CROSSBOW_WEAPON]--;
|
p->ammo_amount[CROSSBOW_WEAPON]--;
|
||||||
if (p->ammo_amount[DYNAMITE_WEAPON])
|
if (p->ammo_amount[DYNAMITE_WEAPON])
|
||||||
p->ammo_amount[DYNAMITE_WEAPON]--;
|
p->ammo_amount[DYNAMITE_WEAPON]--;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
fi.shoot(pi, RPG);
|
fi.shoot(pi, RPG);
|
||||||
p->noise_radius = 32768;
|
p->noise_radius = 32768;
|
||||||
|
@ -3309,7 +3309,7 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect)
|
||||||
if (p->kickback_pic == 4)
|
if (p->kickback_pic == 4)
|
||||||
{
|
{
|
||||||
p->ammo_amount[CHICKEN_WEAPON]--;
|
p->ammo_amount[CHICKEN_WEAPON]--;
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
fi.shoot(pi, RPG2);
|
fi.shoot(pi, RPG2);
|
||||||
p->noise_radius = 32768;
|
p->noise_radius = 32768;
|
||||||
|
|
|
@ -77,7 +77,7 @@ void DoFire(struct player_struct *p, short snum)
|
||||||
if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE ))
|
if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE ))
|
||||||
{
|
{
|
||||||
// make them visible if not set...
|
// make them visible if not set...
|
||||||
lastvisinc = (int)totalclock+32;
|
lastvisinc = gameclock+32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ void operateweapon_ww(int snum, ESyncBits sb_snum, int psect)
|
||||||
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
|
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
|
||||||
{
|
{
|
||||||
// make them visible if not set...
|
// make them visible if not set...
|
||||||
lastvisinc = (int)totalclock + 32;
|
lastvisinc = gameclock + 32;
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
}
|
}
|
||||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum);
|
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum);
|
||||||
|
|
|
@ -757,9 +757,9 @@ void prelevel_common(int g)
|
||||||
void resettimevars(void)
|
void resettimevars(void)
|
||||||
{
|
{
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
|
gameclock = 0;
|
||||||
cloudtotalclock = 0;
|
cloudtotalclock = 0;
|
||||||
levelTextTime = 85;
|
levelTextTime = 85;
|
||||||
ototalclock = 0;
|
|
||||||
lockclock = 0;
|
lockclock = 0;
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
if (camsprite >= 0)
|
if (camsprite >= 0)
|
||||||
|
|
|
@ -643,7 +643,7 @@ void displayrooms(int snum, int smoothratio)
|
||||||
|
|
||||||
if (!isRRRA() || !fogactive)
|
if (!isRRRA() || !fogactive)
|
||||||
{
|
{
|
||||||
if (totalclock < lastvisinc)
|
if (gameclock < lastvisinc)
|
||||||
{
|
{
|
||||||
if (abs(p->visibility - ud.const_visibility) > 8)
|
if (abs(p->visibility - ud.const_visibility) > 8)
|
||||||
p->visibility += (ud.const_visibility - p->visibility) >> 2;
|
p->visibility += (ud.const_visibility - p->visibility) >> 2;
|
||||||
|
|
|
@ -480,8 +480,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
("thunder_brightness", thunder_brightness)
|
("thunder_brightness", thunder_brightness)
|
||||||
|
|
||||||
// Todo: move to backend
|
// Todo: move to backend
|
||||||
("totalclock", totalclock)
|
("gameclock", gameclock)
|
||||||
("ototalclock", ototalclock)
|
|
||||||
("totalclocklock", totalclocklock)
|
("totalclocklock", totalclocklock)
|
||||||
|
|
||||||
("lockclock", lockclock)
|
("lockclock", lockclock)
|
||||||
|
@ -544,10 +543,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
FX_SetReverb(0);
|
FX_SetReverb(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ototalclock = totalclock;
|
|
||||||
}
|
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,11 +129,11 @@ public:
|
||||||
imgScale = baseScale / img->GetDisplayHeight();
|
imgScale = baseScale / img->GetDisplayHeight();
|
||||||
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
|
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
|
||||||
|
|
||||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
||||||
{
|
{
|
||||||
int s = -8;
|
int s = -8;
|
||||||
if (althud_flashing && p->last_extra > max_player_health)
|
if (althud_flashing && p->last_extra > max_player_health)
|
||||||
s += (sintable[((int)totalclock << 5) & 2047] >> 10);
|
s += (sintable[(gameclock << 5) & 2047] >> 10);
|
||||||
int intens = clamp(255 - 4 * s, 0, 255);
|
int intens = clamp(255 - 4 * s, 0, 255);
|
||||||
auto pe = PalEntry(255, intens, intens, intens);
|
auto pe = PalEntry(255, intens, intens, intens);
|
||||||
format.Format("%d", p->last_extra);
|
format.Format("%d", p->last_extra);
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
imgX += (imgX * 0.6) * (strlen - 1);
|
imgX += (imgX * 0.6) * (strlen - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->curr_weapon != KNEE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10)))
|
if (p->curr_weapon != KNEE_WEAPON && (!althud_flashing || gameclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10)))
|
||||||
{
|
{
|
||||||
SBar_DrawString(this, &numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
SBar_DrawString(this, &numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,11 +106,11 @@ public:
|
||||||
imgScale = baseScale / img->GetDisplayHeight();
|
imgScale = baseScale / img->GetDisplayHeight();
|
||||||
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
|
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
|
||||||
|
|
||||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || ((int)totalclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
||||||
{
|
{
|
||||||
int s = -8;
|
int s = -8;
|
||||||
if (althud_flashing && p->last_extra > max_player_health)
|
if (althud_flashing && p->last_extra > max_player_health)
|
||||||
s += (sintable[((int)totalclock << 5) & 2047] >> 10);
|
s += (sintable[(gameclock << 5) & 2047] >> 10);
|
||||||
int intens = clamp(255 - 4 * s, 0, 255);
|
int intens = clamp(255 - 4 * s, 0, 255);
|
||||||
auto pe = PalEntry(255, intens, intens, intens);
|
auto pe = PalEntry(255, intens, intens, intens);
|
||||||
format.Format("%d", p->last_extra);
|
format.Format("%d", p->last_extra);
|
||||||
|
@ -155,7 +155,7 @@ public:
|
||||||
imgX += (imgX * 0.755) * (strlen - 1);
|
imgX += (imgX * 0.755) * (strlen - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || (int)totalclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10)))
|
if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || gameclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10)))
|
||||||
{
|
{
|
||||||
SBar_DrawString(this, &numberFont, format, -1, -numberFont.mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
SBar_DrawString(this, &numberFont, format, -1, -numberFont.mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1142,9 +1142,9 @@ void allignwarpelevators(void)
|
||||||
|
|
||||||
void moveclouds(void)
|
void moveclouds(void)
|
||||||
{
|
{
|
||||||
if (totalclock > cloudtotalclock || totalclock < (cloudtotalclock - 7))
|
if (gameclock > cloudtotalclock || gameclock < (cloudtotalclock - 7))
|
||||||
{
|
{
|
||||||
cloudtotalclock = totalclock + 6;
|
cloudtotalclock = gameclock + 6;
|
||||||
|
|
||||||
// cloudx/y were an array, but all entries were always having the same value so a single pair is enough.
|
// cloudx/y were an array, but all entries were always having the same value so a single pair is enough.
|
||||||
cloudx += (sintable[(ps[screenpeek].getang() + 512) & 2047] >> 9);
|
cloudx += (sintable[(ps[screenpeek].getang() + 512) & 2047] >> 9);
|
||||||
|
|
|
@ -353,7 +353,7 @@ void S_Update(void)
|
||||||
}
|
}
|
||||||
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
||||||
soundEngine->SetListener(listener);
|
soundEngine->SetListener(listener);
|
||||||
soundEngine->UpdateSounds((int)totalclock);
|
soundEngine->UpdateSounds(gameclock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue