Went over the codebase and optimised loading of the entity lump data. I now only run through the list of entries once and pass the unknown keys to the parent class to handle. Should speed up loading significantly.

This commit is contained in:
Marco Cawthorne 2020-09-09 01:56:46 +02:00
parent fd826a226d
commit 51cf0e9f15
75 changed files with 1734 additions and 1561 deletions

View file

@ -147,8 +147,6 @@ CBaseEntity::predraw(void)
RenderFXPass();
#endif
scale = m_flScale;
/* mouth flapping action */
bonecontrol5 = getchannellevel(this, CHAN_VOICE) * 20;
frame1time += clframetime;
@ -267,7 +265,7 @@ void CBaseEntity::ReadEntity(float flChanged)
setcustomskin(this, "", sprintf("geomset 1 %i\n", m_iBody));
}
if (flChanged & BASEFL_CHANGED_SCALE) {
m_flScale = readfloat();
scale = readfloat();
}
#ifdef GS_RENDERFX

View file

@ -24,16 +24,11 @@ class CBaseEntity
#endif
int m_iBody;
float m_flScale;
float m_flSentenceTime;
sound_t *m_pSentenceQue;
int m_iSentenceCount;
int m_iSentencePos;
string targetname;
string target;
float spawnflags;
void(void) CBaseEntity;
virtual void(void) Init;
virtual void(void) Initialized;

View file

@ -20,3 +20,8 @@ vector g_vecSunDir;
/* TODO: Find a better way to figure out what's a CBaseEntity at heart */
.float isCSQC;
/* things we don't have in CSQC normally and oughta be global */
.string target;
.string targetname;
.float spawnflags;

View file

@ -65,7 +65,7 @@ void env_particle::customphysics(void)
}
if (m_strTarget) {
m_eTarget = find(world, CBaseEntity::targetname, m_strTarget);
m_eTarget = find(world, ::targetname, m_strTarget);
makevectors(vectoangles(m_eTarget.origin - origin) * -1);
angles = v_forward;
}

View file

@ -110,7 +110,7 @@ float prop_rope::predraw(void)
float segments;
float sc;
entity x = find(world, CBaseEntity::targetname, target);
entity x = find(world, ::targetname, target);
if (checkpvs(getproperty(VF_ORIGIN), this) == FALSE) {
if (checkpvs(getproperty(VF_ORIGIN), x) == FALSE) {

View file

@ -60,6 +60,7 @@ class ambient_generic:CBaseTrigger
virtual void(entity, int) UseNormal;
virtual void(entity, int) UseLoop;
virtual float(entity, float) SendEntity;
virtual void(string, string) SpawnKey;
};
float
@ -140,37 +141,41 @@ ambient_generic::Respawn(void)
}
}
void
ambient_generic::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "message":
m_strSoundPath = strValue;
m_strActivePath = m_strSoundPath;
precache_sound(m_strSoundPath);
message = __NULL__;
break;
case "health":
m_flVolume = stof(strValue) * 0.1f;
health = __NULL__;
break;
case "volume":
m_flVolume = stof(strValue);
break;
case "pitch":
m_flPitch = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
break;
}
}
void
ambient_generic::ambient_generic(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "message":
m_strSoundPath = argv(i+1);
m_strActivePath = m_strSoundPath;
message = __NULL__;
break;
case "health":
m_flVolume = stof(argv(i+1)) * 0.1f;
health = __NULL__;
break;
case "volume":
m_flVolume = stof(argv(i+1));
break;
case "pitch":
m_flPitch = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
if (!m_strSoundPath) {
objerror("ambient_generic: No sound file specified!");
}
precache_sound(m_strSoundPath);
if (!m_flVolume) {
m_flVolume = 1.0f;
}
@ -189,5 +194,4 @@ ambient_generic::ambient_generic(void)
}
pvsflags = PVSF_USEPHS;
CBaseTrigger::CBaseTrigger();
}

View file

@ -91,10 +91,10 @@ CBaseEntity::SetBody(int newBody)
void
CBaseEntity::SetScale(float newScale)
{
if (newScale == m_flScale)
if (newScale == scale)
return;
m_flScale = newScale;
scale = newScale;
SendFlags |= BASEFL_CHANGED_SCALE;
}
void
@ -216,7 +216,7 @@ CBaseEntity::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, m_iBody);
}
if (fChanged & BASEFL_CHANGED_SCALE) {
WriteFloat(MSG_ENTITY, m_flScale);
WriteFloat(MSG_ENTITY, scale);
}
#ifdef GS_RENDERFX
@ -282,92 +282,10 @@ CBaseEntity::ParentUpdate(void)
}
void
CBaseEntity::CBaseEntity(void)
CBaseEntity::SpawnInit(void)
{
/* Not in Deathmatch */
if (spawnflags & 2048) {
if (cvar("sv_playerslots") > 1) {
remove(this);
return;
}
}
gflags = GF_CANRESPAWN;
effects |= EF_NOSHADOW;
int nfields = tokenize(__fullspawndata);
for (int i = 1; i < (nfields - 1); i += 2) {
switch (argv(i)) {
case "scale":
m_flScale = stof(argv(i+1));
break;
case "origin":
origin = stov(argv(i+1));
break;
case "angles":
angles = stov(argv(i+1));
break;
case "solid":
solid = stof(argv(i+1));
break;
case "health":
health = stof(argv(i+1));
break;
case "shadows":
if (stof(argv(i+1)) == 1) {
effects &= ~EF_NOSHADOW;
}
break;
case "targetname":
targetname = argv(i+1);
break;
case "target":
target = argv(i+1);
break;
case "color":
m_vecRenderColor = stov(argv(i+1));
break;
case "alpha":
m_flRenderAmt = stof(argv(i+1));
break;
case "renderamt":
m_flRenderAmt = stof(argv(i+1)) / 255;
break;
case "rendercolor":
m_vecRenderColor = stov(argv(i+1)) / 255;
break;
case "rendermode":
m_iRenderMode = stoi(argv(i+1));
break;
case "renderfx":
m_iRenderFX = stoi(argv(i+1));
break;
case "parentname":
m_parent = argv(i+1);
break;
case "model":
model = argv(i+1);
break;
default:
break;
}
}
m_oldAngle = angles;
m_oldOrigin = origin;
m_oldSolid = solid;
m_oldHealth = health;
m_oldModel = Util_FixModel(model);
m_oldiRenderFX = m_iRenderFX;
m_oldiRenderMode = m_iRenderMode;
m_oldvecRenderColor = m_vecRenderColor;
m_oldflRenderAmt = m_flRenderAmt;
m_oldvecRenderColor = m_vecRenderColor;
m_oldflRenderAmt = m_flRenderAmt;
m_oldstrTarget = target;
if (m_oldModel != "") {
precache_model(m_oldModel);
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
SpawnKey(argv(i), argv(i+1));
}
}
@ -397,3 +315,99 @@ CBaseEntity::Hide(void)
SetMovetype(MOVETYPE_NONE);
takedamage = DAMAGE_NO;
}
void
CBaseEntity::SpawnKey(string strKey, string strValue)
{
/* we do re-read a lot of the builtin fields in case we want to set
defaults. just in case anybody is wondering. */
switch (strKey) {
case "scale":
scale = stof(strValue);
break;
case "origin":
origin = stov(strValue);
break;
case "angles":
angles = stov(strValue);
break;
case "solid":
solid = stof(strValue);
break;
case "health":
health = stof(strValue);
break;
case "shadows":
if (stof(strValue) == 1) {
effects &= ~EF_NOSHADOW;
}
break;
case "targetname":
targetname = strValue;
break;
case "target":
target = strValue;
break;
case "color":
m_vecRenderColor = stov(strValue);
break;
case "alpha":
m_flRenderAmt = stof(strValue);
break;
case "renderamt":
m_flRenderAmt = stof(strValue) / 255;
break;
case "rendercolor":
m_vecRenderColor = stov(strValue) / 255;
break;
case "rendermode":
m_iRenderMode = stoi(strValue);
break;
case "renderfx":
m_iRenderFX = stoi(strValue);
break;
case "parentname":
m_parent = strValue;
break;
case "model":
model = strValue;
break;
default:
break;
}
}
void
CBaseEntity::CBaseEntity(void)
{
/* Not in Deathmatch */
if (spawnflags & 2048) {
if (cvar("sv_playerslots") > 1) {
remove(this);
return;
}
}
gflags = GF_CANRESPAWN;
effects |= EF_NOSHADOW;
scale = 1.0f;
SpawnInit();
m_oldAngle = angles;
m_oldOrigin = origin;
m_oldSolid = solid;
m_oldHealth = health;
m_oldModel = Util_FixModel(model);
m_oldiRenderFX = m_iRenderFX;
m_oldiRenderMode = m_iRenderMode;
m_oldvecRenderColor = m_vecRenderColor;
m_oldflRenderAmt = m_flRenderAmt;
m_oldvecRenderColor = m_vecRenderColor;
m_oldflRenderAmt = m_flRenderAmt;
m_oldstrTarget = target;
if (m_oldModel != "") {
precache_model(m_oldModel);
}
}

View file

@ -18,7 +18,6 @@ class CBaseEntity
{
string m_oldstrTarget; /* needed due to trigger_changetarget */
int m_iBody;
float m_flScale;
/* respawn */
string m_oldModel;
@ -66,6 +65,8 @@ class CBaseEntity
virtual void(vector) SetAngles;
virtual void(vector) SetOrigin;
virtual void(vector, vector) SetSize;
virtual void(string, string) SpawnKey;
virtual void(void) SpawnInit;
#ifdef GS_RENDERFX
virtual void(int) SetRenderFX;

View file

@ -34,6 +34,7 @@ class CBasePhysics:CBaseEntity
virtual void(void) touch;
virtual void(void) TouchThink;
virtual void(void) Pain;
virtual void(string, string) SpawnKey;
};
void
@ -120,32 +121,34 @@ CBasePhysics::Respawn(void)
effects &= ~EF_NOSHADOW;
}
void
CBasePhysics::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "physmodel":
m_iShape = stoi(strValue);
if (m_iShape > PHYSM_CYLINDER) {
m_iShape = 0;
}
break;
case "massscale":
m_flMass = stof(strValue);
break;
case "physdamagescale":
break;
case "material":
m_iMaterial = stof(strValue);
break;
default:
CBaseEntity::SpawnKey(strKey, strValue);
break;
}
}
void
CBasePhysics::CBasePhysics(void)
{
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
m_flMass = 1.0f;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "physmodel":
m_iShape = stoi(argv(i+1));
if (m_iShape > PHYSM_CYLINDER) {
m_iShape = 0;
}
break;
case "massscale":
m_flMass = stof(argv(i+1));
break;
case "physdamagescale":
break;
case "material":
m_iMaterial = stof(argv(i+1));
break;
default:
break;
}
}
}

View file

@ -47,6 +47,7 @@ class CBaseTrigger:CBaseEntity
virtual int(void) GetMaster;
virtual void(void) InitBrushTrigger;
virtual void(void) InitPointTrigger;
virtual void(string, string) SpawnKey;
};
void
@ -158,27 +159,30 @@ CBaseTrigger::InitBrushTrigger(void)
}
void
CBaseTrigger::CBaseTrigger(void)
CBaseTrigger::SpawnKey(string strKey, string strValue)
{
CBaseEntity::CBaseEntity();
m_strMessage = "";
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "killtarget":
m_strKillTarget = argv(i+1);
break;
case "message":
m_strMessage = argv(i+1);
break;
case "master":
m_strMaster = argv(i+1);
break;
case "team_no":
m_iTeam = stoi(argv(i+1));
break;
default:
break;
}
switch (strKey) {
case "killtarget":
m_strKillTarget = strValue;
break;
case "message":
m_strMessage = strValue;
break;
case "master":
m_strMaster = strValue;
break;
case "team_no":
m_iTeam = stoi(strValue);
break;
default:
CBaseEntity::SpawnKey(strKey, strValue);
break;
}
}
void
CBaseTrigger::CBaseTrigger(void)
{
m_strMessage = "";
CBaseEntity::CBaseEntity();
}

View file

@ -16,10 +16,6 @@
#include "baseentity.h"
.float delay;
.float wait;
.float wait;
void FX_Spark(vector, vector);
void FX_BreakModel(int, vector, vector, vector, float);

View file

@ -47,6 +47,7 @@ class env_beverage:CBaseTrigger
int m_iSkin;
void(void) env_beverage;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -67,22 +68,25 @@ env_beverage::Trigger(entity act, int unused)
m_iReady = FALSE;
}
void
env_beverage::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "health":
m_iUses = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_beverage::env_beverage(void)
{
precache_model("models/can.mdl");
precache_sound("weapons/g_bounce3.wav");
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < ( tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "health":
m_iUses = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
if (!m_iUses) {
m_iUses = 10;

View file

@ -40,23 +40,11 @@ class env_explosion:CBaseTrigger
void(void) env_explosion;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void env_explosion::env_explosion(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "iMagnitude":
m_iMagnitude = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}
void env_explosion::Trigger(entity act, int state)
void
env_explosion::Trigger(entity act, int state)
{
FX_Explosion(origin);
@ -69,3 +57,21 @@ void env_explosion::Trigger(entity act, int state)
remove(this);
}
}
void
env_explosion::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "iMagnitude":
m_iMagnitude = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_explosion::env_explosion(void)
{
CBaseTrigger::CBaseTrigger();
}

View file

@ -41,9 +41,11 @@ class env_fade:CBaseTrigger
void(void) env_fade;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void env_fade::Trigger(entity act, int state)
void
env_fade::Trigger(entity act, int state)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_FADE);
@ -55,27 +57,30 @@ void env_fade::Trigger(entity act, int state)
WriteFloat(MSG_MULTICAST, m_flFadeHold);
WriteByte(MSG_MULTICAST, spawnflags);
msg_entity = act;
if (spawnflags & EVF_ONLYUSER) {
if (spawnflags & EVF_ONLYUSER)
multicast([0,0,0], MULTICAST_ONE_R);
} else {
else
multicast([0,0,0], MULTICAST_ALL);
}
void
env_fade::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "duration":
m_flFadeDuration = stof(strValue);
break;
case "holdtime":
m_flFadeHold = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void env_fade::env_fade (void)
void
env_fade::env_fade(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "duration":
m_flFadeDuration = stof(argv(i+1));
break;
case "holdtime":
m_flFadeHold = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -51,6 +51,7 @@ class env_global:CBaseTrigger
virtual void(string, int) AddNewGlobal;
virtual void(string, int) SetGlobal;
virtual int(string) GetGlobal;
virtual void(string, string) SpawnKey;
};
void
@ -125,29 +126,33 @@ env_global::GetGlobal(string strName)
return 0;
}
void
env_global::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "globalstate":
m_strGlobalState = strValue;
break;
case "triggermode":
m_iTriggerMode = stoi(strValue);
break;
case "initialstate":
m_iInitialState = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_global::env_global(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "globalstate":
m_strGlobalState = argv(i+1);
break;
case "triggermode":
m_iTriggerMode = stoi(argv(i+1));
break;
case "initialstate":
m_iInitialState = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
if (!m_strGlobalState) {
objerror("env_global: No globalstate name given! Aborting\n");
}
if (spawnflags & GLOBAL_SETSPAWN) {
if (!GlobalPresent(m_strGlobalState)) {
AddNewGlobal(m_strGlobalState, m_iInitialState);

View file

@ -58,9 +58,11 @@ class env_laser:CBaseTrigger
virtual void(void) Respawn;
virtual void(void) ParentUpdate;
virtual float(entity, float) SendEntity;
virtual void(string, string) SpawnKey;
};
void env_laser::think(void)
void
env_laser::think(void)
{
entity t;
@ -85,7 +87,8 @@ void env_laser::think(void)
}
}
void env_laser::Trigger(entity act, int state)
void
env_laser::Trigger(entity act, int state)
{
switch (state) {
case TRIG_OFF:
@ -105,7 +108,8 @@ void env_laser::Trigger(entity act, int state)
}
}
void env_laser::Respawn(void)
void
env_laser::Respawn(void)
{
if (spawnflags & ENVLAZ_STARTON) {
m_iState = 1;
@ -113,7 +117,8 @@ void env_laser::Respawn(void)
}
}
float env_laser::SendEntity(entity ePEnt, float fChanged)
float
env_laser::SendEntity(entity ePEnt, float fChanged)
{
WriteByte(MSG_ENTITY, ENT_ENVLASER);
WriteFloat(MSG_ENTITY, fChanged);
@ -141,7 +146,8 @@ float env_laser::SendEntity(entity ePEnt, float fChanged)
return TRUE;
}
void env_laser::ParentUpdate(void)
void
env_laser::ParentUpdate(void)
{
/* FIXME: Check our fields for networking */
/*if (origin != oldnet_origin) {
@ -177,29 +183,32 @@ void env_laser::ParentUpdate(void)
}
}
void env_laser::env_laser(void)
void
env_laser::SpawnKey(string strKey, string strValue)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "texture":
m_strBeamTex = argv(i+1);
precache_model(m_strBeamTex);
break;
case "EndSprite":
m_strEndTex = argv(i+1);
precache_model(m_strEndTex);
break;
case "LaserTarget":
m_strLaserDest = argv(i+1);
break;
case "damage":
m_flDPS = stof(argv(i+1));
break;
default:
break;
}
switch (strKey) {
case "texture":
m_strBeamTex = strValue;
precache_model(m_strBeamTex);
break;
case "EndSprite":
m_strEndTex = strValue;
precache_model(m_strEndTex);
break;
case "LaserTarget":
m_strLaserDest = strValue;
break;
case "damage":
m_flDPS = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_laser::env_laser(void)
{
CBaseTrigger::CBaseTrigger();
gflags = GF_CANRESPAWN;
pvsflags = PVSF_IGNOREPVS;

View file

@ -43,9 +43,11 @@ class env_message:CBaseTrigger
virtual void(entity, int) Play;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void env_message::Play(entity act, int state)
void
env_message::Play(entity act, int state)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_MESSAGE);
@ -67,28 +69,32 @@ void env_message::Play(entity act, int state)
}
}
void env_message::Respawn(void)
void
env_message::Respawn(void)
{
Trigger = Play;
}
void
env_message::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "messagesound":
m_strSound = strValue;
break;
case "messagevolume":
m_flVolume = stof(strValue);
break;
case "messageattenuation":
m_iAttenuation = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void env_message::env_message(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "messagesound":
m_strSound = argv(i+1);
break;
case "messagevolume":
m_flVolume = stof(argv(i+1));
break;
case "messageattenuation":
m_iAttenuation = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -38,9 +38,11 @@ class env_shake:CBaseTrigger
void(void) env_shake;
virtual void(entity act, int) Trigger;
virtual void(string, string) SpawnKey;
};
void env_shake::Trigger(entity act, int state)
void
env_shake::Trigger(entity act, int state)
{
for (entity e = world; (e = find(e, ::classname, "player"));) {
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -54,25 +56,29 @@ void env_shake::Trigger(entity act, int state)
}
}
void env_shake::env_shake(void)
void
env_shake::SpawnKey(string strKey, string strValue)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "radius":
m_flRadius = stof(argv(i+1));
break;
case "amplitude":
m_flAmplitude = stof(argv(i+1));
break;
case "duration":
m_flDuration = stof(argv(i+1));
break;
case "frequency":
m_flFrequency = stof(argv(i+1));
break;
default:
break;
}
switch (strKey) {
case "radius":
m_flRadius = stof(strValue);
break;
case "amplitude":
m_flAmplitude = stof(strValue);
break;
case "duration":
m_flDuration = stof(strValue);
break;
case "frequency":
m_flFrequency = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_shake::env_shake(void)
{
CBaseTrigger::CBaseTrigger();
}

View file

@ -49,6 +49,7 @@ class env_shooter:CBaseTrigger
virtual void(void) Respawn;
virtual void(void) ShootGib;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -104,44 +105,50 @@ env_shooter::Respawn(void)
m_iGibsLeft = m_iGibs;
}
void
env_shooter::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "m_iGibs":
m_iGibs = stoi(strValue);
break;
case "delay":
case "m_flDelay":
m_flDelay = stof(strValue);
break;
case "m_flVelocity":
m_flVelocity = stof(strValue);
break;
case "m_flVariance":
m_flVariance = stof(strValue);
break;
case "m_flGibLife":
m_flGibLife = stof(strValue);
break;
case "shootmodel":
m_strShootModel = strValue;
precache_model(m_strShootModel);
break;
case "shootsounds":
m_flShootSounds = stof(strValue);
break;
case "scale":
m_flScale = stof(strValue);
break;
case "skin":
m_flSkin = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_shooter::env_shooter(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "m_iGibs":
m_iGibs = stoi(argv(i+1));
break;
case "delay":
case "m_flDelay":
m_flDelay = stof(argv(i+1));
break;
case "m_flVelocity":
m_flVelocity = stof(argv(i+1));
break;
case "m_flVariance":
m_flVariance = stof(argv(i+1));
break;
case "m_flGibLife":
m_flGibLife = stof(argv(i+1));
break;
case "shootmodel":
m_strShootModel = argv(i+1);
break;
case "shootsounds":
m_flShootSounds = stof(argv(i+1));
break;
case "scale":
m_flScale = stof(argv(i+1));
break;
case "skin":
m_flSkin = stof(argv(i+1));
break;
default:
break;
}
}
precache_model(m_strShootModel);
CBaseTrigger::CBaseTrigger();
if (!m_strShootModel) {
remove(this);
}
}

View file

@ -53,22 +53,26 @@ class env_spark:CBaseTrigger
virtual void(void) TimedSpark;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void env_spark::CreateSpark(void)
void
env_spark::CreateSpark(void)
{
int r = floor((random() * spark_snd.length));
sound(this, CHAN_AUTO, spark_snd[r], 1.0f, ATTN_IDLE);
FX_Spark(self.origin, self.angles);
}
void env_spark::TimedSpark(void)
void
env_spark::TimedSpark(void)
{
CreateSpark();
nextthink = time + (random() * m_flMaxDelay);
}
void env_spark::Trigger(entity act, int state)
void
env_spark::Trigger(entity act, int state)
{
if (spawnflags & EVSPARK_TOGGLE) {
switch (state) {
@ -92,7 +96,8 @@ void env_spark::Trigger(entity act, int state)
}
}
void env_spark::Respawn(void)
void
env_spark::Respawn(void)
{
if (m_flMaxDelay <= 0) {
m_flMaxDelay = 1.0f;
@ -103,20 +108,24 @@ void env_spark::Respawn(void)
}
}
void env_spark::env_spark(void)
void
env_spark::SpawnKey(string strKey, string strValue)
{
int i;
for (i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "MaxDelay":
m_flMaxDelay = stof(argv(i+1));
break;
default:
break;
}
switch (strKey) {
case "MaxDelay":
m_flMaxDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
for (i = 0; i < spark_snd.length; i++) {
}
void
env_spark::env_spark(void)
{
for (int i = 0; i < spark_snd.length; i++) {
precache_sound(spark_snd[i]);
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -46,9 +46,11 @@ class env_sprite:CBaseTrigger
void(void) env_sprite;
virtual void(entity, int) Trigger;
virtual float(entity, float) Network;
virtual void(string, string) SpawnKey;
};
float env_sprite::Network(entity pvsent, float flags)
float
env_sprite::Network(entity pvsent, float flags)
{
/* Delete it on the client. */
if (m_iToggled == FALSE) {
@ -71,7 +73,8 @@ float env_sprite::Network(entity pvsent, float flags)
return TRUE;
}
void env_sprite::NetworkOnce(void)
void
env_sprite::NetworkOnce(void)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_SPRITE);
@ -92,7 +95,8 @@ void env_sprite::NetworkOnce(void)
}
/* TODO: Implement state */
void env_sprite::Trigger(entity act, int state)
void
env_sprite::Trigger(entity act, int state)
{
if (spawnflags & ENVS_PLAYONCE) {
NetworkOnce();
@ -102,32 +106,28 @@ void env_sprite::Trigger(entity act, int state)
}
}
void env_sprite::env_sprite(void)
void
env_sprite::SpawnKey(string strKey, string strValue)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "framerate":
m_flFramerate = stof(argv(i+1));
break;
case "scale":
m_flScale = stof(argv(i+1));
break;
default:
break;
}
}
if (!m_flFramerate) {
m_flFramerate = 10;
}
if (!m_flScale) {
m_flScale = 1.0f;
switch (strKey) {
case "framerate":
m_flFramerate = stof(strValue);
break;
case "scale":
m_flScale = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
env_sprite::env_sprite(void)
{
m_flFramerate = 10;
m_flScale = 1.0f;
CBaseTrigger::CBaseTrigger();
precache_model(m_oldModel);
m_iToggled = ((spawnflags & ENVS_STARTON) > 0);
if (!(spawnflags & ENVS_PLAYONCE)) {

View file

@ -52,8 +52,7 @@ enumflags
{
SF_TRIGGER,
SF_TOUCH,
SF_PRESSURE,
SF_ISMODEL
SF_PRESSURE
};
enum
@ -120,6 +119,7 @@ class func_breakable:CBaseTrigger
/*virtual void(void) PressureDeath;*/
virtual void(void) Pain;
virtual void(void) Death;
virtual void(string, string) SpawnKey;
};
void
@ -277,15 +277,8 @@ func_breakable::PlayerTouch(void)
void
func_breakable::Respawn(void)
{
CBaseEntity::Respawn();
SetMovetype(MOVETYPE_NONE);
if (spawnflags & SF_ISMODEL) {
SetSolid(SOLID_BBOX);
} else {
SetSolid(SOLID_BSP);
}
SetSolid(SOLID_BSP);
SetModel(m_oldModel);
SetOrigin(m_oldOrigin);
@ -305,59 +298,41 @@ func_breakable::Respawn(void)
}
}
void
func_breakable::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "material":
m_iMaterial = stoi(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
case "explodemagnitude":
m_flExplodeMag = stof(strValue);
break;
case "spawnobject":
int oid = stoi(strValue);
if (oid >= funcbreakable_objtable.length) {
m_strBreakSpawn = "";
print(sprintf("^1func_breakable^7:" \
"spawnobject %i out of bounds! fix your mod!\n", oid));
} else {
m_strBreakSpawn = funcbreakable_objtable[oid];
}
break;
case "spawnonbreak":
m_strBreakSpawn = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
break;
}
}
void
func_breakable::func_breakable(void)
{
vector vvm_angles = [0,0,0];
precache_model(model);
CBaseEntity::CBaseEntity();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "vvm_angles":
vvm_angles = stov(argv(i+1));
break;
case "vvm_model":
// hack, gotta get the world pos */
solid = SOLID_BSP;
SetModel(model);
/* change the origin */
origin = absmin + (0.5 * (absmax - absmin));
m_oldOrigin = origin;
/* Now we can fake being a point entity. */
model = argv(i+1);
m_oldModel = model;
precache_model(model);
spawnflags |= SF_ISMODEL;
break;
case "material":
m_iMaterial = stoi(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "explodemagnitude":
m_flExplodeMag = stof(argv(i+1));
break;
case "spawnobject":
int oid = stoi(argv(i+1));
if (oid >= funcbreakable_objtable.length) {
print(sprintf("^1func_breakable^7: spawnobject %i out of bounds! fix your mod!\n", oid));
m_strBreakSpawn = "";
} else {
m_strBreakSpawn = funcbreakable_objtable[oid];
}
break;
case "spawnonbreak":
m_strBreakSpawn = argv(i+1);
break;
default:
break;
}
}
SetAngles(vvm_angles);
CBaseTrigger::CBaseTrigger();
}

View file

@ -124,8 +124,7 @@ class func_button:CBaseTrigger
int m_iSoundCompat;
string m_strSndPressed;
string m_strSndUnpressed;
virtual void(void) Precache;
virtual void(void) Respawn;
virtual void(void) Arrived;
virtual void(void) Returned;
@ -140,26 +139,11 @@ class func_button:CBaseTrigger
virtual void(void) SetMovementDirection;
virtual void(vector, void(void)) MoveToDestination;
virtual void(void) MoveToDestination_End;
virtual void(string, string) SpawnKey;
};
void func_button::Precache(void)
{
if (m_strSndPressed) {
if (m_iSoundCompat)
precache_sound(m_strSndPressed);
else
Sound_Precache(m_strSndPressed);
}
if (m_strSndUnpressed) {
if (m_iSoundCompat)
precache_sound(m_strSndUnpressed);
else
Sound_Precache(m_strSndUnpressed);
}
}
void func_button::Arrived(void)
void
func_button::Arrived(void)
{
m_iState = STATE_RAISED;
@ -179,7 +163,8 @@ void func_button::Arrived(void)
}
}
void func_button::Returned(void)
void
func_button::Returned(void)
{
if (spawnflags & SF_BTT_TOUCH_ONLY) {
touch = Touch;
@ -189,7 +174,8 @@ void func_button::Returned(void)
SetFrame(FRAME_OFF);
}
void func_button::MoveBack(void)
void
func_button::MoveBack(void)
{
touch = __NULL__;
m_iState = STATE_DOWN;
@ -209,7 +195,8 @@ void func_button::MoveBack(void)
}
}
void func_button::MoveAway(void)
void
func_button::MoveAway(void)
{
if (m_iState == STATE_UP) {
return;
@ -234,7 +221,8 @@ void func_button::MoveAway(void)
}
/* TODO: Handle state */
void func_button::Trigger(entity act, int state)
void
func_button::Trigger(entity act, int state)
{
if (m_flNextTrigger > time) {
return;
@ -265,7 +253,8 @@ void func_button::Trigger(entity act, int state)
}
}
void func_button::Touch(void)
void
func_button::Touch(void)
{
if (other.movetype == MOVETYPE_WALK) {
Trigger(other, TRIG_TOGGLE);
@ -276,18 +265,21 @@ void func_button::Touch(void)
}
}
void func_button::Use(void)
void
func_button::Use(void)
{
Trigger(eActivator, TRIG_TOGGLE);
}
void func_button::Death(void)
void
func_button::Death(void)
{
Trigger(g_dmg_eAttacker, TRIG_TOGGLE);
health = m_oldHealth;
}
void func_button::Blocked(void)
void
func_button::Blocked(void)
{
if (m_iDamage) {
//Damage_Apply(other, this, dmg, other.origin, FALSE);
@ -302,7 +294,8 @@ void func_button::Blocked(void)
}
}
void func_button::SetMovementDirection(void)
void
func_button::SetMovementDirection(void)
{
if (m_oldAngle == [0,-1,0]) {
m_vecMoveDir = [0,0,1];
@ -314,7 +307,8 @@ void func_button::SetMovementDirection(void)
}
}
void func_button::MoveToDestination_End(void)
void
func_button::MoveToDestination_End(void)
{
SetOrigin(m_vecDest);
velocity = [0,0,0];
@ -322,7 +316,8 @@ void func_button::MoveToDestination_End(void)
m_pMove();
}
void func_button::MoveToDestination(vector vecDest, void(void) func)
void
func_button::MoveToDestination(vector vecDest, void(void) func)
{
vector vecDifference;
float flTravel, fTravelTime;
@ -355,7 +350,8 @@ void func_button::MoveToDestination(vector vecDest, void(void) func)
velocity = (vecDifference * (1 / fTravelTime));
}
void func_button::Respawn(void)
void
func_button::Respawn(void)
{
SetMovementDirection();
@ -397,40 +393,56 @@ void func_button::Respawn(void)
SetAngles([0,0,0]);
}
void func_button::func_button(void)
void
func_button::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
case "lip":
m_flLip = stof(strValue);
break;
case "snd_pressed":
m_strSndPressed = strValue;
break;
case "snd_unpressed":
m_strSndUnpressed = strValue;
break;
case "wait":
m_flWait = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
/* compatibility */
case "sounds":
int sfx;
sfx = stoi(strValue);
m_strSndPressed = g_hlbutton_sfx[sfx];
m_iSoundCompat = TRUE;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_button::func_button(void)
{
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "lip":
m_flLip = stof(argv(i+1));
break;
case "snd_pressed":
m_strSndPressed = argv(i+1);
break;
case "snd_unpressed":
m_strSndUnpressed = argv(i+1);
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
/* compatibility */
case "sounds":
int sfx;
sfx = stoi(argv(i+1));
m_strSndPressed = g_hlbutton_sfx[sfx];
m_iSoundCompat = TRUE;
break;
default:
break;
}
if (m_strSndPressed) {
if (m_iSoundCompat)
precache_sound(m_strSndPressed);
else
Sound_Precache(m_strSndPressed);
}
if (m_strSndUnpressed) {
if (m_iSoundCompat)
precache_sound(m_strSndUnpressed);
else
Sound_Precache(m_strSndUnpressed);
}
Precache();
}

View file

@ -86,14 +86,12 @@ func_conveyor::Respawn(void)
SetSkin(0);
}
if (m_flSpeed == 0)
m_flSpeed = 100;
SetAngles([0,0,0]);
}
void
func_conveyor::func_conveyor(void)
{
m_flSpeed = 100;
CBaseTrigger::CBaseTrigger();
}

View file

@ -102,6 +102,7 @@ class func_door:CBaseTrigger
virtual void(void) Blocked;
virtual void(void) Touch;
virtual void(void) Use;
virtual void(string, string) SpawnKey;
virtual void(void) m_pMove = 0;
};
@ -355,6 +356,7 @@ func_door::Respawn(void)
nextthink = 0;
m_pMove = 0;
/* FIXME: Is this correct? */
if (m_flWait == -1) {
spawnflags |= SF_MOV_TOGGLE;
}
@ -395,56 +397,58 @@ func_door::Respawn(void)
}
void
func_door::func_door(void)
func_door::SpawnKey(string strKey, string strValue)
{
int x;
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "lip":
m_flLip = stof(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
case "netname":
targetClose = argv(i+1);
netname = __NULL__;
break;
case "dmg":
m_iDamage = stoi(argv(i+1));
break;
case "noise1":
m_strSndMove = argv(i+1);
break;
case "noise2":
m_strSndStop = argv(i+1);
break;
/* GoldSrc compat */
case "movesnd":
x = stoi(argv(i+1));
if (x >= 1 && x <= 10) {
m_strSndMove = sprintf("doors/doormove%i.wav", x);
}
break;
case "stopsnd":
x = stoi(argv(i+1));
if (x >= 1 && x <= 8) {
m_strSndStop = sprintf("doors/doorstop%i.wav", x);
}
break;
default:
break;
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
case "lip":
m_flLip = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
case "netname":
targetClose = strValue;
netname = __NULL__;
break;
case "dmg":
m_iDamage = stoi(strValue);
break;
case "noise1":
m_strSndMove = strValue;
break;
case "noise2":
m_strSndStop = strValue;
break;
/* GoldSrc compat */
case "movesnd":
x = stoi(strValue);
if (x >= 1 && x <= 10) {
m_strSndMove = sprintf("doors/doormove%i.wav", x);
}
break;
case "stopsnd":
x = stoi(strValue);
if (x >= 1 && x <= 8) {
m_strSndStop = sprintf("doors/doorstop%i.wav", x);
}
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_door::func_door(void)
{
CBaseTrigger::CBaseTrigger();
if (m_strSndMove)
precache_sound(m_strSndMove);

View file

@ -61,7 +61,6 @@ class func_door_rotating:CBaseTrigger
void(void) func_door_rotating;
virtual void(void) Respawn;
virtual void(void) Precache;
virtual void(void) Arrived;
virtual void(void) Returned;
virtual void(void) Back;
@ -73,6 +72,7 @@ class func_door_rotating:CBaseTrigger
virtual void(void) SetMovementDirection;
virtual void(vector angle, void(void) func) RotToDest;
virtual void(void) RotToDest_End;
virtual void(string, string) SpawnKey;
#ifdef GS_BULLET_PHYSICS
virtual void(void) Unhinge;
@ -90,25 +90,6 @@ void func_door_rotating::Unhinge(void)
}
#endif
void func_door_rotating::Precache(void)
{
if (spawnflags & SF_DOOR_SILENT) {
return;
}
if (m_iMoveSnd > 0 && m_iMoveSnd <= 10) {
precache_sound(sprintf("doors/doormove%i.wav", m_iMoveSnd));
} else {
precache_sound("common/null.wav");
}
if (m_iStopSnd > 0 && m_iStopSnd <= 8) {
precache_sound(sprintf("doors/doorstop%i.wav", m_iStopSnd));
} else {
precache_sound("common/null.wav");
}
}
void func_door_rotating::Arrived(void)
{
m_iState = STATE_RAISED;
@ -370,46 +351,61 @@ void func_door_rotating::Respawn(void)
SetAngles(m_vecPos1);
}
void
func_door_rotating::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
/*case "lip":
m_flLip = stof(strValue);
break;*/
case "movesnd":
m_iMoveSnd = stoi(strValue);
break;
case "stopsnd":
m_iStopSnd = stoi(strValue);
break;
case "distance":
m_flDistance = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
case "dmg":
m_iDamage = stoi(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
case "netname":
targetClose = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void func_door_rotating::func_door_rotating(void)
{
m_flSpeed = 100;
m_flDelay = 4;
m_flDistance = 90;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i+1));
break;
/*case "lip":
m_flLip = stof(argv(i+1));
break;*/
case "movesnd":
m_iMoveSnd = stoi(argv(i+1));
break;
case "stopsnd":
m_iStopSnd = stoi(argv(i+1));
break;
case "distance":
m_flDistance = stof(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "dmg":
m_iDamage = stoi(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
case "netname":
targetClose = argv(i+1);
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
func_door_rotating::Precache();
CBaseEntity::CBaseEntity();
if (spawnflags & SF_DOOR_SILENT)
return;
/* TODO: Add support for custom sounds */
if (m_iMoveSnd > 0 && m_iMoveSnd <= 10)
precache_sound(sprintf("doors/doormove%i.wav", m_iMoveSnd));
else
precache_sound("common/null.wav");
if (m_iStopSnd > 0 && m_iStopSnd <= 8)
precache_sound(sprintf("doors/doorstop%i.wav", m_iStopSnd));
else
precache_sound("common/null.wav");
}

View file

@ -39,9 +39,11 @@ class func_guntarget:CBaseTrigger
virtual void(void) Stop;
virtual void(entity act, int) Trigger;
virtual void(void) Death;
virtual void(string, string) SpawnKey;
};
void func_guntarget::Move(void)
void
func_guntarget::Move(void)
{
float flTravelTime;
vector vel_to_pos;
@ -72,7 +74,8 @@ void func_guntarget::Move(void)
nextthink = (ltime + flTravelTime);
}
void func_guntarget::NextPath(void)
void
func_guntarget::NextPath(void)
{
path_corner node;
@ -93,7 +96,8 @@ void func_guntarget::NextPath(void)
}
}
void func_guntarget::Death(void)
void
func_guntarget::Death(void)
{
entity a;
Stop();
@ -108,7 +112,8 @@ void func_guntarget::Death(void)
}
}
void func_guntarget::Stop(void)
void
func_guntarget::Stop(void)
{
takedamage = DAMAGE_NO;
velocity = [0,0,0];
@ -117,7 +122,8 @@ void func_guntarget::Stop(void)
}
/* TODO: Handle state? */
void func_guntarget::Trigger(entity act, int state)
void
func_guntarget::Trigger(entity act, int state)
{
flags = (1 << FL_FROZEN) | flags;
@ -132,7 +138,8 @@ void func_guntarget::Trigger(entity act, int state)
}
}
void func_guntarget::Respawn(void)
void
func_guntarget::Respawn(void)
{
static void ThinkWrap(void) {
Trigger(this, TRIG_TOGGLE);
@ -149,27 +156,26 @@ void func_guntarget::Respawn(void)
}
}
void
func_guntarget::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "health":
health = stof(strValue);
break;
case "speed":
m_flSpeed = stof(strValue);
break;
case "message":
m_strFire = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void func_guntarget::func_guntarget(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "health":
health = stof(argv(i+1));
break;
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "message":
m_strFire = argv(i+1);
break;
default:
break;
}
}
if (!m_flSpeed) {
m_flSpeed = 100;
}
m_flSpeed = 100;
CBaseTrigger::CBaseTrigger();
}

View file

@ -38,6 +38,7 @@ class func_healthcharger:CBaseTrigger
void(void) func_healthcharger;
virtual void(void) customphysics;
virtual void(void) PlayerUse;
virtual void(string, string) SpawnKey;
};
void func_healthcharger::PlayerUse(void)
@ -90,27 +91,31 @@ void func_healthcharger::customphysics(void)
}
}
void
func_healthcharger::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "snd_first":
m_strSndFirst = strValue;
break;
case "snd_charging":
m_strSndCharging = strValue;
break;
case "snd_done":
m_strSndDone = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void func_healthcharger::func_healthcharger(void)
{
m_strSndFirst = "items/medshot4.wav";
m_strSndCharging = "items/medcharge4.wav";
m_strSndDone = "items/medshotno1.wav";
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "snd_first":
m_strSndFirst = argv(i+1);
break;
case "snd_charging":
m_strSndCharging = argv(i+1);
break;
case "snd_done":
m_strSndDone = argv(i+1);
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
precache_sound(m_strSndFirst);
precache_sound(m_strSndCharging);

View file

@ -32,7 +32,6 @@ void func_illusionary::func_illusionary(void)
{
CBaseEntity::CBaseEntity();
precache_model(model);
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_NOT);
SetModel(model);

View file

@ -25,29 +25,32 @@ class func_lod:CBaseEntity
{
void(void) func_lod;
virtual float(entity, float) SendEntity;
virtual void(string, string) SpawnKey;
};
float func_lod::SendEntity (entity a, float b)
float
func_lod::SendEntity(entity a, float b)
{
return FALSE;
}
void func_lod::func_lod(void)
void
func_lod::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "Solid":
case "solid":
solid = stoi(strValue) == 1 ? SOLID_NOT : SOLID_BSP;
break;
default:
CBaseEntity::SpawnKey(strKey, strValue);
}
}
void
func_lod::func_lod(void)
{
CBaseEntity::CBaseEntity();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "Solid":
case "solid":
solid = stoi(argv(i+1)) == 1 ? SOLID_NOT : SOLID_BSP;
break;
default:
break;
}
}
precache_model(model);
SetMovetype(MOVETYPE_PUSH);
SetModel(model);
SetOrigin(origin);

View file

@ -58,6 +58,7 @@ class func_mortar_field:CBaseTrigger
virtual void(void) FireControlled;
virtual void(entity,int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -178,30 +179,32 @@ func_mortar_field::Respawn(void)
SetOrigin(m_oldOrigin);
}
void
func_mortar_field::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "m_iszXController":
m_strXController = strValue;
break;
case "m_iszYController":
m_strYController = strValue;
break;
case "m_flControl":
m_iType = stoi(strValue);
break;
case "m_flCount":
m_iCount = stoi(strValue);
break;
case "m_flSpread":
m_flSpread = stof(strValue) / 2;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_mortar_field::func_mortar_field(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "m_iszXController":
m_strXController = argv(i+1);
break;
case "m_iszYController":
m_strYController = argv(i+1);
break;
case "m_flControl":
m_iType = stoi(argv(i+1));
break;
case "m_flCount":
m_iCount = stoi(argv(i+1));
break;
case "m_flSpread":
m_flSpread = stof(argv(i+1)) / 2;
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -46,6 +46,7 @@ class func_pendulum:CBaseTrigger
virtual void(void) customphysics;
virtual void(void) Respawn;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -100,21 +101,23 @@ func_pendulum::Respawn(void)
SetOrigin(origin);
}
void
func_pendulum::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "damp":
m_flDampening = stof(strValue);
break;
case "distance":
m_flDistance = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_pendulum::func_pendulum(void)
{
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "damp":
m_flDampening = stof(argv(i+1));
break;
case "distance":
m_flDistance = stof(argv(i+1));
break;
default:
break;
}
}
}

View file

@ -33,6 +33,7 @@ class func_physbox:CBaseEntity
void(void) func_physbox;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(string, string) SpawnKey;
};
void func_physbox::touch(void)
@ -49,6 +50,18 @@ void func_physbox::Respawn(void)
physics_enable(this, TRUE);
}
void
func_physbox::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "material":
//m_iMaterial = stof(strValue);
break;
default:
CBaseEntity::SpawnKey(strKey, strValue);
}
}
void func_physbox::func_physbox(void)
{
if (!model) {
@ -57,17 +70,7 @@ void func_physbox::func_physbox(void)
}
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "material":
//m_iMaterial = stof(argv(i+1));
break;
default:
break;
}
}
}
CLASSEXPORT(func_physbox, func_physbox)

View file

@ -50,6 +50,7 @@ class func_plat:CBaseTrigger
virtual void(void) MoveToggle;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(string, string) SpawnKey;
};
void
@ -139,23 +140,24 @@ func_plat::Respawn(void)
nextthink = 0.0f;
}
void
func_plat::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "height":
m_flHeight = stof(strValue);
break;
case "speed":
m_flSpeed = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_plat::func_plat(void)
{
m_flSpeed = 100.0f;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "height":
m_flHeight = stof(argv(i+1));
break;
case "speed":
m_flSpeed = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -38,6 +38,7 @@ class func_recharge:CBaseTrigger
void(void) func_recharge;
virtual void(void) customphysics;
virtual void(void) PlayerUse;
virtual void(string, string) SpawnKey;
};
void func_recharge::PlayerUse(void)
@ -91,27 +92,31 @@ void func_recharge::customphysics(void)
}
}
void
func_recharge::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "snd_first":
m_strSndFirst = strValue;
break;
case "snd_charging":
m_strSndCharging = strValue;
break;
case "snd_done":
m_strSndDone = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void func_recharge::func_recharge(void)
{
m_strSndFirst = "items/suitchargeok1.wav";
m_strSndCharging = "items/suitcharge1.wav";
m_strSndDone = "items/suitchargeno1.wav";
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "snd_first":
m_strSndFirst = argv(i+1);
break;
case "snd_charging":
m_strSndCharging = argv(i+1);
break;
case "snd_done":
m_strSndDone = argv(i+1);
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
precache_sound(m_strSndFirst);
precache_sound(m_strSndCharging);

View file

@ -68,6 +68,7 @@ class func_rot_button:CBaseTrigger
virtual void(void) Respawn;
virtual void(void) Death;
virtual void(void) touch;
virtual void(string, string) SpawnKey;
};
void
@ -188,27 +189,29 @@ func_rot_button::Respawn(void)
m_vecMoveAngle = vecMoveDir * m_flDistance;
}
void
func_rot_button::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "distance":
m_flDistance = stof(strValue);
break;
case "speed":
m_flSpeed = stof(strValue);
break;
case "wait":
m_flReturnTime = stof(strValue);
break;
case "health":
m_iHealth = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_rot_button::func_rot_button(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "distance":
m_flDistance = stof(argv(i+1));
break;
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "wait":
m_flReturnTime = stof(argv(i+1));
break;
case "health":
m_iHealth = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -56,6 +56,7 @@ class func_rotating:CBaseTrigger
virtual void(void) Rotate;
virtual void(void) Blocked;
virtual void(void) SetMovementDirection;
virtual void(string, string) SpawnKey;
};
void
@ -141,30 +142,25 @@ func_rotating::SetMovementDirection(void)
}
}
void
func_rotating::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
case "dmg":
m_flDamage = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_rotating::func_rotating(void)
{
precache_model(model);
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
/*case "spawnorigin":
SetOrigin(stov(argv(i+1)));
break;*/
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "dmg":
m_flDamage = stof(argv(i+1));
break;
default:
break;
}
}
if (!m_flSpeed) {
m_flSpeed = 100;
}
m_flSpeed = 100;
CBaseTrigger::CBaseTrigger();
func_rotating::SetMovementDirection();
}

View file

@ -89,6 +89,7 @@ class func_tank:CBaseVehicle
virtual void(void) Respawn;
virtual void(vector) SpriteSmoke;
virtual void(vector) SpriteFlash;
virtual void(string, string) SpawnKey;
};
void
@ -191,71 +192,73 @@ func_tank::Respawn(void)
PlayerLeave(m_eDriver);
}
void
func_tank::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "yawrate":
m_flYawRate = stof(strValue);
break;
case "yawrange":
m_flYawRange = stof(strValue);
break;
case "pitchrate":
m_flPitchRate = stof(strValue);
break;
case "pitchrange":
m_flPitchRange = stof(strValue);
break;
case "barrel":
m_vecTipPos[0] = stof(strValue);
break;
case "barrely":
m_vecTipPos[1] = stof(strValue);
break;
case "barrelz":
m_vecTipPos[2] = stof(strValue);
break;
case "firerate":
m_flFireRate = 1.0f / stof(strValue);
break;
case "bullet_damage":
m_iDamage = stoi(strValue);
break;
case "firespread":
m_vecSpread = [0.25, 0.25, 0] * stof(strValue);
break;
case "persistance":
m_flPersistance = stof(strValue);
break;
case "minRange":
m_flMinRange = stof(strValue);
break;
case "maxRange":
m_flMaxRange = stof(strValue);
break;
case "spritesmoke":
m_strSpriteSmoke = strValue;
break;
case "spriteflash":
m_strSpriteFlash = strValue;
break;
case "spritescale":
m_flSpriteScale = stof(strValue);
break;
case "rotatesound":
m_strSndRotate = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_tank::func_tank(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "yawrate":
m_flYawRate = stof(argv(i+1));
break;
case "yawrange":
m_flYawRange = stof(argv(i+1));
break;
case "pitchrate":
m_flPitchRate = stof(argv(i+1));
break;
case "pitchrange":
m_flPitchRange = stof(argv(i+1));
break;
case "barrel":
m_vecTipPos[0] = stof(argv(i+1));
break;
case "barrely":
m_vecTipPos[1] = stof(argv(i+1));
break;
case "barrelz":
m_vecTipPos[2] = stof(argv(i+1));
break;
case "firerate":
m_flFireRate = 1.0f / stof(argv(i+1));
break;
case "bullet_damage":
m_iDamage = stoi(argv(i+1));
break;
case "firespread":
m_vecSpread = [0.25, 0.25, 0] * stof(argv(i+1));
break;
case "persistance":
m_flPersistance = stof(argv(i+1));
break;
case "minRange":
m_flMinRange = stof(argv(i+1));
break;
case "maxRange":
m_flMaxRange = stof(argv(i+1));
break;
case "spritesmoke":
m_strSpriteSmoke = argv(i+1);
break;
case "spriteflash":
m_strSpriteFlash = argv(i+1);
break;
case "spritescale":
m_flSpriteScale = stof(argv(i+1));
break;
case "rotatesound":
m_strSndRotate = argv(i+1);
break;
default:
break;
}
}
CBaseVehicle::CBaseVehicle();
if (m_strSpriteFlash)
precache_model(m_strSpriteFlash);
if (m_strSpriteSmoke)
precache_model(m_strSpriteSmoke);
CBaseVehicle::CBaseVehicle();
}

View file

@ -88,6 +88,7 @@ class func_tankmortar:CBaseVehicle
virtual void(void) Respawn;
virtual void(vector) SpriteSmoke;
virtual void(vector) SpriteFlash;
virtual void(string, string) SpawnKey;
};
void
@ -202,71 +203,73 @@ func_tankmortar::Respawn(void)
PlayerLeave(m_eDriver);
}
void
func_tankmortar::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "yawrate":
m_flYawRate = stof(strValue) * 0.01f;
break;
case "yawrange":
m_flYawRange = stof(strValue);
break;
case "pitchrate":
m_flPitchRate = stof(strValue) * 0.01f;
break;
case "pitchrange":
m_flPitchRange = stof(strValue);
break;
case "barrel":
m_vecTipPos[0] = stof(strValue);
break;
case "barrely":
m_vecTipPos[1] = stof(strValue);
break;
case "barrelz":
m_vecTipPos[2] = stof(strValue);
break;
case "firerate":
m_flFireRate = 1.0f / stof(strValue);
break;
case "iMagnitude":
m_iDamage = stoi(strValue);
break;
case "firespread":
m_vecSpread = [0.10, 0.10, 0] * stof(strValue);
break;
case "persistance":
m_flPersistance = stof(strValue);
break;
case "minRange":
m_flMinRange = stof(strValue);
break;
case "maxRange":
m_flMaxRange = stof(strValue);
break;
case "spritesmoke":
m_strSpriteSmoke = strValue;
break;
case "spriteflash":
m_strSpriteFlash = strValue;
break;
case "spritescale":
m_flSpriteScale = stof(strValue);
break;
case "rotatesound":
m_strSndRotate = strValue;
break;
default:
CBaseTrigger::SpawnKey(strValue, strKey);
}
}
void
func_tankmortar::func_tankmortar(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "yawrate":
m_flYawRate = stof(argv(i+1)) * 0.01f;
break;
case "yawrange":
m_flYawRange = stof(argv(i+1));
break;
case "pitchrate":
m_flPitchRate = stof(argv(i+1)) * 0.01f;
break;
case "pitchrange":
m_flPitchRange = stof(argv(i+1));
break;
case "barrel":
m_vecTipPos[0] = stof(argv(i+1));
break;
case "barrely":
m_vecTipPos[1] = stof(argv(i+1));
break;
case "barrelz":
m_vecTipPos[2] = stof(argv(i+1));
break;
case "firerate":
m_flFireRate = 1.0f / stof(argv(i+1));
break;
case "iMagnitude":
m_iDamage = stoi(argv(i+1));
break;
case "firespread":
m_vecSpread = [0.10, 0.10, 0] * stof(argv(i+1));
break;
case "persistance":
m_flPersistance = stof(argv(i+1));
break;
case "minRange":
m_flMinRange = stof(argv(i+1));
break;
case "maxRange":
m_flMaxRange = stof(argv(i+1));
break;
case "spritesmoke":
m_strSpriteSmoke = argv(i+1);
break;
case "spriteflash":
m_strSpriteFlash = argv(i+1);
break;
case "spritescale":
m_flSpriteScale = stof(argv(i+1));
break;
case "rotatesound":
m_strSndRotate = argv(i+1);
break;
default:
break;
}
}
CBaseVehicle::CBaseVehicle();
if (m_strSpriteFlash)
precache_model(m_strSpriteFlash);
if (m_strSpriteSmoke)
precache_model(m_strSpriteSmoke);
CBaseVehicle::CBaseVehicle();
}

View file

@ -55,6 +55,7 @@ class func_tracktrain:CBaseVehicle
virtual void(void) PlayerUse;
virtual void(void) Realign;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -292,21 +293,23 @@ func_tracktrain::Respawn(void)
m_flSpeed = m_flStartSpeed / m_flMaxSpeed;
}
void
func_tracktrain::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flMaxSpeed = stof(strValue);
break;
case "startspeed":
m_flStartSpeed = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_tracktrain::func_tracktrain(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flMaxSpeed = stof(argv(i+1));
break;
case "startspeed":
m_flStartSpeed = stof(argv(i+1));
break;
default:
break;
}
}
CBaseVehicle::CBaseVehicle();
}

View file

@ -86,6 +86,7 @@ class func_train:CBaseTrigger
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(void) Blocked;
virtual void(string, string) SpawnKey;
};
void
@ -217,46 +218,42 @@ func_train::Respawn(void)
}
void
func_train::func_train(void)
func_train::SpawnKey(string strKey, string strValue)
{
int a;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "target":
m_strOldTarget = argv(i+1);
break;
case "dmg":
m_flDamage = stof(argv(i+1));
break;
case "movesnd":
a = bound(0, stof(argv(i+1)), g_strTrainMoveSnd.length);
m_strMoveSnd = g_strTrainMoveSnd[a];
break;
case "stopsnd":
a = bound(0, stof(argv(i+1)), g_strTrainStopSnd.length);
m_strStopSnd = g_strTrainStopSnd[a];
break;
case "snd_move":
m_strMoveSnd = argv(i+1);
break;
case "snd_stop":
m_strStopSnd = argv(i+1);
break;
default:
break;
}
}
if (m_strMoveSnd) {
switch (strKey) {
case "target":
m_strOldTarget = strValue;
break;
case "dmg":
m_flDamage = stof(strValue);
break;
case "movesnd":
a = bound(0, stof(strValue), g_strTrainMoveSnd.length);
m_strMoveSnd = g_strTrainMoveSnd[a];
precache_sound(m_strMoveSnd);
}
if (m_strStopSnd) {
break;
case "stopsnd":
a = bound(0, stof(strValue), g_strTrainStopSnd.length);
m_strStopSnd = g_strTrainStopSnd[a];
precache_sound(m_strStopSnd);
break;
case "snd_move":
m_strMoveSnd = strValue;
break;
case "snd_stop":
m_strStopSnd = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
if (!m_flSpeed) {
m_flSpeed = 100;
}
void
func_train::func_train(void)
{
/* FIXME: This is all decided by the first path_corner pretty much */
m_flSpeed = 100;
CBaseTrigger::CBaseTrigger();
}

View file

@ -94,6 +94,7 @@ class func_vehicle:CBaseVehicle
virtual void(void) Respawn;
virtual void(void) Realign;
virtual void(void) PlayerUse;
virtual void(string, string) SpawnKey;
};
void
@ -496,6 +497,60 @@ func_vehicle::Respawn(void)
PlayerLeave(m_eDriver);
}
void
func_vehicle::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "acceleration":
// TODO
break;
case "speed":
m_flAcceleration = stof(strValue);
break;
case "height":
m_flHeight = stof(strValue);
break;
case "width":
m_flWidth = stof(strValue) / 2;
break;
case "length":
m_flLength = stof(strValue) / 2;
break;
case "bouncefactor":
m_flBounceFactor = stof(strValue);
break;
case "skidspeed":
m_flSkidSpeed = stof(strValue);
break;
case "traction":
m_flTraction = stof(strValue);
break;
case "breakfactor":
m_flBreakFactor = stof(strValue);
break;
case "steerfactor":
m_flSteerFactor = stof(strValue);
break;
case "straightenfactor":
m_flStraightenFactor = stof(strValue);
break;
case "gravitydir":
m_vecGravityDir = stov(strValue);
break;
case "sounds":
// TODO
break;
case "volume":
// TODO
break;
case "dmg":
// TODO
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
func_vehicle::func_vehicle(void)
{
@ -508,57 +563,7 @@ func_vehicle::func_vehicle(void)
m_flStraightenFactor = 1.0f;
m_vecGravityDir = [0,0,-1];
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "acceleration":
// TODO
break;
case "speed":
m_flAcceleration = stof(argv(i+1));
break;
case "height":
m_flHeight = stof(argv(i+1));
break;
case "width":
m_flWidth = stof(argv(i+1)) / 2;
break;
case "length":
m_flLength = stof(argv(i+1)) / 2;
break;
case "bouncefactor":
m_flBounceFactor = stof(argv(i+1));
break;
case "skidspeed":
m_flSkidSpeed = stof(argv(i+1));
break;
case "traction":
m_flTraction = stof(argv(i+1));
break;
case "breakfactor":
m_flBreakFactor = stof(argv(i+1));
break;
case "steerfactor":
m_flSteerFactor = stof(argv(i+1));
break;
case "straightenfactor":
m_flStraightenFactor = stof(argv(i+1));
break;
case "gravitydir":
m_vecGravityDir = stov(argv(i+1));
break;
case "sounds":
// TODO
break;
case "volume":
// TODO
break;
case "dmg":
// TODO
break;
default:
break;
}
}
CBaseVehicle::CBaseVehicle();
m_wlFL = spawn(func_vehicle_wheel);
m_wlFR = spawn(func_vehicle_wheel);
@ -572,6 +577,4 @@ func_vehicle::func_vehicle(void)
m_wlBL.mins[2] = m_flHeight * -1;
m_wlBR.mins[2] = m_flHeight * -1;
}
CBaseVehicle::CBaseVehicle();
}

View file

@ -50,6 +50,7 @@ class game_player_equip:CBaseTrigger
virtual void(string, vector) SpawnUnit;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -110,25 +111,26 @@ game_player_equip::Trigger(entity act, int state)
}
void
game_player_equip::game_player_equip(void)
game_player_equip::SpawnKey(string strKey, string strValue)
{
/* like multi_manager, we save non-field infos in the spawndata */
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "{":
case "}":
case "classname":
case "origin":
case "targetname":
case "spawnflags":
case "angle":
case "angles":
continue;
break;
default:
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, argv(i), argv(i+1));
}
switch (strKey) {
case "{":
case "}":
case "classname":
case "origin":
case "targetname":
case "spawnflags":
case "angle":
case "angles":
break;
default:
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, strKey, strValue);
}
}
void
game_player_equip::game_player_equip(void)
{
CBaseTrigger::CBaseTrigger();
}

View file

@ -62,6 +62,7 @@ class game_text:CBaseTrigger
void(void) game_text;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void game_text::Trigger(entity act, int state)
@ -93,43 +94,46 @@ void game_text::Trigger(entity act, int state)
}
}
void
game_text::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "x":
m_flPosX = stof(strValue);
break;
case "y":
m_flPosY = stof(strValue);
break;
case "effect":
m_iEffect = stoi(strValue);
break;
case "color":
m_vecColor1 = stov(strValue);
break;
case "color2":
m_vecColor2 = stov(strValue);
break;
case "fadein":
m_flFadeIn = stof(strValue);
break;
case "fadeout":
m_flFadeOut = stof(strValue);
break;
case "holdtime":
m_flHoldTime = stof(strValue);
break;
case "fxtime":
m_flFXTime = stof(strValue);
break;
case "channel":
m_iChannel = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void game_text::game_text(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "x":
m_flPosX = stof(argv(i+1));
break;
case "y":
m_flPosY = stof(argv(i+1));
break;
case "effect":
m_iEffect = stoi(argv(i+1));
break;
case "color":
m_vecColor1 = stov(argv(i+1));
break;
case "color2":
m_vecColor2 = stov(argv(i+1));
break;
case "fadein":
m_flFadeIn = stof(argv(i+1));
break;
case "fadeout":
m_flFadeOut = stof(argv(i+1));
break;
case "holdtime":
m_flHoldTime = stof(argv(i+1));
break;
case "fxtime":
m_flFXTime = stof(argv(i+1));
break;
case "channel":
m_iChannel = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -38,29 +38,6 @@ class gibshooter2:env_shooter
void gibshooter2::gibshooter2(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "m_iGibs":
m_iGibs = stoi(argv(i+1));
break;
case "delay":
case "m_flDelay":
m_flDelay = stof(argv(i+1));
break;
case "m_flVelocity":
m_flVelocity = stof(argv(i+1));
break;
case "m_flVariance":
m_flVariance = stof(argv(i+1));
break;
case "m_flGibLife":
m_flGibLife = stof(argv(i+1));
break;
default:
break;
}
}
m_strShootModel = "models/hgibs.mdl";
m_flShootSounds = 3;
m_flScale = 1.0;

View file

@ -39,6 +39,7 @@ class infodecal:CBaseTrigger
void(void) infodecal;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -75,6 +76,19 @@ infodecal::Respawn(void)
}
}
void
infodecal::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "material":
case "texture":
m_strTexture = strtolower(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
infodecal::infodecal(void)
{
@ -83,15 +97,5 @@ infodecal::infodecal(void)
return;
}
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "material":
case "texture":
m_strTexture = strtolower(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -62,6 +62,7 @@ class light:CBaseTrigger
void(void) light;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void light::Trigger(entity act, int state)
@ -95,25 +96,26 @@ void light::Respawn(void)
}
}
void
light::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "pattern":
m_strPattern = strValue;
break;
case "style":
m_flStyle = stof(strValue);
style = __NULL__;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void light::light(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "pattern":
m_strPattern = argv(i+1);
break;
case "style":
m_flStyle = stof(argv(i+1));
style = __NULL__;
break;
default:
break;
}
}
if (!m_strPattern) {
m_strPattern = "m";
}
CBaseTrigger::CBaseTrigger();
m_strPattern = "m";
}
CLASSEXPORT(light_spot, light)

View file

@ -28,6 +28,7 @@ class momentary_door:CBaseMomentary
virtual void(void) customphysics;
virtual void(void) Respawn;
virtual void(void) SetMovementDirection;
virtual void(string, string) SpawnKey;
};
void
@ -101,24 +102,26 @@ momentary_door::Respawn(void)
m_vecPos2 = (m_vecPos1 + m_vecMoveDir * (fabs(m_vecMoveDir * size) - m_flDistance));
}
void
momentary_door::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "lip":
m_flDistance = stof(strValue);
break;
case "speed":
m_flSpeed = stof(strValue);
break;
case "returnspeed":
m_flReturnspeed = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
momentary_door::momentary_door(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "lip":
m_flDistance = stof(argv(i+1));
break;
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "returnspeed":
m_flReturnspeed = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -39,6 +39,7 @@ class momentary_rot_button:CBaseMomentary
virtual void(void) customphysics;
virtual void(void) Respawn;
virtual void(void) SetMovementDirection;
virtual void(string, string) SpawnKey;
};
void
@ -119,24 +120,26 @@ momentary_rot_button::Respawn(void)
m_vecPos2 = m_oldAngle + m_vecMoveDir * m_flDistance;
}
void
momentary_rot_button::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "distance":
m_flDistance = stof(strValue);
break;
case "speed":
m_flSpeed = stof(strValue);
break;
case "returnspeed":
m_flReturnspeed = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
momentary_rot_button::momentary_rot_button(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "distance":
m_flDistance = stof(argv(i+1));
break;
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "returnspeed":
m_flReturnspeed = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -58,6 +58,7 @@ class monstermaker:CBaseTrigger
virtual void(void) Respawn;
virtual void(void) TurnOn;
virtual void(void) TurnOff;
virtual void(string, string) SpawnKey;
};
void
@ -191,33 +192,35 @@ monstermaker::Respawn(void)
m_iMonsterSpawned = 0;
}
void
monstermaker::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "monstertype":
m_strMonster = strValue;
break;
case "monstercount":
m_iTotalMonsters = stoi(strValue);
break;
case "child_alivemax":
case "m_imaxlivechildren":
m_iMaxChildren = stoi(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
case "child_name":
case "netname":
m_strChildName = strValue;
netname = __NULL__;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
monstermaker::monstermaker(void)
{
m_flDelay = 1.0f;
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "monstertype":
m_strMonster = argv(i+1);
break;
case "monstercount":
m_iTotalMonsters = stoi(argv(i+1));
break;
case "child_alivemax":
case "m_imaxlivechildren":
m_iMaxChildren = stoi(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "child_name":
case "netname":
m_strChildName = argv(i+1);
netname = __NULL__;
default:
break;
}
}
}

View file

@ -41,6 +41,7 @@ class multi_manager:CBaseTrigger
int m_iValue;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
@ -104,41 +105,53 @@ multi_manager::Respawn(void)
}
void
multi_manager::multi_manager(void)
multi_manager::SpawnKey(string strKey, string strValue)
{
m_strBuffer = "";
int iFields = tokenize(__fullspawndata);
for (int i = 1; i < (iFields - 1); i += 2) {
// Sigh, let's attempt to sanitize this
switch (argv(i)) {
case "{":
case "}":
case "classname":
case "origin":
case "targetname":
case "spawnflags":
case "angle":
case "angles":
continue;
break;
default:
if (substring(argv(i), strlen(argv(i)) - 3, 1) == "#") {
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, substring(argv(i), 0, strlen(argv(i)) - 3), argv(i+1));
} else if (substring(argv(i), strlen(argv(i)) - 2, 1) == "#") {
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, substring(argv(i), 0, strlen(argv(i)) - 2), argv(i+1));
} else {
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, argv(i), argv(i+1));
}
switch (strKey) {
case "{":
case "}":
case "classname":
case "origin":
case "targetname":
case "spawnflags":
case "angle":
case "angles":
break;
default:
if (substring(strKey, strlen(strKey) - 3, 1) == "#") {
m_strBuffer = sprintf("%s%s %s ",
m_strBuffer,
substring(strKey,
0, strlen(strKey) - 3),
strValue);
} else if (substring(strKey, strlen(strKey) - 2, 1) == "#") {
m_strBuffer = sprintf("%s%s %s ",
m_strBuffer,
substring(strKey,
0, strlen(strKey) - 2),
strValue);
} else {
m_strBuffer = sprintf("%s%s %s ", m_strBuffer, strKey, strValue);
}
}
}
void
multi_manager::multi_manager(void)
{
int iFields;
int b;
m_strBuffer = "";
CBaseTrigger::CBaseTrigger();
for (int b = 0; b < 16; b++) {
m_eTriggers[b] = spawn(multi_manager_sub);
}
/* set up our triggers */
b = 0;
iFields = tokenizebyseparator(m_strBuffer, " ");
int b = 0;
for (int i = 0; i < iFields; i+=2) {
if (b >= 16) {
break;
@ -151,6 +164,4 @@ multi_manager::multi_manager(void)
b++;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -55,6 +55,7 @@ class path_corner:CBaseTrigger
void(void) path_corner;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -85,30 +86,32 @@ path_corner::Respawn(void)
m_iFired = FALSE;
}
void
path_corner::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
case "yaw_speed":
m_flYawSpeed = stof(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
case "message":
m_strMessage = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
path_corner::path_corner(void)
{
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i+1));
break;
case "yaw_speed":
m_flYawSpeed = stof(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
case "message":
m_strMessage = argv(i+1);
break;
default:
break;
}
}
if (!m_flSpeed) {
m_flSpeed = 100;
}

View file

@ -38,6 +38,7 @@ class player_loadsaved:CBaseTrigger
void(void) player_loadsaved;
virtual void(entity, int) Trigger;
virtual void(void) ReloadSave;
virtual void(string, string) SpawnKey;
};
void
@ -66,27 +67,29 @@ player_loadsaved::Trigger(entity act, int unused)
nextthink = time + m_flLoadTime;
}
void
player_loadsaved::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "duration":
m_flFadeDuration = stof(strValue);
break;
case "holdtime":
m_flFadeHold = stof(strValue);
break;
case "message":
m_strMessage = strValue;
break;
case "loadtime":
m_flLoadTime = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
player_loadsaved::player_loadsaved(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "duration":
m_flFadeDuration = stof(argv(i+1));
break;
case "holdtime":
m_flFadeHold = stof(argv(i+1));
break;
case "message":
m_strMessage = argv(i+1);
break;
case "loadtime":
m_flLoadTime = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -50,6 +50,7 @@ class random_speaker:CBaseTrigger
virtual void(void) PlaySample;
virtual void(void) Enable;
virtual void(void) Disable;
virtual void(string, string) SpawnKey;
};
void
@ -122,27 +123,29 @@ random_speaker::Respawn(void)
Disable();
}
void
random_speaker::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "rsnoise":
m_strSample = strValue;
break;
case "volume":
m_flVolume = stof(strValue);
break;
case "wait":
m_flMinPos = stof(strValue);
break;
case "random":
m_flRandPercent = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
random_speaker::random_speaker(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "rsnoise":
m_strSample = argv(i+1);
break;
case "volume":
m_flVolume = stof(argv(i+1));
break;
case "wait":
m_flMinPos = stof(argv(i+1));
break;
case "random":
m_flRandPercent = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -41,6 +41,7 @@ class random_trigger:CBaseTrigger
virtual void(entity,int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -62,27 +63,29 @@ random_trigger::Respawn(void)
Trigger(this, TRIG_ON);
}
void
random_trigger::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "start_state":
m_iStartState = stoi(strValue);
break;
case "wait":
m_flMinTime = stof(strValue);
break;
case "random_min":
m_flRandMin = stof(strValue);
break;
case "random_max":
m_flRandMax = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
random_trigger::random_trigger(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "start_state":
m_iStartState = stoi(argv(i+1));
break;
case "wait":
m_flMinTime = stof(argv(i+1));
break;
case "random_min":
m_flRandMin = stof(argv(i+1));
break;
case "random_max":
m_flRandMax = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -39,6 +39,7 @@ class scripted_sentence:CBaseTrigger
void(void) scripted_sentence;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -63,32 +64,35 @@ scripted_sentence::Trigger(entity act, int unused)
npc.m_flNextSentence = time + m_flDuration;
}
void
scripted_sentence::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "entity":
m_strSpeaker = strValue;
break;
case "sentence":
m_strSentence = strValue;
break;
case "pitch":
m_flPitch = stof(strValue);
break;
case "duration":
m_flDuration = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
scripted_sentence::scripted_sentence(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "entity":
m_strSpeaker = argv(i+1);
break;
case "sentence":
m_strSentence = argv(i+1);
break;
case "pitch":
m_flPitch = stof(argv(i+1));
break;
case "duration":
m_flDuration = stof(argv(i+1));
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -95,6 +95,7 @@ class scripted_sequence:CBaseTrigger
virtual void(entity, int) Trigger;
virtual void(void) InitIdle;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -254,36 +255,39 @@ scripted_sequence::Respawn(void)
}
}
void
scripted_sequence::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "target":
target = strValue;
break;
case "m_iszEntity":
m_strMonster = strValue;
break;
case "m_iszPlay":
m_strActionAnim = strValue;
break;
case "m_iszIdle":
m_strIdleAnim = strValue;
break;
case "m_flRadius":
m_flSearchRadius = stof(strValue);
break;
case "m_flRepeat":
break;
case "m_fMoveTo":
m_iMove = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
scripted_sequence::scripted_sequence(void)
{
int nfields = tokenize(__fullspawndata);
for (int i = 1; i < (nfields-1); i += 2) {
switch (argv(i)) {
case "target":
target = argv(i+1);
break;
case "m_iszEntity":
m_strMonster = argv(i+1);
break;
case "m_iszPlay":
m_strActionAnim = argv(i+1);
break;
case "m_iszIdle":
m_strIdleAnim = argv(i+1);
break;
case "m_flRadius":
m_flSearchRadius = stof(argv(i+1));
break;
case "m_flRepeat":
break;
case "m_fMoveTo":
m_iMove = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
m_oldstrTarget = target;
}

View file

@ -69,6 +69,7 @@ class speaker:CBaseNPC
virtual void(void) Annouce;
virtual void(void) Respawn;
virtual void(void) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -111,27 +112,30 @@ speaker::Trigger(void)
nextthink = time;
}
void
speaker::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "preset":
int p = stoi(strValue);
/* fit in a valid preset string */
if (p > 0 && p < g_speaker_hlpresets.length)
m_strSentence = g_speaker_hlpresets[p-1];
break;
case "message":
m_strSentence = strValue;
break;
case "health":
m_flVolume = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
speaker::speaker(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "preset":
int p = stoi(argv(i+1));
/* fit in a valid preset string */
if (p > 0 && p < g_speaker_hlpresets.length)
m_strSentence = g_speaker_hlpresets[p-1];
break;
case "message":
m_strSentence = argv(i+1);
break;
case "health":
m_flVolume = stof(argv(i+1));
break;
default:
break;
}
}
CBaseNPC::CBaseNPC();
}

View file

@ -39,6 +39,7 @@ class targ_speaker:CBaseTrigger
void(void) targ_speaker;
virtual void(entity,int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -51,21 +52,23 @@ targ_speaker::Trigger(entity act, int state)
}
void
targ_speaker::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "tsnoise":
m_strSample = strValue;
break;
case "volume":
m_flVolume = stof(strValue);
break;
default:
break;
}
}
void
targ_speaker::targ_speaker(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "tsnoise":
m_strSample = argv(i+1);
break;
case "volume":
m_flVolume = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -34,6 +34,7 @@ class target_cdaudio:CBaseTrigger
void(void) target_cdaudio;
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -64,20 +65,23 @@ target_cdaudio::Respawn(void)
setsize(this, mins, maxs);
}
void
target_cdaudio::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "health":
m_iCDTrack = stoi(strValue);
break;
case "radius":
m_flRadius = stof(strValue) / 2;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
target_cdaudio::target_cdaudio(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "health":
m_iCDTrack = stoi(argv(i+1));
break;
case "radius":
m_flRadius = stof(argv(i+1)) / 2;
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -33,6 +33,7 @@ class trigger_auto:CBaseTrigger
void(void) trigger_auto;
virtual void(void) Processing;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -55,23 +56,26 @@ trigger_auto::Respawn(void)
nextthink = time + 0.2f;
}
void
trigger_auto::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
case "triggerstate":
m_iTriggerState = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_auto::trigger_auto(void)
{
m_iTriggerState = TRIG_TOGGLE;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "triggerstate":
m_iTriggerState = stoi(argv(i+1));
break;
default:
break;
}
}
think = Processing;
CBaseTrigger::CBaseTrigger();
m_iTriggerState = TRIG_TOGGLE;
think = Processing;
}

View file

@ -28,6 +28,7 @@ class trigger_autosave:CBaseTrigger
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -63,6 +64,19 @@ trigger_autosave::Respawn(void)
InitBrushTrigger();
}
void
trigger_autosave::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
break;
}
}
void
trigger_autosave::trigger_autosave(void)
{
@ -71,15 +85,5 @@ trigger_autosave::trigger_autosave(void)
return;
}
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
default:
break;
}
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
CBaseTrigger::CBaseTrigger();
}

View file

@ -31,6 +31,7 @@ class trigger_camera:CBaseTrigger
void(void) trigger_camera;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -56,23 +57,26 @@ trigger_camera::Trigger(entity act, int state)
origin, angles, m_flWait));
}
void
trigger_camera::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
case "moveto":
m_strMoveTo = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_camera::trigger_camera(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
case "moveto":
m_strMoveTo = argv(i+1);
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -29,6 +29,7 @@ class trigger_cdaudio:CBaseTrigger
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(string, string) SpawnKey;
};
void
@ -62,18 +63,21 @@ trigger_cdaudio::Respawn(void)
InitBrushTrigger();
}
void
trigger_cdaudio::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "health":
m_iCDTrack = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
break;
}
}
void
trigger_cdaudio::trigger_cdaudio(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "health":
m_iCDTrack = stoi(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
}

View file

@ -57,6 +57,7 @@ class trigger_changelevel:CBaseTrigger
virtual void(void) TouchTrigger;
virtual void(void) Respawn;
virtual int(entity, entity) IsInside;
virtual void(string, string) SpawnKey;
};
int
@ -135,26 +136,28 @@ trigger_changelevel::Respawn(void)
}
}
void
trigger_changelevel::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "map":
m_strMap = strValue;
break;
case "landmark":
m_strLandmark = strValue;
break;
case "changedelay":
m_flChangeDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_changelevel::trigger_changelevel(void)
{
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "map":
m_strMap = argv(i+1);
break;
case "landmark":
m_strLandmark = argv(i+1);
break;
case "changedelay":
m_flChangeDelay = stof(argv(i+1));
break;
default:
break;
}
}
}
vector

View file

@ -30,6 +30,7 @@ class trigger_changetarget:CBaseTrigger
void(void) trigger_changetarget;
virtual void(entity,int) Trigger;
virtual void(string, string) SpawnKey;
};
void
@ -49,18 +50,20 @@ trigger_changetarget::Trigger(entity act, int state)
}
}
void
trigger_changetarget::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "m_iszNewTarget":
m_strNewTarget = strValue;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_changetarget::trigger_changetarget(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "m_iszNewTarget":
m_strNewTarget = argv(i+1);
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -41,6 +41,7 @@ class trigger_counter:CBaseTrigger
virtual void(void) touch;
virtual void(entity,int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -88,21 +89,23 @@ trigger_counter::Respawn(void)
InitBrushTrigger();
}
void
trigger_counter::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "count":
m_iMaxCount = stoi(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_counter::trigger_counter(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "count":
m_iMaxCount = stoi(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -48,6 +48,7 @@ class trigger_hurt:CBaseTrigger
virtual void(entity, int) Trigger;
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -128,6 +129,24 @@ trigger_hurt::Respawn(void)
}
}
void
trigger_hurt::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "dmg":
m_iDamage = stoi(strValue);
break;
case "wait":
m_flNextDmg = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_hurt::trigger_hurt(void)
{
@ -135,20 +154,5 @@ trigger_hurt::trigger_hurt(void)
m_iDamage = 15;
m_flNextDmg = 0.5f;
CBaseEntity::CBaseEntity();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "dmg":
m_iDamage = stoi(argv(i+1));
break;
case "wait":
m_flNextDmg = stof(argv(i+1));
case "delay":
m_flDelay = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -45,6 +45,7 @@ class trigger_look:CBaseTrigger
virtual void(void) Touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -104,32 +105,35 @@ trigger_look::Respawn(void)
m_flLooked = 0.0f;
}
void
trigger_look::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "looktarget":
case "target_destination":
m_strLookTarget = strValue;
break;
case "fov":
case "FieldOfView":
m_flFOV = stof(strValue);
break;
case "looktime":
case "LookTime":
m_flLookTime = stof(strValue);
break;
case "delay":
m_flDelay = stof(strValue);
break;
default:
break;
}
}
void
trigger_look::trigger_look(void)
{
m_flLookTime = 0.5f;
m_flFOV = 0.9f;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "looktarget":
case "target_destination":
m_strLookTarget = argv(i+1);
break;
case "fov":
case "FieldOfView":
m_flFOV = stof(argv(i+1));
break;
case "looktime":
case "LookTime":
m_flLookTime = stof(argv(i+1));
break;
case "delay":
m_flDelay = stof(argv(i+1));
default:
break;
}
}
CBaseEntity::CBaseEntity();
}

View file

@ -41,6 +41,7 @@ class trigger_multiple:CBaseTrigger
void(void) trigger_multiple;
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -80,20 +81,22 @@ trigger_multiple::Respawn(void)
}
void
trigger_multiple::trigger_multiple(void)
trigger_multiple::SpawnKey(string strKey, string strValue)
{
CBaseEntity::CBaseEntity();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "wait":
m_flWait = stof(argv(i+1));
break;
default:
break;
}
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
case "wait":
m_flWait = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_multiple::trigger_multiple(void)
{
CBaseTrigger::CBaseTrigger();
}

View file

@ -39,6 +39,7 @@ class trigger_once:CBaseTrigger
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -70,18 +71,20 @@ trigger_once::Respawn(void)
InitBrushTrigger();
}
void
trigger_once::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_once::trigger_once(void)
{
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
}

View file

@ -42,6 +42,7 @@ class trigger_push:CBaseTrigger
virtual void(void) Respawn;
virtual void(entity, int) Trigger;
virtual void(void) SetMovementDirection;
virtual void(string, string) SpawnKey;
};
void
@ -106,6 +107,7 @@ trigger_push::touch(void)
void
trigger_push::Respawn(void)
{
InitBrushTrigger();
SetMovementDirection();
if (spawnflags & TP_STARTOFF) {
@ -113,20 +115,21 @@ trigger_push::Respawn(void)
}
}
void
trigger_push::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "speed":
m_flSpeed = stof(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_push::trigger_push(void)
{
m_flSpeed = 100;
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "speed":
m_flSpeed = stof(argv(i+1));
break;
default:
break;
}
}
CBaseTrigger::CBaseTrigger();
CBaseTrigger::InitBrushTrigger();
}

View file

@ -41,6 +41,7 @@ class trigger_relay:CBaseTrigger
void(void) trigger_relay;
virtual void(entity, int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
@ -64,21 +65,23 @@ trigger_relay::Respawn(void)
m_iEnabled = TRUE;
}
void
trigger_relay::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "delay":
m_flDelay = stof(strValue);
break;
case "triggerstate":
m_iTriggerState = stoi(strValue);
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}
}
void
trigger_relay::trigger_relay(void)
{
CBaseTrigger::CBaseTrigger();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
m_flDelay = stof(argv(i+1));
break;
case "triggerstate":
m_iTriggerState = stoi(argv(i+1));
break;
default:
break;
}
}
}

View file

@ -32,20 +32,22 @@ class func_friction:CBaseTrigger
void(void) func_friction;
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
#ifdef CLIENT
virtual void(void) Initialized;
virtual void(string, string) SpawnKey;
#endif
};
void func_friction::touch(void)
void
func_friction::touch(void)
{
other.friction = m_flFriction;
}
/* TODO: Make this redundant */
void func_friction::Respawn(void)
void
func_friction::Respawn(void)
{
solid = SOLID_BSPTRIGGER;
#ifdef GS_DEVELOPER
@ -53,38 +55,33 @@ void func_friction::Respawn(void)
#endif
}
void func_friction::func_friction(void)
void
func_friction::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "modifier":
m_flFriction = stof(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
void
func_friction::func_friction(void)
{
#ifdef SERVER
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "modifier":
m_flFriction = stof(argv(i+1));
break;
default:
break;
}
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
#endif
}
#ifdef CLIENT
void func_friction::Initialized (void)
void
func_friction::Initialized (void)
{
setmodel(this, model);
movetype = MOVETYPE_NONE;
solid = SOLID_BSPTRIGGER;
}
void func_friction::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "modifier":
m_flFriction = stof(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
#endif

View file

@ -31,10 +31,10 @@ class trigger_gravity:CBaseTrigger
void(void) trigger_gravity;
virtual void(void) touch;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
#ifdef CLIENT
virtual void(void) Initialized;
virtual void(string, string) SpawnKey;
#endif
};
@ -52,18 +52,20 @@ void trigger_gravity::Respawn(void)
#endif
}
void trigger_gravity::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "gravity":
m_flGravity = stof(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
void trigger_gravity::trigger_gravity(void)
{
#ifdef SERVER
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "gravity":
m_flGravity = stof(argv(i+1));
break;
default:
break;
}
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
#endif
@ -76,14 +78,4 @@ void trigger_gravity::Initialized (void)
movetype = MOVETYPE_NONE;
solid = SOLID_BSPTRIGGER;
}
void trigger_gravity::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "gravity":
m_flGravity = stof(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
#endif