More codestyle cleanups.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-04 23:15:54 +00:00
parent 53ec603bd0
commit 1858565c2c
14 changed files with 1233 additions and 957 deletions

View file

@ -1,9 +1,23 @@
// button and multiple button // button and multiple button
void() button_wait; void ()
void() button_return; button_done =
{
self.state = STATE_BOTTOM;
};
void() button_wait = void ()
button_return =
{
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, button_done);
self.frame = 0; // use normal textures
if (self.health)
self.takedamage = DAMAGE_YES; // can be shot again
};
void ()
button_wait =
{ {
self.state = STATE_TOP; self.state = STATE_TOP;
self.nextthink = self.ltime + self.wait; self.nextthink = self.ltime + self.wait;
@ -13,25 +27,14 @@ void() button_wait =
self.frame = 1; // use alternate textures self.frame = 1; // use alternate textures
}; };
void() button_done = void ()
button_blocked =
{ {
self.state = STATE_BOTTOM; // do nothing, don't come all the way back out
}; };
void() button_return = void ()
{ button_fire =
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, button_done);
self.frame = 0; // use normal textures
if (self.health)
self.takedamage = DAMAGE_YES; // can be shot again
};
void() button_blocked =
{ // do nothing, just don't come all the way back out
};
void() button_fire =
{ {
if (self.state == STATE_UP || self.state == STATE_TOP) if (self.state == STATE_UP || self.state == STATE_TOP)
return; return;
@ -42,13 +45,15 @@ void() button_fire =
SUB_CalcMove (self.pos2, self.speed, button_wait); SUB_CalcMove (self.pos2, self.speed, button_wait);
}; };
void() button_use = void ()
button_use =
{ {
self.enemy = activator; self.enemy = activator;
button_fire (); button_fire ();
}; };
void() button_touch = void ()
button_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -56,7 +61,8 @@ void() button_touch =
button_fire (); button_fire ();
}; };
void() button_killed = void ()
button_killed =
{ {
self.enemy = damage_attacker; self.enemy = damage_attacker;
self.health = self.max_health; self.health = self.max_health;
@ -79,7 +85,8 @@ When a button is touched, it moves some distance in the direction of it's angle,
2) metallic click 2) metallic click
3) in-out 3) in-out
*/ */
void() func_button = void ()
func_button =
{ {
switch (self.sounds) { switch (self.sounds) {
case 0: case 0:
@ -127,6 +134,6 @@ void() func_button =
self.state = STATE_BOTTOM; self.state = STATE_BOTTOM;
self.pos1 = self.origin; self.pos1 = self.origin;
self.pos2 = self.pos2 + self.movedir * (fabs (self.movedir * self.size) self.pos2 = self.pos1 + self.movedir * (fabs (self.movedir * self.size)
- self.lip); - self.lip);
}; };

View file

@ -1,11 +1,3 @@
// prototypes
void() W_WeaponFrame;
void() W_SetCurrentAmmo;
void(entity attacker, float damage) player_pain;
void() player_stand1;
void(vector org) spawn_tfog;
void(vector org, entity death_owner) spawn_tdeath;
float modelindex_eyes, modelindex_player; float modelindex_eyes, modelindex_player;
// LEVEL CHANGING / INTERMISSION ============================================== // LEVEL CHANGING / INTERMISSION ==============================================
@ -19,12 +11,14 @@ float intermission_exittime;
This is the camera point for the intermission. 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' 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 self.angles = self.mangle; // so C can get at it
}; };
void() SetChangeParms = void ()
SetChangeParms =
{ {
if (self.health <= 0) { if (self.health <= 0) {
SetNewParms (); SetNewParms ();
@ -54,7 +48,8 @@ void() SetChangeParms =
parm9 = self.armortype * 100; parm9 = self.armortype * 100;
}; };
void() SetNewParms = void ()
SetNewParms =
{ {
parm1 = IT_SHOTGUN | IT_AXE; parm1 = IT_SHOTGUN | IT_AXE;
parm2 = 100; parm2 = 100;
@ -67,7 +62,8 @@ void() SetNewParms =
parm9 = 0; parm9 = 0;
}; };
void() DecodeLevelParms = void ()
DecodeLevelParms =
{ {
if (serverflags) { if (serverflags) {
if (world.model == "maps/start.bsp") if (world.model == "maps/start.bsp")
@ -92,7 +88,8 @@ FindIntermission
Returns the entity to view from Returns the entity to view from
============ ============
*/ */
entity() FindIntermission = entity ()
FindIntermission =
{ {
local entity spot; local entity spot;
local float cyc; local float cyc;
@ -118,12 +115,12 @@ entity() FindIntermission =
objerror ("FindIntermission: no spot"); objerror ("FindIntermission: no spot");
}; };
void() GotoNextMap = void ()
GotoNextMap =
{ {
local string newmap; local string newmap;
// ZOID: 12-13-96, samelevel is overloaded, only 1 works for same level // ZOID: 12-13-96, samelevel is overloaded, only 1 works for same level
if (cvar ("samelevel") == 1) // if samelevel is set, stay on same level if (cvar ("samelevel") == 1) // if samelevel is set, stay on same level
changelevel (mapname); changelevel (mapname);
else { else {
@ -144,7 +141,8 @@ IntermissionThink
When the player presses attack or jump, change to the next level When the player presses attack or jump, change to the next level
============ ============
*/ */
void() IntermissionThink = void ()
IntermissionThink =
{ {
if (time < intermission_exittime) if (time < intermission_exittime)
return; return;
@ -162,7 +160,8 @@ The global "nextmap" has been set previously.
Take the players to the intermission spot Take the players to the intermission spot
============ ============
*/ */
void() execute_changelevel = void ()
execute_changelevel =
{ {
local entity pos; local entity pos;
@ -188,14 +187,13 @@ void() execute_changelevel =
} }
}; };
void() changelevel_touch = void ()
changelevel_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
// if "noexit" is set, blow up the player trying to leave
// ZOID, 12-13-96, noexit isn't supported in QW. Overload samelevel // ZOID, 12-13-96, noexit isn't supported in QW. Overload samelevel
// if ((cvar ("noexit") == 1) || ((cvar ("noexit") == 2) && (mapname != "start")))
if ((cvar ("samelevel") == 2) || ((cvar ("samelevel") == 3) if ((cvar ("samelevel") == 2) || ((cvar ("samelevel") == 3)
&& (mapname != "start"))) { && (mapname != "start"))) {
T_Damage (other, self, self, 50000); T_Damage (other, self, self, 50000);
@ -220,7 +218,8 @@ void() changelevel_touch =
/*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION /*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. 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) if (!self.map)
objerror ("chagnelevel trigger doesn't have map"); objerror ("chagnelevel trigger doesn't have map");
@ -234,7 +233,8 @@ void() trigger_changelevel =
void () set_suicide_frame; void () set_suicide_frame;
// called by ClientKill and DeadThink // called by ClientKill and DeadThink
void() respawn = void ()
respawn =
{ {
// make a copy of the dead body for appearances sake // make a copy of the dead body for appearances sake
CopyToBodyQueue (self); CopyToBodyQueue (self);
@ -262,7 +262,8 @@ void() ClientKill =
respawn (); respawn ();
}; };
float(vector v) CheckSpawnPoint = float (vector v)
CheckSpawnPoint =
{ {
return FALSE; return FALSE;
}; };
@ -274,7 +275,8 @@ SelectSpawnPoint
Returns the entity to spawn at Returns the entity to spawn at
============ ============
*/ */
entity() SelectSpawnPoint = entity ()
SelectSpawnPoint =
{ {
local entity spot, spots, thing; local entity spot, spots, thing;
local float pcount, numspots, totalspots; local float pcount, numspots, totalspots;
@ -338,10 +340,8 @@ entity() SelectSpawnPoint =
return spot; return spot;
}; };
void() DecodeLevelParms; float (entity e)
void() PlayerDie; ValidateUser =
float(entity e) ValidateUser =
{ {
/* /*
local string userclan, s; local string userclan, s;
@ -382,6 +382,14 @@ float(entity e) ValidateUser =
*/ */
}; };
void () DecodeLevelParms;
void () PlayerDie;
void () W_SetCurrentAmmo;
void () player_stand1;
void (entity attacker, float damage) player_pain;
void (vector org, entity death_owner) spawn_tdeath;
void (vector org) spawn_tfog;
/* /*
=========== ===========
PutClientInServer PutClientInServer
@ -389,7 +397,8 @@ PutClientInServer
called each time a player enters a new level called each time a player enters a new level
============ ============
*/ */
void() PutClientInServer = void ()
PutClientInServer =
{ {
local entity spot; local entity spot;
@ -465,10 +474,10 @@ void() PutClientInServer =
IT_ROCKET_LAUNCHER | IT_LIGHTNING); IT_ROCKET_LAUNCHER | IT_LIGHTNING);
} }
self.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3); self.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
self.items |= (IT_ARMOR3 | IT_INVULNERABILITY);
self.armorvalue = 200; self.armorvalue = 200;
self.armortype = 0.8; self.armortype = 0.8;
self.health = 250; self.health = 250;
self.items |= (IT_ARMOR3 | IT_INVULNERABILITY);
self.invincible_time = 1; self.invincible_time = 1;
self.invincible_finished = time + 3; self.invincible_finished = time + 3;
} }
@ -495,37 +504,40 @@ void() PutClientInServer =
/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24) /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
The normal starting point for a level. 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) /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
Only used on start map for the return point from an episode. Only used on start map for the return point from an episode.
*/ */
void() info_player_start2 = void ()
info_player_start2 =
{ {
}; };
/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24) /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
potential spawning position for deathmatch games 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) /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
potential spawning position for coop games potential spawning position for coop games
*/ */
void() info_player_coop = void ()
info_player_coop =
{ {
}; };
// RULES ====================================================================== // RULES ======================================================================
/* // go to the next level for deathmatch
go to the next level for deathmatch void ()
*/ NextLevel =
void() NextLevel =
{ {
local entity o; local entity o;
@ -576,7 +588,8 @@ CheckRules
Exit deathmatch games upon conditions Exit deathmatch games upon conditions
============ ============
*/ */
void() CheckRules = void ()
CheckRules =
{ {
if (timelimit && time >= timelimit) if (timelimit && time >= timelimit)
NextLevel (); NextLevel ();
@ -586,7 +599,8 @@ void() CheckRules =
//============================================================================ //============================================================================
void() PlayerDeathThink = void ()
PlayerDeathThink =
{ {
local float forward; local float forward;
@ -616,7 +630,8 @@ void() PlayerDeathThink =
respawn (); respawn ();
}; };
void() PlayerJump = void ()
PlayerJump =
{ {
if (self.flags & FL_WATERJUMP) if (self.flags & FL_WATERJUMP)
return; return;
@ -647,7 +662,8 @@ void() PlayerJump =
.float dmgtime; .float dmgtime;
void() WaterMove = void ()
WaterMove =
{ {
// dprint (ftos (self.waterlevel)); // dprint (ftos (self.waterlevel));
if (self.movetype == MOVETYPE_NOCLIP) if (self.movetype == MOVETYPE_NOCLIP)
@ -718,7 +734,8 @@ void() WaterMove =
} }
}; };
void() CheckWaterJump = void ()
CheckWaterJump =
{ {
local vector start, end; local vector start, end;
@ -752,7 +769,8 @@ PlayerPreThink
Called every frame before physics are run Called every frame before physics are run
================ ================
*/ */
void() PlayerPreThink = void ()
PlayerPreThink =
{ {
if (intermission_running) { if (intermission_running) {
IntermissionThink (); // otherwise a button could be missed between IntermissionThink (); // otherwise a button could be missed between
@ -804,7 +822,8 @@ CheckPowerups
Check for turning off powerups Check for turning off powerups
================ ================
*/ */
void() CheckPowerups = void ()
CheckPowerups =
{ {
if (self.health <= 0) if (self.health <= 0)
return; return;
@ -938,6 +957,8 @@ void() CheckPowerups =
} }
}; };
void () W_WeaponFrame;
/* /*
================ ================
PlayerPostThink PlayerPostThink
@ -945,7 +966,8 @@ PlayerPostThink
Called every frame after physics are run Called every frame after physics are run
================ ================
*/ */
void() PlayerPostThink = void ()
PlayerPostThink =
{ {
// dprint ("post think\n"); // dprint ("post think\n");
if (self.view_ofs == '0 0 0') if (self.view_ofs == '0 0 0')
@ -979,7 +1001,8 @@ ClientConnect
called when a player connects to a server called when a player connects to a server
============ ============
*/ */
void() ClientConnect = void ()
ClientConnect =
{ {
bprint (PRINT_HIGH, self.netname); bprint (PRINT_HIGH, self.netname);
bprint (PRINT_HIGH, " entered the game\n"); bprint (PRINT_HIGH, " entered the game\n");
@ -996,7 +1019,8 @@ ClientDisconnect
called when a player disconnects from a server called when a player disconnects from a server
============ ============
*/ */
void() ClientDisconnect = void ()
ClientDisconnect =
{ {
// let everyone else know // let everyone else know
bprint (PRINT_HIGH, self.netname); bprint (PRINT_HIGH, self.netname);
@ -1014,7 +1038,8 @@ ClientObituary
called when a player dies called when a player dies
============ ============
*/ */
void(entity targ, entity attacker) ClientObituary = void (entity targ, entity attacker)
ClientObituary =
{ {
local float rnum; local float rnum;
local string deathstring, deathstring2, attackerteam, targteam; local string deathstring, deathstring2, attackerteam, targteam;
@ -1034,7 +1059,8 @@ void(entity targ, entity attacker) ClientObituary =
} }
} }
if (attacker.classname == "teledeath") { switch (attacker.classname) {
case "teledeath":
bprint (PRINT_MEDIUM,targ.netname); bprint (PRINT_MEDIUM,targ.netname);
bprint (PRINT_MEDIUM," was telefragged by "); bprint (PRINT_MEDIUM," was telefragged by ");
bprint (PRINT_MEDIUM,attacker.owner.netname); bprint (PRINT_MEDIUM,attacker.owner.netname);
@ -1043,9 +1069,7 @@ void(entity targ, entity attacker) ClientObituary =
attacker.owner.frags = attacker.owner.frags + 1; attacker.owner.frags = attacker.owner.frags + 1;
return; return;
} case "teledeath2":
if (attacker.classname == "teledeath2") {
bprint (PRINT_MEDIUM,"Satan's power deflects "); bprint (PRINT_MEDIUM,"Satan's power deflects ");
bprint (PRINT_MEDIUM,targ.netname); bprint (PRINT_MEDIUM,targ.netname);
bprint (PRINT_MEDIUM,"'s telefrag\n"); bprint (PRINT_MEDIUM,"'s telefrag\n");
@ -1053,10 +1077,8 @@ void(entity targ, entity attacker) ClientObituary =
targ.frags = targ.frags - 1; targ.frags = targ.frags - 1;
logfrag (targ, targ); logfrag (targ, targ);
return; return;
} case "teledeath3":
// double 666 telefrag (can happen often in deathmatch 4) // double 666 telefrag (can happen often in deathmatch 4)
if (attacker.classname == "teledeath3") {
bprint (PRINT_MEDIUM,targ.netname); bprint (PRINT_MEDIUM,targ.netname);
bprint (PRINT_MEDIUM," was telefragged by "); bprint (PRINT_MEDIUM," was telefragged by ");
bprint (PRINT_MEDIUM,attacker.owner.netname); bprint (PRINT_MEDIUM,attacker.owner.netname);
@ -1067,7 +1089,8 @@ void(entity targ, entity attacker) ClientObituary =
} }
if (targ.deathtype == "squish") { if (targ.deathtype == "squish") {
if (teamplay && targteam == attackerteam && attackerteam != "" && targ != attacker) { if (teamplay && targteam == attackerteam && attackerteam != ""
&& targ != attacker) {
logfrag (attacker, attacker); logfrag (attacker, attacker);
attacker.frags = attacker.frags - 1; attacker.frags = attacker.frags - 1;
bprint (PRINT_MEDIUM,attacker.netname); bprint (PRINT_MEDIUM,attacker.netname);
@ -1082,8 +1105,8 @@ void(entity targ, entity attacker) ClientObituary =
attacker.frags = attacker.frags + 1; attacker.frags = attacker.frags + 1;
return; return;
} else { } else {
targ.frags--; // killed self
logfrag (targ, targ); logfrag (targ, targ);
targ.frags = targ.frags - 1; // killed self
bprint (PRINT_MEDIUM,targ.netname); bprint (PRINT_MEDIUM,targ.netname);
bprint (PRINT_MEDIUM," was squished\n"); bprint (PRINT_MEDIUM," was squished\n");
return; return;
@ -1092,21 +1115,25 @@ void(entity targ, entity attacker) ClientObituary =
if (attacker.classname == "player") { if (attacker.classname == "player") {
if (targ == attacker) { if (targ == attacker) {
// killed self attacker.frags--; // killed self
logfrag (attacker, attacker); logfrag (attacker, attacker);
attacker.frags = attacker.frags - 1;
bprint (PRINT_MEDIUM,targ.netname); bprint (PRINT_MEDIUM,targ.netname);
if (targ.deathtype == "grenade") if (targ.deathtype == "grenade")
bprint (PRINT_MEDIUM," tries to put the pin back in\n"); bprint (PRINT_MEDIUM," tries to put the pin back in\n");
else if (targ.deathtype == "rocket") else if (targ.deathtype == "rocket")
bprint (PRINT_MEDIUM," becomes bored with life\n"); bprint (PRINT_MEDIUM," becomes bored with life\n");
else if (targ.weapon == 64 && targ.waterlevel > 1) { else if (targ.weapon == 64 && targ.waterlevel > 1) {
if (targ.watertype == CONTENT_SLIME) switch (targ.watertype) {
case CONTENT_SLIME:
bprint (PRINT_MEDIUM," discharges into the slime\n"); bprint (PRINT_MEDIUM," discharges into the slime\n");
else if (targ.watertype == CONTENT_LAVA) break;
case CONTENT_LAVA:
bprint (PRINT_MEDIUM," discharges into the lava\n"); bprint (PRINT_MEDIUM," discharges into the lava\n");
else break;
default:
bprint (PRINT_MEDIUM," discharges into the water.\n"); bprint (PRINT_MEDIUM," discharges into the water.\n");
break;
}
} else } else
bprint (PRINT_MEDIUM," becomes bored with life\n"); bprint (PRINT_MEDIUM," becomes bored with life\n");
return; return;
@ -1122,31 +1149,34 @@ void(entity targ, entity attacker) ClientObituary =
deathstring = " loses another friend\n"; deathstring = " loses another friend\n";
bprint (PRINT_MEDIUM, attacker.netname); bprint (PRINT_MEDIUM, attacker.netname);
bprint (PRINT_MEDIUM, deathstring); bprint (PRINT_MEDIUM, deathstring);
attacker.frags = attacker.frags - 1; attacker.frags--;
//ZOID 12-13-96: killing a teammate logs as suicide //ZOID 12-13-96: killing a teammate logs as suicide
logfrag (attacker, attacker); logfrag (attacker, attacker);
return; return;
} else { } else {
attacker.frags++;
logfrag (attacker, targ); logfrag (attacker, targ);
attacker.frags = attacker.frags + 1;
rnum = attacker.weapon;
deathstring = deathstring2 = "'s quad rocket\n"; deathstring = deathstring2 = "'s quad rocket\n";
if (targ.deathtype == "nail") { switch (targ.deathtype) {
case "nail":
deathstring = " was nailed by "; deathstring = " was nailed by ";
deathstring2 = "\n"; deathstring2 = "\n";
} else if (targ.deathtype == "supernail") { break;
case "supernail":
deathstring = " was punctured by "; deathstring = " was punctured by ";
deathstring2 = "\n"; deathstring2 = "\n";
} else if (targ.deathtype == "grenade") { break;
case "grenade":
deathstring = " eats "; deathstring = " eats ";
deathstring2 = "'s pineapple\n"; deathstring2 = "'s pineapple\n";
if (targ.health < -40) { if (targ.health < -40) {
deathstring = " was gibbed by "; deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n"; deathstring2 = "'s grenade\n";
} }
} else if (targ.deathtype == "rocket") { break;
case "rocket":
if (attacker.super_damage_finished > 0 && targ.health if (attacker.super_damage_finished > 0 && targ.health
< -40) { < -40) {
rnum = random (); rnum = random ();
@ -1169,24 +1199,33 @@ void(entity targ, entity attacker) ClientObituary =
deathstring2 = "'s rocket\n" ; deathstring2 = "'s rocket\n" ;
} }
} }
} else if (rnum == IT_AXE) { break;
default:
switch (attacker.weapon) {
case IT_AXE:
deathstring = " was ax-murdered by "; deathstring = " was ax-murdered by ";
deathstring2 = "\n"; deathstring2 = "\n";
} else if (rnum == IT_SHOTGUN) { break;
case IT_SHOTGUN:
deathstring = " chewed on "; deathstring = " chewed on ";
deathstring2 = "'s boomstick\n"; deathstring2 = "'s boomstick\n";
} else if (rnum == IT_SUPER_SHOTGUN) { break;
case IT_SUPER_SHOTGUN:
deathstring = " ate 2 loads of "; deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n"; deathstring2 = "'s buckshot\n";
} else if (rnum == IT_LIGHTNING) { break;
case IT_LIGHTNING:
deathstring = " accepts "; deathstring = " accepts ";
if (attacker.waterlevel > 1) if (attacker.waterlevel > 1)
deathstring2 = "'s discharge\n"; deathstring2 = "'s discharge\n";
else else
deathstring2 = "'s shaft\n"; deathstring2 = "'s shaft\n";
} else { break;
default:
deathstring = " dies mysteriously "; deathstring = " dies mysteriously ";
deathstring2 = " progs bug\n"; deathstring2 = " progs bug\n";
break;
}
} }
bprint (PRINT_MEDIUM, targ.netname); bprint (PRINT_MEDIUM, targ.netname);
bprint (PRINT_MEDIUM, deathstring); bprint (PRINT_MEDIUM, deathstring);
@ -1197,22 +1236,22 @@ void(entity targ, entity attacker) ClientObituary =
} else { } else {
logfrag (targ, targ); logfrag (targ, targ);
targ.frags = targ.frags - 1; // killed self targ.frags = targ.frags - 1; // killed self
rnum = targ.watertype;
bprint (PRINT_MEDIUM, targ.netname); bprint (PRINT_MEDIUM, targ.netname);
if (rnum == -3) { switch (targ.watertype) {
case -3:
if (random () < 0.5) if (random () < 0.5)
bprint (PRINT_MEDIUM, " sleeps with the fishes\n"); bprint (PRINT_MEDIUM, " sleeps with the fishes\n");
else else
bprint (PRINT_MEDIUM, " sucks it down\n"); bprint (PRINT_MEDIUM, " sucks it down\n");
return; return;
} else if (rnum == -4) { case -4:
if (random () < 0.5) if (random () < 0.5)
bprint (PRINT_MEDIUM, " gulped a load of slime\n"); bprint (PRINT_MEDIUM, " gulped a load of slime\n");
else else
bprint (PRINT_MEDIUM, " can't exist on slime alone\n"); bprint (PRINT_MEDIUM, " can't exist on slime alone\n");
return; return;
} else if (rnum == -5) { case -5:
if (targ.health < -15) { if (targ.health < -15) {
bprint (PRINT_MEDIUM, " burst into flames\n"); bprint (PRINT_MEDIUM, " burst into flames\n");
return; return;
@ -1222,31 +1261,34 @@ void(entity targ, entity attacker) ClientObituary =
else else
bprint (PRINT_MEDIUM, " visits the Volcano God\n"); bprint (PRINT_MEDIUM, " visits the Volcano God\n");
return; return;
default:
break;
} }
if (attacker.classname == "explo_box") { if (attacker.classname == "explo_box") {
bprint (PRINT_MEDIUM, " blew up\n"); bprint (PRINT_MEDIUM, " blew up\n");
return; return;
} }
if (targ.deathtype == "falling") {
switch (targ.deathtype) {
case "falling":
bprint (PRINT_MEDIUM, " fell to his death\n"); bprint (PRINT_MEDIUM, " fell to his death\n");
return; return;
} case "nail":
if (targ.deathtype == "nail" || targ.deathtype == "supernail") { case "supernail":
bprint (PRINT_MEDIUM, " was spiked\n"); bprint (PRINT_MEDIUM, " was spiked\n");
return; return;
} case "laser":
if (targ.deathtype == "laser") {
bprint (PRINT_MEDIUM, " was zapped\n"); bprint (PRINT_MEDIUM, " was zapped\n");
return; return;
} case "fireball":
if (attacker.classname == "fireball") {
bprint (PRINT_MEDIUM, " ate a lavaball\n"); bprint (PRINT_MEDIUM, " ate a lavaball\n");
return; return;
} case "trigger_changelevel":
if (attacker.classname == "trigger_changelevel") {
bprint (PRINT_MEDIUM, " tried to leave\n"); bprint (PRINT_MEDIUM, " tried to leave\n");
return; return;
default:
break;
} }
bprint (PRINT_MEDIUM, " died\n"); bprint (PRINT_MEDIUM, " died\n");

View file

@ -1,9 +1,3 @@
void() T_MissileTouch;
void() info_player_start;
void(entity targ, entity attacker) ClientObituary;
void(entity inflictor, entity attacker, float damage, entity ignore,
string dtype) T_RadiusDamage;
/* SERVER /* SERVER
void () monster_death_use; void () monster_death_use;
*/ */
@ -18,7 +12,8 @@ Returns true if the inflictor can directly damage the target. Used for
explosions and melee attacks. explosions and melee attacks.
============ ============
*/ */
float(entity targ, entity inflictor) CanDamage = float (entity targ, entity inflictor)
CanDamage =
{ {
// bmodels need special checking because their origin is 0,0,0 // bmodels need special checking because their origin is 0,0,0
if (targ.movetype == MOVETYPE_PUSH) { if (targ.movetype == MOVETYPE_PUSH) {
@ -50,7 +45,10 @@ float(entity targ, entity inflictor) CanDamage =
return FALSE; return FALSE;
}; };
void(entity targ, entity attacker) Killed = void (entity targ, entity attacker) ClientObituary;
void (entity targ, entity attacker)
Killed =
{ {
local entity oself; local entity oself;
@ -97,7 +95,8 @@ The damage is coming from inflictor, but get mad at attacker
This should be the only function that ever reduces health. This should be the only function that ever reduces health.
============ ============
*/ */
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage= void (entity targ, entity inflictor, entity attacker, float damage)
T_Damage=
{ {
local entity oldself; local entity oldself;
local float save, take; local float save, take;
@ -221,7 +220,9 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
self = oldself; self = oldself;
}; };
void(entity inflictor, entity attacker, float damage, entity ignore, string dtype) T_RadiusDamage = void (entity inflictor, entity attacker, float damage, entity ignore,
string dtype)
T_RadiusDamage =
{ {
local entity head; local entity head;
local float points; local float points;
@ -257,7 +258,8 @@ void(entity inflictor, entity attacker, float damage, entity ignore, string dtyp
} }
}; };
void(entity attacker, float damage) T_BeamDamage = void (entity attacker, float damage)
T_BeamDamage =
{ {
local entity head; local entity head;
local float points; local float points;

View file

@ -17,10 +17,56 @@ Door.enemy chains from the master door through all doors linked in the chain.
// THINK FUNCTIONS ============================================================ // THINK FUNCTIONS ============================================================
void() door_go_down; void ()
void() door_go_up; door_hit_bottom =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() door_blocked = void ()
door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
if (self.max_health) {
self.takedamage = DAMAGE_YES;
self.health = self.max_health;
}
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
};
void ()
door_hit_top =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
self.think = door_go_down;
self.nextthink = self.ltime + self.wait;
};
void ()
door_go_up =
{
if (self.state == STATE_UP)
return; // allready going up
if (self.state == STATE_TOP) { // reset top wait time
self.nextthink = self.ltime + self.wait;
return;
}
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, door_hit_top);
SUB_UseTargets ();
};
void ()
door_blocked =
{ {
other.deathtype = "squish"; other.deathtype = "squish";
T_Damage (other, self, self.goalentity, self.dmg); T_Damage (other, self, self.goalentity, self.dmg);
@ -35,54 +81,10 @@ void() door_blocked =
} }
}; };
void() door_hit_top =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
self.think = door_go_down;
self.nextthink = self.ltime + self.wait;
};
void() door_hit_bottom =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
if (self.max_health) {
self.takedamage = DAMAGE_YES;
self.health = self.max_health;
}
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
};
void() door_go_up =
{
if (self.state == STATE_UP)
return; // allready going up
if (self.state == STATE_TOP) { // reset top wait time
self.nextthink = self.ltime + self.wait;
return;
}
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, door_hit_top);
SUB_UseTargets ();
};
// ACTIVATION FUNCTIONS ======================================================= // ACTIVATION FUNCTIONS =======================================================
void() door_fire = void ()
door_fire =
{ {
local entity oself, starte; local entity oself, starte;
@ -119,7 +121,8 @@ void() door_fire =
self = oself; self = oself;
}; };
void() door_use = void ()
door_use =
{ {
local entity oself; local entity oself;
@ -133,7 +136,8 @@ void() door_use =
self = oself; self = oself;
}; };
void() door_trigger_touch = void ()
door_trigger_touch =
{ {
if (other.health <= 0) if (other.health <= 0)
return; return;
@ -148,7 +152,8 @@ void() door_trigger_touch =
door_use (); door_use ();
}; };
void() door_killed = void ()
door_killed =
{ {
local entity oself; local entity oself;
@ -167,7 +172,8 @@ door_touch
Prints messages and opens key doors Prints messages and opens key doors
================ ================
*/ */
void() door_touch = void ()
door_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -232,10 +238,10 @@ void() door_touch =
// SPAWNING FUNCTIONS ========================================================= // SPAWNING FUNCTIONS =========================================================
entity(vector fmins, vector fmaxs) spawn_field = entity (vector fmins, vector fmaxs)
spawn_field =
{ {
local entity trigger; local entity trigger;
local vector t1, t2;
trigger = spawn (); trigger = spawn ();
trigger.movetype = MOVETYPE_NONE; trigger.movetype = MOVETYPE_NONE;
@ -243,13 +249,12 @@ entity(vector fmins, vector fmaxs) spawn_field =
trigger.owner = self; trigger.owner = self;
trigger.touch = door_trigger_touch; trigger.touch = door_trigger_touch;
t1 = fmins; setsize (trigger, fmins - '60 60 8', fmaxs + '60 60 8');
t2 = fmaxs;
setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
return (trigger); return (trigger);
}; };
float (entity e1, entity e2) EntitiesTouching = float (entity e1, entity e2)
EntitiesTouching =
{ {
if (e1.mins_x > e2.maxs_x) if (e1.mins_x > e2.maxs_x)
return FALSE; return FALSE;
@ -266,7 +271,8 @@ float (entity e1, entity e2) EntitiesTouching =
return TRUE; return TRUE;
}; };
void() LinkDoors = void ()
LinkDoors =
{ {
local entity t, starte; local entity t, starte;
local vector cmins, cmaxs; local vector cmins, cmaxs;
@ -362,7 +368,8 @@ Key doors are allways wait -1.
3) stone chain 3) stone chain
4) screechy metal 4) screechy metal
*/ */
void() func_door = void ()
func_door =
{ {
switch (world.worldtype) { switch (world.worldtype) {
case 0: case 0:
@ -480,12 +487,6 @@ void() func_door =
// SECRET DOORS =============================================================== // SECRET DOORS ===============================================================
void() fd_secret_move1;
void() fd_secret_move2;
void() fd_secret_move3;
void() fd_secret_move4;
void() fd_secret_move5;
void() fd_secret_move6;
void () fd_secret_done; void () fd_secret_done;
float SECRET_OPEN_ONCE = 1; // stays open float SECRET_OPEN_ONCE = 1; // stays open
@ -494,7 +495,60 @@ float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
float SECRET_NO_SHOOT = 8; // only opened by trigger float SECRET_NO_SHOOT = 8; // only opened by trigger
float SECRET_YES_SHOOT = 16; // shootable even if targeted float SECRET_YES_SHOOT = 16; // shootable even if targeted
void () fd_secret_use = void ()
fd_secret_move6 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.oldorigin, self.speed, fd_secret_done);
};
// Wait 1 second...
void ()
fd_secret_move5 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move6;
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
// Move backward...
void ()
fd_secret_move4 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest1, self.speed, fd_secret_move5);
};
// Wait here until time to go back...
void ()
fd_secret_move3 =
{
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE)) {
self.nextthink = self.ltime + self.wait;
self.think = fd_secret_move4;
}
};
// Start moving sideways w/sound...
void ()
fd_secret_move2 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest2, self.speed, fd_secret_move3);
};
// Wait after first movement...
void ()
fd_secret_move1 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move2;
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void ()
fd_secret_use =
{ {
local float temp; local float temp;
@ -542,58 +596,14 @@ void () fd_secret_use =
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
}; };
void (entity attacker, float damage) fd_secret_pain = void (entity attacker, float damage)
fd_secret_pain =
{ {
fd_secret_use (); fd_secret_use ();
}; };
// Wait after first movement... void ()
void () fd_secret_move1 = fd_secret_done =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move2;
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
// Start moving sideways w/sound...
void () fd_secret_move2 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest2, self.speed, fd_secret_move3);
};
// Wait here until time to go back...
void () fd_secret_move3 =
{
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE)) {
self.nextthink = self.ltime + self.wait;
self.think = fd_secret_move4;
}
};
// Move backward...
void () fd_secret_move4 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest1, self.speed, fd_secret_move5);
};
// Wait 1 second...
void () fd_secret_move5 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move6;
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void () fd_secret_move6 =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.oldorigin, self.speed, fd_secret_done);
};
void () fd_secret_done =
{ {
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) { if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) {
self.health = 10000; self.health = 10000;
@ -605,7 +615,8 @@ void () fd_secret_done =
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise3, 1, ATTN_NORM); sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}; };
void () secret_blocked = void ()
secret_blocked =
{ {
if (time < self.attack_finished) if (time < self.attack_finished)
return; return;
@ -622,7 +633,8 @@ secret_touch
Prints messages Prints messages
================ ================
*/ */
void() secret_touch = void ()
secret_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -653,7 +665,8 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
2) metal 2) metal
3) base 3) base
*/ */
void () func_door_secret = void ()
func_door_secret =
{ {
switch (self.sounds) { switch (self.sounds) {
case 1: case 1:

View file

@ -3,18 +3,21 @@ void() W_SetCurrentAmmo;
/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD /* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
BE .8 .3 .4 IN COLOR */ BE .8 .3 .4 IN COLOR */
void() SUB_regen = void ()
SUB_regen =
{ {
self.model = self.mdl; // restore original model self.model = self.mdl; // restore original model
self.solid = SOLID_TRIGGER; // allow it to be touched again self.solid = SOLID_TRIGGER; // allow it to be touched again
sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound // play respawn sound
sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);
setorigin (self, self.origin); setorigin (self, self.origin);
}; };
/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8) /*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
prints a warning message when spawned prints a warning message when spawned
*/ */
void() noclass = void ()
noclass =
{ {
dprint ("noclass spawned at"); dprint ("noclass spawned at");
dprint (vtos (self.origin)); dprint (vtos (self.origin));
@ -22,7 +25,8 @@ void() noclass =
remove (self); remove (self);
}; };
void() q_touch = void ()
q_touch =
{ {
local string s; local string s;
@ -62,7 +66,8 @@ void() q_touch =
SUB_UseTargets (); // fire all targets / killtargets SUB_UseTargets (); // fire all targets / killtargets
}; };
void(float timeleft) DropQuad = void (float timeleft)
DropQuad =
{ {
local entity item; local entity item;
@ -86,7 +91,8 @@ void(float timeleft) DropQuad =
item.think = SUB_Remove; item.think = SUB_Remove;
}; };
void() r_touch = void ()
r_touch =
{ {
local string s; local string s;
@ -116,7 +122,8 @@ void() r_touch =
SUB_UseTargets (); // fire all targets / killtargets SUB_UseTargets (); // fire all targets / killtargets
}; };
void(float timeleft) DropRing = void (float timeleft)
DropRing =
{ {
local entity item; local entity item;
@ -146,7 +153,8 @@ PlaceItem
plants the object on the floor plants the object on the floor
============ ============
*/ */
void() PlaceItem = void ()
PlaceItem =
{ {
local float oldz; local float oldz;
@ -173,7 +181,8 @@ StartItem
Sets the clipping size and plants the object on the floor Sets the clipping size and plants the object on the floor
============ ============
*/ */
void() StartItem = void ()
StartItem =
{ {
self.nextthink = time + 0.2; // items start after other solids self.nextthink = time + 0.2; // items start after other solids
self.think = PlaceItem; self.think = PlaceItem;
@ -181,10 +190,14 @@ void() StartItem =
// HEALTH BOX ================================================================= // HEALTH BOX =================================================================
float H_ROTTEN = 1;
float H_MEGA = 2;
.float healamount, healtype;
// T_Heal: add health to an entity, limiting health to max_health // T_Heal: add health to an entity, limiting health to max_health
// "ignore" will ignore max_health limit // "ignore" will ignore max_health limit
float (entity e, float healamount, float ignore) T_Heal = float (entity e, float healamount, float ignore)
T_Heal =
{ {
if (e.health <= 0) if (e.health <= 0)
return 0; return 0;
@ -201,49 +214,29 @@ float (entity e, float healamount, float ignore) T_Heal =
return 1; return 1;
}; };
/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth void ()
Health box. Normally gives 25 points. item_megahealth_rot =
Rotten box heals 5-10 points,
megahealth will add 100 health, then
rot you down to your maximum health limit,
one point per second.
*/
float H_ROTTEN = 1;
float H_MEGA = 2;
.float healamount, healtype;
void() health_touch;
void() item_megahealth_rot;
void() item_health =
{ {
self.touch = health_touch; other = self.owner;
if (self.spawnflags & H_ROTTEN) { if (other.health > other.max_health) {
precache_model ("maps/b_bh10.bsp"); other.health = other.health - 1;
precache_sound ("items/r_item1.wav"); self.nextthink = time + 1;
setmodel (self, "maps/b_bh10.bsp"); return;
self.noise = "items/r_item1.wav"; }
self.healamount = 15;
self.healtype = 0; // it is possible for a player to die and respawn between rots, so don't
} else if (self.spawnflags & H_MEGA) { // just blindly subtract the flag off
precache_model ("maps/b_bh100.bsp"); other.items &= ~IT_SUPERHEALTH;
precache_sound ("items/r_item2.wav");
setmodel (self, "maps/b_bh100.bsp"); if (deathmatch != 2) { // deathmatch 2 is silly old rules
self.noise = "items/r_item2.wav"; self.nextthink = time + 20;
self.healamount = 100; self.think = SUB_regen;
self.healtype = 2;
} else {
precache_model ("maps/b_bh25.bsp");
precache_sound ("items/health1.wav");
setmodel (self, "maps/b_bh25.bsp");
self.noise = "items/health1.wav";
self.healamount = 25;
self.healtype = 1;
} }
setsize (self, '0 0 0', '32 32 56');
StartItem ();
}; };
void() health_touch = void ()
health_touch =
{ {
local string s; local string s;
@ -295,29 +288,48 @@ void() health_touch =
SUB_UseTargets (); // fire all targets / killtargets SUB_UseTargets (); // fire all targets / killtargets
}; };
void() item_megahealth_rot = /*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
Health box. Normally gives 25 points.
Rotten box heals 5-10 points,
megahealth will add 100 health, then
rot you down to your maximum health limit,
one point per second.
*/
void ()
item_health =
{ {
other = self.owner; self.touch = health_touch;
if (other.health > other.max_health) { if (self.spawnflags & H_ROTTEN) {
other.health = other.health - 1; precache_model ("maps/b_bh10.bsp");
self.nextthink = time + 1; precache_sound ("items/r_item1.wav");
return; setmodel (self, "maps/b_bh10.bsp");
} self.noise = "items/r_item1.wav";
self.healamount = 15;
// it is possible for a player to die and respawn between rots, so don't self.healtype = 0;
// just blindly subtract the flag off } else if (self.spawnflags & H_MEGA) {
other.items &= ~IT_SUPERHEALTH; precache_model ("maps/b_bh100.bsp");
precache_sound ("items/r_item2.wav");
if (deathmatch != 2) { // deathmatch 2 is silly old rules setmodel (self, "maps/b_bh100.bsp");
self.nextthink = time + 20; self.noise = "items/r_item2.wav";
self.think = SUB_regen; self.healamount = 100;
self.healtype = 2;
} else {
precache_model ("maps/b_bh25.bsp");
precache_sound ("items/health1.wav");
setmodel (self, "maps/b_bh25.bsp");
self.noise = "items/health1.wav";
self.healamount = 25;
self.healtype = 1;
} }
setsize (self, '0 0 0', '32 32 56');
StartItem ();
}; };
// ARMOR ====================================================================== // ARMOR ======================================================================
void() armor_touch = void ()
armor_touch =
{ {
local float type = 0, value = 0, bit = 0; local float type = 0, value = 0, bit = 0;
@ -374,7 +386,8 @@ void() armor_touch =
/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() item_armor1 = void ()
item_armor1 =
{ {
self.touch = armor_touch; self.touch = armor_touch;
precache_model ("progs/armor.mdl"); precache_model ("progs/armor.mdl");
@ -386,7 +399,8 @@ void() item_armor1 =
/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() item_armor2 = void ()
item_armor2 =
{ {
self.touch = armor_touch; self.touch = armor_touch;
precache_model ("progs/armor.mdl"); precache_model ("progs/armor.mdl");
@ -398,7 +412,8 @@ void() item_armor2 =
/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() item_armorInv = void ()
item_armorInv =
{ {
self.touch = armor_touch; self.touch = armor_touch;
precache_model ("progs/armor.mdl"); precache_model ("progs/armor.mdl");
@ -410,7 +425,8 @@ void() item_armorInv =
// WEAPONS ==================================================================== // WEAPONS ====================================================================
void() bound_other_ammo = void ()
bound_other_ammo =
{ {
if (other.ammo_shells > 100) if (other.ammo_shells > 100)
other.ammo_shells = 100; other.ammo_shells = 100;
@ -422,7 +438,8 @@ void() bound_other_ammo =
other.ammo_cells = 100; other.ammo_cells = 100;
}; };
float(float w) RankForWeapon = float (float w)
RankForWeapon =
{ {
switch (w) { switch (w) {
case IT_LIGHTNING: case IT_LIGHTNING:
@ -442,7 +459,8 @@ float(float w) RankForWeapon =
} }
}; };
float (float w) WeaponCode = float (float w)
WeaponCode =
{ {
switch (w) { switch (w) {
case IT_SUPER_SHOTGUN: case IT_SUPER_SHOTGUN:
@ -471,7 +489,8 @@ Deathmatch weapon change rules for picking up a weapon
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells; .float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
============= =============
*/ */
void(float old, float new) Deathmatch_Weapon = void (float old, float new)
Deathmatch_Weapon =
{ {
local float or, nr; local float or, nr;
@ -484,7 +503,8 @@ void(float old, float new) Deathmatch_Weapon =
float () W_BestWeapon; float () W_BestWeapon;
void() weapon_touch = void ()
weapon_touch =
{ {
local float w_switch, hadammo, leave, best, old, new = 0; local float w_switch, hadammo, leave, best, old, new = 0;
local entity stemp; local entity stemp;
@ -603,7 +623,8 @@ void() weapon_touch =
/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_supershotgun = void ()
weapon_supershotgun =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_shot.mdl"); precache_model ("progs/g_shot.mdl");
@ -618,7 +639,8 @@ void() weapon_supershotgun =
/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_nailgun = void ()
weapon_nailgun =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_nail.mdl"); precache_model ("progs/g_nail.mdl");
@ -633,7 +655,8 @@ void() weapon_nailgun =
/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_supernailgun = void ()
weapon_supernailgun =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_nail2.mdl"); precache_model ("progs/g_nail2.mdl");
@ -648,7 +671,8 @@ void() weapon_supernailgun =
/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_grenadelauncher = void ()
weapon_grenadelauncher =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_rock.mdl"); precache_model ("progs/g_rock.mdl");
@ -663,7 +687,8 @@ void() weapon_grenadelauncher =
/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_rocketlauncher = void ()
weapon_rocketlauncher =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_rock2.mdl"); precache_model ("progs/g_rock2.mdl");
@ -678,7 +703,8 @@ void() weapon_rocketlauncher =
/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) /*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
*/ */
void() weapon_lightning = void ()
weapon_lightning =
{ {
if (deathmatch <= 3) { if (deathmatch <= 3) {
precache_model ("progs/g_light.mdl"); precache_model ("progs/g_light.mdl");
@ -693,7 +719,8 @@ void() weapon_lightning =
// AMMO ======================================================================= // AMMO =======================================================================
void() ammo_touch = void ()
ammo_touch =
{ {
local entity stemp; local entity stemp;
local float best; local float best;
@ -776,7 +803,8 @@ float WEAPON_BIG2 = 1;
/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_shells = void ()
item_shells =
{ {
if (deathmatch == 4) if (deathmatch == 4)
return; return;
@ -800,7 +828,8 @@ void() item_shells =
/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_spikes = void ()
item_spikes =
{ {
if (deathmatch == 4) if (deathmatch == 4)
return; return;
@ -824,7 +853,8 @@ void() item_spikes =
/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_rockets = void ()
item_rockets =
{ {
if (deathmatch == 4) if (deathmatch == 4)
return; return;
@ -848,7 +878,8 @@ void() item_rockets =
/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_cells = void ()
item_cells =
{ {
if (deathmatch == 4) if (deathmatch == 4)
return; return;
@ -870,14 +901,16 @@ void() item_cells =
StartItem (); StartItem ();
}; };
/*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
DO NOT USE THIS!!!! IT WILL BE REMOVED!
*/
float WEAPON_SHOTGUN = 1; float WEAPON_SHOTGUN = 1;
float WEAPON_ROCKET = 2; float WEAPON_ROCKET = 2;
float WEAPON_SPIKES = 4; float WEAPON_SPIKES = 4;
float WEAPON_BIG = 8; float WEAPON_BIG = 8;
void() item_weapon =
/*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
DO NOT USE THIS!!!! IT WILL BE REMOVED!
*/
void ()
item_weapon =
{ {
self.touch = ammo_touch; self.touch = ammo_touch;
@ -929,7 +962,8 @@ void() item_weapon =
// KEYS ======================================================================= // KEYS =======================================================================
void() key_touch = void ()
key_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -953,7 +987,8 @@ void() key_touch =
SUB_UseTargets (); // fire all targets / killtargets SUB_UseTargets (); // fire all targets / killtargets
}; };
void() key_setsounds = void ()
key_setsounds =
{ {
switch (world.worldtype) { switch (world.worldtype) {
case 0: case 0:
@ -982,7 +1017,8 @@ following:
1: metal 1: metal
2: base 2: base
*/ */
void() item_key1 = void ()
item_key1 =
{ {
switch (world.worldtype) { switch (world.worldtype) {
case 0: case 0:
@ -1020,7 +1056,8 @@ following:
1: metal 1: metal
2: base 2: base
*/ */
void() item_key2 = void ()
item_key2 =
{ {
switch (world.worldtype) { switch (world.worldtype) {
case 0: case 0:
@ -1050,7 +1087,8 @@ void() item_key2 =
// END OF LEVEL RUNES ========================================================= // END OF LEVEL RUNES =========================================================
void() sigil_touch = void ()
sigil_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -1073,7 +1111,8 @@ void() sigil_touch =
/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4 /*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
End of level sigil, pick up to end episode and return to jrstart. End of level sigil, pick up to end episode and return to jrstart.
*/ */
void() item_sigil = void ()
item_sigil =
{ {
if (!self.spawnflags) if (!self.spawnflags)
objerror ("no spawnflags"); objerror ("no spawnflags");
@ -1105,7 +1144,8 @@ void() item_sigil =
// POWERUPS =================================================================== // POWERUPS ===================================================================
void() powerup_touch = void ()
powerup_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -1163,7 +1203,8 @@ void() powerup_touch =
/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) /*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
Player is invulnerable for 30 seconds Player is invulnerable for 30 seconds
*/ */
void() item_artifact_invulnerability = void ()
item_artifact_invulnerability =
{ {
self.touch = powerup_touch; self.touch = powerup_touch;
@ -1183,7 +1224,8 @@ void() item_artifact_invulnerability =
/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32) /*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
Player takes no damage from water or slime for 30 seconds Player takes no damage from water or slime for 30 seconds
*/ */
void() item_artifact_envirosuit = void ()
item_artifact_envirosuit =
{ {
self.touch = powerup_touch; self.touch = powerup_touch;
@ -1201,7 +1243,8 @@ void() item_artifact_envirosuit =
/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) /*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
Player is invisible for 30 seconds Player is invisible for 30 seconds
*/ */
void() item_artifact_invisibility = void ()
item_artifact_invisibility =
{ {
self.touch = powerup_touch; self.touch = powerup_touch;
@ -1220,7 +1263,8 @@ void() item_artifact_invisibility =
/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32) /*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
The next attack from the player will do 4x damage The next attack from the player will do 4x damage
*/ */
void() item_artifact_super_damage = void ()
item_artifact_super_damage =
{ {
self.touch = powerup_touch; self.touch = powerup_touch;
@ -1242,7 +1286,8 @@ void() item_artifact_super_damage =
// PLAYER BACKPACKS =========================================================== // PLAYER BACKPACKS ===========================================================
void() BackpackTouch = void ()
BackpackTouch =
{ {
local entity stemp; local entity stemp;
local float acount, b_switch, best, old, new; local float acount, b_switch, best, old, new;
@ -1384,7 +1429,8 @@ void() BackpackTouch =
W_SetCurrentAmmo (); W_SetCurrentAmmo ();
}; };
void() DropBackpack = void ()
DropBackpack =
{ {
local entity item; local entity item;

View file

@ -1,7 +1,8 @@
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) /*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for spotlights, etc. Used as a positional target for spotlights, etc.
*/ */
void() info_null = void ()
info_null =
{ {
remove (self); remove (self);
}; };
@ -9,7 +10,8 @@ void() info_null =
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) /*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for lightning. Used as a positional target for lightning.
*/ */
void() info_notnull = void ()
info_notnull =
{ {
}; };
@ -17,14 +19,15 @@ void() info_notnull =
float START_OFF = 1; float START_OFF = 1;
void() light_use = void ()
light_use =
{ {
if (self.spawnflags & START_OFF) { if (self.spawnflags & START_OFF) {
lightstyle (self.style, "m"); lightstyle (self.style, "m");
self.spawnflags = self.spawnflags - START_OFF; self.spawnflags &= ~START_OFF;
} else { } else {
lightstyle (self.style, "a"); lightstyle (self.style, "a");
self.spawnflags = self.spawnflags + START_OFF; self.spawnflags |= START_OFF;
} }
}; };
@ -34,7 +37,8 @@ Default light value is 300
Default style is 0 Default style is 0
If targeted, it will toggle between on or off. If targeted, it will toggle between on or off.
*/ */
void() light = void ()
light =
{ {
if (!self.targetname) { // inert light if (!self.targetname) { // inert light
remove (self); remove (self);
@ -57,7 +61,8 @@ Default style is 0
If targeted, it will toggle between on or off. If targeted, it will toggle between on or off.
Makes steady fluorescent humming sound Makes steady fluorescent humming sound
*/ */
void() light_fluoro = void ()
light_fluoro =
{ {
if (self.style >= 32) { if (self.style >= 32) {
self.use = light_use; self.use = light_use;
@ -77,7 +82,8 @@ Default light value is 300
Default style is 10 Default style is 10
Makes sparking, broken fluorescent sound Makes sparking, broken fluorescent sound
*/ */
void() light_fluorospark = void ()
light_fluorospark =
{ {
if (!self.style) if (!self.style)
self.style = 10; self.style = 10;
@ -91,14 +97,16 @@ Sphere globe light.
Default light value is 300 Default light value is 300
Default style is 0 Default style is 0
*/ */
void() light_globe = void ()
light_globe =
{ {
precache_model ("progs/s_light.spr"); precache_model ("progs/s_light.spr");
setmodel (self, "progs/s_light.spr"); setmodel (self, "progs/s_light.spr");
makestatic (self); makestatic (self);
}; };
void() FireAmbient = void ()
FireAmbient =
{ {
precache_sound ("ambience/fire1.wav"); precache_sound ("ambience/fire1.wav");
// attenuate fast // attenuate fast
@ -110,7 +118,8 @@ Short wall torch
Default light value is 200 Default light value is 200
Default style is 0 Default style is 0
*/ */
void() light_torch_small_walltorch = void ()
light_torch_small_walltorch =
{ {
precache_model ("progs/flame.mdl"); precache_model ("progs/flame.mdl");
setmodel (self, "progs/flame.mdl"); setmodel (self, "progs/flame.mdl");
@ -121,7 +130,8 @@ void() light_torch_small_walltorch =
/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) /*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
Large yellow flame ball Large yellow flame ball
*/ */
void() light_flame_large_yellow = void ()
light_flame_large_yellow =
{ {
precache_model ("progs/flame2.mdl"); precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl"); setmodel (self, "progs/flame2.mdl");
@ -133,7 +143,8 @@ void() light_flame_large_yellow =
/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF /*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
Small yellow flame ball Small yellow flame ball
*/ */
void() light_flame_small_yellow = void ()
light_flame_small_yellow =
{ {
precache_model ("progs/flame2.mdl"); precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl"); setmodel (self, "progs/flame2.mdl");
@ -144,7 +155,8 @@ void() light_flame_small_yellow =
/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF /*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
Small white flame ball Small white flame ball
*/ */
void() light_flame_small_white = void ()
light_flame_small_white =
{ {
precache_model ("progs/flame2.mdl"); precache_model ("progs/flame2.mdl");
setmodel (self, "progs/flame2.mdl"); setmodel (self, "progs/flame2.mdl");
@ -154,13 +166,15 @@ void() light_flame_small_white =
//============================================================================ //============================================================================
void() fire_touch = void ()
fire_touch =
{ {
T_Damage (other, self, self, 20); T_Damage (other, self, self, 20);
remove (self); remove (self);
}; };
void() fire_fly = void ()
fire_fly =
{ {
local entity fireball; local entity fireball;
@ -186,7 +200,8 @@ void() fire_fly =
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8) /*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
Lava Balls Lava Balls
*/ */
void() misc_fireball = void ()
misc_fireball =
{ {
precache_model ("progs/lavaball.mdl"); precache_model ("progs/lavaball.mdl");
self.classname = "fireball"; self.classname = "fireball";
@ -198,7 +213,8 @@ void() misc_fireball =
//============================================================================ //============================================================================
void() barrel_explode = void ()
barrel_explode =
{ {
self.takedamage = DAMAGE_NO; self.takedamage = DAMAGE_NO;
self.classname = "explo_box"; self.classname = "explo_box";
@ -214,7 +230,8 @@ void() barrel_explode =
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) /*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
TESTING THING TESTING THING
*/ */
void() misc_explobox = void ()
misc_explobox =
{ {
local float oldz; local float oldz;
@ -228,7 +245,7 @@ void() misc_explobox =
self.th_die = barrel_explode; self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM; self.takedamage = DAMAGE_AIM;
self.origin_z = self.origin_z + 2; self.origin_z += 2;
oldz = self.origin_z; oldz = self.origin_z;
droptofloor (); droptofloor ();
if (oldz - self.origin_z > 250) { if (oldz - self.origin_z > 250) {
@ -242,7 +259,8 @@ void() misc_explobox =
/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64) /*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
Smaller exploding box, REGISTERED ONLY Smaller exploding box, REGISTERED ONLY
*/ */
void() misc_explobox2 = void ()
misc_explobox2 =
{ {
local float oldz; local float oldz;
@ -256,7 +274,7 @@ void() misc_explobox2 =
self.th_die = barrel_explode; self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM; self.takedamage = DAMAGE_AIM;
self.origin_z = self.origin_z + 2; self.origin_z += 2;
oldz = self.origin_z; oldz = self.origin_z;
droptofloor (); droptofloor ();
if (oldz - self.origin_z > 250) { if (oldz - self.origin_z > 250) {
@ -272,7 +290,8 @@ void() misc_explobox2 =
float SPAWNFLAG_SUPERSPIKE = 1; float SPAWNFLAG_SUPERSPIKE = 1;
float SPAWNFLAG_LASER = 2; float SPAWNFLAG_LASER = 2;
void() Laser_Touch = void ()
Laser_Touch =
{ {
local vector org; local vector org;
@ -300,7 +319,8 @@ void() Laser_Touch =
remove (self); remove (self);
}; };
void(vector org, vector vec) LaunchLaser = void (vector org, vector vec)
LaunchLaser =
{ {
if (self.classname == "monster_enforcer") if (self.classname == "monster_enforcer")
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
@ -326,7 +346,8 @@ void(vector org, vector vec) LaunchLaser =
newmis.touch = Laser_Touch; newmis.touch = Laser_Touch;
}; };
void() spikeshooter_use = void ()
spikeshooter_use =
{ {
if (self.spawnflags & SPAWNFLAG_LASER) { if (self.spawnflags & SPAWNFLAG_LASER) {
sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM); sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
@ -340,7 +361,8 @@ void() spikeshooter_use =
} }
}; };
void() shooter_think = void ()
shooter_think =
{ {
spikeshooter_use (); spikeshooter_use ();
self.nextthink = time + self.wait; self.nextthink = time + self.wait;
@ -351,7 +373,8 @@ void() shooter_think =
When triggered, fires a spike in the direction set in QuakeEd. When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED. Laser is only for REGISTERED.
*/ */
void() trap_spikeshooter = void ()
trap_spikeshooter =
{ {
SetMovedir (); SetMovedir ();
self.use = spikeshooter_use; self.use = spikeshooter_use;
@ -368,7 +391,8 @@ Continuously fires spikes.
"wait" time between spike (1.0 default) "wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered. "nextthink" delay before firing first spike, so multiple shooters can be stagered.
*/ */
void() trap_shooter = void ()
trap_shooter =
{ {
trap_spikeshooter (); trap_spikeshooter ();
@ -383,35 +407,24 @@ void() trap_shooter =
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) /*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
testing air bubbles testing air bubbles
*/ */
void() air_bubbles = void ()
air_bubbles =
{ {
remove (self); remove (self);
}; };
void() bubble_remove; void ()
void() bubble_bob; bubble_remove =
void() make_bubbles =
{ {
local entity bubble; if (other.classname == self.classname) {
// dprint ("bump");
bubble = spawn (); return;
setmodel (bubble, "progs/s_bubble.spr"); }
setorigin (bubble, self.origin); remove (self);
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random () + 0.5;
self.think = make_bubbles;
}; };
void() bubble_split = void ()
bubble_split =
{ {
local entity bubble; local entity bubble;
@ -434,16 +447,8 @@ void() bubble_split =
remove (self); remove (self);
}; };
void() bubble_remove = void ()
{ bubble_bob =
if (other.classname == self.classname) {
// dprint ("bump");
return;
}
remove (self);
};
void() bubble_bob =
{ {
self.cnt++; self.cnt++;
if (self.cnt == 4) if (self.cnt == 4)
@ -473,13 +478,36 @@ void() bubble_bob =
self.think = bubble_bob; self.think = bubble_bob;
}; };
void ()
make_bubbles =
{
local entity bubble;
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.touch = bubble_remove;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random () + 0.5;
self.think = make_bubbles;
};
/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~> /*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/ ~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8) /*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
Just for the debugging level. Don't use Just for the debugging level. Don't use
*/ */
void() viewthing = void ()
viewthing =
{ {
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
@ -489,7 +517,8 @@ void() viewthing =
// SIMPLE BMODELS ============================================================= // SIMPLE BMODELS =============================================================
void() func_wall_use = void ()
func_wall_use =
{ // change to alternate textures { // change to alternate textures
self.frame = 1 - self.frame; self.frame = 1 - self.frame;
}; };
@ -497,7 +526,8 @@ void() func_wall_use =
/*QUAKED func_wall (0 .5 .8) ? /*QUAKED func_wall (0 .5 .8) ?
This is just a solid wall if not inhibitted This is just a solid wall if not inhibitted
*/ */
void() func_wall = void ()
func_wall =
{ {
self.angles = '0 0 0'; self.angles = '0 0 0';
self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
@ -509,7 +539,8 @@ void() func_wall =
/*QUAKED func_illusionary (0 .5 .8) ? /*QUAKED func_illusionary (0 .5 .8) ?
A simple entity that looks solid but lets you walk through it. A simple entity that looks solid but lets you walk through it.
*/ */
void() func_illusionary = void ()
func_illusionary =
{ {
self.angles = '0 0 0'; self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
@ -521,7 +552,8 @@ void() func_illusionary =
/*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4 /*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4
This bmodel will appear if the episode has allready been completed, so players can't reenter it. This bmodel will appear if the episode has allready been completed, so players can't reenter it.
*/ */
void() func_episodegate = void ()
func_episodegate =
{ {
if (!(serverflags & self.spawnflags)) if (!(serverflags & self.spawnflags))
return; // can still enter episode return; // can still enter episode
@ -536,7 +568,8 @@ void() func_episodegate =
/*QUAKED func_bossgate (0 .5 .8) ? /*QUAKED func_bossgate (0 .5 .8) ?
This bmodel appears unless players have all of the episode sigils. This bmodel appears unless players have all of the episode sigils.
*/ */
void() func_bossgate = void ()
func_bossgate =
{ {
if ((serverflags & 15) == 15) if ((serverflags & 15) == 15)
return; // all episodes completed return; // all episodes completed
@ -552,7 +585,8 @@ void() func_bossgate =
/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_suck_wind = void ()
ambient_suck_wind =
{ {
precache_sound ("ambience/suck1.wav"); precache_sound ("ambience/suck1.wav");
ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC); ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
@ -560,7 +594,8 @@ void() ambient_suck_wind =
/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_drone = void ()
ambient_drone =
{ {
precache_sound ("ambience/drone6.wav"); precache_sound ("ambience/drone6.wav");
ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
@ -568,7 +603,8 @@ void() ambient_drone =
/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_flouro_buzz = void ()
ambient_flouro_buzz =
{ {
precache_sound ("ambience/buzz1.wav"); precache_sound ("ambience/buzz1.wav");
ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC); ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
@ -576,7 +612,8 @@ void() ambient_flouro_buzz =
/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_drip = void ()
ambient_drip =
{ {
precache_sound ("ambience/drip1.wav"); precache_sound ("ambience/drip1.wav");
ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
@ -584,7 +621,8 @@ void() ambient_drip =
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_comp_hum = void ()
ambient_comp_hum =
{ {
precache_sound ("ambience/comp1.wav"); precache_sound ("ambience/comp1.wav");
ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC); ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
@ -592,7 +630,8 @@ void() ambient_comp_hum =
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_thunder = void ()
ambient_thunder =
{ {
precache_sound ("ambience/thunder1.wav"); precache_sound ("ambience/thunder1.wav");
ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
@ -600,7 +639,8 @@ void() ambient_thunder =
/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_light_buzz = void ()
ambient_light_buzz =
{ {
precache_sound ("ambience/fl_hum1.wav"); precache_sound ("ambience/fl_hum1.wav");
ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
@ -608,7 +648,8 @@ void() ambient_light_buzz =
/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_swamp1 = void ()
ambient_swamp1 =
{ {
precache_sound ("ambience/swamp1.wav"); precache_sound ("ambience/swamp1.wav");
ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
@ -616,7 +657,8 @@ void() ambient_swamp1 =
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) /*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/ */
void() ambient_swamp2 = void ()
ambient_swamp2 =
{ {
precache_sound ("ambience/swamp2.wav"); precache_sound ("ambience/swamp2.wav");
ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC); ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
@ -624,7 +666,8 @@ void() ambient_swamp2 =
//============================================================================ //============================================================================
void() noise_think = void ()
noise_think =
{ {
self.nextthink = time + 0.5; self.nextthink = time + 0.5;
sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM); sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
@ -639,7 +682,8 @@ void() noise_think =
/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10) /*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10)
For optimzation testing, starts a lot of sounds. For optimzation testing, starts a lot of sounds.
*/ */
void() misc_noisemaker = void ()
misc_noisemaker =
{ {
precache_sound2 ("enforcer/enfire.wav"); precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav"); precache_sound2 ("enforcer/enfstop.wav");

View file

@ -1,12 +1,106 @@
void() plat_center_touch;
void() plat_outside_touch;
void() plat_trigger_use;
void() plat_go_up;
void() plat_go_down;
void() plat_crush;
float PLAT_LOW_TRIGGER = 1; float PLAT_LOW_TRIGGER = 1;
void() plat_spawn_inside_trigger = void ()
plat_hit_bottom =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void ()
plat_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
};
void ()
plat_hit_top =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
self.think = plat_go_down;
self.nextthink = self.ltime + 3;
};
void ()
plat_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
};
void ()
plat_center_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
self = self.enemy;
if (self.state == STATE_BOTTOM)
plat_go_up ();
else if (self.state == STATE_TOP)
self.nextthink = self.ltime + 1; // delay going down
};
void ()
plat_outside_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
// dprint ("plat_outside_touch\n");
self = self.enemy;
if (self.state == STATE_TOP)
plat_go_down ();
};
void ()
plat_trigger_use =
{
if (self.think)
return; // allready activated
plat_go_down ();
};
void ()
plat_crush =
{
// dprint ("plat_crush\n");
other.deathtype = "squish";
T_Damage (other, self, self, 1);
switch (self.state) {
case STATE_UP:
plat_go_down ();
break;
case STATE_DOWN:
plat_go_up ();
break;
default:
objerror ("plat_crush: bad self.state\n");
break;
}
};
void ()
plat_use =
{
self.use = SUB_Null;
if (self.state != STATE_UP)
objerror ("plat_use: not in up state");
plat_go_down ();
};
void ()
plat_spawn_inside_trigger =
{ {
local entity trigger; local entity trigger;
local vector tmin, tmax; local vector tmin, tmax;
@ -36,96 +130,6 @@ void() plat_spawn_inside_trigger =
setsize (trigger, tmin, tmax); setsize (trigger, tmin, tmax);
}; };
void() plat_hit_top =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_TOP;
self.think = plat_go_down;
self.nextthink = self.ltime + 3;
};
void() plat_hit_bottom =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.state = STATE_BOTTOM;
};
void() plat_go_down =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_DOWN;
SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
};
void() plat_go_up =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
self.state = STATE_UP;
SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
};
void() plat_center_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
self = self.enemy;
if (self.state == STATE_BOTTOM)
plat_go_up ();
else if (self.state == STATE_TOP)
self.nextthink = self.ltime + 1; // delay going down
};
void() plat_outside_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
// dprint ("plat_outside_touch\n");
self = self.enemy;
if (self.state == STATE_TOP)
plat_go_down ();
};
void() plat_trigger_use =
{
if (self.think)
return; // allready activated
plat_go_down ();
};
void() plat_crush =
{
// dprint ("plat_crush\n");
other.deathtype = "squish";
T_Damage (other, self, self, 1);
switch (self.state) {
case STATE_UP:
plat_go_down ();
break;
case STATE_DOWN:
plat_go_up ();
break;
default:
objerror ("plat_crush: bad self.state\n");
break;
}
};
void() plat_use =
{
self.use = SUB_Null;
if (self.state != STATE_UP)
objerror ("plat_use: not in up state");
plat_go_down ();
};
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER /*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed default 150 speed default 150
@ -138,7 +142,8 @@ Set "sounds" to one of the following:
1) base fast 1) base fast
2) chain slow 2) chain slow
*/ */
void() func_plat = void ()
func_plat =
{ {
if (!self.t_length) if (!self.t_length)
self.t_length = 80; self.t_length = 80;
@ -199,10 +204,8 @@ void() func_plat =
//============================================================================ //============================================================================
void() train_next; void ()
void() func_train_find; train_blocked =
void() train_blocked =
{ {
if (time < self.attack_finished) if (time < self.attack_finished)
return; return;
@ -211,25 +214,10 @@ void() train_blocked =
T_Damage (other, self, self, self.dmg); T_Damage (other, self, self, self.dmg);
}; };
void() train_use = void () train_wait;
{
if (self.think != func_train_find)
return; // already activated
train_next ();
};
void() train_wait = void ()
{ train_next =
if (self.wait) {
self.nextthink = self.ltime + self.wait;
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise, 1, ATTN_NORM);
} else
self.nextthink = self.ltime + 0.1;
self.think = train_next;
};
void() train_next =
{ {
local entity targ; local entity targ;
@ -245,7 +233,8 @@ void() train_next =
SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait); SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait);
}; };
void() func_train_find = void ()
func_train_find =
{ {
local entity targ; local entity targ;
@ -259,6 +248,27 @@ void() func_train_find =
} }
}; };
void ()
train_use =
{
if (self.think != func_train_find)
return; // already activated
train_next ();
};
void ()
train_wait =
{
if (self.wait) {
self.nextthink = self.ltime + self.wait;
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise, 1, ATTN_NORM);
} else
self.nextthink = self.ltime + 0.1;
self.think = train_next;
};
/*QUAKED func_train (0 .5 .8) ? /*QUAKED func_train (0 .5 .8) ?
Trains are moving platforms that players can ride. Trains are moving platforms that players can ride.
The targets origin specifies the min point of the train at each corner. The targets origin specifies the min point of the train at each corner.
@ -269,7 +279,8 @@ dmg default 2
sounds sounds
1) ratchet metal 1) ratchet metal
*/ */
void() func_train = void ()
func_train =
{ {
if (!self.speed) if (!self.speed)
self.speed = 100; self.speed = 100;

View file

@ -1,5 +1,3 @@
void() bubble_bob;
// PLAYER ===================================================================== // PLAYER =====================================================================
$cd /raid/quake/id1/models/player_4 $cd /raid/quake/id1/models/player_4
@ -23,7 +21,6 @@ $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
$frame pain1 pain2 pain3 pain4 pain5 pain6 $frame pain1 pain2 pain3 pain4 pain5 pain6
// death // death
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6 $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9 $frame axdeth7 axdeth8 axdeth9
@ -60,11 +57,60 @@ $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6 $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//=============================================================================
void () bubble_bob;
void ()
DeathBubblesSpawn =
{
local entity bubble;
if (self.owner.waterlevel != 3)
return;
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.owner.origin + '0 0 24');
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + 0.1;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
remove (self);
};
void (float num_bubbles)
DeathBubbles =
{
local entity bubble_spawner;
bubble_spawner = spawn ();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
bubble_spawner.nextthink = time + 0.1;
bubble_spawner.think = DeathBubblesSpawn;
bubble_spawner.air_finished = 0;
bubble_spawner.owner = self;
bubble_spawner.bubble_count = num_bubbles;
return;
};
// PLAYER ===================================================================== // PLAYER =====================================================================
void () player_run; void () player_run;
void() player_stand1 =[ $axstnd1, player_stand1 ] void ()
player_stand1 = [$axstnd1, player_stand1]
{ {
self.weaponframe = 0; self.weaponframe = 0;
if (self.velocity_x || self.velocity_y) { if (self.velocity_x || self.velocity_y) {
@ -82,10 +128,11 @@ void() player_stand1 =[ $axstnd1, player_stand1 ]
self.walkframe = 0; self.walkframe = 0;
self.frame = $stand1 + self.walkframe; self.frame = $stand1 + self.walkframe;
} }
self.walkframe = self.walkframe + 1; self.walkframe++;
}; };
void() player_run =[ $rockrun1, player_run ] void ()
player_run = [$rockrun1, player_run]
{ {
self.weaponframe = 0; self.weaponframe = 0;
if (!self.velocity_x && !self.velocity_y) { if (!self.velocity_x && !self.velocity_y) {
@ -95,25 +142,28 @@ void() player_run =[ $rockrun1, player_run ]
} }
if (self.weapon == IT_AXE) { if (self.weapon == IT_AXE) {
if (self.walkframe == 6) if (self.walkframe >= 6)
self.walkframe = 0; self.walkframe = 0;
self.frame = $axrun1 + self.walkframe; self.frame = $axrun1 + self.walkframe;
} else { } else {
if (self.walkframe == 6) if (self.walkframe >= 6)
self.walkframe = 0; self.walkframe = 0;
self.frame = self.frame + self.walkframe; self.frame += self.walkframe;
} }
self.walkframe = self.walkframe + 1; self.walkframe++;
}; };
void() muzzleflash = void ()
muzzleflash =
{ {
WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH); WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH);
WriteEntity (MSG_MULTICAST, self); WriteEntity (MSG_MULTICAST, self);
multicast (self.origin, MULTICAST_PVS); multicast (self.origin, MULTICAST_PVS);
}; };
void() player_shot1 = [$shotatt1, player_shot2 ] { void ()
player_shot1 = [$shotatt1, player_shot2]
{
self.weaponframe = 1; self.weaponframe = 1;
muzzleflash (); muzzleflash ();
}; };
@ -125,7 +175,8 @@ void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
void () player_axe1 = [$axatt1, player_axe2] {self.weaponframe = 1;}; void () player_axe1 = [$axatt1, player_axe2] {self.weaponframe = 1;};
void () player_axe2 = [$axatt2, player_axe3] {self.weaponframe = 2;}; void () player_axe2 = [$axatt2, player_axe3] {self.weaponframe = 2;};
void() player_axe3 = [$axatt3, player_axe4 ] { void ()
player_axe3 = [$axatt3, player_axe4] {
self.weaponframe = 3; self.weaponframe = 3;
W_FireAxe (); W_FireAxe ();
}; };
@ -133,7 +184,8 @@ void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
void () player_axeb1 = [$axattb1, player_axeb2] {self.weaponframe = 5;}; void () player_axeb1 = [$axattb1, player_axeb2] {self.weaponframe = 5;};
void () player_axeb2 = [$axattb2, player_axeb3] {self.weaponframe = 6;}; void () player_axeb2 = [$axattb2, player_axeb3] {self.weaponframe = 6;};
void() player_axeb3 = [$axattb3, player_axeb4 ] { void ()
player_axeb3 = [$axattb3, player_axeb4] {
self.weaponframe = 7; self.weaponframe = 7;
W_FireAxe (); W_FireAxe ();
}; };
@ -141,7 +193,9 @@ void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
void () player_axec1 = [$axattc1, player_axec2] {self.weaponframe = 1;}; void () player_axec1 = [$axattc1, player_axec2] {self.weaponframe = 1;};
void () player_axec2 = [$axattc2, player_axec3] {self.weaponframe = 2;}; void () player_axec2 = [$axattc2, player_axec3] {self.weaponframe = 2;};
void() player_axec3 = [$axattc3, player_axec4 ] { void ()
player_axec3 = [$axattc3, player_axec4]
{
self.weaponframe = 3; self.weaponframe = 3;
W_FireAxe (); W_FireAxe ();
}; };
@ -149,7 +203,8 @@ void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
void () player_axed1 = [$axattd1, player_axed2] {self.weaponframe = 5;}; void () player_axed1 = [$axattd1, player_axed2] {self.weaponframe = 5;};
void () player_axed2 = [$axattd2, player_axed3] {self.weaponframe = 6;}; void () player_axed2 = [$axattd2, player_axed3] {self.weaponframe = 6;};
void() player_axed3 = [$axattd3, player_axed4 ] { void ()
player_axed3 = [$axattd3, player_axed4 ] {
self.weaponframe = 7; self.weaponframe = 7;
W_FireAxe (); W_FireAxe ();
}; };
@ -157,7 +212,8 @@ void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
//============================================================================ //============================================================================
void() player_nail1 =[$nailatt1, player_nail2 ] void ()
player_nail1 = [$nailatt1, player_nail2]
{ {
muzzleflash (); muzzleflash ();
@ -174,7 +230,8 @@ void() player_nail1 =[$nailatt1, player_nail2 ]
self.attack_finished = time + 0.2; self.attack_finished = time + 0.2;
}; };
void() player_nail2 =[$nailatt2, player_nail1 ] void ()
player_nail2 = [$nailatt2, player_nail1]
{ {
muzzleflash (); muzzleflash ();
@ -183,8 +240,8 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
return; return;
} }
self.weaponframe = self.weaponframe + 1; self.weaponframe++;
if (self.weaponframe == 9) if (self.weaponframe >= 9)
self.weaponframe = 1; self.weaponframe = 1;
SuperDamageSound (); SuperDamageSound ();
W_FireSpikes (-4); W_FireSpikes (-4);
@ -193,7 +250,8 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
//============================================================================ //============================================================================
void() player_light1 =[$light1, player_light2 ] void ()
player_light1 = [$light1, player_light2]
{ {
muzzleflash (); muzzleflash ();
@ -202,15 +260,16 @@ void() player_light1 =[$light1, player_light2 ]
return; return;
} }
self.weaponframe = self.weaponframe + 1; self.weaponframe++;
if (self.weaponframe == 5) if (self.weaponframe >= 5)
self.weaponframe = 1; self.weaponframe = 1;
SuperDamageSound (); SuperDamageSound ();
W_FireLightning (); W_FireLightning ();
self.attack_finished = time + 0.2; self.attack_finished = time + 0.2;
}; };
void() player_light2 =[$light2, player_light1 ] void ()
player_light2 = [$light2, player_light1]
{ {
muzzleflash (); muzzleflash ();
@ -219,8 +278,8 @@ void() player_light2 =[$light2, player_light1 ]
return; return;
} }
self.weaponframe = self.weaponframe + 1; self.weaponframe++;
if (self.weaponframe == 5) if (self.weaponframe >= 5)
self.weaponframe = 1; self.weaponframe = 1;
SuperDamageSound (); SuperDamageSound ();
W_FireLightning (); W_FireLightning ();
@ -229,7 +288,9 @@ void() player_light2 =[$light2, player_light1 ]
//============================================================================ //============================================================================
void() player_rocket1 =[$rockatt1, player_rocket2 ] { void ()
player_rocket1 = [$rockatt1, player_rocket2]
{
self.weaponframe = 1; self.weaponframe = 1;
muzzleflash (); muzzleflash ();
}; };
@ -238,15 +299,12 @@ void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
void () player_rocket4 = [$rockatt4, player_rocket5] {self.weaponframe = 4;}; void () player_rocket4 = [$rockatt4, player_rocket5] {self.weaponframe = 4;};
void () player_rocket5 = [$rockatt5, player_rocket6] {self.weaponframe = 5;}; void () player_rocket5 = [$rockatt5, player_rocket6] {self.weaponframe = 5;};
void () player_rocket6 = [$rockatt6, player_run] {self.weaponframe = 6;}; void () player_rocket6 = [$rockatt6, player_run] {self.weaponframe = 6;};
void(float num_bubbles) DeathBubbles;
void() PainSound = void ()
PainSound =
{ {
local float rs;
if (self.health < 0) if (self.health < 0)
return; return;
if (damage_attacker.classname == "teledeath") { if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE); sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return; return;
@ -296,11 +354,8 @@ void() PainSound =
return; return;
} }
rs = rint ((random () * 5) + 1);
self.noise = ""; self.noise = "";
switch (rs) { switch (rint ((random () * 5) + 1)) {
case 1: case 1:
self.noise = "player/pain1.wav"; self.noise = "player/pain1.wav";
break; break;
@ -345,7 +400,8 @@ void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {}; void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {}; void() player_axpain6 = [ $axpain6, player_run ] {};
void(entity attacker, float damage) player_pain = void (entity attacker, float damage)
player_pain =
{ {
if (self.weaponframe) if (self.weaponframe)
return; return;
@ -358,59 +414,9 @@ void(entity attacker, float damage) player_pain =
player_pain1 (); player_pain1 ();
}; };
void() player_diea1; void ()
void() player_dieb1; DeathSound =
void() player_diec1;
void() player_died1;
void() player_diee1;
void() player_die_ax1;
void() DeathBubblesSpawn =
{ {
local entity bubble;
if (self.owner.waterlevel != 3)
return;
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.owner.origin + '0 0 24');
bubble.movetype = MOVETYPE_NOCLIP;
bubble.solid = SOLID_NOT;
bubble.velocity = '0 0 15';
bubble.nextthink = time + 0.5;
bubble.think = bubble_bob;
bubble.classname = "bubble";
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + 0.1;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
remove (self);
};
void(float num_bubbles) DeathBubbles =
{
local entity bubble_spawner;
bubble_spawner = spawn ();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
bubble_spawner.nextthink = time + 0.1;
bubble_spawner.think = DeathBubblesSpawn;
bubble_spawner.air_finished = 0;
bubble_spawner.owner = self;
bubble_spawner.bubble_count = num_bubbles;
return;
};
void() DeathSound =
{
local float rs;
// water death sounds // water death sounds
if (self.waterlevel == 3) { if (self.waterlevel == 3) {
DeathBubbles (5); DeathBubbles (5);
@ -418,30 +424,39 @@ void() DeathSound =
return; return;
} }
rs = rint (4 * random () + 1); switch (rint (4 * random () + 1)) {
if (rs == 1) case 1:
self.noise = "player/death1.wav"; self.noise = "player/death1.wav";
if (rs == 2) break;
case 2:
self.noise = "player/death2.wav"; self.noise = "player/death2.wav";
if (rs == 3) break;
case 3:
self.noise = "player/death3.wav"; self.noise = "player/death3.wav";
if (rs == 4) break;
case 4:
self.noise = "player/death4.wav"; self.noise = "player/death4.wav";
if (rs == 5) break;
case 5:
self.noise = "player/death5.wav"; self.noise = "player/death5.wav";
default:
break;
}
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE); sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
return; return;
}; };
void() PlayerDead = void ()
PlayerDead =
{ {
self.nextthink = -1; self.nextthink = -1;
// allow respawn after a certain time // allow respawn after a certain time
self.deadflag = DEAD_DEAD; self.deadflag = DEAD_DEAD;
}; };
vector(float dm) VelocityForDamage = vector (float dm)
VelocityForDamage =
{ {
local vector v; local vector v;
@ -468,7 +483,8 @@ vector(float dm) VelocityForDamage =
return v; return v;
}; };
void(string gibname, float dm) ThrowGib = void (string gibname, float dm)
ThrowGib =
{ {
local entity new; local entity new;
@ -489,7 +505,8 @@ void(string gibname, float dm) ThrowGib =
new.flags = 0; new.flags = 0;
}; };
void(string gibname, float dm) ThrowHead = void (string gibname, float dm)
ThrowHead =
{ {
setmodel (self, gibname); setmodel (self, gibname);
self.frame = 0; self.frame = 0;
@ -505,7 +522,8 @@ void(string gibname, float dm) ThrowHead =
self.avelocity = crandom () * '0 600 0'; self.avelocity = crandom () * '0 600 0';
}; };
void() GibPlayer = void ()
GibPlayer =
{ {
ThrowHead ("progs/h_player.mdl", self.health); ThrowHead ("progs/h_player.mdl", self.health);
ThrowGib ("progs/gib1.mdl", self.health); ThrowGib ("progs/gib1.mdl", self.health);
@ -529,7 +547,89 @@ void() GibPlayer =
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE); sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
}; };
void() PlayerDie = void ()
set_suicide_frame =
{ // used by kill command and disconnect command
if (self.model != "progs/player.mdl")
return; // allready gibbed
self.frame = $deatha11;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.deadflag = DEAD_DEAD;
self.nextthink = -1;
};
void() player_diea1 = [ $deatha1, player_diea2 ] {};
void() player_diea2 = [ $deatha2, player_diea3 ] {};
void() player_diea3 = [ $deatha3, player_diea4 ] {};
void() player_diea4 = [ $deatha4, player_diea5 ] {};
void() player_diea5 = [ $deatha5, player_diea6 ] {};
void() player_diea6 = [ $deatha6, player_diea7 ] {};
void() player_diea7 = [ $deatha7, player_diea8 ] {};
void() player_diea8 = [ $deatha8, player_diea9 ] {};
void() player_diea9 = [ $deatha9, player_diea10 ] {};
void() player_diea10 = [ $deatha10, player_diea11 ] {};
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
void() player_diec1 = [ $deathc1, player_diec2 ] {};
void() player_diec2 = [ $deathc2, player_diec3 ] {};
void() player_diec3 = [ $deathc3, player_diec4 ] {};
void() player_diec4 = [ $deathc4, player_diec5 ] {};
void() player_diec5 = [ $deathc5, player_diec6 ] {};
void() player_diec6 = [ $deathc6, player_diec7 ] {};
void() player_diec7 = [ $deathc7, player_diec8 ] {};
void() player_diec8 = [ $deathc8, player_diec9 ] {};
void() player_diec9 = [ $deathc9, player_diec10 ] {};
void() player_diec10 = [ $deathc10, player_diec11 ] {};
void() player_diec11 = [ $deathc11, player_diec12 ] {};
void() player_diec12 = [ $deathc12, player_diec13 ] {};
void() player_diec13 = [ $deathc13, player_diec14 ] {};
void() player_diec14 = [ $deathc14, player_diec15 ] {};
void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
void() player_died1 = [ $deathd1, player_died2 ] {};
void() player_died2 = [ $deathd2, player_died3 ] {};
void() player_died3 = [ $deathd3, player_died4 ] {};
void() player_died4 = [ $deathd4, player_died5 ] {};
void() player_died5 = [ $deathd5, player_died6 ] {};
void() player_died6 = [ $deathd6, player_died7 ] {};
void() player_died7 = [ $deathd7, player_died8 ] {};
void() player_died8 = [ $deathd8, player_died9 ] {};
void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
void() player_diee1 = [ $deathe1, player_diee2 ] {};
void() player_diee2 = [ $deathe2, player_diee3 ] {};
void() player_diee3 = [ $deathe3, player_diee4 ] {};
void() player_diee4 = [ $deathe4, player_diee5 ] {};
void() player_diee5 = [ $deathe5, player_diee6 ] {};
void() player_diee6 = [ $deathe6, player_diee7 ] {};
void() player_diee7 = [ $deathe7, player_diee8 ] {};
void() player_diee8 = [ $deathe8, player_diee9 ] {};
void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
void ()
PlayerDie =
{ {
local float i; local float i;
local string s; local string s;
@ -615,83 +715,3 @@ void() PlayerDie =
break; break;
} }
}; };
void() set_suicide_frame =
{ // used by kill command and disconnect command
if (self.model != "progs/player.mdl")
return; // allready gibbed
self.frame = $deatha11;
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_TOSS;
self.deadflag = DEAD_DEAD;
self.nextthink = -1;
};
void() player_diea1 = [ $deatha1, player_diea2 ] {};
void() player_diea2 = [ $deatha2, player_diea3 ] {};
void() player_diea3 = [ $deatha3, player_diea4 ] {};
void() player_diea4 = [ $deatha4, player_diea5 ] {};
void() player_diea5 = [ $deatha5, player_diea6 ] {};
void() player_diea6 = [ $deatha6, player_diea7 ] {};
void() player_diea7 = [ $deatha7, player_diea8 ] {};
void() player_diea8 = [ $deatha8, player_diea9 ] {};
void() player_diea9 = [ $deatha9, player_diea10 ] {};
void() player_diea10 = [ $deatha10, player_diea11 ] {};
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
void() player_diec1 = [ $deathc1, player_diec2 ] {};
void() player_diec2 = [ $deathc2, player_diec3 ] {};
void() player_diec3 = [ $deathc3, player_diec4 ] {};
void() player_diec4 = [ $deathc4, player_diec5 ] {};
void() player_diec5 = [ $deathc5, player_diec6 ] {};
void() player_diec6 = [ $deathc6, player_diec7 ] {};
void() player_diec7 = [ $deathc7, player_diec8 ] {};
void() player_diec8 = [ $deathc8, player_diec9 ] {};
void() player_diec9 = [ $deathc9, player_diec10 ] {};
void() player_diec10 = [ $deathc10, player_diec11 ] {};
void() player_diec11 = [ $deathc11, player_diec12 ] {};
void() player_diec12 = [ $deathc12, player_diec13 ] {};
void() player_diec13 = [ $deathc13, player_diec14 ] {};
void() player_diec14 = [ $deathc14, player_diec15 ] {};
void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
void() player_died1 = [ $deathd1, player_died2 ] {};
void() player_died2 = [ $deathd2, player_died3 ] {};
void() player_died3 = [ $deathd3, player_died4 ] {};
void() player_died4 = [ $deathd4, player_died5 ] {};
void() player_died5 = [ $deathd5, player_died6 ] {};
void() player_died6 = [ $deathd6, player_died7 ] {};
void() player_died7 = [ $deathd7, player_died8 ] {};
void() player_died8 = [ $deathd8, player_died9 ] {};
void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
void() player_diee1 = [ $deathe1, player_diee2 ] {};
void() player_diee2 = [ $deathe2, player_diee3 ] {};
void() player_diee3 = [ $deathe3, player_diee4 ] {};
void() player_diee4 = [ $deathe4, player_diee5 ] {};
void() player_diee5 = [ $deathe5, player_diee6 ] {};
void() player_diee6 = [ $deathe6, player_diee7 ] {};
void() player_diee7 = [ $deathe7, player_diee8 ] {};
void() player_diee8 = [ $deathe8, player_diee9 ] {};
void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};

View file

@ -40,7 +40,8 @@ Something has bumped into a movetarget. If it is a monster
moving towards it, change the next destination and continue. moving towards it, change the next destination and continue.
============== ==============
*/ */
void() t_movetarget = void ()
t_movetarget =
{ {
local entity temp; local entity temp;
@ -67,7 +68,8 @@ void() t_movetarget =
} }
}; };
void() movetarget_f = void ()
movetarget_f =
{ {
if (!self.targetname) if (!self.targetname)
objerror ("monster_movetarget: no targetname"); objerror ("monster_movetarget: no targetname");
@ -80,7 +82,8 @@ void() movetarget_f =
/*QUAKED path_corner (0.5 0.3 0) (-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. Monsters will continue walking towards the next target corner.
*/ */
void() path_corner = void ()
path_corner =
{ {
movetarget_f (); movetarget_f ();
}; };

View file

@ -16,7 +16,8 @@ SpectatorConnect
called when a spectator connects to a server called when a spectator connects to a server
============ ============
*/ */
void() SpectatorConnect = void ()
SpectatorConnect =
{ {
bprint (PRINT_MEDIUM, "Spectator "); bprint (PRINT_MEDIUM, "Spectator ");
bprint (PRINT_MEDIUM, self.netname); bprint (PRINT_MEDIUM, self.netname);
@ -32,7 +33,8 @@ SpectatorDisconnect
called when a spectator disconnects from a server called when a spectator disconnects from a server
============ ============
*/ */
void() SpectatorDisconnect = void ()
SpectatorDisconnect =
{ {
bprint (PRINT_MEDIUM, "Spectator "); bprint (PRINT_MEDIUM, "Spectator ");
bprint (PRINT_MEDIUM, self.netname); bprint (PRINT_MEDIUM, self.netname);
@ -46,7 +48,8 @@ SpectatorImpulseCommand
Called by SpectatorThink if the spectator entered an impulse Called by SpectatorThink if the spectator entered an impulse
================ ================
*/ */
void() SpectatorImpulseCommand = void ()
SpectatorImpulseCommand =
{ {
if (self.impulse == 1) { if (self.impulse == 1) {
// teleport the spectator to the next spawn point // teleport the spectator to the next spawn point
@ -73,7 +76,8 @@ SpectatorThink
Called every frame after physics are run Called every frame after physics are run
================ ================
*/ */
void() SpectatorThink = void ()
SpectatorThink =
{ {
// self.origin, etc contains spectator position, so you could // self.origin, etc contains spectator position, so you could
// do some neat stuff here // do some neat stuff here

View file

@ -1,12 +1,17 @@
void () SUB_Null = {}; void () SUB_Null = {};
void() SUB_Remove = {remove(self);}; void ()
SUB_Remove =
{
remove (self);
};
/* /*
QuakeEd only writes a single float for angles (bad idea), so up and down are QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles. just constant angles.
*/ */
vector() SetMovedir = vector ()
SetMovedir =
{ {
if (self.angles == '0 -1 0') if (self.angles == '0 -1 0')
self.movedir = '0 0 1'; self.movedir = '0 0 1';
@ -20,7 +25,8 @@ vector() SetMovedir =
self.angles = '0 0 0'; self.angles = '0 0 0';
}; };
void() InitTrigger = void ()
InitTrigger =
{ {
// trigger angles are used for one-way touches. An angle of 0 is assumed // trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead. // to mean no restrictions, so use a yaw of 360 instead.
@ -41,7 +47,8 @@ calculate self.velocity and self.nextthink to reach dest from
self.origin traveling at speed self.origin traveling at speed
=============== ===============
*/ */
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt = void (entity ent, vector tdest, float tspeed, void () func)
SUB_CalcMoveEnt =
{ {
local entity stemp; local entity stemp;
stemp = self; stemp = self;
@ -51,7 +58,8 @@ void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
self = stemp; self = stemp;
}; };
void(vector tdest, float tspeed, void() func) SUB_CalcMove = void (vector tdest, float tspeed, void () func)
SUB_CalcMove =
{ {
local float len, traveltime; local float len, traveltime;
local vector vdestdelta; local vector vdestdelta;
@ -89,7 +97,8 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove =
}; };
// After moving, set origin to exact final destination // After moving, set origin to exact final destination
void() SUB_CalcMoveDone = void ()
SUB_CalcMoveDone =
{ {
setorigin (self, self.finaldest); setorigin (self, self.finaldest);
self.velocity = '0 0 0'; self.velocity = '0 0 0';
@ -108,7 +117,8 @@ self.angles rotating
The calling function should make sure self.think is valid The calling function should make sure self.think is valid
=============== ===============
*/ */
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt = void (entity ent, vector destangle, float tspeed, void () func)
SUB_CalcAngleMoveEnt =
{ {
local entity stemp; local entity stemp;
stemp = self; stemp = self;
@ -117,7 +127,8 @@ void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveE
self = stemp; self = stemp;
}; };
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = void (vector destangle, float tspeed, void () func)
SUB_CalcAngleMove =
{ {
local vector destdelta; local vector destdelta;
local float len, traveltime; local float len, traveltime;
@ -146,7 +157,8 @@ void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
}; };
// After rotating, set angle to exact final angle // After rotating, set angle to exact final angle
void() SUB_CalcAngleMoveDone = void ()
SUB_CalcAngleMoveDone =
{ {
self.angles = self.finalangle; self.angles = self.finalangle;
self.avelocity = '0 0 0'; self.avelocity = '0 0 0';
@ -157,7 +169,8 @@ void() SUB_CalcAngleMoveDone =
//============================================================================= //=============================================================================
void() DelayThink = void ()
DelayThink =
{ {
local integer rem = self.killtarget != self.targetname; local integer rem = self.killtarget != self.targetname;
activator = self.enemy; activator = self.enemy;
@ -185,7 +198,8 @@ match (string)self.target and call their .use function
============================== ==============================
*/ */
void() SUB_UseTargets = void ()
SUB_UseTargets =
{ {
local entity act, otemp, stemp, t; local entity act, otemp, stemp, t;

View file

@ -1,6 +1,7 @@
entity stemp, otemp, s, old; entity stemp, otemp, s, old;
void() trigger_reactivate = void ()
trigger_reactivate =
{ {
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;
}; };
@ -11,7 +12,8 @@ float SPAWNFLAG_NOMESSAGE = 1;
float SPAWNFLAG_NOTOUCH = 1; float SPAWNFLAG_NOTOUCH = 1;
// the wait time has passed, so set back up for another activation // the wait time has passed, so set back up for another activation
void() multi_wait = void ()
multi_wait =
{ {
if (self.max_health) { if (self.max_health) {
self.health = self.max_health; self.health = self.max_health;
@ -23,7 +25,8 @@ void() multi_wait =
// the trigger was just touched/killed/used // the trigger was just touched/killed/used
// self.enemy should be set to the activator so it can be held through a delay // self.enemy should be set to the activator so it can be held through a delay
// so wait for the delay time before firing // so wait for the delay time before firing
void() multi_trigger = void ()
multi_trigger =
{ {
if (self.nextthink > time) if (self.nextthink > time)
return; // allready been triggered return; // allready been triggered
@ -31,7 +34,7 @@ void() multi_trigger =
if (self.classname == "trigger_secret") { if (self.classname == "trigger_secret") {
if (self.enemy.classname != "player") if (self.enemy.classname != "player")
return; return;
found_secrets = found_secrets + 1; found_secrets++;
WriteByte (MSG_ALL, SVC_FOUNDSECRET); WriteByte (MSG_ALL, SVC_FOUNDSECRET);
} }
@ -56,19 +59,22 @@ void() multi_trigger =
} }
}; };
void() multi_killed = void ()
multi_killed =
{ {
self.enemy = damage_attacker; self.enemy = damage_attacker;
multi_trigger (); multi_trigger ();
}; };
void() multi_use = void ()
multi_use =
{ {
self.enemy = activator; self.enemy = activator;
multi_trigger (); multi_trigger ();
}; };
void() multi_touch = void ()
multi_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -97,7 +103,8 @@ sounds
4) 4)
set "message" to text string set "message" to text string
*/ */
void() trigger_multiple = void ()
trigger_multiple =
{ {
switch (self.sounds) { switch (self.sounds) {
case 1: case 1:
@ -148,7 +155,8 @@ sounds
4) 4)
set "message" to text string set "message" to text string
*/ */
void() trigger_once = void ()
trigger_once =
{ {
self.wait = -1; self.wait = -1;
trigger_multiple (); trigger_multiple ();
@ -159,7 +167,8 @@ void() trigger_once =
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) /*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/ */
void() trigger_relay = void ()
trigger_relay =
{ {
self.use = SUB_UseTargets; self.use = SUB_UseTargets;
}; };
@ -175,9 +184,10 @@ sounds
4) 4)
set "message" to text string set "message" to text string
*/ */
void() trigger_secret = void ()
trigger_secret =
{ {
total_secrets = total_secrets + 1; total_secrets++;
self.wait = -1; self.wait = -1;
if (!self.message) if (!self.message)
self.message = "You found a secret area!"; self.message = "You found a secret area!";
@ -201,9 +211,10 @@ void() trigger_secret =
//============================================================================= //=============================================================================
void() counter_use = void ()
counter_use =
{ {
self.count = self.count - 1; self.count--;
if (self.count < 0) if (self.count < 0)
return; return;
@ -242,7 +253,8 @@ If nomessage is not set, t will print "1 more.. " etc when triggered and "sequen
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/ */
void() trigger_counter = void ()
trigger_counter =
{ {
self.wait = -1; self.wait = -1;
if (!self.count) if (!self.count)
@ -256,7 +268,8 @@ void() trigger_counter =
float PLAYER_ONLY = 1; float PLAYER_ONLY = 1;
float SILENT = 2; float SILENT = 2;
void() play_teleport = void ()
play_teleport =
{ {
local float v; local float v;
local string tmpstr; local string tmpstr;
@ -277,7 +290,8 @@ void() play_teleport =
remove (self); remove (self);
}; };
void(vector org) spawn_tfog = void (vector org)
spawn_tfog =
{ {
s = spawn (); s = spawn ();
s.origin = org; s.origin = org;
@ -289,7 +303,8 @@ void(vector org) spawn_tfog =
multicast (org, MULTICAST_PHS); multicast (org, MULTICAST_PHS);
}; };
void() tdeath_touch = void ()
tdeath_touch =
{ {
local entity other2; local entity other2;
@ -320,8 +335,8 @@ void() tdeath_touch =
T_Damage (other, self, self, 50000); T_Damage (other, self, self, 50000);
}; };
void (vector org, entity death_owner)
void(vector org, entity death_owner) spawn_tdeath = spawn_tdeath =
{ {
local entity death; local entity death;
@ -340,7 +355,8 @@ void(vector org, entity death_owner) spawn_tdeath =
force_retouch = 2; // make sure even still objects get hit force_retouch = 2; // make sure even still objects get hit
}; };
void() teleport_touch = void ()
teleport_touch =
{ {
local entity t; local entity t;
local vector org; local vector org;
@ -395,7 +411,8 @@ void() teleport_touch =
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32) /*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field. This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field.
*/ */
void() info_teleport_destination = void ()
info_teleport_destination =
{ {
// this does nothing, just serves as a target spot // this does nothing, just serves as a target spot
self.mangle = self.angles; self.mangle = self.angles;
@ -406,7 +423,8 @@ void() info_teleport_destination =
objerror ("no targetname"); objerror ("no targetname");
}; };
void() teleport_use = void ()
teleport_use =
{ {
self.nextthink = time + 0.2; self.nextthink = time + 0.2;
force_retouch = 2; // make sure even still objects get hit force_retouch = 2; // make sure even still objects get hit
@ -418,7 +436,8 @@ Any object touching this will be transported to the corresponding info_teleport_
If the trigger_teleport has a targetname, it will only teleport entities when it has been fired. If the trigger_teleport has a targetname, it will only teleport entities when it has been fired.
*/ */
void() trigger_teleport = void ()
trigger_teleport =
{ {
local vector o; local vector o;
@ -442,14 +461,16 @@ void() trigger_teleport =
sets skill level to the value of "message". sets skill level to the value of "message".
Only used on start map. Only used on start map.
*/ */
void() trigger_setskill = void ()
trigger_setskill =
{ {
remove (self); remove (self);
}; };
// ONLY REGISTERED TRIGGERS =================================================== // ONLY REGISTERED TRIGGERS ===================================================
void() trigger_onlyregistered_touch = void ()
trigger_onlyregistered_touch =
{ {
if (other.classname != "player") if (other.classname != "player")
return; return;
@ -474,7 +495,8 @@ void() trigger_onlyregistered_touch =
/*QUAKED trigger_onlyregistered (.5 .5 .5) ? /*QUAKED trigger_onlyregistered (.5 .5 .5) ?
Only fires if playing the registered version, otherwise prints the message Only fires if playing the registered version, otherwise prints the message
*/ */
void() trigger_onlyregistered = void ()
trigger_onlyregistered =
{ {
precache_sound ("misc/talk.wav"); precache_sound ("misc/talk.wav");
InitTrigger (); InitTrigger ();
@ -483,13 +505,15 @@ void() trigger_onlyregistered =
//============================================================================ //============================================================================
void() hurt_on = void ()
hurt_on =
{ {
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;
self.nextthink = -1; self.nextthink = -1;
}; };
void() hurt_touch = void ()
hurt_touch =
{ {
if (other.takedamage) { if (other.takedamage) {
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
@ -506,7 +530,8 @@ Any object touching this will be hurt
set dmg to damage amount set dmg to damage amount
defalt dmg = 5 defalt dmg = 5
*/ */
void() trigger_hurt = void ()
trigger_hurt =
{ {
InitTrigger (); InitTrigger ();
self.touch = hurt_touch; self.touch = hurt_touch;
@ -518,7 +543,8 @@ void() trigger_hurt =
float PUSH_ONCE = 1; float PUSH_ONCE = 1;
void() trigger_push_touch = void ()
trigger_push_touch =
{ {
if (other.classname == "grenade") if (other.classname == "grenade")
other.velocity = self.speed * self.movedir * 10; other.velocity = self.speed * self.movedir * 10;
@ -538,7 +564,8 @@ void() trigger_push_touch =
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE /*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player Pushes the player
*/ */
void() trigger_push = void ()
trigger_push =
{ {
InitTrigger (); InitTrigger ();
precache_sound ("ambience/windfly.wav"); precache_sound ("ambience/windfly.wav");
@ -549,7 +576,8 @@ void() trigger_push =
//============================================================================ //============================================================================
void() trigger_monsterjump_touch = void ()
trigger_monsterjump_touch =
{ {
if (other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER) if (other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER)
return; return;
@ -561,7 +589,7 @@ void() trigger_monsterjump_touch =
if (!(other.flags & FL_ONGROUND)) if (!(other.flags & FL_ONGROUND))
return; return;
other.flags = other.flags - FL_ONGROUND; other.flags &= ~FL_ONGROUND;
other.velocity_z = self.height; other.velocity_z = self.height;
}; };
@ -571,7 +599,8 @@ Walking monsters that touch this will jump in the direction of the trigger's ang
"speed" default to 200, the speed thrown forward "speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards "height" default to 200, the speed thrown upwards
*/ */
void() trigger_monsterjump = void ()
trigger_monsterjump =
{ {
if (!self.speed) if (!self.speed)
self.speed = 200; self.speed = 200;

View file

@ -1,11 +1,13 @@
void (entity targ, entity inflictor, entity attacker, float damage) T_Damage; void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
void () player_run; void () player_run;
void(entity bomb, entity attacker, float rad, entity ignore, string dtype) T_RadiusDamage; void (entity bomb, entity attacker, float rad, entity ignore, string dtype)
T_RadiusDamage;
void (vector org, float damage) SpawnBlood; void (vector org, float damage) SpawnBlood;
void () SuperDamageSound; void () SuperDamageSound;
// called by worldspawn // called by worldspawn
void() W_Precache = void ()
W_Precache =
{ {
precache_sound ("weapons/r_exp3.wav"); // new rocket explosion precache_sound ("weapons/r_exp3.wav"); // new rocket explosion
precache_sound ("weapons/rocket1i.wav"); // spike gun precache_sound ("weapons/rocket1i.wav"); // spike gun
@ -21,12 +23,14 @@ void() W_Precache =
precache_sound ("weapons/shotgn2.wav"); // super shotgun precache_sound ("weapons/shotgn2.wav"); // super shotgun
}; };
float() crandom = float ()
crandom =
{ {
return 2 * (random () - 0.5); return 2 * (random () - 0.5);
}; };
void() W_FireAxe = void ()
W_FireAxe =
{ {
local vector org, source; local vector org, source;
@ -56,7 +60,8 @@ void() W_FireAxe =
//============================================================================ //============================================================================
vector() wall_velocity = vector ()
wall_velocity =
{ {
local vector vel; local vector vel;
@ -69,7 +74,8 @@ vector() wall_velocity =
return vel; return vel;
}; };
void(vector org, vector vel) SpawnMeatSpray = void (vector org, vector vel)
SpawnMeatSpray =
{ {
local entity missile; local entity missile;
@ -94,14 +100,16 @@ void(vector org, vector vel) SpawnMeatSpray =
setorigin (missile, org); setorigin (missile, org);
}; };
void(vector org, float damage) SpawnBlood = void (vector org, float damage)
SpawnBlood =
{ {
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_BLOOD, 1.0); WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_BLOOD, 1.0);
WriteCoordV (MSG_MULTICAST, org); WriteCoordV (MSG_MULTICAST, org);
multicast (org, MULTICAST_PVS); multicast (org, MULTICAST_PVS);
}; };
void(float damage) spawn_touchblood = void (float damage)
spawn_touchblood =
{ {
local vector vel; local vector vel;
@ -126,7 +134,8 @@ float blood_count;
vector puff_org; vector puff_org;
float puff_count; float puff_count;
void() ClearMultiDamage = void ()
ClearMultiDamage =
{ {
multi_ent = world; multi_ent = world;
multi_damage = 0; multi_damage = 0;
@ -134,14 +143,16 @@ void() ClearMultiDamage =
puff_count = 0; puff_count = 0;
}; };
void() ApplyMultiDamage = void ()
ApplyMultiDamage =
{ {
if (!multi_ent) if (!multi_ent)
return; return;
T_Damage (multi_ent, self, self, multi_damage); T_Damage (multi_ent, self, self, multi_damage);
}; };
void(entity hit, float damage) AddMultiDamage = void (entity hit, float damage)
AddMultiDamage =
{ {
if (!hit) if (!hit)
return; return;
@ -154,7 +165,8 @@ void(entity hit, float damage) AddMultiDamage =
multi_damage = multi_damage + damage; multi_damage = multi_damage + damage;
}; };
void() Multi_Finish = void ()
Multi_Finish =
{ {
if (puff_count) { if (puff_count) {
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, puff_count); WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, puff_count);
@ -171,7 +183,8 @@ void() Multi_Finish =
// BULLETS ==================================================================== // BULLETS ====================================================================
void(float damage, vector dir) TraceAttack = void (float damage, vector dir)
TraceAttack =
{ {
local vector org, vel; local vector org, vel;
@ -182,11 +195,11 @@ void(float damage, vector dir) TraceAttack =
org = trace_endpos - dir * 4; org = trace_endpos - dir * 4;
if (trace_ent.takedamage) { if (trace_ent.takedamage) {
blood_count = blood_count + 1; blood_count++;
blood_org = org; blood_org = org;
AddMultiDamage (trace_ent, damage); AddMultiDamage (trace_ent, damage);
} else { } else {
puff_count = puff_count + 1; puff_count++;
} }
}; };
@ -198,7 +211,8 @@ Used by shotgun, super shotgun, and enemy soldier firing
Go to the trouble of combining multiple pellets into a single damage call. Go to the trouble of combining multiple pellets into a single damage call.
================ ================
*/ */
void(float shotcount, vector dir, vector spread) FireBullets = void (float shotcount, vector dir, vector spread)
FireBullets =
{ {
local vector direction, src; local vector direction, src;
@ -219,13 +233,14 @@ void(float shotcount, vector dir, vector spread) FireBullets =
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
TraceAttack (4, direction); TraceAttack (4, direction);
shotcount = shotcount - 1; shotcount--;
} }
ApplyMultiDamage (); ApplyMultiDamage ();
Multi_Finish (); Multi_Finish ();
}; };
void() W_FireShotgun = void ()
W_FireShotgun =
{ {
local vector dir; local vector dir;
@ -235,13 +250,14 @@ void() W_FireShotgun =
WriteByte (MSG_ONE, SVC_SMALLKICK); WriteByte (MSG_ONE, SVC_SMALLKICK);
if (deathmatch != 4 ) if (deathmatch != 4 )
self.currentammo = self.ammo_shells = self.ammo_shells - 1; self.currentammo = self.ammo_shells--;
dir = aim (self, 100000); dir = aim (self, 100000);
FireBullets (6, dir, '0.04 0.04 0'); FireBullets (6, dir, '0.04 0.04 0');
}; };
void() W_FireSuperShotgun = void ()
W_FireSuperShotgun =
{ {
local vector dir; local vector dir;
@ -256,14 +272,15 @@ void() W_FireSuperShotgun =
WriteByte (MSG_ONE, SVC_BIGKICK); WriteByte (MSG_ONE, SVC_BIGKICK);
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_shells = self.ammo_shells - 2; self.currentammo = self.ammo_shells -= 2;
dir = aim (self, 100000); dir = aim (self, 100000);
FireBullets (14, dir, '0.14 0.08 0'); FireBullets (14, dir, '0.14 0.08 0');
}; };
// ROCKETS ==================================================================== // ROCKETS ====================================================================
void() T_MissileTouch = void ()
T_MissileTouch =
{ {
local float damg; local float damg;
@ -282,7 +299,6 @@ void() T_MissileTouch =
if (other == self.owner) if (other == self.owner)
return; // don't explode on owner return; // don't explode on owner
if (self.voided) if (self.voided)
return; return;
self.voided = 1; self.voided = 1;
@ -314,10 +330,11 @@ void() T_MissileTouch =
remove (self); remove (self);
}; };
void() W_FireRocket = void ()
W_FireRocket =
{ {
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; self.currentammo = self.ammo_rockets--;
sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
@ -350,7 +367,8 @@ void() W_FireRocket =
// LIGHTNING ================================================================== // LIGHTNING ==================================================================
void(entity from, float damage) LightningHit = void (entity from, float damage)
LightningHit =
{ {
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_LIGHTNINGBLOOD); WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_LIGHTNINGBLOOD);
WriteCoordV (MSG_MULTICAST, trace_endpos); WriteCoordV (MSG_MULTICAST, trace_endpos);
@ -359,7 +377,8 @@ void(entity from, float damage) LightningHit =
T_Damage (trace_ent, from, from, damage); T_Damage (trace_ent, from, from, damage);
}; };
void(vector p1, vector p2, entity from, float damage) LightningDamage = void (vector p1, vector p2, entity from, float damage)
LightningDamage =
{ {
local entity e1, e2; local entity e1, e2;
local vector f; local vector f;
@ -395,8 +414,8 @@ void(vector p1, vector p2, entity from, float damage) LightningDamage =
LightningHit (from, damage); LightningHit (from, damage);
}; };
void ()
void() W_FireLightning = W_FireLightning =
{ {
local float cells; local float cells;
local vector org; local vector org;
@ -437,7 +456,7 @@ void() W_FireLightning =
WriteByte (MSG_ONE, SVC_SMALLKICK); WriteByte (MSG_ONE, SVC_SMALLKICK);
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_cells = self.ammo_cells - 1; self.currentammo = self.ammo_cells--;
org = self.origin + '0 0 16'; org = self.origin + '0 0 16';
@ -454,7 +473,8 @@ void() W_FireLightning =
//============================================================================= //=============================================================================
void() GrenadeExplode = void ()
GrenadeExplode =
{ {
if (self.voided) if (self.voided)
return; return;
@ -469,7 +489,8 @@ void() GrenadeExplode =
remove (self); remove (self);
}; };
void() GrenadeTouch = void ()
GrenadeTouch =
{ {
if (other == self.owner) if (other == self.owner)
return; // don't explode on owner return; // don't explode on owner
@ -477,16 +498,18 @@ void() GrenadeTouch =
GrenadeExplode (); GrenadeExplode ();
return; return;
} }
// bounce sound // bounce sound
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
if (self.velocity == '0 0 0') if (self.velocity == '0 0 0')
self.avelocity = '0 0 0'; self.avelocity = '0 0 0';
}; };
void() W_FireGrenade = void ()
W_FireGrenade =
{ {
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; self.currentammo = self.ammo_rockets--;
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
@ -546,7 +569,8 @@ launch_spike
Used for both the player and the ogre Used for both the player and the ogre
=============== ===============
*/ */
void(vector org, vector dir) launch_spike = void (vector org, vector dir)
launch_spike =
{ {
newmis = spawn (); newmis = spawn ();
newmis.voided = 0; newmis.voided = 0;
@ -567,14 +591,15 @@ void(vector org, vector dir) launch_spike =
newmis.velocity = dir * 1000; newmis.velocity = dir * 1000;
}; };
void() W_FireSuperSpikes = void ()
W_FireSuperSpikes =
{ {
local vector dir; local vector dir;
sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
self.attack_finished = time + 0.2; self.attack_finished = time + 0.2;
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_nails = self.ammo_nails - 2; self.currentammo = self.ammo_nails -= 2;
dir = aim (self, 1000); dir = aim (self, 1000);
launch_spike (self.origin + '0 0 16', dir); launch_spike (self.origin + '0 0 16', dir);
newmis.touch = superspike_touch; newmis.touch = superspike_touch;
@ -584,7 +609,8 @@ void() W_FireSuperSpikes =
WriteByte (MSG_ONE, SVC_SMALLKICK); WriteByte (MSG_ONE, SVC_SMALLKICK);
}; };
void(float ox) W_FireSpikes = void (float ox)
W_FireSpikes =
{ {
local vector dir; local vector dir;
@ -604,7 +630,7 @@ void(float ox) W_FireSpikes =
sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
self.attack_finished = time + 0.2; self.attack_finished = time + 0.2;
if (deathmatch != 4) if (deathmatch != 4)
self.currentammo = self.ammo_nails = self.ammo_nails - 1; self.currentammo = self.ammo_nails--;
dir = aim (self, 1000); dir = aim (self, 1000);
launch_spike (self.origin + '0 0 16' + v_right * ox, dir); launch_spike (self.origin + '0 0 16' + v_right * ox, dir);
@ -613,7 +639,8 @@ void(float ox) W_FireSpikes =
}; };
.float hit_z; .float hit_z;
void() spike_touch = void ()
spike_touch =
{ {
if (other == self.owner) if (other == self.owner)
return; return;
@ -623,7 +650,6 @@ void() spike_touch =
if (other.solid == SOLID_TRIGGER) if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing return; // trigger field, do nothing
if (pointcontents (self.origin) == CONTENT_SKY) { if (pointcontents (self.origin) == CONTENT_SKY) {
remove (self); remove (self);
return; return;
@ -656,7 +682,8 @@ void() spike_touch =
remove (self); remove (self);
}; };
void() superspike_touch = void ()
superspike_touch =
{ {
if (other == self.owner) if (other == self.owner)
return; return;
@ -666,7 +693,6 @@ void() superspike_touch =
if (other.solid == SOLID_TRIGGER) if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing return; // trigger field, do nothing
if (pointcontents (self.origin) == CONTENT_SKY) { if (pointcontents (self.origin) == CONTENT_SKY) {
remove (self); remove (self);
return; return;
@ -688,7 +714,8 @@ void() superspike_touch =
// PLAYER WEAPON USE ========================================================== // PLAYER WEAPON USE ==========================================================
void() W_SetCurrentAmmo = void ()
W_SetCurrentAmmo =
{ {
player_run (); // get out of any weapon firing states player_run (); // get out of any weapon firing states
@ -750,7 +777,8 @@ void() W_SetCurrentAmmo =
} }
}; };
float() W_BestWeapon = float ()
W_BestWeapon =
{ {
local float it; local float it;
@ -776,11 +804,11 @@ float() W_BestWeapon =
return IT_AXE; return IT_AXE;
}; };
float() W_CheckNoAmmo = float ()
W_CheckNoAmmo =
{ {
if (self.currentammo > 0) if (self.currentammo > 0)
return TRUE; return TRUE;
if (self.weapon == IT_AXE) if (self.weapon == IT_AXE)
return TRUE; return TRUE;
@ -808,7 +836,8 @@ void() player_nail1;
void () player_light1; void () player_light1;
void () player_rocket1; void () player_rocket1;
void() W_Attack = void ()
W_Attack =
{ {
local float r; local float r;
@ -868,7 +897,8 @@ void() W_Attack =
} }
}; };
void() CheatCommand = void ()
CheatCommand =
{ {
// if (deathmatch || coop) // if (deathmatch || coop)
return; return;
@ -893,7 +923,8 @@ CycleWeaponCommand
Go to the next weapon with ammo Go to the next weapon with ammo
============ ============
*/ */
void() CycleWeaponCommand = void ()
CycleWeaponCommand =
{ {
local float am; local float am;
@ -957,7 +988,8 @@ CycleWeaponReverseCommand
Go to the prev weapon with ammo Go to the prev weapon with ammo
============ ============
*/ */
void() CycleWeaponReverseCommand = void ()
CycleWeaponReverseCommand =
{ {
local float am; local float am;
@ -1020,12 +1052,14 @@ ServerflagsCommand
Just for development Just for development
============ ============
*/ */
void() ServerflagsCommand = void ()
ServerflagsCommand =
{ {
serverflags = serverflags * 2 + 1; serverflags = serverflags * 2 + 1;
}; };
void() ImpulseCommands = void ()
ImpulseCommands =
{ {
local float am = 0, fl = 0; local float am = 0, fl = 0;
@ -1110,7 +1144,8 @@ W_WeaponFrame
Called every frame so impulse events can be handled as well as possible Called every frame so impulse events can be handled as well as possible
============ ============
*/ */
void() W_WeaponFrame = void ()
W_WeaponFrame =
{ {
if (time < self.attack_finished) if (time < self.attack_finished)
return; return;
@ -1131,7 +1166,8 @@ SuperDamageSound
Plays sound if needed Plays sound if needed
======== ========
*/ */
void() SuperDamageSound = void ()
SuperDamageSound =
{ {
if (self.super_damage_finished > time) { if (self.super_damage_finished > time) {
if (self.super_sound < time) { if (self.super_sound < time) {

View file

@ -14,7 +14,8 @@ World Types:
2: base 2: base
*/ */
//======================= //=======================
void() worldspawn = void ()
worldspawn =
{ {
lastspawn = world; lastspawn = world;
InitBodyQueue (); InitBodyQueue ();
@ -185,26 +186,29 @@ void() worldspawn =
lightstyle (63, "a"); lightstyle (63, "a");
}; };
void() StartFrame = void ()
StartFrame =
{ {
timelimit = cvar ("timelimit") * 60; timelimit = cvar ("timelimit") * 60;
fraglimit = cvar ("fraglimit"); fraglimit = cvar ("fraglimit");
teamplay = cvar ("teamplay"); teamplay = cvar ("teamplay");
deathmatch = cvar ("deathmatch"); deathmatch = cvar ("deathmatch");
framecount = framecount + 1; framecount++;
}; };
// BODY QUE =================================================================== // BODY QUE ===================================================================
entity bodyqueue_head; entity bodyqueue_head;
void() bodyqueue = void ()
bodyqueue =
{ {
// just here so spawn functions don't complain after world creates bodyqueues // just here so spawn functions don't complain after world creates bodyqueues
}; };
void() InitBodyQueue = void ()
InitBodyQueue =
{ {
bodyqueue_head = spawn (); bodyqueue_head = spawn ();
bodyqueue_head.classname = "bodyqueue"; bodyqueue_head.classname = "bodyqueue";
@ -218,7 +222,8 @@ void() InitBodyQueue =
}; };
// make body queue entry for the given ent so it can be respawned elsewhere // make body queue entry for the given ent so it can be respawned elsewhere
void(entity ent) CopyToBodyQueue = void (entity ent)
CopyToBodyQueue =
{ {
bodyqueue_head.angles = ent.angles; bodyqueue_head.angles = ent.angles;
bodyqueue_head.model = ent.model; bodyqueue_head.model = ent.model;