fix flying failures

This commit is contained in:
flowtron
2022-01-15 11:57:55 +01:00
parent d476d25658
commit 33046aa993
+16
View File
@@ -1783,6 +1783,22 @@ void spectatemode(int mode)
player1->yaw = f->yaw;
player1->pitch = 0.0f;
player1->resetinterp();
physent d = *player1;
d.radius = d.eyeheight = d.maxeyeheight = d.aboveeye = 0.1;
if(collide(&d, false)) // need air around
{
int x = findentity(PLAYERSTART,rnd(ents.length()));
if(x>=0)
{
gotoplayerstart(player1, &ents[x]);
player1->o.z = S((int)player1->o.x, (int)player1->o.y)->floor + player1->maxeyeheight;
entinmap(player1);
}
else
{
spectatemode(SM_OVERVIEW); // fail-safe
}
}
}
else entinmap(player1); // or drop 'em at a random place
addmsg(SV_SPECTCN, "ri", (player1->followplayercn = FPCN_FLY));