Updates to use new QF features.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-03 19:12:07 +00:00
parent afe43c3f76
commit f9c0b28fec
37 changed files with 2766 additions and 4148 deletions

313
nqw/ai.qc
View file

@ -5,7 +5,6 @@ void() knight_bow6;
void() knight_bow1;
void(entity etemp, entity stemp, entity stemp, float dmg) T_Damage;
/*
.enemy
Will be world if not currently angry at anyone.
@ -30,17 +29,12 @@ time > .pausetime.
walkmove(angle, speed) primitive is all or nothing
*/
//
// globals
//
float current_yaw;
//
// when a monster becomes angry at a player, that monster will be used
// as the sight target the next frame so that monsters near that one
// will wake up even if they wouldn't have noticed the player
//
entity sight_entity;
float sight_entity_time;
@ -55,7 +49,6 @@ float(float v) anglemod =
/*
==============================================================================
MOVETARGET CODE
The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
@ -68,16 +61,13 @@ the next spot to move to. If not present, stop here for good.
pausetime
The number of seconds to spend standing or bowing for path_stand or path_bow
==============================================================================
*/
void() movetarget_f =
{
if (!self.targetname)
objerror ("monster_movetarget: no targetname");
self.solid = SOLID_TRIGGER;
self.touch = t_movetarget;
setsize (self, '-8 -8 -8', '8 8 8');
@ -92,7 +82,6 @@ void() path_corner =
movetarget_f ();
};
/*
=============
t_movetarget
@ -103,11 +92,11 @@ moving towards it, change the next destination and continue.
*/
void() t_movetarget =
{
local entity temp;
local entity temp;
if (other.movetarget != self)
return;
if (other.enemy)
return; // fighting, not following a path
@ -118,19 +107,16 @@ local entity temp;
if (self.classname == "monster_ogre")
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
//dprint ("t_movetarget\n");
// dprint ("t_movetarget\n");
self.goalentity = self.movetarget = find (world, targetname, other.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
if (!self.movetarget) {
self.pausetime = time + 999999;
self.th_stand ();
return;
}
};
//============================================================================
/*
@ -146,11 +132,12 @@ returns the range catagorization of an entity reletive to self
*/
float(entity targ) range =
{
local vector spot1, spot2;
local float r;
local vector spot1, spot2;
local float r;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
r = vlen (spot1 - spot2);
if (r < 120)
return RANGE_MELEE;
@ -171,11 +158,11 @@ returns 1 if the entity is visible to self, even if not infront ()
float (entity targ) visible =
{
local vector spot1, spot2;
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, TRUE, self); // see through other monsters
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
@ -184,7 +171,6 @@ float (entity targ) visible =
return FALSE;
};
/*
=============
infront
@ -196,19 +182,16 @@ float(entity targ) infront =
{
local vector vec;
local float dot;
makevectors (self.angles);
vec = normalize (targ.origin - self.origin);
dot = vec * v_forward;
if ( dot > 0.3)
{
if (dot > 0.3)
return TRUE;
}
return FALSE;
};
//============================================================================
/*
@ -221,50 +204,41 @@ Called every 0.1 sec by monsters
============
*/
/*
void() ChangeYaw =
{
local float ideal, move;
//current_yaw = self.ideal_yaw;
// mod down the current angle
current_yaw = anglemod( self.angles_y );
// current_yaw = self.ideal_yaw;
// mod down the current angle
current_yaw = anglemod (self.angles_y);
ideal = self.ideal_yaw;
if (current_yaw == ideal)
return;
move = ideal - current_yaw;
if (ideal > current_yaw)
{
if (ideal > current_yaw) {
if (move > 180)
move = move - 360;
}
else
{
} else {
if (move < -180)
move = move + 360;
}
if (move > 0)
{
if (move > 0) {
if (move > self.yaw_speed)
move = self.yaw_speed;
}
else
{
if (move < 0-self.yaw_speed )
move = 0-self.yaw_speed;
} else {
if (move < 0 - self.yaw_speed)
move = 0 - self.yaw_speed;
}
current_yaw = anglemod (current_yaw + move);
self.angles_y = current_yaw;
};
*/
//============================================================================
void() HuntTarget =
@ -278,54 +252,64 @@ void() HuntTarget =
void() SightSound =
{
local float rsnd;
local float rsnd;
if (self.classname == "monster_ogre")
switch (self.classname) {
case "monster_ogre":
sound (self, CHAN_VOICE, "ogre/ogwake.wav", 1, ATTN_NORM);
else if (self.classname == "monster_knight")
break;
case "monster_knight":
sound (self, CHAN_VOICE, "knight/ksight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_shambler")
break;
case "monster_shambler":
sound (self, CHAN_VOICE, "shambler/ssight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_demon1")
break;
case "monster_demon1":
sound (self, CHAN_VOICE, "demon/sight2.wav", 1, ATTN_NORM);
else if (self.classname == "monster_wizard")
break;
case "monster_wizard":
sound (self, CHAN_VOICE, "wizard/wsight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_zombie")
break;
case "monster_zombie":
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_NORM);
else if (self.classname == "monster_dog")
break;
case "monster_dog":
sound (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
else if (self.classname == "monster_hell_knight")
break;
case "monster_hell_knight":
sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_tarbaby")
break;
case "monster_tarbaby":
sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_vomit")
sound (self, CHAN_VOICE, "vomitus/v_sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_enforcer")
{
rsnd = rint(random() * 3);
if (rsnd == 1)
break;
case "monster_enforcer":
rsnd = random ();
if (rsnd < 0.25)
sound (self, CHAN_VOICE, "enforcer/sight1.wav", 1, ATTN_NORM);
else if (rsnd == 2)
else if (rsnd < 0.5)
sound (self, CHAN_VOICE, "enforcer/sight2.wav", 1, ATTN_NORM);
else if (rsnd == 0)
else if (rsnd < 0.75)
sound (self, CHAN_VOICE, "enforcer/sight3.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enforcer/sight4.wav", 1, ATTN_NORM);
}
else if (self.classname == "monster_army")
break;
case "monster_army":
sound (self, CHAN_VOICE, "soldier/sight1.wav", 1, ATTN_NORM);
else if (self.classname == "monster_shalrath")
break;
case "monster_shalrath":
sound (self, CHAN_VOICE, "shalrath/sight.wav", 1, ATTN_NORM);
break;
}
};
void() FoundTarget =
{
if (self.enemy.classname == "player")
{ // let other monsters see this monster for a while
if (self.enemy.classname == "player") {
// let other monsters see this monster for a while
sight_entity = self;
sight_entity_time = time;
}
self.show_hostile = time + 1; // wake up other monsters
SightSound ();
@ -360,14 +344,11 @@ float() FindTarget =
// spawnflags & 3 is a big hack, because zombie crucified used the first
// spawn flag prior to the ambush flag, and I forgot about it, so the second
// spawn flag works as well
if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3) )
{
if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3)) {
client = sight_entity;
if (client.enemy == self.enemy)
return FALSE;
}
else
{
} else {
client = checkclient ();
if (!client)
return FALSE; // current check entity isn't in PVS
@ -384,41 +365,33 @@ float() FindTarget =
r = range (client);
if (r == RANGE_FAR)
return FALSE;
if (!visible (client))
return FALSE;
if (r == RANGE_NEAR)
{
if (r == RANGE_NEAR) {
if (client.show_hostile < time && !infront (client))
return FALSE;
}
else if (r == RANGE_MID)
{
} else if (r == RANGE_MID) {
if ( /* client.show_hostile < time || */ !infront (client))
return FALSE;
}
//
// got one
//
// got one
self.enemy = client;
if (self.enemy.classname != "player")
{
if (self.enemy.classname != "player") {
self.enemy = self.enemy.enemy;
if (self.enemy.classname != "player")
{
if (self.enemy.classname != "player") {
self.enemy = world;
return FALSE;
}
}
FoundTarget ();
return TRUE;
};
//=============================================================================
void(float dist) ai_forward =
@ -431,7 +404,6 @@ void(float dist) ai_back =
walkmove ( (self.angles_y+180), dist);
};
/*
=============
ai_pain
@ -444,10 +416,10 @@ void(float dist) ai_pain =
ai_back (dist);
/*
local float away;
away = anglemod (vectoyaw (self.origin - self.enemy.origin)
+ 180*(random()- 0.5) );
+ 180 * (random () - 0.5) );
walkmove (away, dist);
*/
};
@ -474,12 +446,7 @@ The monster is walking it's beat
void(float dist) ai_walk =
{
movedist = dist;
if (self.classname == "monster_dragon")
{
movetogoal (dist);
return;
}
// check for noticing a player
if (FindTarget ())
return;
@ -487,7 +454,6 @@ void(float dist) ai_walk =
movetogoal (dist);
};
/*
=============
ai_stand
@ -499,15 +465,12 @@ void() ai_stand =
{
if (FindTarget ())
return;
if (time > self.pausetime)
{
if (time > self.pausetime) {
self.th_walk ();
return;
}
// change angle slightly
// change angle slightly
};
/*
@ -521,17 +484,12 @@ void() ai_turn =
{
if (FindTarget ())
return;
ChangeYaw ();
};
//=============================================================================
/*
=============
ChooseTurn
=============
*/
void(vector dest3) ChooseTurn =
{
local vector dir, newdir;
@ -542,13 +500,10 @@ void(vector dest3) ChooseTurn =
newdir_y = 0 - trace_plane_normal_x;
newdir_z = 0;
if (dir * newdir > 0)
{
if (dir * newdir > 0) {
dir_x = 0 - trace_plane_normal_y;
dir_y = trace_plane_normal_x;
}
else
{
} else {
dir_x = trace_plane_normal_y;
dir_y = 0 - trace_plane_normal_x;
}
@ -557,17 +512,11 @@ void(vector dest3) ChooseTurn =
self.ideal_yaw = vectoyaw(dir);
};
/*
============
FacingIdeal
============
*/
float() FacingIdeal =
{
local float delta;
delta = anglemod(self.angles_y - self.ideal_yaw);
delta = anglemod (self.angles_y - self.ideal_yaw);
if (delta > 45 && delta < 315)
return FALSE;
return TRUE;
@ -583,21 +532,31 @@ float() CheckAnyAttack =
{
if (!enemy_vis)
return 0;
if (self.classname == "monster_army")
return SoldierCheckAttack ();
if (self.classname == "monster_ogre")
return OgreCheckAttack ();
if (self.classname == "monster_shambler")
return ShamCheckAttack ();
if (self.classname == "monster_demon1")
return DemonCheckAttack ();
if (self.classname == "monster_dog")
return DogCheckAttack ();
if (self.classname == "monster_wizard")
return WizardCheckAttack ();
return CheckAttack ();
};
switch (self.classname) {
case "monster_army":
return SoldierCheckAttack ();
break;
case "monster_ogre":
return OgreCheckAttack ();
break;
case "monster_shambler":
return ShamCheckAttack ();
break;
case "monster_demon1":
return DemonCheckAttack ();
break;
case "monster_dog":
return DogCheckAttack ();
break;
case "monster_wizard":
return WizardCheckAttack ();
break;
default:
return CheckAttack ();
break;
}
};
/*
=============
@ -611,14 +570,12 @@ void() ai_run_melee =
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
if (FacingIdeal ()) {
self.th_melee ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_missile
@ -630,14 +587,12 @@ void() ai_run_missile =
{
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (FacingIdeal())
{
if (FacingIdeal ()) {
self.th_missile ();
self.attack_state = AS_STRAIGHT;
}
};
/*
=============
ai_run_slide
@ -648,23 +603,22 @@ Strafe sideways, but stay at aproximately the same range
void() ai_run_slide =
{
local float ofs;
self.ideal_yaw = enemy_yaw;
ChangeYaw ();
if (self.lefty)
ofs = 90;
else
ofs = -90;
if (walkmove (self.ideal_yaw + ofs, movedist))
return;
self.lefty = 1 - self.lefty;
walkmove (self.ideal_yaw - ofs, movedist);
};
/*
=============
ai_run
@ -675,18 +629,14 @@ The monster has an enemy it is trying to kill
void(float dist) ai_run =
{
movedist = dist;
// see if the enemy is dead
if (self.enemy.health <= 0)
{
// see if the enemy is dead
if (self.enemy.health <= 0) {
self.enemy = world;
// FIXME: look all around for other targets
if (self.oldenemy.health > 0)
{
// FIXME: look all around for other targets
if (self.oldenemy.health > 0) {
self.enemy = self.oldenemy;
HuntTarget ();
}
else
{
} else {
if (self.movetarget)
self.th_walk ();
else
@ -697,45 +647,40 @@ void(float dist) ai_run =
self.show_hostile = time + 1; // wake up other monsters
// check knowledge of enemy
// check knowledge of enemy
enemy_vis = visible(self.enemy);
if (enemy_vis)
self.search_time = time + 5;
// look for other coop players
if (coop && self.search_time < time)
{
// look for other coop players
if (coop && self.search_time < time) {
if (FindTarget ())
return;
}
enemy_infront = infront(self.enemy);
enemy_range = range(self.enemy);
enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
enemy_infront = infront (self.enemy);
enemy_range = range (self.enemy);
enemy_yaw = vectoyaw (self.enemy.origin - self.origin);
if (self.attack_state == AS_MISSILE)
{
//dprint ("ai_run_missile\n");
if (self.attack_state == AS_MISSILE) {
// dprint ("ai_run_missile\n");
ai_run_missile ();
return;
}
if (self.attack_state == AS_MELEE)
{
//dprint ("ai_run_melee\n");
if (self.attack_state == AS_MELEE) {
// dprint ("ai_run_melee\n");
ai_run_melee ();
return;
}
if (CheckAnyAttack ())
return; // beginning an attack
if (self.attack_state == AS_SLIDING)
{
if (self.attack_state == AS_SLIDING) {
ai_run_slide ();
return;
}
// head straight in
// head straight in
movetogoal (dist); // done in C code...
};

View file

@ -39,10 +39,8 @@ void(vector p) boss_missile;
void() boss_face =
{
// go for another player if multi player
if (self.enemy.health <= 0 || random() < 0.02)
{
// go for another player if multi player
if (self.enemy.health <= 0 || random () < 0.02) {
self.enemy = find(self.enemy, classname, "player");
if (!self.enemy)
self.enemy = find(self.enemy, classname, "player");
@ -74,7 +72,7 @@ void() boss_rise17 =[ $rise17, boss_missile1 ] {};
void() boss_idle1 =[ $walk1, boss_idle2 ]
{
// look for other players
// look for other players
};
void() boss_idle2 =[ $walk2, boss_idle3 ] {boss_face();};
void() boss_idle3 =[ $walk3, boss_idle4 ] {boss_face();};
@ -177,16 +175,13 @@ void() boss_death8 = [$death8, boss_death9] {};
void() boss_death9 = [$death9, boss_death10]
{
sound (self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_LAVASPLASH);
WriteCoordV (MSG_BROADCAST, self.origin);
};
void() boss_death10 = [$death9, boss_death10]
{
killed_monsters = killed_monsters + 1;
killed_monsters++;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
SUB_UseTargets ();
remove (self);
@ -198,21 +193,18 @@ void(vector p) boss_missile =
local vector org, vec, d;
local float t;
offang = vectoangles (self.enemy.origin - self.origin);
offang = vectoangles (self.enemy.origin - self.origin);
makevectors (offang);
org = self.origin + p_x*v_forward + p_y*v_right + p_z*'0 0 1';
// lead the player on hard mode
if (skill > 1)
{
t = vlen(self.enemy.origin - org) / 300;
org = self.origin + p_x * v_forward + p_y * v_right + p_z * '0 0 1';
// lead the player on hard mode
if (skill > 1) {
t = vlen (self.enemy.origin - org) / 300;
vec = self.enemy.velocity;
vec_z = 0;
d = self.enemy.origin + t * vec;
}
else
{
d = self.enemy.origin + t * vec;
} else {
d = self.enemy.origin;
}
@ -221,12 +213,12 @@ void(vector p) boss_missile =
launch_spike (org, vec);
setmodel (newmis, "progs/lavaball.mdl");
newmis.avelocity = '200 100 300';
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
newmis.velocity = vec*300;
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
newmis.velocity = vec * 300;
newmis.touch = T_MissileTouch; // rocket explosion
sound (self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
// check for dead enemy
// check for dead enemy
if (self.enemy.health <= 0)
boss_idle1 ();
};
@ -237,10 +229,10 @@ void() boss_awake =
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
self.takedamage = DAMAGE_NO;
setmodel (self, "progs/boss.mdl");
setsize (self, '-128 -128 -24', '128 128 256');
if (skill == 0)
self.health = 1;
else
@ -248,24 +240,19 @@ void() boss_awake =
self.enemy = activator;
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_LAVASPLASH);
WriteCoordV (MSG_BROADCAST, self.origin);
self.yaw_speed = 20;
boss_rise1 ();
};
/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
*/
void() monster_boss =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model ("progs/boss.mdl");
@ -292,37 +279,31 @@ float lightning_end;
void() lightning_fire =
{
local vector p1, p2;
if (time >= lightning_end)
{ // done here, put the terminals back up
if (time >= lightning_end) { // done here, put the terminals back up
self = le1;
door_go_down ();
self = le2;
door_go_down ();
return;
}
p1 = (le1.mins + le1.maxs) * 0.5;
p1_z = le1.absmin_z - 16;
p2 = (le2.mins + le2.maxs) * 0.5;
p2_z = le2.absmin_z - 16;
// compensate for length of bolt
p2 = p2 - normalize(p2-p1)*100;
p2 -= normalize (p2 - p1) * 100;
self.nextthink = time + 0.1;
self.think = lightning_fire;
WriteByte (MSG_ALL, SVC_TEMPENTITY);
WriteByte (MSG_ALL, TE_LIGHTNING3);
WriteBytes (MSG_ALL, SVC_TEMPENTITY, TE_LIGHTNING3);
WriteEntity (MSG_ALL, world);
WriteCoord (MSG_ALL, p1_x);
WriteCoord (MSG_ALL, p1_y);
WriteCoord (MSG_ALL, p1_z);
WriteCoord (MSG_ALL, p2_x);
WriteCoord (MSG_ALL, p2_y);
WriteCoord (MSG_ALL, p2_z);
WriteCoordV (MSG_ALL, p1);
WriteCoordV (MSG_ALL, p2);
};
void() lightning_use =
@ -330,38 +311,34 @@ void() lightning_use =
if (lightning_end >= time + 1)
return;
le1 = find( world, target, "lightning");
le2 = find( le1, target, "lightning");
if (!le1 || !le2)
{
le1 = find (world, target, "lightning");
le2 = find (le1, target, "lightning");
if (!le1 || !le2) {
dprint ("missing lightning targets\n");
return;
}
if (
(le1.state != STATE_TOP && le1.state != STATE_BOTTOM)
|| (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
|| (le1.state != le2.state) )
{
if ((le1.state != STATE_TOP && le1.state != STATE_BOTTOM)
|| (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
|| (le1.state != le2.state)) {
// dprint ("not aligned\n");
return;
}
// don't let the electrodes go back up until the bolt is done
// don't let the electrodes go back up until the bolt is done
le1.nextthink = -1;
le2.nextthink = -1;
lightning_end = time + 1;
sound (self, CHAN_VOICE, "misc/power.wav", 1, ATTN_NORM);
lightning_fire ();
lightning_fire ();
// advance the boss pain if down
// advance the boss pain if down
self = find (world, classname, "monster_boss");
if (!self)
return;
self.enemy = activator;
if (le1.state == STATE_TOP && self.health > 0)
{
if (le1.state == STATE_TOP && self.health > 0) {
sound (self, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
self.health = self.health - 1;
if (self.health >= 2)
@ -370,10 +347,9 @@ void() lightning_use =
boss_shockb1();
else if (self.health == 0)
boss_shockc1();
}
}
};
/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16)
Just for boss level.
*/
@ -381,5 +357,3 @@ void() event_lightning =
{
self.use = lightning_use;
};

View file

@ -9,7 +9,7 @@ void() button_wait =
self.nextthink = self.ltime + self.wait;
self.think = button_return;
activator = self.enemy;
SUB_UseTargets();
SUB_UseTargets ();
self.frame = 1; // use alternate textures
};
@ -27,12 +27,11 @@ void() button_return =
self.takedamage = DAMAGE_YES; // can be shot again
};
void() button_blocked =
{ // do nothing, just don't ome all the way back out
{
// do nothing, just don't come all the way back out
};
void() button_fire =
{
if (self.state == STATE_UP || self.state == STATE_TOP)
@ -44,7 +43,6 @@ void() button_fire =
SUB_CalcMove (self.pos2, self.speed, button_wait);
};
void() button_use =
{
self.enemy = activator;
@ -67,7 +65,6 @@ void() button_killed =
button_fire ();
};
/*QUAKED func_button (0 .5 .8) ?
When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
@ -85,27 +82,25 @@ When a button is touched, it moves some distance in the direction of it's angle,
*/
void() func_button =
{
if (self.sounds == 0)
{
switch (self.sounds) {
case 0:
precache_sound ("buttons/airbut1.wav");
self.noise = "buttons/airbut1.wav";
}
if (self.sounds == 1)
{
break;
case 1:
precache_sound ("buttons/switch21.wav");
self.noise = "buttons/switch21.wav";
}
if (self.sounds == 2)
{
break;
case 2:
precache_sound ("buttons/switch02.wav");
self.noise = "buttons/switch02.wav";
}
if (self.sounds == 3)
{
break;
case 3:
precache_sound ("buttons/switch04.wav");
self.noise = "buttons/switch04.wav";
break;
}
SetMovedir ();
self.movetype = MOVETYPE_PUSH;
@ -115,13 +110,11 @@ void() func_button =
self.blocked = button_blocked;
self.use = button_use;
if (self.health)
{
if (self.health) {
self.max_health = self.health;
self.th_die = button_killed;
self.takedamage = DAMAGE_YES;
}
else
} else
self.touch = button_touch;
if (!self.speed)
@ -134,6 +127,6 @@ void() func_button =
self.state = STATE_BOTTOM;
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);
};

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,3 @@
void() T_MissileTouch;
void() info_player_start;
void(entity targ, entity attacker) ClientObituary;
@ -19,9 +18,9 @@ explosions and melee attacks.
float(entity targ, entity inflictor) CanDamage =
{
// bmodels need special checking because their origin is 0,0,0
if (targ.movetype == MOVETYPE_PUSH)
{
traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
if (targ.movetype == MOVETYPE_PUSH) {
traceline (inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE,
self);
if (trace_fraction == 1)
return TRUE;
if (trace_ent == targ)
@ -29,26 +28,25 @@ float(entity targ, entity inflictor) CanDamage =
return FALSE;
}
traceline(inflictor.origin, targ.origin, TRUE, self);
traceline (inflictor.origin, targ.origin, TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
return FALSE;
};
/*
============
Killed
@ -64,8 +62,8 @@ void(entity targ, entity attacker) Killed =
if (self.health < -99)
self.health = -99; // don't let sbar look bad if a player
if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
{ // doors, triggers, etc
if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE) {
// doors, triggers, etc
self.th_die ();
self = oself;
return;
@ -73,9 +71,8 @@ void(entity targ, entity attacker) Killed =
self.enemy = attacker;
// bump the monster counter
if (self.flags & FL_MONSTER)
{
// bump the monster counter
if (self.flags & FL_MONSTER) {
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
}
@ -92,7 +89,6 @@ void(entity targ, entity attacker) Killed =
self = oself;
};
/*
============
T_Damage
@ -109,15 +105,13 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
local float take;
local string attackerteam, targteam;
if (!targ.takedamage)
return;
// used by buttons and triggers to set activator for target firing
// used by buttons and triggers to set activator for target firing
damage_attacker = attacker;
// check for quad damage powerup on the attacker
// check for quad damage powerup on the attacker
if (attacker.super_damage_finished > time && inflictor.classname != "door")
if (deathmatch == 4)
damage = damage * 8;
@ -127,8 +121,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
// save damage based on the target's armor level
save = ceil(targ.armortype*damage);
if (save >= targ.armorvalue)
{
if (save >= targ.armorvalue) {
save = targ.armorvalue;
targ.armortype = 0; // lost all armor
targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
@ -137,11 +130,10 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
targ.armorvalue = targ.armorvalue - save;
take = ceil(damage-save);
// add to the damage total for clients, which will be sent as a single
// message at the end of the frame
// FIXME: remove after combining shotgun blasts?
if (targ.flags & FL_CLIENT)
{
// add to the damage total for clients, which will be sent as a single
// message at the end of the frame
// FIXME: remove after combining shotgun blasts?
if (targ.flags & FL_CLIENT) {
targ.dmg_take = targ.dmg_take + take;
targ.dmg_save = targ.dmg_save + save;
targ.dmg_inflictor = inflictor;
@ -149,10 +141,8 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
damage_inflictor = inflictor;
// figure momentum add
if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
{
// figure momentum add
if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) ) {
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
dir = normalize(dir);
// Set kickback for smaller weapons
@ -161,33 +151,28 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
// if ( (damage < 60) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname != targ.netname))
// targ.velocity = targ.velocity + dir * damage * 11;
// else
// Otherwise, these rules apply to rockets and grenades
// Otherwise, these rules apply to rockets and grenades
// for blast velocity
targ.velocity = targ.velocity + dir * damage * 8;
targ.velocity = targ.velocity + dir * damage * 8;
// Rocket Jump modifiers
if ( (rj > 1) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname == targ.netname))
targ.velocity = targ.velocity + dir * damage * rj;
}
// check for godmode or invincibility
// check for godmode or invincibility
if (targ.flags & FL_GODMODE)
return;
if (targ.invincible_finished >= time)
{
if (self.invincible_sound < time)
{
if (targ.invincible_finished >= time) {
if (self.invincible_sound < time) {
sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
self.invincible_sound = time + 2;
}
return;
}
// team play damage avoidance
//ZOID 12-13-96: self.team doesn't work in QW. Use keys
// team play damage avoidance
//ZOID 12-13-96: self.team doesn't work in QW. Use keys
attackerteam = infokey(attacker, "team");
targteam = infokey(targ, "team");
@ -200,28 +185,24 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
(attacker.classname == "player") && (attackerteam != "") &&
(targ != attacker)&& inflictor.classname !="door")
return;
// do the damage
// do the damage
targ.health = targ.health - take;
if (targ.health <= 0)
{
if (targ.health <= 0) {
Killed (targ, attacker);
return;
}
// react to the damage
// react to the damage
oldself = self;
self = targ;
if ( (self.flags & FL_MONSTER) && attacker != world)
{
if ( (self.flags & FL_MONSTER) && attacker != world) {
// get mad unless of the same class (except for soldiers)
if (self != attacker && attacker != self.enemy)
{
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )
{
if (self != attacker && attacker != self.enemy) {
if ((self.classname != attacker.classname)
|| (self.classname == "monster_army")) {
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;
self.enemy = attacker;
@ -230,8 +211,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
}
}
if (self.th_pain)
{
if (self.th_pain) {
self.th_pain (attacker, take);
// nightmare mode monsters don't go into pain frames often
if (skill == 3)
@ -254,17 +234,14 @@ void(entity inflictor, entity attacker, float damage, entity ignore, string dtyp
head = findradius(inflictor.origin, damage+40);
while (head)
{
//bprint (PRINT_HIGH, head.classname);
//bprint (PRINT_HIGH, " | ");
//bprint (PRINT_HIGH, head.netname);
//bprint (PRINT_HIGH, "\n");
while (head) {
// bprint (PRINT_HIGH, head.classname);
// bprint (PRINT_HIGH, " | ");
// bprint (PRINT_HIGH, head.netname);
// bprint (PRINT_HIGH, "\n");
if (head != ignore)
{
if (head.takedamage)
{
if (head != ignore) {
if (head.takedamage) {
org = head.origin + (head.mins + head.maxs)*0.5;
points = 0.5*vlen (inflictor.origin - org);
if (points < 0)
@ -273,10 +250,8 @@ void(entity inflictor, entity attacker, float damage, entity ignore, string dtyp
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
if (CanDamage (head, inflictor))
{
if (points > 0) {
if (CanDamage (head, inflictor)) {
head.deathtype = dtype;
// shambler takes half damage from all explosions
if (head.classname == "monster_shambler")
@ -284,7 +259,6 @@ void(entity inflictor, entity attacker, float damage, entity ignore, string dtyp
else
T_Damage (head, inflictor, attacker, points);
}
}
}
}
@ -304,20 +278,16 @@ void(entity attacker, float damage) T_BeamDamage =
head = findradius(attacker.origin, damage+40);
while (head)
{
if (head.takedamage)
{
points = 0.5*vlen (attacker.origin - head.origin);
while (head) {
if (head.takedamage) {
points = 0.5 * vlen (attacker.origin - head.origin);
if (points < 0)
points = 0;
points = damage - points;
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
if (CanDamage (head, attacker))
{
if (points > 0) {
if (CanDamage (head, attacker)) {
if (head.classname == "monster_shambler")
T_Damage (head, attacker, attacker, points*0.5);
else
@ -328,4 +298,3 @@ void(entity attacker, float damage) T_BeamDamage =
head = head.chain;
}
};

File diff suppressed because it is too large Load diff

View file

@ -48,9 +48,9 @@ void() demon1_stand12 =[ $stand12, demon1_stand13 ] {ai_stand();};
void() demon1_stand13 =[ $stand13, demon1_stand1 ] {ai_stand();};
void() demon1_walk1 =[ $walk1, demon1_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_walk(8);
if (random () < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_walk (8);
};
void() demon1_walk2 =[ $walk2, demon1_walk3 ] {ai_walk(6);};
void() demon1_walk3 =[ $walk3, demon1_walk4 ] {ai_walk(6);};
@ -61,9 +61,9 @@ void() demon1_walk7 =[ $walk7, demon1_walk8 ] {ai_walk(10);};
void() demon1_walk8 =[ $walk8, demon1_walk1 ] {ai_walk(10);};
void() demon1_run1 =[ $run1, demon1_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_run(20);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
ai_run (20);};
void() demon1_run2 =[ $run2, demon1_run3 ] {ai_run(15);};
void() demon1_run3 =[ $run3, demon1_run4 ] {ai_run(36);};
void() demon1_run4 =[ $run4, demon1_run5 ] {ai_run(20);};
@ -97,7 +97,6 @@ self.nextthink = time + 3;
void() demon1_jump11 =[ $leap11, demon1_jump12 ] {};
void() demon1_jump12 =[ $leap12, demon1_run1 ] {};
void() demon1_atta1 =[ $attacka1, demon1_atta2 ] {ai_charge(4);};
void() demon1_atta2 =[ $attacka2, demon1_atta3 ] {ai_charge(0);};
void() demon1_atta3 =[ $attacka3, demon1_atta4 ] {ai_charge(0);};
@ -132,7 +131,7 @@ void(entity attacker, float damage) demon1_pain =
self.pain_finished = time + 1;
sound (self, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
if (random()*200 > damage)
if (random () * 200 > damage)
return; // didn't flinch
demon1_pain1 ();
@ -152,9 +151,8 @@ void() demon1_die9 =[ $death9, demon1_die9 ] {};
void() demon_die =
{
// check for gib
if (self.health < -80)
{
// check for gib
if (self.health < -80) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_demon.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -179,8 +177,7 @@ void() Demon_MeleeAttack =
*/
void() monster_demon1 =
{
if (deathmatch)
{
if (deathmatch) {
remove(self);
return;
}
@ -210,17 +207,10 @@ void() monster_demon1 =
self.th_missile = demon1_jump1; // jump attack
self.th_pain = demon1_pain;
walkmonster_start();
walkmonster_start ();
};
/*
==============================================================================
DEMON
==============================================================================
*/
// DEMON ======================================================================
/*
==============
@ -231,8 +221,7 @@ Returns TRUE if a melee attack would hit right now
*/
float() CheckDemonMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
if (enemy_range == RANGE_MELEE) { // FIXME: check canreach
self.attack_state = AS_MELEE;
return TRUE;
}
@ -247,28 +236,27 @@ CheckDemonJump
*/
float() CheckDemonJump =
{
local vector dist;
local float d;
local vector dist;
local float d;
if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ 0.75 * self.enemy.size_z)
+ 0.75 * self.enemy.size_z)
return FALSE;
if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ 0.25 * self.enemy.size_z)
+ 0.25 * self.enemy.size_z)
return FALSE;
dist = self.enemy.origin - self.origin;
dist_z = 0;
d = vlen(dist);
d = vlen (dist);
if (d < 100)
return FALSE;
if (d > 200)
{
if (random() < 0.9)
if (d > 200) {
if (random () < 0.9)
return FALSE;
}
@ -277,15 +265,13 @@ float() CheckDemonJump =
float() DemonCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDemonMelee ())
{
// if close enough for slashing, go for it
if (CheckDemonMelee ()) {
self.attack_state = AS_MELEE;
return TRUE;
}
if (CheckDemonJump ())
{
if (CheckDemonJump ()) {
self.attack_state = AS_MISSILE;
sound (self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
return TRUE;
@ -299,7 +285,7 @@ float() DemonCheckAttack =
void(float side) Demon_Melee =
{
local float ldmg;
local float ldmg;
local vector delta;
ai_face ();
@ -307,47 +293,42 @@ void(float side) Demon_Melee =
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
if (vlen (delta) > 100)
return;
if (!CanDamage (self.enemy, self))
return;
sound (self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
ldmg = 10 + 5*random();
ldmg = 10 + 5 * random ();
T_Damage (self.enemy, self, self, ldmg);
makevectors (self.angles);
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
};
void() Demon_JumpTouch =
{
local float ldmg;
local float ldmg;
if (self.health <= 0)
return;
if (other.takedamage)
{
if ( vlen(self.velocity) > 400 )
{
ldmg = 40 + 10*random();
if (other.takedamage) {
if (vlen (self.velocity) > 400) {
ldmg = 40 + 10 * random ();
T_Damage (other, self, self, ldmg);
}
}
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
//dprint ("popjump\n");
self.touch = SUB_Null;
self.think = demon1_jump1;
self.nextthink = time + 0.1;
if (!checkbottom (self)) {
if (self.flags & FL_ONGROUND) { // jump randomly to not get hung up
// dprint ("popjump\n");
self.touch = SUB_Null;
self.think = demon1_jump1;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
// self.velocity_x = (random () - 0.5) * 600;
// self.velocity_y = (random () - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
@ -358,4 +339,3 @@ void() Demon_JumpTouch =
self.think = demon1_jump11;
self.nextthink = time + 0.1;
};

View file

@ -42,8 +42,8 @@ dog_bite
*/
void() dog_bite =
{
local vector delta;
local float ldmg;
local vector delta;
local float ldmg;
if (!self.enemy)
return;
@ -58,7 +58,7 @@ local float ldmg;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 8;
ldmg = (random () + random () + random ()) * 8;
T_Damage (self.enemy, self, self, ldmg);
};
@ -69,26 +69,22 @@ void() Dog_JumpTouch =
if (self.health <= 0)
return;
if (other.takedamage)
{
if ( vlen(self.velocity) > 300 )
{
ldmg = 10 + 10*random();
if (other.takedamage) {
if (vlen (self.velocity) > 300) {
ldmg = 10 + 10 * random ();
T_Damage (other, self, self, ldmg);
}
}
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
//dprint ("popjump\n");
self.touch = SUB_Null;
self.think = dog_leap1;
self.nextthink = time + 0.1;
if (!checkbottom (self)) {
if (self.flags & FL_ONGROUND) { // jump randomly to not get hung up
// dprint ("popjump\n");
self.touch = SUB_Null;
self.think = dog_leap1;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
// self.velocity_x = (random () - 0.5) * 600;
// self.velocity_y = (random () - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
@ -112,9 +108,9 @@ void() dog_stand8 =[ $stand8, dog_stand9 ] {ai_stand();};
void() dog_stand9 =[ $stand9, dog_stand1 ] {ai_stand();};
void() dog_walk1 =[ $walk1 , dog_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_walk(8);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_walk (8);};
void() dog_walk2 =[ $walk2 , dog_walk3 ] {ai_walk(8);};
void() dog_walk3 =[ $walk3 , dog_walk4 ] {ai_walk(8);};
void() dog_walk4 =[ $walk4 , dog_walk5 ] {ai_walk(8);};
@ -124,9 +120,9 @@ void() dog_walk7 =[ $walk7 , dog_walk8 ] {ai_walk(8);};
void() dog_walk8 =[ $walk8 , dog_walk1 ] {ai_walk(8);};
void() dog_run1 =[ $run1 , dog_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
ai_run (16);};
void() dog_run2 =[ $run2 , dog_run3 ] {ai_run(32);};
void() dog_run3 =[ $run3 , dog_run4 ] {ai_run(32);};
void() dog_run4 =[ $run4 , dog_run5 ] {ai_run(20);};
@ -199,7 +195,7 @@ void(entity attacker, float damage) dog_pain =
{
sound (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);
if (random() > 0.5)
if (random () > 0.5)
dog_pain1 ();
else
dog_painb1 ();
@ -225,12 +221,10 @@ void() dog_dieb7 =[ $deathb7, dog_dieb8 ] {};
void() dog_dieb8 =[ $deathb8, dog_dieb9 ] {};
void() dog_dieb9 =[ $deathb9, dog_dieb9 ] {};
void() dog_die =
{
// check for gib
if (self.health < -35)
{
// check for gib
if (self.health < -35) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowGib ("progs/gib3.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
@ -239,11 +233,11 @@ void() dog_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
if (random() > 0.5)
if (random () > 0.5)
dog_die1 ();
else
dog_dieb1 ();
@ -260,8 +254,7 @@ Returns TRUE if a melee attack would hit right now
*/
float() CheckDogMelee =
{
if (enemy_range == RANGE_MELEE)
{ // FIXME: check canreach
if (enemy_range == RANGE_MELEE) { // FIXME: check canreach
self.attack_state = AS_MELEE;
return TRUE;
}
@ -280,17 +273,17 @@ float() CheckDogJump =
local float d;
if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ 0.75 * self.enemy.size_z)
+ 0.75 * self.enemy.size_z)
return FALSE;
if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ 0.25 * self.enemy.size_z)
+ 0.25 * self.enemy.size_z)
return FALSE;
dist = self.enemy.origin - self.origin;
dist_z = 0;
d = vlen(dist);
d = vlen (dist);
if (d < 80)
return FALSE;
@ -304,14 +297,12 @@ float() CheckDogJump =
float() DogCheckAttack =
{
// if close enough for slashing, go for it
if (CheckDogMelee ())
{
if (CheckDogMelee ()) {
self.attack_state = AS_MELEE;
return TRUE;
}
if (CheckDogJump ())
{
if (CheckDogJump ()) {
self.attack_state = AS_MISSILE;
return TRUE;
}
@ -319,7 +310,6 @@ float() DogCheckAttack =
return FALSE;
};
//===========================================================================
/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) Ambush
@ -327,11 +317,11 @@ float() DogCheckAttack =
*/
void() monster_dog =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model ("progs/h_dog.mdl");
precache_model ("progs/dog.mdl");
@ -357,5 +347,5 @@ void() monster_dog =
self.th_melee = dog_atta1;
self.th_missile = dog_leap1;
walkmonster_start();
walkmonster_start ();
};

View file

@ -1,4 +1,3 @@
float DOOR_START_OPEN = 1;
float DOOR_DONT_LINK = 4;
float DOOR_GOLD_KEY = 8;
@ -6,7 +5,6 @@ float DOOR_SILVER_KEY = 16;
float DOOR_TOGGLE = 32;
/*
Doors are similar to buttons, but can spawn a fat trigger field around them
to open without a touch, and they link together to form simultanious
double/quad doors.
@ -15,7 +13,6 @@ Door.owner is the master door. If there is only one door, it points to itself.
If multiple doors, all will point to a single one.
Door.enemy chains from the master door through all doors linked in the chain.
*/
/*
@ -36,8 +33,7 @@ void() door_blocked =
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if (self.wait >= 0)
{
if (self.wait >= 0) {
if (self.state == STATE_DOWN)
door_go_up ();
else
@ -65,8 +61,7 @@ void() door_hit_bottom =
void() door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
if (self.max_health)
{
if (self.max_health) {
self.takedamage = DAMAGE_YES;
self.health = self.max_health;
}
@ -80,8 +75,7 @@ void() door_go_up =
if (self.state == STATE_UP)
return; // allready going up
if (self.state == STATE_TOP)
{ // reset top wait time
if (self.state == STATE_TOP) { // reset top wait time
self.nextthink = self.ltime + self.wait;
return;
}
@ -93,7 +87,6 @@ void() door_go_up =
SUB_UseTargets();
};
/*
=============================================================================
@ -110,34 +103,29 @@ void() door_fire =
if (self.owner != self)
objerror ("door_fire: self.owner != self");
// play use key sound
// play use key sound
if (self.items)
sound (self, CHAN_VOICE, self.noise4, 1, ATTN_NORM);
self.message = string_null; // no more message
oself = self;
if (self.spawnflags & DOOR_TOGGLE)
{
if (self.state == STATE_UP || self.state == STATE_TOP)
{
if (self.spawnflags & DOOR_TOGGLE) {
if (self.state == STATE_UP || self.state == STATE_TOP) {
starte = self;
do
{
do {
door_go_down ();
self = self.enemy;
} while ( (self != starte) && (self != world) );
} while ((self != starte) && (self != world));
self = oself;
return;
}
}
// trigger all paired doors
// trigger all paired doors
starte = self;
do
{
do {
self.goalentity = activator; // Who fired us
door_go_up ();
self = self.enemy;
@ -189,7 +177,6 @@ void() door_killed =
self = oself;
};
/*
================
door_touch
@ -206,51 +193,36 @@ void() door_touch =
self.owner.attack_finished = time + 2;
if (self.owner.message != "")
{
if (self.owner.message != "") {
centerprint (other, self.owner.message);
sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
// key door stuff
// key door stuff
if (!self.items)
return;
// FIXME: blink key on player's status bar
if ( (self.items & other.items) != self.items )
{
if (self.owner.items == IT_KEY1)
{
if (world.worldtype == 2)
{
// FIXME: blink key on player's status bar
if ((self.items & other.items) != self.items) {
if (self.owner.items == IT_KEY1) {
if (world.worldtype == 2) {
centerprint (other, "You need the silver keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
} else if (world.worldtype == 1) {
centerprint (other, "You need the silver runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
} else if (world.worldtype == 0) {
centerprint (other, "You need the silver key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
}
else
{
if (world.worldtype == 2)
{
} else {
if (world.worldtype == 2) {
centerprint (other, "You need the gold keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
} else if (world.worldtype == 1) {
centerprint (other, "You need the gold runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
} else if (world.worldtype == 0) {
centerprint (other, "You need the gold key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
@ -273,7 +245,6 @@ SPAWNING FUNCTIONS
=============================================================================
*/
entity(vector fmins, vector fmaxs) spawn_field =
{
local entity trigger;
@ -309,12 +280,9 @@ float (entity e1, entity e2) EntitiesTouching =
return TRUE;
};
/*
=============
LinkDoors
=============
*/
void() LinkDoors =
@ -324,8 +292,7 @@ void() LinkDoors =
if (self.enemy)
return; // already linked by another door
if (self.spawnflags & 4)
{
if (self.spawnflags & 4) {
self.owner = self.enemy = self;
return; // don't want to link this door
}
@ -336,8 +303,7 @@ void() LinkDoors =
starte = self;
t = self;
do
{
do {
self.owner = starte; // master door
if (self.health)
@ -348,12 +314,11 @@ void() LinkDoors =
starte.message = self.message;
t = find (t, classname, self.classname);
if (!t)
{
if (!t) {
self.enemy = starte; // make the chain a loop
// shootable, fired, or key doors just needed the owner/enemy links,
// they don't spawn a field
// shootable, fired, or key doors just needed the owner/enemy
// links, they don't spawn a field
self = self.owner;
@ -369,8 +334,7 @@ void() LinkDoors =
return;
}
if (EntitiesTouching(self,t))
{
if (EntitiesTouching (self, t)) {
if (t.enemy)
objerror ("cross connected doors");
@ -390,11 +354,9 @@ void() LinkDoors =
if (t.maxs_z > cmaxs_z)
cmaxs_z = t.maxs_z;
}
} while (1 );
} while (1);
};
/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
if two doors touch, they are assumed to be connected and operate as a unit.
@ -421,71 +383,53 @@ Key doors are allways wait -1.
*/
void() func_door =
{
if (world.worldtype == 0)
{
if (world.worldtype == 0) {
precache_sound ("doors/medtry.wav");
precache_sound ("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
}
else if (world.worldtype == 1)
{
} else if (world.worldtype == 1) {
precache_sound ("doors/runetry.wav");
precache_sound ("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
}
else if (world.worldtype == 2)
{
} else if (world.worldtype == 2) {
precache_sound ("doors/basetry.wav");
precache_sound ("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
}
else
{
} else {
dprint ("no worldtype set!\n");
}
if (self.sounds == 0)
{
if (self.sounds == 0) {
precache_sound ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = "misc/null.wav";
self.noise2 = "misc/null.wav";
}
if (self.sounds == 1)
{
} if (self.sounds == 1) {
precache_sound ("doors/drclos4.wav");
precache_sound ("doors/doormv1.wav");
self.noise1 = "doors/drclos4.wav";
self.noise2 = "doors/doormv1.wav";
}
if (self.sounds == 2)
{
} if (self.sounds == 2) {
precache_sound ("doors/hydro1.wav");
precache_sound ("doors/hydro2.wav");
self.noise2 = "doors/hydro1.wav";
self.noise1 = "doors/hydro2.wav";
}
if (self.sounds == 3)
{
} if (self.sounds == 3) {
precache_sound ("doors/stndr1.wav");
precache_sound ("doors/stndr2.wav");
self.noise2 = "doors/stndr1.wav";
self.noise1 = "doors/stndr2.wav";
}
if (self.sounds == 4)
{
} if (self.sounds == 4) {
precache_sound ("doors/ddoor1.wav");
precache_sound ("doors/ddoor2.wav");
self.noise1 = "doors/ddoor2.wav";
self.noise2 = "doors/ddoor1.wav";
}
SetMovedir ();
self.max_health = self.health;
@ -515,10 +459,9 @@ void() func_door =
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
if (self.spawnflags & DOOR_START_OPEN)
{
// DOOR_START_OPEN is to allow an entity to be lighted in the closed
// position but spawn in the open position
if (self.spawnflags & DOOR_START_OPEN) {
setorigin (self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
@ -526,8 +469,7 @@ void() func_door =
self.state = STATE_BOTTOM;
if (self.health)
{
if (self.health) {
self.takedamage = DAMAGE_YES;
self.th_die = door_killed;
}
@ -537,8 +479,8 @@ void() func_door =
self.touch = door_touch;
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
self.think = LinkDoors;
self.nextthink = self.ltime + 0.1;
};
@ -580,23 +522,20 @@ void () fd_secret_use =
SUB_UseTargets(); // fire all targets / killtargets
if (!(self.spawnflags & SECRET_NO_SHOOT))
{
if (!(self.spawnflags & SECRET_NO_SHOOT)) {
//XXX needed? self.th_pain = SUB_Null;
self.takedamage = DAMAGE_NO;
}
self.velocity = '0 0 0';
// Make a sound, wait a little...
sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.nextthink = self.ltime + 0.1;
temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
makevectors(self.mangle);
if (!self.t_width)
{
if (!self.t_width) {
if (self.spawnflags & SECRET_1ST_DOWN)
self. t_width = fabs(v_up * self.size);
else
@ -640,8 +579,7 @@ void () fd_secret_move2 =
void () fd_secret_move3 =
{
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE))
{
if (!(self.spawnflags & SECRET_OPEN_ONCE)) {
self.nextthink = self.ltime + self.wait;
self.think = fd_secret_move4;
}
@ -670,8 +608,7 @@ void () fd_secret_move6 =
void () fd_secret_done =
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) {
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;
@ -705,8 +642,7 @@ void() secret_touch =
self.attack_finished = time + 2;
if (self.message)
{
if (self.message) {
centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
@ -734,8 +670,7 @@ void () func_door_secret =
{
if (self.sounds == 0)
self.sounds = 3;
if (self.sounds == 1)
{
if (self.sounds == 1) {
precache_sound ("doors/latch2.wav");
precache_sound ("doors/winch2.wav");
precache_sound ("doors/drclos4.wav");
@ -743,16 +678,14 @@ void () func_door_secret =
self.noise2 = "doors/winch2.wav";
self.noise3 = "doors/drclos4.wav";
}
if (self.sounds == 2)
{
if (self.sounds == 2) {
precache_sound ("doors/airdoor1.wav");
precache_sound ("doors/airdoor2.wav");
self.noise2 = "doors/airdoor1.wav";
self.noise1 = "doors/airdoor2.wav";
self.noise3 = "doors/airdoor2.wav";
}
if (self.sounds == 3)
{
if (self.sounds == 3) {
precache_sound ("doors/basesec1.wav");
precache_sound ("doors/basesec2.wav");
self.noise2 = "doors/basesec1.wav";
@ -762,7 +695,7 @@ void () func_door_secret =
if (!self.dmg)
self.dmg = 2;
// Magic formula...
self.mangle = self.angles;
self.angles = '0 0 0';
@ -771,13 +704,12 @@ void () func_door_secret =
self.classname = "door";
setmodel (self, self.model);
setorigin (self, self.origin);
self.touch = secret_touch;
self.blocked = secret_blocked;
self.speed = 50;
self.use = fd_secret_use;
if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
if (!self.targetname || self.spawnflags & SECRET_YES_SHOOT) {
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;

View file

@ -42,9 +42,9 @@ void() enforcer_fire =
{
local vector org;
muzzleflash();
muzzleflash ();
makevectors (self.angles);
org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
LaunchLaser(org, self.enemy.origin - self.origin);
@ -61,9 +61,10 @@ void() enf_stand6 =[ $stand6, enf_stand7 ] {ai_stand();};
void() enf_stand7 =[ $stand7, enf_stand1 ] {ai_stand();};
void() enf_walk1 =[ $walk1 , enf_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_walk(2);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_walk (2);
};
void() enf_walk2 =[ $walk2 , enf_walk3 ] {ai_walk(4);};
void() enf_walk3 =[ $walk3 , enf_walk4 ] {ai_walk(4);};
void() enf_walk4 =[ $walk4 , enf_walk5 ] {ai_walk(3);};
@ -81,9 +82,10 @@ void() enf_walk15 =[ $walk15, enf_walk16 ] {ai_walk(4);};
void() enf_walk16 =[ $walk16, enf_walk1 ] {ai_walk(2);};
void() enf_run1 =[ $run1 , enf_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_run(18);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
ai_run (18);
};
void() enf_run2 =[ $run2 , enf_run3 ] {ai_run(14);};
void() enf_run3 =[ $run3 , enf_run4 ] {ai_run(7);};
void() enf_run4 =[ $run4 , enf_run5 ] {ai_run(12);};
@ -105,8 +107,9 @@ void() enf_atk10 =[ $attack6, enf_atk11 ] {enforcer_fire();};
void() enf_atk11 =[ $attack7, enf_atk12 ] {ai_face();};
void() enf_atk12 =[ $attack8, enf_atk13 ] {ai_face();};
void() enf_atk13 =[ $attack9, enf_atk14 ] {ai_face();};
void() enf_atk14 =[ $attack10, enf_run1 ] {ai_face();
SUB_CheckRefire (enf_atk1);
void() enf_atk14 =[ $attack10, enf_run1 ] {
ai_face();
SUB_CheckRefire (enf_atk1);
};
void() enf_paina1 =[ $paina1, enf_paina2 ] {};
@ -153,33 +156,25 @@ void(entity attacker, float damage) enf_pain =
{
local float r;
r = random ();
if (self.pain_finished > time)
return;
r = random ();
if (r < 0.5)
sound (self, CHAN_VOICE, "enforcer/pain1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enforcer/pain2.wav", 1, ATTN_NORM);
if (r < 0.2)
{
if (r < 0.2) {
self.pain_finished = time + 1;
enf_paina1 ();
}
else if (r < 0.4)
{
} else if (r < 0.4) {
self.pain_finished = time + 1;
enf_painb1 ();
}
else if (r < 0.7)
{
} else if (r < 0.7) {
self.pain_finished = time + 1;
enf_painc1 ();
}
else
{
} else {
self.pain_finished = time + 2;
enf_paind1 ();
}
@ -187,13 +182,13 @@ void(entity attacker, float damage) enf_pain =
//============================================================================
void() enf_die1 =[ $death1, enf_die2 ] {};
void() enf_die2 =[ $death2, enf_die3 ] {};
void() enf_die3 =[ $death3, enf_die4 ]
{self.solid = SOLID_NOT;self.ammo_cells = 5;DropBackpack();};
void() enf_die3 =[ $death3, enf_die4 ] {
self.solid = SOLID_NOT;
self.ammo_cells = 5;
DropBackpack();
};
void() enf_die4 =[ $death4, enf_die5 ] {ai_forward(14);};
void() enf_die5 =[ $death5, enf_die6 ] {ai_forward(2);};
void() enf_die6 =[ $death6, enf_die7 ] {};
@ -206,12 +201,13 @@ void() enf_die12 =[ $death12, enf_die13 ] {ai_forward(5);};
void() enf_die13 =[ $death13, enf_die14 ] {};
void() enf_die14 =[ $death14, enf_die14 ] {};
void() enf_fdie1 =[ $fdeath1, enf_fdie2 ] {
};
void() enf_fdie1 =[ $fdeath1, enf_fdie2 ] {};
void() enf_fdie2 =[ $fdeath2, enf_fdie3 ] {};
void() enf_fdie3 =[ $fdeath3, enf_fdie4 ]
{self.solid = SOLID_NOT;self.ammo_cells = 5;DropBackpack();};
void() enf_fdie3 =[ $fdeath3, enf_fdie4 ] {
self.solid = SOLID_NOT;
self.ammo_cells = 5;
DropBackpack();
};
void() enf_fdie4 =[ $fdeath4, enf_fdie5 ] {};
void() enf_fdie5 =[ $fdeath5, enf_fdie6 ] {};
void() enf_fdie6 =[ $fdeath6, enf_fdie7 ] {};
@ -221,12 +217,10 @@ void() enf_fdie9 =[ $fdeath9, enf_fdie10 ] {};
void() enf_fdie10 =[ $fdeath10, enf_fdie11 ] {};
void() enf_fdie11 =[ $fdeath11, enf_fdie11 ] {};
void() enf_die =
{
// check for gib
if (self.health < -35)
{
// check for gib
if (self.health < -35) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_mega.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -235,25 +229,23 @@ void() enf_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM);
if (random() > 0.5)
if (random () > 0.5)
enf_die1 ();
else
enf_fdie1 ();
};
/*QUAKED monster_enforcer (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_enforcer =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model2 ("progs/enforcer.mdl");
precache_model2 ("progs/h_mega.mdl");
precache_model2 ("progs/laser.mdl");
@ -284,5 +276,5 @@ void() monster_enforcer =
self.th_die = enf_die;
self.th_missile = enf_atk1;
walkmonster_start();
walkmonster_start ();
};

View file

@ -1,11 +1,8 @@
/*
A monster is in fight mode if it thinks it can effectively attack its
enemy.
When it decides it can't attack, it goes into hunt mode.
*/
float(float v) anglemod;
@ -26,19 +23,18 @@ void(vector dest) ChooseTurn;
void() ai_face;
float enemy_vis, enemy_infront, enemy_range;
float enemy_yaw;
void() knight_attack =
{
local float len;
// decide if now is a good swing time
len = vlen (self.enemy.origin + self.enemy.view_ofs
- (self.origin + self.view_ofs));
// decide if now is a good swing time
len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
if (len<80)
if (len < 80)
knight_atk1 ();
else
knight_runatk1 ();
@ -61,8 +57,8 @@ float() CheckAttack =
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
@ -74,10 +70,8 @@ float() CheckAttack =
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (enemy_range == RANGE_MELEE)
{ // melee attack
if (self.th_melee)
{
if (enemy_range == RANGE_MELEE) { // melee attack
if (self.th_melee) {
if (self.classname == "monster_knight")
knight_attack ();
else
@ -85,8 +79,8 @@ float() CheckAttack =
return TRUE;
}
}
// missile attack
// missile attack
if (!self.th_missile)
return FALSE;
@ -95,40 +89,31 @@ float() CheckAttack =
if (enemy_range == RANGE_FAR)
return FALSE;
if (enemy_range == RANGE_MELEE)
{
if (enemy_range == RANGE_MELEE) {
chance = 0.9;
self.attack_finished = 0;
}
else if (enemy_range == RANGE_NEAR)
{
} else if (enemy_range == RANGE_NEAR) {
if (self.th_melee)
chance = 0.2;
else
chance = 0.4;
}
else if (enemy_range == RANGE_MID)
{
} else if (enemy_range == RANGE_MID) {
if (self.th_melee)
chance = 0.05;
else
chance = 0.1;
}
else
} else
chance = 0;
if (random () < chance)
{
if (random () < chance) {
self.th_missile ();
SUB_AttackFinished (2*random());
SUB_AttackFinished (2 * random ());
return TRUE;
}
return FALSE;
};
/*
=============
ai_face
@ -163,9 +148,8 @@ void() ai_charge_side =
{
local vector dtemp;
local float heading;
// aim to the left of the enemy for a flyby
// aim to the left of the enemy for a flyby
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
ChangeYaw ();
@ -176,7 +160,6 @@ void() ai_charge_side =
walkmove(heading, 20);
};
/*
=============
ai_melee
@ -193,10 +176,10 @@ void() ai_melee =
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 60)
if (vlen (delta) > 60)
return;
ldmg = (random() + random() + random()) * 3;
ldmg = (random () + random () + random ()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
@ -217,7 +200,7 @@ void() ai_melee_side =
return;
if (!CanDamage (self.enemy, self))
return;
ldmg = (random() + random() + random()) * 3;
ldmg = (random () + random () + random ()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
@ -239,8 +222,8 @@ float() SoldierCheckAttack =
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
@ -251,15 +234,13 @@ float() SoldierCheckAttack =
if (trace_ent != targ)
return FALSE; // don't have a clear shot
// missile attack
// missile attack
if (time < self.attack_finished)
return FALSE;
if (enemy_range == RANGE_FAR)
return FALSE;
if (enemy_range == RANGE_MELEE)
chance = 0.9;
else if (enemy_range == RANGE_NEAR)
@ -269,11 +250,10 @@ float() SoldierCheckAttack =
else
chance = 0;
if (random () < chance)
{
if (random () < chance) {
self.th_missile ();
SUB_AttackFinished (1 + random());
if (random() < 0.3)
SUB_AttackFinished (1 + random ());
if (random () < 0.3)
self.lefty = !self.lefty;
return TRUE;
@ -296,10 +276,8 @@ float() ShamCheckAttack =
local vector spot1, spot2;
local entity targ;
if (enemy_range == RANGE_MELEE)
{
if (CanDamage (self.enemy, self))
{
if (enemy_range == RANGE_MELEE) {
if (CanDamage (self.enemy, self)) {
self.attack_state = AS_MELEE;
return TRUE;
}
@ -312,8 +290,8 @@ float() ShamCheckAttack =
return FALSE;
targ = self.enemy;
// see if any entities are in the way of the shot
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
@ -325,17 +303,16 @@ float() ShamCheckAttack =
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
{
if (trace_ent != targ) {
return FALSE; // don't have a clear shot
}
// missile attack
// missile attack
if (enemy_range == RANGE_FAR)
return FALSE;
self.attack_state = AS_MISSILE;
SUB_AttackFinished (2 + 2*random());
SUB_AttackFinished (2 + 2 * random ());
return TRUE;
};
@ -355,10 +332,8 @@ float() OgreCheckAttack =
local entity targ;
local float chance;
if (enemy_range == RANGE_MELEE)
{
if (CanDamage (self.enemy, self))
{
if (enemy_range == RANGE_MELEE) {
if (CanDamage (self.enemy, self)) {
self.attack_state = AS_MELEE;
return TRUE;
}
@ -371,8 +346,8 @@ float() OgreCheckAttack =
return FALSE;
targ = self.enemy;
// see if any entities are in the way of the shot
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
@ -382,11 +357,9 @@ float() OgreCheckAttack =
return FALSE; // sight line crossed contents
if (trace_ent != targ)
{
return FALSE; // don't have a clear shot
}
// missile attack
// missile attack
if (time < self.attack_finished)
return FALSE;
@ -401,7 +374,6 @@ float() OgreCheckAttack =
chance = 0;
self.attack_state = AS_MISSILE;
SUB_AttackFinished (1 + 2*random());
SUB_AttackFinished (1 + 2 * random ());
return TRUE;
};

View file

@ -59,7 +59,7 @@ void() f_walk17 =[ $swim17, f_walk18 ] {ai_walk(8);};
void() f_walk18 =[ $swim18, f_walk1 ] {ai_walk(8);};
void() f_run1 =[ $swim1, f_run2 ] {ai_run(12);
if (random() < 0.5)
if (random () < 0.5)
sound (self, CHAN_VOICE, "fish/idle.wav", 1, ATTN_NORM);
};
void() f_run2 =[ $swim3, f_run3 ] {ai_run(12);};
@ -78,14 +78,14 @@ void() fish_melee =
if (!self.enemy)
return; // removed before stroke
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 60)
if (vlen (delta) > 60)
return;
sound (self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
ldmg = (random() + random()) * 3;
ldmg = (random () + random ()) * 3;
T_Damage (self.enemy, self, self, ldmg);
};
@ -109,7 +109,7 @@ void() f_attack17 =[ $attack17, f_attack18] {ai_charge(10);};
void() f_attack18 =[ $attack18, f_run1 ] {ai_charge(10);};
void() f_death1 =[ $death1, f_death2 ] {
sound (self, CHAN_VOICE, "fish/death.wav", 1, ATTN_NORM);
sound (self, CHAN_VOICE, "fish/death.wav", 1, ATTN_NORM);
};
void() f_death2 =[ $death2, f_death3 ] {};
void() f_death3 =[ $death3, f_death4 ] {};
@ -144,22 +144,19 @@ void() f_pain9 =[ $pain9, f_run1 ] {ai_pain(6);};
void(entity attacker, float damage) fish_pain =
{
// fish allways do pain frames
// fish allways do pain frames
f_pain1 ();
};
/*QUAKED monster_fish (1 0 0) (-16 -16 -24) (16 16 24) Ambush
*/
void() monster_fish =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model2 ("progs/fish.mdl");
precache_sound2 ("fish/death.wav");
@ -183,4 +180,3 @@ void() monster_fish =
swimmonster_start ();
};

View file

@ -5,4 +5,4 @@ void() deathball_touch;
void() item_deathball =
{
self.touch = deathball_touch;
};
};

View file

@ -68,45 +68,43 @@ void(float offset) hknight_shot =
org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
// set missile speed
// set missile speed
vec = normalize (v_forward);
vec_z = 0 - vec_z + (random() - 0.5)*0.1;
vec_z = 0 - vec_z + (random () - 0.5) * 0.1;
launch_spike (org, vec);
newmis.classname = "knightspike";
setmodel (newmis, "progs/k_spike.mdl");
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
newmis.velocity = vec*300;
newmis.velocity = vec * 300;
sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
};
void() CheckForCharge =
{
// check for mad charge
if (!enemy_vis)
return;
if (time < self.attack_finished)
return;
if ( fabs(self.origin_z - self.enemy.origin_z) > 20)
return; // too much height change
if ( vlen (self.origin - self.enemy.origin) < 80)
return; // use regular attack
// check for mad charge
if (!enemy_vis)
return;
if (time < self.attack_finished)
return;
if (fabs (self.origin_z - self.enemy.origin_z) > 20)
return; // too much height change
if (vlen (self.origin - self.enemy.origin) < 80)
return; // use regular attack
// charge
// charge
SUB_AttackFinished (2);
hknight_char_a1 ();
};
void() CheckContinueCharge =
{
if (time > self.attack_finished)
{
if (time > self.attack_finished) {
SUB_AttackFinished (3);
hknight_run1 ();
return; // done charging
}
if (random() > 0.5)
if (random () > 0.5)
sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
@ -127,8 +125,9 @@ void() hknight_stand9 =[ $stand9, hknight_stand1 ] {ai_stand();};
//===========================================================================
void() hknight_walk1 =[ $walk1, hknight_walk2 ] {
hk_idle_sound();
ai_walk(2);};
hk_idle_sound ();
ai_walk (2);
};
void() hknight_walk2 =[ $walk2, hknight_walk3 ] {ai_walk(5);};
void() hknight_walk3 =[ $walk3, hknight_walk4 ] {ai_walk(5);};
void() hknight_walk4 =[ $walk4, hknight_walk5 ] {ai_walk(4);};
@ -152,8 +151,10 @@ void() hknight_walk20 =[ $walk20, hknight_walk1 ] {ai_walk(2);};
//===========================================================================
void() hknight_run1 =[ $run1, hknight_run2 ] {
hk_idle_sound();
ai_run (20); CheckForCharge (); };
hk_idle_sound ();
ai_run (20);
CheckForCharge ();
};
void() hknight_run2 =[ $run2, hknight_run3 ] {ai_run(25);};
void() hknight_run3 =[ $run3, hknight_run4 ] {ai_run(18);};
void() hknight_run4 =[ $run4, hknight_run5 ] {ai_run(16);};
@ -164,7 +165,9 @@ void() hknight_run8 =[ $run8, hknight_run1 ] {ai_run(13);};
//============================================================================
void() hknight_pain1 =[ $pain1, hknight_pain2 ] {sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);};
void() hknight_pain1 =[ $pain1, hknight_pain2 ] {
sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
};
void() hknight_pain2 =[ $pain2, hknight_pain3 ] {};
void() hknight_pain3 =[ $pain3, hknight_pain4 ] {};
void() hknight_pain4 =[ $pain4, hknight_pain5 ] {};
@ -174,8 +177,10 @@ void() hknight_pain5 =[ $pain5, hknight_run1 ] {};
void() hknight_die1 =[ $death1, hknight_die2 ] {ai_forward(10);};
void() hknight_die2 =[ $death2, hknight_die3 ] {ai_forward(8);};
void() hknight_die3 =[ $death3, hknight_die4 ]
{self.solid = SOLID_NOT; ai_forward(7);};
void() hknight_die3 =[ $death3, hknight_die4 ] {
self.solid = SOLID_NOT;
ai_forward(7);
};
void() hknight_die4 =[ $death4, hknight_die5 ] {};
void() hknight_die5 =[ $death5, hknight_die6 ] {};
void() hknight_die6 =[ $death6, hknight_die7 ] {};
@ -188,8 +193,7 @@ void() hknight_die12 =[ $death12, hknight_die12 ] {};
void() hknight_dieb1 =[ $deathb1, hknight_dieb2 ] {};
void() hknight_dieb2 =[ $deathb2, hknight_dieb3 ] {};
void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ]
{self.solid = SOLID_NOT;};
void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ] {self.solid = SOLID_NOT;};
void() hknight_dieb4 =[ $deathb4, hknight_dieb5 ] {};
void() hknight_dieb5 =[ $deathb5, hknight_dieb6 ] {};
void() hknight_dieb6 =[ $deathb6, hknight_dieb7 ] {};
@ -199,9 +203,8 @@ void() hknight_dieb9 =[ $deathb9, hknight_dieb9 ] {};
void() hknight_die =
{
// check for gib
if (self.health < -40)
{
// check for gib
if (self.health < -40) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_hellkn.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -210,9 +213,9 @@ void() hknight_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
if (random() > 0.5)
if (random () > 0.5)
hknight_die1 ();
else
hknight_dieb1 ();
@ -273,7 +276,7 @@ void() hknight_char_a2 =[ $char_a2, hknight_char_a3 ] {ai_charge(25);};
void() hknight_char_a3 =[ $char_a3, hknight_char_a4 ] {ai_charge(18);};
void() hknight_char_a4 =[ $char_a4, hknight_char_a5 ] {ai_charge(16);};
void() hknight_char_a5 =[ $char_a5, hknight_char_a6 ] {ai_charge(14);};
void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge(20); ai_melee();};
void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge (20);ai_melee();};
void() hknight_char_a7 =[ $char_a7, hknight_char_a8 ] {ai_charge(21); ai_melee();};
void() hknight_char_a8 =[ $char_a8, hknight_char_a9 ] {ai_charge(13); ai_melee();};
void() hknight_char_a9 =[ $char_a9, hknight_char_a10 ] {ai_charge(20); ai_melee();};
@ -287,8 +290,11 @@ void() hknight_char_a16=[ $char_a16, hknight_run1 ] {ai_charge(13);};
//===========================================================================
void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ]
{CheckContinueCharge (); ai_charge(23); ai_melee();};
void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ] {
CheckContinueCharge ();
ai_charge (23);
ai_melee ();
};
void() hknight_char_b2 =[ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
void() hknight_char_b3 =[ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
void() hknight_char_b4 =[ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
@ -351,7 +357,7 @@ void() hknight_watk22 =[ $w_attack22, hknight_run1 ] {ai_charge(3);};
void() hk_idle_sound =
{
if (random() < 0.2)
if (random () < 0.2)
sound (self, CHAN_VOICE, "hknight/idle.wav", 1, ATTN_NORM);
};
@ -362,14 +368,14 @@ void(entity attacker, float damage) hknight_pain =
sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
if (time - self.pain_finished > 5)
{ // allways go into pain frame if it has been a while
if (time - self.pain_finished > 5) {
// allways go into pain frame if it has been a while
hknight_pain1 ();
self.pain_finished = time + 1;
return;
}
if ((random()*30 > damage) )
if ((random () *30 > damage))
return; // didn't flinch
self.pain_finished = time + 1;
@ -387,8 +393,7 @@ void() hknight_melee =
hknight_slice1 ();
else if (hknight_type == 2)
hknight_smash1 ();
else if (hknight_type == 3)
{
else if (hknight_type == 3) {
hknight_watk1 ();
hknight_type = 0;
}
@ -398,15 +403,14 @@ void() hknight_melee =
*/
void() monster_hell_knight =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model2 ("progs/hknight.mdl");
precache_model2 ("progs/k_spike.mdl");
precache_model2 ("progs/h_hellkn.mdl");
precache_sound2 ("hknight/attack1.wav");
precache_sound2 ("hknight/death1.wav");

File diff suppressed because it is too large Load diff

View file

@ -56,9 +56,10 @@ void() knight_stand8 =[ $stand8, knight_stand9 ] {ai_stand();};
void() knight_stand9 =[ $stand9, knight_stand1 ] {ai_stand();};
void() knight_walk1 =[ $walk1, knight_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_walk(3);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_walk (3);
};
void() knight_walk2 =[ $walk2, knight_walk3 ] {ai_walk(2);};
void() knight_walk3 =[ $walk3, knight_walk4 ] {ai_walk(3);};
void() knight_walk4 =[ $walk4, knight_walk5 ] {ai_walk(4);};
@ -75,9 +76,10 @@ void() knight_walk14 =[ $walk14, knight_walk1 ] {ai_walk(3);};
void() knight_run1 =[ $runb1, knight_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_run(16);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
ai_run (16);
};
void() knight_run2 =[ $runb2, knight_run3 ] {ai_run(20);};
void() knight_run3 =[ $runb3, knight_run4 ] {ai_run(13);};
void() knight_run4 =[ $runb4, knight_run5 ] {ai_run(7);};
@ -86,14 +88,12 @@ void() knight_run6 =[ $runb6, knight_run7 ] {ai_run(20);};
void() knight_run7 =[ $runb7, knight_run8 ] {ai_run(14);};
void() knight_run8 =[ $runb8, knight_run1 ] {ai_run(6);};
void() knight_runatk1 =[ $runattack1, knight_runatk2 ]
{
if (random() > 0.5)
sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge(20);
void() knight_runatk1 =[ $runattack1, knight_runatk2 ] {
if (random () > 0.5)
sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
else
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge (20);
};
void() knight_runatk2 =[ $runattack2, knight_runatk3 ] {ai_charge_side();};
void() knight_runatk3 =[ $runattack3, knight_runatk4 ] {ai_charge_side();};
@ -106,18 +106,20 @@ void() knight_runatk9 =[ $runattack9, knight_runatk10 ] {ai_melee_side();};
void() knight_runatk10 =[ $runattack10, knight_runatk11 ] {ai_charge_side();};
void() knight_runatk11 =[ $runattack11, knight_run1 ] {ai_charge(10);};
void() knight_atk1 =[ $attackb1, knight_atk2 ]
{
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge(0);};
void() knight_atk1 =[ $attackb1, knight_atk2 ] {
sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
ai_charge (0);
};
void() knight_atk2 =[ $attackb2, knight_atk3 ] {ai_charge(7);};
void() knight_atk3 =[ $attackb3, knight_atk4 ] {ai_charge(4);};
void() knight_atk4 =[ $attackb4, knight_atk5 ] {ai_charge(0);};
void() knight_atk5 =[ $attackb5, knight_atk6 ] {ai_charge(3);};
void() knight_atk6 =[ $attackb6, knight_atk7 ] {ai_charge(4); ai_melee();};
void() knight_atk7 =[ $attackb7, knight_atk8 ] {ai_charge(1); ai_melee();};
void() knight_atk8 =[ $attackb8, knight_atk9 ] {ai_charge(3);
ai_melee();};
void() knight_atk8 =[ $attackb8, knight_atk9 ] {
ai_charge (3);
ai_melee ();
};
void() knight_atk9 =[ $attackb9, knight_atk10] {ai_charge(1);};
void() knight_atk10=[ $attackb10, knight_run1 ] {ai_charge(5);};
@ -150,20 +152,16 @@ void(entity attacker, float damage) knight_pain =
if (self.pain_finished > time)
return;
r = random();
r = random ();
sound (self, CHAN_VOICE, "knight/khurt.wav", 1, ATTN_NORM);
if (r < 0.85)
{
if (r < 0.85) {
knight_pain1 ();
self.pain_finished = time + 1;
}
else
{
} else {
knight_painb1 ();
self.pain_finished = time + 1;
}
};
//===========================================================================
@ -181,12 +179,9 @@ void() knight_bow8 =[ $kneel2, knight_bow9 ] {ai_turn();};
void() knight_bow9 =[ $kneel1, knight_bow10 ] {ai_turn();};
void() knight_bow10 =[ $walk1, knight_walk1 ] {ai_turn();};
void() knight_die1 =[ $death1, knight_die2 ] {};
void() knight_die2 =[ $death2, knight_die3 ] {};
void() knight_die3 =[ $death3, knight_die4 ]
{self.solid = SOLID_NOT;};
void() knight_die3 =[ $death3, knight_die4 ] {self.solid = SOLID_NOT;};
void() knight_die4 =[ $death4, knight_die5 ] {};
void() knight_die5 =[ $death5, knight_die6 ] {};
void() knight_die6 =[ $death6, knight_die7 ] {};
@ -198,8 +193,7 @@ void() knight_die10=[ $death10, knight_die10] {};
void() knight_dieb1 =[ $deathb1, knight_dieb2 ] {};
void() knight_dieb2 =[ $deathb2, knight_dieb3 ] {};
void() knight_dieb3 =[ $deathb3, knight_dieb4 ]
{self.solid = SOLID_NOT;};
void() knight_dieb3 =[ $deathb3, knight_dieb4 ] {self.solid = SOLID_NOT;};
void() knight_dieb4 =[ $deathb4, knight_dieb5 ] {};
void() knight_dieb5 =[ $deathb5, knight_dieb6 ] {};
void() knight_dieb6 =[ $deathb6, knight_dieb7 ] {};
@ -209,12 +203,10 @@ void() knight_dieb9 =[ $deathb9, knight_dieb10] {};
void() knight_dieb10 = [ $deathb10, knight_dieb11] {};
void() knight_dieb11 = [ $deathb11, knight_dieb11] {};
void() knight_die =
{
// check for gib
if (self.health < -40)
{
// check for gib
if (self.health < -40) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_knight.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -223,24 +215,23 @@ void() knight_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
if (random() < 0.5)
if (random () < 0.5)
knight_die1 ();
else
knight_dieb1 ();
};
/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_knight =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model ("progs/knight.mdl");
precache_model ("progs/h_knight.mdl");

View file

@ -1,4 +1,3 @@
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for spotlights, etc.
*/
@ -20,13 +19,10 @@ float START_OFF = 1;
void() light_use =
{
if (self.spawnflags & START_OFF)
{
if (self.spawnflags & START_OFF) {
lightstyle(self.style, "m");
self.spawnflags = self.spawnflags - START_OFF;
}
else
{
} else {
lightstyle(self.style, "a");
self.spawnflags = self.spawnflags + START_OFF;
}
@ -40,14 +36,12 @@ If targeted, it will toggle between on or off.
*/
void() light =
{
if (!self.targetname)
{ // inert light
remove(self);
if (!self.targetname) { // inert light
remove (self);
return;
}
if (self.style >= 32)
{
if (self.style >= 32) {
self.use = light_use;
if (self.spawnflags & START_OFF)
lightstyle(self.style, "a");
@ -65,8 +59,7 @@ Makes steady fluorescent humming sound
*/
void() light_fluoro =
{
if (self.style >= 32)
{
if (self.style >= 32) {
self.use = light_use;
if (self.spawnflags & START_OFF)
lightstyle(self.style, "a");
@ -108,7 +101,7 @@ void() light_globe =
void() FireAmbient =
{
precache_sound ("ambience/fire1.wav");
// attenuate fast
// attenuate fast
ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
};
@ -161,19 +154,16 @@ void() light_flame_small_white =
//============================================================================
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
Lava Balls
*/
void() fire_fly;
void() fire_touch;
void() misc_fireball =
{
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
self.nextthink = time + (random() * 5);
self.nextthink = time + (random () * 5);
self.think = fire_fly;
if (!self.speed)
self.speed = 1000;
@ -181,15 +171,15 @@ void() misc_fireball =
void() fire_fly =
{
local entity fireball;
local entity fireball;
fireball = spawn();
fireball.solid = SOLID_TRIGGER;
fireball.movetype = MOVETYPE_TOSS;
fireball.velocity = '0 0 1000';
fireball.velocity_x = (random() * 100) - 50;
fireball.velocity_y = (random() * 100) - 50;
fireball.velocity_z = self.speed + (random() * 200);
fireball.velocity_x = (100 * random ()) - 50;
fireball.velocity_y = (100 * random ()) - 50;
fireball.velocity_z = self.speed + (200 * random ());
fireball.classname = "fireball";
setmodel (fireball, "progs/lavaball.mdl");
setsize (fireball, '0 0 0', '0 0 0');
@ -198,11 +188,10 @@ local entity fireball;
fireball.think = SUB_Remove;
fireball.touch = fire_touch;
self.nextthink = time + (random() * 5) + 3;
self.nextthink = time + (random () * 5) + 3;
self.think = fire_fly;
};
void() fire_touch =
{
T_Damage (other, self, self, 20);
@ -211,28 +200,22 @@ void() fire_touch =
//============================================================================
void() barrel_explode =
{
self.takedamage = DAMAGE_NO;
self.classname = "explo_box";
// did say self.owner
T_RadiusDamage (self, self, 160, world, "");
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z+32);
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_EXPLOSION);
self.origin_z += 32;
WriteCoordV (MSG_MULTICAST, self.origin);
multicast (self.origin, MULTICAST_PHS);
remove (self);
};
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
TESTING THING
*/
void() misc_explobox =
{
local float oldz;
@ -250,22 +233,17 @@ void() misc_explobox =
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
if (oldz - self.origin_z > 250) {
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
remove (self);
}
};
/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
Smaller exploding box, REGISTERED ONLY
*/
void() misc_explobox2 =
{
local float oldz;
@ -283,12 +261,11 @@ void() misc_explobox2 =
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
if (oldz - self.origin_z > 250) {
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint ("\n");
remove(self);
remove (self);
}
};
@ -304,33 +281,25 @@ void() Laser_Touch =
if (other == self.owner)
return; // don't explode on owner
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
if (pointcontents(self.origin) == CONTENT_SKY) {
remove (self);
return;
}
sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
org = self.origin - 8*normalize(self.velocity);
if (other.health)
{
if (other.health) {
SpawnBlood (org, 15);
other.deathtype = "laser";
T_Damage (other, self, self.owner, 15);
}
else
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_GUNSHOT);
WriteByte (MSG_MULTICAST, 5);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
} else {
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, 5.0);
WriteCoordV (MSG_MULTICAST, org);
multicast (org, MULTICAST_PVS);
}
remove(self);
remove (self);
};
void(vector org, vector vec) LaunchLaser =
@ -340,7 +309,7 @@ void(vector org, vector vec) LaunchLaser =
vec = normalize(vec);
newmis = spawn();
newmis = spawn ();
newmis.owner = self;
newmis.movetype = MOVETYPE_FLY;
newmis.solid = SOLID_BBOX;
@ -361,13 +330,10 @@ void(vector org, vector vec) LaunchLaser =
void() spikeshooter_use =
{
if (self.spawnflags & SPAWNFLAG_LASER)
{
if (self.spawnflags & SPAWNFLAG_LASER) {
sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
LaunchLaser (self.origin, self.movedir);
}
else
{
} else {
sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
launch_spike (self.origin, self.movedir);
newmis.velocity = self.movedir * 500;
@ -383,18 +349,15 @@ void() shooter_think =
newmis.velocity = self.movedir * 500;
};
/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED.
*/
void() trap_spikeshooter =
{
SetMovedir ();
self.use = spikeshooter_use;
if (self.spawnflags & SPAWNFLAG_LASER)
{
if (self.spawnflags & SPAWNFLAG_LASER) {
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
@ -404,7 +367,6 @@ void() trap_spikeshooter =
precache_sound ("weapons/spike2.wav");
};
/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
Continuously fires spikes.
"wait" time between spike (1.0 default)
@ -420,16 +382,12 @@ void() trap_shooter =
self.think = shooter_think;
};
/*
===============================================================================
===============================================================================
*/
void() make_bubbles;
void() bubble_remove;
void() bubble_bob;
@ -438,7 +396,6 @@ void() bubble_bob;
testing air bubbles
*/
void() air_bubbles =
{
remove (self);
@ -446,7 +403,7 @@ void() air_bubbles =
void() make_bubbles =
{
local entity bubble;
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
@ -461,13 +418,14 @@ local entity bubble;
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random() + 0.5;
self.nextthink = time + random () + 0.5;
self.think = make_bubbles;
};
void() bubble_split =
{
local entity bubble;
local entity bubble;
bubble = spawn();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
@ -489,27 +447,26 @@ local entity bubble;
void() bubble_remove =
{
if (other.classname == self.classname)
{
// dprint ("bump");
if (other.classname == self.classname) {
// dprint ("bump");
return;
}
remove(self);
remove (self);
};
void() bubble_bob =
{
local float rnd1, rnd2, rnd3;
local float rnd1, rnd2, rnd3;
self.cnt = self.cnt + 1;
if (self.cnt == 4)
bubble_split();
bubble_split ();
if (self.cnt == 20)
remove(self);
rnd1 = self.velocity_x + (-10 + (random() * 20));
rnd2 = self.velocity_y + (-10 + (random() * 20));
rnd3 = self.velocity_z + 10 + random() * 10;
rnd1 = self.velocity_x - 10 + random () * 20;
rnd2 = self.velocity_y - 10 + random () * 20;
rnd3 = self.velocity_z + 10 + random () * 10;
if (rnd1 > 10)
rnd1 = 5;
@ -541,9 +498,7 @@ local float rnd1, rnd2, rnd3;
Just for the debugging level. Don't use
*/
void() viewthing =
{
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
@ -551,7 +506,6 @@ void() viewthing =
setmodel (self, "progs/player.mdl");
};
/*
==============================================================================
@ -577,12 +531,10 @@ void() func_wall =
setmodel (self, self.model);
};
/*QUAKED func_illusionary (0 .5 .8) ?
A simple entity that looks solid but lets you walk through it.
*/
void() func_illusionary =
{
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
@ -595,7 +547,6 @@ void() func_illusionary =
This bmodel will appear if the episode has allready been completed, so players can't reenter it.
*/
void() func_episodegate =
{
if (!(serverflags & self.spawnflags))
return; // can still enter episode
@ -611,7 +562,6 @@ void() func_episodegate =
This bmodel appears unless players have all of the episode sigils.
*/
void() func_bossgate =
{
if ( (serverflags & 15) == 15)
return; // all episodes completed
@ -646,6 +596,7 @@ void() ambient_flouro_buzz =
precache_sound ("ambience/buzz1.wav");
ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
};
/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_drip =
@ -653,6 +604,7 @@ void() ambient_drip =
precache_sound ("ambience/drip1.wav");
ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_comp_hum =
@ -660,6 +612,7 @@ void() ambient_comp_hum =
precache_sound ("ambience/comp1.wav");
ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
};
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_thunder =
@ -667,6 +620,7 @@ void() ambient_thunder =
precache_sound ("ambience/thunder1.wav");
ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_light_buzz =
@ -674,6 +628,7 @@ void() ambient_light_buzz =
precache_sound ("ambience/fl_hum1.wav");
ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp1 =
@ -681,6 +636,7 @@ void() ambient_swamp1 =
precache_sound ("ambience/swamp1.wav");
ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp2 =
@ -704,12 +660,9 @@ void() noise_think =
};
/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10)
For optimzation testing, starts a lot of sounds.
For optimization testing, starts a lot of sounds.
*/
void() misc_noisemaker =
{
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
@ -722,6 +675,6 @@ void() misc_noisemaker =
precache_sound2 ("enforcer/death1.wav");
precache_sound2 ("enforcer/idle1.wav");
self.nextthink = time + 0.1 + random();
self.nextthink = time + 0.1 + random ();
self.think = noise_think;
};

View file

@ -1,4 +1,3 @@
/*
===============================================================================
@ -582,4 +581,3 @@ $origin 0 0 24
$base base
$skin skin
$frame frame1

View file

@ -10,7 +10,6 @@
// <code>
// };
/*
================
monster_use
@ -30,9 +29,8 @@ void() monster_use =
return;
if (activator.classname != "player")
return;
// delay reaction so if the monster is teleported, its sound is still
// heard
// delay reaction so if the monster is teleported, its sound is still heard
self.enemy = activator;
self.nextthink = time + 0.1;
self.think = FoundTarget;
@ -48,7 +46,7 @@ enemy as activator.
*/
void() monster_death_use =
{
// fall to ground
// fall to ground
if (self.flags & FL_FLY)
self.flags = self.flags - FL_FLY;
if (self.flags & FL_SWIM)
@ -61,7 +59,6 @@ void() monster_death_use =
SUB_UseTargets ();
};
//============================================================================
void() walkmonster_start_go =
@ -69,8 +66,7 @@ void() walkmonster_start_go =
self.origin_z = self.origin_z + 1; // raise off floor a bit
droptofloor();
if (!walkmove(0,0))
{
if (!walkmove (0, 0)) {
dprint ("walkmonster in wall at: ");
dprint (vtos(self.origin));
dprint ("\n");
@ -86,45 +82,39 @@ void() walkmonster_start_go =
self.flags = self.flags | FL_MONSTER;
if (self.target)
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
if (self.target) {
self.goalentity = self.movetarget = find (world, targetname,
self.target);
self.ideal_yaw = vectoyaw (self.goalentity.origin - self.origin);
if (!self.movetarget) {
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
// this used to be an objerror
if (self.movetarget.classname == "path_corner")
self.th_walk ();
else
self.pausetime = 99999999;
self.th_stand ();
}
else
{
} else {
self.pausetime = 99999999;
self.th_stand ();
}
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random () * 0.5;
};
void() walkmonster_start =
{
// delay drop to floor to make sure all doors have been spawned
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
// delay drop to floor to make sure all doors have been spawned
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random () * 0.5;
self.think = walkmonster_start_go;
total_monsters = total_monsters + 1;
};
void() flymonster_start_go =
{
self.takedamage = DAMAGE_AIM;
@ -138,31 +128,27 @@ void() flymonster_start_go =
self.flags = self.flags | FL_FLY;
self.flags = self.flags | FL_MONSTER;
if (!walkmove(0,0))
{
if (!walkmove (0, 0)) {
dprint ("flymonster in wall at: ");
dprint (vtos(self.origin));
dprint ("\n");
}
if (self.target)
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
if (!self.movetarget)
{
if (self.target) {
self.goalentity = self.movetarget = find (world, targetname,
self.target);
if (!self.movetarget) {
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
// this used to be an objerror
if (self.movetarget.classname == "path_corner")
self.th_walk ();
else
self.pausetime = 99999999;
self.th_stand ();
}
else
{
} else {
self.pausetime = 99999999;
self.th_stand ();
}
@ -170,18 +156,16 @@ void() flymonster_start_go =
void() flymonster_start =
{
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + 0.5 * random ();
self.think = flymonster_start_go;
total_monsters = total_monsters + 1;
};
void() swimmonster_start_go =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
@ -197,35 +181,30 @@ void() swimmonster_start_go =
self.flags = self.flags | FL_SWIM;
self.flags = self.flags | FL_MONSTER;
if (self.target)
{
self.goalentity = self.movetarget = find(world, targetname, self.target);
if (!self.movetarget)
{
if (self.target) {
self.goalentity = self.movetarget = find (world, targetname,
self.target);
if (!self.movetarget) {
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
// this used to be an objerror
self.ideal_yaw = vectoyaw (self.goalentity.origin - self.origin);
self.th_walk ();
}
else
{
} else {
self.pausetime = 99999999;
self.th_stand ();
}
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random () * 0.5;
};
void() swimmonster_start =
{
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random()*0.5;
// spread think times so they don't all happen at same time
self.nextthink = self.nextthink + random () * 0.5;
self.think = swimmonster_start_go;
total_monsters = total_monsters + 1;
};

View file

@ -49,17 +49,13 @@ $frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
//=============================================================================
void() OgreGrenadeExplode =
{
T_RadiusDamage (self, self.owner, 40, world, "ogre");
sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_EXPLOSION);
WriteCoordV (MSG_BROADCAST, self.origin);
multicast (self.origin, MULTICAST_PHS);
remove (self);
@ -69,12 +65,11 @@ void() OgreGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage == DAMAGE_AIM)
{
if (other.takedamage == DAMAGE_AIM) {
OgreGrenadeExplode();
return;
}
sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
@ -87,7 +82,7 @@ OgreFireGrenade
void() OgreFireGrenade =
{
local entity missile;
muzzleflash();
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
@ -96,25 +91,19 @@ void() OgreFireGrenade =
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// set missile speed
// set missile speed
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - self.origin);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
missile.touch = OgreGrenadeTouch;
// set missile duration
// set missile duration
missile.nextthink = time + 2.5;
missile.think = OgreGrenadeExplode;
setmodel (missile, "progs/grenade.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
@ -132,44 +121,43 @@ FIXME
*/
void(float side) chainsaw =
{
local vector delta;
local float ldmg;
local vector delta;
local float ldmg;
if (!self.enemy)
return;
if (!CanDamage (self.enemy, self))
return;
ai_charge(10);
ai_charge (10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 4;
ldmg = 4 * (random () + random () + random ());
self.enemy.deathtype = "ogre";
T_Damage (self.enemy, self, self, ldmg);
if (side)
{
if (side) {
makevectors (self.angles);
if (side == 1)
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
SpawnMeatSpray (self.origin + v_forward * 16,
v_right * 200 * (random () - 0.5));
else
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
SpawnMeatSpray (self.origin + v_forward * 16, side * v_right);
}
};
void() ogre_stand1 =[ $stand1, ogre_stand2 ] {ai_stand();};
void() ogre_stand2 =[ $stand2, ogre_stand3 ] {ai_stand();};
void() ogre_stand3 =[ $stand3, ogre_stand4 ] {ai_stand();};
void() ogre_stand4 =[ $stand4, ogre_stand5 ] {ai_stand();};
void() ogre_stand5 =[ $stand5, ogre_stand6 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_stand();
if (random () < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_stand ();
};
void() ogre_stand6 =[ $stand6, ogre_stand7 ] {ai_stand();};
void() ogre_stand7 =[ $stand7, ogre_stand8 ] {ai_stand();};
@ -179,16 +167,16 @@ void() ogre_stand9 =[ $stand9, ogre_stand1 ] {ai_stand();};
void() ogre_walk1 =[ $walk1, ogre_walk2 ] {ai_walk(3);};
void() ogre_walk2 =[ $walk2, ogre_walk3 ] {ai_walk(2);};
void() ogre_walk3 =[ $walk3, ogre_walk4 ] {
ai_walk(2);
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_walk (2);
if (random () < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
};
void() ogre_walk4 =[ $walk4, ogre_walk5 ] {ai_walk(2);};
void() ogre_walk5 =[ $walk5, ogre_walk6 ] {ai_walk(2);};
void() ogre_walk6 =[ $walk6, ogre_walk7 ] {
ai_walk(5);
if (random() < 0.1)
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
ai_walk (5);
if (random () < 0.1)
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
};
void() ogre_walk7 =[ $walk7, ogre_walk8 ] {ai_walk(3);};
void() ogre_walk8 =[ $walk8, ogre_walk9 ] {ai_walk(2);};
@ -201,9 +189,10 @@ void() ogre_walk14 =[ $walk14, ogre_walk15 ] {ai_walk(3);};
void() ogre_walk15 =[ $walk15, ogre_walk16 ] {ai_walk(3);};
void() ogre_walk16 =[ $walk16, ogre_walk1 ] {ai_walk(4);};
void() ogre_run1 =[ $run1, ogre_run2 ] {ai_run(9);
if (random() < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
void() ogre_run1 =[ $run1, ogre_run2 ] {
ai_run (9);
if (random () < 0.2)
sound (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
};
void() ogre_run2 =[ $run2, ogre_run3 ] {ai_run(12);};
void() ogre_run3 =[ $run3, ogre_run4 ] {ai_run(8);};
@ -213,37 +202,75 @@ void() ogre_run6 =[ $run6, ogre_run7 ] {ai_run(4);};
void() ogre_run7 =[ $run7, ogre_run8 ] {ai_run(13);};
void() ogre_run8 =[ $run8, ogre_run1 ] {ai_run(24);};
void() ogre_swing1 =[ $swing1, ogre_swing2 ] {ai_charge(11);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
void() ogre_swing1 =[ $swing1, ogre_swing2 ] {
ai_charge (11);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_swing2 =[ $swing2, ogre_swing3 ] {ai_charge(1);};
void() ogre_swing3 =[ $swing3, ogre_swing4 ] {ai_charge(4);};
void() ogre_swing4 =[ $swing4, ogre_swing5 ] {ai_charge(13);};
void() ogre_swing5 =[ $swing5, ogre_swing6 ] {ai_charge(9); chainsaw(0);self.angles_y = self.angles_y + random()*25;};
void() ogre_swing6 =[ $swing6, ogre_swing7 ] {chainsaw(200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing7 =[ $swing7, ogre_swing8 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing8 =[ $swing8, ogre_swing9 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing9 =[ $swing9, ogre_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing10 =[ $swing10, ogre_swing11 ] {chainsaw(-200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing11 =[ $swing11, ogre_swing12 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing5 =[ $swing5, ogre_swing6 ] {
ai_charge (9);
chainsaw (0);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing6 =[ $swing6, ogre_swing7 ] {
chainsaw (200);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing7 =[ $swing7, ogre_swing8 ] {
chainsaw (0);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing8 =[ $swing8, ogre_swing9 ] {
chainsaw (0);
self.angles_y = self.angles_y + random () * 25;};
void() ogre_swing9 =[ $swing9, ogre_swing10 ] {
chainsaw (0);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing10 =[ $swing10, ogre_swing11 ] {
chainsaw (-200);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing11 =[ $swing11, ogre_swing12 ] {
chainsaw (0);
self.angles_y = self.angles_y + random () * 25;
};
void() ogre_swing12 =[ $swing12, ogre_swing13 ] {ai_charge(3);};
void() ogre_swing13 =[ $swing13, ogre_swing14 ] {ai_charge(8);};
void() ogre_swing14 =[ $swing14, ogre_run1 ] {ai_charge(9);};
void() ogre_smash1 =[ $smash1, ogre_smash2 ] {ai_charge(6);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
void() ogre_smash1 =[ $smash1, ogre_smash2 ] {
ai_charge (6);
sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_smash2 =[ $smash2, ogre_smash3 ] {ai_charge(0);};
void() ogre_smash3 =[ $smash3, ogre_smash4 ] {ai_charge(0);};
void() ogre_smash4 =[ $smash4, ogre_smash5 ] {ai_charge(1);};
void() ogre_smash5 =[ $smash5, ogre_smash6 ] {ai_charge(4);};
void() ogre_smash6 =[ $smash6, ogre_smash7 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash7 =[ $smash7, ogre_smash8 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash8 =[ $smash8, ogre_smash9 ] {ai_charge(10); chainsaw(0);};
void() ogre_smash9 =[ $smash9, ogre_smash10 ] {ai_charge(13); chainsaw(0);};
void() ogre_smash6 =[ $smash6, ogre_smash7 ] {
ai_charge (4);
chainsaw (0);
};
void() ogre_smash7 =[ $smash7, ogre_smash8 ] {
ai_charge (4);
chainsaw (0);
};
void() ogre_smash8 =[ $smash8, ogre_smash9 ] {
ai_charge (10);
chainsaw (0);
};
void() ogre_smash9 =[ $smash9, ogre_smash10 ] {
ai_charge (13);
chainsaw (0);
};
void() ogre_smash10 =[ $smash10, ogre_smash11 ] {chainsaw(1);};
void() ogre_smash11 =[ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0);
self.nextthink = self.nextthink + random()*0.2;}; // slight variation
void() ogre_smash11 =[ $smash11, ogre_smash12 ] {
ai_charge (2);
chainsaw (0);
self.nextthink = self.nextthink + random () * 0.2; // slight variation
};
void() ogre_smash12 =[ $smash12, ogre_smash13 ] {ai_charge(0);};
void() ogre_smash13 =[ $smash13, ogre_smash14 ] {ai_charge(4);};
void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
@ -251,7 +278,10 @@ void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
void() ogre_nail1 =[ $shoot1, ogre_nail2 ] {ai_face();};
void() ogre_nail2 =[ $shoot2, ogre_nail3 ] {ai_face();};
void() ogre_nail3 =[ $shoot2, ogre_nail4 ] {ai_face();};
void() ogre_nail4 =[ $shoot3, ogre_nail5 ] {ai_face();OgreFireGrenade();};
void() ogre_nail4 =[ $shoot3, ogre_nail5 ] {
ai_face ();
OgreFireGrenade();
};
void() ogre_nail5 =[ $shoot4, ogre_nail6 ] {ai_face();};
void() ogre_nail6 =[ $shoot5, ogre_nail7 ] {ai_face();};
void() ogre_nail7 =[ $shoot6, ogre_run1 ] {ai_face();};
@ -262,12 +292,10 @@ void() ogre_pain3 =[ $pain3, ogre_pain4 ] {};
void() ogre_pain4 =[ $pain4, ogre_pain5 ] {};
void() ogre_pain5 =[ $pain5, ogre_run1 ] {};
void() ogre_painb1 =[ $painb1, ogre_painb2 ] {};
void() ogre_painb2 =[ $painb2, ogre_painb3 ] {};
void() ogre_painb3 =[ $painb3, ogre_run1 ] {};
void() ogre_painc1 =[ $painc1, ogre_painc2 ] {};
void() ogre_painc2 =[ $painc2, ogre_painc3 ] {};
void() ogre_painc3 =[ $painc3, ogre_painc4 ] {};
@ -275,7 +303,6 @@ void() ogre_painc4 =[ $painc4, ogre_painc5 ] {};
void() ogre_painc5 =[ $painc5, ogre_painc6 ] {};
void() ogre_painc6 =[ $painc6, ogre_run1 ] {};
void() ogre_paind1 =[ $paind1, ogre_paind2 ] {};
void() ogre_paind2 =[ $paind2, ogre_paind3 ] {ai_pain(10);};
void() ogre_paind3 =[ $paind3, ogre_paind4 ] {ai_pain(9);};
@ -309,41 +336,31 @@ void() ogre_paine13=[ $paine13, ogre_paine14 ] {};
void() ogre_paine14=[ $paine14, ogre_paine15 ] {};
void() ogre_paine15=[ $paine15, ogre_run1 ] {};
void(entity attacker, float damage) ogre_pain =
{
local float r;
// don't make multiple pain sounds right after each other
// don't make multiple pain sounds right after each other
if (self.pain_finished > time)
return;
sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
r = random();
r = random ();
if (r < 0.25)
{
if (r < 0.25) {
ogre_pain1 ();
self.pain_finished = time + 1;
}
else if (r < 0.5)
{
} else if (r < 0.5) {
ogre_painb1 ();
self.pain_finished = time + 1;
}
else if (r < 0.75)
{
} else if (r < 0.75) {
ogre_painc1 ();
self.pain_finished = time + 1;
}
else if (r < 0.88)
{
} else if (r < 0.88) {
ogre_paind1 ();
self.pain_finished = time + 2;
}
else
{
} else {
ogre_paine1 ();
self.pain_finished = time + 2;
}
@ -351,9 +368,11 @@ void(entity attacker, float damage) ogre_pain =
void() ogre_die1 =[ $death1, ogre_die2 ] {};
void() ogre_die2 =[ $death2, ogre_die3 ] {};
void() ogre_die3 =[ $death3, ogre_die4 ]
{self.solid = SOLID_NOT;
self.ammo_rockets = 2;DropBackpack();};
void() ogre_die3 =[ $death3, ogre_die4 ] {
self.solid = SOLID_NOT;
self.ammo_rockets = 2;
DropBackpack ();
};
void() ogre_die4 =[ $death4, ogre_die5 ] {};
void() ogre_die5 =[ $death5, ogre_die6 ] {};
void() ogre_die6 =[ $death6, ogre_die7 ] {};
@ -368,9 +387,11 @@ void() ogre_die14 =[ $death14, ogre_die14 ] {};
void() ogre_bdie1 =[ $bdeath1, ogre_bdie2 ] {};
void() ogre_bdie2 =[ $bdeath2, ogre_bdie3 ] {ai_forward(5);};
void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ]
{self.solid = SOLID_NOT;
self.ammo_rockets = 2;DropBackpack();};
void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ] {
self.solid = SOLID_NOT;
self.ammo_rockets = 2;
DropBackpack ();
};
void() ogre_bdie4 =[ $bdeath4, ogre_bdie5 ] {ai_forward(1);};
void() ogre_bdie5 =[ $bdeath5, ogre_bdie6 ] {ai_forward(3);};
void() ogre_bdie6 =[ $bdeath6, ogre_bdie7 ] {ai_forward(7);};
@ -381,9 +402,8 @@ void() ogre_bdie10 =[ $bdeath10, ogre_bdie10 ] {};
void() ogre_die =
{
// check for gib
if (self.health < -80)
{
// check for gib
if (self.health < -80) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_ogre.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);
@ -394,7 +414,7 @@ void() ogre_die =
sound (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);
if (random() < 0.5)
if (random () < 0.5)
ogre_die1 ();
else
ogre_bdie1 ();
@ -402,23 +422,21 @@ void() ogre_die =
void() ogre_melee =
{
if (random() > 0.5)
if (random () > 0.5)
ogre_smash1 ();
else
ogre_swing1 ();
};
/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_ogre =
{
if (deathmatch)
{
if (deathmatch) {
remove(self);
return;
}
precache_model ("progs/ogre.mdl");
precache_model ("progs/h_ogre.mdl");
precache_model ("progs/grenade.mdl");
@ -447,12 +465,10 @@ void() monster_ogre =
self.th_missile = ogre_nail1;
self.th_pain = ogre_pain;
walkmonster_start();
walkmonster_start ();
};
void() monster_ogre_marksman =
{
monster_ogre ();
};

View file

@ -16,7 +16,6 @@ void() finale_2;
void() finale_3;
void() finale_4;
entity shub;
$frame old1 old2 old3 old4 old5 old6 old7 old8 old9
@ -78,7 +77,6 @@ void() old_idle44 =[ $old44, old_idle45 ] {};
void() old_idle45 =[ $old45, old_idle46 ] {};
void() old_idle46 =[ $old46, old_idle1 ] {};
void() old_thrash1 =[ $shake1, old_thrash2 ] {lightstyle(0, "m");};
void() old_thrash2 =[ $shake2, old_thrash3 ] {lightstyle(0, "k");};
void() old_thrash3 =[ $shake3, old_thrash4 ] {lightstyle(0, "k");};
@ -93,10 +91,11 @@ void() old_thrash11 =[ $shake11, old_thrash12 ] {lightstyle(0, "
void() old_thrash12 =[ $shake12, old_thrash13 ] {lightstyle(0, "i");};
void() old_thrash13 =[ $shake13, old_thrash14 ] {lightstyle(0, "k");};
void() old_thrash14 =[ $shake14, old_thrash15 ] {lightstyle(0, "m");};
void() old_thrash15 =[ $shake15, old_thrash16 ] {lightstyle(0, "m");
self.cnt = self.cnt + 1;
if (self.cnt != 3)
self.think = old_thrash1;
void() old_thrash15 =[ $shake15, old_thrash16 ] {
lightstyle (0, "m");
self.cnt = self.cnt + 1;
if (self.cnt != 3)
self.think = old_thrash1;
};
void() old_thrash16 =[ $shake16, old_thrash17 ] {lightstyle(0, "g");};
void() old_thrash17 =[ $shake17, old_thrash18 ] {lightstyle(0, "c");};
@ -127,8 +126,7 @@ void() finale_1 =
WriteString (MSG_ALL, "");
pl = find (world, classname, "player");
while (pl != world)
{
while (pl != world) {
pl.view_ofs = '0 0 0';
pl.angles = other.v_angle = pos.mangle;
pl.fixangle = TRUE; // turn this way immediately
@ -158,11 +156,8 @@ void() finale_2 =
// start a teleport splash inside shub
o = shub.origin - '0 100 0';
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TELEPORT);
WriteCoord (MSG_BROADCAST, o_x);
WriteCoord (MSG_BROADCAST, o_y);
WriteCoord (MSG_BROADCAST, o_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_TELEPORT);
WriteCoordV (MSG_BROADCAST, o);
sound (shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
@ -191,19 +186,16 @@ void() finale_4 =
oldo = self.origin;
z = 16;
while (z <= 144)
{
while (z <= 144) {
x = -64;
while (x <= 64)
{
while (x <= 64) {
y = -64;
while (y <= 64)
{
while (y <= 64) {
self.origin_x = oldo_x + x;
self.origin_y = oldo_y + y;
self.origin_z = oldo_z + z;
r = random();
r = random ();
if (r < 0.3)
ThrowGib ("progs/gib1.mdl", -999);
else if (r < 0.6)
@ -220,7 +212,7 @@ void() finale_4 =
WriteByte (MSG_ALL, SVC_FINALE);
WriteString (MSG_ALL, "Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you.");
// put a player model down
// put a player model down
n = spawn();
setmodel (n, "progs/player.mdl");
oldo = oldo - '32 264 0';
@ -230,10 +222,8 @@ void() finale_4 =
remove (self);
// switch cd track
WriteByte (MSG_ALL, SVC_CDTRACK);
WriteByte (MSG_ALL, 3);
// WriteByte (MSG_ALL, 3);
// switch cd track
WriteBytes (MSG_ALL, SVC_CDTRACK, 3.0);
lightstyle(0, "m");
};
@ -246,13 +236,11 @@ void (entity attacker, float damage) nopain =
//============================================================================
/*QUAKED monster_oldone (1 0 0) (-16 -16 -24) (16 16 32)
*/
void() monster_oldone =
{
if (deathmatch)
{
if (deathmatch) {
remove(self);
return;
}
@ -280,4 +268,3 @@ void() monster_oldone =
total_monsters = total_monsters + 1;
};

View file

@ -1,5 +1,3 @@
void() plat_center_touch;
void() plat_outside_touch;
void() plat_trigger_use;
@ -13,9 +11,7 @@ void() plat_spawn_inside_trigger =
local entity trigger;
local vector tmin, tmax;
//
// middle trigger
//
// middle trigger
trigger = spawn();
trigger.touch = plat_center_touch;
trigger.movetype = MOVETYPE_NONE;
@ -28,13 +24,11 @@ void() plat_spawn_inside_trigger =
if (self.spawnflags & PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (self.size_x <= 50)
{
if (self.size_x <= 50) {
tmin_x = (self.mins_x + self.maxs_x) / 2;
tmax_x = tmin_x + 1;
}
if (self.size_y <= 50)
{
if (self.size_y <= 50) {
tmin_y = (self.mins_y + self.maxs_y) / 2;
tmax_y = tmin_y + 1;
}
@ -93,7 +87,7 @@ void() plat_outside_touch =
if (other.health <= 0)
return;
//dprint ("plat_outside_touch\n");
// dprint ("plat_outside_touch\n");
self = self.enemy;
if (self.state == STATE_TOP)
plat_go_down ();
@ -109,7 +103,7 @@ void() plat_trigger_use =
void() plat_crush =
{
//dprint ("plat_crush\n");
// dprint ("plat_crush\n");
other.deathtype = "squish";
T_Damage (other, self, self, 1);
@ -143,10 +137,7 @@ Set "sounds" to one of the following:
1) base fast
2) chain slow
*/
void() func_plat =
{
if (!self.t_length)
self.t_length = 80;
@ -155,25 +146,22 @@ void() func_plat =
if (self.sounds == 0)
self.sounds = 2;
// FIX THIS TO LOAD A GENERIC PLAT SOUND
if (self.sounds == 1)
{
// FIX THIS TO LOAD A GENERIC PLAT SOUND
if (self.sounds == 1) {
precache_sound ("plats/plat1.wav");
precache_sound ("plats/plat2.wav");
self.noise = "plats/plat1.wav";
self.noise1 = "plats/plat2.wav";
}
if (self.sounds == 2)
{
if (self.sounds == 2) {
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
self.noise = "plats/medplat1.wav";
self.noise1 = "plats/medplat2.wav";
}
self.mangle = self.angles;
self.angles = '0 0 0';
@ -188,7 +176,7 @@ void() func_plat =
if (!self.speed)
self.speed = 150;
// pos1 is the top position, pos2 is the bottom
// pos1 is the top position, pos2 is the bottom
self.pos1 = self.origin;
self.pos2 = self.origin;
if (self.height)
@ -200,13 +188,10 @@ void() func_plat =
plat_spawn_inside_trigger (); // the "start moving" trigger
if (self.targetname)
{
if (self.targetname) {
self.state = STATE_UP;
self.use = plat_use;
}
else
{
} else {
setorigin (self, self.pos2);
self.state = STATE_BOTTOM;
}
@ -230,17 +215,15 @@ void() train_use =
{
if (self.think != func_train_find)
return; // already activated
train_next();
train_next ();
};
void() train_wait =
{
if (self.wait)
{
if (self.wait) {
self.nextthink = self.ltime + self.wait;
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
else
} else
self.nextthink = self.ltime + 0.1;
self.think = train_next;
@ -263,15 +246,13 @@ void() train_next =
};
void() func_train_find =
{
local entity targ;
targ = find (world, targetname, self.target);
self.target = targ.target;
setorigin (self, targ.origin - self.mins);
if (!self.targetname)
{ // not triggered, so start immediately
if (!self.targetname) { // not triggered, so start immediately
self.nextthink = self.ltime + 0.1;
self.think = train_next;
}
@ -297,16 +278,14 @@ void() func_train =
if (!self.dmg)
self.dmg = 2;
if (self.sounds == 0)
{
if (self.sounds == 0) {
self.noise = ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = ("misc/null.wav");
precache_sound ("misc/null.wav");
}
if (self.sounds == 1)
{
if (self.sounds == 1) {
self.noise = ("plats/train2.wav");
precache_sound ("plats/train2.wav");
self.noise1 = ("plats/train1.wav");
@ -324,8 +303,8 @@ void() func_train =
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};
@ -357,9 +336,8 @@ void() misc_teleporttrain =
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};

View file

@ -1,4 +1,3 @@
void() bubble_bob;
/*
@ -14,34 +13,23 @@ $origin 0 -6 24
$base base
$skin skin
//
// running
//
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
//
// standing
//
$frame stand1 stand2 stand3 stand4 stand5
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
//
// pain
//
$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
$frame pain1 pain2 pain3 pain4 pain5 pain6
//
// death
//
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9
@ -60,9 +48,7 @@ $frame deathd8 deathd9
$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
$frame deathe8 deathe9
//
// attacks
//
$frame nailatt1 nailatt2
$frame light1 light2
@ -79,7 +65,6 @@ $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
/*
==============================================================================
PLAYER
@ -91,21 +76,17 @@ void() player_run;
void() player_stand1 =[ $axstnd1, player_stand1 ]
{
self.weaponframe=0;
if (self.velocity_x || self.velocity_y)
{
if (self.velocity_x || self.velocity_y) {
self.walkframe=0;
player_run();
return;
}
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
if (self.walkframe >= 12)
self.walkframe = 0;
self.frame = $axstnd1 + self.walkframe;
}
else
{
} else {
if (self.walkframe >= 5)
self.walkframe = 0;
self.frame = $stand1 + self.walkframe;
@ -116,21 +97,17 @@ void() player_stand1 =[ $axstnd1, player_stand1 ]
void() player_run =[ $rockrun1, player_run ]
{
self.weaponframe=0;
if (!self.velocity_x && !self.velocity_y)
{
if (!self.velocity_x && !self.velocity_y) {
self.walkframe=0;
player_stand1();
return;
}
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = $axrun1 + self.walkframe;
}
else
{
} else {
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = self.frame + self.walkframe;
@ -146,7 +123,10 @@ void()muzzleflash =
};
void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;muzzleflash();};
void() player_shot1 = [$shotatt1, player_shot2 ] {
self.weaponframe = 1;
muzzleflash ();
};
void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
@ -155,25 +135,36 @@ void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};
void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe=3;W_FireAxe();};
void() player_axe3 = [$axatt3, player_axe4 ] {
self.weaponframe = 3;
W_FireAxe ();
};
void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe=5;};
void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe=6;};
void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe=7;W_FireAxe();};
void() player_axeb3 = [$axattb3, player_axeb4 ] {
self.weaponframe = 7;
W_FireAxe ();
};
void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe=1;};
void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe=2;};
void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe=3;W_FireAxe();};
void() player_axec3 = [$axattc3, player_axec4 ] {
self.weaponframe = 3;
W_FireAxe ();
};
void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe=5;};
void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe=6;};
void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe=7;W_FireAxe();};
void() player_axed3 = [$axattd3, player_axed4 ] {
self.weaponframe = 7;
W_FireAxe ();
};
void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
//============================================================================
void() player_nail1 =[$nailatt1, player_nail2 ]
@ -189,6 +180,7 @@ void() player_nail1 =[$nailatt1, player_nail2 ]
W_FireSpikes (4);
self.attack_finished = time + 0.2;
};
void() player_nail2 =[$nailatt2, player_nail1 ]
{
muzzleflash();
@ -218,6 +210,7 @@ void() player_light1 =[$light1, player_light2 ]
W_FireLightning();
self.attack_finished = time + 0.2;
};
void() player_light2 =[$light2, player_light1 ]
{
muzzleflash();
@ -234,7 +227,6 @@ void() player_light2 =[$light2, player_light1 ]
//============================================================================
void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
muzzleflash();};
void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
@ -246,94 +238,99 @@ void(float num_bubbles) DeathBubbles;
void() PainSound =
{
local float rs;
local float rs;
if (self.health < 0)
return;
if (damage_attacker.classname == "teledeath")
{
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
// water pain sounds
if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
{
DeathBubbles(1);
if (random() > 0.5)
// water pain sounds
if (self.watertype == CONTENT_WATER && self.waterlevel == 3) {
DeathBubbles (1);
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
return;
}
// slime pain sounds
if (self.watertype == CONTENT_SLIME)
{
// FIX ME put in some steam here
if (random() > 0.5)
// slime pain sounds
if (self.watertype == CONTENT_SLIME) {
// FIXME put in some steam here
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
}
if (self.watertype == CONTENT_LAVA)
{
if (random() > 0.5)
if (self.watertype == CONTENT_LAVA) {
// FIXME put in some steam here
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
}
if (self.pain_finished > time)
{
if (self.pain_finished > time) {
self.axhitme = 0;
return;
}
self.pain_finished = time + 0.5;
// don't make multiple pain sounds right after each other
// don't make multiple pain sounds right after each other
// ax pain sound
if (self.axhitme == 1)
{
// ax pain sound
if (self.axhitme == 1) {
self.axhitme = 0;
sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
return;
}
rs = rint((random() * 5) + 1);
self.noise = "";
if (rs == 1)
switch (rint (5 * random ())) {
case 0:
self.noise = "player/pain1.wav";
else if (rs == 2)
break;
case 1:
self.noise = "player/pain2.wav";
else if (rs == 3)
break;
case 2:
self.noise = "player/pain3.wav";
else if (rs == 4)
break;
case 3:
self.noise = "player/pain4.wav";
else if (rs == 5)
break;
case 4:
self.noise = "player/pain5.wav";
else
break;
default:
case 5:
self.noise = "player/pain6.wav";
break;
}
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
return;
};
void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
void() player_pain1 = [ $pain1, player_pain2 ] {
PainSound ();
self.weaponframe = 0;
};
void() player_pain2 = [ $pain2, player_pain3 ] {};
void() player_pain3 = [ $pain3, player_pain4 ] {};
void() player_pain4 = [ $pain4, player_pain5 ] {};
void() player_pain5 = [ $pain5, player_pain6 ] {};
void() player_pain6 = [ $pain6, player_run ] {};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {
PainSound ();
self.weaponframe = 0;
};
void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
@ -363,10 +360,11 @@ void() player_die_ax1;
void() DeathBubblesSpawn =
{
local entity bubble;
local entity bubble;
if (self.owner.waterlevel != 3)
return;
bubble = spawn();
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.owner.origin + '0 0 24');
bubble.movetype = MOVETYPE_NOCLIP;
@ -382,14 +380,14 @@ local entity bubble;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
remove(self);
remove (self);
};
void(float num_bubbles) DeathBubbles =
{
local entity bubble_spawner;
bubble_spawner = spawn();
local entity bubble_spawner;
bubble_spawner = spawn ();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
@ -401,20 +399,18 @@ local entity bubble_spawner;
return;
};
void() DeathSound =
{
local float rs;
local float rs;
// water death sounds
if (self.waterlevel == 3)
{
DeathBubbles(5);
if (self.waterlevel == 3) {
DeathBubbles (5);
sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
return;
}
rs = rint ((random() * 4) + 1);
rs = rint ((random () * 4) + 1);
if (rs == 1)
self.noise = "player/death1.wav";
if (rs == 2)
@ -430,49 +426,37 @@ local float rs;
return;
};
void() PlayerDead =
{
self.nextthink = -1;
// allow respawn after a certain time
// allow respawn after a certain time
self.deadflag = DEAD_DEAD;
};
vector(float dm) VelocityForDamage =
{
local vector v;
local vector v;
if (vlen(damage_inflictor.velocity)>0)
{
if (vlen (damage_inflictor.velocity) > 0) {
v = 0.5 * damage_inflictor.velocity;
v = v + (25 * normalize(self.origin-damage_inflictor.origin));
v_z = 100 + 240 * random();
v_x = v_x + (200 * crandom());
v_y = v_y + (200 * crandom());
//dprint ("Velocity gib\n");
}
else
{
v_x = 100 * crandom();
v_y = 100 * crandom();
v_z = 200 + 100 * random();
v += 25 * normalize (self.origin - damage_inflictor.origin);
v_x += 400 * (random () - 0.5);
v_y += 400 * (random () - 0.5);
v_z = 100 + 240 * random ();
// dprint ("Velocity gib\n");
} else {
v_x = 200 * (random () - 0.5);
v_y = 200 * (random () - 0.5);
v_z = 200 + 100 * random ();
}
//v_x = 100 * crandom();
//v_y = 100 * crandom();
//v_z = 200 + 100 * random();
if (dm > -50)
{
// dprint ("level 1\n");
if (dm > -50) {
// dprint ("level 1\n");
v = v * 0.7;
}
else if (dm > -200)
{
// dprint ("level 3\n");
} else if (dm > -200) {
// dprint ("level 3\n");
v = v * 2;
}
else
} else
v = v * 10;
return v;
@ -480,7 +464,7 @@ vector(float dm) VelocityForDamage =
void(string gibname, float dm) ThrowGib =
{
local entity new;
local entity new;
new = spawn();
new.origin = self.origin;
@ -489,12 +473,12 @@ void(string gibname, float dm) ThrowGib =
new.velocity = VelocityForDamage (dm);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.avelocity_x = random () * 600;
new.avelocity_y = random () * 600;
new.avelocity_z = random () * 600;
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.nextthink = time + 10 + random () * 10;
new.frame = 0;
new.flags = 0;
};
@ -512,10 +496,9 @@ void(string gibname, float dm) ThrowHead =
self.velocity = VelocityForDamage (dm);
self.origin_z = self.origin_z - 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.avelocity = crandom() * '0 600 0';
self.avelocity = (random () - 0.5) * '0 1200 0';
};
void() GibPlayer =
{
ThrowHead ("progs/h_player.mdl", self.health);
@ -525,19 +508,17 @@ void() GibPlayer =
self.deadflag = DEAD_DEAD;
if (damage_attacker.classname == "teledeath")
{
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (damage_attacker.classname == "teledeath2")
{
if (damage_attacker.classname == "teledeath2") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (random() < 0.5)
if (random () < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
else
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
@ -549,29 +530,25 @@ void() PlayerDie =
local string s;
self.items = self.items - (self.items & IT_INVISIBILITY);
if ((stof(infokey(world,"dq"))) != 0)
{
if (self.super_damage_finished > 0)
{
if ((stof (infokey (world, "dq"))) != 0) {
if (self.super_damage_finished > 0) {
DropQuad (self.super_damage_finished - time);
bprint (PRINT_LOW, self.netname);
if (deathmatch == 4)
bprint (PRINT_LOW, " lost an OctaPower with ");
else
bprint (PRINT_LOW, " lost a quad with ");
s = ftos(rint(self.super_damage_finished - time));
s = ftos (rint (self.super_damage_finished - time));
bprint (PRINT_LOW, s);
bprint (PRINT_LOW, " seconds remaining\n");
}
}
if ((stof(infokey(world,"dr"))) != 0)
{
if (self.invisible_finished > 0)
{
if ((stof (infokey (world, "dr"))) != 0) {
if (self.invisible_finished > 0) {
bprint (PRINT_LOW, self.netname);
bprint (PRINT_LOW, " lost a ring with ");
s = ftos(rint(self.invisible_finished - time));
s = ftos (rint (self.invisible_finished - time));
bprint (PRINT_LOW, s);
bprint (PRINT_LOW, " seconds remaining\n");
DropRing (self.invisible_finished - time);
@ -584,19 +561,18 @@ void() PlayerDie =
self.radsuit_finished = 0;
self.modelindex = modelindex_player; // don't use eyes
DropBackpack();
DropBackpack ();
self.weaponmodel="";
self.weaponmodel = "";
self.view_ofs = '0 0 -8';
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.movetype = MOVETYPE_TOSS;
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;
self.velocity_z = self.velocity_z + random () * 300;
if (self.health < -40)
{
if (self.health < -40) {
GibPlayer ();
return;
}
@ -606,15 +582,14 @@ void() PlayerDie =
self.angles_x = 0;
self.angles_z = 0;
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
player_die_ax1 ();
return;
}
i = cvar("temp1");
if (!i)
i = 1 + floor(random()*6);
i = 1 + floor (6 * random ());
if (i == 1)
player_diea1();

View file

@ -1,8 +1,6 @@
/*
in nightmare mode, all attack_finished times become 0
some monsters refire twice automatically
*/
void(float normal) SUB_AttackFinished =

View file

@ -1,6 +1,5 @@
void() monster_death_use;
void() monster_ogre = {remove(self);};
void() monster_demon1 = {remove(self);};
void() monster_shambler = {remove(self);};
@ -20,7 +19,6 @@ void() event_lightning = {remove(self);};
/*
==============================================================================
MOVETARGET CODE
The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
@ -33,7 +31,6 @@ the next spot to move to. If not present, stop here for good.
pausetime
The number of seconds to spend standing or bowing for path_stand or path_bow
==============================================================================
*/
@ -47,11 +44,11 @@ moving towards it, change the next destination and continue.
*/
void() t_movetarget =
{
local entity temp;
local entity temp;
if (other.movetarget != self)
return;
if (other.enemy)
return; // fighting, not following a path
@ -62,28 +59,24 @@ local entity temp;
if (self.classname == "monster_ogre")
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
//dprint ("t_movetarget\n");
// dprint ("t_movetarget\n");
self.goalentity = self.movetarget = find (world, targetname, other.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
self.ideal_yaw = vectoyaw (self.goalentity.origin - self.origin);
if (!self.movetarget) {
self.pausetime = time + 999999;
self.th_stand ();
return;
}
};
void() movetarget_f =
{
if (!self.targetname)
objerror ("monster_movetarget: no targetname");
self.solid = SOLID_TRIGGER;
self.touch = t_movetarget;
setsize (self, '-8 -8 -8', '8 8 8');
};
/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
@ -93,6 +86,3 @@ void() path_corner =
{
movetarget_f ();
};
//============================================================================

View file

@ -26,9 +26,10 @@ void() ShalMissile;
void() shal_stand =[ $walk1, shal_stand ] {ai_stand();};
void() shal_walk1 =[ $walk2, shal_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_walk(6);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_walk (6);
};
void() shal_walk2 =[ $walk3, shal_walk3 ] {ai_walk(4);};
void() shal_walk3 =[ $walk4, shal_walk4 ] {ai_walk(0);};
void() shal_walk4 =[ $walk5, shal_walk5 ] {ai_walk(0);};
@ -42,9 +43,10 @@ void() shal_walk11 =[ $walk12, shal_walk12 ] {ai_walk(4);};
void() shal_walk12 =[ $walk1, shal_walk1 ] {ai_walk(5);};
void() shal_run1 =[ $walk2, shal_run2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_run(6);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
ai_run (6);
};
void() shal_run2 =[ $walk3, shal_run3 ] {ai_run(4);};
void() shal_run3 =[ $walk4, shal_run4 ] {ai_run(0);};
void() shal_run4 =[ $walk5, shal_run5 ] {ai_run(0);};
@ -58,8 +60,8 @@ void() shal_run11 =[ $walk12, shal_run12 ] {ai_run(4);};
void() shal_run12 =[ $walk1, shal_run1 ] {ai_run(5);};
void() shal_attack1 =[ $attack1, shal_attack2 ] {
sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
ai_face();
sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
ai_face ();
};
void() shal_attack2 =[ $attack2, shal_attack3 ] {ai_face();};
void() shal_attack3 =[ $attack3, shal_attack4 ] {ai_face();};
@ -93,15 +95,14 @@ void(entity attacker, float damage) shalrath_pain =
return;
sound (self, CHAN_VOICE, "shalrath/pain.wav", 1, ATTN_NORM);
shal_pain1();
shal_pain1 ();
self.pain_finished = time + 3;
};
void() shalrath_die =
{
// check for gib
if (self.health < -90)
{
// check for gib
if (self.health < -90) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_shal.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -111,9 +112,8 @@ void() shalrath_die =
}
sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
shal_death1();
shal_death1 ();
self.solid = SOLID_NOT;
// insert death sounds here
};
/*
@ -135,7 +135,7 @@ void() ShalMissile =
if (flytime < 0.1)
flytime = 0.1;
muzzleflash();
muzzleflash ();
sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
missile = spawn ();
@ -160,8 +160,7 @@ void() ShalHome =
{
local vector dir, vtemp;
vtemp = self.enemy.origin + '0 0 10';
if (self.enemy.health < 1)
{
if (self.enemy.health < 1) {
remove(self);
return;
}
@ -184,11 +183,8 @@ void() ShalMissileTouch =
T_RadiusDamage (self, self.owner, 40, world, "shalrath");
sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_EXPLOSION);
WriteCoordV (MSG_BROADCAST, self.origin);
multicast (self.origin, MULTICAST_PHS);
remove (self);
@ -200,25 +196,25 @@ void() ShalMissileTouch =
*/
void() monster_shalrath =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model2 ("progs/shalrath.mdl");
precache_model2 ("progs/h_shal.mdl");
precache_model2 ("progs/v_spike.mdl");
precache_sound2 ("shalrath/attack.wav");
precache_sound2 ("shalrath/attack2.wav");
precache_sound2 ("shalrath/death.wav");
precache_sound2 ("shalrath/idle.wav");
precache_sound2 ("shalrath/pain.wav");
precache_sound2 ("shalrath/sight.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/shalrath.mdl");
setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = 400;
@ -231,6 +227,5 @@ void() monster_shalrath =
self.th_missile = shal_attack1;
self.think = walkmonster_start;
self.nextthink = time + 0.1 + random ()*0.1;
self.nextthink = time + 0.1 + random () * 0.1;
};

View file

@ -65,23 +65,27 @@ void() sham_walk8 =[ $walk8, sham_walk9 ] {ai_walk(3);};
void() sham_walk9 =[ $walk9, sham_walk10] {ai_walk(13);};
void() sham_walk10 =[ $walk10, sham_walk11] {ai_walk(9);};
void() sham_walk11 =[ $walk11, sham_walk12] {ai_walk(7);};
void() sham_walk12 =[ $walk12, sham_walk1 ] {ai_walk(7);
if (random() > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);};
void() sham_walk12 =[ $walk12, sham_walk1 ] {
ai_walk (7);
if (random () > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
};
void() sham_run1 =[ $run1, sham_run2 ] {ai_run(20);};
void() sham_run2 =[ $run2, sham_run3 ] {ai_run(24);};
void() sham_run3 =[ $run3, sham_run4 ] {ai_run(20);};
void() sham_run4 =[ $run4, sham_run5 ] {ai_run(20);};
void() sham_run5 =[ $run5, sham_run6 ] {ai_run(24);};
void() sham_run6 =[ $run6, sham_run1 ] {ai_run(20);
if (random() > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
void() sham_run6 =[ $run6, sham_run1 ] {
ai_run (20);
if (random () > 0.8)
sound (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
};
void() sham_smash1 =[ $smash1, sham_smash2 ] {
sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
ai_charge(2);};
sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
ai_charge (2);
};
void() sham_smash2 =[ $smash2, sham_smash3 ] {ai_charge(6);};
void() sham_smash3 =[ $smash3, sham_smash4 ] {ai_charge(6);};
void() sham_smash4 =[ $smash4, sham_smash5 ] {ai_charge(5);};
@ -91,26 +95,29 @@ void() sham_smash7 =[ $smash7, sham_smash8 ] {ai_charge(0);};
void() sham_smash8 =[ $smash8, sham_smash9 ] {ai_charge(0);};
void() sham_smash9 =[ $smash9, sham_smash10 ] {ai_charge(0);};
void() sham_smash10 =[ $smash10, sham_smash11 ] {
local vector delta;
local float ldmg;
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(0);
ai_charge (0);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
if (vlen (delta) > 100)
return;
if (!CanDamage (self.enemy, self))
return;
ldmg = (random() + random() + random()) * 40;
ldmg = 40 * (random () + random () + random ());
T_Damage (self.enemy, self, self, ldmg);
sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
SpawnMeatSpray (self.origin + v_forward * 16,
v_right * (200 * (random () - 0.5));
SpawnMeatSpray (self.origin + v_forward * 16,
v_right * (200 * (random () - 0.5));
};
void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);};
void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);};
@ -119,43 +126,46 @@ void() sham_swingr1;
void(float side) ShamClaw =
{
local vector delta;
local float ldmg;
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(10);
ai_charge (10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
if (vlen (delta) > 100)
return;
ldmg = (random() + random() + random()) * 20;
ldmg = 20 * (random () + random () + random ());
T_Damage (self.enemy, self, self, ldmg);
sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
if (side)
{
if (side) {
makevectors (self.angles);
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
SpawnMeatSpray (self.origin + v_forward * 16, side * v_right);
}
};
void() sham_swingl1 =[ $swingl1, sham_swingl2 ] {
sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM);
ai_charge(5);};
sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM);
ai_charge (5);
};
void() sham_swingl2 =[ $swingl2, sham_swingl3 ] {ai_charge(3);};
void() sham_swingl3 =[ $swingl3, sham_swingl4 ] {ai_charge(7);};
void() sham_swingl4 =[ $swingl4, sham_swingl5 ] {ai_charge(3);};
void() sham_swingl5 =[ $swingl5, sham_swingl6 ] {ai_charge(7);};
void() sham_swingl6 =[ $swingl6, sham_swingl7 ] {ai_charge(9);};
void() sham_swingl7 =[ $swingl7, sham_swingl8 ] {ai_charge(5); ShamClaw(250);};
void() sham_swingl7 =[ $swingl7, sham_swingl8 ] {
ai_charge (5);
ShamClaw (250);
};
void() sham_swingl8 =[ $swingl8, sham_swingl9 ] {ai_charge(4);};
void() sham_swingl9 =[ $swingl9, sham_run1 ] {
ai_charge(8);
if (random()<0.5)
self.think = sham_swingr1;
ai_charge (8);
if (random () < 0.5)
self.think = sham_swingr1;
};
void() sham_swingr1 =[ $swingr1, sham_swingr2 ] {
@ -170,23 +180,26 @@ void() sham_swingr7 =[ $swingr7, sham_swingr8 ] {ai_charge(6); ShamC
void() sham_swingr8 =[ $swingr8, sham_swingr9 ] {ai_charge(3);};
void() sham_swingr9 =[ $swingr9, sham_run1 ] {ai_charge(1);
ai_charge(10);
if (random()<0.5)
if (random () < 0.5)
self.think = sham_swingl1;
};
void() sham_melee =
{
local float chance;
chance = random();
if (chance > 0.6 || self.health == 600)
sham_smash1 ();
else if (chance > 0.3)
sham_swingr1 ();
else
sham_swingl1 ();
};
if (self.health == 600) {
sham_smash1 ();
} else {
chance = random ();
if (chance > 0.6)
sham_smash1 ();
else if (chance > 0.3)
sham_swingr1 ();
else
sham_swingl1 ();
}
};
//============================================================================
@ -203,62 +216,60 @@ void() CastLightning =
dir = self.enemy.origin + '0 0 16' - org;
dir = normalize (dir);
traceline (org, self.origin + dir*600, TRUE, self);
traceline (org, self.origin + dir * 600, TRUE, self);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING1);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_LIGHTNING1);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
WriteCoordV (MSG_BROADCAST, org);
WriteCoordV (MSG_BROADCAST, trace_endpos);
LightningDamage (org, trace_endpos, self, 10);
};
void() sham_magic1 =[ $magic1, sham_magic2 ] {ai_face();
void() sham_magic1 =[ $magic1, sham_magic2 ] {
ai_face();
sound (self, CHAN_WEAPON, "shambler/sattck1.wav", 1, ATTN_NORM);
};
void() sham_magic2 =[ $magic2, sham_magic3 ] {ai_face();};
void() sham_magic3 =[ $magic3, sham_magic4 ] {ai_face();self.nextthink = self.nextthink + 0.2;
local entity o;
void() sham_magic3 =[ $magic3, sham_magic4 ] {
ai_face();
self.nextthink = self.nextthink + 0.2;
local entity o;
muzzleflash();
ai_face();
self.owner = spawn();
o = self.owner;
setmodel (o, "progs/s_light.mdl");
setorigin (o, self.origin);
o.angles = self.angles;
o.nextthink = time + 0.7;
o.think = SUB_Remove;
muzzleflash();
ai_face();
self.owner = spawn();
o = self.owner;
setmodel (o, "progs/s_light.mdl");
setorigin (o, self.origin);
o.angles = self.angles;
o.nextthink = time + 0.7;
o.think = SUB_Remove;
};
void() sham_magic4 =[ $magic4, sham_magic5 ]
{
muzzleflash();
self.owner.frame = 1;
muzzleflash ();
self.owner.frame = 1;
};
void() sham_magic5 =[ $magic5, sham_magic6 ]
{
muzzleflash();
self.owner.frame = 2;
muzzleflash ();
self.owner.frame = 2;
};
void() sham_magic6 =[ $magic6, sham_magic9 ]
{
remove (self.owner);
CastLightning();
sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
remove (self.owner);
CastLightning();
sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
};
void() sham_magic9 =[ $magic9, sham_magic10 ]
{CastLightning();};
{CastLightning ();};
void() sham_magic10 =[ $magic10, sham_magic11 ]
{CastLightning();};
{CastLightning ();};
void() sham_magic11 =[ $magic11, sham_magic12 ]
{
if (skill == 3)
CastLightning();
if (skill == 3)
CastLightning ();
};
void() sham_magic12 =[ $magic12, sham_run1 ] {};
@ -278,7 +289,7 @@ void(entity attacker, float damage) sham_pain =
if (self.health <= 0)
return; // allready dying, don't go into pain frame
if (random()*400 > damage)
if (random () * 400 > damage)
return; // didn't flinch
if (self.pain_finished > time)
@ -305,9 +316,8 @@ void() sham_death11 =[ $death11, sham_death11 ] {};
void() sham_die =
{
// check for gib
if (self.health < -60)
{
// check for gib
if (self.health < -60) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_shams.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -316,23 +326,22 @@ void() sham_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
sham_death1 ();
};
//============================================================================
/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_shambler =
{
if (deathmatch)
{
if (deathmatch) {
remove(self);
return;
}
precache_model ("progs/shambler.mdl");
precache_model ("progs/s_light.mdl");
precache_model ("progs/h_shams.mdl");
@ -363,5 +372,5 @@ void() monster_shambler =
self.th_missile = sham_magic1;
self.th_pain = sham_pain;
walkmonster_start();
walkmonster_start ();
};

View file

@ -55,9 +55,10 @@ void() army_stand7 =[ $stand7, army_stand8 ] {ai_stand();};
void() army_stand8 =[ $stand8, army_stand1 ] {ai_stand();};
void() army_walk1 =[ $prowl_1, army_walk2 ] {
if (random() < 0.2)
sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
ai_walk(1);};
if (random () < 0.2)
sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
ai_walk (1);
};
void() army_walk2 =[ $prowl_2, army_walk3 ] {ai_walk(1);};
void() army_walk3 =[ $prowl_3, army_walk4 ] {ai_walk(1);};
void() army_walk4 =[ $prowl_4, army_walk5 ] {ai_walk(1);};
@ -83,9 +84,10 @@ void() army_walk23 =[ $prowl_23, army_walk24 ] {ai_walk(1);};
void() army_walk24 =[ $prowl_24, army_walk1 ] {ai_walk(1);};
void() army_run1 =[ $run1, army_run2 ] {
if (random() < 0.2)
if (random () < 0.2)
sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
ai_run(11);};
ai_run (11);
};
void() army_run2 =[ $run2, army_run3 ] {ai_run(15);};
void() army_run3 =[ $run3, army_run4 ] {ai_run(10);};
void() army_run4 =[ $run4, army_run5 ] {ai_run(10);};
@ -98,9 +100,16 @@ void() army_atk1 =[ $shoot1, army_atk2 ] {ai_face();};
void() army_atk2 =[ $shoot2, army_atk3 ] {ai_face();};
void() army_atk3 =[ $shoot3, army_atk4 ] {ai_face();};
void() army_atk4 =[ $shoot4, army_atk5 ] {ai_face();};
void() army_atk5 =[ $shoot5, army_atk6 ] {ai_face();army_fire();muzzleflash();};
void() army_atk5 =[ $shoot5, army_atk6 ] {
ai_face ();
army_fire ();
muzzleflash ();
};
void() army_atk6 =[ $shoot6, army_atk7 ] {ai_face();};
void() army_atk7 =[ $shoot7, army_atk8 ] {ai_face();SUB_CheckRefire (army_atk1);};
void() army_atk7 =[ $shoot7, army_atk8 ] {
ai_face ();
SUB_CheckRefire (army_atk1);
};
void() army_atk8 =[ $shoot8, army_atk9 ] {ai_face();};
void() army_atk9 =[ $shoot9, army_run1 ] {ai_face();};
@ -148,53 +157,47 @@ void(entity attacker, float damage) army_pain =
if (self.pain_finished > time)
return;
r = random();
if (r < 0.2)
{
r = random ();
if (r < 0.2) {
self.pain_finished = time + 0.6;
army_pain1 ();
sound (self, CHAN_VOICE, "soldier/pain1.wav", 1, ATTN_NORM);
}
else if (r < 0.6)
{
} else if (r < 0.6) {
self.pain_finished = time + 1.1;
army_painb1 ();
sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
}
else
{
} else {
self.pain_finished = time + 1.1;
army_painc1 ();
sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
}
};
void() army_fire =
{
local vector dir;
local entity en;
ai_face();
ai_face ();
sound (self, CHAN_WEAPON, "soldier/sattck1.wav", 1, ATTN_NORM);
// fire somewhat behind the player, so a dodging player is harder to hit
// fire somewhat behind the player, so a dodging player is harder to hit
en = self.enemy;
dir = en.origin - en.velocity*0.2;
dir = en.origin - en.velocity * 0.2;
dir = normalize (dir - self.origin);
FireBullets (4, dir, '0.1 0.1 0');
};
void() army_die1 =[ $death1, army_die2 ] {};
void() army_die2 =[ $death2, army_die3 ] {};
void() army_die3 =[ $death3, army_die4 ]
{self.solid = SOLID_NOT;self.ammo_shells = 5;DropBackpack();};
void() army_die3 =[ $death3, army_die4 ] {
self.solid = SOLID_NOT;
self.ammo_shells = 5;
DropBackpack();
};
void() army_die4 =[ $death4, army_die5 ] {};
void() army_die5 =[ $death5, army_die6 ] {};
void() army_die6 =[ $death6, army_die7 ] {};
@ -205,8 +208,12 @@ void() army_die10 =[ $death10, army_die10 ] {};
void() army_cdie1 =[ $deathc1, army_cdie2 ] {};
void() army_cdie2 =[ $deathc2, army_cdie3 ] {ai_back(5);};
void() army_cdie3 =[ $deathc3, army_cdie4 ]
{self.solid = SOLID_NOT;self.ammo_shells = 5;DropBackpack();ai_back(4);};
void() army_cdie3 =[ $deathc3, army_cdie4 ] {
self.solid = SOLID_NOT;
self.ammo_shells = 5;
DropBackpack ();
ai_back (4);
};
void() army_cdie4 =[ $deathc4, army_cdie5 ] {ai_back(13);};
void() army_cdie5 =[ $deathc5, army_cdie6 ] {ai_back(3);};
void() army_cdie6 =[ $deathc6, army_cdie7 ] {ai_back(4);};
@ -219,9 +226,8 @@ void() army_cdie11 =[ $deathc11, army_cdie11 ] {};
void() army_die =
{
// check for gib
if (self.health < -35)
{
// check for gib
if (self.health < -35) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_guard.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health);
@ -230,9 +236,9 @@ void() army_die =
return;
}
// regular death
// regular death
sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
if (random() < 0.5)
if (random () < 0.5)
army_die1 ();
else
army_cdie1 ();
@ -243,11 +249,11 @@ void() army_die =
*/
void() monster_army =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model ("progs/soldier.mdl");
precache_model ("progs/h_guard.mdl");
precache_model ("progs/gib1.mdl");
@ -263,7 +269,6 @@ void() monster_army =
precache_sound ("player/udeath.wav"); // gib death
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;

View file

@ -50,11 +50,12 @@ void() SpectatorImpulseCommand =
{
if (self.impulse == 1) {
// teleport the spectator to the next spawn point
// note that if the spectator is tracking, this doesn't do
// much
self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
// note that if the spectator is tracking, this doesn't do much
self.goalentity = find (self.goalentity, classname,
"info_player_deathmatch");
if (self.goalentity == world)
self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
self.goalentity = find (self.goalentity, classname,
"info_player_deathmatch");
if (self.goalentity != world) {
setorigin(self, self.goalentity.origin);
self.angles = self.goalentity.angles;
@ -76,9 +77,6 @@ void() SpectatorThink =
{
// self.origin, etc contains spectator position, so you could
// do some neat stuff here
if (self.impulse)
SpectatorImpulseCommand();
};

View file

@ -1,4 +1,3 @@
// these are the only sprites still in the game...
$spritename s_explod
@ -11,16 +10,13 @@ $frame 24 88 56 56
$frame 120 88 56 56
$frame 216 88 56 56
$spritename s_bubble
$type vp_parallel
$load /raid/quake/id1/gfx/sprites/bubble.lbm
$frame 16 16 16 16
$frame 40 16 16 16
$spritename s_light
$type vp_parallel
$load /raid/quake/id1/gfx/sprites/light.lbm
$frame 104 32 32 32

View file

@ -1,10 +1,7 @@
void() SUB_Null = {};
void() SUB_Remove = {remove(self);};
/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles.
@ -15,8 +12,7 @@ vector() SetMovedir =
self.movedir = '0 0 1';
else if (self.angles == '0 -2 0')
self.movedir = '0 0 -1';
else
{
else {
makevectors (self.angles);
self.movedir = v_forward;
}
@ -52,7 +48,8 @@ self.origin traveling at speed
*/
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
{
local entity stemp;
local entity stemp;
stemp = self;
self = ent;
@ -62,8 +59,8 @@ local entity stemp;
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
{
local vector vdestdelta;
local float len, traveltime;
local vector vdestdelta;
local float len, traveltime;
if (!tspeed)
objerror("No speed is defined!");
@ -72,30 +69,29 @@ local float len, traveltime;
self.finaldest = tdest;
self.think = SUB_CalcMoveDone;
if (tdest == self.origin)
{
if (tdest == self.origin) {
self.velocity = '0 0 0';
self.nextthink = self.ltime + 0.1;
return;
}
// set destdelta to the vector needed to move
// set destdelta to the vector needed to move
vdestdelta = tdest - self.origin;
// calculate length of vector
// calculate length of vector
len = vlen (vdestdelta);
// divide by speed to get time to reach dest
// divide by speed to get time to reach dest
traveltime = len / tspeed;
if (traveltime < 0.03)
traveltime = 0.03;
// set nextthink to trigger a think when dest is reached
// set nextthink to trigger a think when dest is reached
self.nextthink = self.ltime + traveltime;
// scale the destdelta vector by the time spent traveling to get velocity
self.velocity = vdestdelta * (1/traveltime); // qcc won't take vec/float
// scale the destdelta vector by the time spent traveling to get velocity
self.velocity = vdestdelta * (1 / traveltime); // qcc won't take vec/float
};
/*
@ -112,7 +108,6 @@ void() SUB_CalcMoveDone =
self.think1();
};
/*
=============
SUB_CalcAngleMove
@ -125,7 +120,8 @@ The calling function should make sure self.think is valid
*/
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt =
{
local entity stemp;
local entity stemp;
stemp = self;
self = ent;
SUB_CalcAngleMove (destangle, tspeed, func);
@ -134,25 +130,25 @@ local entity stemp;
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
{
local vector destdelta;
local float len, traveltime;
local vector destdelta;
local float len, traveltime;
if (!tspeed)
objerror("No speed is defined!");
// set destdelta to the vector needed to move
// set destdelta to the vector needed to move
destdelta = destangle - self.angles;
// calculate length of vector
// calculate length of vector
len = vlen (destdelta);
// divide by speed to get time to reach dest
// divide by speed to get time to reach dest
traveltime = len / tspeed;
// set nextthink to trigger a think when dest is reached
// set nextthink to trigger a think when dest is reached
self.nextthink = self.ltime + traveltime;
// scale the destdelta vector by the time spent traveling to get velocity
// scale the destdelta vector by the time spent traveling to get velocity
self.avelocity = destdelta * (1 / traveltime);
self.think1 = func;
@ -171,10 +167,9 @@ void() SUB_CalcAngleMoveDone =
self.avelocity = '0 0 0';
self.nextthink = -1;
if (self.think1)
self.think1();
self.think1 ();
};
//=============================================================================
void() DelayThink =
@ -183,7 +178,7 @@ void() DelayThink =
activator = self.enemy;
SUB_UseTargets ();
if (rem)
remove(self);
remove (self);
};
/*
@ -202,20 +197,16 @@ and removes them, so some events can remove other triggers.
Search for (string)targetname in all entities that
match (string)self.target and call their .use function
==============================
*/
void() SUB_UseTargets =
{
local entity t, stemp, otemp, act;
//
// check for a delay
//
if (self.delay)
{
// create a temp object to fire at a later time
t = spawn();
// check for a delay
if (self.delay) {
// create a temp object to fire at a later time
t = spawn ();
t.classname = "DelayedUse";
t.nextthink = time + self.delay;
t.think = DelayThink;
@ -225,63 +216,45 @@ void() SUB_UseTargets =
t.target = self.target;
return;
}
//
// print the message
//
if (activator.classname == "player" && self.message != "")
{
// print the message
if (activator.classname == "player" && self.message != "") {
centerprint (activator, self.message);
if (!self.noise)
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
//
// kill the killtagets
//
if (self.killtarget)
{
// kill the killtagets
if (self.killtarget) {
local string kt = self.killtarget;
t = world;
do
{
do {
t = find (t, targetname, kt);
if (!t)
return;
remove (t);
} while ( 1 );
} while (1);
}
//
// fire targets
//
if (self.target)
{
// fire targets
if (self.target) {
act = activator;
t = world;
do
{
do {
t = find (t, targetname, self.target);
if (!t)
{
return;
}
stemp = self;
otemp = other;
self = t;
other = stemp;
if (self.use != SUB_Null)
{
if (self.use != SUB_Null) {
if (self.use)
self.use ();
}
self = stemp;
other = otemp;
activator = act;
} while ( 1 );
} while (1);
}
};

View file

@ -82,21 +82,17 @@ void() tbaby_run23 =[ $run23, tbaby_run24 ] {ai_run(2);};
void() tbaby_run24 =[ $run24, tbaby_run25 ] {ai_run(2);};
void() tbaby_run25 =[ $run25, tbaby_run1 ] {ai_run(2);};
//============================================================================
void() tbaby_jump1;
void() Tar_JumpTouch =
{
local float ldmg;
if (other.takedamage && other.classname != self.classname)
{
if ( vlen(self.velocity) > 400 )
{
ldmg = 10 + 10*random();
if (other.takedamage && other.classname != self.classname) {
if (vlen (self.velocity) > 400) {
ldmg = 10 + 10 * random ();
T_Damage (other, self, self, ldmg);
sound (self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
}
@ -104,19 +100,15 @@ void() Tar_JumpTouch =
else
sound (self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
if (!checkbottom(self))
{
if (self.flags & FL_ONGROUND)
{ // jump randomly to not get hung up
//dprint ("popjump\n");
self.touch = SUB_Null;
self.think = tbaby_run1;
self.movetype = MOVETYPE_STEP;
self.nextthink = time + 0.1;
// self.velocity_x = (random() - 0.5) * 600;
// self.velocity_y = (random() - 0.5) * 600;
if (!checkbottom (self)) {
if (self.flags & FL_ONGROUND) { // jump randomly to not get hung up
// dprint ("popjump\n");
self.touch = SUB_Null;
self.think = tbaby_run1;
self.movetype = MOVETYPE_STEP;
self.nextthink = time + 0.1;
// self.velocity_x = (random () - 0.5) * 600;
// self.velocity_y = (random () - 0.5) * 600;
// self.velocity_z = 200;
// self.flags = self.flags - FL_ONGROUND;
}
@ -134,12 +126,11 @@ void() tbaby_fly1 =[ $fly1, tbaby_fly2 ] {};
void() tbaby_fly2 =[ $fly2, tbaby_fly3 ] {};
void() tbaby_fly3 =[ $fly3, tbaby_fly4 ] {};
void() tbaby_fly4 =[ $fly4, tbaby_fly1 ] {
self.cnt = self.cnt + 1;
if (self.cnt == 4)
{
//dprint ("spawn hop\n");
tbaby_jump5 ();
}
self.cnt = self.cnt + 1;
if (self.cnt == 4) {
// dprint ("spawn hop\n");
tbaby_jump5 ();
}
};
void() tbaby_jump1 =[ $jump1, tbaby_jump2 ] {ai_face();};
@ -153,32 +144,28 @@ void() tbaby_jump5 =[ $jump5, tbaby_jump6 ]
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 600 + '0 0 200';
self.velocity_z = self.velocity_z + random()*150;
self.velocity_z = self.velocity_z + random () * 150;
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
self.cnt = 0;
};
void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
//=============================================================================
void() tbaby_die1 =[ $exp, tbaby_die2 ] {
self.takedamage = DAMAGE_NO;
self.takedamage = DAMAGE_NO;
};
void() tbaby_die2 =[ $exp, tbaby_run1 ]
{
T_RadiusDamage (self, self, 120, world, "tarbaby");
sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
self.origin = self.origin - 8*normalize(self.velocity);
self.origin = self.origin - 8 * normalize (self.velocity);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TAREXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteBytes (MSG_BROADCAST, SVC_TEMPENTITY, TE_TAREXPLOSION);
WriteCoordV (MSG_BROADCAST, self.origin);
multicast (self.origin, MULTICAST_PHS);
remove (self);
@ -186,23 +173,22 @@ void() tbaby_die2 =[ $exp, tbaby_run1 ]
//=============================================================================
/*QUAKED monster_tarbaby (1 0 0) (-16 -16 -24) (16 16 24) Ambush
*/
void() monster_tarbaby =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model2 ("progs/tarbaby.mdl");
precache_sound2 ("blob/death1.wav");
precache_sound2 ("blob/hit1.wav");
precache_sound2 ("blob/land1.wav");
precache_sound2 ("blob/sight1.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
@ -217,7 +203,6 @@ void() monster_tarbaby =
self.th_missile = tbaby_jump1;
self.th_melee = tbaby_jump1;
self.th_die = tbaby_die1;
walkmonster_start ();
};

View file

@ -29,13 +29,11 @@ void() multi_wait =
// so wait for the delay time before firing
void() multi_trigger =
{
if (self.nextthink > time)
{
if (self.nextthink > time) {
return; // allready been triggered
}
if (self.classname == "trigger_secret")
{
if (self.classname == "trigger_secret") {
if (self.enemy.classname != "player")
return;
found_secrets = found_secrets + 1;
@ -279,10 +277,11 @@ float SILENT = 2;
void() play_teleport =
{
local float v;
local string tmpstr;
local float v;
local string tmpstr;
v = 5 * random ();
v = random() * 5;
if (v < 1)
tmpstr = "misc/r_tele1.wav";
else if (v < 2)
@ -305,15 +304,11 @@ void(vector org) spawn_tfog =
s.nextthink = time + 0.2;
s.think = play_teleport;
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_TELEPORT);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_TELEPORT);
WriteCoordV (MSG_MULTICAST, org);
multicast (org, MULTICAST_PHS);
};
void() tdeath_touch =
{
local entity other2;

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,6 @@ $frame death1 death2 death3 death4 death5 death6 death7 death8
/*
==============================================================================
WIZARD
If the player moves behind cover before the missile is launched, launch it
@ -46,61 +45,55 @@ if self.enemy maintains it's current velocity
*/
void(entity missile, float mspeed, float accuracy) LaunchMissile =
{
local vector vec, move;
local float fly;
local float fly;
local vector vec, move;
makevectors (self.angles);
// set missile speed
vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin;
// calc aproximate time for missile to reach vec
// set missile speed
vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7
- missile.origin;
// calc aproximate time for missile to reach vec
fly = vlen (vec) / mspeed;
// get the entities xy velocity
// get the entities xy velocity
move = self.enemy.velocity;
move_z = 0;
// project the target forward in time
// project the target forward in time
vec = vec + move * fly;
vec = normalize(vec);
vec = vec + accuracy*v_up*(random()- 0.5) + accuracy*v_right*(random()- 0.5);
vec = normalize (vec);
vec = vec + (2 * accuracy) * (v_up * (random () - 0.5) + v_right
* (random () - 0.5));
missile.velocity = vec * mspeed;
missile.angles = '0 0 0';
missile.angles_y = vectoyaw(missile.velocity);
missile.angles_y = vectoyaw (missile.velocity);
// set missile duration
// set missile duration
missile.nextthink = time + 5;
missile.think = SUB_Remove;
};
void() wiz_run1;
void() wiz_side1;
/*
=================
WizardCheckAttack
=================
*/
float() WizardCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
local vector spot1, spot2;
if (time < self.attack_finished)
return FALSE;
if (!enemy_vis)
return FALSE;
if (enemy_range == RANGE_FAR)
{
if (self.attack_state != AS_STRAIGHT)
{
if (enemy_range == RANGE_FAR) {
if (self.attack_state != AS_STRAIGHT) {
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
@ -108,50 +101,48 @@ float() WizardCheckAttack =
}
targ = self.enemy;
// see if any entities are in the way of the shot
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_ent != targ)
{ // don't have a clear shot, so move to a side
if (self.attack_state != AS_STRAIGHT)
{
if (trace_ent != targ) { // don't have a clear shot, so move to a side
if (self.attack_state != AS_STRAIGHT) {
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
return FALSE;
}
if (enemy_range == RANGE_MELEE)
switch (enemy_range) {
case RANGE_MELEE:
chance = 0.9;
else if (enemy_range == RANGE_NEAR)
break;
case RANGE_NEAR:
chance = 0.6;
else if (enemy_range == RANGE_MID)
break;
case RANGE_MID:
chance = 0.2;
else
break;
default:
case RANGE_FAR:
chance = 0;
}
if (random () < chance)
{
if (random () < chance) {
self.attack_state = AS_MISSILE;
return TRUE;
}
if (enemy_range == RANGE_MID)
{
if (self.attack_state != AS_STRAIGHT)
{
if (enemy_range == RANGE_MID) {
if (self.attack_state != AS_STRAIGHT) {
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
}
else
{
if (self.attack_state != AS_SLIDING)
{
} else {
if (self.attack_state != AS_SLIDING) {
self.attack_state = AS_SLIDING;
wiz_side1 ();
}
@ -160,49 +151,33 @@ float() WizardCheckAttack =
return FALSE;
};
/*
=================
WizardAttackFinished
=================
*/
float() WizardAttackFinished =
{
if (enemy_range >= RANGE_MID || !enemy_vis)
{
if (enemy_range >= RANGE_MID || !enemy_vis) {
self.attack_state = AS_STRAIGHT;
self.think = wiz_run1;
}
else
{
} else {
self.attack_state = AS_SLIDING;
self.think = wiz_side1;
}
};
/*
==============================================================================
FAST ATTACKS
==============================================================================
*/
// FAST ATTACKS ===============================================================
void() Wiz_FastFire =
{
local vector vec;
local vector dst;
local vector dst, vec;
if (self.owner.health > 0)
{
if (self.owner.health > 0) {
muzzleflash();
makevectors (self.enemy.angles);
dst = self.enemy.origin - 13*self.movedir;
makevectors (self.enemy.angles);
dst = self.enemy.origin - 13 * self.movedir;
vec = normalize(dst - self.origin);
vec = normalize (dst - self.origin);
sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
launch_spike (self.origin, vec);
newmis.velocity = vec*600;
newmis.velocity = vec * 600;
newmis.owner = self.owner;
newmis.classname = "wizspike";
setmodel (newmis, "progs/w_spike.mdl");
@ -212,10 +187,9 @@ void() Wiz_FastFire =
remove (self);
};
void() Wiz_StartFast =
{
local entity missile;
local entity missile;
sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
self.v_angle = self.angles;
@ -224,8 +198,9 @@ void() Wiz_StartFast =
missile = spawn ();
missile.owner = self;
missile.nextthink = time + 0.6;
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right*14);
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 30' + v_forward * 14 + v_righ
* 14);
missile.enemy = self.enemy;
missile.nextthink = time + 0.8;
missile.think = Wiz_FastFire;
@ -235,26 +210,25 @@ void() Wiz_StartFast =
missile.owner = self;
missile.nextthink = time + 1;
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right* -14);
setorigin (missile, self.origin + '0 0 30' + v_forward * 14 + v_right
* -14);
missile.enemy = self.enemy;
missile.nextthink = time + 0.3;
missile.think = Wiz_FastFire;
missile.movedir = VEC_ORIGIN - v_right;
};
void() Wiz_idlesound =
{
local float wr;
wr = random() * 5;
local float wr;
if (self.waitmin < time)
{
wr = random () * 5;
if (self.waitmin < time) {
self.waitmin = time + 2;
if (wr > 4.5)
if (wr > 4.5)
sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
if (wr < 1.5)
else if (wr < 1.5)
sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
}
return;
@ -269,8 +243,10 @@ void() wiz_stand6 =[ $hover6, wiz_stand7 ] {ai_stand();};
void() wiz_stand7 =[ $hover7, wiz_stand8 ] {ai_stand();};
void() wiz_stand8 =[ $hover8, wiz_stand1 ] {ai_stand();};
void() wiz_walk1 =[ $hover1, wiz_walk2 ] {ai_walk(8);
Wiz_idlesound();};
void() wiz_walk1 =[ $hover1, wiz_walk2 ] {
ai_walk (8);
Wiz_idlesound ();
};
void() wiz_walk2 =[ $hover2, wiz_walk3 ] {ai_walk(8);};
void() wiz_walk3 =[ $hover3, wiz_walk4 ] {ai_walk(8);};
void() wiz_walk4 =[ $hover4, wiz_walk5 ] {ai_walk(8);};
@ -279,8 +255,10 @@ void() wiz_walk6 =[ $hover6, wiz_walk7 ] {ai_walk(8);};
void() wiz_walk7 =[ $hover7, wiz_walk8 ] {ai_walk(8);};
void() wiz_walk8 =[ $hover8, wiz_walk1 ] {ai_walk(8);};
void() wiz_side1 =[ $hover1, wiz_side2 ] {ai_run(8);
Wiz_idlesound();};
void() wiz_side1 =[ $hover1, wiz_side2 ] {
ai_run (8);
Wiz_idlesound ();
};
void() wiz_side2 =[ $hover2, wiz_side3 ] {ai_run(8);};
void() wiz_side3 =[ $hover3, wiz_side4 ] {ai_run(8);};
void() wiz_side4 =[ $hover4, wiz_side5 ] {ai_run(8);};
@ -289,8 +267,9 @@ void() wiz_side6 =[ $hover6, wiz_side7 ] {ai_run(8);};
void() wiz_side7 =[ $hover7, wiz_side8 ] {ai_run(8);};
void() wiz_side8 =[ $hover8, wiz_side1 ] {ai_run(8);};
void() wiz_run1 =[ $fly1, wiz_run2 ] {ai_run(16);
Wiz_idlesound();
void() wiz_run1 =[ $fly1, wiz_run2 ] {
ai_run (16);
Wiz_idlesound ();
};
void() wiz_run2 =[ $fly2, wiz_run3 ] {ai_run(16);};
void() wiz_run3 =[ $fly3, wiz_run4 ] {ai_run(16);};
@ -306,7 +285,10 @@ void() wiz_run12 =[ $fly12, wiz_run13 ] {ai_run(16);};
void() wiz_run13 =[ $fly13, wiz_run14 ] {ai_run(16);};
void() wiz_run14 =[ $fly14, wiz_run1 ] {ai_run(16);};
void() wiz_fast1 =[ $magatt1, wiz_fast2 ] {ai_face();Wiz_StartFast();};
void() wiz_fast1 =[ $magatt1, wiz_fast2 ] {
ai_face ();
Wiz_StartFast ();
};
void() wiz_fast2 =[ $magatt2, wiz_fast3 ] {ai_face();};
void() wiz_fast3 =[ $magatt3, wiz_fast4 ] {ai_face();};
void() wiz_fast4 =[ $magatt4, wiz_fast5 ] {ai_face();};
@ -315,7 +297,11 @@ void() wiz_fast6 =[ $magatt6, wiz_fast7 ] {ai_face();};
void() wiz_fast7 =[ $magatt5, wiz_fast8 ] {ai_face();};
void() wiz_fast8 =[ $magatt4, wiz_fast9 ] {ai_face();};
void() wiz_fast9 =[ $magatt3, wiz_fast10 ] {ai_face();};
void() wiz_fast10 =[ $magatt2, wiz_run1 ] {ai_face();SUB_AttackFinished(2);WizardAttackFinished ();};
void() wiz_fast10 =[ $magatt2, wiz_run1 ] {
ai_face ();
SUB_AttackFinished (2);
WizardAttackFinished ();
};
void() wiz_pain1 =[ $pain1, wiz_pain2 ] {};
void() wiz_pain2 =[ $pain2, wiz_pain3 ] {};
@ -323,12 +309,11 @@ void() wiz_pain3 =[ $pain3, wiz_pain4 ] {};
void() wiz_pain4 =[ $pain4, wiz_run1 ] {};
void() wiz_death1 =[ $death1, wiz_death2 ] {
self.velocity_x = -200 + 400*random();
self.velocity_y = -200 + 400*random();
self.velocity_z = 100 + 100*random();
self.flags = self.flags - (self.flags & FL_ONGROUND);
sound (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
self.velocity_x = -200 + 400 * random ();
self.velocity_y = -200 + 400 * random ();
self.velocity_z = 100 + 100 * random ();
self.flags = self.flags - (self.flags & FL_ONGROUND);
sound (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
};
void() wiz_death2 =[ $death2, wiz_death3 ] {};
void() wiz_death3 =[ $death3, wiz_death4 ]{self.solid = SOLID_NOT;};
@ -340,9 +325,8 @@ void() wiz_death8 =[ $death8, wiz_death8 ] {};
void() wiz_die =
{
// check for gib
if (self.health < -40)
{
// check for gib
if (self.health < -40) {
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
ThrowHead ("progs/h_wizard.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
@ -358,13 +342,12 @@ void() wiz_die =
void(entity attacker, float damage) Wiz_Pain =
{
sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
if (random()*70 > damage)
if (random () * 70 > damage)
return; // didn't flinch
wiz_pain1 ();
};
void() Wiz_Missile =
{
wiz_fast1();
@ -374,11 +357,11 @@ void() Wiz_Missile =
*/
void() monster_wizard =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
precache_model ("progs/wizard.mdl");
precache_model ("progs/h_wizard.mdl");
precache_model ("progs/w_spike.mdl");

View file

@ -1,159 +1,4 @@
void() InitBodyQue;
void() main =
{
dprint ("main function\n");
// these are just commands the the prog compiler to copy these files
precache_file ("progs.dat");
precache_file ("gfx.wad");
precache_file ("quake.rc");
precache_file ("default.cfg");
precache_file ("end1.bin");
precache_file2 ("end2.bin");
precache_file ("demo1.dem");
precache_file ("demo2.dem");
precache_file ("demo3.dem");
//
// these are all of the lumps from the cached.ls files
//
precache_file ("gfx/palette.lmp");
precache_file ("gfx/colormap.lmp");
precache_file2 ("gfx/pop.lmp");
precache_file ("gfx/complete.lmp");
precache_file ("gfx/inter.lmp");
precache_file ("gfx/ranking.lmp");
precache_file ("gfx/vidmodes.lmp");
precache_file ("gfx/finale.lmp");
precache_file ("gfx/conback.lmp");
precache_file ("gfx/qplaque.lmp");
precache_file ("gfx/menudot1.lmp");
precache_file ("gfx/menudot2.lmp");
precache_file ("gfx/menudot3.lmp");
precache_file ("gfx/menudot4.lmp");
precache_file ("gfx/menudot5.lmp");
precache_file ("gfx/menudot6.lmp");
precache_file ("gfx/menuplyr.lmp");
precache_file ("gfx/bigbox.lmp");
precache_file ("gfx/dim_modm.lmp");
precache_file ("gfx/dim_drct.lmp");
precache_file ("gfx/dim_ipx.lmp");
precache_file ("gfx/dim_tcp.lmp");
precache_file ("gfx/dim_mult.lmp");
precache_file ("gfx/mainmenu.lmp");
precache_file ("gfx/box_tl.lmp");
precache_file ("gfx/box_tm.lmp");
precache_file ("gfx/box_tr.lmp");
precache_file ("gfx/box_ml.lmp");
precache_file ("gfx/box_mm.lmp");
precache_file ("gfx/box_mm2.lmp");
precache_file ("gfx/box_mr.lmp");
precache_file ("gfx/box_bl.lmp");
precache_file ("gfx/box_bm.lmp");
precache_file ("gfx/box_br.lmp");
precache_file ("gfx/sp_menu.lmp");
precache_file ("gfx/ttl_sgl.lmp");
precache_file ("gfx/ttl_main.lmp");
precache_file ("gfx/ttl_cstm.lmp");
precache_file ("gfx/mp_menu.lmp");
precache_file ("gfx/netmen1.lmp");
precache_file ("gfx/netmen2.lmp");
precache_file ("gfx/netmen3.lmp");
precache_file ("gfx/netmen4.lmp");
precache_file ("gfx/netmen5.lmp");
precache_file ("gfx/sell.lmp");
precache_file ("gfx/help0.lmp");
precache_file ("gfx/help1.lmp");
precache_file ("gfx/help2.lmp");
precache_file ("gfx/help3.lmp");
precache_file ("gfx/help4.lmp");
precache_file ("gfx/help5.lmp");
precache_file ("gfx/pause.lmp");
precache_file ("gfx/loading.lmp");
precache_file ("gfx/p_option.lmp");
precache_file ("gfx/p_load.lmp");
precache_file ("gfx/p_save.lmp");
precache_file ("gfx/p_multi.lmp");
// sounds loaded by C code
precache_sound ("misc/menu1.wav");
precache_sound ("misc/menu2.wav");
precache_sound ("misc/menu3.wav");
precache_sound ("ambience/water1.wav");
precache_sound ("ambience/wind2.wav");
// shareware
precache_file ("maps/start.bsp");
precache_file ("maps/e1m1.bsp");
precache_file ("maps/e1m2.bsp");
precache_file ("maps/e1m3.bsp");
precache_file ("maps/e1m4.bsp");
precache_file ("maps/e1m5.bsp");
precache_file ("maps/e1m6.bsp");
precache_file ("maps/e1m7.bsp");
precache_file ("maps/e1m8.bsp");
// registered
precache_file2 ("gfx/pop.lmp");
precache_file2 ("maps/e2m1.bsp");
precache_file2 ("maps/e2m2.bsp");
precache_file2 ("maps/e2m3.bsp");
precache_file2 ("maps/e2m4.bsp");
precache_file2 ("maps/e2m5.bsp");
precache_file2 ("maps/e2m6.bsp");
precache_file2 ("maps/e2m7.bsp");
precache_file2 ("maps/e3m1.bsp");
precache_file2 ("maps/e3m2.bsp");
precache_file2 ("maps/e3m3.bsp");
precache_file2 ("maps/e3m4.bsp");
precache_file2 ("maps/e3m5.bsp");
precache_file2 ("maps/e3m6.bsp");
precache_file2 ("maps/e3m7.bsp");
precache_file2 ("maps/e4m1.bsp");
precache_file2 ("maps/e4m2.bsp");
precache_file2 ("maps/e4m3.bsp");
precache_file2 ("maps/e4m4.bsp");
precache_file2 ("maps/e4m5.bsp");
precache_file2 ("maps/e4m6.bsp");
precache_file2 ("maps/e4m7.bsp");
precache_file2 ("maps/e4m8.bsp");
precache_file2 ("maps/end.bsp");
precache_file2 ("maps/dm1.bsp");
precache_file2 ("maps/dm2.bsp");
precache_file2 ("maps/dm3.bsp");
precache_file2 ("maps/dm4.bsp");
precache_file2 ("maps/dm5.bsp");
precache_file2 ("maps/dm6.bsp");
};
void() InitBodyQueue;
entity lastspawn;
@ -172,29 +17,28 @@ World Types:
void() worldspawn =
{
lastspawn = world;
InitBodyQue ();
InitBodyQueue ();
// custom map attributes
// custom map attributes
if (self.model == "maps/e1m8.bsp")
cvar_set ("sv_gravity", "100");
else
cvar_set ("sv_gravity", "800");
// the area based ambient sounds MUST be the first precache_sounds
// the area based ambient sounds MUST be the first precache_sounds
// player precaches
// player precaches
W_Precache (); // get weapon precaches
// sounds used from C physics code
// sounds used from C physics code
precache_sound ("demon/dland2.wav"); // landing thud
precache_sound ("misc/h2ohit1.wav"); // landing splash
// setup precaches allways needed
// setup precaches allways needed
precache_sound ("items/itembk2.wav"); // item respawn sound
precache_sound ("player/plyrjmp8.wav"); // player jump
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land2.wav"); // player hurt landing
precache_sound ("player/drown1.wav"); // drowning pain
precache_sound ("player/drown2.wav"); // drowning pain
@ -202,7 +46,7 @@ void() worldspawn =
precache_sound ("player/gasp2.wav"); // taking breath
precache_sound ("player/h2odeath.wav"); // drowning death
precache_sound ("misc/talk.wav"); // talk
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
precache_sound ("misc/r_tele1.wav"); // teleport sounds
precache_sound ("misc/r_tele2.wav");
@ -216,10 +60,10 @@ void() worldspawn =
precache_sound ("weapons/lstart.wav"); //lightning start
precache_sound ("items/damage3.wav");
precache_sound ("misc/power.wav"); //lightning for boss
precache_sound ("misc/power.wav"); //lightning for boss
// player gib sounds
precache_sound ("player/gib.wav"); // player gib sound
precache_sound ("player/gib.wav"); // player gib sound
precache_sound ("player/udeath.wav"); // player gib sound
precache_sound ("player/tornoff2.wav"); // gib sound
@ -241,8 +85,8 @@ void() worldspawn =
precache_sound ("boss1/sight1.wav");
// ax sounds
precache_sound ("weapons/ax1.wav"); // ax swoosh
// ax sounds
precache_sound ("weapons/ax1.wav"); // ax swoosh
precache_sound ("player/axhit1.wav"); // ax hit meat
precache_sound ("player/axhit2.wav"); // ax hit world
@ -255,8 +99,8 @@ void() worldspawn =
precache_sound ("player/lburn1.wav"); // lava burn
precache_sound ("player/lburn2.wav"); // lava burn
precache_sound ("misc/water1.wav"); // swimming
precache_sound ("misc/water2.wav"); // swimming
precache_sound ("misc/water1.wav"); // swimming
precache_sound ("misc/water2.wav"); // swimming
// Invulnerability sounds
precache_sound ("items/protect.wav");
@ -285,8 +129,8 @@ void() worldspawn =
precache_model ("progs/bolt.mdl"); // for lightning gun
precache_model ("progs/bolt2.mdl"); // for lightning gun
precache_model ("progs/bolt3.mdl"); // for boss shock
precache_model ("progs/lavaball.mdl"); // for testing
precache_model ("progs/lavaball.mdl"); // for testing
precache_model ("progs/missile.mdl");
precache_model ("progs/grenade.mdl");
precache_model ("progs/spike.mdl");
@ -297,11 +141,8 @@ void() worldspawn =
precache_model ("progs/zom_gib.mdl");
precache_model ("progs/v_light.mdl");
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
// 0 normal
lightstyle(0, "m");
@ -366,42 +207,38 @@ BODY QUE
==============================================================================
*/
entity bodyque_head;
entity bodyqueue_head;
void() bodyque =
{ // just here so spawn functions don't complain after the world
// creates bodyques
};
void() InitBodyQue =
void() bodyqueue =
{
bodyque_head = spawn();
bodyque_head.classname = "bodyque";
bodyque_head.owner = spawn();
bodyque_head.owner.classname = "bodyque";
bodyque_head.owner.owner = spawn();
bodyque_head.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner = spawn();
bodyque_head.owner.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner.owner = bodyque_head;
// just here so spawn functions don't complain after world creates bodyqueues
};
// make a body que entry for the given ent so the ent can be
// respawned elsewhere
void(entity ent) CopyToBodyQue =
void() InitBodyQueue =
{
bodyque_head.angles = ent.angles;
bodyque_head.model = ent.model;
bodyque_head.modelindex = ent.modelindex;
bodyque_head.frame = ent.frame;
bodyque_head.colormap = ent.colormap;
bodyque_head.movetype = ent.movetype;
bodyque_head.velocity = ent.velocity;
bodyque_head.flags = 0;
setorigin (bodyque_head, ent.origin);
setsize (bodyque_head, ent.mins, ent.maxs);
bodyque_head = bodyque_head.owner;
bodyqueue_head = spawn();
bodyqueue_head.classname = "bodyqueue";
bodyqueue_head.owner = spawn();
bodyqueue_head.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner = spawn();
bodyqueue_head.owner.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner.owner = spawn();
bodyqueue_head.owner.owner.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner.owner.owner = bodyqueue_head;
};
// make a body queue entry for the given ent so it can be respawned elsewhere
void(entity ent) CopyToBodyQueue =
{
bodyqueue_head.angles = ent.angles;
bodyqueue_head.model = ent.model;
bodyqueue_head.modelindex = ent.modelindex;
bodyqueue_head.frame = ent.frame;
bodyqueue_head.colormap = ent.colormap;
bodyqueue_head.movetype = ent.movetype;
bodyqueue_head.velocity = ent.velocity;
bodyqueue_head.flags = 0;
setorigin (bodyqueue_head, ent.origin);
setsize (bodyqueue_head, ent.mins, ent.maxs);
bodyqueue_head = bodyqueue_head.owner;
};

View file

@ -73,13 +73,24 @@ void() zombie_stand14 =[ $stand14, zombie_stand15 ] {ai_stand();};
void() zombie_stand15 =[ $stand15, zombie_stand1 ] {ai_stand();};
void() zombie_cruc1 = [ $cruc_1, zombie_cruc2 ] {
if (random() < 0.1)
sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);};
void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;};
void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;};
if (random () < 0.1)
sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);
};
void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {
self.nextthink = time + 0.1 + random () * 0.1;
};
void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {
self.nextthink = time + 0.1 + random () * 0.1;
};
void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {
self.nextthink = time + 0.1 + random () * 0.1;
};
void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {
self.nextthink = time + 0.1 + random () * 0.1;
};
void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {
self.nextthink = time + 0.1 + random () * 0.1;
};
void() zombie_walk1 =[ $walk1, zombie_walk2 ] {ai_walk(0);};
void() zombie_walk2 =[ $walk2, zombie_walk3 ] {ai_walk(2);};
@ -100,11 +111,15 @@ void() zombie_walk16 =[ $walk16, zombie_walk17 ] {ai_walk(0);};
void() zombie_walk17 =[ $walk17, zombie_walk18 ] {ai_walk(0);};
void() zombie_walk18 =[ $walk18, zombie_walk19 ] {ai_walk(0);};
void() zombie_walk19 =[ $walk19, zombie_walk1 ] {
ai_walk(0);
if (random() < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);};
ai_walk (0);
if (random () < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
};
void() zombie_run1 =[ $run1, zombie_run2 ] {ai_run(1);self.inpain = 0;};
void() zombie_run1 =[ $run1, zombie_run2 ] {
ai_run (1);
self.inpain = 0;
};
void() zombie_run2 =[ $run2, zombie_run3 ] {ai_run(1);};
void() zombie_run3 =[ $run3, zombie_run4 ] {ai_run(0);};
void() zombie_run4 =[ $run4, zombie_run5 ] {ai_run(1);};
@ -122,11 +137,11 @@ void() zombie_run15 =[ $run15, zombie_run16 ] {ai_run(6);};
void() zombie_run16 =[ $run16, zombie_run17 ] {ai_run(7);};
void() zombie_run17 =[ $run17, zombie_run18 ] {ai_run(3);};
void() zombie_run18 =[ $run18, zombie_run1 ] {
ai_run(8);
if (random() < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
if (random() > 0.8)
sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
ai_run (8);
if (random () < 0.2)
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
if (random () > 0.8)
sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
};
/*
@ -141,14 +156,13 @@ void() ZombieGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage)
{
if (other.takedamage) {
T_Damage (other, self, self.owner, 10 );
sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
remove (self);
return;
}
sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
self.velocity = '0 0 0';
self.avelocity = '0 0 0';
self.touch = SUB_Remove;
@ -171,22 +185,18 @@ void(vector st) ZombieFireGrenade =
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// calc org
// calc org
org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up;
// set missile speed
// set missile speed
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - org);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '3000 1000 2000';
missile.touch = ZombieGrenadeTouch;
// set missile duration
// set missile duration
missile.nextthink = time + 2.5;
missile.think = SUB_Remove;
@ -195,7 +205,6 @@ void(vector st) ZombieFireGrenade =
setorigin (missile, org);
};
void() zombie_atta1 =[ $atta1, zombie_atta2 ] {ai_face();};
void() zombie_atta2 =[ $atta2, zombie_atta3 ] {ai_face();};
void() zombie_atta3 =[ $atta3, zombie_atta4 ] {ai_face();};
@ -208,7 +217,10 @@ void() zombie_atta9 =[ $atta9, zombie_atta10 ] {ai_face();};
void() zombie_atta10 =[ $atta10, zombie_atta11 ] {ai_face();};
void() zombie_atta11 =[ $atta11, zombie_atta12 ] {ai_face();};
void() zombie_atta12 =[ $atta12, zombie_atta13 ] {ai_face();};
void() zombie_atta13 =[ $atta13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');};
void() zombie_atta13 =[ $atta13, zombie_run1 ] {
ai_face ();
ZombieFireGrenade ('-10 -22 30');
};
void() zombie_attb1 =[ $attb1, zombie_attb2 ] {ai_face();};
void() zombie_attb2 =[ $attb2, zombie_attb3 ] {ai_face();};
@ -223,7 +235,10 @@ void() zombie_attb10 =[ $attb10, zombie_attb11 ] {ai_face();};
void() zombie_attb11 =[ $attb11, zombie_attb12 ] {ai_face();};
void() zombie_attb12 =[ $attb12, zombie_attb13 ] {ai_face();};
void() zombie_attb13 =[ $attb13, zombie_attb14 ] {ai_face();};
void() zombie_attb14 =[ $attb13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');};
void() zombie_attb14 =[ $attb13, zombie_run1 ] {
ai_face ();
ZombieFireGrenade ('-10 -24 29');
};
void() zombie_attc1 =[ $attc1, zombie_attc2 ] {ai_face();};
void() zombie_attc2 =[ $attc2, zombie_attc3 ] {ai_face();};
@ -236,13 +251,16 @@ void() zombie_attc8 =[ $attc8, zombie_attc9 ] {ai_face();};
void() zombie_attc9 =[ $attc9, zombie_attc10 ] {ai_face();};
void() zombie_attc10 =[ $attc10, zombie_attc11 ] {ai_face();};
void() zombie_attc11 =[ $attc11, zombie_attc12 ] {ai_face();};
void() zombie_attc12 =[ $attc12, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');};
void() zombie_attc12 =[ $attc12, zombie_run1 ] {
ai_face ();
ZombieFireGrenade ('-12 -19 29');
};
void() zombie_missile =
{
local float r;
r = random();
r = random ();
if (r < 0.3)
zombie_atta1 ();
@ -252,7 +270,6 @@ void() zombie_missile =
zombie_attc1 ();
};
/*
=============================================================================
@ -261,7 +278,9 @@ PAIN
=============================================================================
*/
void() zombie_paina1 =[ $paina1, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
void() zombie_paina1 =[ $paina1, zombie_paina2 ] {
sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
};
void() zombie_paina2 =[ $paina2, zombie_paina3 ] {ai_painforward(3);};
void() zombie_paina3 =[ $paina3, zombie_paina4 ] {ai_painforward(1);};
void() zombie_paina4 =[ $paina4, zombie_paina5 ] {ai_pain(1);};
@ -274,7 +293,9 @@ void() zombie_paina10 =[ $paina10, zombie_paina11 ] {};
void() zombie_paina11 =[ $paina11, zombie_paina12 ] {};
void() zombie_paina12 =[ $paina12, zombie_run1 ] {};
void() zombie_painb1 =[ $painb1, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
void() zombie_painb1 =[ $painb1, zombie_painb2 ] {
sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);
};
void() zombie_painb2 =[ $painb2, zombie_painb3 ] {ai_pain(2);};
void() zombie_painb3 =[ $painb3, zombie_painb4 ] {ai_pain(8);};
void() zombie_painb4 =[ $painb4, zombie_painb5 ] {ai_pain(6);};
@ -282,7 +303,9 @@ void() zombie_painb5 =[ $painb5, zombie_painb6 ] {ai_pain(2);};
void() zombie_painb6 =[ $painb6, zombie_painb7 ] {};
void() zombie_painb7 =[ $painb7, zombie_painb8 ] {};
void() zombie_painb8 =[ $painb8, zombie_painb9 ] {};
void() zombie_painb9 =[ $painb9, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);};
void() zombie_painb9 =[ $painb9, zombie_painb10 ] {
sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
};
void() zombie_painb10 =[ $painb10, zombie_painb11 ] {};
void() zombie_painb11 =[ $painb11, zombie_painb12 ] {};
void() zombie_painb12 =[ $painb12, zombie_painb13 ] {};
@ -303,7 +326,9 @@ void() zombie_painb26 =[ $painb26, zombie_painb27 ] {};
void() zombie_painb27 =[ $painb27, zombie_painb28 ] {};
void() zombie_painb28 =[ $painb28, zombie_run1 ] {};
void() zombie_painc1 =[ $painc1, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
void() zombie_painc1 =[ $painc1, zombie_painc2 ] {
sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);
};
void() zombie_painc2 =[ $painc2, zombie_painc3 ] {};
void() zombie_painc3 =[ $painc3, zombie_painc4 ] {ai_pain(3);};
void() zombie_painc4 =[ $painc4, zombie_painc5 ] {ai_pain(1);};
@ -322,7 +347,9 @@ void() zombie_painc16 =[ $painc16, zombie_painc17 ] {};
void() zombie_painc17 =[ $painc17, zombie_painc18 ] {};
void() zombie_painc18 =[ $painc18, zombie_run1 ] {};
void() zombie_paind1 =[ $paind1, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
void() zombie_paind1 =[ $paind1, zombie_paind2 ] {
sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
};
void() zombie_paind2 =[ $paind2, zombie_paind3 ] {};
void() zombie_paind3 =[ $paind3, zombie_paind4 ] {};
void() zombie_paind4 =[ $paind4, zombie_paind5 ] {};
@ -337,8 +364,8 @@ void() zombie_paind12 =[ $paind12, zombie_paind13 ] {};
void() zombie_paind13 =[ $paind13, zombie_run1 ] {};
void() zombie_paine1 =[ $paine1, zombie_paine2 ] {
sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
self.health = 60;
sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
self.health = 60;
};
void() zombie_paine2 =[ $paine2, zombie_paine3 ] {ai_pain(8);};
void() zombie_paine3 =[ $paine3, zombie_paine4 ] {ai_pain(5);};
@ -349,21 +376,22 @@ void() zombie_paine7 =[ $paine7, zombie_paine8 ] {ai_pain(1);};
void() zombie_paine8 =[ $paine8, zombie_paine9 ] {ai_pain(1);};
void() zombie_paine9 =[ $paine9, zombie_paine10 ] {ai_pain(2);};
void() zombie_paine10 =[ $paine10, zombie_paine11 ] {
sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
};
void() zombie_paine11 =[ $paine11, zombie_paine12 ] {self.nextthink = self.nextthink + 5;self.health = 60;};
void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
// see if ok to stand up
self.health = 60;
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
self.solid = SOLID_SLIDEBOX;
if (!walkmove (0, 0))
{
self.think = zombie_paine11;
sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
self.solid = SOLID_NOT;
return;
}
};
void() zombie_paine11 =[ $paine11, zombie_paine12 ] {
self.nextthink = self.nextthink + 5;self.health = 60;
};
void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
// see if ok to stand up
self.health = 60;
sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
self.solid = SOLID_SLIDEBOX;
if (!walkmove (0, 0)) {
self.think = zombie_paine11;
self.solid = SOLID_NOT;
return;
}
};
void() zombie_paine13 =[ $paine13, zombie_paine14 ] {};
void() zombie_paine14 =[ $paine14, zombie_paine15 ] {};
@ -424,33 +452,30 @@ void(entity attacker, float take) zombie_pain =
if (self.inpain == 2)
return; // down on ground, so don't reset any counters
// go down immediately if a big enough hit
if (take >= 25)
{
// go down immediately if a big enough hit
if (take >= 25) {
self.inpain = 2;
zombie_paine1 ();
return;
}
if (self.inpain)
{
// if hit again in next gre seconds while not in pain frames, definately drop
if (self.inpain) {
// if hit again in next gre seconds while not in pain frames, definately drop
self.pain_finished = time + 3;
return; // currently going through an animation, don't change
}
if (self.pain_finished > time)
{
// hit again, so drop down
if (self.pain_finished > time) {
// hit again, so drop down
self.inpain = 2;
zombie_paine1 ();
return;
}
// gp into one of the fast pain animations
// gp into one of the fast pain animations
self.inpain = 1;
r = random();
r = random ();
if (r < 0.25)
zombie_paina1 ();
else if (r < 0.5)
@ -469,9 +494,8 @@ If crucified, stick the bounding box 12 pixels back into a wall to look right.
*/
void() monster_zombie =
{
if (deathmatch)
{
remove(self);
if (deathmatch) {
remove (self);
return;
}
@ -505,11 +529,9 @@ void() monster_zombie =
self.th_die = zombie_die;
self.th_missile = zombie_missile;
if (self.spawnflags & SPAWN_CRUCIFIED)
{
if (self.spawnflags & SPAWN_CRUCIFIED) {
self.movetype = MOVETYPE_NONE;
zombie_cruc1 ();
}
else
walkmonster_start();
} else
walkmonster_start ();
};