djcev.com

//

Git Repos / fte_dogmode / qc / func / togglevisiblewall.qc

Last update to this file was on 2025-03-30 at 19:29.

Show togglevisiblewall.qc

//==============================================================================
// func_togglevisiblewall
//
// A bmodel which you can toggle its visibility. Behaves much like a
// traditional func_wall in any other way, but you can target it to
// toggle visible/invisible. If the entity has a switchable shadow it
// also toggles.
//
// spawnflag 1: starts invisible
// spawnflag 2: set brush as non-solid
//==============================================================================

//======================================================================
// constants
//======================================================================

#ifdef SSQC
//----------------------------------------------------------------------
// func_togglevisiblewall spawnflags -- CEV
//----------------------------------------------------------------------
typedef enumflags
{
SPAWNFLAG_FUNC_TOGGLEVISWALL_STARTOFF = 1,
SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID = 2
// SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
// SPAWNFLAG_NOT_ON_NORMAL = 512,
// SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
// SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
// SPAWNFLAG_NOT_IN_COOP = 4096,
// SPAWNFLAG_NOT_IN_SP = 8192,
// SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
// SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
// SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
} func_togglevisiblewall_spawnflags;
#endif

//======================================================================
// forward declarations
//======================================================================

// func_togglevisiblewall
#ifdef CSQC
void(float isnew) func_togglevisiblewall_netreceive;
#endif
#ifdef SSQC
void() func_togglevisiblewall_use;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) func_togglevisiblewall_init;
#endif
#ifdef SSQC
void() func_togglevisiblewall;
#endif

//------------------------------------------------------------------------------

//----------------------------------------------------------------------
// class func_togglevisiblewall: base_func
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) func_togglevisiblewall_netreceive =
{
// creates the netflag variable -- CEV
BASE_FUNC_NETRECEIVE (func_togglevisiblewall_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() func_togglevisiblewall_use =
{
if (!self.state)
{
if (!(self.spawnflags &
SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID))
{
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
}
setmodel (self, self.mdl);
if (self.switchshadstyle)
lightstyle (self.switchshadstyle, "a");
self.state = 1;
}
else
{
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setmodel (self, "");
if (self.switchshadstyle)
lightstyle (self.switchshadstyle, "m");
self.state = 0;
}

self.SendFlags |= NETFLAG_BASE_ENTITY_MODEL |
NETFLAG_BASE_ENTITY_SOLID;
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_togglevisiblewall_init =
{
e.classname = "func_togglevisiblewall";
e.classtype = CT_FUNC_TOGGLEVISIBLEWALL;
base_func_init (e);

#ifdef CSQC
setmodelindex (e, e.modelindex);
setsize (e, e.mins, e.maxs);
setorigin (e, e.origin);
e.drawmask = DRAWMASK_NORMAL;
// shouldn't need a predraw -- CEV
#endif

#ifdef SSQC
e.angles = '0 0 0';
e.mdl = e.model;
e.use = func_togglevisiblewall_use;

if (e.spawnflags & SPAWNFLAG_FUNC_TOGGLEVISWALL_STARTOFF)
e.state = 1;
else
e.state = 0;

if (e.spawnflags & SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID)
{
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NONE;
}

sub_runvoidas (e, func_togglevisiblewall_use);

e.SendEntity = base_entity_netsend;
e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() func_togglevisiblewall =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

func_togglevisiblewall_init (self);
};
#endif
// };

Return to the top of this page or return to the overview of this repo.

Log togglevisiblewall.qc

Date Commit Message Author + -
2025-03-30 Big commit. Entity networking, etc. cev +59 -8
2024-06-15 Major update, committing as-is, will have bugs cev +7 -1
2024-03-24 2nd pass refactor, rework QC class structure cev +53 -29
2024-01-31 Class based monster refactor & start projectiles cev +2 -2
2024-01-09 Continue OO / Class-based refactor cev +43 -40
2023-11-27 Code reorg, minor movement changes, misc cev +68  

Return to the top of this page or return to the overview of this repo.