1814 lines
45 KiB
C++
1814 lines
45 KiB
C++
|
|
// prototypes
|
|
void () w_weaponframe;
|
|
void() w_setcurrentammo;
|
|
void() player_pain;
|
|
void() player_stand1;
|
|
void (vector org) spawn_tfog;
|
|
void (vector org, entity death_owner) spawn_tdeath;
|
|
|
|
float modelindex_eyes, modelindex_player, modelindex_hammer;
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
level changing / intermission
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
float intermission_running;
|
|
float intermission_exittime;
|
|
|
|
/*quaked info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
|
|
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() setchangeparms =
|
|
{
|
|
if (self.health <= 0)
|
|
{
|
|
setnewparms ();
|
|
return;
|
|
}
|
|
|
|
//jim
|
|
// remove items
|
|
self.items = self.items - (self.items &
|
|
(it_key1 | it_key2 | it_invisibility | it_invulnerability | it_suit | it_quad ) );
|
|
//med
|
|
self.items2 = self.items2 - (self.items2 &
|
|
(hip_it_wetsuit | hip_it_empathy_shields ) );
|
|
//med
|
|
self.gravity = 1.0;
|
|
|
|
// cap super health
|
|
if (self.health > 100)
|
|
self.health = 100;
|
|
if (self.health < 50)
|
|
self.health = 50;
|
|
parm1 = self.items;
|
|
parm2 = self.health;
|
|
parm3 = self.armorvalue;
|
|
if (self.ammo_shells < 25)
|
|
parm4 = 25;
|
|
else
|
|
parm4 = self.ammo_shells;
|
|
parm5 = self.ammo_nails;
|
|
parm6 = self.ammo_rockets;
|
|
parm7 = self.ammo_cells;
|
|
parm8 = self.weapon;
|
|
parm9 = self.armortype * 100;
|
|
};
|
|
|
|
void() setnewparms =
|
|
{
|
|
parm1 = it_shotgun | it_axe;
|
|
parm2 = 100;
|
|
parm3 = 0;
|
|
parm4 = 25;
|
|
parm5 = 0;
|
|
parm6 = 0;
|
|
parm7 = 0;
|
|
parm8 = 1;
|
|
parm9 = 0;
|
|
};
|
|
|
|
void() decodelevelparms =
|
|
{
|
|
//hipnotic
|
|
if (world.model == "maps/start.bsp")
|
|
setnewparms (); // take away all stuff on starting new episode
|
|
if (world.model == "maps/hip1m1.bsp")
|
|
setnewparms (); // take away all stuff on starting new episode
|
|
if (world.model == "maps/hip2m1.bsp")
|
|
setnewparms (); // take away all stuff on starting new episode
|
|
if (world.model == "maps/hip3m1.bsp")
|
|
setnewparms (); // take away all stuff on starting new episode
|
|
|
|
self.items = parm1;
|
|
self.health = parm2;
|
|
self.armorvalue = parm3;
|
|
self.ammo_shells = parm4;
|
|
self.ammo_nails = parm5;
|
|
self.ammo_rockets = parm6;
|
|
self.ammo_cells = parm7;
|
|
self.weapon = parm8;
|
|
self.armortype = parm9 * 0.01;
|
|
};
|
|
|
|
/*
|
|
============
|
|
findintermission
|
|
|
|
returns the entity to view from
|
|
============
|
|
*/
|
|
entity() findintermission =
|
|
{
|
|
local entity spot;
|
|
local float cyc;
|
|
|
|
// look for info_intermission first
|
|
spot = find (world, classname, "info_intermission");
|
|
if (spot)
|
|
{ // pick a random one
|
|
cyc = random() * 4;
|
|
while (cyc > 1)
|
|
{
|
|
spot = find (spot, classname, "info_intermission");
|
|
if (!spot)
|
|
spot = find (spot, classname, "info_intermission");
|
|
cyc = cyc - 1;
|
|
}
|
|
return spot;
|
|
}
|
|
|
|
// then look for the start position
|
|
spot = find (world, classname, "info_player_start");
|
|
if (spot)
|
|
return spot;
|
|
|
|
// testinfo_player_start is only found in regioned levels
|
|
spot = find (world, classname, "testplayerstart");
|
|
if (spot)
|
|
return spot;
|
|
|
|
objerror ("findintermission: no spot");
|
|
};
|
|
|
|
|
|
string nextmap;
|
|
void() gotonextmap =
|
|
{
|
|
if (cvar("samelevel")) // if samelevel is set, stay on same level
|
|
changelevel (mapname);
|
|
else
|
|
changelevel (nextmap);
|
|
};
|
|
|
|
|
|
void() exitintermission =
|
|
{
|
|
// skip any text in deathmatch
|
|
if (deathmatch)
|
|
{
|
|
gotonextmap ();
|
|
return;
|
|
}
|
|
|
|
intermission_exittime = time + 1;
|
|
intermission_running = intermission_running + 1;
|
|
|
|
//
|
|
// run some text if at the end of an episode
|
|
//
|
|
if (intermission_running == 2)
|
|
{
|
|
if (world.model == "maps/e1m7.bsp")
|
|
{
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 2);
|
|
writebyte (msg_all, 3);
|
|
if (!cvar("registered"))
|
|
{
|
|
writebyte (msg_all, svc_finale);
|
|
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!");
|
|
}
|
|
else
|
|
{
|
|
writebyte (msg_all, svc_finale);
|
|
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!");
|
|
}
|
|
return;
|
|
}
|
|
else if (world.model == "maps/e2m6.bsp")
|
|
{
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 2);
|
|
writebyte (msg_all, 3);
|
|
|
|
writebyte (msg_all, 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.");
|
|
return;
|
|
}
|
|
else if (world.model == "maps/e3m6.bsp")
|
|
{
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 2);
|
|
writebyte (msg_all, 3);
|
|
|
|
writebyte (msg_all, 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.");
|
|
return;
|
|
}
|
|
else if (world.model == "maps/e4m7.bsp")
|
|
{
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 2);
|
|
writebyte (msg_all, 3);
|
|
|
|
writebyte (msg_all, 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.");
|
|
return;
|
|
}
|
|
|
|
//hipnotic
|
|
if (world.model == "maps/hip1m4.bsp")
|
|
{
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 6);
|
|
writebyte (msg_all, 3);
|
|
writebyte (msg_all, svc_finale);
|
|
/*
|
|
**************************************
|
|
deep within the bowels of the
|
|
research facility, you discover the
|
|
passage that the followers of quake
|
|
have used to enter our world.
|
|
the bastards used some type of
|
|
gigantic teleporter to overload
|
|
one of our own slipgates! as long as
|
|
this portal exists, earth will never
|
|
be safe from quake's cruel minions.
|
|
|
|
if you can find the source of the
|
|
portal's power, you can shut it
|
|
down--possibly forever! with only a
|
|
moment's consideration for your own
|
|
safety, you re-enter the dark domain,
|
|
knowing hell would be a better fate
|
|
than experiencing the reign of quake.
|
|
*/
|
|
writestring (msg_all, "deep within the bowels of the\nresearch facility, you discover the\npassage that the followers of quake\nhave used to enter our world.\nthe bastards used some type of\ngigantic teleporter to overload\none of our own slipgates! as long as\nthis portal exists, earth will never\nbe safe from quake's cruel minions." );
|
|
//writestring (msg_all, "if you can find the source of the\nportal's power, you can shut it\ndown--possibly forever! with only a\nmoment's consideration for your own\nsafety, you re-enter the dark domain,\nknowing hell would be a better fate\nthan experiencing the reign of quake." );
|
|
return;
|
|
}
|
|
else if (world.model == "maps/hip2m5.bsp")
|
|
{
|
|
/*
|
|
**************************************
|
|
after destroying the power generator,
|
|
you pass beyond the gate of mortum's
|
|
keep. a wave of nausea suddenly flows
|
|
over you and you find yourself cast
|
|
out into a liquid void. you float
|
|
lifelessly, yet aware, in a lavender
|
|
sea of energy.
|
|
|
|
after what seems like an eternity,
|
|
you feel the presence of a diabolical
|
|
intelligence. you are held helpless
|
|
for a moment as your mind is open to
|
|
that of armagon--quake's general and
|
|
master of this realm. recognizing
|
|
you as the one who foiled his
|
|
attempt to conquer earth, a hellish
|
|
howl fills your mind and blots out
|
|
all consciousness. when you awake,
|
|
you find yourself on the shores of
|
|
reality, but in a time and place
|
|
unknown to you.
|
|
*/
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 6);
|
|
writebyte (msg_all, 3);
|
|
|
|
writebyte (msg_all, svc_finale);
|
|
writestring (msg_all, "after destroying the power generator,\nyou pass beyond the gate of mortum's\nkeep. a wave of nausea suddenly flows\nover you and you find yourself cast\nout into a liquid void. you float\nlifelessly, yet aware, in a lavender\nsea of energy." );
|
|
//writestring (msg_all, "after what seems like an eternity,\nyou feel the presence of a diabolical\nintelligence. you are held helpless\nfor a moment as your mind is open to\nthat of armagon--quake's general and\nmaster of this realm. recognizing\nyou as the one who foiled his\nattempts to conquer earth, a hellish\nhowl fills your mind and blots out\nall consciousness. when you awake,\nyou find yourself on the shores of\nreality, but in a time and place\nunknown to you." );
|
|
return;
|
|
}
|
|
else if (world.model == "maps/hipend.bsp")
|
|
{
|
|
/*
|
|
**************************************
|
|
after the last echoes of armagon's
|
|
death yell fade away, you breathe a
|
|
heavy sigh of relief. with the loss
|
|
of his magic, armagon's fortress
|
|
begins to collapse. the rift he
|
|
created to send his grisly troops
|
|
through time slowly closes and seals
|
|
itself forever. in the chaos that
|
|
ensues, a wall collapses, revealing
|
|
one remaining time portal. with your
|
|
chances to escape rapidly growing
|
|
slim, you race for the portal,
|
|
mindless of your destination. in a
|
|
flash of light, you find yourself
|
|
back at command hq, safe and sound.
|
|
|
|
congratulations! you are victorious!
|
|
the minions of quake have once again
|
|
fallen before your mighty hand.
|
|
is this the last you will see of
|
|
quake's hellions?
|
|
|
|
only time will tell...
|
|
*/
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 2);
|
|
writebyte (msg_all, 3);
|
|
|
|
writebyte (msg_all, svc_finale);
|
|
writestring (msg_all, "after the last echoes of armagon's\ndeath yell fade away, you breathe a\nheavy sigh of relief. with the loss\nof his magic, armagon's fortress\nbegins to collapse. the rift he\ncreated to send his grisly troops\nthrough time slowly closes and seals\nitself forever. in the chaos that\nensues, a wall collapses, revealing\none remaining time portal. with your\nchances to escape rapidly growing\nslim, you race for the portal,\nmindless of your destination. in a\nflash of light, you find yourself\nback at command hq, safe and sound." );
|
|
//writestring (msg_all, "congratulations! you are victorious!\nthe minions of quake have once again\nfallen before your mighty hand.\nis this the last you will see of\nquake's hellions?\n\nonly time will tell..." );
|
|
//intermission_exittime = time + 10000000; // never allow exit
|
|
return;
|
|
}
|
|
gotonextmap();
|
|
}
|
|
|
|
if (intermission_running == 3)
|
|
{
|
|
if (!cvar("registered"))
|
|
{ // shareware episode has been completed, go to sell screen
|
|
writebyte (msg_all, svc_sellscreen);
|
|
return;
|
|
}
|
|
|
|
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.");
|
|
return;
|
|
}
|
|
|
|
//hipnotic
|
|
if (world.model == "maps/hip1m4.bsp")
|
|
{
|
|
writebyte (msg_all, svc_finale);
|
|
writestring (msg_all, "if you can find the source of the\nportal's power, you can shut it\ndown--possibly forever! with only a\nmoment's consideration for your own\nsafety, you re-enter the dark domain,\nknowing hell would be a better fate\nthan experiencing the reign of quake." );
|
|
return;
|
|
}
|
|
else if (world.model == "maps/hip2m5.bsp")
|
|
{
|
|
writebyte (msg_all, svc_finale);
|
|
writestring (msg_all, "after what seems like an eternity,\nyou feel the presence of a diabolical\nintelligence. you are held helpless\nfor a moment as your mind is open to\nthat of armagon--quake's general and\nmaster of this realm. recognizing\nyou as the one who foiled his\nattempt to conquer earth, a hellish\nhowl fills your mind and blots out\nall consciousness. when you awake,\nyou find yourself on the shores of\nreality, but in a time and place\nunknown to you." );
|
|
return;
|
|
}
|
|
else if (world.model == "maps/hipend.bsp")
|
|
{
|
|
writebyte (msg_all, svc_finale);
|
|
writestring (msg_all, "congratulations! you are victorious!\nthe minions of quake have once again\nfallen before your mighty hand.\nis this the last you will see of\nquake's hellions?\n\nonly time will tell..." );
|
|
intermission_exittime = time + 10000000; // never allow exit
|
|
return;
|
|
}
|
|
}
|
|
|
|
gotonextmap();
|
|
};
|
|
|
|
/*
|
|
============
|
|
intermissionthink
|
|
|
|
when the player presses attack or jump, change to the next level
|
|
============
|
|
*/
|
|
void() intermissionthink =
|
|
{
|
|
if (time < intermission_exittime)
|
|
return;
|
|
|
|
if (!self.button0 && !self.button1 && !self.button2)
|
|
return;
|
|
|
|
exitintermission ();
|
|
};
|
|
|
|
void() execute_changelevel =
|
|
{
|
|
local entity pos;
|
|
|
|
intermission_running = 1;
|
|
|
|
// enforce a wait time before allowing changelevel
|
|
if (deathmatch)
|
|
intermission_exittime = time + 5;
|
|
else
|
|
intermission_exittime = time + 2;
|
|
|
|
writebyte (msg_all, svc_cdtrack);
|
|
writebyte (msg_all, 9);
|
|
writebyte (msg_all, 3);
|
|
|
|
pos = findintermission ();
|
|
|
|
other = find (world, classname, "player");
|
|
while (other != world)
|
|
{
|
|
other.view_ofs = '0 0 0';
|
|
other.angles = other.v_angle = pos.mangle;
|
|
other.fixangle = true; // turn this way immediately
|
|
other.nextthink = time + 0.5;
|
|
other.takedamage = damage_no;
|
|
other.solid = solid_not;
|
|
other.movetype = movetype_none;
|
|
other.modelindex = 0;
|
|
setorigin (other, pos.origin);
|
|
other = find (other, classname, "player");
|
|
}
|
|
|
|
writebyte (msg_all, svc_intermission);
|
|
};
|
|
|
|
|
|
void() changelevel_touch =
|
|
{
|
|
local entity pos;
|
|
|
|
if (other.classname != "player")
|
|
return;
|
|
|
|
if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
|
|
{
|
|
t_damage (other, self, self, 50000);
|
|
return;
|
|
}
|
|
|
|
if (coop || deathmatch)
|
|
{
|
|
bprint (other.netname);
|
|
bprint (" exited the level\n");
|
|
}
|
|
|
|
nextmap = self.map;
|
|
|
|
sub_usetargets ();
|
|
|
|
if ( (self.spawnflags & 1) && (deathmatch == 0) )
|
|
{ // no_intermission
|
|
gotonextmap();
|
|
return;
|
|
}
|
|
|
|
self.touch = sub_null;
|
|
|
|
// we can't move people right now, because touch functions are called
|
|
// in the middle of c movement code, so set a think time to do it
|
|
self.think = execute_changelevel;
|
|
self.nextthink = time + 0.1;
|
|
};
|
|
|
|
/*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 =
|
|
{
|
|
if (!self.map)
|
|
objerror ("chagnelevel trigger doesn't have map");
|
|
|
|
inittrigger ();
|
|
self.touch = changelevel_touch;
|
|
};
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
player game edge functions
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
void() set_suicide_frame;
|
|
|
|
// called by clientkill and deadthink
|
|
void() respawn =
|
|
{
|
|
if (coop)
|
|
{
|
|
// make a copy of the dead body for appearances sake
|
|
copytobodyque (self);
|
|
// get the spawn parms as they were at level start
|
|
setspawnparms (self);
|
|
// respawn
|
|
putclientinserver ();
|
|
}
|
|
else if (deathmatch)
|
|
{
|
|
// make a copy of the dead body for appearances sake
|
|
copytobodyque (self);
|
|
// set default spawn parms
|
|
setnewparms ();
|
|
// respawn
|
|
putclientinserver ();
|
|
}
|
|
else
|
|
{ // restart the entire server
|
|
localcmd ("restart\n");
|
|
}
|
|
};
|
|
|
|
|
|
/*
|
|
============
|
|
clientkill
|
|
|
|
player entered the suicide command
|
|
============
|
|
*/
|
|
void() clientkill =
|
|
{
|
|
bprint (self.netname);
|
|
bprint (" suicides\n");
|
|
set_suicide_frame ();
|
|
self.modelindex = modelindex_player;
|
|
self.frags = self.frags - 2; // extra penalty
|
|
respawn ();
|
|
};
|
|
|
|
float(vector v) checkspawnpoint =
|
|
{
|
|
return false;
|
|
};
|
|
|
|
/*
|
|
============
|
|
selectspawnpoint
|
|
|
|
returns the entity to spawn at
|
|
============
|
|
*/
|
|
entity() selectspawnpoint =
|
|
{
|
|
local entity spot;
|
|
local entity thing;
|
|
local float pcount;
|
|
|
|
// testinfo_player_start is only found in regioned levels
|
|
spot = find (world, classname, "testplayerstart");
|
|
if (spot)
|
|
return spot;
|
|
|
|
// choose a info_player_deathmatch point
|
|
if (coop)
|
|
{
|
|
lastspawn = find(lastspawn, classname, "info_player_coop");
|
|
if (lastspawn == world)
|
|
lastspawn = find (lastspawn, classname, "info_player_start");
|
|
if (lastspawn != world)
|
|
return lastspawn;
|
|
}
|
|
else if (deathmatch)
|
|
{
|
|
spot = lastspawn;
|
|
while (1)
|
|
{
|
|
spot = find(spot, classname, "info_player_deathmatch");
|
|
if (spot != world)
|
|
{
|
|
if (spot == lastspawn)
|
|
return lastspawn;
|
|
pcount = 0;
|
|
thing = findradius(spot.origin, 32);
|
|
while(thing)
|
|
{
|
|
if (thing.classname == "player")
|
|
pcount = pcount + 1;
|
|
thing = thing.chain;
|
|
}
|
|
if (pcount == 0)
|
|
{
|
|
lastspawn = spot;
|
|
return spot;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (serverflags)
|
|
{ // return with a rune to start
|
|
spot = find (world, classname, "info_player_start2");
|
|
if (spot)
|
|
return spot;
|
|
}
|
|
|
|
spot = find (world, classname, "info_player_start");
|
|
if (!spot)
|
|
error ("putclientinserver: no info_player_start on level");
|
|
|
|
return spot;
|
|
};
|
|
|
|
/*
|
|
===========
|
|
putclientinserver
|
|
|
|
called each time a player is spawned
|
|
============
|
|
*/
|
|
void() decodelevelparms;
|
|
void() playerdie;
|
|
|
|
|
|
void() putclientinserver =
|
|
{
|
|
local entity spot;
|
|
|
|
spot = selectspawnpoint ();
|
|
|
|
self.classname = "player";
|
|
self.health = 100;
|
|
self.takedamage = damage_aim;
|
|
self.solid = solid_slidebox;
|
|
self.movetype = movetype_walk;
|
|
self.show_hostile = 0;
|
|
self.max_health = 100;
|
|
self.flags = fl_client;
|
|
self.air_finished = time + 12;
|
|
self.dmg = 2; // initial water damage
|
|
self.super_damage_finished = 0;
|
|
self.radsuit_finished = 0;
|
|
self.invisible_finished = 0;
|
|
self.invincible_finished = 0;
|
|
self.effects = 0;
|
|
self.invincible_time = 0;
|
|
//jim
|
|
self.wetsuit_finished = 0;
|
|
//med
|
|
self.empathy_finished = 0;
|
|
//med
|
|
self.items2 = 0;
|
|
self.gravity = 1.0;
|
|
|
|
|
|
decodelevelparms ();
|
|
|
|
w_setcurrentammo ();
|
|
|
|
self.attack_finished = time;
|
|
self.th_pain = player_pain;
|
|
self.th_die = playerdie;
|
|
|
|
self.deadflag = dead_no;
|
|
// paustime is set by teleporters to keep the player from moving a while
|
|
self.pausetime = 0;
|
|
|
|
// spot = selectspawnpoint ();
|
|
|
|
self.origin = spot.origin + '0 0 1';
|
|
self.angles = spot.angles;
|
|
self.fixangle = true; // turn this way immediately
|
|
|
|
//jim
|
|
// clear out velocity so you're not launched into the air
|
|
// when you respawn.
|
|
self.velocity = '0 0 0';
|
|
|
|
// oh, this is a hack!
|
|
setmodel (self, "progs/playham.mdl");
|
|
modelindex_hammer = self.modelindex;
|
|
|
|
setmodel (self, "progs/eyes.mdl");
|
|
modelindex_eyes = self.modelindex;
|
|
|
|
setmodel (self, "progs/player.mdl");
|
|
modelindex_player = self.modelindex;
|
|
|
|
setsize (self, vec_hull_min, vec_hull_max);
|
|
|
|
self.view_ofs = '0 0 22';
|
|
|
|
player_stand1 ();
|
|
|
|
if (deathmatch || coop)
|
|
{
|
|
makevectors(self.angles);
|
|
spawn_tfog (self.origin + v_forward*20);
|
|
}
|
|
|
|
spawn_tdeath (self.origin, self);
|
|
};
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
quaked functions
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
|
|
/*quaked info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
|
|
the normal starting point for a level.
|
|
*/
|
|
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 =
|
|
{
|
|
};
|
|
|
|
|
|
/*
|
|
saved out by quaked in region mode
|
|
*/
|
|
void() testplayerstart =
|
|
{
|
|
};
|
|
|
|
/*quaked info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
|
|
potential spawning position for deathmatch games
|
|
*/
|
|
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 =
|
|
{
|
|
};
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
rules
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
/*
|
|
go to the next level for deathmatch
|
|
only called if a time or frag limit has expired
|
|
*/
|
|
void() nextlevel =
|
|
{
|
|
local entity o;
|
|
|
|
//hipnotic
|
|
//commented out so that timelimit and fraglimit work on start map
|
|
/*
|
|
if (mapname == "start")
|
|
{
|
|
if (!cvar("registered"))
|
|
{
|
|
mapname = "e1m1";
|
|
}
|
|
else if (!(serverflags & 1))
|
|
{
|
|
mapname = "e1m1";
|
|
serverflags = serverflags | 1;
|
|
}
|
|
else if (!(serverflags & 2))
|
|
{
|
|
mapname = "e2m1";
|
|
serverflags = serverflags | 2;
|
|
}
|
|
else if (!(serverflags & 4))
|
|
{
|
|
mapname = "e3m1";
|
|
serverflags = serverflags | 4;
|
|
}
|
|
else if (!(serverflags & 8))
|
|
{
|
|
mapname = "e4m1";
|
|
serverflags = serverflags - 7;
|
|
}
|
|
|
|
o = spawn();
|
|
o.map = mapname;
|
|
}
|
|
else
|
|
{
|
|
*/
|
|
// find a trigger changelevel
|
|
o = find(world, classname, "trigger_changelevel");
|
|
|
|
// go back to start if no trigger_changelevel
|
|
if (!o)
|
|
{
|
|
mapname = "start";
|
|
o = spawn();
|
|
o.map = mapname;
|
|
}
|
|
// }
|
|
|
|
nextmap = o.map;
|
|
gameover = true;
|
|
|
|
if (o.nextthink < time)
|
|
{
|
|
o.think = execute_changelevel;
|
|
o.nextthink = time + 0.1;
|
|
}
|
|
};
|
|
|
|
/*
|
|
============
|
|
checkrules
|
|
|
|
exit deathmatch games upon conditions
|
|
============
|
|
*/
|
|
void() checkrules =
|
|
{
|
|
local float timelimit;
|
|
local float fraglimit;
|
|
|
|
if (gameover) // someone else quit the game already
|
|
return;
|
|
|
|
timelimit = cvar("timelimit") * 60;
|
|
fraglimit = cvar("fraglimit");
|
|
|
|
if (timelimit && time >= timelimit)
|
|
{
|
|
nextlevel ();
|
|
return;
|
|
}
|
|
|
|
if (fraglimit && self.frags >= fraglimit)
|
|
{
|
|
nextlevel ();
|
|
return;
|
|
}
|
|
};
|
|
|
|
//============================================================================
|
|
|
|
void() playerdeaththink =
|
|
{
|
|
local entity old_self;
|
|
local float forward;
|
|
|
|
if ((self.flags & fl_onground))
|
|
{
|
|
forward = vlen (self.velocity);
|
|
forward = forward - 20;
|
|
if (forward <= 0)
|
|
self.velocity = '0 0 0';
|
|
else
|
|
self.velocity = forward * normalize(self.velocity);
|
|
}
|
|
|
|
// wait for all buttons released
|
|
if (self.deadflag == dead_dead)
|
|
{
|
|
if (self.button2 || self.button1 || self.button0)
|
|
return;
|
|
self.deadflag = dead_respawnable;
|
|
return;
|
|
}
|
|
|
|
// wait for any button down
|
|
if (!self.button2 && !self.button1 && !self.button0)
|
|
return;
|
|
|
|
self.button0 = 0;
|
|
self.button1 = 0;
|
|
self.button2 = 0;
|
|
respawn();
|
|
};
|
|
|
|
|
|
void() playerjump =
|
|
{
|
|
local vector start, end;
|
|
|
|
if (self.flags & fl_waterjump)
|
|
return;
|
|
|
|
if (self.waterlevel >= 2)
|
|
{
|
|
if (self.watertype == content_water)
|
|
self.velocity_z = 100;
|
|
else if (self.watertype == content_slime)
|
|
self.velocity_z = 80;
|
|
else
|
|
self.velocity_z = 50;
|
|
|
|
// play swiming sound
|
|
if (self.swim_flag < time)
|
|
{
|
|
self.swim_flag = time + 1;
|
|
if (random() < 0.5)
|
|
sound (self, chan_body, "misc/water1.wav", 1, attn_norm);
|
|
else
|
|
sound (self, chan_body, "misc/water2.wav", 1, attn_norm);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
if (!(self.flags & fl_onground))
|
|
return;
|
|
|
|
if ( !(self.flags & fl_jumpreleased) )
|
|
return; // don't pogo stick
|
|
|
|
self.flags = self.flags - (self.flags & fl_jumpreleased);
|
|
|
|
self.flags = self.flags - fl_onground; // don't stairwalk
|
|
|
|
self.button2 = 0;
|
|
// player jumping sound
|
|
sound (self, chan_body, "player/plyrjmp8.wav", 1, attn_norm);
|
|
self.velocity_z = self.velocity_z + 270;
|
|
};
|
|
|
|
|
|
/*
|
|
===========
|
|
watermove
|
|
|
|
============
|
|
*/
|
|
.float dmgtime;
|
|
|
|
void() watermove =
|
|
{
|
|
//dprint (ftos(self.waterlevel));
|
|
if (self.movetype == movetype_noclip)
|
|
return;
|
|
if (self.health < 0)
|
|
return;
|
|
|
|
if (self.waterlevel != 3)
|
|
{
|
|
if (self.air_finished < time)
|
|
sound (self, chan_voice, "player/gasp2.wav", 1, attn_norm);
|
|
else if (self.air_finished < time + 9)
|
|
sound (self, chan_voice, "player/gasp1.wav", 1, attn_norm);
|
|
self.air_finished = time + 12;
|
|
self.dmg = 2;
|
|
}
|
|
else if (self.air_finished < time)
|
|
{ // drown!
|
|
if (self.pain_finished < time)
|
|
{
|
|
self.dmg = self.dmg + 2;
|
|
if (self.dmg > 15)
|
|
self.dmg = 10;
|
|
t_damage (self, world, world, self.dmg);
|
|
self.pain_finished = time + 1;
|
|
}
|
|
}
|
|
|
|
if (!self.waterlevel)
|
|
{
|
|
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;
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (self.watertype == content_lava)
|
|
{ // do damage
|
|
if (self.dmgtime < time)
|
|
{
|
|
if (self.radsuit_finished > time)
|
|
self.dmgtime = time + 1;
|
|
else
|
|
self.dmgtime = time + 0.2;
|
|
|
|
t_damage (self, world, world, 10*self.waterlevel);
|
|
}
|
|
}
|
|
else if (self.watertype == content_slime)
|
|
{ // do damage
|
|
if (self.dmgtime < time && self.radsuit_finished < time)
|
|
{
|
|
self.dmgtime = time + 1;
|
|
t_damage (self, world, world, 4*self.waterlevel);
|
|
}
|
|
}
|
|
|
|
if ( !(self.flags & fl_inwater) )
|
|
{
|
|
|
|
// player enter water sound
|
|
|
|
if (self.watertype == content_lava)
|
|
sound (self, chan_body, "player/inlava.wav", 1, attn_norm);
|
|
if (self.watertype == content_water)
|
|
sound (self, chan_body, "player/inh2o.wav", 1, attn_norm);
|
|
if (self.watertype == content_slime)
|
|
sound (self, chan_body, "player/slimbrn2.wav", 1, attn_norm);
|
|
|
|
self.flags = self.flags + fl_inwater;
|
|
self.dmgtime = 0;
|
|
}
|
|
|
|
if (! (self.flags & fl_waterjump) )
|
|
self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
|
|
};
|
|
|
|
void() checkwaterjump =
|
|
{
|
|
local vector start, end;
|
|
|
|
// check for a jump-out-of-water
|
|
makevectors (self.angles);
|
|
start = self.origin;
|
|
start_z = start_z + 8;
|
|
v_forward_z = 0;
|
|
normalize(v_forward);
|
|
end = start + v_forward*24;
|
|
traceline (start, end, true, self);
|
|
if (trace_fraction < 1)
|
|
{ // solid at waist
|
|
start_z = start_z + self.maxs_z - 8;
|
|
end = start + v_forward*24;
|
|
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.velocity_z = 225;
|
|
self.flags = self.flags - (self.flags & fl_jumpreleased);
|
|
self.teleport_time = time + 2; // safety net
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
|
|
/*
|
|
================
|
|
playerprethink
|
|
|
|
called every frame before physics are run
|
|
================
|
|
*/
|
|
//med 01/17/97
|
|
void(float num_bubbles) deathbubbles;
|
|
void() playerprethink =
|
|
{
|
|
local float mspeed, aspeed;
|
|
local float r;
|
|
|
|
if (intermission_running)
|
|
{
|
|
earthquake_prethink();
|
|
intermissionthink (); // otherwise a button could be missed between
|
|
return; // the think tics
|
|
}
|
|
|
|
if (self.view_ofs == '0 0 0')
|
|
return; // intermission or finale
|
|
|
|
//jim
|
|
// kill player on edge of oblivion
|
|
if ( ( self.origin_z < -1300 ) && (world.model == "maps/hipdm1.bsp") &&
|
|
( self.health > 0 ) )
|
|
{
|
|
self.deathtype = "falling";
|
|
|
|
if (self.invincible_finished >= time)
|
|
{
|
|
self.invincible_finished = 0;
|
|
self.items = self.items - (self.items & it_invulnerability);
|
|
self.invincible_time = 0;
|
|
self.invincible_finished = 0;
|
|
self.effects = self.effects - (self.effects & ef_dimlight);
|
|
}
|
|
t_damage( self, self, world, self.health + 1000 );
|
|
}
|
|
|
|
//jim
|
|
// if (!deathmatch)
|
|
// {
|
|
earthquake_prethink();
|
|
// }
|
|
|
|
makevectors (self.v_angle); // is this still used
|
|
|
|
checkrules ();
|
|
watermove ();
|
|
|
|
//jim
|
|
//wetsuit
|
|
if (self.wetsuit_finished > time)
|
|
{
|
|
if (self.waterlevel==2)
|
|
{
|
|
self.velocity = self.velocity * 1.25;
|
|
}
|
|
if (self.waterlevel==3)
|
|
{
|
|
self.velocity = self.velocity * 1.5;
|
|
}
|
|
if (self.waterlevel >= 2)
|
|
{
|
|
// play scuba sound
|
|
if (self.swim_flag < time)
|
|
{
|
|
self.swim_flag = time + 7;
|
|
sound (self, chan_body, "misc/wetsuit.wav", 1, attn_norm);
|
|
}
|
|
//med 01/17/97
|
|
else
|
|
{
|
|
if (fabs(self.swim_flag - time - 6)<0.04)
|
|
{
|
|
deathbubbles(1);
|
|
}
|
|
else if (fabs(self.swim_flag - time - 5.5)<0.04)
|
|
{
|
|
deathbubbles(1);
|
|
}
|
|
else if (fabs(self.swim_flag - time - 5)<0.04)
|
|
{
|
|
deathbubbles(1);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if (self.waterlevel == 2)
|
|
checkwaterjump ();
|
|
|
|
if (self.deadflag >= dead_dead)
|
|
{
|
|
playerdeaththink ();
|
|
return;
|
|
}
|
|
|
|
if (self.deadflag == dead_dying)
|
|
return; // dying, so do nothing
|
|
|
|
if (self.button2)
|
|
{
|
|
playerjump ();
|
|
}
|
|
else
|
|
self.flags = self.flags | fl_jumpreleased;
|
|
|
|
// teleporters can force a non-moving pause time
|
|
if (time < self.pausetime)
|
|
self.velocity = '0 0 0';
|
|
|
|
if(time > self.attack_finished && self.currentammo == 0 && self.weapon != it_axe && self.weapon != it_mjolnir)
|
|
{
|
|
self.weapon = w_bestweapon ();
|
|
w_setcurrentammo ();
|
|
}
|
|
};
|
|
|
|
/*
|
|
================
|
|
checkpowerups
|
|
|
|
check for turning off powerups
|
|
================
|
|
*/
|
|
void() checkpowerups =
|
|
{
|
|
if (self.health <= 0)
|
|
return;
|
|
|
|
// invisibility
|
|
if (self.invisible_finished)
|
|
{
|
|
// sound and screen flash when items starts to run out
|
|
if (self.invisible_sound < time)
|
|
{
|
|
sound (self, chan_auto, "items/inv3.wav", 0.5, attn_idle);
|
|
self.invisible_sound = time + ((random() * 3) + 1);
|
|
}
|
|
|
|
|
|
if (self.invisible_finished < time + 3)
|
|
{
|
|
if (self.invisible_time == 1)
|
|
{
|
|
sprint (self, "ring of shadows magic is fading\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/inv2.wav", 1, attn_norm);
|
|
self.invisible_time = time + 1;
|
|
}
|
|
|
|
if (self.invisible_time < time)
|
|
{
|
|
self.invisible_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.invisible_finished < time)
|
|
{ // just stopped
|
|
self.items = self.items - it_invisibility;
|
|
self.invisible_finished = 0;
|
|
self.invisible_time = 0;
|
|
}
|
|
|
|
// use the eyes
|
|
self.frame = 0;
|
|
self.modelindex = modelindex_eyes;
|
|
}
|
|
//med 12/04/96 added mjolnir stuff
|
|
else if (self.weapon == it_mjolnir)
|
|
self.modelindex = modelindex_hammer; // don't use eyes
|
|
else
|
|
self.modelindex = modelindex_player; // don't use eyes
|
|
|
|
// invincibility
|
|
if (self.invincible_finished)
|
|
{
|
|
// sound and screen flash when items starts to run out
|
|
if (self.invincible_finished < time + 3)
|
|
{
|
|
if (self.invincible_time == 1)
|
|
{
|
|
sprint (self, "protection is almost burned out\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/protect2.wav", 1, attn_norm);
|
|
self.invincible_time = time + 1;
|
|
}
|
|
|
|
if (self.invincible_time < time)
|
|
{
|
|
self.invincible_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.invincible_finished < time)
|
|
{ // just stopped
|
|
self.items = self.items - it_invulnerability;
|
|
self.invincible_time = 0;
|
|
self.invincible_finished = 0;
|
|
}
|
|
if (self.invincible_finished > time)
|
|
self.effects = self.effects | ef_dimlight;
|
|
else
|
|
self.effects = self.effects - (self.effects & ef_dimlight);
|
|
}
|
|
|
|
// super damage
|
|
if (self.super_damage_finished)
|
|
{
|
|
|
|
// sound and screen flash when items starts to run out
|
|
|
|
if (self.super_damage_finished < time + 3)
|
|
{
|
|
if (self.super_time == 1)
|
|
{
|
|
sprint (self, "quad damage is wearing off\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/damage2.wav", 1, attn_norm);
|
|
self.super_time = time + 1;
|
|
}
|
|
|
|
if (self.super_time < time)
|
|
{
|
|
self.super_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.super_damage_finished < time)
|
|
{ // just stopped
|
|
self.items = self.items - it_quad;
|
|
self.super_damage_finished = 0;
|
|
self.super_time = 0;
|
|
}
|
|
if (self.super_damage_finished > time)
|
|
self.effects = self.effects | ef_dimlight;
|
|
else
|
|
self.effects = self.effects - (self.effects & ef_dimlight);
|
|
}
|
|
|
|
// suit
|
|
if (self.radsuit_finished)
|
|
{
|
|
self.air_finished = time + 12; // don't drown
|
|
|
|
// sound and screen flash when items starts to run out
|
|
if (self.radsuit_finished < time + 3)
|
|
{
|
|
if (self.rad_time == 1)
|
|
{
|
|
sprint (self, "air supply in biosuit expiring\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/suit2.wav", 1, attn_norm);
|
|
self.rad_time = time + 1;
|
|
}
|
|
|
|
if (self.rad_time < time)
|
|
{
|
|
self.rad_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.radsuit_finished < time)
|
|
{ // just stopped
|
|
self.items = self.items - it_suit;
|
|
self.rad_time = 0;
|
|
self.radsuit_finished = 0;
|
|
}
|
|
}
|
|
|
|
//jim
|
|
// wetsuit
|
|
if (self.wetsuit_finished)
|
|
{
|
|
self.air_finished = time + 12; // don't drown
|
|
|
|
// sound and screen flash when items starts to run out
|
|
if (self.wetsuit_finished < time + 3)
|
|
{
|
|
if (self.wetsuit_time == 1)
|
|
{
|
|
sprint (self, "air supply in wetsuit is running out\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/suit2.wav", 1, attn_norm);
|
|
self.wetsuit_time = time + 1;
|
|
}
|
|
|
|
if (self.wetsuit_time < time)
|
|
{
|
|
self.wetsuit_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.wetsuit_finished < time)
|
|
{ // just stopped
|
|
//med
|
|
self.items2 = self.items2 - hip_it_wetsuit;
|
|
self.wetsuit_time = 0;
|
|
self.wetsuit_finished = 0;
|
|
}
|
|
}
|
|
|
|
//med
|
|
// empathy shields
|
|
if (self.empathy_finished)
|
|
{
|
|
// sound and screen flash when items starts to run out
|
|
if (self.empathy_finished < time + 3)
|
|
{
|
|
if (self.empathy_time == 1)
|
|
{
|
|
sprint (self, "empathy shields are running out\n");
|
|
stuffcmd (self, "bf\n");
|
|
sound (self, chan_auto, "items/suit2.wav", 1, attn_norm);
|
|
self.empathy_time = time + 1;
|
|
}
|
|
|
|
if (self.empathy_time < time)
|
|
{
|
|
self.empathy_time = time + 1;
|
|
stuffcmd (self, "bf\n");
|
|
}
|
|
}
|
|
|
|
if (self.empathy_finished < time)
|
|
{ // just stopped
|
|
//med
|
|
self.items2 = self.items2 - hip_it_empathy_shields;
|
|
self.empathy_time = 0;
|
|
self.empathy_finished = 0;
|
|
}
|
|
//med
|
|
if (self.empathy_finished > time)
|
|
self.effects = self.effects | ef_dimlight;
|
|
else
|
|
self.effects = self.effects - (self.effects & ef_dimlight);
|
|
}
|
|
};
|
|
|
|
|
|
/*
|
|
================
|
|
playerpostthink
|
|
|
|
called every frame after physics are run
|
|
================
|
|
*/
|
|
void() playerpostthink =
|
|
{
|
|
local float mspeed, aspeed;
|
|
local float r;
|
|
|
|
if (self.view_ofs == '0 0 0')
|
|
{
|
|
earthquake_postthink();
|
|
return; // intermission or finale
|
|
}
|
|
|
|
//jim
|
|
//wetsuit
|
|
if (self.wetsuit_finished > time)
|
|
{
|
|
if (self.waterlevel==2)
|
|
{
|
|
self.velocity = self.velocity * 0.8;
|
|
}
|
|
if (self.waterlevel==3)
|
|
{
|
|
self.velocity = self.velocity * 0.66;
|
|
}
|
|
}
|
|
|
|
//jim
|
|
// if (!deathmatch)
|
|
// {
|
|
earthquake_postthink();
|
|
// }
|
|
|
|
if (self.deadflag)
|
|
return;
|
|
|
|
// do weapon stuff
|
|
|
|
w_weaponframe ();
|
|
|
|
// check to see if player landed and play landing sound
|
|
if ((self.jump_flag < -300) && (self.flags & fl_onground) && (self.health > 0))
|
|
{
|
|
if (self.watertype == content_water)
|
|
sound (self, chan_body, "player/h2ojump.wav", 1, attn_norm);
|
|
else if (self.jump_flag < -650)
|
|
{
|
|
t_damage (self, world, world, 5);
|
|
sound (self, chan_voice, "player/land2.wav", 1, attn_norm);
|
|
self.deathtype = "falling";
|
|
}
|
|
else
|
|
sound (self, chan_voice, "player/land.wav", 1, attn_norm);
|
|
|
|
self.jump_flag = 0;
|
|
}
|
|
|
|
if (!(self.flags & fl_onground))
|
|
self.jump_flag = self.velocity_z;
|
|
|
|
checkpowerups ();
|
|
};
|
|
|
|
|
|
/*
|
|
===========
|
|
clientconnect
|
|
|
|
called when a player connects to a server
|
|
============
|
|
*/
|
|
void() clientconnect =
|
|
{
|
|
bprint (self.netname);
|
|
bprint (" entered the game\n");
|
|
|
|
// a client connecting during an intermission can cause problems
|
|
if (intermission_running)
|
|
exitintermission ();
|
|
};
|
|
|
|
|
|
/*
|
|
===========
|
|
clientdisconnect
|
|
|
|
called when a player disconnects from a server
|
|
============
|
|
*/
|
|
void() clientdisconnect =
|
|
{
|
|
if (gameover)
|
|
return;
|
|
// if the level end trigger has been activated, just return
|
|
// since they aren't *really* leaving
|
|
|
|
// let everyone else know
|
|
bprint (self.netname);
|
|
bprint (" left the game with ");
|
|
bprint (ftos(self.frags));
|
|
bprint (" frags\n");
|
|
sound (self, chan_body, "player/tornoff2.wav", 1, attn_none);
|
|
set_suicide_frame ();
|
|
};
|
|
|
|
/*
|
|
===========
|
|
clientobituary
|
|
|
|
called when a player dies
|
|
============
|
|
*/
|
|
void(entity targ, entity attacker) clientobituary =
|
|
{
|
|
local float rnum;
|
|
local string deathstring, deathstring2;
|
|
rnum = random();
|
|
|
|
if (targ.classname == "player")
|
|
{
|
|
if (attacker.classname == "teledeath")
|
|
{
|
|
bprint (targ.netname);
|
|
bprint (" was telefragged by ");
|
|
bprint (attacker.owner.netname);
|
|
bprint ("\n");
|
|
|
|
attacker.owner.frags = attacker.owner.frags + 1;
|
|
return;
|
|
}
|
|
|
|
if (attacker.classname == "teledeath2")
|
|
{
|
|
bprint ("satan's power deflects ");
|
|
bprint (targ.netname);
|
|
bprint ("'s telefrag\n");
|
|
|
|
targ.frags = targ.frags - 1;
|
|
return;
|
|
}
|
|
|
|
if (attacker.classname == "player")
|
|
{
|
|
if (targ == attacker)
|
|
{
|
|
// killed self
|
|
attacker.frags = attacker.frags - 1;
|
|
bprint (targ.netname);
|
|
|
|
if (targ.weapon == 64 && targ.waterlevel > 1)
|
|
{
|
|
bprint (" discharges into the water.\n");
|
|
return;
|
|
}
|
|
if (targ.weapon == it_grenade_launcher)
|
|
bprint (" tries to put the pin back in\n");
|
|
//jim
|
|
else if (rnum > 0.4 )
|
|
bprint (" becomes bored with life\n");
|
|
else
|
|
bprint (" checks if his weapon is loaded\n");
|
|
return;
|
|
}
|
|
else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
|
|
{
|
|
if (rnum < 0.25)
|
|
deathstring = " mows down a teammate\n";
|
|
else if (rnum < 0.50)
|
|
deathstring = " checks his glasses\n";
|
|
else if (rnum < 0.75)
|
|
deathstring = " gets a frag for the other team\n";
|
|
else
|
|
deathstring = " loses another friend\n";
|
|
bprint (attacker.netname);
|
|
bprint (deathstring);
|
|
attacker.frags = attacker.frags - 1;
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
attacker.frags = attacker.frags + 1;
|
|
//med 01/19/97
|
|
if (empathyused == 1)
|
|
{
|
|
bprint (targ.netname);
|
|
if (random()<0.5)
|
|
bprint (" shares ");
|
|
else
|
|
bprint (" feels ");
|
|
bprint (attacker.netname);
|
|
bprint ("'s pain\n");
|
|
return;
|
|
}
|
|
|
|
//med 11/18/96
|
|
if (targ.dmg_inflictor.classname == "proximity_grenade")
|
|
{
|
|
bprint (targ.netname);
|
|
if (random()<0.5)
|
|
bprint (" got too friendly with ");
|
|
else
|
|
bprint (" did the rhumba with ");
|
|
bprint (attacker.netname);
|
|
bprint ("'s bomb\n");
|
|
return;
|
|
}
|
|
rnum = attacker.weapon;
|
|
if (rnum == it_axe)
|
|
{
|
|
deathstring = " was ax-murdered by ";
|
|
deathstring2 = "\n";
|
|
}
|
|
if (rnum == it_shotgun)
|
|
{
|
|
deathstring = " chewed on ";
|
|
deathstring2 = "'s boomstick\n";
|
|
}
|
|
if (rnum == it_super_shotgun)
|
|
{
|
|
deathstring = " ate 2 loads of ";
|
|
deathstring2 = "'s buckshot\n";
|
|
}
|
|
if (rnum == it_nailgun)
|
|
{
|
|
deathstring = " was nailed by ";
|
|
deathstring2 = "\n";
|
|
}
|
|
if (rnum == it_super_nailgun)
|
|
{
|
|
deathstring = " was punctured by ";
|
|
deathstring2 = "\n";
|
|
}
|
|
if (rnum == it_grenade_launcher)
|
|
{
|
|
deathstring = " eats ";
|
|
deathstring2 = "'s pineapple\n";
|
|
if (targ.health < -40)
|
|
{
|
|
deathstring = " was gibbed by ";
|
|
deathstring2 = "'s grenade\n";
|
|
}
|
|
}
|
|
if (rnum == it_rocket_launcher)
|
|
{
|
|
deathstring = " rides ";
|
|
deathstring2 = "'s rocket\n";
|
|
if (targ.health < -40)
|
|
{
|
|
deathstring = " was gibbed by ";
|
|
deathstring2 = "'s rocket\n" ;
|
|
}
|
|
}
|
|
if (rnum == it_lightning)
|
|
{
|
|
deathstring = " accepts ";
|
|
if (attacker.waterlevel > 1)
|
|
deathstring2 = "'s discharge\n";
|
|
else
|
|
deathstring2 = "'s shaft\n";
|
|
}
|
|
//med
|
|
if (rnum == it_laser_cannon)
|
|
{
|
|
if (random()<0.5)
|
|
{
|
|
deathstring = " was toasted by ";
|
|
}
|
|
else
|
|
{
|
|
deathstring = " was radiated by ";
|
|
}
|
|
deathstring2 = "'s laser\n";
|
|
}
|
|
//med
|
|
if (rnum == it_mjolnir)
|
|
{
|
|
deathstring = " was slammed by ";
|
|
deathstring2 = "'s hammer\n";
|
|
}
|
|
bprint (targ.netname);
|
|
bprint (deathstring);
|
|
bprint (attacker.netname);
|
|
bprint (deathstring2);
|
|
}
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
targ.frags = targ.frags - 1; // killed self
|
|
rnum = targ.watertype;
|
|
|
|
bprint (targ.netname);
|
|
|
|
//jim
|
|
if ( attacker.deathtype )
|
|
{
|
|
bprint( " " );
|
|
bprint ( attacker.deathtype );
|
|
bprint( "\n" );
|
|
return;
|
|
}
|
|
|
|
if (rnum == -3)
|
|
{
|
|
if (random() < 0.5)
|
|
bprint (" sleeps with the fishes\n");
|
|
else
|
|
bprint (" sucks it down\n");
|
|
return;
|
|
}
|
|
else if (rnum == -4)
|
|
{
|
|
if (random() < 0.5)
|
|
bprint (" gulped a load of slime\n");
|
|
else
|
|
bprint (" can't exist on slime alone\n");
|
|
return;
|
|
}
|
|
else if (rnum == -5)
|
|
{
|
|
if (targ.health < -15)
|
|
{
|
|
bprint (" burst into flames\n");
|
|
return;
|
|
}
|
|
if (random() < 0.5)
|
|
bprint (" turned into hot slag\n");
|
|
else
|
|
bprint (" visits the volcano god\n");
|
|
return;
|
|
}
|
|
|
|
if (attacker.flags & fl_monster)
|
|
{
|
|
if (attacker.classname == "monster_army")
|
|
bprint (" was shot by a grunt\n");
|
|
if (attacker.classname == "monster_demon1")
|
|
bprint (" was eviscerated by a fiend\n");
|
|
if (attacker.classname == "monster_dog")
|
|
bprint (" was mauled by a rottweiler\n");
|
|
if (attacker.classname == "monster_dragon")
|
|
bprint (" was fried by a dragon\n");
|
|
if (attacker.classname == "monster_enforcer")
|
|
bprint (" was blasted by an enforcer\n");
|
|
if (attacker.classname == "monster_fish")
|
|
bprint (" was fed to the rotfish\n");
|
|
if (attacker.classname == "monster_hell_knight")
|
|
bprint (" was slain by a death knight\n");
|
|
if (attacker.classname == "monster_knight")
|
|
bprint (" was slashed by a knight\n");
|
|
if (attacker.classname == "monster_ogre")
|
|
bprint (" was destroyed by an ogre\n");
|
|
if (attacker.classname == "monster_oldone")
|
|
bprint (" became one with shub-niggurath\n");
|
|
if (attacker.classname == "monster_shalrath")
|
|
bprint (" was exploded by a vore\n");
|
|
if (attacker.classname == "monster_shambler")
|
|
bprint (" was smashed by a shambler\n");
|
|
if (attacker.classname == "monster_tarbaby")
|
|
bprint (" was slimed by a spawn\n");
|
|
if (attacker.classname == "monster_vomit")
|
|
bprint (" was vomited on by a vomitus\n");
|
|
if (attacker.classname == "monster_wizard")
|
|
bprint (" was scragged by a scrag\n");
|
|
if (attacker.classname == "monster_zombie")
|
|
bprint (" joins the zombies\n");
|
|
//med
|
|
if (attacker.classname == "monster_gremlin")
|
|
bprint (" was outsmarted by a gremlin\n");
|
|
//med
|
|
if (attacker.classname == "monster_scourge")
|
|
bprint (" was stung by a centroid\n");
|
|
//med
|
|
if (attacker.classname == "monster_armagon")
|
|
bprint (" was outgunned by armagon\n");
|
|
|
|
return;
|
|
}
|
|
if (attacker.classname == "explo_box")
|
|
{
|
|
bprint (" blew up\n");
|
|
return;
|
|
}
|
|
if (attacker.solid == solid_bsp && attacker != world)
|
|
{
|
|
bprint (" was squished\n");
|
|
return;
|
|
}
|
|
if (targ.deathtype == "falling")
|
|
{
|
|
targ.deathtype = "";
|
|
bprint (" fell to his death\n");
|
|
return;
|
|
}
|
|
if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
|
|
{
|
|
bprint (" was spiked\n");
|
|
return;
|
|
}
|
|
if (attacker.classname == "fireball")
|
|
{
|
|
bprint (" ate a lavaball\n");
|
|
return;
|
|
}
|
|
if (attacker.classname == "trigger_changelevel")
|
|
{
|
|
bprint (" tried to leave\n");
|
|
return;
|
|
}
|
|
|
|
bprint (" died\n");
|
|
}
|
|
}
|
|
};
|