- fixed: A_Warp didn't initialize oldx/y/z in all situations.

This commit is contained in:
Christoph Oelckers 2014-10-25 00:05:52 +02:00
parent e81c404b04
commit b6f4862024

View file

@ -4348,12 +4348,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
ACTION_PARAM_INT(flags, 5);
ACTION_PARAM_STATE(success_state, 6);
fixed_t
oldx,
oldy,
oldz;
AActor *reference = COPY_AAPTR(self, destination_selector);
if (!reference)
@ -4362,6 +4356,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
return;
}
fixed_t oldx = self->x;
fixed_t oldy = self->y;
fixed_t oldz = self->z;
if (!(flags & WARPF_ABSOLUTEANGLE))
{
angle += (flags & WARPF_USECALLERANGLE) ? self->angle : reference->angle;
@ -4371,20 +4369,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
if (!(flags & WARPF_ABSOLUTEOFFSET))
{
angle_t fineangle = angle >> ANGLETOFINESHIFT;
oldx = xofs;
fixed_t xofs1 = xofs;
// (borrowed from A_SpawnItemEx, assumed workable)
// in relative mode negative y values mean 'left' and positive ones mean 'right'
// This is the inverse orientation of the absolute mode!
xofs = FixedMul(oldx, finecosine[fineangle]) + FixedMul(yofs, finesine[fineangle]);
yofs = FixedMul(oldx, finesine[fineangle]) - FixedMul(yofs, finecosine[fineangle]);
xofs = FixedMul(xofs1, finecosine[fineangle]) + FixedMul(yofs, finesine[fineangle]);
yofs = FixedMul(xofs1, finesine[fineangle]) - FixedMul(yofs, finecosine[fineangle]);
}
oldx = self->x;
oldy = self->y;
oldz = self->z;
if (flags & WARPF_TOFLOOR)
{
// set correct xy