From 43c0fa0f9a4607938972bba6d45fb9258848e2fb Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 23 Aug 2008 10:30:11 +0000 Subject: [PATCH] delay when respawning from spect mode git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2358 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 20 ++++++++++++-------- source/src/physics.cpp | 5 ++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 51119843..d1b589d7 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -395,15 +395,18 @@ bool tryrespawn() { 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; - } + int respawnmillis = player1->respawnoffset+(m_ctf ? 5000 : 2000); + // set min wait time when in spectate mode (avoid unfair specting) + if(player1->isspectating() && player1->spectatemode!=SM_DEATHCAM) + { + spectate(SM_DEATHCAM); + player1->respawnoffset = lastmillis; // count again + return false; + } + + if(lastmillis>respawnmillis) + { player1->attacking = false; if(m_arena) { conoutf("waiting for new round to start..."); return false; } respawnself(); @@ -411,6 +414,7 @@ bool tryrespawn() player1->lastaction -= weapon::weaponchangetime/2; return true; } + else hudoutf("waiting %3.1f seconds for respawning", (respawnmillis-lastmillis)/(float)1000); } return false; } diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 747fe8cf..59bada83 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -564,7 +564,10 @@ void attack(bool on) { if(intermission) return; if(editmode) editdrag(on); - else if(player1->state==CS_DEAD) tryrespawn(); + else if(player1->state==CS_DEAD) + { + if(!on) tryrespawn(); + } else player1->attacking = on; }