keep SPECT state across spawns

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6665 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2011-10-15 23:57:27 +00:00
parent 969a3373cc
commit 5f3fb3ef67
3 changed files with 21 additions and 7 deletions
+3 -1
View File
@@ -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);
}
+13 -3
View File
@@ -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;
+5 -3
View File
@@ -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)