djcev.com

//

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

Last update to this file was on 2024-03-24 at 02:40.

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
//======================================================================

const float TOGGLEVISWALL_STARTOFF = 1;
const float TOGGLEVISWALL_NOTSOLID = 2;

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

// func_togglevisiblewall
void() func_togglevisiblewall_use;
void(entity e) func_togglevisiblewall_init;
void() func_togglevisiblewall;

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

//----------------------------------------------------------------------
// class func_togglevisiblewall: base_func
// {
//--------------------------------------------------------------
void() func_togglevisiblewall_use =
{
if (!self.state)
{
if (!(self.spawnflags & TOGGLEVISWALL_NOTSOLID))
{
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
}
setmodel (self, self.origmodel);
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;
}
};

//--------------------------------------------------------------
void(entity e) func_togglevisiblewall_init =
{
e.classname = "func_togglevisiblewall";
e.classtype = CT_FUNC_TOGGLEVISIBLEWALL;
base_func_init (e);

e.angles = '0 0 0';
e.use = func_togglevisiblewall_use;

e.origmodel = e.model;

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

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

sub_runvoidas (e, func_togglevisiblewall_use);
};

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

func_togglevisiblewall_init (self);
};
// };

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

Log togglevisiblewall.qc

Date Commit Message Author + -
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.