Skip to content

Commit

Permalink
func_wall_toggle: reset entity on start round
Browse files Browse the repository at this point in the history
func_wall_toggle features: added spawnflags not solid
Update regamedll-cs.fgd
  • Loading branch information
s1lentq committed Jul 2, 2017
1 parent 7fddff5 commit f0409ce
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions regamedll/dlls/bmodels.cpp
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions regamedll/dlls/bmodels.h
Expand Up @@ -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
Expand Down Expand Up @@ -85,6 +86,11 @@ class CFuncWallToggle: public CFuncWall
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();
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/multiplay_gamerules.cpp
Expand Up @@ -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
Expand Down
Expand Up @@ -2717,6 +2717,7 @@
spawnflags(flags) =
[
1 : "Starts Invisible" : 0
8 : "Not Solid" : 0
]
]

Expand Down
3 changes: 3 additions & 0 deletions regamedll/extra/cssdk/dlls/bmodels.h
Expand Up @@ -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
Expand All @@ -71,6 +72,8 @@ class CFuncWall: public CBaseEntity {
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;
};

Expand Down

0 comments on commit f0409ce

Please sign in to comment.