diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 2623dfc5..de92bd3a 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1673,7 +1673,7 @@ playerent *updatefollowplayer(int shiftdirection) void spectate() { - if(m_demo) return; + if(m_demo || editmode) return; if(!team_isspect(player1->team)) addmsg(SV_SWITCHTEAM, "ri", TEAM_SPECT); else tryrespawn(); } diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 0c7eaad4..6941c678 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -630,12 +630,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false) int val = getint(p); if(!d) break; if(val) d->state = CS_EDITING; - else - { - //2011oct16:flowtron:keep spectator state - //specators shouldn't be allowed to toggle editmode for themselves. they're ghosts! - d->state = d->state==CS_SPECTATE?CS_SPECTATE:CS_ALIVE; - } + else d->state = CS_ALIVE; break; } diff --git a/source/src/editing.cpp b/source/src/editing.cpp index 8d5e1ff9..91d03262 100644 --- a/source/src/editing.cpp +++ b/source/src/editing.cpp @@ -33,6 +33,15 @@ void toggleedit(bool force) { if(player1->state==CS_DEAD) return; // do not allow dead players to edit to avoid state confusion if(!force && !editmode && !allowedittoggle()) return; // not in most multiplayer modes + if(player1->state == CS_SPECTATE) + { + if(watchingdemo) + { + if(player1->spectatemode != SM_FLY) spectatemode(SM_FLY); // release in a place of followed player + } + else return; + } + if(!(editmode = !editmode)) { float oldz = player1->o.z; @@ -46,9 +55,7 @@ void toggleedit(bool force) } keyrepeat(editmode); editing = editmode ? 1 : 0; - //2011oct16:flowtron:keep spectator state - //spectators are ghosts, no toggling of editmode for them! - player1->state = player1->state==CS_SPECTATE?CS_SPECTATE:(editing ? CS_EDITING : CS_ALIVE); + player1->state = editing ? CS_EDITING : (watchingdemo ? CS_SPECTATE : CS_ALIVE); if(editing && player1->onladder) player1->onladder = false; if(editing && (player1->weaponsel->type == GUN_SNIPER && ((sniperrifle *)player1->weaponsel)->scoped)) ((sniperrifle *)player1->weaponsel)->onownerdies(); // or ondeselecting() if(editing && (player1->weaponsel->type == GUN_GRENADE)) ((grenades *)player1->weaponsel)->onownerdies();