Git Repos / fte_dogmode / qc / items / lights.qc
Last update to this file was on 2025-08-13 at 05:20.
Show lights.qc
//==============================================================================
// item_torch -- CEV
//==============================================================================
//======================================================================
// constants
//======================================================================
#ifdef SSQC
//----------------------------------------------------------------------
// item_torch spawnflags -- CEV
//----------------------------------------------------------------------
typedef enumflags
{
SPAWNFLAG_ITEM_TORCH_DYNAMIC = 1, // this needs dynamic light -- CEV
SPAWNFLAG_ITEM_TORCH_SILENT = 4, // silent torch -- dumptruck_ds
SPAWNFLAG_ITEM_TORCH_MG1_UPSIDE_DOWN = 4 // MG1 compat -- CEV
// 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
} item_torch_spawnflags;
#endif
#if defined(CSQC) || defined(SSQC)
const vector ITEM_TORCH_MINS = '-3.5 -3.5 -14';
const vector ITEM_TORCH_MAXS = '3.5 3.5 40';
#endif
//======================================================================
// forward declarations
//======================================================================
// item_torch
#ifdef CSQC
void(float isnew) item_torch_netreceive;
float() item_torch_predraw;
#endif
#ifdef SSQC
void(entity grabber, entity torch) item_torch_grab;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) item_torch_init;
#endif
#ifdef SSQC
void() item_torch;
#endif
//------------------------------------------------------------------------------
/*QUAKED item_torch (0 .5 0) (-10 -10 -20) (10 10 20) X 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
{ model ("progs/flame.mdl"); }
Short wall torch
See the "light" entity for a full description.
*/
//----------------------------------------------------------------------
// class item_torch: base_item
// {
#ifdef CSQC
void(float isnew) item_torch_netreceive =
{
// creates a number of variables, including netflags -- CEV
BASE_ITEM_NETRECEIVE (item_torch_init)
};
//--------------------------------------------------------------
float() item_torch_predraw =
{
#if 0
dynamiclight_add (self.origin, 200, '0.5 0.5 0.5', 6);
#endif
// update frame1time so the torch animates -- CEV
self.frame1time = time;
// interpolate origin -- see base_entities.qc -- CEV
BASE_ENTITY_LERP_ORIGIN (self,
self.origin_net, self.origin_prev, time,
self.origin_net_time, self.origin_prev_time)
if (self.effects & EF_REDTINT)
{
self.colormod = '1.0 0 0';
self.effects &= ~EF_REDTINT;
}
else if (self.colormod)
{
self.colormod = '0 0 0';
}
return PREDRAW_AUTOADD;
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
void(entity grabber, entity torch) item_torch_grab =
{
BASE_ITEM_INVENTORY_ADD (torch, grabber)
// don't re-grab / immediately throw the item -- CEV
if (grabber.button4)
grabber.flags |= FL_THROW_HELD;
// let the player know -- CEV
sprint (grabber, sprintf("%s grabbed a %s\n",
grabber.netname, torch.netname));
// let CSQC know -- CEV
if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
// torches don't respawn -- CEV
if (torch)
{
torch.model = __NULL__;
setmodel (torch, torch.model);
torch.solid = SOLID_NOT;
torch.think = sub_remove;
torch.nextthink = time + 0.2;
torch.SendFlags |= NETFLAG_BASE_ENTITY_MODEL |
NETFLAG_BASE_ENTITY_SOLID;
}
};
#endif
#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_torch_init =
{
e.classname = "item_torch";
e.classtype = CT_ITEM_TORCH;
base_mapentity_init (e);
e.classgroup |= CG_ITEM;
e.flags |= FL_FINDABLE_NONSOLID;
e.pos1 = ITEM_TORCH_MINS;
e.pos2 = ITEM_TORCH_MAXS;
#ifdef CSQC
setmodelindex (e, e.modelindex);
setsize (e, e.pos1, e.pos2);
setorigin (e, e.origin);
e.drawmask = DRAWMASK_NORMAL;
e.predraw = item_torch_predraw;
#endif
#ifdef SSQC
// TODO CEV was BASE_LIGHT_MG1_UPSIDEDOWN
if (known_release == KNOWN_RELEASE_MG1) {
if (e.spawnflags & SPAWNFLAG_ITEM_TORCH_MG1_UPSIDE_DOWN)
{
e.spawnflags &= ~SPAWNFLAG_BASE_LIGHT_MG1_UPSIDE_DOWN;
e.angles = '180 0 0';
} }
local item_info_t iit = item_info[ITEM_SEQ_TORCH];
precache_model (iit.world_model);
precache_sound (iit.pickup_sound.wav);
e.weapon = ITEM_SEQ_TORCH;
e.netname = iit.name;
e.solid = SOLID_TRIGGER;
setmodel (e, iit.world_model);
setsize (e, e.pos1, e.pos2);
setorigin (e, e.origin);
if (e.spawnflags & SPAWNFLAG_ITEM_THROWN)
{
e.movetype = MOVETYPE_TOSS;
e.tick = base_item_neteval;
e.classgroup |= CG_FRAMETICK;
e.think = base_item_think_throwgroundcheck;
e.nextthink = time + 0.1;
}
else
{
e.movetype = MOVETYPE_NONE;
}
// for silent torch -- dumptruck_ds
if (!(e.spawnflags && SPAWNFLAG_ITEM_TORCH_SILENT))
{
precache_sound (snd_amb_fire.wav);
AMBSOUND (e.origin, snd_amb_fire)
}
e.SendEntity = base_entity_netsend;
e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
void() item_torch =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
item_torch_init (self);
};
#endif
// };
Return to the top of this page or return to the overview of this repo.
Log lights.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2025-08-13 | Another big commit. Item changes, field rework, etc. | cev | +212 |
Return to the top of this page or return to the overview of this repo.