- added a global leveltimer variable to Duke.

This timer only gets incremented by the main game ticker when the playsim is running.

This timer gets used for all playsim-related timing and animations so that these are decoupled from imprecisions in the global timer.
This commit is contained in:
Christoph Oelckers 2020-08-31 00:33:41 +02:00
parent 34104a74d8
commit 03aad6559b
17 changed files with 96 additions and 102 deletions

View File

@ -1618,7 +1618,7 @@ void ProcessInput(PLAYER *pPlayer)
{
gViewLookAdjust -= float(lookStepDown);
}
gViewLookRecenter = ((pInput->actions & SB_CENTERVIEW) && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN));
gViewLookRecenter = ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)));
}
pPlayer->q16look = fix16_clamp(pPlayer->q16look+(pInput->q16horz<<3), fix16_from_int(downAngle), fix16_from_int(upAngle));
pPlayer->q16horiz = fix16_from_float(100.f*tanf(fix16_to_float(pPlayer->q16look)*fPI/1024.f));

View File

@ -262,7 +262,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
int downAngle = -347;
double lookStepUp = 4.0*upAngle/60.0;
double lookStepDown = -4.0*downAngle/60.0;
if (predict.at6e && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN))
if (predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
{
if (predict.at20 < 0)
predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepDown), fix16_from_int(0));
@ -288,7 +288,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
{
gViewLookAdjust -= float(lookStepDown);
}
gViewLookRecenter = predict.at6e && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN);
gViewLookRecenter = predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN));
}
predict.at20 = fix16_clamp(predict.at20+(pInput->q16horz<<3), fix16_from_int(downAngle), fix16_from_int(upAngle));
predict.at24 = fix16_from_float(100.f*tanf(fix16_to_float(predict.at20)*fPI/1024.f));

View File

@ -218,7 +218,7 @@ static void GameTicker()
void Display()
{
if (screen == nullptr || !AppActive && (screen->IsFullscreen() || !vid_activeinbackground))
if (screen == nullptr || (!AppActive && (screen->IsFullscreen() || !vid_activeinbackground)))
{
return;
}

View File

@ -153,7 +153,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
case SECTOREFFECTOR:
if(t->lotag == 27 && ud.recstat == 1)
{
t->picnum = 11+((gameclock>>3)&1);
t->picnum = 11+((ud.levelclock>>3)&1);
t->cstat |= 128;
}
else
@ -250,7 +250,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
t->z -= (4<<8);
break;
case CRYSTALAMMO:
t->shade = (sintable[(gameclock<<4)&2047]>>10);
t->shade = (sintable[(ud.levelclock<<4)&2047]>>10);
continue;
case VIEWSCREEN:
case VIEWSCREEN2:
@ -268,10 +268,10 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
break;
case SHRINKSPARK:
t->picnum = SHRINKSPARK+( (gameclock>>4)&3 );
t->picnum = SHRINKSPARK+( (ud.levelclock>>4)&3 );
break;
case GROWSPARK:
t->picnum = GROWSPARK+( (gameclock>>4)&3 );
t->picnum = GROWSPARK+( (ud.levelclock>>4)&3 );
break;
case RPG:
/*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)
{
ps[screenpeek].visibility = -127;
lastvisinc = gameclock+32;
lastvisinc = ud.levelclock+32;
}
t->shade = -127;
break;

View File

@ -142,7 +142,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
case SECTOREFFECTOR:
if (t->lotag == 27 && ud.recstat == 1)
{
t->picnum = 11 + ((gameclock >> 3) & 1);
t->picnum = 11 + ((ud.levelclock >> 3) & 1);
t->cstat |= 128;
}
else
@ -180,7 +180,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
case RESPAWNMARKERRED:
case RESPAWNMARKERYELLOW:
case RESPAWNMARKERGREEN:
t->picnum = 861+( (gameclock>>4) & 13);
t->picnum = 861+( (ud.levelclock>>4) & 13);
if (s->picnum == RESPAWNMARKERRED)
t->pal = 0;
else if (s->picnum == RESPAWNMARKERYELLOW)
@ -247,21 +247,21 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
t->z -= (4<<8);
break;
case CRYSTALAMMO:
t->shade = (sintable[(gameclock<<4)&2047]>>10);
t->shade = (sintable[(ud.levelclock<<4)&2047]>>10);
break;
case SHRINKSPARK:
if ((sprite[s->owner].picnum == CHEER || sprite[s->owner].picnum == CHEERSTAYPUT) && isRRRA())
{
t->picnum = CHEERBLADE+( (gameclock>>4)&3 );
t->picnum = CHEERBLADE+( (ud.levelclock>>4)&3 );
t->shade = -127;
}
else
t->picnum = SHRINKSPARK+( (gameclock>>4)&7 );
t->picnum = SHRINKSPARK+( (ud.levelclock>>4)&7 );
break;
case CHEERBOMB:
if (isRRRA())
{
t->picnum = CHEERBOMB + ((gameclock >> 4) & 3);
t->picnum = CHEERBOMB + ((ud.levelclock >> 4) & 3);
break;
}
else goto default_case;
@ -269,10 +269,10 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
if(isRRRA())
{
if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 8)
t->picnum = RRTILE3500 + ((gameclock >> 4) % 6);
t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6);
else if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 19)
{
t->picnum = RRTILE5090 + ((gameclock >> 4) & 3);
t->picnum = RRTILE5090 + ((ud.levelclock >> 4) & 3);
t->shade = -127;
}
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;
}
else
t->picnum = SPIT + ((gameclock >> 4) & 3);
t->picnum = SPIT + ((ud.levelclock >> 4) & 3);
}
else
t->picnum = SPIT + ((gameclock >> 4) & 3);
t->picnum = SPIT + ((ud.levelclock >> 4) & 3);
break;
case EMPTYBIKE:
if (!isRRRA()) goto default_case;
@ -796,12 +796,12 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
if(t->picnum == EXPLOSION2)
{
ps[screenpeek].visibility = -127;
lastvisinc = gameclock+32;
lastvisinc = ud.levelclock+32;
t->pal = 0;
}
else if(t->picnum == FIRELASER)
{
t->picnum = FIRELASER+((gameclock>>2)&5);
t->picnum = FIRELASER+((ud.levelclock>>2)&5);
}
t->shade = -127;
break;
@ -897,11 +897,11 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
t->shade = -127;
break;
case RRTILE2034:
t->picnum = RRTILE2034+(gameclock&1);
t->picnum = RRTILE2034 + ((ud.levelclock>>2)&1);
break;
case RRTILE2944:
t->shade = -127;
t->picnum = RRTILE2944+((gameclock>>2)&4);
t->picnum = RRTILE2944+((ud.levelclock>>2)&4);
break;
case PLAYERONWATER:

View File

@ -130,7 +130,7 @@ void FTA(int q, struct player_struct* p)
if (q < 0 || !(p->gm & MODE_GAME))
return;
if (p->ftq != q || (gameclock - p->ftt > TICRATE && q != QUOTE_DEAD))
if (p->ftq != q || (ud.levelclock - p->ftt > TICRATE && q != QUOTE_DEAD))
{
p->ftq = q;
auto qu = quoteMgr.GetQuote(q);
@ -148,7 +148,7 @@ void FTA(int q, struct player_struct* p)
}
}
}
p->ftt = gameclock;
p->ftt = ud.levelclock;
}
//==========================================================================

View File

@ -1040,9 +1040,6 @@ int ParseState::parse(void)
resetinventory(g_p);
resetweapons(g_p);
//cameradist = 0;
//cameraclock = gameclock;
}
setpal(&ps[g_p]);
break;

View File

@ -51,9 +51,6 @@ void GameInterface::Ticker()
{
sync[i] = playercmds[i].ucmd;
}
ud.camerasprite = -1;
if (earthquaketime > 0) earthquaketime--;
if (rtsplaying > 0) rtsplaying--;
if (show_shareware > 0)
@ -61,53 +58,56 @@ void GameInterface::Ticker()
show_shareware--;
}
everyothertime++;
updateinterpolations();
if (playrunning())
{
ud.levelclock+= 4;
if (earthquaketime > 0) earthquaketime--;
ud.camerasprite = -1;
everyothertime++;
global_random = krand();
movedummyplayers();//ST 13
r_NoInterpolate = false;
}
else r_NoInterpolate = true;
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
if (playrunning())
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
auto p = &ps[i];
if (p->pals.a > 0)
p->pals.a--;
if (playrunning())
{
auto p = &ps[i];
if (p->pals.a > 0)
p->pals.a--;
hud_input(i);
fi.processinput(i);
fi.checksectors(i);
hud_input(i);
fi.processinput(i);
fi.checksectors(i);
}
}
}
if (playrunning())
{
if (levelTextTime > 0)
levelTextTime--;
fi.think();
}
if ((everyothertime & 1) == 0)
{
fi.animatewalls();
movecyclers();
}
if ((everyothertime & 1) == 0)
{
fi.animatewalls();
movecyclers();
}
if (isRR() && ud.recstat == 0 && ud.multimode < 2)
dotorch();
if (isRR() && ud.recstat == 0 && ud.multimode < 2)
dotorch();
r_NoInterpolate = false;
}
else r_NoInterpolate = true;
if (ps[myconnectindex].gm & (MODE_EOL | MODE_RESTART))
{
exitlevel();
}
nonsharedkeys();
nonsharedkeys(); // this must go elsewhere later!
}
//---------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ source as it is released.
BEGIN_DUKE_NS
void fireweapon_ww(int snum);
void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker);
void operateweapon_ww(int snum, ESyncBits actions, int psect);
//---------------------------------------------------------------------------
//
@ -1504,7 +1504,7 @@ int doincrements_d(struct player_struct* p)
p->knuckle_incs++;
if (p->knuckle_incs == 10 && !isWW2GI())
{
if (gameclock > 1024)
if (ud.levelclock > 1024)
if (snum == screenpeek || ud.coop == 1)
{
if (rand() & 1)
@ -2077,7 +2077,7 @@ static void fireweapon(int snum)
//
//---------------------------------------------------------------------------
static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
static void operateweapon(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
int pi = p->i;
@ -2181,7 +2181,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
fi.shoot(pi, SHOTSPARK1);
S_PlayActorSound(PISTOL_FIRE, pi);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
}
@ -2240,7 +2240,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
S_PlayActorSound(SHOTGUN_FIRE, pi);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
}
@ -2293,7 +2293,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
S_PlayActorSound(CHAINGUN_FIRE, pi);
fi.shoot(pi, CHAINGUN);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
checkavailweapon(p);
@ -2344,7 +2344,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
// make them visible if not set...
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
}
checkavailweapon(p);
//#endif
@ -2358,7 +2358,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
// make them visible if not set...
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
}
checkavailweapon(p);
}
@ -2377,7 +2377,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
p->visibility = 0;
//flashColor = 176 + (252 << 8) + (120 << 16);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
checkavailweapon(p);
}
}
@ -2385,7 +2385,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
p->okickback_pic = p->kickback_pic = 0;
p->visibility = 0;
lastvisinc = gameclock + 32;
lastvisinc = ud.levelclock + 32;
checkavailweapon(p);
}
else p->kickback_pic++;
@ -2403,7 +2403,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
(p->kickback_pic & 1))
{
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
fi.shoot(pi, RPG);
p->ammo_amount[DEVISTATOR_WEAPON]--;
checkavailweapon(p);
@ -2413,7 +2413,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
else if (p->kickback_pic & 1)
{
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
fi.shoot(pi, RPG);
p->ammo_amount[DEVISTATOR_WEAPON]--;
checkavailweapon(p);
@ -2433,7 +2433,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
p->ammo_amount[p->curr_weapon]--;
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
fi.shoot(pi, FREEZEBLAST);
checkavailweapon(p);
}
@ -2516,7 +2516,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
if (p->kickback_pic == 4)
{
p->ammo_amount[RPG_WEAPON]--;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
fi.shoot(pi, RPG);
checkavailweapon(p);
@ -2625,8 +2625,8 @@ static void processweapon(int snum, ESyncBits actions, int psect)
}
else if (p->kickback_pic)
{
if (!isWW2GI()) operateweapon(snum, actions, psect, gameclock);
else operateweapon_ww(snum, actions, psect, gameclock);
if (!isWW2GI()) operateweapon(snum, actions, psect);
else operateweapon_ww(snum, actions, psect);
}
}
//---------------------------------------------------------------------------

View File

@ -1430,7 +1430,7 @@ int doincrements_r(struct player_struct* p)
}
S_PlayActorSound(snd, p->i);
}
else if (gameclock > 1024)
else if (ud.levelclock > 1024)
if (snum == screenpeek || ud.coop == 1)
{
if (rand() & 1)
@ -2771,7 +2771,7 @@ static void fireweapon(int snum)
//
//---------------------------------------------------------------------------
static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
static void operateweapon(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
int pi = p->i;
@ -2882,7 +2882,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
p->noise_radius = 8192;
madenoise(snum);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
if (psectlotag != 857)
{
@ -2961,7 +2961,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
p->noise_radius = 8192;
madenoise(snum);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
}
@ -3072,7 +3072,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
fi.shoot(pi, CHAINGUN);
p->noise_radius = 8192;
madenoise(snum);
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
if (psectlotag != 857)
@ -3128,7 +3128,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
if (p->kickback_pic == 2 || p->kickback_pic == 4)
{
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
S_PlayActorSound(CHAINGUN_FIRE, pi);
fi.shoot(pi, SHOTSPARK1);
p->noise_radius = 16384;
@ -3155,7 +3155,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
if (p->kickback_pic == 2 || p->kickback_pic == 4)
{
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
S_PlayActorSound(CHAINGUN_FIRE, pi);
fi.shoot(pi, CHAINGUN);
p->noise_radius = 16384;
@ -3213,7 +3213,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
{
p->ammo_amount[ALIENBLASTER_WEAPON]--;
p->visibility = 0;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
checkavailweapon(p);
}
else if (p->kickback_pic == 12)
@ -3322,7 +3322,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
p->ammo_amount[CROSSBOW_WEAPON]--;
if (p->ammo_amount[DYNAMITE_WEAPON])
p->ammo_amount[DYNAMITE_WEAPON]--;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
fi.shoot(pi, RPG);
p->noise_radius = 32768;
@ -3340,7 +3340,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker)
if (p->kickback_pic == 4)
{
p->ammo_amount[CHICKEN_WEAPON]--;
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
fi.shoot(pi, RPG2);
p->noise_radius = 32768;
@ -3414,7 +3414,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
}
else if (p->kickback_pic)
{
operateweapon(snum, actions, psect, gameclock);
operateweapon(snum, actions, psect);
}
}

View File

@ -77,7 +77,7 @@ void DoFire(struct player_struct *p, short snum)
if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE ))
{
// make them visible if not set...
lastvisinc = gameclock+32;
lastvisinc = ud.levelclock+32;
p->visibility = 0;
}
@ -306,7 +306,7 @@ void fireweapon_ww(int snum)
//
//---------------------------------------------------------------------------
void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker)
void operateweapon_ww(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
int pi = p->i;
@ -400,7 +400,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker)
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
{
// make them visible if not set...
lastvisinc = ticker + 32;
lastvisinc = ud.levelclock + 32;
p->visibility = 0;
}
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum);

View File

@ -757,6 +757,7 @@ void prelevel_common(int g)
void resettimevars(void)
{
resetGameClock();
ud.levelclock = 0;
levelTextTime = 85;
ready2send = 1;
if (camsprite >= 0)
@ -1160,4 +1161,4 @@ void exitlevel(void)
}
END_DUKE_NS
END_DUKE_NS

View File

@ -642,7 +642,7 @@ void displayrooms(int snum, double smoothratio)
if (!isRRRA() || !fogactive)
{
if (gameclock < lastvisinc)
if (ud.levelclock < lastvisinc)
{
if (abs(p->visibility - ud.const_visibility) > 8)
p->visibility += (ud.const_visibility - p->visibility) >> 2;

View File

@ -404,6 +404,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("coop", ud.coop)
("marker", ud.marker)
("ffire", ud.ffire)
("levelclock", ud.levelclock)
.Array("sectorextra", sectorextra, numsectors)
("rtsplaying", rtsplaying)
@ -477,10 +478,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("RRRA_ExitedLevel", RRRA_ExitedLevel)
("fogactive", fogactive)
("thunder_brightness", thunder_brightness)
// Todo: move to backend
("gameclock", gameclock)
.Array("po", po, ud.multimode)
.EndObject();

View File

@ -129,11 +129,11 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > max_player_health)
s += (sintable[(gameclock << 6) & 2047] >> 10);
s += (sintable[(ud.levelclock << 6) & 2047] >> 10);
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
SBar_DrawString(this, &numberFont, format, 25, texty, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, 1, 1);
@ -178,7 +178,7 @@ public:
imgX += (imgX * 0.6) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && (!althud_flashing || gameclock & 32 || ammo > (max_ammo_amount[weapon] / 10)))
if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (max_ammo_amount[weapon] / 10)))
{
SBar_DrawString(this, &numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
}

View File

@ -106,13 +106,11 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
int gameclock = I_GetBuildTime();
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > max_player_health)
s += (sintable[(gameclock << 6) & 2047] >> 10);
s += (sintable[(ud.levelclock << 6) & 2047] >> 10);
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
SBar_DrawString(this, &numberFont, format, 26.5, -numberFont.mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, scale, scale);
@ -175,7 +173,7 @@ public:
imgX += (imgX * 0.755) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || gameclock & 32 || ammo > (max_ammo_amount[weapon] / 10)))
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (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);
}

View File

@ -51,6 +51,7 @@ struct TileInfo
struct user_defs
{
int levelclock;
unsigned char god, cashman, eog;
unsigned char show_help, scrollmode, clipping;
char user_name[MAXPLAYERS][32];