This commit is contained in:
Ragnvald Maartmann-Moe IV 2004-02-09 06:15:13 +00:00
parent ff00c005cc
commit 90d7c11e08
5 changed files with 368 additions and 245 deletions

View file

@ -62,22 +62,34 @@ void() _spawn_point_init = {
/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24) /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
The single player starting point for a level. The single player starting point for a level.
*/ */
void() info_player_start = { self.count = 0; _spawn_point_init(); }; void() info_player_start = {
self.count = 0;
_spawn_point_init ();
};
/*QUAKED info_player_start2 (1 0 0) (-16 -16 24) (16 16 24) /*QUAKED info_player_start2 (1 0 0) (-16 -16 24) (16 16 24)
Only used on start map for the return point from an episode. Only used on start map for the return point from an episode.
*/ */
void() info_player_start2 = { self.count = 0; _spawn_point_init(); }; void() info_player_start2 = {
self.count = 0;
_spawn_point_init ();
};
/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24) /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
A spawn point for non-teamplay deathmatch games A spawn point for non-teamplay deathmatch games
*/ */
void() info_player_deathmatch = { self.count = 100; _spawn_point_init(); }; void() info_player_deathmatch = {
self.count = 100;
_spawn_point_init ();
};
/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24) /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
A spawn point for coop games A spawn point for coop games
*/ */
void() info_player_coop = { self.count = 0; _spawn_point_init(); }; void() info_player_coop = {
self.count = 0;
_spawn_point_init ();
};
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
Doesn't do anything. Use it for ambients. Doesn't do anything. Use it for ambients.
@ -97,7 +109,7 @@ If targeted, it will toggle between on or off.
void() _light_use = { void() _light_use = {
if (self.spawnflags & SPAWNFLAGS_START_OFF) { if (self.spawnflags & SPAWNFLAGS_START_OFF) {
lightstyle (self.style, self.noise4); lightstyle (self.style, self.noise4);
self.spawnflags -= SPAWNFLAGS_START_OFF; self.spawnflags &= ~SPAWNFLAGS_START_OFF;
} else { } else {
lightstyle (self.style, self.noise3); lightstyle (self.style, self.noise3);
self.spawnflags |= SPAWNFLAGS_START_OFF; self.spawnflags |= SPAWNFLAGS_START_OFF;
@ -107,8 +119,10 @@ void() _light_use = {
void() light = { void() light = {
util_map_entity_init(); util_map_entity_init();
if (!self.noise3) self.noise3 = "a"; if (!self.noise3)
if (!self.noise4) self.noise4 = "m"; self.noise3 = "a";
if (!self.noise4)
self.noise4 = "m";
self.use = _light_use; self.use = _light_use;
if (self.spawnflags & SPAWNFLAGS_START_OFF) if (self.spawnflags & SPAWNFLAGS_START_OFF)
@ -125,14 +139,20 @@ Lava Balls
void() _misc_fireball_deathmsg = { void() _misc_fireball_deathmsg = {
local float r; local float r;
local string nname; local string nname;
r = random (); r = random ();
nname = name (self); nname = name (self);
if (r < 0.25) bprint(PRINT_DEATH, nname, " catches a lava ball.\n"); if (r < 0.25) {
else if (r < 0.5) bprint(PRINT_DEATH, "A lavaball gives ", nname, " a hug.\n"); bprint (PRINT_DEATH, nname, " catches a lava ball.\n");
else if (r < 0.75) bprint(PRINT_DEATH, nname, " was struck down by the lava gods.\n"); } else if (r < 0.5) {
else bprint(PRINT_DEATH, nname, " gets coated with liquid brimstone.\n"); bprint (PRINT_DEATH, "A lavaball gives ", nname, " a hug.\n");
} else if (r < 0.75) {
bprint (PRINT_DEATH, nname, " was struck down by the lava gods.\n");
} else {
bprint (PRINT_DEATH, nname, " gets coated with liquid brimstone.\n");
}
}; };
void() _misc_fireball_touch = { void() _misc_fireball_touch = {
@ -165,9 +185,12 @@ void() _misc_fireball_think = {
void() misc_fireball = { void() misc_fireball = {
util_map_entity_init(); util_map_entity_init();
if (!self.angles) self.angles = '-90 0 0'; if (!self.angles)
if (!self.speed) self.speed = 200; self.angles = '-90 0 0';
if (!self.weaponmodel) self.weaponmodel = "progs/lavaball.mdl"; if (!self.speed)
self.speed = 200;
if (!self.weaponmodel)
self.weaponmodel = "progs/lavaball.mdl";
precache_model (self.weaponmodel); precache_model (self.weaponmodel);
@ -178,7 +201,6 @@ void() misc_fireball = {
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) /*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
Exploding box. Exploding box.
*/ */
void() _misc_explobox_deathmsg = { void() _misc_explobox_deathmsg = {
local float r; local float r;
local string nname; local string nname;
@ -187,11 +209,20 @@ void() _misc_explobox_deathmsg = {
r = random (); r = random ();
if (self.dmg_attacker.dmg_attacker == self) { if (self.dmg_attacker.dmg_attacker == self) {
if (r < 0.5) bprint(PRINT_DEATH, nname, " learns what combustible means the hard way.\n"); if (r < 0.5) {
else bprint(PRINT_DEATH, nname, " trips on some live ammo.\n"); bprint (PRINT_DEATH, nname,
" learns what combustible means the hard way.\n");
} else { } else {
if (r < 0.5) bprint(PRINT_DEATH, nname, " has fun at the gunpowder factory.\n"); bprint (PRINT_DEATH, nname, " trips on some live ammo.\n");
else bprint(PRINT_DEATH, nname, " eats ", name(self.dmg_attacker.dmg_attacker), "'s box of joy.\n"); }
} else {
if (r < 0.5) {
bprint (PRINT_DEATH, nname,
" has fun at the gunpowder factory.\n");
} else {
bprint (PRINT_DEATH, nname, " eats ",
name (self.dmg_attacker.dmg_attacker), "'s box of joy.\n");
}
} }
}; };
@ -220,7 +251,8 @@ _misc_explobox_damage = {
}; };
void() misc_explobox = { void() misc_explobox = {
if (!self.model) self.model = "maps/b_explob.bsp"; if (!self.model)
self.model = "maps/b_explob.bsp";
if (!self.mins && !self.maxs) { if (!self.mins && !self.maxs) {
self.mins = '0 0 0'; self.mins = '0 0 0';
self.maxs = '32 32 64'; self.maxs = '32 32 64';
@ -231,11 +263,16 @@ void() misc_explobox = {
util_map_entity_init(); util_map_entity_init();
if (!self.health) self.health = 20; if (!self.health)
if (!self.dmg) self.dmg = 160; self.health = 20;
if (!self.mass) self.mass = self.dmg * 8; if (!self.dmg)
if (!self.lip) self.lip = self.dmg; self.dmg = 160;
if (!self.speed) self.speed = 1000; if (!self.mass)
self.mass = self.dmg * 8;
if (!self.lip)
self.lip = self.dmg;
if (!self.speed)
self.speed = 1000;
self.netname = "combustible cargo"; self.netname = "combustible cargo";

View file

@ -26,9 +26,12 @@ void() item_health = {
item_megahealth (); item_megahealth ();
return; return;
} else { } else {
if (!self.model) self.model = "maps/b_bh25.bsp"; if (!self.model)
if (!self.noise2) self.noise2 = "items/health1.wav"; self.model = "maps/b_bh25.bsp";
if (!self.health) self.health = 25; if (!self.noise2)
self.noise2 = "items/health1.wav";
if (!self.health)
self.health = 25;
} }
if (self.mins == '0 0 0' && self.maxs == '0 0 0') if (self.mins == '0 0 0' && self.maxs == '0 0 0')
@ -40,8 +43,10 @@ void() item_health = {
/*QUAKED item_armor (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED item_armor (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() item_armor = { void() item_armor = {
if (!self.model) self.model = "progs/armor.mdl"; if (!self.model)
if (!self.noise2) self.noise2 = "items/armor1.wav"; self.model = "progs/armor.mdl";
if (!self.noise2)
self.noise2 = "items/armor1.wav";
if (self.mins == '0 0 0' && self.maxs == '0 0 0') if (self.mins == '0 0 0' && self.maxs == '0 0 0')
setsize (self, '-16 -16 0', '16 16 56'); setsize (self, '-16 -16 0', '16 16 56');
item_generic (); item_generic ();
@ -52,8 +57,10 @@ void() item_armor = {
/*QUAKED item_ammo (0 .5 .8) (0 0 0) (32 32 32) /*QUAKED item_ammo (0 .5 .8) (0 0 0) (32 32 32)
*/ */
void() item_ammo = { void() item_ammo = {
if (!self.model) self.model = "progs/backpack.mdl"; if (!self.model)
if (!self.noise2) self.noise2 = "weapons/lock4.wav"; self.model = "progs/backpack.mdl";
if (!self.noise2)
self.noise2 = "weapons/lock4.wav";
if (self.mins == '0 0 0' && self.maxs == '0 0 0') if (self.mins == '0 0 0' && self.maxs == '0 0 0')
setsize(self, '0 0 0', '32 32 56'); setsize(self, '0 0 0', '32 32 56');
if (!self.wait && !self.delay) { if (!self.wait && !self.delay) {

View file

@ -59,15 +59,15 @@ void() _move_to_pos_done = {
/* calculate velocity and direction to move to position at spd. */ /* calculate velocity and direction to move to position at spd. */
/* _ONLY_ use this with MOVETYPE_PUSH's! */ /* _ONLY_ use this with MOVETYPE_PUSH's! */
void(vector position, float spd, void() think_func) util_move_to_pos = { void(vector position, float spd, void() think_func) util_move_to_pos = {
local vector offs;
local float dist; local float dist;
local vector offs;
self.finaldest = position; self.finaldest = position;
self.speed = spd; self.speed = spd;
offs = position - self.origin; offs = position - self.origin;
dist = vlen (offs); dist = vlen (offs);
offs = offs * (1/dist); offs *= (1/ dist);
self.velocity = offs * spd; self.velocity = offs * spd;
@ -80,7 +80,7 @@ void(vector position, float spd, void() think_func) util_move_to_pos = {
}; };
void() _movewall_done = { void() _movewall_done = {
self.state = self.state + 0.5; self.state += 0.5;
if (self.w_think) if (self.w_think)
self.w_think (); self.w_think ();
@ -100,8 +100,10 @@ void() _movewall_use = {
return; return;
spd = self.goalentity.speed; spd = self.goalentity.speed;
if (!spd) spd = self.speed; if (!spd)
util_move_to_pos(self.goalentity.pos2 - self.view_ofs, spd, _movewall_done); spd = self.speed;
util_move_to_pos (self.goalentity.pos2 - self.view_ofs, spd,
_movewall_done);
self.state = self.goalentity.style - 0.5; self.state = self.goalentity.style - 0.5;
self.goalentity = self.goalentity.goalentity; self.goalentity = self.goalentity.goalentity;
@ -178,9 +180,9 @@ void() _movewall_block_goback = {
void() _movewall_trigger_touch = { void() _movewall_trigger_touch = {
self = self.owner; self = self.owner;
self.flags = self.flags | FL_JUMPRELEASED; self.flags |= FL_JUMPRELEASED;
self.touch (); self.touch ();
self.flags = self.flags - FL_JUMPRELEASED; self.flags &= ~FL_JUMPRELEASED;
}; };
entity(vector org, vector tmin, vector tmax) _movewall_spawn_trigger = { entity(vector org, vector tmin, vector tmax) _movewall_spawn_trigger = {
@ -209,8 +211,8 @@ entity(vector org, vector tmin, vector tmax) _movewall_spawn_trigger = {
#define SPAWNFLAGS_DOOR_START_OPEN 1 #define SPAWNFLAGS_DOOR_START_OPEN 1
#define SPAWNFLAGS_DOOR_DONT_LINK 4 #define SPAWNFLAGS_DOOR_DONT_LINK 4
#define SPAWNFLAGS_DOOR_GOLD_KEY 8 /* legacy */ #define SPAWNFLAGS_DOOR_GOLD_KEY 8 // legacy
#define SPAWNFLAGS_DOOR_SILVER_KEY 16 /* legacy */ #define SPAWNFLAGS_DOOR_SILVER_KEY 16 // legacy
#define SPAWNFLAGS_DOOR_TOGGLE 32 #define SPAWNFLAGS_DOOR_TOGGLE 32
float(float d) _movewall_door_takedamage = { float(float d) _movewall_door_takedamage = {
@ -248,7 +250,7 @@ float(float d) _movewall_door_takedamage = {
self = oldself; self = oldself;
deathmsg_nodisplay (); deathmsg_nodisplay ();
return FALSE; /* lie */ return FALSE; // lie
}; };
void() _movewall_door_touch = { void() _movewall_door_touch = {
@ -313,16 +315,25 @@ void() _door_link = {
tail.owner = self; tail.owner = self;
/* *Sigh*. Id compat. */ /* *Sigh*. Id compat. */
if (tail.noise1) self.noise1 = tail.noise1; if (tail.noise1)
if (tail.noise2) self.noise2 = tail.noise2; self.noise1 = tail.noise1;
if (tail.noise3) self.noise3 = tail.noise3; if (tail.noise2)
if (tail.noise4) self.noise4 = tail.noise4; self.noise2 = tail.noise2;
if (tail.noise5) self.noise5 = tail.noise5; if (tail.noise3)
if (tail.noise6) self.noise6 = tail.noise6; self.noise3 = tail.noise3;
if (tail.message) self.message = tail.message; if (tail.noise4)
self.noise4 = tail.noise4;
if (tail.noise5)
self.noise5 = tail.noise5;
if (tail.noise6)
self.noise6 = tail.noise6;
if (tail.message)
self.message = tail.message;
if (tail.health) self.health = tail.health; if (tail.health)
if (tail.targetname) self.targetname = tail.targetname; self.health = tail.health;
if (tail.targetname)
self.targetname = tail.targetname;
tail.message = ""; tail.message = "";
@ -366,56 +377,76 @@ void() _door_link = {
void() func_door = { void() func_door = {
if (!self.noise5) { if (!self.noise5) {
if (world.worldtype == 0) { switch (world.worldtype) {
case 0:
self.noise5 = "doors/medtry.wav"; self.noise5 = "doors/medtry.wav";
self.noise6 = "doors/meduse.wav"; self.noise6 = "doors/meduse.wav";
} else if (world.worldtype == 1) { break;
case 1:
self.noise5 = "doors/runetry.wav"; self.noise5 = "doors/runetry.wav";
self.noise6 = "doors/runeuse.wav"; self.noise6 = "doors/runeuse.wav";
} else if (world.worldtype == 2) { break;
case 2:
self.noise5 = "doors/basetry.wav"; self.noise5 = "doors/basetry.wav";
self.noise6 = "doors/baseuse.wav"; self.noise6 = "doors/baseuse.wav";
break;
default:
break;
} }
} }
if (!self.noise3) { if (!self.noise3) {
if (self.sounds == 1) { switch (self.sounds) {
case 1:
self.noise3 = "doors/doormv1.wav"; self.noise3 = "doors/doormv1.wav";
self.noise4 = "doors/drclos4.wav"; self.noise4 = "doors/drclos4.wav";
} else if (self.sounds == 2) { break;
case 2:
self.noise3 = "doors/hydro1.wav"; self.noise3 = "doors/hydro1.wav";
self.noise4 = "doors/hydro2.wav"; self.noise4 = "doors/hydro2.wav";
} else if (self.sounds == 3) { break;
case 3:
self.noise3 = "doors/stndr1.wav"; self.noise3 = "doors/stndr1.wav";
self.noise4 = "doors/stndr2.wav"; self.noise4 = "doors/stndr2.wav";
} else if (self.sounds == 4) { break;
case 4:
self.noise3 = "doors/ddoor1.wav"; self.noise3 = "doors/ddoor1.wav";
self.noise4 = "doors/ddoor2.wav"; self.noise4 = "doors/ddoor2.wav";
break;
default:
break;
} }
} }
if (self.noise3) precache_sound(self.noise3); if (self.noise3)
if (self.noise4) precache_sound(self.noise4); precache_sound(self.noise3);
if (self.noise4)
precache_sound(self.noise4);
if (self.message != "" && !self.noise1 && !self.noise2) if (self.message != "" && !self.noise1 && !self.noise2)
self.noise2 = "misc/talk.wav"; self.noise2 = "misc/talk.wav";
if (!self.speed) self.speed = 100; if (!self.speed)
if (!self.wait) self.wait = 3; self.speed = 100;
if (!self.lip) self.lip = 8; if (!self.wait)
self.wait = 3;
if (!self.lip)
self.lip = 8;
if (!self.dmg) self.dmg = 2; if (!self.dmg)
if (self.dmg < 0) self.dmg = 0; self.dmg = 2;
if (self.dmg < 0)
self.dmg = 0;
if (self.spawnflags & SPAWNFLAGS_DOOR_SILVER_KEY) { if (self.spawnflags & SPAWNFLAGS_DOOR_SILVER_KEY) {
self.spawnflags = self.spawnflags | SPAWNFLAGS_CHECK_ITEMS; self.spawnflags |= SPAWNFLAGS_CHECK_ITEMS;
self.items = self.items | IT_KEY1; self.items |= IT_KEY1;
self.wait = -1; self.wait = -1;
} }
if (self.spawnflags & SPAWNFLAGS_DOOR_GOLD_KEY) { if (self.spawnflags & SPAWNFLAGS_DOOR_GOLD_KEY) {
self.spawnflags = self.spawnflags | SPAWNFLAGS_CHECK_ITEMS; self.spawnflags |= SPAWNFLAGS_CHECK_ITEMS;
self.items = self.items | IT_KEY2; self.items |= IT_KEY2;
self.wait = -1; self.wait = -1;
} }
@ -428,7 +459,8 @@ void() func_door = {
util_set_movedir (); util_set_movedir ();
self.pos1 = self.origin; self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); self.pos2 = self.pos1 + self.movedir * (fabs (self.movedir * self.size)
- self.lip);
if (self.spawnflags & SPAWNFLAGS_DOOR_START_OPEN) { if (self.spawnflags & SPAWNFLAGS_DOOR_START_OPEN) {
setorigin (self, self.pos2); setorigin (self, self.pos2);
@ -448,7 +480,7 @@ void() func_door = {
self.blocked = _movewall_block_goback; self.blocked = _movewall_block_goback;
self.w_think = _movewall_binary_think; self.w_think = _movewall_binary_think;
self.owner = self; /* In case we get triggered before 0.1 */ self.owner = self; // In case we get triggered before 0.1
self.think = _door_link; self.think = _door_link;
self.nextthink = self.ltime + 0.1; self.nextthink = self.ltime + 0.1;
@ -480,11 +512,15 @@ void() func_plat = {
} }
} }
if (self.noise3) precache_sound(self.noise3); if (self.noise3)
if (self.noise4) precache_sound(self.noise4); precache_sound(self.noise3);
if (self.noise4)
precache_sound(self.noise4);
if (!self.speed) self.speed = 150; if (!self.speed)
if (!self.wait) self.wait = 1; self.speed = 150;
if (!self.wait)
self.wait = 1;
movewall_init (); movewall_init ();
@ -495,7 +531,7 @@ void() func_plat = {
self.pos1 = self.origin; self.pos1 = self.origin;
self.pos2 = self.origin; self.pos2 = self.origin;
self.pos2_z = self.pos2_z - self.height; self.pos2_z -= self.height;
// ============= // =============
tmin = self.mins + '25 25 0'; tmin = self.mins + '25 25 0';
@ -556,7 +592,8 @@ void() _movewall_button_think = {
} else { } else {
if (self.state == 1) { if (self.state == 1) {
if (self.noise4) if (self.noise4)
sound(self, CHAN_BODY|CHAN_NO_PHS_ADD, self.noise4, 1, ATTN_NORM); sound (self, CHAN_BODY|CHAN_NO_PHS_ADD, self.noise4, 1,
ATTN_NORM);
self.think = _movewall_wait_think; self.think = _movewall_wait_think;
@ -575,7 +612,6 @@ void() _movewall_button_think = {
void() _movewall_button_touch = { void() _movewall_button_touch = {
if (!is_living (other)) if (!is_living (other))
return; return;
if (self.state != 0) if (self.state != 0)
return; return;
@ -595,23 +631,40 @@ float(float d) _movewall_button_takedamage = {
self.use (); self.use ();
} }
return FALSE; /* lie */ return FALSE; // lie
}; };
void() func_button = { void() func_button = {
if (!self.noise3) { if (!self.noise3) {
if (self.sounds == 0) self.noise3 = "buttons/airbut1.wav"; switch (self.sounds) {
else if (self.sounds == 1) self.noise3 = "buttons/switch21.wav"; case 0:
else if (self.sounds == 2) self.noise3 = "buttons/switch02.wav"; self.noise3 = "buttons/airbut1.wav";
else if (self.sounds == 3) self.noise3 = "buttons/switch04.wav"; break;
case 1:
self.noise3 = "buttons/switch21.wav";
break;
case 2:
self.noise3 = "buttons/switch02.wav";
break;
case 3:
self.noise3 = "buttons/switch04.wav";
break;
default:
break;
}
} }
if (self.noise3) precache_sound(self.noise3); if (self.noise3)
if (self.noise4) precache_sound(self.noise4); precache_sound (self.noise3);
if (self.noise4)
precache_sound (self.noise4);
if (!self.speed) self.speed = 40; if (!self.speed)
if (!self.wait) self.wait = 1; self.speed = 40;
if (!self.lip) self.lip = 4; if (!self.wait)
self.wait = 1;
if (!self.lip)
self.lip = 4;
movewall_init (); movewall_init ();
@ -620,7 +673,8 @@ void() func_button = {
util_set_movedir (); util_set_movedir ();
self.pos1 = self.origin; self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); self.pos2 = self.pos1 + self.movedir * (fabs (self.movedir * self.size)
- self.lip);
self.style = 1; self.style = 1;
self.state = 1 - self.style; self.state = 1 - self.style;
@ -662,7 +716,7 @@ void() func_button = {
/* pos1 is state 0 position */ /* pos1 is state 0 position */
void() _movewall_secret_use = { void() _movewall_secret_use = {
/* Stay open... */ // Stay open...
if (self.count == 2 && self.state == 2) if (self.count == 2 && self.state == 2)
self.nextthink = self.ltime + self.wait; self.nextthink = self.ltime + self.wait;
@ -702,12 +756,14 @@ void() _movewall_secret_think = {
self.think = _movewall_use; self.think = _movewall_use;
self.nextthink = self.ltime + 1.0; self.nextthink = self.ltime + 1.0;
if (self.count == 0 && self.state == 0) { if (self.count == 0) {
if (self.state == 0) {
self.style = 1; self.style = 1;
self.pos2 = self.dest1; self.pos2 = self.dest1;
} if (self.count == 0 && self.state == 1) { } else if (self.state == 1) {
self.style = 2; self.style = 2;
self.pos2 = self.dest2; self.pos2 = self.dest2;
}
} else if (self.count == 1 && self.state == 2) { } else if (self.count == 1 && self.state == 2) {
if (self.spawnflags & SPAWNFLAGS_SECRET_ONCE) { if (self.spawnflags & SPAWNFLAGS_SECRET_ONCE) {
self.nextthink = -1; self.nextthink = -1;
@ -752,7 +808,8 @@ void() _movewall_secret_touch = {
centerprint (other, self.message); centerprint (other, self.message);
if (self.noise2) if (self.noise2)
sound(other, CHAN_ITEM, self.noise2, self.volume, self.attenuation); sound (other, CHAN_ITEM, self.noise2, self.volume,
self.attenuation);
} }
}; };
@ -771,31 +828,43 @@ dmg damage to inflict when blocked (default 2)
void() func_door_secret = { void() func_door_secret = {
if (!self.noise3) { if (!self.noise3) {
if (self.sounds == 1) { switch (self.sounds) {
case 1:
self.noise1 = "doors/latch2.wav"; self.noise1 = "doors/latch2.wav";
self.noise3 = "doors/winch2.wav"; self.noise3 = "doors/winch2.wav";
self.noise4 = "doors/drclos4.wav"; self.noise4 = "doors/drclos4.wav";
} else if (self.sounds == 2) { break;
case 2:
self.noise3 = "doors/airdoor1.wav"; self.noise3 = "doors/airdoor1.wav";
self.noise4 = "doors/airdoor2.wav"; self.noise4 = "doors/airdoor2.wav";
} else if (self.sounds == 0 || self.sounds == 3) { break;
case 0:
case 3:
self.noise3 = "doors/basesec1.wav"; self.noise3 = "doors/basesec1.wav";
self.noise4 = "doors/basesec2.wav"; self.noise4 = "doors/basesec2.wav";
break;
default:
break;
} }
} }
if (self.message != "" && !self.noise2) if (self.message != "" && !self.noise2)
self.noise2 = "misc/talk.wav"; self.noise2 = "misc/talk.wav";
if (self.noise3) precache_sound(self.noise3); if (self.noise3)
if (self.noise4) precache_sound(self.noise4); precache_sound(self.noise3);
if (self.noise4)
precache_sound(self.noise4);
self.solid = SOLID_BSP; self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH; self.movetype = MOVETYPE_PUSH;
if (!self.speed) self.speed = 50; if (!self.speed)
if (!self.wait) self.wait = 5; self.speed = 50;
if (!self.dmg) self.dmg = 2; if (!self.wait)
self.wait = 5;
if (!self.dmg)
self.dmg = 2;
movewall_init (); movewall_init ();
@ -862,7 +931,8 @@ void() _movewall_train_think = {
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
} else { } else {
if (self.noise4) if (self.noise4)
sound(self, CHAN_VOICE|CHAN_NO_PHS_ADD, self.noise4, 1, ATTN_NORM); sound (self, CHAN_VOICE|CHAN_NO_PHS_ADD, self.noise4, 1,
ATTN_NORM);
self.think = _movewall_wait_think; self.think = _movewall_wait_think;
self.nextthink = self.ltime + self.wait; self.nextthink = self.ltime + self.wait;
@ -876,11 +946,14 @@ void() _train_finalize = {
oldself = self; oldself = self;
while (self) { while (self) {
if (self.goalentity) break; /* Looped. FIXME: Use short circuit when compiler supports */ if (self.goalentity)
break; // Looped. FIXME: Use short circuit when compiler supports
if (!self.target) objerror("Train without target\n"); if (!self.target)
objerror ("Train without target\n");
self.goalentity = find (world, targetname, self.target); self.goalentity = find (world, targetname, self.target);
if (!self.goalentity) objerror("Unable to find train target\n"); if (!self.goalentity)
objerror ("Unable to find train target\n");
self = self.goalentity; self = self.goalentity;
self.pos2 = self.origin; self.pos2 = self.origin;
@ -905,13 +978,19 @@ void() func_train = {
} }
} }
if (self.noise3) precache_sound(self.noise3); if (self.noise3)
if (self.noise4) precache_sound(self.noise4); precache_sound(self.noise3);
if (self.noise4)
precache_sound(self.noise4);
if (!self.speed) self.speed = 100; if (!self.speed)
if (!self.wait) self.wait = 0.1; self.speed = 100;
if (!self.dmg) self.dmg = 2; if (!self.wait)
if (self.dmg < 0) self.dmg = 0; self.wait = 0.1;
if (!self.dmg)
self.dmg = 2;
if (self.dmg < 0)
self.dmg = 0;
self.view_ofs = self.mins; self.view_ofs = self.mins;
@ -922,7 +1001,7 @@ void() func_train = {
util_map_entity_init(); util_map_entity_init();
/* Make sure all the targetnames are set */ // Make sure all the targetnames are set
self.think = _train_finalize; self.think = _train_finalize;
self.nextthink = self.ltime + sv_mintic; self.nextthink = self.ltime + sv_mintic;
}; };