Git Repos / fte_dogmode / qc / base_trigger.qc
Last update to this file was on 2025-03-30 at 19:29.
Show base_trigger.qc
//==============================================================================
// base_trigger.qc -- trigger base class
//==============================================================================
//======================================================================
// constants
//======================================================================
#if defined(CSQC) || defined(SSQC)
//----------------------------------------------------------------------
// base_trigger netflags -- CEV
// STATE needed for endwaiting & needs to be the same in child classes -- CEV
//----------------------------------------------------------------------
typedef enumflags
{
NETFLAG_BASE_TRIGGER_STATE,
NETFLAG_BASE_TRIGGER_ESTATE
} base_trigger_netflags;
#endif
//======================================================================
// forward declarations
//======================================================================
// base_trigger
#ifdef SSQC
void(entity e) sub_checkwaiting;
void() sub_endwaiting;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) base_trigger_point_init;
void(entity e) base_trigger_init;
#endif
#ifdef SSQC
strip void() base_trigger;
#endif
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
// class base_trigger: base_mapentity
// {
//==============================================================
// Subs
//==============================================================
#ifdef SSQC
//--------------------------------------------------------------
void(entity e) sub_checkwaiting =
{
if (e.is_waiting <= 0)
return;
if (known_release == KNOWN_RELEASE_MG1)
// MG1 compat -- CEV
return;
// store current use to swap later
e.olduse = e.use;
e.use = sub_endwaiting;
e.estate = STATE_INACTIVE;
dprint (sprintf("sub_checkwaiting: spawned a waiting "
"%s with targetname %s and target %s\n",
e.classname, e.targetname, e.target));
if (e.SendEntity)
e.SendFlags |= NETFLAG_BASE_TRIGGER_ESTATE;
};
//--------------------------------------------------------------
void() sub_endwaiting =
{
self.is_waiting = FALSE;
self.estate = STATE_ACTIVE;
if (self.use == sub_endwaiting)
self.use = self.olduse;
// special case for teleports, makes it ignore the
// fact that it has a targetname when touched
if (self.classtype == CT_TRIGGER_TELEPORT)
self.is_waiting = -1;
if (self.SendEntity)
self.SendFlags |= NETFLAG_BASE_TRIGGER_ESTATE;
};
#endif
//==============================================================
// Constructor & Spawn Functions
//==============================================================
#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
// InitPointTrigger -- Drake -- dumptruck_ds
// PM: The point trigger version of InitTrigger.
//--------------------------------------------------------------
void(entity e) base_trigger_point_init =
{
local vector v1, v2;
v1 = e.origin;
v2 = v1 + e.mangle;
e.model = "";
setorigin (e, '0 0 0');
// Calls 'setmodel', so do first.
base_trigger_init (e);
// Calling 'setmodel' resets entity size.
setsize (e, v1, v2);
};
//--------------------------------------------------------------
// InitTrigger
//--------------------------------------------------------------
void(entity e) base_trigger_init =
{
base_mapentity_init (e);
e.classgroup |= CG_TRIGGER;
e.solid = SOLID_TRIGGER;
#ifdef SSQC
// trigger angles are used for one-way touches. An angle of
// 0 is assumed to mean no restrictions, so use a yaw of 360
// instead.
if (e.angles != '0 0 0')
sub_setmovedir (e);
// set size and link into world
setmodel (e, e.model);
e.movetype = MOVETYPE_NONE;
e.modelindex = 0;
e.model = "";
#endif
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
strip void() base_trigger =
{
base_trigger_init (self);
};
// };
#endif
Return to the top of this page or return to the overview of this repo.
Log base_trigger.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2025-03-30 | Big commit. Entity networking, etc. | cev | +20 | -16 |
2024-11-20 | pmove refactor into prepoc macros, view bobbing | cev | +1 | |
2024-06-15 | Major update, committing as-is, will have bugs | cev | +38 | -2 |
2024-04-12 | Moveable gibs, heads, some bugfixes | cev | +1 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +62 | -82 |
2024-01-31 | Class based monster refactor & start projectiles | cev | +24 | -15 |
2024-01-09 | Continue OO / Class-based refactor | cev | +118 |
Return to the top of this page or return to the overview of this repo.