From f0409ce468cee5690e16f11d8022365288ae2a17 Mon Sep 17 00:00:00 2001 From: s1lent Date: Sun, 2 Jul 2017 23:10:00 +0700 Subject: [PATCH] func_wall_toggle: reset entity on start round func_wall_toggle features: added spawnflags not solid Update regamedll-cs.fgd --- regamedll/dlls/bmodels.cpp | 23 +++++++++++++++++++ regamedll/dlls/bmodels.h | 6 +++++ regamedll/dlls/multiplay_gamerules.cpp | 1 + .../GameDefinitionFile/regamedll-cs.fgd | 1 + regamedll/extra/cssdk/dlls/bmodels.h | 3 +++ 5 files changed, 34 insertions(+) diff --git a/regamedll/dlls/bmodels.cpp b/regamedll/dlls/bmodels.cpp index 7d16e459..4a301614 100644 --- a/regamedll/dlls/bmodels.cpp +++ b/regamedll/dlls/bmodels.cpp @@ -68,8 +68,31 @@ void CFuncWallToggle::Spawn() { TurnOff(); } + +#ifdef REGAMEDLL_ADD + if (pev->spawnflags & SF_WALL_NOTSOLID) + { + pev->solid = SOLID_NOT; + } +#endif + } +#ifdef REGAMEDLL_FIXES +void CFuncWallToggle::Restart() +{ + CFuncWall::Spawn(); + + if (pev->spawnflags & SF_WALL_START_OFF) + { + TurnOff(); + return; + } + + TurnOn(); +} +#endif + void CFuncWallToggle::TurnOff() { pev->solid = SOLID_NOT; diff --git a/regamedll/dlls/bmodels.h b/regamedll/dlls/bmodels.h index 99d6a73f..a9af47de 100644 --- a/regamedll/dlls/bmodels.h +++ b/regamedll/dlls/bmodels.h @@ -58,6 +58,7 @@ // func_wall_toggle #define SF_WALL_START_OFF 0x0001 +#define SF_WALL_NOTSOLID 0x0008 // func_conveyor #define SF_CONVEYOR_VISUAL 0x0001 @@ -85,6 +86,11 @@ public: virtual void Spawn(); virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); +#ifdef REGAMEDLL_FIXES + virtual void Restart(); + virtual int ObjectCaps() { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } +#endif + public: void TurnOff(); void TurnOn(); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 06ebcec9..cf464b2b 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -709,6 +709,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(CleanUpMap)() #ifdef REGAMEDLL_FIXES UTIL_RestartOther("trigger_once"); + UTIL_RestartOther("func_wall_toggle"); UTIL_RestartOther("multisource"); UTIL_RestartOther("trigger_auto"); #endif diff --git a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd index f9b6ec62..5b9a7149 100644 --- a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd +++ b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd @@ -2717,6 +2717,7 @@ spawnflags(flags) = [ 1 : "Starts Invisible" : 0 + 8 : "Not Solid" : 0 ] ] diff --git a/regamedll/extra/cssdk/dlls/bmodels.h b/regamedll/extra/cssdk/dlls/bmodels.h index d6e948b3..e3fa20f9 100644 --- a/regamedll/extra/cssdk/dlls/bmodels.h +++ b/regamedll/extra/cssdk/dlls/bmodels.h @@ -53,6 +53,7 @@ // func_wall_toggle #define SF_WALL_START_OFF 0x0001 +#define SF_WALL_NOTSOLID 0x0008 // func_conveyor #define SF_CONVEYOR_VISUAL 0x0001 @@ -71,6 +72,8 @@ public: class CFuncWallToggle: public CFuncWall { public: virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual int ObjectCaps() = 0; virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; };