2002-02-15 18:27:57 +00:00
// prototypes
void ( ) W_WeaponFrame ;
2004-02-09 00:03:10 +00:00
void ( ) W_SetCurrentAmmo ;
void ( entity attacker , float damage ) player_pain ;
void ( ) player_stand1 ;
2002-02-15 18:27:57 +00:00
void ( vector org ) spawn_tfog ;
void ( vector org , entity death_owner ) spawn_tdeath ;
float modelindex_eyes , modelindex_player ;
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
LEVEL CHANGING / INTERMISSION
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
float intermission_running ;
float intermission_exittime ;
/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
2004-02-09 00:03:10 +00:00
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 '
2002-02-15 18:27:57 +00:00
*/
void ( ) info_intermission =
{
} ;
void ( ) SetChangeParms =
{
2004-02-09 00:03:10 +00:00
if ( self . health < = 0 ) {
2002-02-15 18:27:57 +00:00
SetNewParms ( ) ;
return ;
}
2004-02-09 00:03:10 +00:00
// remove items
2004-02-08 04:37:28 +00:00
self . items & = ~ ( IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY
| IT_SUIT | IT_QUAD ) ;
2004-02-09 00:03:10 +00:00
// cap super health
2002-02-15 18:27:57 +00:00
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 =
{
2004-02-09 00:03:10 +00:00
if ( serverflags ) {
2002-02-15 18:27:57 +00:00
if ( world . model = = " maps/start.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 =
{
2004-02-09 00:03:10 +00:00
local float cyc ;
local entity spot ;
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
// look for info_intermission first
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " info_intermission " ) ;
2004-02-09 00:03:10 +00:00
if ( spot ) { // pick a random one
cyc = random ( ) * 4 ;
while ( cyc > 1 ) {
2002-02-15 18:27:57 +00:00
spot = find ( spot , classname , " info_intermission " ) ;
if ( ! spot )
spot = find ( spot , classname , " info_intermission " ) ;
2004-02-09 00:03:10 +00:00
cyc - - ;
2002-02-15 18:27:57 +00:00
}
return spot ;
}
2004-02-09 00:03:10 +00:00
// then look for the start position
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " info_player_start " ) ;
if ( spot )
return spot ;
2004-02-09 00:03:10 +00:00
// testinfo_player_start is only found in regioned levels
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " testplayerstart " ) ;
if ( spot )
return spot ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
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 =
{
2004-02-09 00:03:10 +00:00
// skip any text in deathmatch
if ( deathmatch ) {
2002-02-15 18:27:57 +00:00
GotoNextMap ( ) ;
return ;
}
intermission_exittime = time + 1 ;
2004-02-09 00:03:10 +00:00
intermission_running + + ;
// run some text if at the end of an episode
if ( intermission_running = = 2 ) {
if ( world . model = = " maps/e1m7.bsp " ) {
2004-02-09 07:43:28 +00:00
WriteBytes ( MSG_ALL , SVC_CDTRACK , 2.0 , 3.0 ) ;
2004-02-09 00:03:10 +00:00
if ( ! cvar ( " registered " ) ) {
2002-02-15 18:27:57 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
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! " ) ;
2004-02-09 00:03:10 +00:00
} else {
2002-02-15 18:27:57 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
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 ;
2004-02-09 00:03:10 +00:00
} else if ( world . model = = " maps/e2m6.bsp " ) {
2004-02-09 07:43:28 +00:00
WriteBytes ( MSG_ALL , SVC_CDTRACK , 2.0 , 3.0 , SVC_FINALE ) ;
2002-02-15 18:27:57 +00:00
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 ;
2004-02-09 00:03:10 +00:00
} else if ( world . model = = " maps/e3m6.bsp " ) {
2004-02-09 07:43:28 +00:00
WriteBytes ( MSG_ALL , SVC_CDTRACK , 2.0 , 3.0 , SVC_FINALE ) ;
2002-02-15 18:27:57 +00:00
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 ;
2004-02-09 00:03:10 +00:00
} else if ( world . model = = " maps/e4m7.bsp " ) {
2004-02-09 07:43:28 +00:00
WriteBytes ( MSG_ALL , SVC_CDTRACK , 2.0 , 3.0 , SVC_FINALE ) ;
2002-02-15 18:27:57 +00:00
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 ;
}
2004-02-09 00:03:10 +00:00
GotoNextMap ( ) ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
if ( intermission_running = = 3 ) {
if ( ! cvar ( " registered " ) ) { // shareware episode has been completed, go to sell screen
2002-02-15 18:27:57 +00:00
WriteByte ( MSG_ALL , SVC_SELLSCREEN ) ;
return ;
}
2004-02-09 00:03:10 +00:00
if ( ( serverflags & 15 ) = = 15 ) {
2002-02-15 18:27:57 +00:00
WriteByte ( MSG_ALL , SVC_FINALE ) ;
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 ;
}
}
2004-02-09 00:03:10 +00:00
GotoNextMap ( ) ;
2002-02-15 18:27:57 +00:00
} ;
/*
= = = = = = = = = = = =
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 ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
ExitIntermission ( ) ;
} ;
void ( ) execute_changelevel =
{
local entity pos ;
intermission_running = 1 ;
2004-02-09 00:03:10 +00:00
// enforce a wait time before allowing changelevel
2002-02-15 18:27:57 +00:00
if ( deathmatch )
intermission_exittime = time + 5 ;
else
intermission_exittime = time + 2 ;
2004-02-09 07:43:28 +00:00
WriteBytes ( MSG_ALL , SVC_CDTRACK , 3.0 , 3.0 ) ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
pos = FindIntermission ( ) ;
other = find ( world , classname , " player " ) ;
2004-02-09 00:03:10 +00:00
while ( other ! = world ) {
2002-02-15 18:27:57 +00:00
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 " ) ;
2004-02-09 00:03:10 +00:00
}
2002-02-15 18:27:57 +00:00
WriteByte ( MSG_ALL , SVC_INTERMISSION ) ;
} ;
void ( ) changelevel_touch =
{
if ( other . classname ! = " player " )
return ;
2004-02-09 00:03:10 +00:00
if ( ( cvar ( " noexit " ) = = 1 ) | | ( ( cvar ( " noexit " ) = = 2 )
& & ( mapname ! = " start " ) ) ) {
2002-02-15 18:27:57 +00:00
T_Damage ( other , self , self , 50000 ) ;
return ;
}
2004-02-09 00:03:10 +00:00
if ( coop | | deathmatch ) {
2002-02-15 18:27:57 +00:00
bprint ( other . netname ) ;
bprint ( " exited the level \n " ) ;
}
nextmap = self . map ;
SUB_UseTargets ( ) ;
2004-02-09 00:03:10 +00:00
if ( ( self . spawnflags & 1 ) & & ( deathmatch = = 0 ) ) { // NO_INTERMISSION
GotoNextMap ( ) ;
2002-02-15 18:27:57 +00:00
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 =
{
2004-02-09 00:03:10 +00:00
if ( coop ) {
2002-02-15 18:27:57 +00:00
// 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 ( ) ;
2004-02-09 00:03:10 +00:00
} else if ( deathmatch ) {
2002-02-15 18:27:57 +00:00
// make a copy of the dead body for appearances sake
CopyToBodyQue ( self ) ;
// set default spawn parms
SetNewParms ( ) ;
// respawn
PutClientInServer ( ) ;
2004-02-09 00:03:10 +00:00
} else { // restart the entire server
2002-02-15 18:27:57 +00:00
localcmd ( " restart \n " ) ;
}
} ;
/*
= = = = = = = = = = = =
ClientKill
Player entered the suicide command
= = = = = = = = = = = =
*/
void ( ) ClientKill =
{
bprint ( self . netname ) ;
bprint ( " suicides \n " ) ;
set_suicide_frame ( ) ;
self . modelindex = modelindex_player ;
2004-02-09 00:03:10 +00:00
self . frags - = 2 ; // extra penalty
2002-02-15 18:27:57 +00:00
respawn ( ) ;
} ;
float ( vector v ) CheckSpawnPoint =
{
return FALSE ;
} ;
/*
= = = = = = = = = = = =
SelectSpawnPoint
Returns the entity to spawn at
= = = = = = = = = = = =
*/
entity ( ) SelectSpawnPoint =
{
2004-02-09 00:03:10 +00:00
local float pcount ;
local entity spot , thing ;
// testinfo_player_start is only found in regioned levels
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " testplayerstart " ) ;
if ( spot )
return spot ;
2004-02-09 00:03:10 +00:00
// choose a info_player_deathmatch point
if ( coop ) {
2002-02-15 18:27:57 +00:00
lastspawn = find ( lastspawn , classname , " info_player_coop " ) ;
if ( lastspawn = = world )
lastspawn = find ( lastspawn , classname , " info_player_start " ) ;
if ( lastspawn ! = world )
return lastspawn ;
2004-02-09 00:03:10 +00:00
} else if ( deathmatch ) {
2002-02-15 18:27:57 +00:00
spot = lastspawn ;
2004-02-09 00:03:10 +00:00
while ( 1 ) {
2002-02-15 18:27:57 +00:00
spot = find ( spot , classname , " info_player_deathmatch " ) ;
2004-02-09 00:03:10 +00:00
if ( spot ! = world ) {
2002-02-15 18:27:57 +00:00
if ( spot = = lastspawn )
return lastspawn ;
pcount = 0 ;
thing = findradius ( spot . origin , 32 ) ;
2004-02-09 00:03:10 +00:00
while ( thing ) {
2002-02-15 18:27:57 +00:00
if ( thing . classname = = " player " )
2004-02-09 00:03:10 +00:00
pcount + + ;
2002-02-15 18:27:57 +00:00
thing = thing . chain ;
}
2004-02-09 00:03:10 +00:00
if ( pcount = = 0 ) {
2002-02-15 18:27:57 +00:00
lastspawn = spot ;
return spot ;
}
}
}
}
2004-02-09 00:03:10 +00:00
if ( serverflags ) { // return with a rune to start
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " info_player_start2 " ) ;
if ( spot )
return spot ;
}
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
spot = find ( world , classname , " info_player_start " ) ;
if ( ! spot )
error ( " PutClientInServer: no info_player_start on level " ) ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
return spot ;
} ;
/*
= = = = = = = = = = =
PutClientInServer
called each time a player is spawned
= = = = = = = = = = = =
*/
void ( ) DecodeLevelParms ;
void ( ) PlayerDie ;
void ( ) PutClientInServer =
{
2004-02-09 00:03:10 +00:00
local entity spot ;
2002-02-15 18:27:57 +00:00
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 ;
DecodeLevelParms ( ) ;
W_SetCurrentAmmo ( ) ;
self . attack_finished = time ;
self . th_pain = player_pain ;
self . th_die = PlayerDie ;
self . deadflag = DEAD_NO ;
2004-02-09 00:03:10 +00:00
// pausetime is set by teleporters to keep the player from moving a while
2002-02-15 18:27:57 +00:00
self . pausetime = 0 ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
// spot = SelectSpawnPoint ();
self . origin = spot . origin + ' 0 0 1 ' ;
self . angles = spot . angles ;
self . fixangle = TRUE ; // turn this way immediately
2004-02-09 00:03:10 +00:00
// oh, this is a hack!
2002-02-15 18:27:57 +00:00
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 ) ;
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
self . view_ofs = ' 0 0 22 ' ;
player_stand1 ( ) ;
2004-02-09 00:03:10 +00:00
if ( deathmatch | | coop ) {
2002-02-15 18:27:57 +00:00
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 ;
2004-02-09 00:03:10 +00:00
if ( mapname = = " start " ) {
if ( ! cvar ( " registered " ) ) {
2002-02-15 18:27:57 +00:00
mapname = " e1m1 " ;
2004-02-09 00:03:10 +00:00
} else if ( ! ( serverflags & 1 ) ) {
2002-02-15 18:27:57 +00:00
mapname = " e1m1 " ;
2004-02-08 04:37:28 +00:00
serverflags | = 1 ;
2004-02-09 00:03:10 +00:00
} else if ( ! ( serverflags & 2 ) ) {
2002-02-15 18:27:57 +00:00
mapname = " e2m1 " ;
2004-02-08 04:37:28 +00:00
serverflags | = 2 ;
2004-02-09 00:03:10 +00:00
} else if ( ! ( serverflags & 4 ) ) {
2002-02-15 18:27:57 +00:00
mapname = " e3m1 " ;
2004-02-08 04:37:28 +00:00
serverflags | = 4 ;
2004-02-09 00:03:10 +00:00
} else if ( ! ( serverflags & 8 ) ) {
2002-02-15 18:27:57 +00:00
mapname = " e4m1 " ;
2007-04-28 00:39:42 +00:00
serverflags & = ~ 7 ;
2002-02-15 18:27:57 +00:00
}
o = spawn ( ) ;
o . map = mapname ;
2004-02-09 00:03:10 +00:00
} else {
2002-02-15 18:27:57 +00:00
// find a trigger changelevel
o = find ( world , classname , " trigger_changelevel " ) ;
// go back to start if no trigger_changelevel
2004-02-09 00:03:10 +00:00
if ( ! o ) {
2002-02-15 18:27:57 +00:00
mapname = " start " ;
2004-02-09 00:03:10 +00:00
o = spawn ( ) ;
2002-02-15 18:27:57 +00:00
o . map = mapname ;
}
}
nextmap = o . map ;
gameover = TRUE ;
2004-02-09 00:03:10 +00:00
if ( o . nextthink < time ) {
2002-02-15 18:27:57 +00:00
o . think = execute_changelevel ;
o . nextthink = time + 0.1 ;
}
} ;
/*
= = = = = = = = = = = =
CheckRules
Exit deathmatch games upon conditions
= = = = = = = = = = = =
*/
void ( ) CheckRules =
{
2004-02-09 00:03:10 +00:00
local float fraglimit , timelimit ;
2002-02-15 18:27:57 +00:00
if ( gameover ) // someone else quit the game already
return ;
2004-02-09 00:03:10 +00:00
timelimit = cvar ( " timelimit " ) * 60 ;
fraglimit = cvar ( " fraglimit " ) ;
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
if ( timelimit & & time > = timelimit ) {
2002-02-15 18:27:57 +00:00
NextLevel ( ) ;
return ;
}
2004-02-09 00:03:10 +00:00
if ( fraglimit & & self . frags > = fraglimit ) {
2002-02-15 18:27:57 +00:00
NextLevel ( ) ;
return ;
}
} ;
//============================================================================
void ( ) PlayerDeathThink =
{
local float forward ;
2004-02-09 00:03:10 +00:00
if ( ( self . flags & FL_ONGROUND ) ) {
2002-02-15 18:27:57 +00:00
forward = vlen ( self . velocity ) ;
2004-02-09 00:03:10 +00:00
forward - = 20 ;
2002-02-15 18:27:57 +00:00
if ( forward < = 0 )
self . velocity = ' 0 0 0 ' ;
2004-02-09 00:03:10 +00:00
else
self . velocity = forward * normalize ( self . velocity ) ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
// wait for all buttons released
if ( self . deadflag = = DEAD_DEAD ) {
2002-02-15 18:27:57 +00:00
if ( self . button2 | | self . button1 | | self . button0 )
return ;
self . deadflag = DEAD_RESPAWNABLE ;
return ;
}
2004-02-09 00:03:10 +00:00
// wait for any button down
2002-02-15 18:27:57 +00:00
if ( ! self . button2 & & ! self . button1 & & ! self . button0 )
return ;
self . button0 = 0 ;
self . button1 = 0 ;
self . button2 = 0 ;
respawn ( ) ;
} ;
void ( ) PlayerJump =
{
if ( self . flags & FL_WATERJUMP )
return ;
2004-02-09 00:03:10 +00:00
if ( self . waterlevel > = 2 ) {
2002-02-15 18:27:57 +00:00
if ( self . watertype = = CONTENT_WATER )
self . velocity_z = 100 ;
else if ( self . watertype = = CONTENT_SLIME )
self . velocity_z = 80 ;
else
self . velocity_z = 50 ;
2004-02-09 00:03:10 +00:00
// play swiming sound
if ( self . swim_flag < time ) {
2002-02-15 18:27:57 +00:00
self . swim_flag = time + 1 ;
2004-02-09 00:03:10 +00:00
if ( random ( ) < 0.5 )
2002-02-15 18:27:57 +00:00
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 ;
2004-02-08 08:21:07 +00:00
if ( ! ( self . flags & FL_JUMPRELEASED ) )
2002-02-15 18:27:57 +00:00
return ; // don't pogo stick
2004-02-08 04:37:28 +00:00
self . flags & = ~ FL_JUMPRELEASED ;
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
self . flags & = ~ FL_ONGROUND ; // don't stairwalk
2002-02-15 18:27:57 +00:00
self . button2 = 0 ;
2004-02-09 00:03:10 +00:00
// player jumping sound
2002-02-15 18:27:57 +00:00
sound ( self , CHAN_BODY , " player/plyrjmp8.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
self . velocity_z + = 270 ;
2002-02-15 18:27:57 +00:00
} ;
. float dmgtime ;
void ( ) WaterMove =
{
2004-02-09 00:03:10 +00:00
// dprint (ftos (self.waterlevel));
2002-02-15 18:27:57 +00:00
if ( self . movetype = = MOVETYPE_NOCLIP )
return ;
if ( self . health < 0 )
return ;
2004-02-09 00:03:10 +00:00
if ( self . waterlevel ! = 3 ) {
2002-02-15 18:27:57 +00:00
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 ;
2004-02-09 00:03:10 +00:00
} else if ( self . air_finished < time ) { // drown!
if ( self . pain_finished < time ) {
2002-02-15 18:27:57 +00:00
self . dmg = self . dmg + 2 ;
if ( self . dmg > 15 )
self . dmg = 10 ;
T_Damage ( self , world , world , self . dmg ) ;
self . pain_finished = time + 1 ;
}
}
2004-02-09 00:03:10 +00:00
if ( ! self . waterlevel ) {
2004-02-08 04:37:28 +00:00
if ( self . flags & FL_INWATER ) {
2002-02-15 18:27:57 +00:00
// play leave water sound
sound ( self , CHAN_BODY , " misc/outwater.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
self . flags & = ~ FL_INWATER ;
2002-02-15 18:27:57 +00:00
}
return ;
}
2004-02-09 00:03:10 +00:00
if ( self . watertype = = CONTENT_LAVA ) { // do damage
if ( self . dmgtime < time ) {
2002-02-15 18:27:57 +00:00
if ( self . radsuit_finished > time )
self . dmgtime = time + 1 ;
else
self . dmgtime = time + 0.2 ;
2004-02-09 00:03:10 +00:00
T_Damage ( self , world , world , 10 * self . waterlevel ) ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
} else if ( self . watertype = = CONTENT_SLIME ) { // do damage
if ( self . dmgtime < time & & self . radsuit_finished < time ) {
2002-02-15 18:27:57 +00:00
self . dmgtime = time + 1 ;
2004-02-09 00:03:10 +00:00
T_Damage ( self , world , world , 4 * self . waterlevel ) ;
2002-02-15 18:27:57 +00:00
}
}
2004-02-09 00:03:10 +00:00
if ( ! ( self . flags & FL_INWATER ) ) {
// player enter water sound
switch ( self . watertype ) {
case CONTENT_LAVA :
2002-02-15 18:27:57 +00:00
sound ( self , CHAN_BODY , " player/inlava.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
break ;
case CONTENT_WATER :
2002-02-15 18:27:57 +00:00
sound ( self , CHAN_BODY , " player/inh2o.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
break ;
case CONTENT_SLIME :
2002-02-15 18:27:57 +00:00
sound ( self , CHAN_BODY , " player/slimbrn2.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
break ;
default :
break ;
}
self . flags | = FL_INWATER ;
2002-02-15 18:27:57 +00:00
self . dmgtime = 0 ;
}
2004-02-08 04:37:28 +00:00
if ( ! ( self . flags & FL_WATERJUMP ) )
self . velocity - = 0.8 * self . waterlevel * frametime * self . velocity ;
2002-02-15 18:27:57 +00:00
} ;
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 ) ;
2004-02-09 00:03:10 +00:00
end = start + v_forward * 24 ;
2002-02-15 18:27:57 +00:00
traceline ( start , end , TRUE , self ) ;
2004-02-09 00:03:10 +00:00
if ( trace_fraction < 1 ) { // solid at waist
2002-02-15 18:27:57 +00:00
start_z = start_z + self . maxs_z - 8 ;
2004-02-09 00:03:10 +00:00
end = start + v_forward * 24 ;
2002-02-15 18:27:57 +00:00
self . movedir = trace_plane_normal * - 50 ;
traceline ( start , end , TRUE , self ) ;
2004-02-09 00:03:10 +00:00
if ( trace_fraction = = 1 ) { // open at eye level
2004-02-08 04:37:28 +00:00
self . flags | = FL_WATERJUMP ;
2002-02-15 18:27:57 +00:00
self . velocity_z = 225 ;
2004-02-08 04:37:28 +00:00
self . flags & = ~ FL_JUMPRELEASED ;
2002-02-15 18:27:57 +00:00
self . teleport_time = time + 2 ; // safety net
return ;
}
}
} ;
/*
= = = = = = = = = = = = = = = =
PlayerPreThink
Called every frame before physics are run
= = = = = = = = = = = = = = = =
*/
void ( ) PlayerPreThink =
{
2004-02-09 00:03:10 +00:00
if ( intermission_running ) {
2002-02-15 18:27:57 +00:00
IntermissionThink ( ) ; // otherwise a button could be missed between
return ; // the think tics
}
if ( self . view_ofs = = ' 0 0 0 ' )
return ; // intermission or finale
makevectors ( self . v_angle ) ; // is this still used
CheckRules ( ) ;
WaterMove ( ) ;
if ( self . waterlevel = = 2 )
CheckWaterJump ( ) ;
2004-02-09 00:03:10 +00:00
if ( self . deadflag > = DEAD_DEAD ) {
2002-02-15 18:27:57 +00:00
PlayerDeathThink ( ) ;
return ;
}
2004-02-09 00:03:10 +00:00
2002-02-15 18:27:57 +00:00
if ( self . deadflag = = DEAD_DYING )
return ; // dying, so do nothing
2004-02-09 00:03:10 +00:00
if ( self . button2 ) {
2002-02-15 18:27:57 +00:00
PlayerJump ( ) ;
2004-02-09 00:03:10 +00:00
} else
2004-02-08 04:37:28 +00:00
self . flags | = FL_JUMPRELEASED ;
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
// teleporters can force a non-moving pause time
2002-02-15 18:27:57 +00:00
if ( time < self . pausetime )
self . velocity = ' 0 0 0 ' ;
2004-02-08 04:37:28 +00:00
if ( time > self . attack_finished
2004-02-09 00:03:10 +00:00
& & self . currentammo = = 0 & & self . weapon ! = IT_AXE ) {
2002-02-15 18:27:57 +00:00
self . weapon = W_BestWeapon ( ) ;
W_SetCurrentAmmo ( ) ;
}
} ;
/*
= = = = = = = = = = = = = = = =
CheckPowerups
Check for turning off powerups
= = = = = = = = = = = = = = = =
*/
void ( ) CheckPowerups =
{
if ( self . health < = 0 )
return ;
2004-02-09 00:03:10 +00:00
// invisibility
if ( self . invisible_finished ) {
// sound and screen flash when items starts to run out
if ( self . invisible_sound < time ) {
2002-02-15 18:27:57 +00:00
sound ( self , CHAN_AUTO , " items/inv3.wav " , 0.5 , ATTN_IDLE ) ;
self . invisible_sound = time + ( ( random ( ) * 3 ) + 1 ) ;
}
2004-02-09 00:03:10 +00:00
if ( self . invisible_finished < time + 3 ) {
if ( self . invisible_time = = 1 ) {
2002-02-15 18:27:57 +00:00
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 ;
}
2004-02-09 00:03:10 +00:00
if ( self . invisible_time < time ) {
2002-02-15 18:27:57 +00:00
self . invisible_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
2004-02-09 00:03:10 +00:00
if ( self . invisible_finished < time ) { // just stopped
self . items & = ~ IT_INVISIBILITY ;
2002-02-15 18:27:57 +00:00
self . invisible_finished = 0 ;
self . invisible_time = 0 ;
}
// use the eyes
self . frame = 0 ;
self . modelindex = modelindex_eyes ;
2004-02-09 00:03:10 +00:00
} else
2002-02-15 18:27:57 +00:00
self . modelindex = modelindex_player ; // don't use eyes
2004-02-09 00:03:10 +00:00
// 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 ) {
2002-02-15 18:27:57 +00:00
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 ;
}
2004-02-09 00:03:10 +00:00
if ( self . invincible_time < time ) {
2002-02-15 18:27:57 +00:00
self . invincible_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
2004-02-09 00:03:10 +00:00
if ( self . invincible_finished < time ) { // just stopped
self . items & = ~ IT_INVULNERABILITY ;
2002-02-15 18:27:57 +00:00
self . invincible_time = 0 ;
self . invincible_finished = 0 ;
}
if ( self . invincible_finished > time )
2004-02-08 04:37:28 +00:00
self . effects | = EF_DIMLIGHT ;
2002-02-15 18:27:57 +00:00
else
2004-02-08 04:37:28 +00:00
self . effects & = ~ EF_DIMLIGHT ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
// super damage
if ( self . super_damage_finished ) {
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
// sound and screen flash when items starts to run out
if ( self . super_damage_finished < time + 3 ) {
if ( self . super_time = = 1 ) {
2002-02-15 18:27:57 +00:00
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 ;
}
2004-02-09 00:03:10 +00:00
if ( self . super_time < time ) {
2002-02-15 18:27:57 +00:00
self . super_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
2004-02-09 00:03:10 +00:00
if ( self . super_damage_finished < time ) { // just stopped
self . items & = ~ IT_QUAD ;
2002-02-15 18:27:57 +00:00
self . super_damage_finished = 0 ;
self . super_time = 0 ;
}
if ( self . super_damage_finished > time )
2004-02-08 04:37:28 +00:00
self . effects | = EF_DIMLIGHT ;
2002-02-15 18:27:57 +00:00
else
2004-02-08 04:37:28 +00:00
self . effects & = ~ EF_DIMLIGHT ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
// suit
if ( self . radsuit_finished ) {
2002-02-15 18:27:57 +00:00
self . air_finished = time + 12 ; // don't drown
2004-02-09 00:03:10 +00:00
// sound and screen flash when items starts to run out
if ( self . radsuit_finished < time + 3 ) {
if ( self . rad_time = = 1 ) {
2002-02-15 18:27:57 +00:00
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 ;
}
2004-02-09 00:03:10 +00:00
if ( self . rad_time < time ) {
2002-02-15 18:27:57 +00:00
self . rad_time = time + 1 ;
stuffcmd ( self , " bf \n " ) ;
}
}
2004-02-09 00:03:10 +00:00
if ( self . radsuit_finished < time ) { // just stopped
self . items & = ~ IT_SUIT ;
2002-02-15 18:27:57 +00:00
self . rad_time = 0 ;
self . radsuit_finished = 0 ;
}
2004-02-09 00:03:10 +00:00
}
2002-02-15 18:27:57 +00:00
} ;
/*
= = = = = = = = = = = = = = = =
PlayerPostThink
Called every frame after physics are run
= = = = = = = = = = = = = = = =
*/
void ( ) PlayerPostThink =
{
if ( self . view_ofs = = ' 0 0 0 ' )
return ; // intermission or finale
if ( self . deadflag )
return ;
2004-02-09 00:03:10 +00:00
// do weapon stuff
2002-02-15 18:27:57 +00:00
W_WeaponFrame ( ) ;
2004-02-09 00:03:10 +00:00
// check to see if player landed and play landing sound
if ( ( self . jump_flag < - 300 ) & & ( self . flags & FL_ONGROUND )
& & ( self . health > 0 ) ) {
2002-02-15 18:27:57 +00:00
if ( self . watertype = = CONTENT_WATER )
sound ( self , CHAN_BODY , " player/h2ojump.wav " , 1 , ATTN_NORM ) ;
2004-02-09 00:03:10 +00:00
else if ( self . jump_flag < - 650 ) {
2002-02-15 18:27:57 +00:00
T_Damage ( self , world , world , 5 ) ;
sound ( self , CHAN_VOICE , " player/land2.wav " , 1 , ATTN_NORM ) ;
self . deathtype = " falling " ;
2004-02-09 00:03:10 +00:00
} else
2002-02-15 18:27:57 +00:00
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 " ) ;
2004-02-09 00:03:10 +00:00
// a client connecting during an intermission can cause problems
2002-02-15 18:27:57 +00:00
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 =
{
2004-02-09 00:03:10 +00:00
local float rnum ;
local string deathstring , deathstring2 ;
rnum = random ( ) ;
if ( targ . classname = = " player " ) {
if ( attacker . classname = = " teledeath " ) {
2002-02-15 18:27:57 +00:00
bprint ( targ . netname ) ;
bprint ( " was telefragged by " ) ;
bprint ( attacker . owner . netname ) ;
bprint ( " \n " ) ;
2004-02-09 00:03:10 +00:00
attacker . owner . frags + + ;
2002-02-15 18:27:57 +00:00
return ;
}
2004-02-09 00:03:10 +00:00
switch ( attacker . classname ) {
case " teledeath2 " :
2002-02-15 18:27:57 +00:00
bprint ( " Satan's power deflects " ) ;
bprint ( targ . netname ) ;
bprint ( " 's telefrag \n " ) ;
2004-02-09 00:03:10 +00:00
targ . frags - - ;
2002-02-15 18:27:57 +00:00
return ;
2004-02-09 00:03:10 +00:00
case " player " :
if ( targ = = attacker ) {
2002-02-15 18:27:57 +00:00
// killed self
2004-02-09 00:03:10 +00:00
attacker . frags - - ;
2002-02-15 18:27:57 +00:00
bprint ( targ . netname ) ;
2004-02-09 00:03:10 +00:00
if ( targ . weapon = = 64 & & targ . waterlevel > 1 ) {
2002-02-15 18:27:57 +00:00
bprint ( " discharges into the water. \n " ) ;
return ;
}
if ( targ . weapon = = IT_GRENADE_LAUNCHER )
bprint ( " tries to put the pin back in \n " ) ;
else
bprint ( " becomes bored with life \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
} else if ( ( teamplay = = 2 ) & & ( targ . team > 0 )
& & ( targ . team = = attacker . team ) ) {
2002-02-15 18:27:57 +00:00
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 ) ;
2004-02-09 00:03:10 +00:00
attacker . frags - - ;
2002-02-15 18:27:57 +00:00
return ;
2004-02-09 00:03:10 +00:00
} else {
deathstring = deathstring2 = " " ;
attacker . frags + + ;
2002-02-15 18:27:57 +00:00
2004-02-09 00:03:10 +00:00
switch ( attacker . weapon ) {
case IT_AXE :
2002-02-15 18:27:57 +00:00
deathstring = " was ax-murdered by " ;
deathstring2 = " \n " ;
2004-02-09 00:03:10 +00:00
break ;
case IT_SHOTGUN :
2002-02-15 18:27:57 +00:00
deathstring = " chewed on " ;
deathstring2 = " 's boomstick \n " ;
2004-02-09 00:03:10 +00:00
break ;
case IT_SUPER_SHOTGUN :
2002-02-15 18:27:57 +00:00
deathstring = " ate 2 loads of " ;
deathstring2 = " 's buckshot \n " ;
2004-02-09 00:03:10 +00:00
break ;
case IT_NAILGUN :
2002-02-15 18:27:57 +00:00
deathstring = " was nailed by " ;
deathstring2 = " \n " ;
2004-02-09 00:03:10 +00:00
break ;
case IT_SUPER_NAILGUN :
2002-02-15 18:27:57 +00:00
deathstring = " was punctured by " ;
deathstring2 = " \n " ;
2004-02-09 00:03:10 +00:00
break ;
case IT_GRENADE_LAUNCHER :
if ( targ . health < - 40 ) {
2002-02-15 18:27:57 +00:00
deathstring = " was gibbed by " ;
deathstring2 = " 's grenade \n " ;
2004-02-09 00:03:10 +00:00
} else {
deathstring = " eats " ;
deathstring2 = " 's pineapple \n " ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
break ;
case IT_ROCKET_LAUNCHER :
if ( targ . health < - 40 ) {
2002-02-15 18:27:57 +00:00
deathstring = " was gibbed by " ;
deathstring2 = " 's rocket \n " ;
2004-02-09 00:03:10 +00:00
} else {
deathstring = " rides " ;
deathstring2 = " 's rocket \n " ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
break ;
case IT_LIGHTNING :
2002-02-15 18:27:57 +00:00
deathstring = " accepts " ;
if ( attacker . waterlevel > 1 )
deathstring2 = " 's discharge \n " ;
else
deathstring2 = " 's shaft \n " ;
2004-02-09 00:03:10 +00:00
break ;
default :
deathstring = " dies mysteriously from " ;
deathstring2 = " progs bug \n " ;
break ;
2002-02-15 18:27:57 +00:00
}
bprint ( targ . netname ) ;
bprint ( deathstring ) ;
bprint ( attacker . netname ) ;
bprint ( deathstring2 ) ;
2004-02-09 00:03:10 +00:00
return ;
2002-02-15 18:27:57 +00:00
}
2004-02-09 00:03:10 +00:00
default :
targ . frags - - ;
2002-02-15 18:27:57 +00:00
bprint ( targ . netname ) ;
2004-02-09 00:03:10 +00:00
// killed by a monster?
if ( attacker . flags & FL_MONSTER ) {
switch ( attacker . classname ) {
case " monster_army " :
2002-02-15 18:27:57 +00:00
bprint ( " was shot by a Grunt \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_demon1 " :
2002-02-15 18:27:57 +00:00
bprint ( " was eviscerated by a Fiend \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_dog " :
2002-02-15 18:27:57 +00:00
bprint ( " was mauled by a Rottweiler \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_dragon " :
2002-02-15 18:27:57 +00:00
bprint ( " was fried by a Dragon \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_enforcer " :
2002-02-15 18:27:57 +00:00
bprint ( " was blasted by an Enforcer \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_fish " :
2002-02-15 18:27:57 +00:00
bprint ( " was fed to the Rotfish \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_hell_knight " :
2002-02-15 18:27:57 +00:00
bprint ( " was slain by a Death Knight \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_knight " :
2002-02-15 18:27:57 +00:00
bprint ( " was slashed by a Knight \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_ogre " :
2002-02-15 18:27:57 +00:00
bprint ( " was destroyed by an Ogre \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_oldone " :
2002-02-15 18:27:57 +00:00
bprint ( " became one with Shub-Niggurath \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_shalrath " :
2002-02-15 18:27:57 +00:00
bprint ( " was exploded by a Vore \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_shambler " :
2002-02-15 18:27:57 +00:00
bprint ( " was smashed by a Shambler \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_tarbaby " :
2002-02-15 18:27:57 +00:00
bprint ( " was slimed by a Spawn \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_vomit " :
2002-02-15 18:27:57 +00:00
bprint ( " was vomited on by a Vomitus \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_wizard " :
2002-02-15 18:27:57 +00:00
bprint ( " was scragged by a Scrag \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
case " monster_zombie " :
2002-02-15 18:27:57 +00:00
bprint ( " joins the Zombies \n " ) ;
2004-02-09 00:03:10 +00:00
return ;
default :
bprint ( " died to something that does not exist. BUG! \n " ) ;
return ;
}
2002-02-15 18:27:57 +00:00
}
// tricks and traps
2004-02-09 00:03:10 +00:00
if ( attacker . solid = = SOLID_BSP & & attacker ! = world ) {
2002-02-15 18:27:57 +00:00
bprint ( " was squished \n " ) ;
return ;
}
2004-02-09 00:03:10 +00:00
switch ( attacker . classname ) {
case " explo_box " :
bprint ( " blew up \n " ) ;
2002-02-15 18:27:57 +00:00
return ;
2004-02-09 00:03:10 +00:00
case " fireball " :
2002-02-15 18:27:57 +00:00
bprint ( " ate a lavaball \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
case " trap_shooter " :
case " trap_spikeshooter " :
bprint ( " was spiked \n " ) ;
return ;
case " trigger_changelevel " :
2002-02-15 18:27:57 +00:00
bprint ( " tried to leave \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
default :
break ;
2002-02-15 18:27:57 +00:00
}
// in-water deaths
2004-02-09 00:03:10 +00:00
switch ( targ . watertype ) {
case - 3 :
if ( random ( ) < 0.5 )
2002-02-15 18:27:57 +00:00
bprint ( " sleeps with the fishes \n " ) ;
else
bprint ( " sucks it down \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
case - 4 :
if ( random ( ) < 0.5 )
2002-02-15 18:27:57 +00:00
bprint ( " gulped a load of slime \n " ) ;
else
bprint ( " can't exist on slime alone \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
case - 5 :
if ( targ . health < - 15 ) {
2002-02-15 18:27:57 +00:00
bprint ( " burst into flames \n " ) ;
return ;
}
2004-02-09 00:03:10 +00:00
if ( random ( ) < 0.5 )
2002-02-15 18:27:57 +00:00
bprint ( " turned into hot slag \n " ) ;
else
bprint ( " visits the Volcano God \n " ) ;
return ;
2004-02-09 00:03:10 +00:00
default :
break ;
2002-02-15 18:27:57 +00:00
}
// fell to their death?
2004-02-09 00:03:10 +00:00
if ( targ . deathtype = = " falling " ) {
2002-02-15 18:27:57 +00:00
targ . deathtype = " " ;
bprint ( " fell to his death \n " ) ;
return ;
}
// hell if I know; he's just dead!!!
bprint ( " died \n " ) ;
2004-02-09 00:03:10 +00:00
break ;
2002-02-15 18:27:57 +00:00
}
}
} ;