diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index e3f7d1bd..3906acd4 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -730,9 +730,11 @@ void findplayerstart(playerent *d, bool mapcenter, int arenaspawn) void spawnplayer(playerent *d) { + //2011oct16:flowtron:keep spectator state + bool dws = d->state == CS_SPECTATE; d->respawn(); d->spawnstate(gamemode); - d->state = (d==player1 && editmode) ? CS_EDITING : CS_ALIVE; + d->state = (d==player1 && editmode) ? CS_EDITING : (dws?CS_SPECTATE:CS_ALIVE); findplayerstart(d); } diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index cf2120de..143989c3 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -626,7 +626,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) int val = getint(p); if(!d) break; if(val) d->state = CS_EDITING; - else d->state = CS_ALIVE; + 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; + } break; } @@ -643,7 +648,10 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) s->selectweapon(gunselect); loopi(NUMGUNS) s->ammo[i] = getint(p); loopi(NUMGUNS) s->mag[i] = getint(p); - s->state = CS_SPAWNING; + //2011oct16:flowtron:keep spectator state + //possible fubar here - trying out ATM! + bool cws = s->state == CS_SPECTATE; + s->state = cws?CS_SPECTATE:CS_SPAWNING; if(s->lifesequence==0) s->resetstats(); //NEW break; } @@ -671,7 +679,9 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) int arenaspawn = getint(p); loopi(NUMGUNS) player1->ammo[i] = getint(p); loopi(NUMGUNS) player1->mag[i] = getint(p); - player1->state = CS_ALIVE; + //2011oct16:flowtron:keep spectator state + bool pws = player1->state == CS_SPECTATE; + player1->state = pws?CS_SPECTATE:CS_ALIVE; lastspawn = lastmillis; findplayerstart(player1, false, arenaspawn); arenaintermission = 0; diff --git a/source/src/editing.cpp b/source/src/editing.cpp index 64ced307..8f77b16b 100644 --- a/source/src/editing.cpp +++ b/source/src/editing.cpp @@ -40,7 +40,9 @@ void toggleedit(bool force) } keyrepeat(editmode); editing = editmode ? 1 : 0; - player1->state = editing ? CS_EDITING : CS_ALIVE; + //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); 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(!force) addmsg(SV_EDITMODE, "ri", editing); @@ -272,7 +274,7 @@ void copy() block *b = blockcopy(sels[i]); copybuffers.add(b); } - + } void paste() @@ -315,7 +317,7 @@ int countwalls(int type) loopselsxy(if(s->type==type) counter++) return counter; } - + void tofronttex() // maintain most recently used of the texture lists when applying texture { loopi(3)