diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 2ab57ab7e..75779cc93 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -201,7 +201,8 @@ static const char *MenuDefCommands[] = "fpuke", "pukename", "event", - "netevent" + "netevent", + "openmenu" }; // CODE -------------------------------------------------------------------- diff --git a/src/g_level.cpp b/src/g_level.cpp index cb5bc4baf..ce8ff0850 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1954,6 +1954,52 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic) return 0; } +//========================================================================== +// +// +//========================================================================== + +template +inline T VecDiff(const T& v1, const T& v2) +{ + T result = v2 - v1; + + if (level.subsectors.Size() > 0) + { + const sector_t *const sec1 = P_PointInSector(v1); + const sector_t *const sec2 = P_PointInSector(v2); + + if (nullptr != sec1 && nullptr != sec2) + { + result += Displacements.getOffset(sec2->PortalGroup, sec1->PortalGroup); + } + } + + return result; +} + +DEFINE_ACTION_FUNCTION(FLevelLocals, Vec2Diff) +{ + PARAM_PROLOGUE; + PARAM_FLOAT(x1); + PARAM_FLOAT(y1); + PARAM_FLOAT(x2); + PARAM_FLOAT(y2); + ACTION_RETURN_VEC2(VecDiff(DVector2(x1, y1), DVector2(x2, y2))); +} + +DEFINE_ACTION_FUNCTION(FLevelLocals, Vec3Diff) +{ + PARAM_PROLOGUE; + PARAM_FLOAT(x1); + PARAM_FLOAT(y1); + PARAM_FLOAT(z1); + PARAM_FLOAT(x2); + PARAM_FLOAT(y2); + PARAM_FLOAT(z2); + ACTION_RETURN_VEC3(VecDiff(DVector3(x1, y1, z1), DVector3(x2, y2, z2))); +} + //========================================================================== // // diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index b2b4ea9ae..1ac8b33fe 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -44,6 +44,7 @@ RenderContext gl; EXTERN_CVAR(Bool, gl_legacy_mode) extern int currentrenderer; +CVAR(Bool, gl_riskymodernpath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) //========================================================================== // @@ -209,7 +210,10 @@ void gl_LoadExtensions() // The minimum requirement for the modern render path is GL 3.3. // Although some GL 3.1 or 3.2 solutions may theoretically work they are usually too broken or too slow. // unless, of course, we're simply using this as a software backend... - if ((gl_version < 3.3f && (currentrenderer==1)) || gl_version < 3.0f) + float minmodernpath = 3.3f; + if (gl_riskymodernpath) + minmodernpath = 3.1f; + if ((gl_version < minmodernpath && (currentrenderer==1)) || gl_version < 3.0f) { gl.legacyMode = true; gl.lightmethod = LM_LEGACY; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 22afac1b6..e499f9d01 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -851,9 +851,25 @@ FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS]; // //---------------------------------------------------------------------------- +struct FACSStackMemory +{ + int32_t& operator[](const size_t index) + { + if (index >= STACK_SIZE) + { + I_Error("Corrupted stack pointer in ACS VM"); + } + + return buffer[index]; + } + +private: + int32_t buffer[STACK_SIZE]; +}; + struct FACSStack { - int32_t buffer[STACK_SIZE]; + FACSStackMemory buffer; int sp; FACSStack *next; FACSStack *prev; @@ -1488,7 +1504,20 @@ void P_CollectACSGlobalStrings() { for (FACSStack *stack = FACSStack::head; stack != NULL; stack = stack->next) { - GlobalACSStrings.MarkStringArray(stack->buffer, stack->sp); + const int32_t sp = stack->sp; + + if (0 == sp) + { + continue; + } + else if (sp < 0 && sp >= STACK_SIZE) + { + I_Error("Corrupted stack pointer in ACS VM"); + } + else + { + GlobalACSStrings.MarkStringArray(&stack->buffer[0], sp); + } } FBehavior::StaticMarkLevelVarStrings(); P_MarkWorldVarStrings(); @@ -6889,7 +6918,7 @@ inline int getshort (int *&pc) return res; } -static bool CharArrayParms(int &capacity, int &offset, int &a, int *Stack, int &sp, bool ranged) +static bool CharArrayParms(int &capacity, int &offset, int &a, FACSStackMemory& Stack, int &sp, bool ranged) { if (ranged) { @@ -7012,7 +7041,7 @@ int DLevelScript::RunScript () } FACSStack stackobj; - int32_t *Stack = stackobj.buffer; + FACSStackMemory& Stack = stackobj.buffer; int &sp = stackobj.sp; int *pc = this->pc; @@ -7376,7 +7405,7 @@ int DLevelScript::RunScript () sp -= sizeof(CallReturn)/sizeof(int); retsp = &Stack[sp]; activeBehavior->GetFunctionProfileData(activeFunction)->AddRun(runaway - ret->EntryInstrCount); - sp = int(locals - Stack); + sp = int(locals - &Stack[0]); pc = ret->ReturnModule->Ofs2PC(ret->ReturnAddress); activeFunction = ret->ReturnFunction; activeBehavior = ret->ReturnModule; diff --git a/src/p_map.cpp b/src/p_map.cpp index 56eea2e1f..7cab335c0 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2784,9 +2784,8 @@ DEFINE_ACTION_FUNCTION(AActor, TryMove) // //========================================================================== -bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags) +static bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags) { - FCheckPosition tm; double newz = thing->Z(); auto f1 = thing->flags & MF_PICKUP; @@ -2879,6 +2878,28 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags) return true; } +bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags) +{ + FCheckPosition tm; + return P_CheckMove(thing, pos, tm, flags); +} + +DEFINE_ACTION_FUNCTION(AActor, CheckMove) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_INT_DEF(flags); + PARAM_POINTER_DEF(tm, FCheckPosition); + if (tm == nullptr) + { + ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), flags)); + } + else + { + ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), *tm, flags)); + } +} //========================================================================== diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 31ab08496..24c30375e 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1275,20 +1275,21 @@ void FMultiBlockThingsIterator::Reset() // //=========================================================================== -class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator +class DBlockThingsIterator : public DObject { DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject); FPortalGroupArray check; + FMultiBlockThingsIterator iterator; public: FMultiBlockThingsIterator::CheckResult cres; bool Next() { - return FMultiBlockThingsIterator::Next(&cres); + return iterator.Next(&cres); } DBlockThingsIterator(AActor *origin, double checkradius = -1, bool ignorerestricted = false) - : FMultiBlockThingsIterator(check, origin, checkradius, ignorerestricted) + : iterator(check, origin, checkradius, ignorerestricted) { cres.thing = nullptr; cres.Position.Zero(); @@ -1296,7 +1297,7 @@ public: } DBlockThingsIterator(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec) - : FMultiBlockThingsIterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec) + : iterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec) { cres.thing = nullptr; cres.Position.Zero(); diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index ee464a35b..6dd222fbf 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -624,6 +624,7 @@ class Actor : Thinker native } native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null); + native bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null); native void NewChaseDir(); native void RandomChaseDir(); native bool CheckMissileRange(); diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 4ffe34dce..01e2af795 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -552,6 +552,9 @@ struct LevelLocals native native bool IsJumpingAllowed() const; native bool IsCrouchingAllowed() const; native bool IsFreelookAllowed() const; + + native static clearscope vector2 Vec2Diff(vector2 v1, vector2 v2); + native static clearscope vector3 Vec3Diff(vector3 v1, vector3 v2); String TimeFormatted(bool totals = false) { diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index e35af3a80..e6954b789 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -516,6 +516,15 @@ enum EWarpFlags WARPF_COPYPITCH = 0x8000, }; +// Flags for Actor.CheckMove() + +enum ECheckMoveFlags +{ + PCM_DROPOFF = 1, + PCM_NOACTORS = 1 << 1, + PCM_NOLINES = 1 << 2, +}; + // flags for A_SetPitch/SetAngle/SetRoll enum EAngleFlags { diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn159.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn159.lmp new file mode 100644 index 000000000..d57a2dd3e Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn159.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn192.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn192.lmp new file mode 100644 index 000000000..006a09f71 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn192.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn194.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn194.lmp new file mode 100644 index 000000000..9dc64ce2a Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn194.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn195.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn195.lmp new file mode 100644 index 000000000..b9e53b30a Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn195.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn199.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn199.lmp new file mode 100644 index 000000000..07039d4fb Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn199.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn200.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn200.lmp new file mode 100644 index 000000000..c6c4637e2 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn200.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn201.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn201.lmp index a1667e9a9..1497e3abb 100644 Binary files a/wadsrc_extra/static/filter/game-doom/graphics/stcfn201.lmp and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn201.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn202.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn202.lmp new file mode 100644 index 000000000..ca4c44ee8 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn202.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn206.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn206.lmp new file mode 100644 index 000000000..08325aecf Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn206.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn207.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn207.lmp new file mode 100644 index 000000000..9191a48f8 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn207.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn212.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn212.lmp new file mode 100644 index 000000000..ca0f6133e Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn212.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn213.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn213.lmp new file mode 100644 index 000000000..116cd8dc4 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn213.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn217.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn217.lmp new file mode 100644 index 000000000..4d8caefc7 Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn217.lmp differ diff --git a/wadsrc_extra/static/filter/game-doom/graphics/stcfn219.lmp b/wadsrc_extra/static/filter/game-doom/graphics/stcfn219.lmp new file mode 100644 index 000000000..5aa6f2f4f Binary files /dev/null and b/wadsrc_extra/static/filter/game-doom/graphics/stcfn219.lmp differ