fix damage indicator overflow after fastforward
break up shiftgametime() time jumps into 5-second jumps and five 1-second jumps for the last five seconds rename respawnoffset to lastdeath (because that's what it is) rename clientside nextmillis to skipmillis (because that's what it does)
This commit is contained in:
@@ -94,12 +94,12 @@ void CBot::Think()
|
||||
// Bot is dead?
|
||||
if (m_pMyEnt->state == CS_DEAD)
|
||||
{
|
||||
if(lastmillis-m_pMyEnt->respawnoffset<1200)
|
||||
if(lastmillis-m_pMyEnt->lastdeath<1200)
|
||||
{
|
||||
m_pMyEnt->move = 0;
|
||||
moveplayer(m_pMyEnt, 1, true);
|
||||
}
|
||||
else if (!m_arena && lastmillis-m_pMyEnt->respawnoffset>5000) Spawn();
|
||||
else if (!m_arena && lastmillis-m_pMyEnt->lastdeath>5000) Spawn();
|
||||
SendBotInfo();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -853,11 +853,11 @@ void shiftgametime(int newmillis)
|
||||
if(!curdemofile || !curdemofile[0]) return;
|
||||
watchingdemo = false;
|
||||
callvote(SA_MAP, curdemofile, "-1", "0");
|
||||
nextmillis = newmillis;
|
||||
skipmillis = newmillis;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextmillis = newmillis - gamemillis;
|
||||
skipmillis = newmillis - gamemillis;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ struct serverstate servstate = { 0 };
|
||||
playerent *player1 = newplayerent(); // our client
|
||||
vector<playerent *> players; // other clients
|
||||
|
||||
int lastmillis = 0, totalmillis = 0, nextmillis = 0;
|
||||
int lastmillis = 0, totalmillis = 0, skipmillis = 0;
|
||||
int lasthit = 0;
|
||||
int curtime = 0;
|
||||
string clientmap = "";
|
||||
@@ -371,7 +371,7 @@ void deathstate(playerent *pl)
|
||||
{
|
||||
pl->state = CS_DEAD;
|
||||
pl->spectatemode = SM_DEATHCAM;
|
||||
pl->respawnoffset = pl->lastpain = lastmillis;
|
||||
pl->lastdeath = pl->lastpain = lastmillis;
|
||||
pl->move = pl->strafe = 0;
|
||||
pl->pitch = pl->roll = pl->movroll = pl->effroll = 0;
|
||||
pl->attacking = false;
|
||||
@@ -562,7 +562,7 @@ void showrespawntimer()
|
||||
else if(player1->state==CS_DEAD && m_flags && (!player1->isspectating() || player1->spectatemode==SM_DEATHCAM))
|
||||
{
|
||||
int secs = 5;
|
||||
showhudtimer(secs, player1->respawnoffset, "READY!", lastspawnattempt >= arenaintermission && lastmillis < lastspawnattempt+100);
|
||||
showhudtimer(secs, player1->lastdeath, "READY!", lastspawnattempt >= arenaintermission && lastmillis < lastspawnattempt+100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -784,7 +784,7 @@ bool tryrespawn()
|
||||
}
|
||||
else
|
||||
{
|
||||
int respawnmillis = player1->respawnoffset+(m_arena ? 0 : (m_flags ? 5000 : 2000));
|
||||
int respawnmillis = player1->lastdeath + (m_arena ? 0 : (m_flags ? 5000 : 2000));
|
||||
if(lastmillis>respawnmillis)
|
||||
{
|
||||
player1->attacking = false;
|
||||
@@ -850,7 +850,7 @@ COMMANDF(burstshots, "si", (char *gun, int *shots)
|
||||
void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bool local)
|
||||
{
|
||||
if(pl->state != CS_ALIVE || intermission) return;
|
||||
pl->respawnoffset = pl->lastpain = lastmillis;
|
||||
pl->lastpain = lastmillis;
|
||||
// could the author of the FIXME below please elaborate what's to fix?! (ft:2011mar28)
|
||||
// I suppose someone wanted to play the hitsound for player1 or spectated player (lucas:2011may22)
|
||||
playerent *h = player1->isspectating() && player1->followplayercn >= 0 && (player1->spectatemode == SM_FOLLOW1ST || player1->spectatemode == SM_FOLLOW3RD || player1->spectatemode == SM_FOLLOW3RD_TRANSPARENT) ? getclient(player1->followplayercn) : NULL;
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ extern int unsavededits;
|
||||
extern vector<entity> ents; // map entities
|
||||
extern vector<int> eh_ents; // edithide entities
|
||||
extern vec worldpos, camup, camright, camdir; // current target of the crosshair in the world
|
||||
extern int lastmillis, totalmillis, nextmillis; // last time
|
||||
extern int lastmillis, totalmillis, skipmillis; // last time
|
||||
extern int curtime; // current frame time
|
||||
extern int interm;
|
||||
extern int gamemode, nextmode;
|
||||
|
||||
+3
-4
@@ -422,7 +422,7 @@ public:
|
||||
enet_uint32 address;
|
||||
int lifesequence; // sequence id for each respawn, used in damage test
|
||||
int frags, flagscore, deaths, points, tks;
|
||||
int lastaction, lastmove, lastpain, lastvoicecom;
|
||||
int lastaction, lastmove, lastpain, lastvoicecom, lastdeath;
|
||||
int clientrole;
|
||||
bool attacking;
|
||||
string name;
|
||||
@@ -431,7 +431,6 @@ public:
|
||||
int nextweapon; // weapon we switch to
|
||||
int spectatemode, followplayercn;
|
||||
int eardamagemillis;
|
||||
int respawnoffset;
|
||||
float maxroll, maxrolleffect, movroll, effroll; // roll added by movement and damage
|
||||
bool allowmove() { return state!=CS_DEAD || spectatemode==SM_FLY; }
|
||||
|
||||
@@ -449,8 +448,8 @@ public:
|
||||
|
||||
bool ignored, muted;
|
||||
|
||||
playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), address(0), lifesequence(0), frags(0), flagscore(0), deaths(0), points(0), tks(0), lastpain(0), lastvoicecom(0), clientrole(CR_DEFAULT),
|
||||
team(TEAM_SPECT), spectatemode(SM_NONE), eardamagemillis(0), respawnoffset(0), maxroll(ROLLMOVDEF), maxrolleffect(ROLLEFFDEF), movroll(0), effroll(0),
|
||||
playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), address(0), lifesequence(0), frags(0), flagscore(0), deaths(0), points(0), tks(0), lastpain(0), lastvoicecom(0), lastdeath(0), clientrole(CR_DEFAULT),
|
||||
team(TEAM_SPECT), spectatemode(SM_NONE), eardamagemillis(0), maxroll(ROLLMOVDEF), maxrolleffect(ROLLEFFDEF), movroll(0), effroll(0),
|
||||
prevweaponsel(NULL), weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL),
|
||||
smoothmillis(-1),
|
||||
head(-1, -1, -1), ignored(false), muted(false)
|
||||
|
||||
+5
-3
@@ -1284,10 +1284,12 @@ int main(int argc, char **argv)
|
||||
int scaledtime = elapsed*gamespeed + timeerr;
|
||||
curtime = scaledtime/100;
|
||||
timeerr = scaledtime%100;
|
||||
if(nextmillis && watchingdemo)
|
||||
if(!watchingdemo) skipmillis = 0;
|
||||
if(skipmillis && watchingdemo)
|
||||
{
|
||||
curtime += nextmillis;
|
||||
nextmillis = 0;
|
||||
int skipmillisnow = skipmillis > 5000 ? skipmillis - 5000 : min(1000, skipmillis);
|
||||
curtime += skipmillisnow;
|
||||
skipmillis -= skipmillisnow;
|
||||
}
|
||||
if(paused) curtime = 0;
|
||||
}
|
||||
|
||||
@@ -868,7 +868,7 @@ void jumpn(bool on)
|
||||
wason = on;
|
||||
if(player1->isspectating())
|
||||
{
|
||||
if(lastmillis - player1->respawnoffset > 1000 && on) togglespect();
|
||||
if(lastmillis - player1->lastdeath > 1000 && on) togglespect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -703,7 +703,7 @@ void damageblend(int n, void *p)
|
||||
{
|
||||
if(!damagescreen) return;
|
||||
if(lastmillis > damageblendmillis || damageblendplayer != p) damageblendmillis = lastmillis;
|
||||
damageblendmillis += n*damagescreenfactor;
|
||||
damageblendmillis = min(damageblendmillis + n * damagescreenfactor, lastmillis + 3999);
|
||||
damageblendplayer = p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user