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
void() button_wait;
void() button_return;
void ()
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.nextthink = self.ltime + self.wait;
@ -13,25 +27,14 @@ void() button_wait =
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 =
{
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 =
void ()
button_fire =
{
if (self.state == STATE_UP || self.state == STATE_TOP)
return;
@ -42,13 +45,15 @@ void() button_fire =
SUB_CalcMove (self.pos2, self.speed, button_wait);
};
void() button_use =
void ()
button_use =
{
self.enemy = activator;
button_fire ();
};
void() button_touch =
void ()
button_touch =
{
if (other.classname != "player")
return;
@ -56,7 +61,8 @@ void() button_touch =
button_fire ();
};
void() button_killed =
void ()
button_killed =
{
self.enemy = damage_attacker;
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
3) in-out
*/
void() func_button =
void ()
func_button =
{
switch (self.sounds) {
case 0:
@ -127,6 +134,6 @@ void() func_button =
self.state = STATE_BOTTOM;
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);
};

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

View file

@ -17,10 +17,56 @@ Door.enemy chains from the master door through all doors linked in the chain.
// THINK FUNCTIONS ============================================================
void() door_go_down;
void() door_go_up;
void ()
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";
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 =======================================================
void() door_fire =
void ()
door_fire =
{
local entity oself, starte;
@ -119,7 +121,8 @@ void() door_fire =
self = oself;
};
void() door_use =
void ()
door_use =
{
local entity oself;
@ -133,7 +136,8 @@ void() door_use =
self = oself;
};
void() door_trigger_touch =
void ()
door_trigger_touch =
{
if (other.health <= 0)
return;
@ -148,7 +152,8 @@ void() door_trigger_touch =
door_use ();
};
void() door_killed =
void ()
door_killed =
{
local entity oself;
@ -167,7 +172,8 @@ door_touch
Prints messages and opens key doors
================
*/
void() door_touch =
void ()
door_touch =
{
if (other.classname != "player")
return;
@ -232,10 +238,10 @@ void() door_touch =
// SPAWNING FUNCTIONS =========================================================
entity(vector fmins, vector fmaxs) spawn_field =
entity (vector fmins, vector fmaxs)
spawn_field =
{
local entity trigger;
local vector t1, t2;
trigger = spawn ();
trigger.movetype = MOVETYPE_NONE;
@ -243,13 +249,12 @@ entity(vector fmins, vector fmaxs) spawn_field =
trigger.owner = self;
trigger.touch = door_trigger_touch;
t1 = fmins;
t2 = fmaxs;
setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
setsize (trigger, fmins - '60 60 8', fmaxs + '60 60 8');
return (trigger);
};
float (entity e1, entity e2) EntitiesTouching =
float (entity e1, entity e2)
EntitiesTouching =
{
if (e1.mins_x > e2.maxs_x)
return FALSE;
@ -266,7 +271,8 @@ float (entity e1, entity e2) EntitiesTouching =
return TRUE;
};
void() LinkDoors =
void ()
LinkDoors =
{
local entity t, starte;
local vector cmins, cmaxs;
@ -362,7 +368,8 @@ Key doors are allways wait -1.
3) stone chain
4) screechy metal
*/
void() func_door =
void ()
func_door =
{
switch (world.worldtype) {
case 0:
@ -480,12 +487,6 @@ void() func_door =
// 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;
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_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;
@ -542,58 +596,14 @@ void () fd_secret_use =
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 ();
};
// 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);
};
// 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 =
void ()
fd_secret_done =
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) {
self.health = 10000;
@ -605,7 +615,8 @@ void () fd_secret_done =
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void () secret_blocked =
void ()
secret_blocked =
{
if (time < self.attack_finished)
return;
@ -622,7 +633,8 @@ secret_touch
Prints messages
================
*/
void() secret_touch =
void ()
secret_touch =
{
if (other.classname != "player")
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
3) base
*/
void () func_door_secret =
void ()
func_door_secret =
{
switch (self.sounds) {
case 1:

View file

@ -3,18 +3,21 @@ void() W_SetCurrentAmmo;
/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
BE .8 .3 .4 IN COLOR */
void() SUB_regen =
void ()
SUB_regen =
{
self.model = self.mdl; // restore original model
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);
};
/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
prints a warning message when spawned
*/
void() noclass =
void ()
noclass =
{
dprint ("noclass spawned at");
dprint (vtos (self.origin));
@ -22,7 +25,8 @@ void() noclass =
remove (self);
};
void() q_touch =
void ()
q_touch =
{
local string s;
@ -62,7 +66,8 @@ void() q_touch =
SUB_UseTargets (); // fire all targets / killtargets
};
void(float timeleft) DropQuad =
void (float timeleft)
DropQuad =
{
local entity item;
@ -86,7 +91,8 @@ void(float timeleft) DropQuad =
item.think = SUB_Remove;
};
void() r_touch =
void ()
r_touch =
{
local string s;
@ -116,7 +122,8 @@ void() r_touch =
SUB_UseTargets (); // fire all targets / killtargets
};
void(float timeleft) DropRing =
void (float timeleft)
DropRing =
{
local entity item;
@ -146,7 +153,8 @@ PlaceItem
plants the object on the floor
============
*/
void() PlaceItem =
void ()
PlaceItem =
{
local float oldz;
@ -173,7 +181,8 @@ StartItem
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.think = PlaceItem;
@ -181,10 +190,14 @@ void() StartItem =
// 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
// "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)
return 0;
@ -201,49 +214,29 @@ float (entity e, float healamount, float ignore) T_Heal =
return 1;
};
/*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.
*/
float H_ROTTEN = 1;
float H_MEGA = 2;
.float healamount, healtype;
void() health_touch;
void() item_megahealth_rot;
void() item_health =
void ()
item_megahealth_rot =
{
self.touch = health_touch;
other = self.owner;
if (self.spawnflags & H_ROTTEN) {
precache_model ("maps/b_bh10.bsp");
precache_sound ("items/r_item1.wav");
setmodel (self, "maps/b_bh10.bsp");
self.noise = "items/r_item1.wav";
self.healamount = 15;
self.healtype = 0;
} else if (self.spawnflags & H_MEGA) {
precache_model ("maps/b_bh100.bsp");
precache_sound ("items/r_item2.wav");
setmodel (self, "maps/b_bh100.bsp");
self.noise = "items/r_item2.wav";
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;
if (other.health > other.max_health) {
other.health = other.health - 1;
self.nextthink = time + 1;
return;
}
// it is possible for a player to die and respawn between rots, so don't
// just blindly subtract the flag off
other.items &= ~IT_SUPERHEALTH;
if (deathmatch != 2) { // deathmatch 2 is silly old rules
self.nextthink = time + 20;
self.think = SUB_regen;
}
setsize (self, '0 0 0', '32 32 56');
StartItem ();
};
void() health_touch =
void ()
health_touch =
{
local string s;
@ -295,29 +288,48 @@ void() health_touch =
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) {
other.health = other.health - 1;
self.nextthink = time + 1;
return;
}
// it is possible for a player to die and respawn between rots, so don't
// just blindly subtract the flag off
other.items &= ~IT_SUPERHEALTH;
if (deathmatch != 2) { // deathmatch 2 is silly old rules
self.nextthink = time + 20;
self.think = SUB_regen;
if (self.spawnflags & H_ROTTEN) {
precache_model ("maps/b_bh10.bsp");
precache_sound ("items/r_item1.wav");
setmodel (self, "maps/b_bh10.bsp");
self.noise = "items/r_item1.wav";
self.healamount = 15;
self.healtype = 0;
} else if (self.spawnflags & H_MEGA) {
precache_model ("maps/b_bh100.bsp");
precache_sound ("items/r_item2.wav");
setmodel (self, "maps/b_bh100.bsp");
self.noise = "items/r_item2.wav";
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 ======================================================================
void() armor_touch =
void ()
armor_touch =
{
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)
*/
void() item_armor1 =
void ()
item_armor1 =
{
self.touch = armor_touch;
precache_model ("progs/armor.mdl");
@ -386,7 +399,8 @@ void() item_armor1 =
/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
*/
void() item_armor2 =
void ()
item_armor2 =
{
self.touch = armor_touch;
precache_model ("progs/armor.mdl");
@ -398,7 +412,8 @@ void() item_armor2 =
/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
*/
void() item_armorInv =
void ()
item_armorInv =
{
self.touch = armor_touch;
precache_model ("progs/armor.mdl");
@ -410,7 +425,8 @@ void() item_armorInv =
// WEAPONS ====================================================================
void() bound_other_ammo =
void ()
bound_other_ammo =
{
if (other.ammo_shells > 100)
other.ammo_shells = 100;
@ -422,7 +438,8 @@ void() bound_other_ammo =
other.ammo_cells = 100;
};
float(float w) RankForWeapon =
float (float w)
RankForWeapon =
{
switch (w) {
case IT_LIGHTNING:
@ -442,7 +459,8 @@ float(float w) RankForWeapon =
}
};
float (float w) WeaponCode =
float (float w)
WeaponCode =
{
switch (w) {
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;
=============
*/
void(float old, float new) Deathmatch_Weapon =
void (float old, float new)
Deathmatch_Weapon =
{
local float or, nr;
@ -484,7 +503,8 @@ void(float old, float new) Deathmatch_Weapon =
float () W_BestWeapon;
void() weapon_touch =
void ()
weapon_touch =
{
local float w_switch, hadammo, leave, best, old, new = 0;
local entity stemp;
@ -603,7 +623,8 @@ void() weapon_touch =
/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
*/
void() weapon_supershotgun =
void ()
weapon_supershotgun =
{
if (deathmatch <= 3) {
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)
*/
void() weapon_nailgun =
void ()
weapon_nailgun =
{
if (deathmatch <= 3) {
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)
*/
void() weapon_supernailgun =
void ()
weapon_supernailgun =
{
if (deathmatch <= 3) {
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)
*/
void() weapon_grenadelauncher =
void ()
weapon_grenadelauncher =
{
if (deathmatch <= 3) {
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)
*/
void() weapon_rocketlauncher =
void ()
weapon_rocketlauncher =
{
if (deathmatch <= 3) {
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)
*/
void() weapon_lightning =
void ()
weapon_lightning =
{
if (deathmatch <= 3) {
precache_model ("progs/g_light.mdl");
@ -693,7 +719,8 @@ void() weapon_lightning =
// AMMO =======================================================================
void() ammo_touch =
void ()
ammo_touch =
{
local entity stemp;
local float best;
@ -776,7 +803,8 @@ float WEAPON_BIG2 = 1;
/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
*/
void() item_shells =
void ()
item_shells =
{
if (deathmatch == 4)
return;
@ -800,7 +828,8 @@ void() item_shells =
/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
*/
void() item_spikes =
void ()
item_spikes =
{
if (deathmatch == 4)
return;
@ -824,7 +853,8 @@ void() item_spikes =
/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
*/
void() item_rockets =
void ()
item_rockets =
{
if (deathmatch == 4)
return;
@ -848,7 +878,8 @@ void() item_rockets =
/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
*/
void() item_cells =
void ()
item_cells =
{
if (deathmatch == 4)
return;
@ -870,14 +901,16 @@ void() item_cells =
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_ROCKET = 2;
float WEAPON_SPIKES = 4;
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;
@ -929,7 +962,8 @@ void() item_weapon =
// KEYS =======================================================================
void() key_touch =
void ()
key_touch =
{
if (other.classname != "player")
return;
@ -953,7 +987,8 @@ void() key_touch =
SUB_UseTargets (); // fire all targets / killtargets
};
void() key_setsounds =
void ()
key_setsounds =
{
switch (world.worldtype) {
case 0:
@ -982,7 +1017,8 @@ following:
1: metal
2: base
*/
void() item_key1 =
void ()
item_key1 =
{
switch (world.worldtype) {
case 0:
@ -1020,7 +1056,8 @@ following:
1: metal
2: base
*/
void() item_key2 =
void ()
item_key2 =
{
switch (world.worldtype) {
case 0:
@ -1050,7 +1087,8 @@ void() item_key2 =
// END OF LEVEL RUNES =========================================================
void() sigil_touch =
void ()
sigil_touch =
{
if (other.classname != "player")
return;
@ -1073,7 +1111,8 @@ void() sigil_touch =
/*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.
*/
void() item_sigil =
void ()
item_sigil =
{
if (!self.spawnflags)
objerror ("no spawnflags");
@ -1105,7 +1144,8 @@ void() item_sigil =
// POWERUPS ===================================================================
void() powerup_touch =
void ()
powerup_touch =
{
if (other.classname != "player")
return;
@ -1163,7 +1203,8 @@ void() powerup_touch =
/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
Player is invulnerable for 30 seconds
*/
void() item_artifact_invulnerability =
void ()
item_artifact_invulnerability =
{
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)
Player takes no damage from water or slime for 30 seconds
*/
void() item_artifact_envirosuit =
void ()
item_artifact_envirosuit =
{
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)
Player is invisible for 30 seconds
*/
void() item_artifact_invisibility =
void ()
item_artifact_invisibility =
{
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)
The next attack from the player will do 4x damage
*/
void() item_artifact_super_damage =
void ()
item_artifact_super_damage =
{
self.touch = powerup_touch;
@ -1242,7 +1286,8 @@ void() item_artifact_super_damage =
// PLAYER BACKPACKS ===========================================================
void() BackpackTouch =
void ()
BackpackTouch =
{
local entity stemp;
local float acount, b_switch, best, old, new;
@ -1384,7 +1429,8 @@ void() BackpackTouch =
W_SetCurrentAmmo ();
};
void() DropBackpack =
void ()
DropBackpack =
{
local entity item;

View file

@ -1,7 +1,8 @@
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for spotlights, etc.
*/
void() info_null =
void ()
info_null =
{
remove (self);
};
@ -9,7 +10,8 @@ void() info_null =
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for lightning.
*/
void() info_notnull =
void ()
info_notnull =
{
};
@ -17,14 +19,15 @@ void() info_notnull =
float START_OFF = 1;
void() light_use =
void ()
light_use =
{
if (self.spawnflags & START_OFF) {
lightstyle (self.style, "m");
self.spawnflags = self.spawnflags - START_OFF;
self.spawnflags &= ~START_OFF;
} else {
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
If targeted, it will toggle between on or off.
*/
void() light =
void ()
light =
{
if (!self.targetname) { // inert light
remove (self);
@ -57,7 +61,8 @@ Default style is 0
If targeted, it will toggle between on or off.
Makes steady fluorescent humming sound
*/
void() light_fluoro =
void ()
light_fluoro =
{
if (self.style >= 32) {
self.use = light_use;
@ -77,7 +82,8 @@ Default light value is 300
Default style is 10
Makes sparking, broken fluorescent sound
*/
void() light_fluorospark =
void ()
light_fluorospark =
{
if (!self.style)
self.style = 10;
@ -91,14 +97,16 @@ Sphere globe light.
Default light value is 300
Default style is 0
*/
void() light_globe =
void ()
light_globe =
{
precache_model ("progs/s_light.spr");
setmodel (self, "progs/s_light.spr");
makestatic (self);
};
void() FireAmbient =
void ()
FireAmbient =
{
precache_sound ("ambience/fire1.wav");
// attenuate fast
@ -110,7 +118,8 @@ Short wall torch
Default light value is 200
Default style is 0
*/
void() light_torch_small_walltorch =
void ()
light_torch_small_walltorch =
{
precache_model ("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)
Large yellow flame ball
*/
void() light_flame_large_yellow =
void ()
light_flame_large_yellow =
{
precache_model ("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
Small yellow flame ball
*/
void() light_flame_small_yellow =
void ()
light_flame_small_yellow =
{
precache_model ("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
Small white flame ball
*/
void() light_flame_small_white =
void ()
light_flame_small_white =
{
precache_model ("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);
remove (self);
};
void() fire_fly =
void ()
fire_fly =
{
local entity fireball;
@ -186,7 +200,8 @@ void() fire_fly =
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
Lava Balls
*/
void() misc_fireball =
void ()
misc_fireball =
{
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
@ -198,7 +213,8 @@ void() misc_fireball =
//============================================================================
void() barrel_explode =
void ()
barrel_explode =
{
self.takedamage = DAMAGE_NO;
self.classname = "explo_box";
@ -214,7 +230,8 @@ void() barrel_explode =
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
TESTING THING
*/
void() misc_explobox =
void ()
misc_explobox =
{
local float oldz;
@ -228,7 +245,7 @@ void() misc_explobox =
self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM;
self.origin_z = self.origin_z + 2;
self.origin_z += 2;
oldz = self.origin_z;
droptofloor ();
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)
Smaller exploding box, REGISTERED ONLY
*/
void() misc_explobox2 =
void ()
misc_explobox2 =
{
local float oldz;
@ -256,7 +274,7 @@ void() misc_explobox2 =
self.th_die = barrel_explode;
self.takedamage = DAMAGE_AIM;
self.origin_z = self.origin_z + 2;
self.origin_z += 2;
oldz = self.origin_z;
droptofloor ();
if (oldz - self.origin_z > 250) {
@ -272,7 +290,8 @@ void() misc_explobox2 =
float SPAWNFLAG_SUPERSPIKE = 1;
float SPAWNFLAG_LASER = 2;
void() Laser_Touch =
void ()
Laser_Touch =
{
local vector org;
@ -300,7 +319,8 @@ void() Laser_Touch =
remove (self);
};
void(vector org, vector vec) LaunchLaser =
void (vector org, vector vec)
LaunchLaser =
{
if (self.classname == "monster_enforcer")
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
@ -326,7 +346,8 @@ void(vector org, vector vec) LaunchLaser =
newmis.touch = Laser_Touch;
};
void() spikeshooter_use =
void ()
spikeshooter_use =
{
if (self.spawnflags & SPAWNFLAG_LASER) {
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 ();
self.nextthink = time + self.wait;
@ -351,7 +373,8 @@ void() shooter_think =
When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED.
*/
void() trap_spikeshooter =
void ()
trap_spikeshooter =
{
SetMovedir ();
self.use = spikeshooter_use;
@ -368,7 +391,8 @@ Continuously fires spikes.
"wait" time between spike (1.0 default)
"nextthink" delay before firing first spike, so multiple shooters can be stagered.
*/
void() trap_shooter =
void ()
trap_shooter =
{
trap_spikeshooter ();
@ -383,35 +407,24 @@ void() trap_shooter =
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
testing air bubbles
*/
void() air_bubbles =
void ()
air_bubbles =
{
remove (self);
};
void() bubble_remove;
void() bubble_bob;
void() make_bubbles =
void ()
bubble_remove =
{
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;
if (other.classname == self.classname) {
// dprint ("bump");
return;
}
remove (self);
};
void() bubble_split =
void ()
bubble_split =
{
local entity bubble;
@ -434,16 +447,8 @@ void() bubble_split =
remove (self);
};
void() bubble_remove =
{
if (other.classname == self.classname) {
// dprint ("bump");
return;
}
remove (self);
};
void() bubble_bob =
void ()
bubble_bob =
{
self.cnt++;
if (self.cnt == 4)
@ -473,13 +478,36 @@ void() 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)
Just for the debugging level. Don't use
*/
void() viewthing =
void ()
viewthing =
{
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
@ -489,7 +517,8 @@ void() viewthing =
// SIMPLE BMODELS =============================================================
void() func_wall_use =
void ()
func_wall_use =
{ // change to alternate textures
self.frame = 1 - self.frame;
};
@ -497,7 +526,8 @@ void() func_wall_use =
/*QUAKED func_wall (0 .5 .8) ?
This is just a solid wall if not inhibitted
*/
void() func_wall =
void ()
func_wall =
{
self.angles = '0 0 0';
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) ?
A simple entity that looks solid but lets you walk through it.
*/
void() func_illusionary =
void ()
func_illusionary =
{
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
@ -521,7 +552,8 @@ void() func_illusionary =
/*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.
*/
void() func_episodegate =
void ()
func_episodegate =
{
if (!(serverflags & self.spawnflags))
return; // can still enter episode
@ -536,7 +568,8 @@ void() func_episodegate =
/*QUAKED func_bossgate (0 .5 .8) ?
This bmodel appears unless players have all of the episode sigils.
*/
void() func_bossgate =
void ()
func_bossgate =
{
if ((serverflags & 15) == 15)
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)
*/
void() ambient_suck_wind =
void ()
ambient_suck_wind =
{
precache_sound ("ambience/suck1.wav");
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)
*/
void() ambient_drone =
void ()
ambient_drone =
{
precache_sound ("ambience/drone6.wav");
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)
*/
void() ambient_flouro_buzz =
void ()
ambient_flouro_buzz =
{
precache_sound ("ambience/buzz1.wav");
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)
*/
void() ambient_drip =
void ()
ambient_drip =
{
precache_sound ("ambience/drip1.wav");
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)
*/
void() ambient_comp_hum =
void ()
ambient_comp_hum =
{
precache_sound ("ambience/comp1.wav");
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)
*/
void() ambient_thunder =
void ()
ambient_thunder =
{
precache_sound ("ambience/thunder1.wav");
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)
*/
void() ambient_light_buzz =
void ()
ambient_light_buzz =
{
precache_sound ("ambience/fl_hum1.wav");
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)
*/
void() ambient_swamp1 =
void ()
ambient_swamp1 =
{
precache_sound ("ambience/swamp1.wav");
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)
*/
void() ambient_swamp2 =
void ()
ambient_swamp2 =
{
precache_sound ("ambience/swamp2.wav");
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;
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)
For optimzation testing, starts a lot of sounds.
*/
void() misc_noisemaker =
void ()
misc_noisemaker =
{
precache_sound2 ("enforcer/enfire.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;
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 vector tmin, tmax;
@ -36,96 +130,6 @@ void() plat_spawn_inside_trigger =
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
speed default 150
@ -138,7 +142,8 @@ Set "sounds" to one of the following:
1) base fast
2) chain slow
*/
void() func_plat =
void ()
func_plat =
{
if (!self.t_length)
self.t_length = 80;
@ -199,10 +204,8 @@ void() func_plat =
//============================================================================
void() train_next;
void() func_train_find;
void() train_blocked =
void ()
train_blocked =
{
if (time < self.attack_finished)
return;
@ -211,25 +214,10 @@ void() train_blocked =
T_Damage (other, self, self, self.dmg);
};
void() train_use =
{
if (self.think != func_train_find)
return; // already activated
train_next ();
};
void () train_wait;
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;
};
void() train_next =
void ()
train_next =
{
local entity targ;
@ -245,7 +233,8 @@ void() train_next =
SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait);
};
void() func_train_find =
void ()
func_train_find =
{
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) ?
Trains are moving platforms that players can ride.
The targets origin specifies the min point of the train at each corner.
@ -269,7 +279,8 @@ dmg default 2
sounds
1) ratchet metal
*/
void() func_train =
void ()
func_train =
{
if (!self.speed)
self.speed = 100;

View file

@ -1,5 +1,3 @@
void() bubble_bob;
// PLAYER =====================================================================
$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
// death
$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
$frame axdeth7 axdeth8 axdeth9
@ -60,11 +57,60 @@ $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$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 =====================================================================
void () player_run;
void() player_stand1 =[ $axstnd1, player_stand1 ]
void ()
player_stand1 = [$axstnd1, player_stand1]
{
self.weaponframe = 0;
if (self.velocity_x || self.velocity_y) {
@ -82,10 +128,11 @@ void() player_stand1 =[ $axstnd1, player_stand1 ]
self.walkframe = 0;
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;
if (!self.velocity_x && !self.velocity_y) {
@ -95,25 +142,28 @@ void() player_run =[ $rockrun1, player_run ]
}
if (self.weapon == IT_AXE) {
if (self.walkframe == 6)
if (self.walkframe >= 6)
self.walkframe = 0;
self.frame = $axrun1 + self.walkframe;
} else {
if (self.walkframe == 6)
if (self.walkframe >= 6)
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);
WriteEntity (MSG_MULTICAST, self);
multicast (self.origin, MULTICAST_PVS);
};
void() player_shot1 = [$shotatt1, player_shot2 ] {
void ()
player_shot1 = [$shotatt1, player_shot2]
{
self.weaponframe = 1;
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_axe2 = [$axatt2, player_axe3] {self.weaponframe = 2;};
void() player_axe3 = [$axatt3, player_axe4 ] {
void ()
player_axe3 = [$axatt3, player_axe4] {
self.weaponframe = 3;
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_axeb2 = [$axattb2, player_axeb3] {self.weaponframe = 6;};
void() player_axeb3 = [$axattb3, player_axeb4 ] {
void ()
player_axeb3 = [$axattb3, player_axeb4] {
self.weaponframe = 7;
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_axec2 = [$axattc2, player_axec3] {self.weaponframe = 2;};
void() player_axec3 = [$axattc3, player_axec4 ] {
void ()
player_axec3 = [$axattc3, player_axec4]
{
self.weaponframe = 3;
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_axed2 = [$axattd2, player_axed3] {self.weaponframe = 6;};
void() player_axed3 = [$axattd3, player_axed4 ] {
void ()
player_axed3 = [$axattd3, player_axed4 ] {
self.weaponframe = 7;
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 ();
@ -174,7 +230,8 @@ void() player_nail1 =[$nailatt1, player_nail2 ]
self.attack_finished = time + 0.2;
};
void() player_nail2 =[$nailatt2, player_nail1 ]
void ()
player_nail2 = [$nailatt2, player_nail1]
{
muzzleflash ();
@ -183,8 +240,8 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
return;
}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe++;
if (self.weaponframe >= 9)
self.weaponframe = 1;
SuperDamageSound ();
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 ();
@ -202,15 +260,16 @@ void() player_light1 =[$light1, player_light2 ]
return;
}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe++;
if (self.weaponframe >= 5)
self.weaponframe = 1;
SuperDamageSound ();
W_FireLightning ();
self.attack_finished = time + 0.2;
};
void() player_light2 =[$light2, player_light1 ]
void ()
player_light2 = [$light2, player_light1]
{
muzzleflash ();
@ -219,8 +278,8 @@ void() player_light2 =[$light2, player_light1 ]
return;
}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe++;
if (self.weaponframe >= 5)
self.weaponframe = 1;
SuperDamageSound ();
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;
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_rocket5 = [$rockatt5, player_rocket6] {self.weaponframe = 5;};
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)
return;
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
@ -296,11 +354,8 @@ void() PainSound =
return;
}
rs = rint ((random () * 5) + 1);
self.noise = "";
switch (rs) {
switch (rint ((random () * 5) + 1)) {
case 1:
self.noise = "player/pain1.wav";
break;
@ -345,7 +400,8 @@ void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {};
void(entity attacker, float damage) player_pain =
void (entity attacker, float damage)
player_pain =
{
if (self.weaponframe)
return;
@ -358,59 +414,9 @@ void(entity attacker, float damage) player_pain =
player_pain1 ();
};
void() player_diea1;
void() player_dieb1;
void() player_diec1;
void() player_died1;
void() player_diee1;
void() player_die_ax1;
void() DeathBubblesSpawn =
void ()
DeathSound =
{
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
if (self.waterlevel == 3) {
DeathBubbles (5);
@ -418,30 +424,39 @@ void() DeathSound =
return;
}
rs = rint (4 * random () + 1);
if (rs == 1)
switch (rint (4 * random () + 1)) {
case 1:
self.noise = "player/death1.wav";
if (rs == 2)
break;
case 2:
self.noise = "player/death2.wav";
if (rs == 3)
break;
case 3:
self.noise = "player/death3.wav";
if (rs == 4)
break;
case 4:
self.noise = "player/death4.wav";
if (rs == 5)
break;
case 5:
self.noise = "player/death5.wav";
default:
break;
}
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
return;
};
void() PlayerDead =
void ()
PlayerDead =
{
self.nextthink = -1;
// allow respawn after a certain time
self.deadflag = DEAD_DEAD;
};
vector(float dm) VelocityForDamage =
vector (float dm)
VelocityForDamage =
{
local vector v;
@ -468,7 +483,8 @@ vector(float dm) VelocityForDamage =
return v;
};
void(string gibname, float dm) ThrowGib =
void (string gibname, float dm)
ThrowGib =
{
local entity new;
@ -489,7 +505,8 @@ void(string gibname, float dm) ThrowGib =
new.flags = 0;
};
void(string gibname, float dm) ThrowHead =
void (string gibname, float dm)
ThrowHead =
{
setmodel (self, gibname);
self.frame = 0;
@ -505,7 +522,8 @@ void(string gibname, float dm) ThrowHead =
self.avelocity = crandom () * '0 600 0';
};
void() GibPlayer =
void ()
GibPlayer =
{
ThrowHead ("progs/h_player.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);
};
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 string s;
@ -615,83 +715,3 @@ void() PlayerDie =
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.
==============
*/
void() t_movetarget =
void ()
t_movetarget =
{
local entity temp;
@ -67,7 +68,8 @@ void() t_movetarget =
}
};
void() movetarget_f =
void ()
movetarget_f =
{
if (!self.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)
Monsters will continue walking towards the next target corner.
*/
void() path_corner =
void ()
path_corner =
{
movetarget_f ();
};

View file

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

View file

@ -1,12 +1,17 @@
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
just constant angles.
*/
vector() SetMovedir =
vector ()
SetMovedir =
{
if (self.angles == '0 -1 0')
self.movedir = '0 0 1';
@ -20,7 +25,8 @@ vector() SetMovedir =
self.angles = '0 0 0';
};
void() InitTrigger =
void ()
InitTrigger =
{
// 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.
@ -41,7 +47,8 @@ calculate self.velocity and self.nextthink to reach dest from
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;
stemp = self;
@ -51,7 +58,8 @@ void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
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 vector vdestdelta;
@ -89,7 +97,8 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove =
};
// After moving, set origin to exact final destination
void() SUB_CalcMoveDone =
void ()
SUB_CalcMoveDone =
{
setorigin (self, self.finaldest);
self.velocity = '0 0 0';
@ -108,7 +117,8 @@ self.angles rotating
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;
stemp = self;
@ -117,7 +127,8 @@ void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveE
self = stemp;
};
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
void (vector destangle, float tspeed, void () func)
SUB_CalcAngleMove =
{
local vector destdelta;
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
void() SUB_CalcAngleMoveDone =
void ()
SUB_CalcAngleMoveDone =
{
self.angles = self.finalangle;
self.avelocity = '0 0 0';
@ -157,7 +169,8 @@ void() SUB_CalcAngleMoveDone =
//=============================================================================
void() DelayThink =
void ()
DelayThink =
{
local integer rem = self.killtarget != self.targetname;
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;

View file

@ -1,6 +1,7 @@
entity stemp, otemp, s, old;
void() trigger_reactivate =
void ()
trigger_reactivate =
{
self.solid = SOLID_TRIGGER;
};
@ -11,7 +12,8 @@ float SPAWNFLAG_NOMESSAGE = 1;
float SPAWNFLAG_NOTOUCH = 1;
// the wait time has passed, so set back up for another activation
void() multi_wait =
void ()
multi_wait =
{
if (self.max_health) {
self.health = self.max_health;
@ -23,7 +25,8 @@ void() multi_wait =
// the trigger was just touched/killed/used
// self.enemy should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void() multi_trigger =
void ()
multi_trigger =
{
if (self.nextthink > time)
return; // allready been triggered
@ -31,7 +34,7 @@ void() multi_trigger =
if (self.classname == "trigger_secret") {
if (self.enemy.classname != "player")
return;
found_secrets = found_secrets + 1;
found_secrets++;
WriteByte (MSG_ALL, SVC_FOUNDSECRET);
}
@ -56,19 +59,22 @@ void() multi_trigger =
}
};
void() multi_killed =
void ()
multi_killed =
{
self.enemy = damage_attacker;
multi_trigger ();
};
void() multi_use =
void ()
multi_use =
{
self.enemy = activator;
multi_trigger ();
};
void() multi_touch =
void ()
multi_touch =
{
if (other.classname != "player")
return;
@ -97,7 +103,8 @@ sounds
4)
set "message" to text string
*/
void() trigger_multiple =
void ()
trigger_multiple =
{
switch (self.sounds) {
case 1:
@ -148,7 +155,8 @@ sounds
4)
set "message" to text string
*/
void() trigger_once =
void ()
trigger_once =
{
self.wait = -1;
trigger_multiple ();
@ -159,7 +167,8 @@ void() trigger_once =
/*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.
*/
void() trigger_relay =
void ()
trigger_relay =
{
self.use = SUB_UseTargets;
};
@ -175,9 +184,10 @@ sounds
4)
set "message" to text string
*/
void() trigger_secret =
void ()
trigger_secret =
{
total_secrets = total_secrets + 1;
total_secrets++;
self.wait = -1;
if (!self.message)
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)
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.
*/
void() trigger_counter =
void ()
trigger_counter =
{
self.wait = -1;
if (!self.count)
@ -256,7 +268,8 @@ void() trigger_counter =
float PLAYER_ONLY = 1;
float SILENT = 2;
void() play_teleport =
void ()
play_teleport =
{
local float v;
local string tmpstr;
@ -277,7 +290,8 @@ void() play_teleport =
remove (self);
};
void(vector org) spawn_tfog =
void (vector org)
spawn_tfog =
{
s = spawn ();
s.origin = org;
@ -289,7 +303,8 @@ void(vector org) spawn_tfog =
multicast (org, MULTICAST_PHS);
};
void() tdeath_touch =
void ()
tdeath_touch =
{
local entity other2;
@ -320,8 +335,8 @@ void() tdeath_touch =
T_Damage (other, self, self, 50000);
};
void(vector org, entity death_owner) spawn_tdeath =
void (vector org, entity death_owner)
spawn_tdeath =
{
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
};
void() teleport_touch =
void ()
teleport_touch =
{
local entity t;
local vector org;
@ -395,7 +411,8 @@ void() teleport_touch =
/*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.
*/
void() info_teleport_destination =
void ()
info_teleport_destination =
{
// this does nothing, just serves as a target spot
self.mangle = self.angles;
@ -406,7 +423,8 @@ void() info_teleport_destination =
objerror ("no targetname");
};
void() teleport_use =
void ()
teleport_use =
{
self.nextthink = time + 0.2;
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.
*/
void() trigger_teleport =
void ()
trigger_teleport =
{
local vector o;
@ -442,14 +461,16 @@ void() trigger_teleport =
sets skill level to the value of "message".
Only used on start map.
*/
void() trigger_setskill =
void ()
trigger_setskill =
{
remove (self);
};
// ONLY REGISTERED TRIGGERS ===================================================
void() trigger_onlyregistered_touch =
void ()
trigger_onlyregistered_touch =
{
if (other.classname != "player")
return;
@ -474,7 +495,8 @@ void() trigger_onlyregistered_touch =
/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
Only fires if playing the registered version, otherwise prints the message
*/
void() trigger_onlyregistered =
void ()
trigger_onlyregistered =
{
precache_sound ("misc/talk.wav");
InitTrigger ();
@ -483,13 +505,15 @@ void() trigger_onlyregistered =
//============================================================================
void() hurt_on =
void ()
hurt_on =
{
self.solid = SOLID_TRIGGER;
self.nextthink = -1;
};
void() hurt_touch =
void ()
hurt_touch =
{
if (other.takedamage) {
self.solid = SOLID_NOT;
@ -506,7 +530,8 @@ Any object touching this will be hurt
set dmg to damage amount
defalt dmg = 5
*/
void() trigger_hurt =
void ()
trigger_hurt =
{
InitTrigger ();
self.touch = hurt_touch;
@ -518,7 +543,8 @@ void() trigger_hurt =
float PUSH_ONCE = 1;
void() trigger_push_touch =
void ()
trigger_push_touch =
{
if (other.classname == "grenade")
other.velocity = self.speed * self.movedir * 10;
@ -538,7 +564,8 @@ void() trigger_push_touch =
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player
*/
void() trigger_push =
void ()
trigger_push =
{
InitTrigger ();
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)
return;
@ -561,7 +589,7 @@ void() trigger_monsterjump_touch =
if (!(other.flags & FL_ONGROUND))
return;
other.flags = other.flags - FL_ONGROUND;
other.flags &= ~FL_ONGROUND;
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
"height" default to 200, the speed thrown upwards
*/
void() trigger_monsterjump =
void ()
trigger_monsterjump =
{
if (!self.speed)
self.speed = 200;

View file

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

View file

@ -14,7 +14,8 @@ World Types:
2: base
*/
//=======================
void() worldspawn =
void ()
worldspawn =
{
lastspawn = world;
InitBodyQueue ();
@ -185,26 +186,29 @@ void() worldspawn =
lightstyle (63, "a");
};
void() StartFrame =
void ()
StartFrame =
{
timelimit = cvar ("timelimit") * 60;
fraglimit = cvar ("fraglimit");
teamplay = cvar ("teamplay");
deathmatch = cvar ("deathmatch");
framecount = framecount + 1;
framecount++;
};
// BODY QUE ===================================================================
entity bodyqueue_head;
void() bodyqueue =
void ()
bodyqueue =
{
// just here so spawn functions don't complain after world creates bodyqueues
};
void() InitBodyQueue =
void ()
InitBodyQueue =
{
bodyqueue_head = spawn ();
bodyqueue_head.classname = "bodyqueue";
@ -218,7 +222,8 @@ void() InitBodyQueue =
};
// 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.model = ent.model;