mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- Added A_SetFloatBobPhase(int). Takes a number between 0 and 63. If it's outside that range, it does nothing.
- Added A_Warp flags: - WARPF_BOB: Gets the bob offset of actor pointer with the FLOATBOB flag. - WARPF_MOVEPTR: The function is inversed to move the pointed actor with applied flags, but only the original caller will make the success/jump.
This commit is contained in:
parent
dac2ae6411
commit
643d37ab7c
3 changed files with 67 additions and 29 deletions
|
@ -4563,6 +4563,8 @@ enum WARPF
|
||||||
WARPF_TOFLOOR = 0x100,
|
WARPF_TOFLOOR = 0x100,
|
||||||
WARPF_TESTONLY = 0x200,
|
WARPF_TESTONLY = 0x200,
|
||||||
WARPF_ABSOLUTEPOSITION = 0x400,
|
WARPF_ABSOLUTEPOSITION = 0x400,
|
||||||
|
WARPF_BOB = 0x800,
|
||||||
|
WARPF_MOVEPTR = 0x1000,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
|
@ -4579,19 +4581,29 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
|
|
||||||
AActor *reference = COPY_AAPTR(self, destination_selector);
|
AActor *reference = COPY_AAPTR(self, destination_selector);
|
||||||
|
|
||||||
|
//If there is no actor to warp to, fail.
|
||||||
if (!reference)
|
if (!reference)
|
||||||
{
|
{
|
||||||
ACTION_SET_RESULT(false);
|
ACTION_SET_RESULT(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t oldx = self->x;
|
AActor *caller = self;
|
||||||
fixed_t oldy = self->y;
|
|
||||||
fixed_t oldz = self->z;
|
if (flags & WARPF_MOVEPTR)
|
||||||
|
{
|
||||||
|
AActor *temp = reference;
|
||||||
|
reference = caller;
|
||||||
|
caller = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed_t oldx = caller->x;
|
||||||
|
fixed_t oldy = caller->y;
|
||||||
|
fixed_t oldz = caller->z;
|
||||||
|
|
||||||
if (!(flags & WARPF_ABSOLUTEANGLE))
|
if (!(flags & WARPF_ABSOLUTEANGLE))
|
||||||
{
|
{
|
||||||
angle += (flags & WARPF_USECALLERANGLE) ? self->angle : reference->angle;
|
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
|
||||||
}
|
}
|
||||||
if (!(flags & WARPF_ABSOLUTEPOSITION))
|
if (!(flags & WARPF_ABSOLUTEPOSITION))
|
||||||
{
|
{
|
||||||
|
@ -4612,7 +4624,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
{
|
{
|
||||||
// set correct xy
|
// set correct xy
|
||||||
|
|
||||||
self->SetOrigin(
|
caller->SetOrigin(
|
||||||
reference->x + xofs,
|
reference->x + xofs,
|
||||||
reference->y + yofs,
|
reference->y + yofs,
|
||||||
reference->z);
|
reference->z);
|
||||||
|
@ -4623,10 +4635,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
if (zofs)
|
if (zofs)
|
||||||
{
|
{
|
||||||
// extra unlink, link and environment calculation
|
// extra unlink, link and environment calculation
|
||||||
self->SetOrigin(
|
caller->SetOrigin(
|
||||||
self->x,
|
caller->x,
|
||||||
self->y,
|
caller->y,
|
||||||
self->floorz + zofs);
|
caller->floorz + zofs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4634,12 +4646,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
// already identified floor
|
// already identified floor
|
||||||
|
|
||||||
// A_Teleport does the same thing anyway
|
// A_Teleport does the same thing anyway
|
||||||
self->z = self->floorz;
|
caller->z = caller->floorz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->SetOrigin(
|
caller->SetOrigin(
|
||||||
reference->x + xofs,
|
reference->x + xofs,
|
||||||
reference->y + yofs,
|
reference->y + yofs,
|
||||||
reference->z + zofs);
|
reference->z + zofs);
|
||||||
|
@ -4649,51 +4661,57 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
{
|
{
|
||||||
if (flags & WARPF_TOFLOOR)
|
if (flags & WARPF_TOFLOOR)
|
||||||
{
|
{
|
||||||
self->SetOrigin(xofs, yofs, self->floorz + zofs);
|
caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->SetOrigin(xofs, yofs, zofs);
|
caller->SetOrigin(xofs, yofs, zofs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & WARPF_NOCHECKPOSITION) || P_TestMobjLocation(self))
|
if ((flags & WARPF_NOCHECKPOSITION) || P_TestMobjLocation(caller))
|
||||||
{
|
{
|
||||||
if (flags & WARPF_TESTONLY)
|
if (flags & WARPF_TESTONLY)
|
||||||
{
|
{
|
||||||
self->SetOrigin(oldx, oldy, oldz);
|
caller->SetOrigin(oldx, oldy, oldz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->angle = angle;
|
caller->angle = angle;
|
||||||
|
|
||||||
if (flags & WARPF_STOP)
|
if (flags & WARPF_STOP)
|
||||||
{
|
{
|
||||||
self->velx = 0;
|
caller->velx = 0;
|
||||||
self->vely = 0;
|
caller->vely = 0;
|
||||||
self->velz = 0;
|
caller->velz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & WARPF_WARPINTERPOLATION)
|
if (flags & WARPF_WARPINTERPOLATION)
|
||||||
{
|
{
|
||||||
self->PrevX += self->x - oldx;
|
caller->PrevX += caller->x - oldx;
|
||||||
self->PrevY += self->y - oldy;
|
caller->PrevY += caller->y - oldy;
|
||||||
self->PrevZ += self->z - oldz;
|
caller->PrevZ += caller->z - oldz;
|
||||||
}
|
}
|
||||||
else if (flags & WARPF_COPYINTERPOLATION)
|
else if (flags & WARPF_COPYINTERPOLATION)
|
||||||
{
|
{
|
||||||
self->PrevX = self->x + reference->PrevX - reference->x;
|
caller->PrevX = caller->x + reference->PrevX - reference->x;
|
||||||
self->PrevY = self->y + reference->PrevY - reference->y;
|
caller->PrevY = caller->y + reference->PrevY - reference->y;
|
||||||
self->PrevZ = self->z + reference->PrevZ - reference->z;
|
caller->PrevZ = caller->z + reference->PrevZ - reference->z;
|
||||||
}
|
}
|
||||||
else if (!(flags & WARPF_INTERPOLATE))
|
else if (!(flags & WARPF_INTERPOLATE))
|
||||||
{
|
{
|
||||||
self->PrevX = self->x;
|
caller->PrevX = caller->x;
|
||||||
self->PrevY = self->y;
|
caller->PrevY = caller->y;
|
||||||
self->PrevZ = self->z;
|
caller->PrevZ = caller->z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & WARPF_BOB) && (reference->flags2 & MF2_FLOATBOB))
|
||||||
|
{
|
||||||
|
caller->z += reference->GetBobOffset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (success_state)
|
if (success_state)
|
||||||
{
|
{
|
||||||
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
||||||
|
@ -4706,7 +4724,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->SetOrigin(oldx, oldy, oldz);
|
caller->SetOrigin(oldx, oldy, oldz);
|
||||||
ACTION_SET_RESULT(false);
|
ACTION_SET_RESULT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5634,6 +5652,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_SetFloatBobPhase
|
||||||
|
//
|
||||||
|
// Changes the FloatBobPhase of the
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(1);
|
||||||
|
ACTION_PARAM_INT(bob, 0);
|
||||||
|
|
||||||
|
//Respect float bob phase limits.
|
||||||
|
if (self && (bob >= 0 && bob <= 63))
|
||||||
|
self->FloatBobPhase = bob;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// A_SetRipperLevel(int level)
|
// A_SetRipperLevel(int level)
|
||||||
|
|
|
@ -326,6 +326,7 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_TakeFromSiblings(class<Inventory> itemtype, int amount = 0);
|
action native A_TakeFromSiblings(class<Inventory> itemtype, int amount = 0);
|
||||||
action native A_SetTeleFog(name oldpos, name newpos);
|
action native A_SetTeleFog(name oldpos, name newpos);
|
||||||
action native A_SwapTeleFog();
|
action native A_SwapTeleFog();
|
||||||
|
action native A_SetFloatBobPhase(int bob);
|
||||||
action native A_SetRipperLevel(int level);
|
action native A_SetRipperLevel(int level);
|
||||||
action native A_SetRipMin(int min);
|
action native A_SetRipMin(int min);
|
||||||
action native A_SetRipMax(int max);
|
action native A_SetRipMax(int max);
|
||||||
|
|
|
@ -345,6 +345,8 @@ Const Int WARPF_TOFLOOR = 0x100;
|
||||||
Const Int WARPF_TESTONLY = 0x200;
|
Const Int WARPF_TESTONLY = 0x200;
|
||||||
Const Int WAPRF_ABSOLUTEPOSITION = 0x400;
|
Const Int WAPRF_ABSOLUTEPOSITION = 0x400;
|
||||||
Const Int WARPF_ABSOLUTEPOSITION = 0x400;
|
Const Int WARPF_ABSOLUTEPOSITION = 0x400;
|
||||||
|
Const Int WARPF_BOB = 0x800;
|
||||||
|
Const Int WARPF_MOVEPTR = 0x1000;
|
||||||
|
|
||||||
// flags for A_SetPitch/SetAngle/SetRoll
|
// flags for A_SetPitch/SetAngle/SetRoll
|
||||||
const int SPF_FORCECLAMP = 1;
|
const int SPF_FORCECLAMP = 1;
|
||||||
|
|
Loading…
Reference in a new issue