Sanity improvements. It's not enough, yet, though...

This commit is contained in:
Ragnvald Maartmann-Moe IV 2004-02-09 04:41:39 +00:00
parent f63eb36504
commit c9150ef436
2 changed files with 61 additions and 52 deletions

View file

@ -9,8 +9,8 @@
void() _item_regen_think = {
self.solid = SOLID_TRIGGER;
setmodel(self, self.model);
sound(self, CHAN_VOICE, self.noise7, 1, ATTN_NORM);
setmodel (self, self.model);
sound (self, CHAN_VOICE, self.noise7, 1, ATTN_NORM);
};
void() item_remove_regen = {
@ -19,7 +19,7 @@ void() item_remove_regen = {
self.solid = SOLID_NOT;
self.modelindex = 0;
del = self.wait + random()*self.delay;
del = self.wait + random () * self.delay;
if (del <= 0) {
safe_remove(self);
return;
@ -32,15 +32,14 @@ void() item_remove_regen = {
void() item_generic_touch = {
if (!other.th_takeitem)
return;
if (!util_check_targets()) return;
if (!switcheroo(other, self, other.th_takeitem))
if (!util_check_targets ())
return;
if (!switcheroo (other, self, other.th_takeitem))
return;
util_use_targets();
util_use_targets ();
item_remove_regen();
item_remove_regen ();
};
void() item_generic = {
@ -48,12 +47,12 @@ void() item_generic = {
self.noise7 = "items/itembk2.wav";
if (sv_spawning)
precache_sound(self.noise7);
precache_sound (self.noise7);
self.solid = SOLID_TRIGGER;
self.touch = item_generic_touch;
util_map_entity_init();
util_map_entity_init ();
self.flags |= FL_ITEM;

View file

@ -10,21 +10,30 @@ void() util_map_entity_init = {
self.deadflag = DEAD_NONLIVING;
if (self.noise && sv_spawning) {
if (!self.volume) self.volume = 0.5;
if (!self.attenuation) self.attenuation = ATTN_STATIC;
if (!self.volume)
self.volume = 0.5;
if (!self.attenuation)
self.attenuation = ATTN_STATIC;
precache_sound(self.noise);
ambientsound(center(self), self.noise, self.volume, self.attenuation);
precache_sound (self.noise);
ambientsound (center (self), self.noise, self.volume,
self.attenuation);
} else {
if (!self.volume) self.volume = 1.0;
if (!self.attenuation) self.attenuation = ATTN_NORM;
if (!self.volume)
self.volume = 1.0;
if (!self.attenuation)
self.attenuation = ATTN_NORM;
}
if (sv_spawning) {
if (self.noise1) precache_sound(self.noise1);
if (self.noise2) precache_sound(self.noise2);
if (self.noise5) precache_sound(self.noise5);
if (self.noise6) precache_sound(self.noise6);
if (self.noise1)
precache_sound (self.noise1);
if (self.noise2)
precache_sound (self.noise2);
if (self.noise5)
precache_sound (self.noise5);
if (self.noise6)
precache_sound (self.noise6);
}
if (self.mangle)
@ -32,12 +41,12 @@ void() util_map_entity_init = {
if (self.model) {
if (sv_spawning)
precache_model(self.model);
setmodel(self, self.model);
precache_model (self.model);
setmodel (self, self.model);
}
setsize(self, self.mins, self.maxs);
setorigin(self, self.origin); // Links BSP models
setsize (self, self.mins, self.maxs);
setorigin (self, self.origin); // Links BSP models
};
void() util_map_entity_cull = {
@ -49,7 +58,7 @@ void() util_map_entity_cull = {
if (!sv_spawning) {
if (self.targetname) {
if (find(world, target, self.targetname))
if (find (world, target, self.targetname))
return;
}
@ -63,7 +72,7 @@ void() util_map_entity_cull = {
if (self == oldself)
continue;
util_map_entity_cull();
util_map_entity_cull ();
}
self = oldself;
@ -76,47 +85,48 @@ void() util_map_entity_cull = {
}
}
if (self.model) safe_makestatic(self);
else safe_remove(self);
if (self.model)
safe_makestatic (self);
else
safe_remove (self);
};
void() util_map_entity_drop = {
self.origin = self.origin + '0 0 2';
if (!droptofloor()) {
dprint(self.classname, " fell out of level from ", vtos(self.origin), "\n");
remove(self);
if (!droptofloor ()) {
dprint (self.classname, " fell out of level from ", vtos (self.origin),
"\n");
remove (self);
return;
}
};
float() util_check_targets = {
/*
if (self.spawnflags & (SPAWNFLAGS_CHECK_ITEMS|SPAWNFLAGS_TAKE_ITEMS)) {
}
*/
// if (self.spawnflags & (SPAWNFLAGS_CHECK_ITEMS|SPAWNFLAGS_TAKE_ITEMS)) {
// }
return TRUE;
};
float() util_use_targets = {
if (!util_check_targets())
if (!util_check_targets ())
return FALSE;
if (self.noise1)
sound(self, CHAN_VOICE, self.noise1, self.volume, self.attenuation);
sound (self, CHAN_VOICE, self.noise1, self.volume, self.attenuation);
if (self.noise2)
sound(other, CHAN_ITEM, self.noise2, self.volume, self.attenuation);
sound (other, CHAN_ITEM, self.noise2, self.volume, self.attenuation);
if (self.message && is_cl(other))
centerprint(other, self.message);
if (self.message && is_cl (other))
centerprint (other, self.message);
if (self.th_activate)
self.th_activate();
self.th_activate ();
if (self.target)
foreach_field(targetname, self.target, use);
foreach_field (targetname, self.target, use);
if (self.killtarget)
foreach(targetname, self.killtarget, safe_remove);
foreach (targetname, self.killtarget, safe_remove);
if (self.count > 0) {
self.count--;
@ -128,7 +138,7 @@ float() util_use_targets = {
self.use = NOTHING_function;
self.touch = NOTHING_function;
util_map_entity_cull();
util_map_entity_cull ();
}
}
@ -144,21 +154,21 @@ float(entity e) is_solid = {
};
float(entity e) is_teleportable = {
return e.movetype != MOVETYPE_NONE &&
e.movetype != MOVETYPE_PUSH &&
e.movetype != MOVETYPE_NOCLIP &&
(e.solid == SOLID_BBOX || e.solid == SOLID_SLIDEBOX);
return (e.movetype != MOVETYPE_NONE &&
e.movetype != MOVETYPE_PUSH &&
e.movetype != MOVETYPE_NOCLIP &&
(e.solid == SOLID_BBOX || e.solid == SOLID_SLIDEBOX));
};
void() util_set_movedir = {
if (self.mangle != '0 0 0')
self.angles = self.mangle;
if (self.angles == '0 -1 0')
if (self.angles == '0 -1 0') {
self.movedir = '0 0 1';
else if (self.angles == '0 -2 0')
} else if (self.angles == '0 -2 0') {
self.movedir = '0 0 -1';
else {
} else {
makevectors(self.angles);
self.movedir = v_forward;
}