mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- Fixed: Polyobjs that rotated faster than their distance would overshoot on their first tic and
continue spinning until the next time around because the check for moving too fast was only done after the polyobject had been rotated once. - Reduced the potential for overflow when setting up the speed of a rotating polyobj. SVN r4332 (trunk)
This commit is contained in:
parent
e32e44209e
commit
c6dd658aa8
1 changed files with 8 additions and 8 deletions
|
@ -382,24 +382,24 @@ void DRotatePoly::Tick ()
|
||||||
FPolyObj *poly = PO_GetPolyobj (m_PolyObj);
|
FPolyObj *poly = PO_GetPolyobj (m_PolyObj);
|
||||||
if (poly == NULL) return;
|
if (poly == NULL) return;
|
||||||
|
|
||||||
|
// Don't let non-perpetual polyobjs overshoot their targets.
|
||||||
|
if (m_Dist != -1 && (unsigned int)m_Dist < (unsigned int)abs(m_Speed))
|
||||||
|
{
|
||||||
|
m_Speed = m_Speed < 0 ? -m_Dist : m_Dist;
|
||||||
|
}
|
||||||
|
|
||||||
if (poly->RotatePolyobj (m_Speed))
|
if (poly->RotatePolyobj (m_Speed))
|
||||||
{
|
{
|
||||||
unsigned int absSpeed = abs (m_Speed);
|
|
||||||
|
|
||||||
if (m_Dist == -1)
|
if (m_Dist == -1)
|
||||||
{ // perpetual polyobj
|
{ // perpetual polyobj
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Dist -= absSpeed;
|
m_Dist -= abs(m_Speed);
|
||||||
if (m_Dist == 0)
|
if (m_Dist == 0)
|
||||||
{
|
{
|
||||||
SN_StopSequence (poly);
|
SN_StopSequence (poly);
|
||||||
Destroy ();
|
Destroy ();
|
||||||
}
|
}
|
||||||
else if ((unsigned int)m_Dist < absSpeed)
|
|
||||||
{
|
|
||||||
m_Speed = m_Dist * (m_Speed < 0 ? -1 : 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle,
|
||||||
{
|
{
|
||||||
pe->m_Dist = ANGLE_MAX-1;
|
pe->m_Dist = ANGLE_MAX-1;
|
||||||
}
|
}
|
||||||
pe->m_Speed = (speed*direction*(ANGLE_90/64))>>3;
|
pe->m_Speed = speed*direction*(ANGLE_90/(64<<3));
|
||||||
SN_StartSequence (poly, poly->seqType, SEQ_DOOR, 0);
|
SN_StartSequence (poly, poly->seqType, SEQ_DOOR, 0);
|
||||||
direction = -direction; // Reverse the direction
|
direction = -direction; // Reverse the direction
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue