- fixed: Trying to rotate a polyobject into its actual position during loading of a savegame still inflicted damage on all touching actors - including incomplete player pawns - and also got blocked by them.

Similar code already existed for the MovePolyobj function but apparently was overlooked here.
This commit is contained in:
Christoph Oelckers 2014-12-25 18:46:50 +01:00
parent f2551dceda
commit 6fd70ff320
3 changed files with 19 additions and 15 deletions

View File

@ -566,7 +566,7 @@ void P_SerializePolyobjs (FArchive &arc)
I_Error ("UnarchivePolyobjs: Invalid polyobj tag");
}
arc << angle;
po->RotatePolyobj (angle);
po->RotatePolyobj (angle, false);
arc << deltaX << deltaY << po->interpolation;
deltaX -= po->StartSpot.x;
deltaY -= po->StartSpot.y;

View File

@ -1051,7 +1051,7 @@ static void RotatePt (int an, fixed_t *x, fixed_t *y, fixed_t startSpotX, fixed_
//
//==========================================================================
bool FPolyObj::RotatePolyobj (angle_t angle)
bool FPolyObj::RotatePolyobj (angle_t angle, bool fromsave)
{
int an;
bool blocked;
@ -1073,23 +1073,27 @@ bool FPolyObj::RotatePolyobj (angle_t angle)
validcount++;
UpdateBBox();
for(unsigned i=0;i < Sidedefs.Size(); i++)
// If we are loading a savegame we do not really want to damage actors and be blocked by them. This can also cause crashes when trying to damage incompletely deserialized player pawns.
if (!fromsave)
{
if (CheckMobjBlocking(Sidedefs[i]))
for (unsigned i = 0; i < Sidedefs.Size(); i++)
{
blocked = true;
if (CheckMobjBlocking(Sidedefs[i]))
{
blocked = true;
}
}
}
if (blocked)
{
for(unsigned i=0;i < Vertices.Size(); i++)
if (blocked)
{
Vertices[i]->x = PrevPts[i].x;
Vertices[i]->y = PrevPts[i].y;
for(unsigned i=0;i < Vertices.Size(); i++)
{
Vertices[i]->x = PrevPts[i].x;
Vertices[i]->y = PrevPts[i].y;
}
UpdateBBox();
LinkPolyobj();
return false;
}
UpdateBBox();
LinkPolyobj();
return false;
}
this->angle += angle;
LinkPolyobj();

View File

@ -74,7 +74,7 @@ struct FPolyObj
int GetMirror();
bool MovePolyobj (int x, int y, bool force = false);
bool RotatePolyobj (angle_t angle);
bool RotatePolyobj (angle_t angle, bool fromsave = false);
void ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy, side_t **side) const;
void LinkPolyobj ();
void RecalcActorFloorCeil(FBoundingBox bounds) const;