Git Repos / fte_dogmode / qc / func / togglewall.qc
Last update to this file was on 2024-07-03 at 07:20.
Show togglewall.qc
//==============================================================================
// func_togglewall -- Hipnotic Interactive, Jim Dose'
//==============================================================================
// Particle effects QuickC program
// By Jim Dose' 9/19/96
// Copyright (c)1996 Hipnotic Interactive, Inc.
// All rights reserved.
// Distributed (unsupported) on 3.12.97
//======================================================================
// constants
//======================================================================
#ifdef SSQC
const float TOGGLEWALL_START_OFF = 1;
#endif
#if defined(CSQC) || defined(SSQC)
enumflags
{
TOGGLEWALL_NET_MODEL, // wall model has changed
TOGGLEWALL_NET_ORIGIN, // wall origin has changed
TOGGLEWALL_NET_SIZE // wall size has changed
};
#endif
//======================================================================
// forward declarations
//======================================================================
// func_togglewall
#ifdef CSQC
void(float isnew) func_togglewall_netreceive;
#endif
#ifdef SSQC
float(entity to, float netflags) func_togglewall_netsend;
void() func_togglewall_touch;
void() func_togglewall_use;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) func_togglewall_init;
#endif
#ifdef SSQC
void() func_togglewall;
#endif
//------------------------------------------------------------------------------
/*QUAKED func_togglewall (0 .5 .8) ? TOGGLEWALL_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Creates a invisible wall that can be toggled on and off.
TOGGLEWALL_START_OFF wall doesn't block until triggered.
"noise" is the sound to play when wall is turned off.
"noise1" is the sound to play when wall is blocking.
"dmg" is the amount of damage to cause when touched.
*/
//----------------------------------------------------------------------
// class func_togglewall: base_func
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) func_togglewall_netreceive =
{
local float netflags = ReadFloat ();
if (netflags & TOGGLEWALL_NET_MODEL)
self.modelindex = ReadFloat ();
if (netflags & TOGGLEWALL_NET_ORIGIN)
{
self.origin_x = ReadCoord ();
self.origin_y = ReadCoord ();
self.origin_z = ReadCoord ();
}
if (netflags & TOGGLEWALL_NET_SIZE)
{
self.mins_x = ReadCoord ();
self.mins_y = ReadCoord ();
self.mins_z = ReadCoord ();
self.maxs_x = ReadCoord ();
self.maxs_y = ReadCoord ();
self.maxs_z = ReadCoord ();
}
if (isnew)
func_togglewall_init (self);
if (netflags & TOGGLEWALL_NET_MODEL)
setmodelindex (self, self.modelindex);
if (netflags & TOGGLEWALL_NET_SIZE)
setsize (self, self.mins, self.maxs);
if (netflags & TOGGLEWALL_NET_ORIGIN)
setorigin (self, self.origin);
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
float(entity to, float netflags) func_togglewall_netsend =
{
WriteShort (MSG_ENTITY, self.classtype);
WriteFloat (MSG_ENTITY, netflags);
if (netflags & TOGGLEWALL_NET_MODEL)
WriteFloat (MSG_ENTITY, self.modelindex);
if (netflags & TOGGLEWALL_NET_ORIGIN)
{
WriteCoord (MSG_ENTITY, self.origin_x);
WriteCoord (MSG_ENTITY, self.origin_y);
WriteCoord (MSG_ENTITY, self.origin_z);
}
if (netflags & TOGGLEWALL_NET_SIZE)
{
WriteCoord (MSG_ENTITY, self.mins_x);
WriteCoord (MSG_ENTITY, self.mins_y);
WriteCoord (MSG_ENTITY, self.mins_z);
WriteCoord (MSG_ENTITY, self.maxs_x);
WriteCoord (MSG_ENTITY, self.maxs_y);
WriteCoord (MSG_ENTITY, self.maxs_z);
}
return TRUE;
};
//--------------------------------------------------------------
void() func_togglewall_touch =
{
if (!self.dmg)
return;
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
t_damage2 (other, self, self, self.dmg);
sound (self, CHAN_VOICE, self.noise1, VOL_HIGH, ATTN_NORM);
};
//--------------------------------------------------------------
void() func_togglewall_use =
{
if (!self.state)
{
self.state = 1;
setorigin (self, self.origin - '8000 8000 8000');
// sound (self, CHAN_VOICE, self.noise1,
// VOL_HIGH, ATTN_NORM);
}
else
{
self.state = 0;
setorigin (self, self.origin + '8000 8000 8000');
sound (self, CHAN_VOICE, self.noise,
VOL_HIGH, ATTN_NORM);
}
self.SendFlags = TOGGLEWALL_NET_ORIGIN;
};
#endif
#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_togglewall_init =
{
e.classname = "togglewall";
e.classtype = CT_FUNC_TOGGLEWALL;
base_func_init (e);
#ifdef SSQC
e.movetype = MOVETYPE_PUSH;
e.mdl = e.model;
setmodel (e, e.model);
setsize (e, e.mins, e.maxs);
setorigin (e, e.origin);
e.touch = func_togglewall_touch;
e.use = func_togglewall_use;
if (!e.noise)
e.noise = "misc/null.wav";
if (!e.noise1)
e.noise1 = "misc/null.wav";
precache_sound (e.noise);
precache_sound (e.noise1);
#endif
e.solid = SOLID_BSP;
e.model = __NULL__;
#ifdef SSQC
if (e.spawnflags & TOGGLEWALL_START_OFF)
{
e.state = 0;
setorigin (e, e.origin + '8000 8000 8000');
}
else
{
e.state = 1;
sound (e, CHAN_VOICE, e.noise1, VOL_HIGH, ATTN_NORM);
}
e.SendEntity = func_togglewall_netsend;
e.SendFlags = TOGGLEWALL_NET_MODEL | TOGGLEWALL_NET_ORIGIN |
TOGGLEWALL_NET_SIZE;
#endif
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
void() func_togglewall =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
func_togglewall_init (self);
};
#endif
// };
Return to the top of this page or return to the overview of this repo.
Log togglewall.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-07-03 | pmove changes and fixes, improved climbing | cev | +1 | -1 |
2024-06-15 | Major update, committing as-is, will have bugs | cev | +112 | -4 |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +64 | -38 |
2024-02-18 | Client/player, projectiles, entrypoints refactor | cev | +1 | -1 |
2024-01-09 | Continue OO / Class-based refactor | cev | +64 | -62 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +6 | -3 |
2023-11-27 | Code reorg, minor movement changes, misc | cev | +91 |
Return to the top of this page or return to the overview of this repo.