Merge branch 'WarpHeightOffset' of https://github.com/MajorCooke/zdoom

This commit is contained in:
Christoph Oelckers 2015-08-26 08:46:20 +02:00
commit d87b6d6337
5 changed files with 15 additions and 27 deletions

View file

@ -5862,6 +5862,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
int flags = args[5]; int flags = args[5];
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : ""; const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false; bool exact = argCount > 7 ? !!args[7] : false;
fixed_t heightoffset = argCount > 8 ? args[8] : 0;
FState *state = argCount > 6 ? activator->GetClass()->ActorInfo->FindStateByString(statename, exact) : 0; FState *state = argCount > 6 ? activator->GetClass()->ActorInfo->FindStateByString(statename, exact) : 0;
@ -5879,7 +5880,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (!reference) if (!reference)
return false; return false;
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags)) if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset))
{ {
if (state && argCount > 6) if (state && argCount > 6)
{ {

View file

@ -176,7 +176,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser);
bool P_Thing_CanRaise(AActor *thing); bool P_Thing_CanRaise(AActor *thing);
const PClass *P_GetSpawnableType(int spawnnum); const PClass *P_GetSpawnableType(int spawnnum);
void InitSpawnablesFromMapinfo(); void InitSpawnablesFromMapinfo();
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags); 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);
enum WARPF enum WARPF
{ {

View file

@ -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) 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)
{ {
if (flags & WARPF_MOVEPTR) if (flags & WARPF_MOVEPTR)
{ {
@ -693,6 +693,9 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
fixed_t oldy = caller->y; fixed_t oldy = caller->y;
fixed_t oldz = caller->z; fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset);
if (!(flags & WARPF_ABSOLUTEANGLE)) if (!(flags & WARPF_ABSOLUTEANGLE))
{ {
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle; angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
@ -715,30 +718,13 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_TOFLOOR) if (flags & WARPF_TOFLOOR)
{ {
// set correct xy // set correct xy
// now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with.
// extra unlink, link and environment calculation
caller->SetOrigin( caller->SetOrigin(
reference->x + xofs, reference->x + xofs,
reference->y + yofs, reference->y + yofs,
reference->z); reference->floorz + zofs);
// 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
caller->SetOrigin(
caller->x,
caller->y,
caller->floorz + zofs);
}
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;
}
} }
else else
{ {

View file

@ -4672,7 +4672,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
{ {
ACTION_PARAM_START(7); ACTION_PARAM_START(8);
ACTION_PARAM_INT(destination_selector, 0); ACTION_PARAM_INT(destination_selector, 0);
ACTION_PARAM_FIXED(xofs, 1); ACTION_PARAM_FIXED(xofs, 1);
@ -4681,6 +4681,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
ACTION_PARAM_ANGLE(angle, 4); ACTION_PARAM_ANGLE(angle, 4);
ACTION_PARAM_INT(flags, 5); ACTION_PARAM_INT(flags, 5);
ACTION_PARAM_STATE(success_state, 6); ACTION_PARAM_STATE(success_state, 6);
ACTION_PARAM_FIXED(heightoffset,7)
AActor *reference; AActor *reference;
@ -4700,7 +4701,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
return; return;
} }
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags)) if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset))
{ {
if (success_state) if (success_state)
{ {

View file

@ -249,7 +249,7 @@ ACTOR Actor native //: Thinker
action native A_PlayerSkinCheck(state label); action native A_PlayerSkinCheck(state label);
action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight); action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight);
action native A_Teleport(state teleportstate = "", class<SpecialSpot> targettype = "BossSpot", class<Actor> fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); action native A_Teleport(state teleportstate = "", class<SpecialSpot> targettype = "BossSpot", class<Actor> fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT);
action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = ""); action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0);
action native A_ThrowGrenade(class<Actor> itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); action native A_ThrowGrenade(class<Actor> itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true);
action native A_Weave(int xspeed, int yspeed, float xdist, float ydist); action native A_Weave(int xspeed, int yspeed, float xdist, float ydist);