diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index f0408f8c..c0962793 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -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; } diff --git a/source/src/entity.h b/source/src/entity.h index f62a90f9..6ae9a619 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -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) { diff --git a/source/src/protos.h b/source/src/protos.h index a9d74857..88206bb8 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -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); diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index a86f4c7b..9ba54ac8 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -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 ¢erpos, float radius, const vec &o) { if(showmap) return !o.reject(centerpos, radius);