spawn delay hud message & forceteam spawn delay modified

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2578 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-09-14 00:37:05 +00:00
parent 25261e3ac2
commit b9fb8522ab
4 changed files with 21 additions and 6 deletions
+9 -4
View File
@@ -95,7 +95,11 @@ void changeteam(int team, bool respawn) // force team and respawn
c2sinit = false;
if(m_flags) tryflagdrop(false);
filtertext(player1->team, team_string(team), false, MAXTEAMLEN);
if(respawn) addmsg(SV_CHANGETEAM, "r");
if(respawn)
{
addmsg(SV_CHANGETEAM, "r");
player1->lastteamchange = lastmillis;
}
}
void newteam(char *name)
@@ -420,17 +424,18 @@ bool tryrespawn()
}
int respawnmillis = player1->respawnoffset+(m_arena ? 0 : (m_flags ? 5000 : 2000));
if(player1->lastteamchange) respawnmillis = player1->lastteamchange + 1500;
if(lastmillis>respawnmillis)
{
player1->attacking = false;
if(m_arena) { hudoutf("waiting for new round to start..."); return false; }
player1->lastteamchange = 0;
if(m_arena) { hudoutf2("waiting for new round to start..."); return false; }
respawnself();
player1->weaponswitch(player1->primweap);
player1->lastaction -= weapon::weaponchangetime/2;
return true;
}
else hudoutf("wait %3.1f seconds to respawn", (respawnmillis-lastmillis)/(float)1000);
else hudoutf2("wait %3.1f seconds to respawn", (respawnmillis-lastmillis)/(float)1000);
}
return false;
}
+2 -2
View File
@@ -350,7 +350,7 @@ struct playerent : dynent, playerstate
int skin, nextskin; // skin after respawning
int spectatemode, followplayercn;
int eardamagemillis;
int respawnoffset;
int respawnoffset, lastteamchange;
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 +363,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), respawnoffset(0),
skin(0), nextskin(0), spectatemode(SM_NONE), followplayercn(-1), eardamagemillis(0), respawnoffset(0), lastteamchange(0),
prevweaponsel(NULL), weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL),
smoothmillis(-1)
{
+1
View File
@@ -456,6 +456,7 @@ extern void pruneundos(int maxremain = 0);
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater);
extern void loadingscreen(const char *fmt = NULL, ...);
extern void hudoutf(const char *s, ...);
extern void hudoutf2(const char *s, ...);
extern void show_out_of_renderloop_progress(float bar1, const char *text1, float bar2 = 0, const char *text2 = NULL);
extern void updatedmgindicator(vec &attack);
+9
View File
@@ -289,6 +289,15 @@ void hudoutf(const char *s, ...)
conoutf(s);
}
void hudoutf2(const char *s, ...)
{
s_sprintfdv(sf, s);
string sp;
filtertext(sp, sf);
s = sf;
hudmsgs.addline(s);
}
bool insideradar(const vec &centerpos, float radius, const vec &o)
{
if(showmap) return !o.reject(centerpos, radius);