delay when respawning from spect mode
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2352 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+20
-10
@@ -138,7 +138,7 @@ void deathstate(playerent *pl)
|
||||
{
|
||||
pl->state = CS_DEAD;
|
||||
pl->spectatemode = SM_DEATHCAM;
|
||||
pl->lastpain = pl->lastaction = lastmillis;
|
||||
pl->respawnoffset = pl->lastpain = pl->lastaction = lastmillis;
|
||||
pl->move = pl->strafe = 0;
|
||||
pl->pitch = pl->roll = 0;
|
||||
pl->attacking = false;
|
||||
@@ -393,14 +393,24 @@ void respawnself()
|
||||
|
||||
bool tryrespawn()
|
||||
{
|
||||
if(player1->state==CS_DEAD && lastmillis>player1->lastpain+(m_ctf ? 5000 : 2000))
|
||||
{
|
||||
player1->attacking = false;
|
||||
if(m_arena) { conoutf("waiting for new round to start..."); return false; }
|
||||
respawnself();
|
||||
player1->weaponswitch(player1->primweap);
|
||||
player1->lastaction -= weapon::weaponchangetime/2;
|
||||
return true;
|
||||
if(player1->state==CS_DEAD)
|
||||
{
|
||||
if(lastmillis>player1->respawnoffset+(m_ctf ? 5000 : 2000))
|
||||
{
|
||||
if(player1->isspectating() && player1->spectatemode!=SM_DEATHCAM)
|
||||
{
|
||||
spectate(SM_DEATHCAM);
|
||||
player1->respawnoffset = lastmillis+2000;
|
||||
return false;
|
||||
}
|
||||
|
||||
player1->attacking = false;
|
||||
if(m_arena) { conoutf("waiting for new round to start..."); return false; }
|
||||
respawnself();
|
||||
player1->weaponswitch(player1->primweap);
|
||||
player1->lastaction -= weapon::weaponchangetime/2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -411,7 +421,7 @@ void dodamage(int damage, playerent *pl, playerent *actor, bool gib, bool local)
|
||||
{
|
||||
if(pl->state != CS_ALIVE || intermission) return;
|
||||
|
||||
pl->lastpain = lastmillis;
|
||||
pl->respawnoffset = pl->lastpain = lastmillis;
|
||||
if(local) damage = pl->dodamage(damage);
|
||||
else if(actor==player1) return;
|
||||
|
||||
|
||||
+2
-1
@@ -351,6 +351,7 @@ struct playerent : dynent, playerstate
|
||||
int skin, nextskin; // skin after respawning
|
||||
int spectatemode, followplayercn;
|
||||
int eardamagemillis;
|
||||
int respawnoffset;
|
||||
virtual float dyneyeheight() { return (state==CS_DEAD || state==CS_SPECTATE) && spectatemode==SM_FLY ? 1.0f : physent::dyneyeheight(); }
|
||||
bool allowmove() { return state!=CS_DEAD || spectatemode==SM_FLY; }
|
||||
|
||||
@@ -363,7 +364,7 @@ struct playerent : dynent, playerstate
|
||||
int smoothmillis;
|
||||
|
||||
playerent() : clientnum(-1), lastupdate(0), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), deaths(0), lastpain(0), lastvoicecom(0), clientrole(CR_DEFAULT),
|
||||
skin(0), nextskin(0), spectatemode(SM_NONE), followplayercn(-1), eardamagemillis(0),
|
||||
skin(0), nextskin(0), spectatemode(SM_NONE), followplayercn(-1), eardamagemillis(0), respawnoffset(0),
|
||||
weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL),
|
||||
smoothmillis(-1)
|
||||
{
|
||||
|
||||
@@ -318,6 +318,7 @@ extern char *colorname(playerent *d, int num = 0, char *name = NULL, const char
|
||||
extern char *colorping(int ping);
|
||||
extern void togglespect();
|
||||
extern playerent *findfollowplayer(int shiftdirection = 0);
|
||||
extern void spectate(int mode);
|
||||
|
||||
struct votedisplayinfo
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user