- 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"); I_Error ("UnarchivePolyobjs: Invalid polyobj tag");
} }
arc << angle; arc << angle;
po->RotatePolyobj (angle); po->RotatePolyobj (angle, false);
arc << deltaX << deltaY << po->interpolation; arc << deltaX << deltaY << po->interpolation;
deltaX -= po->StartSpot.x; deltaX -= po->StartSpot.x;
deltaY -= po->StartSpot.y; 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; int an;
bool blocked; bool blocked;
@ -1073,6 +1073,9 @@ bool FPolyObj::RotatePolyobj (angle_t angle)
validcount++; validcount++;
UpdateBBox(); UpdateBBox();
// 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)
{
for (unsigned i = 0; i < Sidedefs.Size(); i++) for (unsigned i = 0; i < Sidedefs.Size(); i++)
{ {
if (CheckMobjBlocking(Sidedefs[i])) if (CheckMobjBlocking(Sidedefs[i]))
@ -1091,6 +1094,7 @@ bool FPolyObj::RotatePolyobj (angle_t angle)
LinkPolyobj(); LinkPolyobj();
return false; return false;
} }
}
this->angle += angle; this->angle += angle;
LinkPolyobj(); LinkPolyobj();
ClearSubsectorLinks(); ClearSubsectorLinks();

View file

@ -74,7 +74,7 @@ struct FPolyObj
int GetMirror(); int GetMirror();
bool MovePolyobj (int x, int y, bool force = false); 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 ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy, side_t **side) const;
void LinkPolyobj (); void LinkPolyobj ();
void RecalcActorFloorCeil(FBoundingBox bounds) const; void RecalcActorFloorCeil(FBoundingBox bounds) const;