diff --git a/src/p_local.h b/src/p_local.h index 6bb65ad97..8ebdf9fae 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -261,7 +261,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo AActor *P_CheckOnmobj (AActor *thing); void P_FakeZMovement (AActor *mo); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); -bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL); +bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL, bool missilecheck = false); bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags = 0); void P_ApplyTorque(AActor *mo); diff --git a/src/p_map.cpp b/src/p_map.cpp index a3427d486..4e873c99a 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -106,6 +106,27 @@ DEFINE_ACTION_FUNCTION(_FCheckPosition, ClearLastRipped) return 0; } +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos); +DEFINE_FIELD_NAMED_X(FCheckPosition, FCheckPosition, sector, cursector); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorz); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingz); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, dropoffz); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorpic); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorterrain); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorsector); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingpic); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingsector); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, touchmidtex); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, abovemidtex); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floatok); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, FromPMove); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingline); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, stepthing); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, DoRipping); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, portalstep); +DEFINE_FIELD_X(FCheckPosition, FCheckPosition, PushTime); + //========================================================================== // // CanCollideWith @@ -1867,9 +1888,18 @@ DEFINE_ACTION_FUNCTION(AActor, CheckPosition) PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_BOOL_DEF(actorsonly); - ACTION_RETURN_BOOL(P_CheckPosition(self, DVector2(x, y), actorsonly)); + PARAM_POINTER_DEF(tm, FCheckPosition); + if (tm) + { + ACTION_RETURN_BOOL(P_CheckPosition(self, DVector2(x, y), *tm, actorsonly)); + } + else + { + ACTION_RETURN_BOOL(P_CheckPosition(self, DVector2(x, y), actorsonly)); + } } + //---------------------------------------------------------------------------- // // FUNC P_TestMobjLocation @@ -2659,10 +2689,10 @@ pushline: bool P_TryMove(AActor *thing, const DVector2 &pos, int dropoff, // killough 3/15/98: allow dropoff as option - const secplane_t *onfloor) // [RH] Let P_TryMove keep the thing on the floor + const secplane_t *onfloor, bool missilecheck) // [RH] Let P_TryMove keep the thing on the floor { FCheckPosition tm; - return P_TryMove(thing, pos, dropoff, onfloor, tm); + return P_TryMove(thing, pos, dropoff, onfloor, tm, missilecheck); } DEFINE_ACTION_FUNCTION(AActor, TryMove) @@ -2671,7 +2701,16 @@ DEFINE_ACTION_FUNCTION(AActor, TryMove) PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_INT(dropoff); - ACTION_RETURN_BOOL(P_TryMove(self, DVector2(x, y), dropoff)); + PARAM_BOOL_DEF(missilecheck); + PARAM_POINTER_DEF(tm, FCheckPosition); + if (tm == nullptr) + { + ACTION_RETURN_BOOL(P_TryMove(self, DVector2(x, y), dropoff, nullptr, missilecheck)); + } + else + { + ACTION_RETURN_BOOL(P_TryMove(self, DVector2(x, y), dropoff, nullptr, *tm, missilecheck)); + } } diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 00720ce79..dc058aaf9 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1,32 +1,29 @@ struct FCheckPosition { -/* - // in native Actor thing; native Vector3 pos; // out - native sector sector; + native Sector cursector; native double floorz; native double ceilingz; native double dropoffz; - nativeTextureID floorpic; + native TextureID floorpic; native int floorterrain; - native sector floorsector; + native Sector floorsector; native TextureID ceilingpic; - native sector ceilingsector; + native Sector ceilingsector; native bool touchmidtex; native bool abovemidtex; native bool floatok; native bool FromPMove; native line ceilingline; - native AActor stepthing; + native Actor stepthing; native bool DoRipping; native bool portalstep; native int PushTime; -*/ native void ClearLastRipped(); } @@ -361,7 +358,7 @@ class Actor : Thinker native native double BulletSlope(out FTranslatedLineTarget pLineTarget = null, int aimflags = 0); native Actor AimTarget(); native bool CheckMissileSpawn(double maxdist); - native bool CheckPosition(Vector2 pos, bool actorsonly = false); + native bool CheckPosition(Vector2 pos, bool actorsonly = false, FCheckPosition tm = null); native bool TestMobjLocation(); native static Actor Spawn(class type, vector3 pos = (0,0,0), int replace = NO_REPLACE); native Actor SpawnMissile(Actor dest, class type, Actor owner = null); @@ -422,7 +419,7 @@ class Actor : Thinker native return true; } - native bool TryMove(vector2 newpos, int dropoff); + native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null); native void NewChaseDir(); native void RandomChaseDir(); native bool CheckMissileRange();