Gone over triggers to add some helpful prints.

This commit is contained in:
Marco Cawthorne 2020-03-23 17:25:03 +01:00
parent 41ce469bb3
commit 20c6a2d508
34 changed files with 278 additions and 81 deletions

View file

@ -32,7 +32,6 @@ Print_Draw(void)
g_printlines--;
g_printtime = time + 5;
}
for (int i = 0; i < 5; i++) {
drawstring(pos, g_printbuffer[i], [12,12], [1,1,1], 1.0f, 0);

View file

@ -1,3 +1,7 @@
#ifdef DEVELOPER
#define GS_DEVELOPER
#endif
#includelist
materials.h
client/baseentity.cpp

View file

@ -35,6 +35,7 @@ class CBaseEntity
{
string targetname;
string target;
float spawnflags;
void() CBaseEntity;
@ -112,6 +113,11 @@ void CBaseEntity::ReadEntity(float flChanged)
void CBaseEntity::SpawnKey(string strField, string strKey)
{
switch (strField) {
/* compiler specific stuff */
case "angle":
case "_minlight":
case "_cs":
break;
case "shadows":
if (stof(strKey) == 1) {
effects &= ~EF_NOSHADOW;
@ -148,8 +154,14 @@ void CBaseEntity::SpawnKey(string strField, string strKey)
case "scale":
scale = stof(strKey);
break;
case "spawnflags":
spawnflags = stof(strKey);
break;
default:
//dprint(sprintf("Unknown field %s, value %s\n", strField, strKey));
#ifdef GS_DEVELOPER
print( sprintf( "%s::SpawnKey: Unknown '%s' value '%s'\n",
this.classname, strField, strKey ) );
#endif
}
}
@ -157,7 +169,6 @@ void CBaseEntity::Init(void)
{
effects |= EF_NOSHADOW;
for (int i = 0; i < (tokenize(__fullspawndata) - 1); i += 2) {
//dprint(sprintf("SpawnData: %s %s\n", argv(i), argv(i+1)));
SpawnKey(argv(i), argv(i+1));
}
Initialized();

View file

@ -96,7 +96,7 @@ CMap_Shoot(void)
self.nextthink = time + 0.5f;
} else {
print("^2Cubemaps done...\n");
localcmd("mod_findcubemaps\nvid_reload\n");
localcmd("vid_reload\n");
g_iCubeProcess = FALSE;
remove(self);
}
@ -138,6 +138,7 @@ CMap_Build(void)
localcmd("r_showbboxes 0\n");
localcmd("r_wireframe 0\n");
localcmd("r_hdr_irisadaptation 0\n");
localcmd("r_postprocshader \"\"0\n");
print("^4Building cubemaps...\n");
g_eCubeCycle = spawn();
g_eCubeCycle.owner = find(world, classname, "env_cubemap");

View file

@ -133,11 +133,13 @@ void env_glow::env_glow(void)
void env_glow::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "material":
case "shader":
m_strSprite = strKey;
precache_pic(m_strSprite);
m_vecSize = drawgetimagesize(m_strSprite) / 2;
break;
case "sprite":
case "model":
m_strSprite = sprintf("%s_0.tga", strKey);
m_vecSize = drawgetimagesize(m_strSprite) / 2;

View file

@ -60,8 +60,6 @@ Client-side environmental reverb modifier.
This works only with the OpenAL sound backend.
*/
float g_flDSPCheck;
enum {
DSP_DEFAULT,
DSP_PADDEDCELL,
@ -376,9 +374,12 @@ void DSP_UpdateListener(void)
}
g_flDSPTime += clframetime;
#else
#ifdef DEVELOPER
print(sprintf("[DSP] Environment changed to %i.\n", g_iDSP));
#endif
#ifdef GS_DEVELOPER
print( sprintf( "DSP_UpdateListener: Changed style to %i\n",
g_iDSP ) );
#endif
old_dsp = g_iDSP;
setup_reverb(12, &reverbPresets[g_iDSP], sizeof(reverbinfo_t));
#endif

View file

@ -21,7 +21,6 @@
Client-side environmental soundscape modifier.
*/
float g_flSoundscapeCheck;
int Sound_Precache(string shader);
int g_scapes;
@ -70,7 +69,7 @@ void env_soundscape::env_soundscape(void)
void DSP_ResetSoundscape(void)
{
g_entSoundScape = world;
g_entSoundScape = __NULL__;
}
var int autocvar_dsp_soundscapes = TRUE;
@ -155,7 +154,7 @@ void DSP_UpdateSoundscape(void)
}
/* is no soundscape active? increase the default volume */
if (g_entSoundScape == world) {
if (g_entSoundScape == __NULL__) {
newvol = bound(0, g_ambientsound.m_flVolume + clframetime, 1.0);
} else{
newvol = bound(0, g_ambientsound.m_flVolume - clframetime, 1.0);

View file

@ -21,24 +21,65 @@ Dustmote emitting brush volume.
class func_dustmotes:CBaseEntity
{
int m_iCount;
int m_iPart;
float m_flNexTime;
void() func_dustmotes;
virtual void() Init;
virtual float() predraw;
virtual void(string, string) SpawnKey;
};
void func_dustmotes::customphysics(void)
float func_dustmotes::predraw(void)
{
if (m_flNexTime > cltime) {
return PREDRAW_NEXT;
}
if (checkpvs(getproperty(VF_ORIGIN), this) == FALSE) {
return PREDRAW_NEXT;
}
for ( int i = 0; i < m_iCount; i++) {
vector vPos;
vPos[0] = mins[0] + ( random() * ( maxs[0] - mins[0] ) );
vPos[1] = mins[1] + ( random() * ( maxs[1] - mins[1] ) );
vPos[2] = mins[2] + ( random() * ( maxs[2] - mins[2] ) );
pointparticles( PART_DUSTMOTE, vPos, [0,0,0], 1 );
}
m_flNexTime = cltime + 3.0f;
addentity(self);
return PREDRAW_NEXT;
}
void func_dustmotes::func_dustmotes(void)
{
drawmask = MASK_ENGINE;
solid = SOLID_NOT;
Init();
m_iCount = vlen(size) / 10;
}
void func_dustmotes::Init(void)
{
CBaseEntity::Init();
precache_model(model);
setmodel(this, model);
setorigin(this, origin);
movetype = MOVETYPE_NONE;
drawmask = MASK_ENGINE;
}
void func_dustmotes::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "count":
case "SpawnRate":
m_iCount = stoi(strKey);
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}

View file

@ -25,8 +25,8 @@ Used for zoo and test maps in which less interactive overlays are desired.
class point_message:CBaseEntity
{
float radius;
string message;
float m_flRadius;
string m_strMessage;
void() point_message;
virtual void(string, string) SpawnKey;
};
@ -35,10 +35,10 @@ void point_message::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "radius":
radius = stof(strKey);
m_flRadius = stof(strKey);
break;
case "message":
message = strKey;
m_strMessage = strKey;
break;
case "origin":
origin = stov( strKey );
@ -51,7 +51,58 @@ void point_message::SpawnKey(string strField, string strKey)
void point_message::point_message(void)
{
radius = 512;
message = "No message";
m_flRadius = 512;
m_strMessage = "No message";
Init();
}
int PointMessage_Visible( vector p1, vector p2, vector ang)
{
vector delta;
float fov;
makevectors( ang );
delta = normalize ( p1 - p2 );
fov = delta * v_forward;
if ( fov > 0.3 ) {
traceline( p2, p1, TRUE, self );
if ( trace_fraction == 1.0 ) {
return TRUE;
}
}
return FALSE;
}
void PointMessage_Draw(void)
{
string msg;
float distance;
vector vecPlayer;
#ifdef WASTES
vecPlayer = viewClient.vecPlayerOrigin;
vecPlayer += [ 0, 0, getstatf( ST_VIEWHEIGHT ) ];
#else
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
vecPlayer = pSeat->vPlayerOrigin;
#endif
#ifdef WASTES
for ( entity eFind = world; ( eFind = find( eFind, ::classname, "point_message" ) ); ) {
point_message m = (point_message)eFind;
msg = m.m_strMessage;
distance = vlen(m.origin - vecPlayer);
if (distance > m.m_flRadius) {
continue;
}
if ( PointMessage_Visible( m.origin, vecPlayer, getproperty( VF_ANGLES )) == TRUE ) {
vector vTemp = project( m.origin ) - [ ( stringwidth( msg, FALSE,[8,8] ) / 2 ), 0];
Gfx_String( vTemp, msg, [8,8], autocvar_hud_color, 1.0f, FNT_GAME);
}
}
#endif
}

View file

@ -14,6 +14,19 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED prop_rope (1 0 0) (-8 -8 -8) (8 8 8) ROPE_HALF
"sag" Multiplier on how much sagginess will be applied to the rope.
"segments" Number of total segments. Default is 16.
"material" The texture to use on the rope.
"swingfactor" Multiplier on how much the rope swings about.
Client-side decorative entity. Connect the entity to a named info_notnull
and watch it swing around.
Set spawnflag to 1 (ROPE_HALF) to cut it off half-way. Useful for vertically
swinging ropes.
*/
#define ROPE_RIBBON
void(float radius, vector texcoordbias) R_EndPolygonRibbon = #0;
@ -105,7 +118,10 @@ float prop_rope::predraw(void)
}
if (!x) {
print("prop_rope without target.\n");
#ifdef GS_DEVELOPER
print( sprintf( "%s::predraw: Unknown target '%s'\n",
this.classname, target ) );
#endif
remove(this);
return PREDRAW_NEXT;
}
@ -148,6 +164,12 @@ float prop_rope::predraw(void)
sc += (M_PI * (1 / segments));
}
/* only drawing one segment. */
if (spawnflags & 1) {
addentity(this);
return PREDRAW_NEXT;
}
sc = 0;
pos1 = x.origin;
for (float i = 0; i < segments / 2; i++) {

View file

@ -1,3 +1,7 @@
#ifdef DEVELOPER
#define GS_DEVELOPER
#endif
#includelist
materials.h
server/defs.h

View file

@ -90,15 +90,29 @@ float ambient_generic::SendEntity(entity ePEnt, float fChanged)
void ambient_generic::UseNormal(void)
{
sound(this, CHAN_VOICE, m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
#ifdef GS_DEVELOPER
print( sprintf( "%s::UseNormal: Play `%s`\n",
this.classname, m_strActivePath ) );
#endif
}
void ambient_generic::UseLoop(void)
{
if (m_iToggleSwitch == TRUE) {
#ifdef GS_DEVELOPER
print( sprintf( "%s::UseLoop: Stop `%s`\n",
this.classname, m_strActivePath ) );
#endif
m_strActivePath = "common/null.wav";
} else {
m_strActivePath = m_strSoundPath;
#ifdef GS_DEVELOPER
print( sprintf( "%s::UseLoop: Play `%s`\n",
this.classname, m_strActivePath ) );
#endif
}
m_iToggleSwitch = 1 - m_iToggleSwitch;
SendFlags |= AG_SAMPLE;
}

View file

@ -185,7 +185,6 @@ void CBaseEntity::ParentUpdate(void)
}
setorigin(this, p.origin);
nextthink = time;
}
}
@ -231,11 +230,17 @@ void CBaseEntity :: CBaseEntity ( void )
m_strTarget = argv( i + 1 );
target = __NULL__;
break;
case "color":
m_rendercolor = stov( argv( i + 1 ) );
break;
case "alpha":
m_renderamt = stof( argv( i + 1 ) ) / 255;
break;
case "renderamt":
m_renderamt = stof( argv( i + 1 ) );
m_renderamt = stof( argv( i + 1 ) ) / 255;
break;
case "rendercolor":
m_rendercolor = stov( argv( i + 1 ) );
m_rendercolor = stov( argv( i + 1 ) ) / 255;
break;
case "rendermode":
m_rendermode = stof( argv( i + 1 ) );
@ -275,7 +280,7 @@ void CBaseEntity::RendermodeUpdate(void)
return;
}
colormod = m_rendercolor / 255;
colormod = m_rendercolor;
alpha = bound(0.001, ( m_renderamt / 255 ), 1.0);
if ( m_rendermode == RM_ADDITIVE ) {

View file

@ -58,7 +58,7 @@ void CBasePhysics::touch(void)
{
#ifdef GS_BULLET_PHYSICS
makevectors(vectoangles(origin - other.origin));
physics_addforce(this, v_forward * 128, other.origin);
physics_addforce(this, v_forward, other.origin);
physics_enable(this, TRUE);
#endif
}
@ -66,7 +66,6 @@ void CBasePhysics::touch(void)
void CBasePhysics::vPain(entity eAttacker, int iType, int iDamage)
{
#ifdef GS_BULLET_PHYSICS
iDamage *= 5;
makevectors(vectoangles(origin - trace_endpos));
physics_addforce(this, v_forward * iDamage, trace_endpos);
health = 100000;
@ -78,10 +77,11 @@ void CBasePhysics::Respawn(void)
{
#ifdef GS_BULLET_PHYSICS
movetype = MOVETYPE_PHYSICS;
solid = SOLID_PHYSICS_BOX + m_iShape; // SOLID_PHYSICS_TRIMESH
solid = SOLID_PHYSICS_BOX + m_iShape;
geomtype = GEOMTYPE_BOX;
setmodel(this, m_oldModel);
setorigin(this, m_oldOrigin);
physics_enable(this, FALSE);
physics_enable(this, TRUE);
takedamage = DAMAGE_YES;
health = 100000;
mass = m_flMass;

View file

@ -33,7 +33,7 @@ class CBaseTrigger : CBaseEntity
virtual void() UseTargets;
virtual int() GetValue;
virtual int() GetMaster;
virtual void( float del ) UseTargets_Delay;
virtual void( float ) UseTargets_Delay;
virtual void() InitBrushTrigger;
virtual void() InitPointTrigger;
};
@ -43,10 +43,12 @@ void CBaseTrigger :: UseTargets ( void )
for ( entity eFind = world; ( eFind = find( eFind, CBaseTrigger::m_strTargetName, m_strTarget ) ); ) {
CBaseTrigger trigger = (CBaseTrigger) eFind;
#ifdef GS_DEVELOPER
print( sprintf( "%s: Triggering %s `%s`\n",
this.classname, eFind.classname, trigger.m_strTargetName ) );
print( sprintf( "^2%s::^3UseTargets^7: Triggering %s `%s`\n",
this.classname, eFind.classname, trigger.m_strTargetName ) );
#endif
trigger.Trigger();
if (trigger.Trigger != __NULL__) {
trigger.Trigger();
}
}
if (m_strMessage && eActivator.flags & FL_CLIENT) {
@ -94,7 +96,8 @@ void CBaseTrigger :: UseTargets_Delay ( float fDelay )
}
#ifdef GS_DEVELOPER
print( sprintf( "CBaseTrigger: Delaying trigger of `%s`\n", m_strTarget ) );
print( sprintf( "^2%s::^3UseTargets_Delay^7: Triggering `%s`\n",
this.classname, m_strTarget ) );
#endif
CBaseTrigger eTimer = spawn( CBaseTrigger );

View file

@ -14,13 +14,13 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef DEVELOPER
#define GS_DEVELOPER
#ifdef WASTES
#define GS_BULLET_PHYSICS
#endif
#ifdef WASTES
//#define GS_BULLET_PHYSICS
#endif
.float delay;
.float wait;
.float wait;
void Effect_CreateSpark(vector, vector);
void Effect_BreakModel(int, vector, vector, vector, float);

View file

@ -119,7 +119,7 @@ void func_breakable::Explode(void)
vWorldPos[0] = absmin[0] + ( 0.5 * ( absmax[0] - absmin[0] ) );
vWorldPos[1] = absmin[1] + ( 0.5 * ( absmax[1] - absmin[1] ) );
vWorldPos[2] = absmin[2] + ( 0.5 * ( absmax[2] - absmin[2] ) );
Effect_BreakModel(20, absmin, absmax, '0 0 0', m_iMaterial);
Effect_BreakModel(vlen(size) / 10, absmin, absmax, '0 0 0', m_iMaterial);
Effect_CreateExplosion(vWorldPos);
Damage_Radius(vWorldPos, this, m_flExplodeMag, m_flExplodeMag * 2.5f, TRUE, 0);
CBaseTrigger::UseTargets();
@ -132,7 +132,6 @@ void func_breakable::vDeath (entity attacker, int type, int damage)
return;
}
health = 0;
eActivator = attacker;
/* This may seem totally absurd. That's because it is. It's very
@ -145,7 +144,7 @@ void func_breakable::vDeath (entity attacker, int type, int damage)
think = Explode;
nextthink = time + random(0.0,0.5);
} else {
Effect_BreakModel(20, absmin, absmax, '0 0 0', m_iMaterial);
Effect_BreakModel(vlen(size) / 10, absmin, absmax, '0 0 0', m_iMaterial);
CBaseTrigger::UseTargets();
CBaseEntity::Hide();
}

View file

@ -231,14 +231,8 @@ void func_button::Trigger(void)
func_button::MoveAway();
if (m_flDelay) {
#ifdef GS_DEVELOPER
dprint(sprintf("func_button: Delayed trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets_Delay(m_flDelay);
} else {
#ifdef GS_DEVELOPER
print(sprintf("func_button: Normal trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets();
}
}

View file

@ -191,14 +191,8 @@ void func_door::Trigger(void)
// Only trigger stuff when we are done moving
if ((m_iState == DOORSTATE_RAISED) || (m_iState == DOORSTATE_LOWERED)) {
if (m_flDelay > 0) {
#ifdef GS_DEVELOPER
print(sprintf("func_door: Delayed trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets_Delay(m_flDelay);
} else {
#ifdef GS_DEVELOPER
dprint(sprintf("func_door: Normal trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets();
}
}

View file

@ -215,14 +215,8 @@ void func_door_rotating::Trigger(void)
Away();
if (m_flDelay) {
#ifdef GS_DEVELOPER
print(sprintf("func_door_rotating: Delayed trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets_Delay(m_flDelay);
} else {
#ifdef GS_DEVELOPER
print(sprintf("func_door_rotating: Normal trigger of `%s`\n", m_strTarget));
#endif
CBaseTrigger::UseTargets();
}
}

View file

@ -24,6 +24,11 @@ void func_physbox::Respawn(void)
void func_physbox::func_physbox(void)
{
if (!model) {
remove(this);
return;
}
CBaseEntity::CBaseEntity();
precache_model(m_oldModel);

View file

@ -43,7 +43,7 @@ class func_recharge:CBaseTrigger
void func_recharge::PlayerUse(void)
{
eActivator.gflags |= GF_USE_RELEASED;
/* First come first serve */
if (m_eUser && eActivator != m_eUser) {
return;
@ -53,7 +53,7 @@ void func_recharge::PlayerUse(void)
if (m_eUser == world) {
sound(this, CHAN_VOICE, m_strSndFirst, 1.0, ATTN_NORM);
}
if (m_flDelay > time) {
return;
}
@ -78,6 +78,7 @@ void func_recharge::customphysics(void)
if (m_flCheck > time) {
return;
}
if (m_eUser) {
sound(this, CHAN_ITEM, "common/null.wav", 1.0, ATTN_NORM);
m_eUser = world;

View file

@ -24,7 +24,7 @@
Rotating brush object. Useful for fans, etc.
*/
#ifdef DEVELOPER
#ifdef GS_DEVELOPER
var int autocvar_dev_rotspeed = 0;
#endif
@ -94,7 +94,7 @@ void func_rotating :: Blocked ( void )
void func_rotating :: Respawn ( void )
{
#ifdef DEVELOPER
#ifdef GS_DEVELOPER
if (autocvar_dev_rotspeed != 0) {
m_flSpeed = autocvar_dev_rotspeed;
}

View file

@ -44,7 +44,7 @@ void func_tracktrain::GoToTarget(void)
f = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
if (!f) {
print("^1func_tracktrain^7: Trigger-Target not found! Removing.\n");
print("func_tracktrain::GoToTarget: Trigger-Target not found! Removing.\n");
return;
}
@ -53,7 +53,6 @@ void func_tracktrain::GoToTarget(void)
if (!flTravelTime) {
NextPath();
print(sprintf("TRAIN %s SPEED: %f\n", m_strTargetName, flTravelTime));
return;
}
@ -66,7 +65,7 @@ void func_tracktrain::NextPath(void)
{
CBaseTrigger current_target;
print(sprintf("^2func_tracktrain^7: Talking to current target %s... ", m_strTarget));
print(sprintf("func_tracktrain::NextPath: Talking to current target %s... ", m_strTarget));
current_target = (CBaseTrigger)find(world, CBaseTrigger::m_strTargetName, m_strTarget);
if (!current_target) {
@ -91,12 +90,12 @@ void func_tracktrain::Find(void)
entity f = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
if (!f) {
print(sprintf("^1func_tracktrain^7: End-Target %s not found! Removing.\n",m_strTarget));
print(sprintf("func_tracktrain::Find: End-Target %s not found! Removing.\n",m_strTarget));
remove(this);
return;
}
print("^2func_tracktrain^7: Successfully found first target.\n");
print("func_tracktrain::Find: Successfully found first target.\n");
setorigin(this, f.origin);
}

View file

@ -162,7 +162,7 @@ func_train::NextPath(void)
}
/* make the loopy noise stop */
if (m_strMoveSnd) {
sound(this, CHAN_VOICE, "common/null.wav", 0.0, ATTN_NORM);
sound(this, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM);
}
setorigin(this, eNode.origin - (mins + maxs) * 0.5);

View file

@ -62,7 +62,8 @@ void multi_manager :: Trigger (void)
entity eFind = find(world, CBaseTrigger::m_strTargetName, wow.m_strTarget);
#ifdef GS_DEVELOPER
print(sprintf("multi_manager: %s (%s)\n", wow.m_strTarget, eFind.classname));
print( sprintf( "%s::Trigger: %s (%s)\n",
this.classname, wow.m_strTarget, eFind.classname ) );
#endif
CBaseTrigger::UseTargets();

View file

@ -42,6 +42,10 @@ void trigger_auto::think(void)
CBaseTrigger::UseTargets_Delay(m_flDelay);
if (spawnflags & 1) {
#ifdef GS_DEVELOPER
print( sprintf( "%s::think: Removed self after trigger\n",
this.classname ) );
#endif
remove(this);
}
}

View file

@ -43,6 +43,11 @@ void trigger_autosave::touch(void)
msg_entity = this;
multicast(origin, MULTICAST_ALL);
#ifdef GS_DEVELOPER
print( sprintf( "%s::touch: Called autosave\n",
this.classname) );
#endif
localcmd("save autosave");
Hide();
@ -72,6 +77,7 @@ void trigger_autosave::trigger_autosave(void)
remove(this);
return;
}
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":

View file

@ -40,7 +40,13 @@ void trigger_camera::Trigger(void)
angles[0] *= -1;
}
}
Client_TriggerCamera(eActivator, origin, angles, m_flWait);
#ifdef GS_DEVELOPER
print( sprintf( "%s::Trigger: Camera at %v, %v, for %f sec/s requested\n",
this.classname, origin, angles, m_flWait ) );
#endif
}
void trigger_camera::trigger_camera(void)

View file

@ -30,7 +30,10 @@ class trigger_cdaudio : CBaseTrigger
void trigger_cdaudio :: Trigger ( void )
{
//dprint( sprintf( "trigger_cdaudio: Now playing CD track %i", m_iCDTrack ) );
#ifdef GS_DEVELOPER
print( sprintf( "%s::Trigger: CD Track %i requested\n",
this.classname, m_iCDTrack ) );
#endif
WriteByte( MSG_ALL, 32 ); // aka SVC_CDTRACK
WriteByte( MSG_ALL, m_iCDTrack );
remove( this );

View file

@ -70,8 +70,16 @@ void trigger_changelevel::Change(void)
if (m_strLandmark) {
entity landmark = find(world, CBaseTrigger::m_strTargetName, m_strLandmark);
g_landmarkpos = m_activator.origin - landmark.origin;
#ifdef GS_DEVELOPER
print( sprintf( "%s::Change: Change to `%s` using landmark '%s'\n",
this.classname, m_strMap, m_strLandmark ) );
#endif
changelevel(m_strMap, m_strLandmark);
} else {
#ifdef GS_DEVELOPER
print( sprintf( "%s::Change: Change to `%s`\n",
this.classname, m_strMap ) );
#endif
changelevel(m_strMap);
}
}
@ -91,9 +99,17 @@ void trigger_changelevel::Trigger(void)
m_activator = other;
if (m_flChangeDelay) {
#ifdef GS_DEVELOPER
print( sprintf( "%s::Trigger: Delayed change to `%s` in %d sec/s\n",
this.classname, m_strMap, m_flChangeDelay ) );
#endif
think = Change;
nextthink = time + m_flChangeDelay;
} else {
#ifdef GS_DEVELOPER
print( sprintf( "%s::Trigger: Change to `%s`\n",
this.classname, m_strMap ) );
#endif
Change();
}
}
@ -131,7 +147,7 @@ vector Landmark_GetSpot(void)
entity landmark = find(world, CBaseTrigger::m_strTargetName, startspot);
if (!landmark) {
print(sprintf("^1ERROR^7: Cannot find startspot \"%s\"!\n",startspot));
print(sprintf("^1ERROR^7: Landmark_GetSpot: Cannot find startspot '%s'!\n",startspot));
return __NULL__;
}

View file

@ -54,13 +54,15 @@ void trigger_hurt::Trigger(void)
{
if (solid != SOLID_NOT) {
#ifdef GS_DEVELOPER
print("trigger_hurt: de-activated.\n");
print( sprintf( "%s::Trigger: Deactivated\n",
this.classname ) );
#endif
solid = SOLID_NOT;
touch = __NULL__;
} else {
#ifdef GS_DEVELOPER
print("trigger_hurt: activated.\n");
print( sprintf( "%s::Trigger: Activated\n",
this.classname ) );
#endif
solid = SOLID_TRIGGER;
touch = Touch;
@ -101,6 +103,11 @@ void trigger_hurt::Touch(void)
Damage_Apply(other, this, m_iDamage, 0, DMG_GENERIC);
#ifdef GS_DEVELOPER
print( sprintf( "%s::Touch: Hurting '%s' with %i\n",
this.classname, other.netname, m_iDamage ) );
#endif
// Shut it down if used once
if (spawnflags & SF_HURT_ONCE) {
Trigger();

View file

@ -58,9 +58,9 @@ void trigger_multiple::touch(void)
}
if (m_flDelay > 0) {
CBaseTrigger::UseTargets_Delay(m_flDelay);
UseTargets_Delay(m_flDelay);
} else {
CBaseTrigger::UseTargets();
UseTargets();
}
/* This is effectively a trigger_once...*/
@ -86,6 +86,8 @@ void trigger_multiple::Respawn(void)
void trigger_multiple::trigger_multiple(void)
{
CBaseEntity::CBaseEntity();
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
switch (argv(i)) {
case "delay":
@ -98,7 +100,5 @@ void trigger_multiple::trigger_multiple(void)
break;
}
}
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
InitBrushTrigger();
}

View file

@ -37,7 +37,18 @@ void trigger_teleport::touch(void)
entity eTarget = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
if (eTarget) {
setorigin(other, eTarget.origin + [0,0,16]);
vector endpos = eTarget.origin + [0,0,16];
setorigin(other, endpos);
#ifdef GS_DEVELOPER
print( sprintf( "%s::touch: Teleported '%s' to `%v`\n",
this.classname, other.netname, endpos ) );
#endif
} else {
#ifdef GS_DEVELOPER
print( sprintf( "%s::touch: Failed to teleport '%s'\n",
this.classname, other.netname ) );
#endif
}
}
}