mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- Added SXF_NOPOINTERS for A_SpawnItemEx.
- Added WARPF_ABSOLUTEPOSITION for A_Warp.
This commit is contained in:
parent
29c6e61afd
commit
68a5db3c8c
2 changed files with 92 additions and 68 deletions
|
@ -1767,6 +1767,7 @@ enum SIX_Flags
|
|||
SIXF_TRANSFERRENDERSTYLE = 1 << 19,
|
||||
SIXF_SETTARGET = 1 << 20,
|
||||
SIXF_SETTRACER = 1 << 21,
|
||||
SIXF_NOPOINTERS = 1 << 22,
|
||||
};
|
||||
|
||||
static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
||||
|
@ -1854,6 +1855,13 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
|||
// If this is a missile or something else set the target to the originator
|
||||
mo->target = originator ? originator : self;
|
||||
}
|
||||
if (flags & SIXF_NOPOINTERS)
|
||||
{
|
||||
//[MC]Intentionally eliminate pointers. Overrides TRANSFERPOINTERS, but is overridden by SETMASTER/TARGET/TRACER.
|
||||
mo->target = NULL;
|
||||
mo->master = NULL;
|
||||
mo->tracer = NULL;
|
||||
}
|
||||
if (flags & SIXF_SETMASTER)
|
||||
{
|
||||
mo->master = originator;
|
||||
|
@ -4378,7 +4386,8 @@ enum WARPF
|
|||
|
||||
WARPF_STOP = 0x80,
|
||||
WARPF_TOFLOOR = 0x100,
|
||||
WARPF_TESTONLY = 0x200
|
||||
WARPF_TESTONLY = 0x200,
|
||||
WARPF_ABSOLUTEPOSITION = 0x400,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||
|
@ -4411,59 +4420,72 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
|||
{
|
||||
angle += (flags & WARPF_USECALLERANGLE) ? self->angle : reference->angle;
|
||||
}
|
||||
|
||||
if (!(flags & WARPF_ABSOLUTEOFFSET))
|
||||
if (!(flags & WARPF_ABSOLUTEPOSITION))
|
||||
{
|
||||
angle_t fineangle = angle>>ANGLETOFINESHIFT;
|
||||
oldx = 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]);
|
||||
}
|
||||
|
||||
oldx = self->x;
|
||||
oldy = self->y;
|
||||
oldz = self->z;
|
||||
|
||||
if (flags & WARPF_TOFLOOR)
|
||||
{
|
||||
// set correct xy
|
||||
|
||||
self->SetOrigin(
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->z);
|
||||
|
||||
// now the caller's floorz should be appropriate for the assigned xy-position
|
||||
// assigning position again with
|
||||
|
||||
if (zofs)
|
||||
if (!(flags & WARPF_ABSOLUTEOFFSET))
|
||||
{
|
||||
// extra unlink, link and environment calculation
|
||||
angle_t fineangle = angle >> ANGLETOFINESHIFT;
|
||||
oldx = 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]);
|
||||
}
|
||||
|
||||
oldx = self->x;
|
||||
oldy = self->y;
|
||||
oldz = self->z;
|
||||
|
||||
if (flags & WARPF_TOFLOOR)
|
||||
{
|
||||
// set correct xy
|
||||
|
||||
self->SetOrigin(
|
||||
self->x,
|
||||
self->y,
|
||||
self->floorz + zofs);
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->z);
|
||||
|
||||
// now the caller's floorz should be appropriate for the assigned xy-position
|
||||
// assigning position again with
|
||||
|
||||
if (zofs)
|
||||
{
|
||||
// extra unlink, link and environment calculation
|
||||
self->SetOrigin(
|
||||
self->x,
|
||||
self->y,
|
||||
self->floorz + zofs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is no offset, there should be no ill effect from moving down to the
|
||||
// already identified floor
|
||||
|
||||
// A_Teleport does the same thing anyway
|
||||
self->z = self->floorz;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is no offset, there should be no ill effect from moving down to the
|
||||
// already identified floor
|
||||
|
||||
// A_Teleport does the same thing anyway
|
||||
self->z = self->floorz;
|
||||
self->SetOrigin(
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->z + zofs);
|
||||
}
|
||||
}
|
||||
else
|
||||
else //[MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's.
|
||||
{
|
||||
self->SetOrigin(
|
||||
reference->x + xofs,
|
||||
reference->y + yofs,
|
||||
reference->z + zofs);
|
||||
if (flags & WARPF_TOFLOOR)
|
||||
{
|
||||
self->SetOrigin(xofs, yofs, self->floorz + zofs);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->SetOrigin(xofs, yofs, zofs);
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & WARPF_NOCHECKPOSITION) || P_TestMobjLocation(self))
|
||||
|
|
|
@ -46,29 +46,30 @@ const int FBF_NOFLASH = 16;
|
|||
const int FBF_NORANDOMPUFFZ = 32;
|
||||
|
||||
// Flags for A_SpawnItemEx
|
||||
const int SXF_TRANSFERTRANSLATION = 1;
|
||||
const int SXF_ABSOLUTEPOSITION = 2;
|
||||
const int SXF_ABSOLUTEANGLE = 4;
|
||||
const int SXF_ABSOLUTEMOMENTUM = 8;
|
||||
const int SXF_ABSOLUTEVELOCITY = 8;
|
||||
const int SXF_SETMASTER = 16;
|
||||
const int SXF_NOCHECKPOSITION = 32;
|
||||
const int SXF_TELEFRAG = 64;
|
||||
const int SXF_CLIENTSIDE = 128; // only used by Skulltag
|
||||
const int SXF_TRANSFERAMBUSHFLAG = 256;
|
||||
const int SXF_TRANSFERPITCH = 512;
|
||||
const int SXF_TRANSFERPOINTERS = 1024;
|
||||
const int SXF_USEBLOODCOLOR = 2048;
|
||||
const int SXF_CLEARCALLERTID = 4096;
|
||||
const int SXF_MULTIPLYSPEED = 8192;
|
||||
const int SXF_TRANSFERSCALE = 16384;
|
||||
const int SXF_TRANSFERSPECIAL = 32768;
|
||||
const int SXF_CLEARCALLERSPECIAL = 65536;
|
||||
const int SXF_TRANSFERSTENCILCOL = 131072;
|
||||
const int SXF_TRANSFERALPHA = 262144;
|
||||
const int SXF_TRANSFERRENDERSTYLE = 524288;
|
||||
const int SXF_SETTARGET = 1048576;
|
||||
const int SXF_SETTRACER = 2097152;
|
||||
const int SXF_TRANSFERTRANSLATION = 1 << 0;
|
||||
const int SXF_ABSOLUTEPOSITION = 1 << 1;
|
||||
const int SXF_ABSOLUTEANGLE = 1 << 2;
|
||||
const int SXF_ABSOLUTEMOMENTUM = 1 << 3; //Since "momentum" is declared to be deprecated in the expressions, for compatibility
|
||||
const int SXF_ABSOLUTEVELOCITY = 1 << 3; //purposes, this was made. It does the same thing though. Do not change the value.
|
||||
const int SXF_SETMASTER = 1 << 4;
|
||||
const int SXF_NOCHECKPOSITION = 1 << 5;
|
||||
const int SXF_TELEFRAG = 1 << 6;
|
||||
const int SXF_CLIENTSIDE = 1 << 7; // only used by Skulltag
|
||||
const int SXF_TRANSFERAMBUSHFLAG = 1 << 8;
|
||||
const int SXF_TRANSFERPITCH = 1 << 9;
|
||||
const int SXF_TRANSFERPOINTERS = 1 << 10;
|
||||
const int SXF_USEBLOODCOLOR = 1 << 11;
|
||||
const int SXF_CLEARCALLERTID = 1 << 12;
|
||||
const int SXF_MULTIPLYSPEED = 1 << 13;
|
||||
const int SXF_TRANSFERSCALE = 1 << 14;
|
||||
const int SXF_TRANSFERSPECIAL = 1 << 15;
|
||||
const int SXF_CLEARCALLERSPECIAL = 1 << 16;
|
||||
const int SXF_TRANSFERSTENCILCOL = 1 << 17;
|
||||
const int SXF_TRANSFERALPHA = 1 << 18;
|
||||
const int SXF_TRANSFERRENDERSTYLE = 1 << 19;
|
||||
const int SXF_SETTARGET = 1 << 20;
|
||||
const int SXF_SETTRACER = 1 << 21;
|
||||
const int SXF_NOPOINTERS = 1 << 22;
|
||||
|
||||
// Flags for A_Chase
|
||||
const int CHF_FASTCHASE = 1;
|
||||
|
@ -316,6 +317,7 @@ Const Int WARPF_COPYINTERPOLATION = 0x40;
|
|||
Const Int WARPF_STOP = 0x80;
|
||||
Const Int WARPF_TOFLOOR = 0x100;
|
||||
Const Int WARPF_TESTONLY = 0x200;
|
||||
Const Int WAPRF_ABSOLUTEPOSITION = 0x400;
|
||||
|
||||
// flags for A_SetPitch/SetAngle
|
||||
const int SPF_FORCECLAMP = 1;
|
||||
|
|
Loading…
Reference in a new issue