mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-12 23:44:27 +00:00
More optimizations, clean out some single use variables and cut & paste slop.
This commit is contained in:
parent
e16af82af2
commit
31a1ed87a2
7 changed files with 400 additions and 329 deletions
115
nqw/ai.qc
115
nqw/ai.qc
|
@ -38,15 +38,6 @@ float current_yaw;
|
|||
entity sight_entity;
|
||||
float sight_entity_time;
|
||||
|
||||
float(float v) anglemod =
|
||||
{
|
||||
while (v >= 360)
|
||||
v = v - 360;
|
||||
while (v < 0)
|
||||
v = v + 360;
|
||||
return v;
|
||||
};
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
MOVETARGET CODE
|
||||
|
@ -63,7 +54,8 @@ pausetime
|
|||
The number of seconds to spend standing or bowing for path_stand or path_bow
|
||||
==============================================================================
|
||||
*/
|
||||
void() movetarget_f =
|
||||
void ()
|
||||
movetarget_f =
|
||||
{
|
||||
if (!self.targetname)
|
||||
objerror ("monster_movetarget: no targetname");
|
||||
|
@ -71,13 +63,13 @@ void() movetarget_f =
|
|||
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)
|
||||
Monsters will continue walking towards the next target corner.
|
||||
*/
|
||||
void() path_corner =
|
||||
void ()
|
||||
path_corner =
|
||||
{
|
||||
movetarget_f ();
|
||||
};
|
||||
|
@ -90,7 +82,8 @@ Something has bumped into a movetarget. If it is a monster
|
|||
moving towards it, change the next destination and continue.
|
||||
==============
|
||||
*/
|
||||
void() t_movetarget =
|
||||
void ()
|
||||
t_movetarget =
|
||||
{
|
||||
local entity temp;
|
||||
|
||||
|
@ -130,7 +123,8 @@ returns the range catagorization of an entity reletive to self
|
|||
3 only triggered by damage
|
||||
=============
|
||||
*/
|
||||
float(entity targ) range =
|
||||
float (entity targ)
|
||||
range =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
local float r;
|
||||
|
@ -155,7 +149,8 @@ visible
|
|||
returns 1 if the entity is visible to self, even if not infront ()
|
||||
=============
|
||||
*/
|
||||
float (entity targ) visible =
|
||||
float (entity targ)
|
||||
visible =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
|
||||
|
@ -178,7 +173,8 @@ infront
|
|||
returns 1 if the entity is in front (in sight) of self
|
||||
=============
|
||||
*/
|
||||
float(entity targ) infront =
|
||||
float (entity targ)
|
||||
infront =
|
||||
{
|
||||
local vector vec;
|
||||
local float dot;
|
||||
|
@ -210,7 +206,7 @@ void() ChangeYaw =
|
|||
|
||||
// current_yaw = self.ideal_yaw;
|
||||
// mod down the current angle
|
||||
current_yaw = anglemod (self.angles_y);
|
||||
current_yaw = self.angles_y % 360;
|
||||
ideal = self.ideal_yaw;
|
||||
|
||||
if (current_yaw == ideal)
|
||||
|
@ -233,7 +229,7 @@ void() ChangeYaw =
|
|||
move = 0 - self.yaw_speed;
|
||||
}
|
||||
|
||||
current_yaw = anglemod (current_yaw + move);
|
||||
current_yaw = (current_yaw + move) % 360;
|
||||
|
||||
self.angles_y = current_yaw;
|
||||
};
|
||||
|
@ -241,7 +237,8 @@ void() ChangeYaw =
|
|||
|
||||
//============================================================================
|
||||
|
||||
void() HuntTarget =
|
||||
void ()
|
||||
HuntTarget =
|
||||
{
|
||||
self.goalentity = self.enemy;
|
||||
self.think = self.th_run;
|
||||
|
@ -250,7 +247,8 @@ void() HuntTarget =
|
|||
SUB_AttackFinished (1); // wait a while before first attack
|
||||
};
|
||||
|
||||
void() SightSound =
|
||||
void ()
|
||||
SightSound =
|
||||
{
|
||||
local float rsnd;
|
||||
|
||||
|
@ -302,7 +300,8 @@ void() SightSound =
|
|||
}
|
||||
};
|
||||
|
||||
void() FoundTarget =
|
||||
void ()
|
||||
FoundTarget =
|
||||
{
|
||||
if (self.enemy.classname == "player") {
|
||||
// let other monsters see this monster for a while
|
||||
|
@ -333,7 +332,8 @@ checked each frame. This means multi player games will have slightly
|
|||
slower noticing monsters.
|
||||
============
|
||||
*/
|
||||
float() FindTarget =
|
||||
float ()
|
||||
FindTarget =
|
||||
{
|
||||
local entity client;
|
||||
local float r;
|
||||
|
@ -394,12 +394,14 @@ float() FindTarget =
|
|||
|
||||
//=============================================================================
|
||||
|
||||
void(float dist) ai_forward =
|
||||
void (float dist)
|
||||
ai_forward =
|
||||
{
|
||||
walkmove (self.angles_y, dist);
|
||||
};
|
||||
|
||||
void(float dist) ai_back =
|
||||
void (float dist)
|
||||
ai_back =
|
||||
{
|
||||
walkmove ((self.angles_y + 180), dist);
|
||||
};
|
||||
|
@ -411,14 +413,15 @@ ai_pain
|
|||
stagger back a bit
|
||||
=============
|
||||
*/
|
||||
void(float dist) ai_pain =
|
||||
void (float dist)
|
||||
ai_pain =
|
||||
{
|
||||
ai_back (dist);
|
||||
/*
|
||||
local float away;
|
||||
|
||||
away = anglemod (vectoyaw (self.origin - self.enemy.origin)
|
||||
+ 180 * (random () - 0.5) );
|
||||
away = (vectoyaw (self.origin - self.enemy.origin)
|
||||
+ 180 * (random () - 0.5)) % 360;
|
||||
|
||||
walkmove (away, dist);
|
||||
*/
|
||||
|
@ -431,7 +434,8 @@ ai_painforward
|
|||
stagger back a bit
|
||||
=============
|
||||
*/
|
||||
void(float dist) ai_painforward =
|
||||
void (float dist)
|
||||
ai_painforward =
|
||||
{
|
||||
walkmove (self.ideal_yaw, dist);
|
||||
};
|
||||
|
@ -443,7 +447,8 @@ ai_walk
|
|||
The monster is walking it's beat
|
||||
=============
|
||||
*/
|
||||
void(float dist) ai_walk =
|
||||
void (float dist)
|
||||
ai_walk =
|
||||
{
|
||||
movedist = dist;
|
||||
|
||||
|
@ -461,7 +466,8 @@ ai_stand
|
|||
The monster is staying in one place for a while, with slight angle turns
|
||||
=============
|
||||
*/
|
||||
void() ai_stand =
|
||||
void ()
|
||||
ai_stand =
|
||||
{
|
||||
if (FindTarget ())
|
||||
return;
|
||||
|
@ -480,7 +486,8 @@ ai_turn
|
|||
don't move, but turn towards ideal_yaw
|
||||
=============
|
||||
*/
|
||||
void() ai_turn =
|
||||
void ()
|
||||
ai_turn =
|
||||
{
|
||||
if (FindTarget ())
|
||||
return;
|
||||
|
@ -490,33 +497,35 @@ void() ai_turn =
|
|||
|
||||
//=============================================================================
|
||||
|
||||
void(vector dest3) ChooseTurn =
|
||||
void (vector dest3)
|
||||
ChooseTurn =
|
||||
{
|
||||
local vector dir, newdir;
|
||||
|
||||
dir = self.origin - dest3;
|
||||
|
||||
newdir_x = trace_plane_normal_y;
|
||||
newdir_y = 0 - trace_plane_normal_x;
|
||||
newdir_y = -trace_plane_normal_x;
|
||||
newdir_z = 0;
|
||||
|
||||
if (dir * newdir > 0) {
|
||||
dir_x = 0 - trace_plane_normal_y;
|
||||
dir_x = -trace_plane_normal_y;
|
||||
dir_y = trace_plane_normal_x;
|
||||
} else {
|
||||
dir_x = trace_plane_normal_y;
|
||||
dir_y = 0 - trace_plane_normal_x;
|
||||
dir_y = -trace_plane_normal_x;
|
||||
}
|
||||
|
||||
dir_z = 0;
|
||||
self.ideal_yaw = vectoyaw (dir);
|
||||
};
|
||||
|
||||
float() FacingIdeal =
|
||||
float ()
|
||||
FacingIdeal =
|
||||
{
|
||||
local float delta;
|
||||
|
||||
delta = anglemod (self.angles_y - self.ideal_yaw);
|
||||
delta = (self.angles_y - self.ideal_yaw) % 360;
|
||||
if (delta > 45 && delta < 315)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
@ -528,7 +537,8 @@ float() FacingIdeal =
|
|||
float () WizardCheckAttack;
|
||||
float () DogCheckAttack;
|
||||
|
||||
float() CheckAnyAttack =
|
||||
float ()
|
||||
CheckAnyAttack =
|
||||
{
|
||||
if (!enemy_vis)
|
||||
return 0;
|
||||
|
@ -565,7 +575,8 @@ ai_run_melee
|
|||
Turn and close until within an angle to launch a melee attack
|
||||
=============
|
||||
*/
|
||||
void() ai_run_melee =
|
||||
void ()
|
||||
ai_run_melee =
|
||||
{
|
||||
self.ideal_yaw = enemy_yaw;
|
||||
ChangeYaw ();
|
||||
|
@ -583,7 +594,8 @@ ai_run_missile
|
|||
Turn in place until within an angle to launch a missile attack
|
||||
=============
|
||||
*/
|
||||
void() ai_run_missile =
|
||||
void ()
|
||||
ai_run_missile =
|
||||
{
|
||||
self.ideal_yaw = enemy_yaw;
|
||||
ChangeYaw ();
|
||||
|
@ -600,7 +612,8 @@ ai_run_slide
|
|||
Strafe sideways, but stay at aproximately the same range
|
||||
=============
|
||||
*/
|
||||
void() ai_run_slide =
|
||||
void ()
|
||||
ai_run_slide =
|
||||
{
|
||||
local float ofs;
|
||||
|
||||
|
@ -626,7 +639,8 @@ ai_run
|
|||
The monster has an enemy it is trying to kill
|
||||
=============
|
||||
*/
|
||||
void(float dist) ai_run =
|
||||
void (float dist)
|
||||
ai_run =
|
||||
{
|
||||
movedist = dist;
|
||||
// see if the enemy is dead
|
||||
|
@ -662,23 +676,24 @@ void(float dist) ai_run =
|
|||
enemy_range = range (self.enemy);
|
||||
enemy_yaw = vectoyaw (self.enemy.origin - self.origin);
|
||||
|
||||
if (self.attack_state == AS_MISSILE) {
|
||||
switch (self.attack_state) {
|
||||
case AS_MISSILE:
|
||||
// dprint ("ai_run_missile\n");
|
||||
ai_run_missile ();
|
||||
return;
|
||||
}
|
||||
if (self.attack_state == AS_MELEE) {
|
||||
case AS_MELEE:
|
||||
// dprint ("ai_run_melee\n");
|
||||
ai_run_melee ();
|
||||
return;
|
||||
}
|
||||
|
||||
case AS_SLIDING:
|
||||
if (CheckAnyAttack ())
|
||||
return; // beginning an attack
|
||||
|
||||
if (self.attack_state == AS_SLIDING) {
|
||||
return;
|
||||
ai_run_slide ();
|
||||
return;
|
||||
default:
|
||||
if (CheckAnyAttack ())
|
||||
return; // beginning an attack
|
||||
break;
|
||||
}
|
||||
|
||||
// head straight in
|
||||
|
|
13
nqw/boss.qc
13
nqw/boss.qc
|
@ -1,10 +1,5 @@
|
|||
/*
|
||||
==============================================================================
|
||||
// BOSS-ONE ===================================================================
|
||||
|
||||
BOSS-ONE
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
$cd id1/models/boss1
|
||||
$origin 0 0 -15
|
||||
$base base
|
||||
|
@ -37,7 +32,8 @@ $frame shockc9 shockc10
|
|||
|
||||
void (vector p) boss_missile;
|
||||
|
||||
void() boss_face =
|
||||
void ()
|
||||
boss_face =
|
||||
{
|
||||
// go for another player if multi player
|
||||
if (self.enemy.health <= 0 || random () < 0.02) {
|
||||
|
@ -187,7 +183,8 @@ void() boss_death10 = [$death9, boss_death10]
|
|||
remove (self);
|
||||
};
|
||||
|
||||
void(vector p) boss_missile =
|
||||
void (vector p)
|
||||
boss_missile =
|
||||
{
|
||||
local vector offang;
|
||||
local vector org, vec, d;
|
||||
|
|
271
nqw/client.qc
271
nqw/client.qc
|
@ -19,12 +19,14 @@ float intermission_exittime;
|
|||
This is the camera point for the intermission.
|
||||
Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
|
||||
*/
|
||||
void() info_intermission =
|
||||
void ()
|
||||
info_intermission =
|
||||
{
|
||||
self.angles = self.mangle; // so C can get at it
|
||||
};
|
||||
|
||||
void() SetChangeParms =
|
||||
void ()
|
||||
SetChangeParms =
|
||||
{
|
||||
if (self.health <= 0) {
|
||||
SetNewParms ();
|
||||
|
@ -32,9 +34,8 @@ void() SetChangeParms =
|
|||
}
|
||||
|
||||
// remove items
|
||||
self.items = self.items -
|
||||
(self.items & (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY |
|
||||
IT_INVULNERABILITY | IT_SUIT | IT_QUAD));
|
||||
self.items &= ~(IT_KEY1 | IT_KEY2 | IT_INVISIBILITY |
|
||||
IT_INVULNERABILITY | IT_SUIT | IT_QUAD);
|
||||
|
||||
// cap super health
|
||||
if (self.health > 100)
|
||||
|
@ -55,7 +56,8 @@ void() SetChangeParms =
|
|||
parm9 = self.armortype * 100;
|
||||
};
|
||||
|
||||
void() SetNewParms =
|
||||
void ()
|
||||
SetNewParms =
|
||||
{
|
||||
parm1 = IT_SHOTGUN | IT_AXE;
|
||||
parm2 = 100;
|
||||
|
@ -68,7 +70,8 @@ void() SetNewParms =
|
|||
parm9 = 0;
|
||||
};
|
||||
|
||||
void() DecodeLevelParms =
|
||||
void ()
|
||||
DecodeLevelParms =
|
||||
{
|
||||
if (serverflags) {
|
||||
if (world.model == "maps/start.bsp")
|
||||
|
@ -93,7 +96,8 @@ FindIntermission
|
|||
Returns the entity to view from
|
||||
============
|
||||
*/
|
||||
entity() FindIntermission =
|
||||
entity ()
|
||||
FindIntermission =
|
||||
{
|
||||
local entity spot;
|
||||
local float cyc;
|
||||
|
@ -106,7 +110,7 @@ entity() FindIntermission =
|
|||
spot = find (spot, classname, "info_intermission");
|
||||
if (!spot)
|
||||
spot = find (spot, classname, "info_intermission");
|
||||
cyc = cyc - 1;
|
||||
cyc--;
|
||||
}
|
||||
return spot;
|
||||
}
|
||||
|
@ -119,7 +123,8 @@ entity() FindIntermission =
|
|||
objerror ("FindIntermission: no spot");
|
||||
};
|
||||
|
||||
void() GotoNextMap =
|
||||
void ()
|
||||
GotoNextMap =
|
||||
{
|
||||
local string newmap;
|
||||
|
||||
|
@ -140,7 +145,8 @@ void() GotoNextMap =
|
|||
}
|
||||
};
|
||||
|
||||
void() ExitIntermission =
|
||||
void ()
|
||||
ExitIntermission =
|
||||
{
|
||||
// skip any text in deathmatch
|
||||
if (deathmatch) {
|
||||
|
@ -156,22 +162,80 @@ void() ExitIntermission =
|
|||
if (world.model == "maps/e1m7.bsp") {
|
||||
WriteBytes (MSG_ALL, SVC_CDTRACK, 2.0, SVC_FINALE);
|
||||
if (!cvar("registered")) {
|
||||
WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
|
||||
WriteString (MSG_ALL, "As the corpse of the monstrous entity\n"
|
||||
"Chthon sinks back into the lava whence\n"
|
||||
"it rose, you grip the Rune of Earth\n"
|
||||
"Magic tightly. Now that you have\n"
|
||||
"conquered the Dimension of the Doomed,\n"
|
||||
"realm of Earth Magic, you are ready to\n"
|
||||
"complete your task in the other three\n"
|
||||
"haunted lands of Quake. Or are you? If\n"
|
||||
"you don't register Quake, you'll never\n"
|
||||
"know what awaits you in the Realm of\n"
|
||||
"Black Magic, the Netherworld, and the\n"
|
||||
"Elder World!");
|
||||
} else {
|
||||
WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
|
||||
WriteString (MSG_ALL, "As the corpse of the monstrous entity\n"
|
||||
"Chthon sinks back into the lava whence\n"
|
||||
"it rose, you grip the Rune of Earth\n"
|
||||
"Magic tightly. Now that you have\n"
|
||||
"conquered the Dimension of the Doomed,\n"
|
||||
"realm of Earth Magic, you are ready to\n"
|
||||
"complete your task. A Rune of magic\n"
|
||||
"power lies at the end of each haunted\n"
|
||||
"land of Quake. Go forth, seek the\n"
|
||||
"totality of the four Runes!");
|
||||
}
|
||||
return;
|
||||
} else if (world.model == "maps/e2m6.bsp") {
|
||||
WriteBytes (MSG_ALL, SVC_CDTRACK, 2.0, SVC_FINALE);
|
||||
WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
|
||||
WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\n"
|
||||
"your hand and whispers dark thoughts\n"
|
||||
"into your brain. You learn the inmost\n"
|
||||
"lore of the Hell-Mother; Shub-Niggurath!\n"
|
||||
"You now know that she is behind all the\n"
|
||||
"terrible plotting which has led to so\n"
|
||||
"much death and horror. But she is not\n"
|
||||
"inviolate! Armed with this Rune, you\n"
|
||||
"realize that once all four Runes are\n"
|
||||
"combined, the gate to Shub-Niggurath's\n"
|
||||
"Pit will open, and you can face the\n"
|
||||
"Witch-Goddess herself in her frightful\n"
|
||||
"otherworld cathedral.");
|
||||
return;
|
||||
} else if (world.model == "maps/e3m6.bsp") {
|
||||
WriteBytes (MSG_ALL, SVC_CDTRACK, 2.0, SVC_FINALE);
|
||||
WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
|
||||
WriteString (MSG_ALL, "The charred viscera of diabolic horrors\n"
|
||||
"bubble viscously as you seize the Rune\n"
|
||||
"of Hell Magic. Its heat scorches your\n"
|
||||
"hand, and its terrible secrets blight\n"
|
||||
"your mind. Gathering the shreds of your\n"
|
||||
"courage, you shake the devil's shackles\n"
|
||||
"from your soul, and become ever more\n"
|
||||
"hard and determined to destroy the\n"
|
||||
"hideous creatures whose mere existence\n"
|
||||
"threatens the souls and psyches of all\n"
|
||||
"the population of Earth.");
|
||||
return;
|
||||
} else if (world.model == "maps/e4m7.bsp") {
|
||||
WriteBytes (MSG_ALL, SVC_CDTRACK, 2.0, SVC_FINALE);
|
||||
WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
|
||||
WriteString (MSG_ALL, "Despite the awful might of the Elder\n"
|
||||
"World, you have achieved the Rune of\n"
|
||||
"Elder Magic, capstone of all types of\n"
|
||||
"arcane wisdom. Beyond good and evil,\n"
|
||||
"beyond life and death, the Rune\n"
|
||||
"pulsates, heavy with import. Patient and\n"
|
||||
"potent, the Elder Being Shub-Niggurath\n"
|
||||
"weaves her dire plans to clear off all\n"
|
||||
"life from the Earth, and bring her own\n"
|
||||
"foul offspring to our world! For all the\n"
|
||||
"dwellers in these nightmare dimensions\n"
|
||||
"are her descendants! Once all Runes of\n"
|
||||
"magic power are united, the energy\n"
|
||||
"behind them will blast open the Gateway\n"
|
||||
"to Shub-Niggurath, and you can travel\n"
|
||||
"there to foil the Hell-Mother's plots\n"
|
||||
"in person.");
|
||||
return;
|
||||
}
|
||||
GotoNextMap();
|
||||
|
@ -186,7 +250,17 @@ void() ExitIntermission =
|
|||
|
||||
if ((serverflags & 15) == 15) {
|
||||
WriteByte (MSG_ALL, SVC_FINALE);
|
||||
WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
|
||||
WriteString (MSG_ALL, "Now, you have all four Runes. You sense\n"
|
||||
"tremendous invisible forces moving to\n"
|
||||
"unseal ancient barriers. Shub-Niggurath\n"
|
||||
"had hoped to use the Runes Herself to\n"
|
||||
"clear off the Earth, but now instead,\n"
|
||||
"you will use them to enter her home and\n"
|
||||
"confront her as an avatar of avenging\n"
|
||||
"Earth-life. If you defeat her, you will\n"
|
||||
"be remembered forever as the savior of\n"
|
||||
"the planet. If she conquers, it will be\n"
|
||||
"as if you had never been born.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +275,8 @@ IntermissionThink
|
|||
When the player presses attack or jump, change to the next level
|
||||
============
|
||||
*/
|
||||
void() IntermissionThink =
|
||||
void ()
|
||||
IntermissionThink =
|
||||
{
|
||||
if (time < intermission_exittime)
|
||||
return;
|
||||
|
@ -220,7 +295,8 @@ The global "nextmap" has been set previously.
|
|||
Take the players to the intermission spot
|
||||
============
|
||||
*/
|
||||
void() execute_changelevel =
|
||||
void ()
|
||||
execute_changelevel =
|
||||
{
|
||||
local entity pos;
|
||||
|
||||
|
@ -251,7 +327,8 @@ void() execute_changelevel =
|
|||
};
|
||||
|
||||
|
||||
void() changelevel_touch =
|
||||
void ()
|
||||
changelevel_touch =
|
||||
{
|
||||
if (other.classname != "player")
|
||||
return;
|
||||
|
@ -290,7 +367,8 @@ void() changelevel_touch =
|
|||
/*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
|
||||
When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
|
||||
*/
|
||||
void() trigger_changelevel =
|
||||
void ()
|
||||
trigger_changelevel =
|
||||
{
|
||||
if (!self.map)
|
||||
objerror ("chagnelevel trigger doesn't have map");
|
||||
|
@ -301,7 +379,8 @@ void() trigger_changelevel =
|
|||
|
||||
// PLAYER GAME EDGE FUNCTIONS =================================================
|
||||
|
||||
void() set_suicide_frame;
|
||||
void ()
|
||||
set_suicide_frame;
|
||||
|
||||
// called by ClientKill and DeadThink
|
||||
void() respawn =
|
||||
|
@ -335,7 +414,8 @@ ClientKill
|
|||
Player entered the suicide command
|
||||
============
|
||||
*/
|
||||
void() ClientKill =
|
||||
void ()
|
||||
ClientKill =
|
||||
{
|
||||
bprint (PRINT_MEDIUM, self.netname);
|
||||
bprint (PRINT_MEDIUM, " suicides\n");
|
||||
|
@ -346,7 +426,8 @@ void() ClientKill =
|
|||
respawn ();
|
||||
};
|
||||
|
||||
float(vector v) CheckSpawnPoint =
|
||||
float (vector v)
|
||||
CheckSpawnPoint =
|
||||
{
|
||||
return FALSE;
|
||||
};
|
||||
|
@ -358,7 +439,8 @@ SelectSpawnPoint
|
|||
Returns the entity to spawn at
|
||||
============
|
||||
*/
|
||||
entity() SelectSpawnPoint =
|
||||
entity ()
|
||||
SelectSpawnPoint =
|
||||
{
|
||||
local entity spot, spots, thing;
|
||||
local float numspots, totalspots, pcount;
|
||||
|
@ -384,32 +466,32 @@ entity() SelectSpawnPoint =
|
|||
spots = world;
|
||||
spot = find (world, classname, "info_player_deathmatch");
|
||||
while (spot) {
|
||||
totalspots = totalspots + 1;
|
||||
totalspots++;
|
||||
|
||||
thing = findradius (spot.origin, 84);
|
||||
pcount = 0;
|
||||
while (thing) {
|
||||
if (thing.classname == "player")
|
||||
pcount=pcount + 1;
|
||||
pcount++;
|
||||
thing = thing.chain;
|
||||
}
|
||||
if (pcount == 0) {
|
||||
spot.goalentity = spots;
|
||||
spots = spot;
|
||||
numspots = numspots + 1;
|
||||
numspots++;
|
||||
}
|
||||
|
||||
// Get the next spot in the chain
|
||||
spot = find (spot, classname, "info_player_deathmatch");
|
||||
}
|
||||
totalspots=totalspots - 1;
|
||||
totalspots--;
|
||||
if (!numspots) {
|
||||
// ack, they are all full, just pick one at random
|
||||
// bprint (PRINT_HIGH, "Ackk! All spots are full. Selecting random spawn spot\n");
|
||||
totalspots = rint ((totalspots * random ()));
|
||||
spot = find (world, classname, "info_player_deathmatch");
|
||||
while (totalspots > 0) {
|
||||
totalspots = totalspots - 1;
|
||||
totalspots--;
|
||||
spot = find (spot, classname, "info_player_deathmatch");
|
||||
}
|
||||
return spot;
|
||||
|
@ -418,13 +500,13 @@ entity() SelectSpawnPoint =
|
|||
// We now have the number of spots available on the map in numspots
|
||||
|
||||
// Generate a random number between 1 and numspots
|
||||
numspots = numspots - 1;
|
||||
numspots--;
|
||||
numspots = rint ((numspots * random ()));
|
||||
|
||||
spot = spots;
|
||||
while (numspots > 0) {
|
||||
spot = spot.goalentity;
|
||||
numspots = numspots - 1;
|
||||
numspots--;
|
||||
}
|
||||
return spot;
|
||||
}
|
||||
|
@ -445,7 +527,8 @@ entity() SelectSpawnPoint =
|
|||
void () DecodeLevelParms;
|
||||
void () PlayerDie;
|
||||
|
||||
float(entity e) ValidateUser =
|
||||
float (entity e)
|
||||
ValidateUser =
|
||||
{
|
||||
/*
|
||||
local string userclan, s;
|
||||
|
@ -493,7 +576,8 @@ PutClientInServer
|
|||
called each time a player enters a new level
|
||||
============
|
||||
*/
|
||||
void() PutClientInServer =
|
||||
void ()
|
||||
PutClientInServer =
|
||||
{
|
||||
local entity spot;
|
||||
|
||||
|
@ -523,7 +607,7 @@ void() PutClientInServer =
|
|||
self.th_die = PlayerDie;
|
||||
|
||||
self.deadflag = DEAD_NO;
|
||||
// paustime is set by teleporters to keep the player from moving a while
|
||||
// pausetime is set by teleporters to keep the player from moving a while
|
||||
self.pausetime = 0;
|
||||
|
||||
spot = SelectSpawnPoint ();
|
||||
|
@ -565,19 +649,14 @@ void() PutClientInServer =
|
|||
self.ammo_shells = 255;
|
||||
self.ammo_rockets = 255;
|
||||
self.ammo_cells = 255;
|
||||
self.items = self.items | IT_NAILGUN;
|
||||
self.items = self.items | IT_SUPER_NAILGUN;
|
||||
self.items = self.items | IT_SUPER_SHOTGUN;
|
||||
self.items = self.items | IT_ROCKET_LAUNCHER;
|
||||
// self.items = self.items | IT_GRENADE_LAUNCHER;
|
||||
self.items = self.items | IT_LIGHTNING;
|
||||
self.items |= (IT_NAILGUN | IT_SUPER_NAILGUN | IT_SUPER_SHOTGUN |
|
||||
IT_ROCKET_LAUNCHER | IT_LIGHTNING);
|
||||
}
|
||||
self.items = self.items
|
||||
- (self.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR3;
|
||||
self.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
|
||||
self.items |= (IT_ARMOR3 | IT_INVULNERABILITY);
|
||||
self.armorvalue = 200;
|
||||
self.armortype = 0.8;
|
||||
self.health = 250;
|
||||
self.items = self.items | IT_INVULNERABILITY;
|
||||
self.invincible_time = 1;
|
||||
self.invincible_finished = time + 3;
|
||||
}
|
||||
|
@ -587,18 +666,13 @@ void() PutClientInServer =
|
|||
self.ammo_shells = 30;
|
||||
self.ammo_rockets = 10;
|
||||
self.ammo_cells = 30;
|
||||
self.items = self.items | IT_NAILGUN;
|
||||
self.items = self.items | IT_SUPER_NAILGUN;
|
||||
self.items = self.items | IT_SUPER_SHOTGUN;
|
||||
self.items = self.items | IT_ROCKET_LAUNCHER;
|
||||
self.items = self.items | IT_GRENADE_LAUNCHER;
|
||||
self.items = self.items | IT_LIGHTNING;
|
||||
self.items = self.items
|
||||
- (self.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR3;
|
||||
self.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
|
||||
self.items |= (IT_NAILGUN | IT_SUPER_NAILGUN | IT_SUPER_SHOTGUN |
|
||||
IT_ROCKET_LAUNCHER | IT_GRENADE_LAUNCHER |
|
||||
IT_LIGHTNING | IT_ARMOR3 | IT_INVULNERABILITY);
|
||||
self.armorvalue = 200;
|
||||
self.armortype = 0.8;
|
||||
self.health = 200;
|
||||
self.items = self.items | IT_INVULNERABILITY;
|
||||
self.invincible_time = 1;
|
||||
self.invincible_finished = time + 3;
|
||||
}
|
||||
|
@ -609,35 +683,40 @@ void() PutClientInServer =
|
|||
/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
|
||||
The normal starting point for a level.
|
||||
*/
|
||||
void() info_player_start =
|
||||
void ()
|
||||
info_player_start =
|
||||
{
|
||||
};
|
||||
|
||||
/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
|
||||
Only used on start map for the return point from an episode.
|
||||
*/
|
||||
void() info_player_start2 =
|
||||
void ()
|
||||
info_player_start2 =
|
||||
{
|
||||
};
|
||||
|
||||
/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
|
||||
potential spawning position for deathmatch games
|
||||
*/
|
||||
void() info_player_deathmatch =
|
||||
void ()
|
||||
info_player_deathmatch =
|
||||
{
|
||||
};
|
||||
|
||||
/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
|
||||
potential spawning position for coop games
|
||||
*/
|
||||
void() info_player_coop =
|
||||
void ()
|
||||
info_player_coop =
|
||||
{
|
||||
};
|
||||
|
||||
// RULES ======================================================================
|
||||
|
||||
// go to the next level for deathmatch
|
||||
void() NextLevel =
|
||||
void ()
|
||||
NextLevel =
|
||||
{
|
||||
local entity o;
|
||||
|
||||
|
@ -649,16 +728,16 @@ void() NextLevel =
|
|||
mapname = "e1m1";
|
||||
} else if (!(serverflags & 1)) {
|
||||
mapname = "e1m1";
|
||||
serverflags = serverflags | 1;
|
||||
serverflags |= 1;
|
||||
} else if (!(serverflags & 2)) {
|
||||
mapname = "e2m1";
|
||||
serverflags = serverflags | 2;
|
||||
serverflags |= 2;
|
||||
} else if (!(serverflags & 4)) {
|
||||
mapname = "e3m1";
|
||||
serverflags = serverflags | 4;
|
||||
serverflags |= 4;
|
||||
} else if (!(serverflags & 8)) {
|
||||
mapname = "e4m1";
|
||||
serverflags = serverflags - 7;
|
||||
serverflags -= 7;
|
||||
}
|
||||
|
||||
o = spawn();
|
||||
|
@ -688,7 +767,8 @@ CheckRules
|
|||
Exit deathmatch games upon conditions
|
||||
============
|
||||
*/
|
||||
void() CheckRules =
|
||||
void ()
|
||||
CheckRules =
|
||||
{
|
||||
if (deathmatch) {
|
||||
if (timelimit && time >= timelimit)
|
||||
|
@ -701,13 +781,14 @@ void() CheckRules =
|
|||
|
||||
//============================================================================
|
||||
|
||||
void() PlayerDeathThink =
|
||||
void ()
|
||||
PlayerDeathThink =
|
||||
{
|
||||
local float forward;
|
||||
|
||||
if ((self.flags & FL_ONGROUND)) {
|
||||
forward = vlen (self.velocity);
|
||||
forward = forward - 20;
|
||||
forward -= 20;
|
||||
if (forward <= 0)
|
||||
self.velocity = '0 0 0';
|
||||
else
|
||||
|
@ -732,7 +813,8 @@ void() PlayerDeathThink =
|
|||
respawn();
|
||||
};
|
||||
|
||||
void() PlayerJump =
|
||||
void ()
|
||||
PlayerJump =
|
||||
{
|
||||
if (self.flags & FL_WATERJUMP)
|
||||
return;
|
||||
|
@ -755,7 +837,7 @@ void() PlayerJump =
|
|||
if (!(self.flags & FL_JUMPRELEASED))
|
||||
return; // don't pogo stick
|
||||
|
||||
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
|
||||
self.flags &= ~FL_JUMPRELEASED;
|
||||
self.button2 = 0;
|
||||
|
||||
// player jumping sound
|
||||
|
@ -780,7 +862,7 @@ void() WaterMove =
|
|||
self.dmg = 2;
|
||||
} else if (self.air_finished < time) { // drown!
|
||||
if (self.pain_finished < time) {
|
||||
self.dmg = self.dmg + 2;
|
||||
self.dmg += 2;
|
||||
if (self.dmg > 15)
|
||||
self.dmg = 10;
|
||||
T_Damage (self, world, world, self.dmg);
|
||||
|
@ -792,7 +874,7 @@ void() WaterMove =
|
|||
if (self.flags & FL_INWATER) {
|
||||
// play leave water sound
|
||||
sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
|
||||
self.flags = self.flags - FL_INWATER;
|
||||
self.flags &= ~FL_INWATER;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -826,12 +908,13 @@ void() WaterMove =
|
|||
sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
|
||||
break;
|
||||
}
|
||||
self.flags = self.flags + FL_INWATER;
|
||||
self.flags |= FL_INWATER;
|
||||
self.dmgtime = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void() CheckWaterJump =
|
||||
void ()
|
||||
CheckWaterJump =
|
||||
{
|
||||
local vector start, end;
|
||||
|
||||
|
@ -849,9 +932,9 @@ void() CheckWaterJump =
|
|||
self.movedir = trace_plane_normal * -50;
|
||||
traceline (start, end, TRUE, self);
|
||||
if (trace_fraction == 1) { // open at eye level
|
||||
self.flags = self.flags | FL_WATERJUMP;
|
||||
self.flags |= FL_WATERJUMP;
|
||||
self.velocity_z = 225;
|
||||
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
|
||||
self.flags &= ~FL_JUMPRELEASED;
|
||||
self.teleport_time = time + 2; // safety net
|
||||
return;
|
||||
}
|
||||
|
@ -865,7 +948,8 @@ PlayerPreThink
|
|||
Called every frame before physics are run
|
||||
================
|
||||
*/
|
||||
void() PlayerPreThink =
|
||||
void ()
|
||||
PlayerPreThink =
|
||||
{
|
||||
if (intermission_running) {
|
||||
IntermissionThink (); // otherwise a button could be missed between
|
||||
|
@ -916,7 +1000,8 @@ CheckPowerups
|
|||
Check for turning off powerups
|
||||
================
|
||||
*/
|
||||
void() CheckPowerups = // FIXME: this whole thing is a mess.
|
||||
void ()
|
||||
CheckPowerups = // FIXME: this whole thing is a mess.
|
||||
{
|
||||
if (self.health <= 0)
|
||||
return;
|
||||
|
@ -944,7 +1029,7 @@ void() CheckPowerups = // FIXME: this whole thing is a mess.
|
|||
}
|
||||
|
||||
if (self.invisible_finished < time) { // just stopped
|
||||
self.items = self.items - IT_INVISIBILITY;
|
||||
self.items &= ~IT_INVISIBILITY;
|
||||
self.invisible_finished = 0;
|
||||
self.invisible_time = 0;
|
||||
}
|
||||
|
@ -973,7 +1058,7 @@ void() CheckPowerups = // FIXME: this whole thing is a mess.
|
|||
}
|
||||
|
||||
if (self.invincible_finished < time) { // just stopped
|
||||
self.items = self.items - IT_INVULNERABILITY;
|
||||
self.items &= ~IT_INVULNERABILITY;
|
||||
self.invincible_time = 0;
|
||||
self.invincible_finished = 0;
|
||||
}
|
||||
|
@ -1005,7 +1090,7 @@ void() CheckPowerups = // FIXME: this whole thing is a mess.
|
|||
}
|
||||
|
||||
if (self.super_damage_finished < time) { // just stopped
|
||||
self.items = self.items - IT_QUAD;
|
||||
self.items &= ~IT_QUAD;
|
||||
if (deathmatch == 4) {
|
||||
self.ammo_cells = 255;
|
||||
self.armorvalue = 1;
|
||||
|
@ -1041,7 +1126,7 @@ void() CheckPowerups = // FIXME: this whole thing is a mess.
|
|||
}
|
||||
|
||||
if (self.radsuit_finished < time) { // just stopped
|
||||
self.items = self.items - IT_SUIT;
|
||||
self.items &= ~IT_SUIT;
|
||||
self.rad_time = 0;
|
||||
self.radsuit_finished = 0;
|
||||
}
|
||||
|
@ -1089,7 +1174,8 @@ ClientConnect
|
|||
called when a player connects to a server
|
||||
============
|
||||
*/
|
||||
void() ClientConnect =
|
||||
void ()
|
||||
ClientConnect =
|
||||
{
|
||||
if (deathmatch || coop) { // Tonik
|
||||
bprint (PRINT_HIGH, self.netname);
|
||||
|
@ -1108,7 +1194,8 @@ ClientDisconnect
|
|||
called when a player disconnects from a server
|
||||
============
|
||||
*/
|
||||
void() ClientDisconnect =
|
||||
void ()
|
||||
ClientDisconnect =
|
||||
{
|
||||
local entity e;
|
||||
local string tmp;
|
||||
|
@ -1148,7 +1235,8 @@ ClientObituary
|
|||
called when a player dies
|
||||
============
|
||||
*/
|
||||
void(entity targ, entity attacker) ClientObituary =
|
||||
void (entity targ, entity attacker)
|
||||
ClientObituary =
|
||||
{
|
||||
local float rnum;
|
||||
local string deathstring, deathstring2, attackerteam, targteam;
|
||||
|
@ -1163,7 +1251,7 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
if (targ.deathtype == "selfwater") {
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
bprint (PRINT_MEDIUM," electrocutes himself.\n ");
|
||||
targ.frags = targ.frags - 1;
|
||||
targ.frags--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1174,14 +1262,14 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
bprint (PRINT_MEDIUM, " was telefragged by ");
|
||||
bprint (PRINT_MEDIUM, attacker.owner.netname);
|
||||
bprint (PRINT_MEDIUM, "\n");
|
||||
attacker.owner.frags++;
|
||||
logfrag (attacker.owner, targ);
|
||||
attacker.owner.frags = attacker.owner.frags + 1;
|
||||
return;
|
||||
case "teledeath2":
|
||||
bprint (PRINT_MEDIUM, "Satan's power deflects ");
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
bprint (PRINT_MEDIUM, "'s telefrag\n");
|
||||
targ.frags = targ.frags - 1;
|
||||
targ.frags--;
|
||||
logfrag (targ, targ);
|
||||
return;
|
||||
case "teledeath3":
|
||||
|
@ -1190,14 +1278,14 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
bprint (PRINT_MEDIUM, " was telefragged by ");
|
||||
bprint (PRINT_MEDIUM, attacker.owner.netname);
|
||||
bprint (PRINT_MEDIUM, "'s Satan's power\n");
|
||||
targ.frags = targ.frags - 1;
|
||||
targ.frags--;
|
||||
logfrag (targ, targ);
|
||||
return;
|
||||
case "squish":
|
||||
if (teamplay && targteam == attackerteam && attackerteam != ""
|
||||
&& targ != attacker) {
|
||||
attacker.frags--;
|
||||
logfrag (attacker, attacker);
|
||||
attacker.frags = attacker.frags - 1;
|
||||
bprint (PRINT_MEDIUM, attacker.netname);
|
||||
bprint (PRINT_MEDIUM, " squished a teammate\n");
|
||||
return;
|
||||
|
@ -1206,12 +1294,12 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
bprint (PRINT_MEDIUM, " squishes ");
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
bprint (PRINT_MEDIUM, "\n");
|
||||
attacker.frags++;
|
||||
logfrag (attacker, targ);
|
||||
attacker.frags = attacker.frags + 1;
|
||||
return;
|
||||
} else {
|
||||
targ.frags--; // killed self
|
||||
logfrag (targ, targ);
|
||||
targ.frags = targ.frags - 1; // killed self
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
bprint (PRINT_MEDIUM, " was squished\n");
|
||||
return;
|
||||
|
@ -1220,8 +1308,8 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
case "player":
|
||||
if (targ == attacker) {
|
||||
// killed self
|
||||
attacker.frags--;
|
||||
logfrag (attacker, attacker);
|
||||
attacker.frags = attacker.frags - 1;
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
if (targ.deathtype == "grenade")
|
||||
bprint (PRINT_MEDIUM, " tries to put the pin back in\n");
|
||||
|
@ -1249,14 +1337,15 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
deathstring = " loses another friend\n";
|
||||
bprint (PRINT_MEDIUM, attacker.netname);
|
||||
bprint (PRINT_MEDIUM, deathstring);
|
||||
attacker.frags = attacker.frags - 1;
|
||||
// ZOID 12-13-96: killing a teammate logs as suicide
|
||||
attacker.frags--;
|
||||
logfrag (attacker, attacker);
|
||||
return;
|
||||
} else {
|
||||
attacker.frags++;
|
||||
logfrag (attacker, targ);
|
||||
|
||||
deathstring = deathstring2 = " this should never happen ";
|
||||
switch (targ.deathtype) {
|
||||
case "nail":
|
||||
deathstring = " was nailed by ";
|
||||
|
|
155
nqw/fight.qc
155
nqw/fight.qc
|
@ -26,7 +26,8 @@ void() ai_face;
|
|||
float enemy_vis, enemy_infront, enemy_range;
|
||||
float enemy_yaw;
|
||||
|
||||
void() knight_attack =
|
||||
void ()
|
||||
knight_attack =
|
||||
{
|
||||
local float len;
|
||||
|
||||
|
@ -50,19 +51,17 @@ The player is in view, so decide to move or launch an attack
|
|||
Returns FALSE if movement should continue
|
||||
============
|
||||
*/
|
||||
float() CheckAttack =
|
||||
float ()
|
||||
CheckAttack =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
local entity targ;
|
||||
local float chance;
|
||||
|
||||
targ = self.enemy;
|
||||
|
||||
// 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);
|
||||
traceline (self.origin + self.view_ofs, targ.origin + targ.view_ofs,
|
||||
FALSE, self);
|
||||
|
||||
if (trace_ent != targ)
|
||||
return FALSE; // don't have a clear shot
|
||||
|
@ -80,37 +79,39 @@ float() CheckAttack =
|
|||
}
|
||||
}
|
||||
|
||||
// missile attack
|
||||
if (!self.th_missile)
|
||||
if (!self.th_missile) // missile attack
|
||||
return FALSE;
|
||||
|
||||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
|
||||
if (enemy_range == RANGE_FAR)
|
||||
return FALSE;
|
||||
if (enemy_range == RANGE_MELEE) {
|
||||
chance = 0; // FIXME: STUPID DAMN WARNINGS
|
||||
switch (enemy_range) {
|
||||
case RANGE_MELEE:
|
||||
chance = 0.9;
|
||||
self.attack_finished = 0;
|
||||
} else if (enemy_range == RANGE_NEAR) {
|
||||
break;
|
||||
case RANGE_NEAR:
|
||||
if (self.th_melee)
|
||||
chance = 0.2;
|
||||
else
|
||||
chance = 0.4;
|
||||
} else if (enemy_range == RANGE_MID) {
|
||||
break;
|
||||
case RANGE_MID:
|
||||
if (self.th_melee)
|
||||
chance = 0.05;
|
||||
else
|
||||
chance = 0.1;
|
||||
} else
|
||||
chance = 0;
|
||||
break;
|
||||
case RANGE_FAR:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (random () < chance) {
|
||||
self.th_missile ();
|
||||
SUB_AttackFinished (2 * random ());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
|
@ -121,7 +122,8 @@ ai_face
|
|||
Stay facing the enemy
|
||||
=============
|
||||
*/
|
||||
void() ai_face =
|
||||
void ()
|
||||
ai_face =
|
||||
{
|
||||
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
|
||||
ChangeYaw ();
|
||||
|
@ -138,15 +140,16 @@ float (entity targ) visible;
|
|||
float (entity targ) infront;
|
||||
float (entity targ) range;
|
||||
|
||||
void(float d) ai_charge =
|
||||
void (float d)
|
||||
ai_charge =
|
||||
{
|
||||
ai_face ();
|
||||
movetogoal (d); // done in C code...
|
||||
};
|
||||
|
||||
void() ai_charge_side =
|
||||
void ()
|
||||
ai_charge_side =
|
||||
{
|
||||
local vector dtemp;
|
||||
local float heading;
|
||||
|
||||
// aim to the left of the enemy for a flyby
|
||||
|
@ -154,39 +157,28 @@ void() ai_charge_side =
|
|||
ChangeYaw ();
|
||||
|
||||
makevectors (self.angles);
|
||||
dtemp = self.enemy.origin - 30*v_right;
|
||||
heading = vectoyaw(dtemp - self.origin);
|
||||
heading = vectoyaw ((self.enemy.origin - 30 * v_right) - self.origin);
|
||||
|
||||
walkmove (heading, 20);
|
||||
};
|
||||
|
||||
/*
|
||||
=============
|
||||
ai_melee
|
||||
|
||||
=============
|
||||
*/
|
||||
void() ai_melee =
|
||||
void ()
|
||||
ai_melee =
|
||||
{
|
||||
local vector delta;
|
||||
local float ldmg;
|
||||
|
||||
if (!self.enemy)
|
||||
return; // removed before stroke
|
||||
|
||||
delta = self.enemy.origin - self.origin;
|
||||
|
||||
if (vlen (delta) > 60)
|
||||
if (vlen (self.enemy.origin - self.origin) > 60)
|
||||
return;
|
||||
|
||||
ldmg = (random () + random () + random ()) * 3;
|
||||
T_Damage (self.enemy, self, self, ldmg);
|
||||
};
|
||||
|
||||
|
||||
void() ai_melee_side =
|
||||
void ()
|
||||
ai_melee_side =
|
||||
{
|
||||
local vector delta;
|
||||
local float ldmg;
|
||||
|
||||
if (!self.enemy)
|
||||
|
@ -194,17 +186,15 @@ void() ai_melee_side =
|
|||
|
||||
ai_charge_side ();
|
||||
|
||||
delta = self.enemy.origin - self.origin;
|
||||
|
||||
if (vlen(delta) > 60)
|
||||
if (vlen (self.enemy.origin - self.origin) > 60)
|
||||
return;
|
||||
if (!CanDamage (self.enemy, self))
|
||||
return;
|
||||
|
||||
ldmg = (random () + random () + random ()) * 3;
|
||||
T_Damage (self.enemy, self, self, ldmg);
|
||||
};
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
|
@ -215,50 +205,47 @@ The player is in view, so decide to move or launch an attack
|
|||
Returns FALSE if movement should continue
|
||||
============
|
||||
*/
|
||||
float() SoldierCheckAttack =
|
||||
float ()
|
||||
SoldierCheckAttack =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
local entity targ;
|
||||
local float chance;
|
||||
|
||||
targ = self.enemy;
|
||||
|
||||
// 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);
|
||||
traceline (self.origin + self.view_ofs, targ.origin + targ.view_ofs,
|
||||
FALSE, self);
|
||||
|
||||
if (trace_inopen && trace_inwater)
|
||||
return FALSE; // sight line crossed contents
|
||||
|
||||
if (trace_ent != targ)
|
||||
return FALSE; // don't have a clear shot
|
||||
|
||||
// missile attack
|
||||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
return FALSE; // missile attack
|
||||
|
||||
if (enemy_range == RANGE_FAR)
|
||||
return FALSE;
|
||||
if (enemy_range == RANGE_MELEE)
|
||||
chance = 0; // FIXME: STUPID DAMN WARNINGS
|
||||
switch (enemy_range) {
|
||||
case RANGE_MELEE:
|
||||
chance = 0.9;
|
||||
else if (enemy_range == RANGE_NEAR)
|
||||
break;
|
||||
case RANGE_NEAR:
|
||||
chance = 0.4;
|
||||
else if (enemy_range == RANGE_MID)
|
||||
break;
|
||||
case RANGE_MID:
|
||||
chance = 0.05;
|
||||
else
|
||||
chance = 0;
|
||||
|
||||
break;
|
||||
case RANGE_FAR:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
if (random () < chance) {
|
||||
self.th_missile ();
|
||||
SUB_AttackFinished (1 + random ());
|
||||
if (random () < 0.3)
|
||||
self.lefty = !self.lefty;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
//=============================================================================
|
||||
|
@ -271,10 +258,11 @@ The player is in view, so decide to move or launch an attack
|
|||
Returns FALSE if movement should continue
|
||||
============
|
||||
*/
|
||||
float() ShamCheckAttack =
|
||||
float ()
|
||||
ShamCheckAttack =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
local entity targ;
|
||||
local vector spot1, spot2;
|
||||
|
||||
if (enemy_range == RANGE_MELEE) {
|
||||
if (CanDamage (self.enemy, self)) {
|
||||
|
@ -285,7 +273,6 @@ float() ShamCheckAttack =
|
|||
|
||||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
|
||||
if (!enemy_vis)
|
||||
return FALSE;
|
||||
|
||||
|
@ -294,15 +281,12 @@ float() ShamCheckAttack =
|
|||
// see if any entities are in the way of the shot
|
||||
spot1 = self.origin + self.view_ofs;
|
||||
spot2 = targ.origin + targ.view_ofs;
|
||||
|
||||
if (vlen (spot1 - spot2) > 600)
|
||||
return FALSE;
|
||||
|
||||
traceline (spot1, spot2, FALSE, self);
|
||||
|
||||
if (trace_inopen && trace_inwater)
|
||||
return FALSE; // sight line crossed contents
|
||||
|
||||
if (trace_ent != targ) {
|
||||
return FALSE; // don't have a clear shot
|
||||
}
|
||||
|
@ -326,11 +310,11 @@ The player is in view, so decide to move or launch an attack
|
|||
Returns FALSE if movement should continue
|
||||
============
|
||||
*/
|
||||
float() OgreCheckAttack =
|
||||
float ()
|
||||
OgreCheckAttack =
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
local entity targ;
|
||||
local float chance;
|
||||
// local float chance;
|
||||
|
||||
if (enemy_range == RANGE_MELEE) {
|
||||
if (CanDamage (self.enemy, self)) {
|
||||
|
@ -341,17 +325,14 @@ float() OgreCheckAttack =
|
|||
|
||||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
|
||||
if (!enemy_vis)
|
||||
return FALSE;
|
||||
|
||||
targ = self.enemy;
|
||||
|
||||
// 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);
|
||||
traceline (self.origin + self.view_ofs, targ.origin + targ.view_ofs,
|
||||
FALSE, self);
|
||||
|
||||
if (trace_inopen && trace_inwater)
|
||||
return FALSE; // sight line crossed contents
|
||||
|
@ -363,15 +344,19 @@ float() OgreCheckAttack =
|
|||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
|
||||
if (enemy_range == RANGE_FAR)
|
||||
switch (enemy_range) {
|
||||
case RANGE_NEAR:
|
||||
// chance = 0.10;
|
||||
break;
|
||||
case RANGE_MID:
|
||||
// chance = 0.05;
|
||||
break;
|
||||
case RANGE_FAR:
|
||||
return FALSE;
|
||||
|
||||
else if (enemy_range == RANGE_NEAR)
|
||||
chance = 0.10;
|
||||
else if (enemy_range == RANGE_MID)
|
||||
chance = 0.05;
|
||||
else
|
||||
chance = 0;
|
||||
default:
|
||||
// chance = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
self.attack_state = AS_MISSILE;
|
||||
SUB_AttackFinished (1 + 2 * random ());
|
||||
|
|
|
@ -238,8 +238,6 @@ void(float num_bubbles) DeathBubbles;
|
|||
|
||||
void() PainSound =
|
||||
{
|
||||
local float rs;
|
||||
|
||||
if (self.health < 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
SHAMBLER
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
// SHAMBLER ===================================================================
|
||||
|
||||
$cd id1/models/shams
|
||||
$origin 0 0 24
|
||||
|
@ -95,7 +89,6 @@ 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;
|
||||
|
||||
if (!self.enemy)
|
||||
|
@ -103,9 +96,7 @@ void() sham_smash10 =[ $smash10, sham_smash11 ] {
|
|||
|
||||
ai_charge (0);
|
||||
|
||||
delta = self.enemy.origin - self.origin;
|
||||
|
||||
if (vlen (delta) > 100)
|
||||
if (vlen (self.enemy.origin - self.origin) > 100)
|
||||
return;
|
||||
if (!CanDamage (self.enemy, self))
|
||||
return;
|
||||
|
@ -115,9 +106,9 @@ void() sham_smash10 =[ $smash10, sham_smash11 ] {
|
|||
sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
|
||||
|
||||
SpawnMeatSpray (self.origin + v_forward * 16,
|
||||
v_right * (200 * (random () - 0.5));
|
||||
v_right * 200 * (random () - 0.5));
|
||||
SpawnMeatSpray (self.origin + v_forward * 16,
|
||||
v_right * (200 * (random () - 0.5));
|
||||
v_right * 200 * (random () - 0.5));
|
||||
};
|
||||
void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);};
|
||||
void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);};
|
||||
|
|
|
@ -85,7 +85,6 @@ float() WizardCheckAttack =
|
|||
{
|
||||
local entity targ;
|
||||
local float chance;
|
||||
local vector spot1, spot2;
|
||||
|
||||
if (time < self.attack_finished)
|
||||
return FALSE;
|
||||
|
@ -103,10 +102,8 @@ float() WizardCheckAttack =
|
|||
targ = self.enemy;
|
||||
|
||||
// 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);
|
||||
traceline (self.origin + self.view_ofs, targ.origin + targ.view_ofs,
|
||||
FALSE, self);
|
||||
|
||||
if (trace_ent != targ) { // don't have a clear shot, so move to a side
|
||||
if (self.attack_state != AS_STRAIGHT) {
|
||||
|
@ -116,6 +113,7 @@ float() WizardCheckAttack =
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
chance = 0; // FIXME: DAMN IDIOTIC WARNINGS!
|
||||
switch (enemy_range) {
|
||||
case RANGE_MELEE:
|
||||
chance = 0.9;
|
||||
|
@ -199,8 +197,7 @@ void() Wiz_StartFast =
|
|||
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_righ
|
||||
* 14);
|
||||
setorigin (missile, self.origin + '0 0 30' + 14 * (v_forward + v_right));
|
||||
missile.enemy = self.enemy;
|
||||
missile.nextthink = time + 0.8;
|
||||
missile.think = Wiz_FastFire;
|
||||
|
@ -210,8 +207,7 @@ 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' + 14 * (v_forward - v_right));
|
||||
missile.enemy = self.enemy;
|
||||
missile.nextthink = time + 0.3;
|
||||
missile.think = Wiz_FastFire;
|
||||
|
|
Loading…
Reference in a new issue