- Clean up.

This commit is contained in:
MajorCooke 2015-08-10 12:41:40 -05:00
parent 9cf8a2a26c
commit 7e661dfe57

View file

@ -692,12 +692,16 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
fixed_t oldx = caller->x; fixed_t oldx = caller->x;
fixed_t oldy = caller->y; fixed_t oldy = caller->y;
fixed_t oldz = caller->z; fixed_t oldz = caller->z;
fixed_t height = 0;
if (flags & WARPF_ADDHEIGHT) if (flags & WARPF_ADDHEIGHT)
height = reference->height + heightoffset; {
zofs += reference->height + heightoffset;
}
else if (flags & WARPF_MULHEIGHT) else if (flags & WARPF_MULHEIGHT)
height = FixedMul(reference->height, heightoffset); {
zofs += FixedMul(reference->height, heightoffset);
}
if (!(flags & WARPF_ABSOLUTEANGLE)) if (!(flags & WARPF_ABSOLUTEANGLE))
{ {
@ -725,44 +729,33 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
caller->SetOrigin( caller->SetOrigin(
reference->x + xofs, reference->x + xofs,
reference->y + yofs, reference->y + yofs,
reference->z + height); reference->z);
// now the caller's floorz should be appropriate for the assigned xy-position // now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with // assigning position again with.
// extra unlink, link and environment calculation
if (zofs) caller->SetOrigin(
{ caller->x,
// extra unlink, link and environment calculation caller->y,
caller->SetOrigin( caller->floorz + zofs);
caller->x,
caller->y,
caller->floorz + zofs + height);
}
else
{
// if there is no offset, there should be no ill effect from moving down to the already defined floor
// A_Teleport does the same thing anyway
caller->z = caller->floorz + height;
}
} }
else else
{ {
caller->SetOrigin( caller->SetOrigin(
reference->x + xofs, reference->x + xofs,
reference->y + yofs, reference->y + yofs,
reference->z + zofs + height); reference->z + zofs);
} }
} }
else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's. else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's.
{ {
if (flags & WARPF_TOFLOOR) if (flags & WARPF_TOFLOOR)
{ {
caller->SetOrigin(xofs, yofs, caller->floorz + zofs + height); caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
} }
else else
{ {
caller->SetOrigin(xofs, yofs, zofs + height); caller->SetOrigin(xofs, yofs, zofs);
} }
} }