mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-29 21:00:50 +00:00
- Added flags SXF_CLEARCALLERTID, SXF_MULTIPLYSPEED, and SXF_TRANSFERSCALE for A_SpawnItemEx.
SVN r4188 (trunk)
This commit is contained in:
parent
de20936b13
commit
277d59b2bb
3 changed files with 133 additions and 91 deletions
|
@ -1716,27 +1716,32 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
|
|||
// Common code for A_SpawnItem and A_SpawnItemEx
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
enum SIX_Flags
|
||||
{
|
||||
SIXF_TRANSFERTRANSLATION=1,
|
||||
SIXF_ABSOLUTEPOSITION=2,
|
||||
SIXF_ABSOLUTEANGLE=4,
|
||||
SIXF_ABSOLUTEVELOCITY=8,
|
||||
SIXF_SETMASTER=16,
|
||||
SIXF_NOCHECKPOSITION=32,
|
||||
SIXF_TELEFRAG=64,
|
||||
// 128 is used by Skulltag!
|
||||
SIXF_TRANSFERAMBUSHFLAG=256,
|
||||
SIXF_TRANSFERPITCH=512,
|
||||
SIXF_TRANSFERPOINTERS=1024,
|
||||
SIXF_USEBLOODCOLOR=2048,
|
||||
SIXF_TRANSFERTRANSLATION = 1 << 0,
|
||||
SIXF_ABSOLUTEPOSITION = 1 << 1,
|
||||
SIXF_ABSOLUTEANGLE = 1 << 2,
|
||||
SIXF_ABSOLUTEVELOCITY = 1 << 3,
|
||||
SIXF_SETMASTER = 1 << 4,
|
||||
SIXF_NOCHECKPOSITION = 1 << 5,
|
||||
SIXF_TELEFRAG = 1 << 6,
|
||||
SIXF_CLIENTSIDE = 1 << 7, // only used by Skulldronum
|
||||
SIXF_TRANSFERAMBUSHFLAG = 1 << 8,
|
||||
SIXF_TRANSFERPITCH = 1 << 9,
|
||||
SIXF_TRANSFERPOINTERS = 1 << 10,
|
||||
SIXF_USEBLOODCOLOR = 1 << 11,
|
||||
SIXF_CLEARCALLERTID = 1 << 12,
|
||||
SIXF_MULTIPLYSPEED = 1 << 13,
|
||||
SIXF_TRANSFERSCALE = 1 << 14,
|
||||
};
|
||||
|
||||
|
||||
static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
||||
{
|
||||
if (mo)
|
||||
if (mo == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
AActor *originator = self;
|
||||
|
||||
if (!(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
|
@ -1760,8 +1765,14 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
|||
}
|
||||
|
||||
mo->angle = self->angle;
|
||||
if (flags & SIXF_TRANSFERPITCH) mo->pitch = self->pitch;
|
||||
while (originator && originator->isMissile()) originator = originator->target;
|
||||
if (flags & SIXF_TRANSFERPITCH)
|
||||
{
|
||||
mo->pitch = self->pitch;
|
||||
}
|
||||
while (originator && originator->isMissile())
|
||||
{
|
||||
originator = originator->target;
|
||||
}
|
||||
|
||||
if (flags & SIXF_TELEFRAG)
|
||||
{
|
||||
|
@ -1811,7 +1822,21 @@ 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_TRANSFERSCALE)
|
||||
{
|
||||
mo->scaleX = self->scaleX;
|
||||
mo->scaleY = self->scaleY;
|
||||
}
|
||||
if (flags & SIXF_TRANSFERAMBUSHFLAG)
|
||||
{
|
||||
mo->flags = (mo->flags & ~MF_AMBUSH) | (self->flags & MF_AMBUSH);
|
||||
}
|
||||
if (flags & SIXF_CLEARCALLERTID)
|
||||
{
|
||||
self->RemoveFromHash();
|
||||
self->tid = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1875,7 +1900,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
|||
//===========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
||||
{
|
||||
ACTION_PARAM_START(10);
|
||||
ACTION_PARAM_START(11);
|
||||
ACTION_PARAM_CLASS(missile, 0);
|
||||
ACTION_PARAM_FIXED(xofs, 1);
|
||||
ACTION_PARAM_FIXED(yofs, 2);
|
||||
|
@ -1886,6 +1911,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
ACTION_PARAM_ANGLE(Angle, 7);
|
||||
ACTION_PARAM_INT(flags, 8);
|
||||
ACTION_PARAM_INT(chance, 9);
|
||||
ACTION_PARAM_INT(tid, 10);
|
||||
|
||||
if (!missile)
|
||||
{
|
||||
|
@ -1931,14 +1957,27 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
|||
AActor *mo = Spawn(missile, x, y, self->z - self->floorclip + self->GetBobOffset() + zofs, ALLOW_REPLACE);
|
||||
bool res = InitSpawnedItem(self, mo, flags);
|
||||
ACTION_SET_RESULT(res); // for an inventory item's use state
|
||||
if (mo)
|
||||
if (res)
|
||||
{
|
||||
if (tid != 0)
|
||||
{
|
||||
assert(mo->tid == 0);
|
||||
mo->tid = tid;
|
||||
mo->AddToHash();
|
||||
}
|
||||
if (flags & SIXF_MULTIPLYSPEED)
|
||||
{
|
||||
mo->velx = FixedMul(xvel, mo->Speed);
|
||||
mo->vely = FixedMul(yvel, mo->Speed);
|
||||
mo->velz = FixedMul(zvel, mo->Speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->velx = xvel;
|
||||
mo->vely = yvel;
|
||||
mo->velz = zvel;
|
||||
}
|
||||
mo->angle = Angle;
|
||||
if (flags & SIXF_TRANSFERAMBUSHFLAG)
|
||||
mo->flags = (mo->flags&~MF_AMBUSH) | (self->flags & MF_AMBUSH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_GiveInventory(class<Inventory> itemtype, int amount = 0, int giveto = AAPTR_DEFAULT);
|
||||
action native A_TakeInventory(class<Inventory> itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT);
|
||||
action native A_SpawnItem(class<Actor> itemtype = "Unknown", float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false);
|
||||
action native A_SpawnItemEx(class<Actor> itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0);
|
||||
action native A_SpawnItemEx(class<Actor> itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0);
|
||||
action native A_Print(string whattoprint, float time = 0, string fontname = "");
|
||||
action native A_PrintBold(string whattoprint, float time = 0, string fontname = "");
|
||||
action native A_Log(string whattoprint);
|
||||
|
|
|
@ -54,6 +54,9 @@ 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;
|
||||
|
||||
// Flags for A_Chase
|
||||
const int CHF_FASTCHASE = 1;
|
||||
|
|
Loading…
Reference in a new issue