djcev.com

//

Git Repos / fte_dogmode / qc / func / togglewall.qc

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

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

const float TOGGLEWALL_START_OFF = 1;

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

// func_togglewall
void() func_togglewall_touch;
void() func_togglewall_use;
void(entity e) func_togglewall_init;
void() func_togglewall;

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

/*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
// {
//--------------------------------------------------------------
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, 1, 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, 1, ATTN_NORM);
}
else
{
self.state = 0;
setorigin (self, self.origin + '8000 8000 8000');
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
};

//--------------------------------------------------------------
void(entity e) func_togglewall_init =
{
e.classname = "togglewall";
e.classtype = CT_FUNC_TOGGLEWALL;
base_func_init (e);

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);

e.solid = SOLID_BSP;
e.model = __NULL__;

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, 1, ATTN_NORM);
}
};

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

func_togglewall_init (self);
};
// };

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

Log togglewall.qc

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