From c4b546404ace0d20fa5315bba158426abcabaf90 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Feb 2017 17:50:48 +0100 Subject: [PATCH] - added a 'nocheck' parameter to A_Raise* and Thing_Raise. --- src/actionspecials.h | 2 +- src/p_actionfunctions.cpp | 22 ++++++++++++++++------ src/p_lnspec.cpp | 6 +++--- src/p_local.h | 2 +- src/p_things.cpp | 4 ++-- wadsrc/static/zscript/actor.txt | 6 +++--- wadsrc/static/zscript/constants.txt | 6 ++++++ 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/actionspecials.h b/src/actionspecials.h index 42861b702..aac1b7161 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -15,7 +15,7 @@ DEFINE_SPECIAL(Door_LockedRaise, 13, 4, 5, 5) DEFINE_SPECIAL(Door_Animated, 14, 4, 4, 4) DEFINE_SPECIAL(Autosave, 15, 0, 0, 0) // [RH] Save the game *now* DEFINE_SPECIAL(Transfer_WallLight, 16, -1, -1, 2) -DEFINE_SPECIAL(Thing_Raise, 17, 1, 1, 1) +DEFINE_SPECIAL(Thing_Raise, 17, 1, 2, 2) DEFINE_SPECIAL(StartConversation, 18, 1, 2, 2) DEFINE_SPECIAL(Thing_Stop, 19, 1, 1, 1) DEFINE_SPECIAL(Floor_LowerByValue, 20, 3, 4, 4) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 16c8c3267..51e71cb3f 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4602,6 +4602,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeCountFlags) return 0; } + +enum ERaise +{ + RF_TRANSFERFRIENDLINESS = 1, + RF_NOCHECKPOSITION = 2 +}; + //=========================================================================== // // A_RaiseMaster @@ -4610,11 +4617,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeCountFlags) DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_DEF(copy); + PARAM_INT_DEF(flags); + bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); if (self->master != NULL) { - P_Thing_Raise(self->master, copy ? self : NULL); + P_Thing_Raise(self->master, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); } return 0; } @@ -4627,16 +4635,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster) DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_DEF(copy); + PARAM_INT_DEF(flags); TThinkerIterator it; AActor *mo; + bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); while ((mo = it.Next()) != NULL) { if (mo->master == self) { - P_Thing_Raise(mo, copy ? self : NULL); + P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); } } return 0; @@ -4650,18 +4659,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren) DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_DEF(copy); + PARAM_INT_DEF(flags); TThinkerIterator it; AActor *mo; + bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); if (self->master != NULL) { while ((mo = it.Next()) != NULL) { if (mo->master == self->master && mo != self) { - P_Thing_Raise(mo, copy ? self : NULL); + P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); } } } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 9cbb4aec1..394203c75 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1737,14 +1737,14 @@ FUNC(LS_Thing_SpawnFacing) } FUNC(LS_Thing_Raise) -// Thing_Raise(tid) +// Thing_Raise(tid, nocheck) { AActor * target; bool ok = false; if (arg0==0) { - ok = P_Thing_Raise (it,NULL); + ok = P_Thing_Raise (it,NULL, arg1); } else { @@ -1752,7 +1752,7 @@ FUNC(LS_Thing_Raise) while ( (target = iterator.Next ()) ) { - ok |= P_Thing_Raise(target,NULL); + ok |= P_Thing_Raise(target,NULL, arg1); } } return ok; diff --git a/src/p_local.h b/src/p_local.h index 677de09fc..9ce290be7 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -151,7 +151,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog); int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type); void P_Thing_SetVelocity(AActor *actor, const DVector3 &vec, bool add, bool setbob); void P_RemoveThing(AActor * actor); -bool P_Thing_Raise(AActor *thing, AActor *raiser); +bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck = false); bool P_Thing_CanRaise(AActor *thing); PClassActor *P_GetSpawnableType(int spawnnum); void InitSpawnablesFromMapinfo(); diff --git a/src/p_things.cpp b/src/p_things.cpp index f6c06a1e5..d4298f934 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -406,7 +406,7 @@ void P_RemoveThing(AActor * actor) } -bool P_Thing_Raise(AActor *thing, AActor *raiser) +bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck) { FState * RaiseState = thing->GetRaiseState(); if (RaiseState == NULL) @@ -426,7 +426,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser) thing->flags |= MF_SOLID; thing->Height = info->Height; // [RH] Use real height thing->radius = info->radius; // [RH] Use real radius - if (!P_CheckPosition (thing, thing->Pos())) + if (!nocheck && !P_CheckPosition (thing, thing->Pos())) { thing->flags = oldflags; thing->radius = oldradius; diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 2e9752b97..926b03804 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -790,9 +790,9 @@ class Actor : Thinker native native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0); deprecated native void A_ChangeFlag(string flagname, bool value); native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE); - native void A_RaiseMaster(bool copy = 0); - native void A_RaiseChildren(bool copy = 0); - native void A_RaiseSiblings(bool copy = 0); + native void A_RaiseMaster(int flags = 0); + native void A_RaiseChildren(int flags = 0); + native void A_RaiseSiblings(int flags = 0); deprecated native void A_BasicAttack(int meleedamage, sound meleesound, class missiletype, double missileheight); action native bool, Actor A_ThrowGrenade(class itemtype, double zheight = 0, double xyvel = 0, double zvel = 0, bool useammo = true); native void A_Weave(int xspeed, int yspeed, double xdist, double ydist); diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 422853ea6..9e9d4dae8 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -996,6 +996,12 @@ enum EFindFloorCeiling FFCF_NODROPOFF = 256, // Caller does not need a dropoff (saves some time when checking portals) }; +enum ERaise +{ + RF_TRANSFERFRIENDLINESS = 1, + RF_NOCHECKPOSITION = 2 +} + enum ETeleport { TELF_DESTFOG = 1,