Change switching between spectate and edit mode
1. In multiplayer this switching isn't allowed, because it was broken and messed up, for example other players didn't see concurrently spectating and editing player. 2. In demo mode switching from spectate to edit mode is improved. 3. Several years broken code for edit mode is reverted.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user