- Added Warp properties RadiusOffset and Pitch.
- RadiusOffset is a multiplier of the target actor's radius added onto the offsets x and y. - Pitch is added to the warping actor's current pitch, provided WARPF_USEPITCH is supplied. - Fixed WARPF_TOFLOOR not working as intended.
This commit is contained in:
parent
125afcf3de
commit
af9478f818
6 changed files with 40 additions and 18 deletions
|
|
@ -680,7 +680,7 @@ void InitSpawnablesFromMapinfo()
|
|||
}
|
||||
|
||||
|
||||
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset)
|
||||
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset, fixed_t radiusoffset, angle_t pitch)
|
||||
{
|
||||
if (flags & WARPF_MOVEPTR)
|
||||
{
|
||||
|
|
@ -692,9 +692,10 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
|
|||
fixed_t oldx = caller->x;
|
||||
fixed_t oldy = caller->y;
|
||||
fixed_t oldz = caller->z;
|
||||
|
||||
zofs += FixedMul(reference->height, heightoffset);
|
||||
|
||||
|
||||
const fixed_t rad = FixedMul(radiusoffset, reference->radius);
|
||||
const angle_t fineangle = angle >> ANGLETOFINESHIFT;
|
||||
|
||||
if (!(flags & WARPF_ABSOLUTEANGLE))
|
||||
{
|
||||
|
|
@ -704,13 +705,12 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
|
|||
{
|
||||
if (!(flags & WARPF_ABSOLUTEOFFSET))
|
||||
{
|
||||
angle_t fineangle = angle >> ANGLETOFINESHIFT;
|
||||
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(xofs1, finecosine[fineangle]) + FixedMul(yofs, finesine[fineangle]);
|
||||
yofs = FixedMul(xofs1, finesine[fineangle]) - FixedMul(yofs, finecosine[fineangle]);
|
||||
}
|
||||
|
|
@ -722,15 +722,16 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
|
|||
// assigning position again with.
|
||||
// extra unlink, link and environment calculation
|
||||
caller->SetOrigin(
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->floorz + zofs);
|
||||
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
|
||||
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
|
||||
reference->z);
|
||||
caller->z = caller->floorz + zofs;
|
||||
}
|
||||
else
|
||||
{
|
||||
caller->SetOrigin(
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
|
||||
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
|
||||
reference->z + zofs);
|
||||
}
|
||||
}
|
||||
|
|
@ -738,11 +739,12 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
|
|||
{
|
||||
if (flags & WARPF_TOFLOOR)
|
||||
{
|
||||
caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
|
||||
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
|
||||
caller->z = caller->floorz + zofs;
|
||||
}
|
||||
else
|
||||
{
|
||||
caller->SetOrigin(xofs, yofs, zofs);
|
||||
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,6 +758,18 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
|
|||
{
|
||||
caller->angle = angle;
|
||||
|
||||
if (flags & WARPF_COPYPITCH)
|
||||
caller->SetPitch(reference->pitch, false);
|
||||
|
||||
if (pitch)
|
||||
caller->SetPitch(caller->pitch + pitch, false);
|
||||
|
||||
if (flags & WARPF_COPYVELOCITY)
|
||||
{
|
||||
caller->velx = reference->velx;
|
||||
caller->vely = reference->vely;
|
||||
caller->velz = reference->velz;
|
||||
}
|
||||
if (flags & WARPF_STOP)
|
||||
{
|
||||
caller->velx = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue