Update to use new QuakeForge features, massive whitespace, many optimizations.

Whee!
This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-02 04:06:47 +00:00
parent 2dee2b38c9
commit a5f350679e
18 changed files with 1894 additions and 3251 deletions

View file

@ -1,5 +1,5 @@
all: qwprogs.dat
qwprogs.dat: progs.src *.qc
qfcc -Werror -g
qfcc -Werror -Wall -g
clean:
rm -f core *.dat *.sym progdefs.h

View file

@ -9,7 +9,7 @@ void() button_wait =
self.nextthink = self.ltime + self.wait;
self.think = button_return;
activator = self.enemy;
SUB_UseTargets();
SUB_UseTargets ();
self.frame = 1; // use alternate textures
};
@ -27,12 +27,10 @@ void() button_return =
self.takedamage = DAMAGE_YES; // can be shot again
};
void() button_blocked =
{ // do nothing, just don't ome all the way back out
{ // do nothing, just don't come all the way back out
};
void() button_fire =
{
if (self.state == STATE_UP || self.state == STATE_TOP)
@ -44,7 +42,6 @@ void() button_fire =
SUB_CalcMove (self.pos2, self.speed, button_wait);
};
void() button_use =
{
self.enemy = activator;
@ -67,7 +64,6 @@ void() button_killed =
button_fire ();
};
/*QUAKED func_button (0 .5 .8) ?
When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
@ -85,25 +81,24 @@ When a button is touched, it moves some distance in the direction of it's angle,
*/
void() func_button =
{
if (self.sounds == 0)
{
switch (self.sounds) {
case 0:
precache_sound ("buttons/airbut1.wav");
self.noise = "buttons/airbut1.wav";
}
if (self.sounds == 1)
{
break;
case 1:
precache_sound ("buttons/switch21.wav");
self.noise = "buttons/switch21.wav";
}
if (self.sounds == 2)
{
break;
case 2:
precache_sound ("buttons/switch02.wav");
self.noise = "buttons/switch02.wav";
}
if (self.sounds == 3)
{
break;
default:
case 3:
precache_sound ("buttons/switch04.wav");
self.noise = "buttons/switch04.wav";
break;
}
SetMovedir ();
@ -115,13 +110,11 @@ void() func_button =
self.blocked = button_blocked;
self.use = button_use;
if (self.health)
{
if (self.health) {
self.max_health = self.health;
self.th_die = button_killed;
self.takedamage = DAMAGE_YES;
}
else
} else
self.touch = button_touch;
if (!self.speed)
@ -134,6 +127,6 @@ void() func_button =
self.state = STATE_BOTTOM;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
self.pos2 = self.pos2 + self.movedir * (fabs (self.movedir * self.size)
- self.lip);
};

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,10 @@
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;
void(entity inflictor, entity attacker, float damage, entity ignore,
string dtype) T_RadiusDamage;
/*SERVER
/* SERVER
void() monster_death_use;
*/
@ -20,10 +20,10 @@ explosions and melee attacks.
*/
float(entity targ, entity inflictor) CanDamage =
{
// bmodels need special checking because their origin is 0,0,0
if (targ.movetype == MOVETYPE_PUSH)
{
traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
// bmodels need special checking because their origin is 0,0,0
if (targ.movetype == MOVETYPE_PUSH) {
traceline (inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE,
self);
if (trace_fraction == 1)
return TRUE;
if (trace_ent == targ)
@ -31,31 +31,25 @@ float(entity targ, entity inflictor) CanDamage =
return FALSE;
}
traceline(inflictor.origin, targ.origin, TRUE, self);
traceline (inflictor.origin, targ.origin, TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
traceline (inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
if (trace_fraction == 1)
return TRUE;
return FALSE;
};
/*
============
Killed
============
*/
void(entity targ, entity attacker) Killed =
{
local entity oself;
@ -66,8 +60,8 @@ void(entity targ, entity attacker) Killed =
if (self.health < -99)
self.health = -99; // don't let sbar look bad if a player
if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
{ // doors, triggers, etc
if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE) {
// doors, triggers, etc
self.th_die ();
self = oself;
return;
@ -75,28 +69,26 @@ void(entity targ, entity attacker) Killed =
self.enemy = attacker;
// bump the monster counter
if (self.flags & FL_MONSTER)
{
// bump the monster counter
if (self.flags & FL_MONSTER) {
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
}
ClientObituary(self, attacker);
ClientObituary (self, attacker);
self.takedamage = DAMAGE_NO;
self.touch = SUB_Null;
self.effects = 0;
/*SERVER
monster_death_use();
/* SERVER
monster_death_use ();
*/
self.th_die ();
self = oself;
};
/*
============
T_Damage
@ -107,126 +99,114 @@ This should be the only function that ever reduces health.
*/
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
{
local vector dir;
local entity oldself;
local float save;
local float take;
local string attackerteam, targteam;
local entity oldself;
local float save, take;
local string attackerteam, targteam;
local vector dir;
if (!targ.takedamage)
return;
// used by buttons and triggers to set activator for target firing
// used by buttons and triggers to set activator for target firing
damage_attacker = attacker;
// check for quad damage powerup on the attacker
// check for quad damage powerup on the attacker
if (attacker.super_damage_finished > time && inflictor.classname != "door")
if (deathmatch == 4)
damage = damage * 8;
else
damage = damage * 4;
if (deathmatch == 4)
damage *= 8;
else
damage *= 4;
// save damage based on the target's armor level
// save damage based on the target's armor level
save = ceil(targ.armortype*damage);
if (save >= targ.armorvalue)
{
save = ceil (targ.armortype * damage);
if (save >= targ.armorvalue) {
save = targ.armorvalue;
targ.armortype = 0; // lost all armor
targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
targ.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
}
targ.armorvalue = targ.armorvalue - save;
take = ceil(damage-save);
take = ceil (damage - save);
// add to the damage total for clients, which will be sent as a single
// message at the end of the frame
// FIXME: remove after combining shotgun blasts?
if (targ.flags & FL_CLIENT)
{
targ.dmg_take = targ.dmg_take + take;
targ.dmg_save = targ.dmg_save + save;
// add to the damage total for clients, which will be sent as a single
// message at the end of the frame
// FIXME: remove after combining shotgun blasts?
if (targ.flags & FL_CLIENT) {
targ.dmg_take += take;
targ.dmg_save += save;
targ.dmg_inflictor = inflictor;
}
damage_inflictor = inflictor;
// figure momentum add
if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
{
// figure momentum add
if ((inflictor != world) && (targ.movetype == MOVETYPE_WALK)) {
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
dir = normalize(dir);
dir = normalize (dir);
// Set kickback for smaller weapons
//Zoid -- use normal NQ kickback
// // Read: only if it's not yourself doing the damage
// if ( (damage < 60) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname != targ.netname))
// if ( (damage < 60) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname != targ.netname))
// targ.velocity = targ.velocity + dir * damage * 11;
// else
// Otherwise, these rules apply to rockets and grenades
// else
// Otherwise, these rules apply to rockets and grenades
// for blast velocity
targ.velocity = targ.velocity + dir * damage * 8;
targ.velocity = targ.velocity + dir * damage * 8;
// Rocket Jump modifiers
if ( (rj > 1) & ((attacker.classname == "player") & (targ.classname == "player")) & ( attacker.netname == targ.netname))
if ((rj > 1) & ((attacker.classname == "player")
& (targ.classname == "player"))
& (attacker.netname == targ.netname))
targ.velocity = targ.velocity + dir * damage * rj;
}
// check for godmode or invincibility
// check for godmode or invincibility
if (targ.flags & FL_GODMODE)
return;
if (targ.invincible_finished >= time)
{
if (self.invincible_sound < time)
{
if (targ.invincible_finished >= time) {
if (self.invincible_sound < time) {
sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
self.invincible_sound = time + 2;
}
return;
}
// team play damage avoidance
//ZOID 12-13-96: self.team doesn't work in QW. Use keys
attackerteam = infokey(attacker, "team");
targteam = infokey(targ, "team");
// team play damage avoidance
//ZOID 12-13-96: self.team doesn't work in QW. Use keys
attackerteam = infokey (attacker, "team");
targteam = infokey (targ, "team");
if ((teamplay == 1) && (targteam == attackerteam) &&
(attacker.classname == "player") && (attackerteam != "") &&
inflictor.classname !="door")
inflictor.classname != "door")
return;
if ((teamplay == 3) && (targteam == attackerteam) &&
(attacker.classname == "player") && (attackerteam != "") &&
(targ != attacker)&& inflictor.classname !="door")
(targ != attacker) && inflictor.classname != "door")
return;
// do the damage
targ.health = targ.health - take;
if (targ.health <= 0)
{
// do the damage
targ.health -= take;
if (targ.health <= 0) {
Killed (targ, attacker);
return;
}
// react to the damage
// react to the damage
oldself = self;
self = targ;
/*SERVER
if ( (self.flags & FL_MONSTER) && attacker != world)
{
/* SERVER
if ( (self.flags & FL_MONSTER) && attacker != world) {
// get mad unless of the same class (except for soldiers)
if (self != attacker && attacker != self.enemy)
{
if ( (self.classname != attacker.classname)
|| (self.classname == "monster_army" ) )
{
if (self != attacker && attacker != self.enemy) {
if ((self.classname != attacker.classname)
|| (self.classname == "monster_army")) {
if (self.enemy.classname == "player")
self.oldenemy = self.enemy;
self.enemy = attacker;
@ -236,49 +216,37 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
}
*/
if (self.th_pain)
{
self.th_pain (attacker, take);
}
self = oldself;
};
/*
============
T_RadiusDamage
============
*/
void(entity inflictor, entity attacker, float damage, entity ignore, string dtype) T_RadiusDamage =
{
local float points;
local entity head;
local vector org;
local entity head;
local float points;
local vector org;
head = findradius(inflictor.origin, damage+40);
head = findradius (inflictor.origin, damage + 40);
while (head)
{
//bprint (PRINT_HIGH, head.classname);
//bprint (PRINT_HIGH, " | ");
//bprint (PRINT_HIGH, head.netname);
//bprint (PRINT_HIGH, "\n");
while (head) {
// bprint (PRINT_HIGH, head.classname);
// bprint (PRINT_HIGH, " | ");
// bprint (PRINT_HIGH, head.netname);
// bprint (PRINT_HIGH, "\n");
if (head != ignore)
{
if (head.takedamage)
{
org = head.origin + (head.mins + head.maxs)*0.5;
points = 0.5*vlen (inflictor.origin - org);
if (head != ignore) {
if (head.takedamage) {
org = head.origin + (head.mins + head.maxs) * 0.5;
points = 0.5 * vlen (inflictor.origin - org);
if (points < 0)
points = 0;
points = damage - points;
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
if (CanDamage (head, inflictor))
{
points *= 0.5;
if (points > 0) {
if (CanDamage (head, inflictor)) {
head.deathtype = dtype;
T_Damage (head, inflictor, attacker, points);
}
@ -289,30 +257,22 @@ void(entity inflictor, entity attacker, float damage, entity ignore, string dtyp
}
};
/*
============
T_BeamDamage
============
*/
void(entity attacker, float damage) T_BeamDamage =
{
local float points;
local entity head;
local entity head;
local float points;
head = findradius(attacker.origin, damage+40);
head = findradius (attacker.origin, damage + 40);
while (head)
{
if (head.takedamage)
{
points = 0.5*vlen (attacker.origin - head.origin);
while (head) {
if (head.takedamage) {
points = 0.5 * vlen (attacker.origin - head.origin);
if (points < 0)
points = 0;
points = damage - points;
if (head == attacker)
points = points * 0.5;
if (points > 0)
{
points *= 0.5;
if (points > 0) {
if (CanDamage (head, attacker))
T_Damage (head, attacker, attacker, points);
}
@ -320,4 +280,3 @@ void(entity attacker, float damage) T_BeamDamage =
head = head.chain;
}
};

View file

@ -1,27 +1,17 @@
// SOURCE FOR GLOBALVARS_T C STRUCTURE ========================================
/*
==============================================================================
SOURCE FOR GLOBALVARS_T C STRUCTURE
==============================================================================
*/
//
// system globals
//
entity self;
entity other;
entity world;
float time;
float frametime;
entity newmis; // if this is set, the entity that just
entity newmis; // if this is set, the entity that just
// run created a new missile that should
// be simulated immediately
float force_retouch; // force all entities to touch triggers
float force_retouch; // force all entities to touch triggers
// next frame. this is needed because
// non-moving things don't normally scan
// for triggers, and when a trigger is
@ -31,7 +21,7 @@ float force_retouch; // force all entities to touch triggers
// to guarantee everything is touched
string mapname;
float serverflags; // propagated from level to level, used to
float serverflags; // propagated from level to level, used to
// keep track of completed episodes
float total_secrets;
@ -41,15 +31,12 @@ float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
// spawnparms are used to encode information about clients across server
// level changes
// spawnparms encode information about clients across server level changes
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
//
// global variables set by built in functions
//
vector v_forward, v_up, v_right; // set by makevectors()
// set by traceline / tracebox
float trace_allsolid;
float trace_startsolid;
@ -61,13 +48,9 @@ entity trace_ent;
float trace_inopen;
float trace_inwater;
entity msg_entity; // destination of single entity writes
entity msg_entity; // destination of single entity writes
//
// required prog functions
//
void() main; // only for testing
void() StartFrame;
void() PlayerPreThink;
@ -90,17 +73,9 @@ void() SetChangeParms; // call to set parms for self so
void end_sys_globals; // flag for structure dumping
//================================================
/*
==============================================================================
// SOURCE FOR ENTVARS_T C STRUCTURE ===========================================
SOURCE FOR ENTVARS_T C STRUCTURE
==============================================================================
*/
//
// system fields (*** = do not set in prog code, maintained by C code)
//
.float modelindex; // *** model index in the precached list
.vector absmin, absmax; // *** origin + mins / maxs
@ -212,18 +187,9 @@ void end_sys_globals; // flag for structure dumping
void end_sys_fields; // flag for structure dumping
//================================================
/*
==============================================================================
// VARS NOT REFERENCED BY C CODE ==============================================
VARS NOT REFERENCED BY C CODE
==============================================================================
*/
//
// constants
//
float FALSE = 0;
float TRUE = 1;
@ -270,14 +236,12 @@ float RANGE_MID = 2;
float RANGE_FAR = 3;
// deadflag values
float DEAD_NO = 0;
float DEAD_DYING = 1;
float DEAD_DEAD = 2;
float DEAD_RESPAWNABLE = 3;
// takedamage values
float DAMAGE_NO = 0;
float DAMAGE_YES = 1;
float DAMAGE_AIM = 2;
@ -312,16 +276,15 @@ float IT_SUIT = 2097152;
float IT_QUAD = 4194304;
// point content values
float CONTENT_EMPTY = -1;
float CONTENT_SOLID = -2;
float CONTENT_WATER = -3;
float CONTENT_SLIME = -4;
float CONTENT_LAVA = -5;
float CONTENT_SKY = -6;
float CONTENT_SKY = -6;
float STATE_TOP = 0;
float STATE_BOTTOM = 1;
float STATE_BOTTOM = 1;
float STATE_UP = 2;
float STATE_DOWN = 3;
@ -344,21 +307,20 @@ float SVC_SMALLKICK = 34;
float SVC_BIGKICK = 35;
float SVC_MUZZLEFLASH = 39;
float TE_SPIKE = 0;
float TE_SUPERSPIKE = 1;
float TE_SPIKE = 0;
float TE_SUPERSPIKE = 1;
float TE_GUNSHOT = 2;
float TE_EXPLOSION = 3;
float TE_TAREXPLOSION = 4;
float TE_LIGHTNING1 = 5;
float TE_LIGHTNING2 = 6;
float TE_WIZSPIKE = 7;
float TE_KNIGHTSPIKE = 8;
float TE_LIGHTNING3 = 9;
float TE_LAVASPLASH = 10;
float TE_TELEPORT = 11;
float TE_BLOOD = 12;
float TE_LIGHTNINGBLOOD = 13;
float TE_EXPLOSION = 3;
float TE_TAREXPLOSION = 4;
float TE_LIGHTNING1 = 5;
float TE_LIGHTNING2 = 6;
float TE_WIZSPIKE = 7;
float TE_KNIGHTSPIKE = 8;
float TE_LIGHTNING3 = 9;
float TE_LAVASPLASH = 10;
float TE_TELEPORT = 11;
float TE_BLOOD = 12;
float TE_LIGHTNINGBLOOD = 13;
// sound channels
// channel 0 never willingly overrides
@ -376,23 +338,19 @@ float ATTN_IDLE = 2;
float ATTN_STATIC = 3;
// update types
float UPDATE_GENERAL = 0;
float UPDATE_STATIC = 1;
float UPDATE_BINARY = 2;
float UPDATE_TEMP = 3;
// entity effects
//float EF_BRIGHTFIELD = 1;
//float EF_MUZZLEFLASH = 2;
float EF_BRIGHTLIGHT = 4;
float EF_DIMLIGHT = 8;
float EF_FLAG1 = 16;
float EF_FLAG2 = 32;
// GLQuakeWorld Stuff
float EF_BLUE = 64; // Blue Globe effect for Quad
float EF_RED = 128; // Red Globe effect for Pentagram
float EF_BLUE = 64; // Blue glow effect for Quad
float EF_RED = 128; // Red glow effect for Pentagram
// messages
float MSG_BROADCAST = 0; // unreliable to all
float MSG_ONE = 1; // reliable to one (msg_entity)
@ -414,14 +372,8 @@ float MULTICAST_ALL_R = 3; // every client, reliable
float MULTICAST_PHS_R = 4; // within hearing, reliable
float MULTICAST_PVS_R = 5; // within sight, reliable
// globals ====================================================================
//================================================
//
// globals
//
float movedist;
string string_null; // null string, nothing should be held here
@ -433,9 +385,7 @@ entity damage_attacker; // set by T_Damage
entity damage_inflictor;
float framecount;
//
// cvars checked each frame
//
float teamplay;
float timelimit;
float fraglimit;
@ -444,9 +394,7 @@ float rj;
//================================================
//
// world fields (FIXME: make globals)
//
.string wad;
.string map;
.float worldtype; // 0=medieval 1=metal 2=base
@ -455,16 +403,11 @@ float rj;
.string killtarget;
//
// quakeed fields
//
.float light_lev; // not used by game, but parsed by light util
.float style;
//
// monster ai
//
.void() th_stand;
.void() th_walk;
.void() th_run;
@ -487,9 +430,7 @@ float AS_SLIDING = 2;
float AS_MELEE = 3;
float AS_MISSILE = 4;
//
// player only fields
//
.float voided;
.float walkframe;
@ -498,7 +439,6 @@ float AS_MISSILE = 4;
.float gravity; // Gravity Multiplier (0 to 1.0)
.float attack_finished;
.float pain_finished;
@ -524,9 +464,7 @@ float AS_MISSILE = 4;
.float bubble_count; // keeps track of the number of bubbles
.string deathtype; // keeps track of how the player died
//
// object stuff
//
.string mdl;
.vector mangle; // angle at start
@ -534,76 +472,50 @@ float AS_MISSILE = 4;
.float t_length, t_width;
//
// doors, etc
//
.vector dest, dest1, dest2;
.float wait; // time from firing to restarting
.float delay; // time from activation to firing
.entity trigger_field; // door's trigger entity
.string noise4;
//
// monsters
//
.float pausetime;
.entity movetarget;
//
// doors
//
.float aflag;
.float dmg; // damage done by door when hit
//
// misc
//
.float cnt; // misc flag
//
// subs
//
.void() think1;
.vector finaldest, finalangle;
//
// triggers
//
.float count; // for counting triggers
//
// plats / doors / buttons
//
.float lip;
.float state;
.vector pos1, pos2; // top and bottom positions
.float height;
//
// sounds
//
.float waitmin, waitmax;
.float distance;
.float volume;
//===========================================================================
//
// builtin functions
//
void(vector ang) makevectors = #1; // sets v_forward, etc globals
void(entity e, vector o) setorigin = #2;
void(entity e, string m) setmodel = #3; // set movetype and solid first
void(entity e, vector min, vector max) setsize = #4;
// #5 was removed
//void() break = #6;
float() random = #7; // returns 0 - 1
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
@ -621,7 +533,6 @@ void(entity e) remove = #15;
// forent->owner == test, or test->owner == forent
// a forent of world is ignored
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
entity() checkclient = #17; // returns a client to look for
entity(entity start, .string fld, string match) find = #18;
string(string s) precache_sound = #19;
@ -638,39 +549,32 @@ void() traceon = #29; // turns
void() traceoff = #30;
void(entity e) eprint = #31; // prints an entire edict
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
// #33 was removed
float() droptofloor = #34; // TRUE if landed on floor
void(float style, string value) lightstyle = #35;
float(float v) rint = #36; // round to nearest int
float(float v) floor = #37; // largest integer <= v
float(float v) ceil = #38; // smallest integer >= v
// #39 was removed
float(entity e) checkbottom = #40; // true if self is on ground
float(vector v) pointcontents = #41; // returns a CONTENT_*
// #42 was removed
float(float f) fabs = #43;
vector(entity e, float speed) aim = #44; // returns the shooting vector
float(string s) cvar = #45; // return cvar.value
void(string s) localcmd = #46; // put string into local que
entity(entity e) nextent = #47; // for looping through all ents
// #48 was removed
void() ChangeYaw = #49; // turn towards self.ideal_yaw
// at self.yaw_speed
// #50 was removed
vector(vector v) vectoangles = #51;
//
// direct client message generation
//
void(float to, float f) WriteByte = #52;
void(float to, float f) WriteChar = #53;
void(float to, float f) WriteShort = #54;
void(float to, float f) WriteLong = #55;
void(float to, float f) WriteCoord = #56;
void(float to, float f) WriteAngle = #57;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
void(float to, vector v) WriteCoordV = #0;
void(float to, vector v) WriteAngleV = #0;
void(float to, ...) WriteBytes = #0;
// several removed
void(float step) movetogoal = #67;
@ -679,8 +583,6 @@ string(string s) precache_file = #68; // no effect except for -copy
void(entity e) makestatic = #69;
void(string s) changelevel = #70;
//#71 was removed
void(string var, string val) cvar_set = #72; // sets cvar.value
void(entity client, string s) centerprint = #73; // sprint, but in middle
@ -703,9 +605,7 @@ void(vector where, float set) multicast = #82; // sends the temp message to a s
//============================================================================
//
// subs.qc
//
void(vector tdest, float tspeed, void() func) SUB_CalcMove;
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
@ -715,14 +615,9 @@ void() SUB_Null;
void() SUB_UseTargets;
void() SUB_Remove;
//
// combat.qc
//
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
float (entity e, float healamount, float ignore) T_Heal; // health function
float(entity targ, entity inflictor) CanDamage;

View file

@ -1,4 +1,3 @@
float DOOR_START_OPEN = 1;
float DOOR_DONT_LINK = 4;
float DOOR_GOLD_KEY = 8;
@ -6,7 +5,6 @@ float DOOR_SILVER_KEY = 16;
float DOOR_TOGGLE = 32;
/*
Doors are similar to buttons, but can spawn a fat trigger field around them
to open without a touch, and they link together to form simultanious
double/quad doors.
@ -15,16 +13,9 @@ Door.owner is the master door. If there is only one door, it points to itself.
If multiple doors, all will point to a single one.
Door.enemy chains from the master door through all doors linked in the chain.
*/
/*
=============================================================================
THINK FUNCTIONS
=============================================================================
*/
// THINK FUNCTIONS ============================================================
void() door_go_down;
void() door_go_up;
@ -34,10 +25,9 @@ void() door_blocked =
other.deathtype = "squish";
T_Damage (other, self, self.goalentity, self.dmg);
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if (self.wait >= 0)
{
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if (self.wait >= 0) {
if (self.state == STATE_DOWN)
door_go_up ();
else
@ -45,7 +35,6 @@ void() door_blocked =
}
};
void() door_hit_top =
{
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise1, 1, ATTN_NORM);
@ -65,8 +54,7 @@ void() door_hit_bottom =
void() door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
if (self.max_health)
{
if (self.max_health) {
self.takedamage = DAMAGE_YES;
self.health = self.max_health;
}
@ -78,10 +66,9 @@ void() door_go_down =
void() door_go_up =
{
if (self.state == STATE_UP)
return; // allready going up
return; // allready going up
if (self.state == STATE_TOP)
{ // reset top wait time
if (self.state == STATE_TOP) { // reset top wait time
self.nextthink = self.ltime + self.wait;
return;
}
@ -90,54 +77,41 @@ void() door_go_up =
self.state = STATE_UP;
SUB_CalcMove (self.pos2, self.speed, door_hit_top);
SUB_UseTargets();
SUB_UseTargets ();
};
/*
=============================================================================
ACTIVATION FUNCTIONS
=============================================================================
*/
// ACTIVATION FUNCTIONS =======================================================
void() door_fire =
{
local entity oself;
local entity starte;
local entity oself, starte;
if (self.owner != self)
objerror ("door_fire: self.owner != self");
// play use key sound
// play use key sound
if (self.items)
sound (self, CHAN_VOICE, self.noise4, 1, ATTN_NORM);
self.message = string_null; // no more message
oself = self;
if (self.spawnflags & DOOR_TOGGLE)
{
if (self.state == STATE_UP || self.state == STATE_TOP)
{
if (self.spawnflags & DOOR_TOGGLE) {
if (self.state == STATE_UP || self.state == STATE_TOP) {
starte = self;
do
{
do {
door_go_down ();
self = self.enemy;
} while ( (self != starte) && (self != world) );
} while ((self != starte) && (self != world));
self = oself;
return;
}
}
// trigger all paired doors
// trigger all paired doors
starte = self;
do
{
do {
self.goalentity = activator; // Who fired us
door_go_up ();
self = self.enemy;
@ -145,10 +119,9 @@ void() door_fire =
self = oself;
};
void() door_use =
{
local entity oself;
local entity oself;
self.message = ""; // door message are for touch only
self.owner.message = "";
@ -160,14 +133,13 @@ void() door_use =
self = oself;
};
void() door_trigger_touch =
{
if (other.health <= 0)
return;
if (time < self.attack_finished)
return;
self.attack_finished = time + 1;
activator = other;
@ -176,10 +148,9 @@ void() door_trigger_touch =
door_use ();
};
void() door_killed =
{
local entity oself;
local entity oself;
oself = self;
self = self.owner;
@ -189,7 +160,6 @@ void() door_killed =
self = oself;
};
/*
================
door_touch
@ -206,53 +176,48 @@ void() door_touch =
self.owner.attack_finished = time + 2;
if (self.owner.message != "")
{
if (self.owner.message != "") {
centerprint (other, self.owner.message);
sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
// key door stuff
// key door stuff
if (!self.items)
return;
// FIXME: blink key on player's status bar
if ( (self.items & other.items) != self.items )
{
if (self.owner.items == IT_KEY1)
{
if (world.worldtype == 2)
{
// FIXME: blink key on player's status bar
if ((self.items & other.items) != self.items) {
if (self.owner.items == IT_KEY1) {
switch (world.worldtype) {
case 2:
centerprint (other, "You need the silver keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
break;
case 1:
centerprint (other, "You need the silver runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
break;
case 0:
centerprint (other, "You need the silver key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
default:
break;
}
}
else
{
if (world.worldtype == 2)
{
} else {
switch (world.worldtype) {
case 2:
centerprint (other, "You need the gold keycard");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 1)
{
break;
case 1:
centerprint (other, "You need the gold runekey");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}
else if (world.worldtype == 0)
{
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
break;
case 0:
centerprint (other, "You need the gold key");
sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
default:
break;
}
}
return;
@ -265,21 +230,14 @@ void() door_touch =
door_use ();
};
/*
=============================================================================
SPAWNING FUNCTIONS
=============================================================================
*/
// SPAWNING FUNCTIONS =========================================================
entity(vector fmins, vector fmaxs) spawn_field =
{
local entity trigger;
local vector t1, t2;
local entity trigger;
local vector t1, t2;
trigger = spawn();
trigger = spawn ();
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.owner = self;
@ -291,7 +249,6 @@ entity(vector fmins, vector fmaxs) spawn_field =
return (trigger);
};
float (entity e1, entity e2) EntitiesTouching =
{
if (e1.mins_x > e2.maxs_x)
@ -309,35 +266,25 @@ float (entity e1, entity e2) EntitiesTouching =
return TRUE;
};
/*
=============
LinkDoors
=============
*/
void() LinkDoors =
{
local entity t, starte;
local vector cmins, cmaxs;
local entity t, starte;
local vector cmins, cmaxs;
if (self.enemy)
return; // already linked by another door
if (self.spawnflags & 4)
{
if (self.spawnflags & 4) {
self.owner = self.enemy = self;
return; // don't want to link this door
}
cmins = self.mins;
cmaxs = self.maxs;
starte = self;
t = self;
do
{
do {
self.owner = starte; // master door
if (self.health)
@ -348,12 +295,11 @@ void() LinkDoors =
starte.message = self.message;
t = find (t, classname, self.classname);
if (!t)
{
if (!t) {
self.enemy = starte; // make the chain a loop
// shootable, fired, or key doors just needed the owner/enemy links,
// they don't spawn a field
// shootable, fired, or key doors just needed the owner/enemy
// links, they don't spawn a field
self = self.owner;
@ -364,13 +310,12 @@ void() LinkDoors =
if (self.items)
return;
self.owner.trigger_field = spawn_field(cmins, cmaxs);
self.owner.trigger_field = spawn_field (cmins, cmaxs);
return;
}
if (EntitiesTouching(self,t))
{
if (EntitiesTouching (self, t)) {
if (t.enemy)
objerror ("cross connected doors");
@ -390,11 +335,9 @@ void() LinkDoors =
if (t.maxs_z > cmaxs_z)
cmaxs_z = t.maxs_z;
}
} while (1 );
} while (1);
};
/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
if two doors touch, they are assumed to be connected and operate as a unit.
@ -419,73 +362,66 @@ Key doors are allways wait -1.
3) stone chain
4) screechy metal
*/
void() func_door =
{
if (world.worldtype == 0)
{
switch (world.worldtype) {
case 0:
precache_sound ("doors/medtry.wav");
precache_sound ("doors/meduse.wav");
self.noise3 = "doors/medtry.wav";
self.noise4 = "doors/meduse.wav";
}
else if (world.worldtype == 1)
{
break;
case 1:
precache_sound ("doors/runetry.wav");
precache_sound ("doors/runeuse.wav");
self.noise3 = "doors/runetry.wav";
self.noise4 = "doors/runeuse.wav";
}
else if (world.worldtype == 2)
{
break;
case 2:
precache_sound ("doors/basetry.wav");
precache_sound ("doors/baseuse.wav");
self.noise3 = "doors/basetry.wav";
self.noise4 = "doors/baseuse.wav";
}
else
{
break;
default:
dprint ("no worldtype set!\n");
break;
}
if (self.sounds == 0)
{
switch (self.sounds) {
case 0:
precache_sound ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = "misc/null.wav";
self.noise2 = "misc/null.wav";
}
if (self.sounds == 1)
{
break;
case 1:
precache_sound ("doors/drclos4.wav");
precache_sound ("doors/doormv1.wav");
self.noise1 = "doors/drclos4.wav";
self.noise2 = "doors/doormv1.wav";
}
if (self.sounds == 2)
{
break;
case 2:
precache_sound ("doors/hydro1.wav");
precache_sound ("doors/hydro2.wav");
self.noise2 = "doors/hydro1.wav";
self.noise1 = "doors/hydro2.wav";
}
if (self.sounds == 3)
{
break;
case 3:
precache_sound ("doors/stndr1.wav");
precache_sound ("doors/stndr2.wav");
self.noise2 = "doors/stndr1.wav";
self.noise1 = "doors/stndr2.wav";
}
if (self.sounds == 4)
{
break;
case 4:
precache_sound ("doors/ddoor1.wav");
precache_sound ("doors/ddoor2.wav");
self.noise1 = "doors/ddoor2.wav";
self.noise2 = "doors/ddoor1.wav";
default:
break;
}
SetMovedir ();
self.max_health = self.health;
@ -513,12 +449,12 @@ void() func_door =
self.dmg = 2;
self.pos1 = self.origin;
self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
self.pos2 = self.pos1 + self.movedir * (fabs (self.movedir * self.size)
- self.lip);
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
if (self.spawnflags & DOOR_START_OPEN)
{
// DOOR_START_OPEN is to allow an entity to be lighted in the closed
// position but spawn in the open position
if (self.spawnflags & DOOR_START_OPEN) {
setorigin (self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
@ -526,8 +462,7 @@ void() func_door =
self.state = STATE_BOTTOM;
if (self.health)
{
if (self.health) {
self.takedamage = DAMAGE_YES;
self.th_die = door_killed;
}
@ -537,19 +472,13 @@ void() func_door =
self.touch = door_touch;
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
self.think = LinkDoors;
self.nextthink = self.ltime + 0.1;
};
/*
=============================================================================
SECRET DOORS
=============================================================================
*/
// SECRET DOORS ===============================================================
void() fd_secret_move1;
void() fd_secret_move2;
@ -565,10 +494,9 @@ 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 =
{
local float temp;
local float temp;
self.health = 10000;
@ -576,35 +504,33 @@ void () fd_secret_use =
if (self.origin != self.oldorigin)
return;
self.message = string_null; // no more message
self.message = string_null; // no more message
SUB_UseTargets(); // fire all targets / killtargets
SUB_UseTargets (); // fire all targets / killtargets
if (!(self.spawnflags & SECRET_NO_SHOOT))
{
if (!(self.spawnflags & SECRET_NO_SHOOT)) {
//XXX needed? self.th_pain = SUB_Null;
self.takedamage = DAMAGE_NO;
}
self.velocity = '0 0 0';
// Make a sound, wait a little...
sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
self.nextthink = self.ltime + 0.1;
temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
makevectors(self.mangle);
makevectors (self.mangle);
if (!self.t_width)
{
if (!self.t_width) {
if (self.spawnflags & SECRET_1ST_DOWN)
self. t_width = fabs(v_up * self.size);
self. t_width = fabs (v_up * self.size);
else
self. t_width = fabs(v_right * self.size);
self. t_width = fabs (v_right * self.size);
}
if (!self.t_length)
self. t_length = fabs(v_forward * self.size);
self. t_length = fabs (v_forward * self.size);
if (self.spawnflags & SECRET_1ST_DOWN)
self.dest1 = self.origin - v_up * self.t_width;
@ -612,8 +538,8 @@ void () fd_secret_use =
self.dest1 = self.origin + v_right * (self.t_width * temp);
self.dest2 = self.dest1 + v_forward * self.t_length;
SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest1, self.speed, fd_secret_move1);
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
};
void (entity attacker, float damage) fd_secret_pain =
@ -626,22 +552,21 @@ void () fd_secret_move1 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move2;
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
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);
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))
{
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;
}
@ -650,8 +575,8 @@ void () fd_secret_move3 =
// Move backward...
void () fd_secret_move4 =
{
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.dest1, self.speed, fd_secret_move5);
};
// Wait 1 second...
@ -659,31 +584,32 @@ void () fd_secret_move5 =
{
self.nextthink = self.ltime + 1.0;
self.think = fd_secret_move6;
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
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);
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
SUB_CalcMove (self.oldorigin, self.speed, fd_secret_done);
};
void () fd_secret_done =
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) {
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;
self.th_die = fd_secret_use;
}
sound(self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise3, 1, ATTN_NORM);
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise3, 1, ATTN_NORM);
};
void () secret_blocked =
{
if (time < self.attack_finished)
return;
self.attack_finished = time + 0.5;
other.deathtype = "squish";
T_Damage (other, self, self, self.dmg);
@ -705,14 +631,12 @@ void() secret_touch =
self.attack_finished = time + 2;
if (self.message)
{
if (self.message) {
centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
};
/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
Basic secret door. Slides back, then to the side. Angle determines direction.
wait = # of seconds before coming back
@ -729,35 +653,34 @@ 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 =
{
if (self.sounds == 0)
self.sounds = 3;
if (self.sounds == 1)
{
switch (self.sounds) {
case 1:
precache_sound ("doors/latch2.wav");
precache_sound ("doors/winch2.wav");
precache_sound ("doors/drclos4.wav");
self.noise1 = "doors/latch2.wav";
self.noise2 = "doors/winch2.wav";
self.noise3 = "doors/drclos4.wav";
}
if (self.sounds == 2)
{
break;
case 2:
precache_sound ("doors/airdoor1.wav");
precache_sound ("doors/airdoor2.wav");
self.noise2 = "doors/airdoor1.wav";
self.noise1 = "doors/airdoor2.wav";
self.noise3 = "doors/airdoor2.wav";
}
if (self.sounds == 3)
{
break;
case 0:
self.sounds = 3;
case 3:
precache_sound ("doors/basesec1.wav");
precache_sound ("doors/basesec2.wav");
self.noise2 = "doors/basesec1.wav";
self.noise1 = "doors/basesec2.wav";
self.noise3 = "doors/basesec2.wav";
default:
break;
}
if (!self.dmg)
@ -776,8 +699,7 @@ void () func_door_secret =
self.blocked = secret_blocked;
self.speed = 50;
self.use = fd_secret_use;
if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
{
if (!self.targetname || self.spawnflags & SECRET_YES_SHOOT) {
self.health = 10000;
self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_pain;

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,9 @@
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for spotlights, etc.
*/
void() info_null =
{
remove(self);
remove (self);
};
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
@ -20,14 +19,11 @@ float START_OFF = 1;
void() light_use =
{
if (self.spawnflags & START_OFF)
{
lightstyle(self.style, "m");
if (self.spawnflags & START_OFF) {
lightstyle (self.style, "m");
self.spawnflags = self.spawnflags - START_OFF;
}
else
{
lightstyle(self.style, "a");
} else {
lightstyle (self.style, "a");
self.spawnflags = self.spawnflags + START_OFF;
}
};
@ -40,19 +36,17 @@ If targeted, it will toggle between on or off.
*/
void() light =
{
if (!self.targetname)
{ // inert light
remove(self);
if (!self.targetname) { // inert light
remove (self);
return;
}
if (self.style >= 32)
{
if (self.style >= 32) {
self.use = light_use;
if (self.spawnflags & START_OFF)
lightstyle(self.style, "a");
lightstyle (self.style, "a");
else
lightstyle(self.style, "m");
lightstyle (self.style, "m");
}
};
@ -65,13 +59,12 @@ Makes steady fluorescent humming sound
*/
void() light_fluoro =
{
if (self.style >= 32)
{
if (self.style >= 32) {
self.use = light_use;
if (self.spawnflags & START_OFF)
lightstyle(self.style, "a");
lightstyle (self.style, "a");
else
lightstyle(self.style, "m");
lightstyle (self.style, "m");
}
precache_sound ("ambience/fl_hum1.wav");
@ -108,7 +101,7 @@ void() light_globe =
void() FireAmbient =
{
precache_sound ("ambience/fire1.wav");
// attenuate fast
// attenuate fast
ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
};
@ -161,35 +154,23 @@ void() light_flame_small_white =
//============================================================================
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
Lava Balls
*/
void() fire_fly;
void() fire_touch;
void() misc_fireball =
void() fire_touch =
{
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
self.nextthink = time + (random() * 5);
self.think = fire_fly;
if (!self.speed)
self.speed = 1000;
T_Damage (other, self, self, 20);
remove (self);
};
void() fire_fly =
{
local entity fireball;
local entity fireball;
fireball = spawn();
fireball = spawn ();
fireball.solid = SOLID_TRIGGER;
fireball.movetype = MOVETYPE_TOSS;
fireball.velocity = '0 0 1000';
fireball.velocity_x = (random() * 100) - 50;
fireball.velocity_y = (random() * 100) - 50;
fireball.velocity_z = self.speed + (random() * 200);
fireball.velocity_x = (100 * random ()) - 50;
fireball.velocity_y = (100 * random ()) - 50;
fireball.velocity_z = self.speed + (200 * random ());
fireball.classname = "fireball";
setmodel (fireball, "progs/lavaball.mdl");
setsize (fireball, '0 0 0', '0 0 0');
@ -198,44 +179,44 @@ local entity fireball;
fireball.think = SUB_Remove;
fireball.touch = fire_touch;
self.nextthink = time + (random() * 5) + 3;
self.nextthink = time + (5 * random ()) + 3;
self.think = fire_fly;
};
void() fire_touch =
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
Lava Balls
*/
void() misc_fireball =
{
T_Damage (other, self, self, 20);
remove(self);
precache_model ("progs/lavaball.mdl");
self.classname = "fireball";
self.nextthink = time + (5 * random ());
self.think = fire_fly;
if (!self.speed)
self.speed = 1000;
};
//============================================================================
void() barrel_explode =
{
self.takedamage = DAMAGE_NO;
self.classname = "explo_box";
// did say self.owner
T_RadiusDamage (self, self, 160, world, "");
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z+32);
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_EXPLOSION);
self.origin_z += 32;
WriteCoordV (MSG_MULTICAST, self.origin);
multicast (self.origin, MULTICAST_PHS);
remove (self);
};
/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
TESTING THING
*/
void() misc_explobox =
{
local float oldz;
local float oldz;
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
@ -249,26 +230,21 @@ void() misc_explobox =
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
droptofloor ();
if (oldz - self.origin_z > 250) {
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint (vtos (self.origin));
dprint ("\n");
remove(self);
remove (self);
}
};
/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
Smaller exploding box, REGISTERED ONLY
*/
void() misc_explobox2 =
{
local float oldz;
local float oldz;
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
@ -282,13 +258,12 @@ void() misc_explobox2 =
self.origin_z = self.origin_z + 2;
oldz = self.origin_z;
droptofloor();
if (oldz - self.origin_z > 250)
{
droptofloor ();
if (oldz - self.origin_z > 250) {
dprint ("item fell out of level at ");
dprint (vtos(self.origin));
dprint (vtos (self.origin));
dprint ("\n");
remove(self);
remove (self);
}
};
@ -299,38 +274,30 @@ float SPAWNFLAG_LASER = 2;
void() Laser_Touch =
{
local vector org;
local vector org;
if (other == self.owner)
return; // don't explode on owner
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
if (pointcontents (self.origin) == CONTENT_SKY) {
remove (self);
return;
}
sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
org = self.origin - 8*normalize(self.velocity);
org = self.origin - 8 * normalize (self.velocity);
if (other.health)
{
if (other.health) {
SpawnBlood (org, 15);
other.deathtype = "laser";
T_Damage (other, self, self.owner, 15);
}
else
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_GUNSHOT);
WriteByte (MSG_MULTICAST, 5);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
} else {
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, 5.0);
WriteCoordV (MSG_MULTICAST, org);
multicast (org, MULTICAST_PVS);
}
remove(self);
remove (self);
};
void(vector org, vector vec) LaunchLaser =
@ -338,9 +305,9 @@ void(vector org, vector vec) LaunchLaser =
if (self.classname == "monster_enforcer")
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
vec = normalize(vec);
newmis = spawn();
vec = normalize (vec);
newmis = spawn ();
newmis.owner = self;
newmis.movetype = MOVETYPE_FLY;
newmis.solid = SOLID_BBOX;
@ -352,7 +319,7 @@ void(vector org, vector vec) LaunchLaser =
setorigin (newmis, org);
newmis.velocity = vec * 600;
newmis.angles = vectoangles(newmis.velocity);
newmis.angles = vectoangles (newmis.velocity);
newmis.nextthink = time + 5;
newmis.think = SUB_Remove;
@ -361,13 +328,10 @@ void(vector org, vector vec) LaunchLaser =
void() spikeshooter_use =
{
if (self.spawnflags & SPAWNFLAG_LASER)
{
if (self.spawnflags & SPAWNFLAG_LASER) {
sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
LaunchLaser (self.origin, self.movedir);
}
else
{
} else {
sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
launch_spike (self.origin, self.movedir);
newmis.velocity = self.movedir * 500;
@ -383,28 +347,22 @@ void() shooter_think =
newmis.velocity = self.movedir * 500;
};
/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
When triggered, fires a spike in the direction set in QuakeEd.
Laser is only for REGISTERED.
*/
void() trap_spikeshooter =
{
SetMovedir ();
self.use = spikeshooter_use;
if (self.spawnflags & SPAWNFLAG_LASER)
{
if (self.spawnflags & SPAWNFLAG_LASER) {
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
}
else
} else
precache_sound ("weapons/spike2.wav");
};
/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
Continuously fires spikes.
"wait" time between spike (1.0 default)
@ -420,35 +378,23 @@ void() trap_shooter =
self.think = shooter_think;
};
/*
===============================================================================
===============================================================================
*/
void() make_bubbles;
void() bubble_remove;
void() bubble_bob;
// ============================================================================
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
testing air bubbles
*/
void() air_bubbles =
{
remove (self);
};
void() bubble_remove;
void() bubble_bob;
void() make_bubbles =
{
local entity bubble;
local entity bubble;
bubble = spawn();
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = MOVETYPE_NOCLIP;
@ -461,14 +407,15 @@ local entity bubble;
bubble.frame = 0;
bubble.cnt = 0;
setsize (bubble, '-8 -8 -8', '8 8 8');
self.nextthink = time + random() + 0.5;
self.nextthink = time + random () + 0.5;
self.think = make_bubbles;
};
void() bubble_split =
{
local entity bubble;
bubble = spawn();
local entity bubble;
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.origin);
bubble.movetype = MOVETYPE_NOCLIP;
@ -489,27 +436,26 @@ local entity bubble;
void() bubble_remove =
{
if (other.classname == self.classname)
{
// dprint ("bump");
if (other.classname == self.classname) {
// dprint ("bump");
return;
}
remove(self);
remove (self);
};
void() bubble_bob =
{
local float rnd1, rnd2, rnd3;
local float rnd1, rnd2, rnd3;
self.cnt = self.cnt + 1;
if (self.cnt == 4)
bubble_split();
bubble_split ();
if (self.cnt == 20)
remove(self);
remove (self);
rnd1 = self.velocity_x + (-10 + (random() * 20));
rnd2 = self.velocity_y + (-10 + (random() * 20));
rnd3 = self.velocity_z + 10 + random() * 10;
rnd1 = self.velocity_x - 10 + 20 * random ();
rnd2 = self.velocity_y - 10 + 20 * random ();
rnd3 = self.velocity_z + 10 + 10 * random ();
if (rnd1 > 10)
rnd1 = 5;
@ -538,12 +484,9 @@ local float rnd1, rnd2, rnd3;
~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
Just for the debugging level. Don't use
*/
void() viewthing =
{
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
@ -551,14 +494,7 @@ void() viewthing =
setmodel (self, "progs/player.mdl");
};
/*
==============================================================================
SIMPLE BMODELS
==============================================================================
*/
// SIMPLE BMODELS =============================================================
void() func_wall_use =
{ // change to alternate textures
@ -577,12 +513,10 @@ void() func_wall =
setmodel (self, self.model);
};
/*QUAKED func_illusionary (0 .5 .8) ?
A simple entity that looks solid but lets you walk through it.
*/
void() func_illusionary =
{
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
@ -595,7 +529,6 @@ void() func_illusionary =
This bmodel will appear if the episode has allready been completed, so players can't reenter it.
*/
void() func_episodegate =
{
if (!(serverflags & self.spawnflags))
return; // can still enter episode
@ -611,7 +544,6 @@ void() func_episodegate =
This bmodel appears unless players have all of the episode sigils.
*/
void() func_bossgate =
{
if ( (serverflags & 15) == 15)
return; // all episodes completed
@ -653,6 +585,7 @@ void() ambient_drip =
precache_sound ("ambience/drip1.wav");
ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_comp_hum =
@ -660,6 +593,7 @@ void() ambient_comp_hum =
precache_sound ("ambience/comp1.wav");
ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
};
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_thunder =
@ -667,6 +601,7 @@ void() ambient_thunder =
precache_sound ("ambience/thunder1.wav");
ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_light_buzz =
@ -674,6 +609,7 @@ void() ambient_light_buzz =
precache_sound ("ambience/fl_hum1.wav");
ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp1 =
@ -681,6 +617,7 @@ void() ambient_swamp1 =
precache_sound ("ambience/swamp1.wav");
ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
};
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
void() ambient_swamp2 =
@ -707,9 +644,7 @@ void() noise_think =
For optimzation testing, starts a lot of sounds.
*/
void() misc_noisemaker =
{
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
@ -722,6 +657,6 @@ void() misc_noisemaker =
precache_sound2 ("enforcer/death1.wav");
precache_sound2 ("enforcer/idle1.wav");
self.nextthink = time + 0.1 + random();
self.nextthink = time + 0.1 + random ();
self.think = noise_think;
};

View file

@ -1,11 +1,4 @@
/*
===============================================================================
WORLD WEAPONS
===============================================================================
*/
// WORLD WEAPONS ==============================================================
$modelname g_shot
$cd /raid/quake/id1/models/g_shot
@ -15,7 +8,6 @@ $base base
$skin skin
$frame shot1
$modelname g_nail
$cd /raid/quake/id1/models/g_nail
$flags 8 // client side rotate
@ -24,7 +16,6 @@ $base base
$skin skin
$frame shot1
$modelname g_nail2
$cd /raid/quake/id1/models/g_nail2
$flags 8 // client side rotate
@ -33,7 +24,6 @@ $base base
$skin skin
$frame shot2
$modelname g_rock
$cd /raid/quake/id1/models/g_rock
$flags 8 // client side rotate
@ -42,7 +32,6 @@ $base base
$skin skin
$frame shot1
$modelname g_rock2
$cd /raid/quake/id1/models/g_rock2
$flags 8 // client side rotate
@ -59,13 +48,7 @@ $base base
$skin skin
$frame shot1
/*
===============================================================================
VIEW WEAPONS
===============================================================================
*/
// VIEW WEAPONS ===============================================================
$modelname v_axe
$cd /raid/quake/id1/models/v_axe
@ -74,7 +57,6 @@ $base base
$skin skin
$frame frame1 frame2 frame3 frame4 frame5 frame6 frame7 frame8 frame9
$modelname v_shot
$cd /raid/quake/id1/models/v_shot
$origin 0 0 54
@ -82,7 +64,6 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
$modelname v_shot2
$cd /raid/quake/id1/models/v_shot2
$origin 0 0 56
@ -90,7 +71,6 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
$modelname v_rock2
$cd /raid/quake/id1/models/v_rock2
$origin 0 0 54
@ -98,7 +78,6 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5 shot6 shot6
$modelname v_rock
$cd /raid/quake/id1/models/v_rock
$origin 0 0 54
@ -106,7 +85,6 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
$modelname v_nail2
$cd /raid/quake/id1/models/v_nail2
$origin 0 0 54
@ -114,7 +92,6 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7 shot8 shot9
$modelname v_nail
$cd /raid/quake/id1/models/v_nail
$origin 0 0 54
@ -129,14 +106,7 @@ $base base
$skin skin
$frame shot1 shot2 shot3 shot4 shot5
/*
===============================================================================
ITEMS
===============================================================================
*/
// ITEMS ======================================================================
$modelname w_g_key
$cd /raid/quake/id1/models/w_g_key
@ -180,7 +150,6 @@ $base base
$skin skin
$frame frame1
$modelname quaddama
$cd /raid/quake/id1/models/quaddama
$flags 8 // client side rotate
@ -258,14 +227,7 @@ $base base
$skin skin
$frame frame1
/*
===============================================================================
GIBS
===============================================================================
*/
// GIBS =======================================================================
$modelname gib1
$cd /raid/quake/id1/models/gib1
@ -275,8 +237,8 @@ $base base
$skin skin
$frame frame1
// torso
$modelname gib2
$cd /raid/quake/id1/models/gib2
$flags 4 // EF_GIB
@ -293,7 +255,6 @@ $base base
$skin skin
$frame frame1
// heads
$modelname h_player
@ -392,13 +353,7 @@ $base base
$skin skin
$frame frame1
/*
===============================================================================
MISC
===============================================================================
*/
// MISC =======================================================================
$modelname armor
$cd /raid/quake/id1/models/armor
@ -582,4 +537,3 @@ $origin 0 0 24
$base base
$skin skin
$frame frame1

View file

@ -1,5 +1,3 @@
void() plat_center_touch;
void() plat_outside_touch;
void() plat_trigger_use;
@ -13,10 +11,8 @@ void() plat_spawn_inside_trigger =
local entity trigger;
local vector tmin, tmax;
//
// middle trigger
//
trigger = spawn();
// middle trigger
trigger = spawn ();
trigger.touch = plat_center_touch;
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
@ -27,18 +23,16 @@ void() plat_spawn_inside_trigger =
tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
if (self.spawnflags & PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (self.size_x <= 50)
{
if (self.size_x <= 50) {
tmin_x = (self.mins_x + self.maxs_x) / 2;
tmax_x = tmin_x + 1;
}
if (self.size_y <= 50)
{
if (self.size_y <= 50) {
tmin_y = (self.mins_y + self.maxs_y) / 2;
tmax_y = tmin_y + 1;
}
setsize (trigger, tmin, tmax);
};
@ -74,7 +68,6 @@ void() plat_center_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
@ -89,11 +82,10 @@ void() plat_outside_touch =
{
if (other.classname != "player")
return;
if (other.health <= 0)
return;
//dprint ("plat_outside_touch\n");
// dprint ("plat_outside_touch\n");
self = self.enemy;
if (self.state == STATE_TOP)
plat_go_down ();
@ -103,23 +95,27 @@ void() plat_trigger_use =
{
if (self.think)
return; // allready activated
plat_go_down();
plat_go_down ();
};
void() plat_crush =
{
//dprint ("plat_crush\n");
// dprint ("plat_crush\n");
other.deathtype = "squish";
T_Damage (other, self, self, 1);
if (self.state == STATE_UP)
switch (self.state) {
case STATE_UP:
plat_go_down ();
else if (self.state == STATE_DOWN)
break;
case STATE_DOWN:
plat_go_up ();
else
break;
default:
objerror ("plat_crush: bad self.state\n");
break;
}
};
void() plat_use =
@ -127,10 +123,9 @@ void() plat_use =
self.use = SUB_Null;
if (self.state != STATE_UP)
objerror ("plat_use: not in up state");
plat_go_down();
plat_go_down ();
};
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed default 150
@ -143,37 +138,30 @@ Set "sounds" to one of the following:
1) base fast
2) chain slow
*/
void() func_plat =
{
if (!self.t_length)
self.t_length = 80;
if (!self.t_width)
self.t_width = 10;
if (self.sounds == 0)
self.sounds = 2;
// FIX THIS TO LOAD A GENERIC PLAT SOUND
if (self.sounds == 1)
{
switch (self.sounds) {
case 1:
precache_sound ("plats/plat1.wav");
precache_sound ("plats/plat2.wav");
self.noise = "plats/plat1.wav";
self.noise1 = "plats/plat2.wav";
}
if (self.sounds == 2)
{
break;
case 0: // FIX THIS TO LOAD A GENERIC PLAT SOUND
case 2:
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
self.noise = "plats/medplat1.wav";
self.noise1 = "plats/medplat2.wav";
default:
break;
}
self.mangle = self.angles;
self.angles = '0 0 0';
@ -188,7 +176,7 @@ void() func_plat =
if (!self.speed)
self.speed = 150;
// pos1 is the top position, pos2 is the bottom
// pos1 is the top position, pos2 is the bottom
self.pos1 = self.origin;
self.pos2 = self.origin;
if (self.height)
@ -200,13 +188,10 @@ void() func_plat =
plat_spawn_inside_trigger (); // the "start moving" trigger
if (self.targetname)
{
if (self.targetname) {
self.state = STATE_UP;
self.use = plat_use;
}
else
{
} else {
setorigin (self, self.pos2);
self.state = STATE_BOTTOM;
}
@ -230,17 +215,15 @@ void() train_use =
{
if (self.think != func_train_find)
return; // already activated
train_next();
train_next ();
};
void() train_wait =
{
if (self.wait)
{
if (self.wait) {
self.nextthink = self.ltime + self.wait;
sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self.noise, 1, ATTN_NORM);
}
else
} else
self.nextthink = self.ltime + 0.1;
self.think = train_next;
@ -263,7 +246,6 @@ void() train_next =
};
void() func_train_find =
{
local entity targ;
@ -286,7 +268,6 @@ speed default 100
dmg default 2
sounds
1) ratchet metal
*/
void() func_train =
{
@ -297,16 +278,12 @@ void() func_train =
if (!self.dmg)
self.dmg = 2;
if (self.sounds == 0)
{
if (self.sounds == 0) {
self.noise = ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = ("misc/null.wav");
precache_sound ("misc/null.wav");
}
if (self.sounds == 1)
{
} else if (self.sounds == 1) {
self.noise = ("plats/train2.wav");
precache_sound ("plats/train2.wav");
self.noise1 = ("plats/train1.wav");
@ -324,8 +301,8 @@ void() func_train =
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};
@ -357,9 +334,8 @@ void() misc_teleporttrain =
setsize (self, self.mins , self.maxs);
setorigin (self, self.origin);
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_train_find;
};

View file

@ -1,47 +1,30 @@
void() bubble_bob;
/*
==============================================================================
PLAYER
==============================================================================
*/
// PLAYER =====================================================================
$cd /raid/quake/id1/models/player_4
$origin 0 -6 24
$base base
$skin skin
//
// running
//
$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
//
// standing
//
$frame stand1 stand2 stand3 stand4 stand5
$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
//
// pain
//
$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,9 +43,7 @@ $frame deathd8 deathd9
$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
$frame deathe8 deathe9
//
// attacks
//
$frame nailatt1 nailatt2
$frame light1 light2
@ -79,33 +60,24 @@ $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
/*
==============================================================================
PLAYER
==============================================================================
*/
// 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)
{
if (self.velocity_x || self.velocity_y) {
self.walkframe=0;
player_run();
player_run ();
return;
}
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
if (self.walkframe >= 12)
self.walkframe = 0;
self.frame = $axstnd1 + self.walkframe;
}
else
{
} else {
if (self.walkframe >= 5)
self.walkframe = 0;
self.frame = $stand1 + self.walkframe;
@ -113,24 +85,20 @@ void() player_stand1 =[ $axstnd1, player_stand1 ]
self.walkframe = self.walkframe + 1;
};
void() player_run =[ $rockrun1, player_run ]
void() player_run =[ $rockrun1, player_run ]
{
self.weaponframe=0;
if (!self.velocity_x && !self.velocity_y)
{
if (!self.velocity_x && !self.velocity_y) {
self.walkframe=0;
player_stand1();
return;
}
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = $axrun1 + self.walkframe;
}
else
{
} else {
if (self.walkframe == 6)
self.walkframe = 0;
self.frame = self.frame + self.walkframe;
@ -138,15 +106,17 @@ void() player_run =[ $rockrun1, player_run ]
self.walkframe = self.walkframe + 1;
};
void()muzzleflash =
void() muzzleflash =
{
WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH);
WriteEntity (MSG_MULTICAST, self);
multicast (self.origin, MULTICAST_PVS);
};
void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;muzzleflash();};
void() player_shot1 = [$shotatt1, player_shot2 ] {
self.weaponframe = 1;
muzzleflash ();
};
void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
@ -155,33 +125,47 @@ 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 ] {self.weaponframe=3;W_FireAxe();};
void() player_axe3 = [$axatt3, player_axe4 ] {
self.weaponframe = 3;
W_FireAxe ();
};
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 ] {self.weaponframe=7;W_FireAxe();};
void() player_axeb3 = [$axattb3, player_axeb4 ] {
self.weaponframe = 7;
W_FireAxe ();
};
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 ] {self.weaponframe=3;W_FireAxe();};
void() player_axec3 = [$axattc3, player_axec4 ] {
self.weaponframe = 3;
W_FireAxe ();
};
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 ] {self.weaponframe=7;W_FireAxe();};
void() player_axed3 = [$axattd3, player_axed4 ] {
self.weaponframe = 7;
W_FireAxe ();
};
void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
//============================================================================
void() player_nail1 =[$nailatt1, player_nail2 ]
{
muzzleflash();
muzzleflash ();
if (!self.button0 || intermission_running || self.impulse) {
player_run ();
return;
}
if (!self.button0 || intermission_running || self.impulse)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
@ -189,12 +173,16 @@ void() player_nail1 =[$nailatt1, player_nail2 ]
W_FireSpikes (4);
self.attack_finished = time + 0.2;
};
void() player_nail2 =[$nailatt2, player_nail1 ]
{
muzzleflash();
muzzleflash ();
if (!self.button0 || intermission_running || self.impulse) {
player_run ();
return;
}
if (!self.button0 || intermission_running || self.impulse)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 9)
self.weaponframe = 1;
@ -207,36 +195,44 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
void() player_light1 =[$light1, player_light2 ]
{
muzzleflash();
muzzleflash ();
if (!self.button0 || intermission_running) {
player_run ();
return;
}
if (!self.button0 || intermission_running)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
SuperDamageSound ();
W_FireLightning ();
self.attack_finished = time + 0.2;
};
void() player_light2 =[$light2, player_light1 ]
{
muzzleflash();
muzzleflash ();
if (!self.button0 || intermission_running) {
player_run ();
return;
}
if (!self.button0 || intermission_running)
{player_run ();return;}
self.weaponframe = self.weaponframe + 1;
if (self.weaponframe == 5)
self.weaponframe = 1;
SuperDamageSound();
W_FireLightning();
SuperDamageSound ();
W_FireLightning ();
self.attack_finished = time + 0.2;
};
//============================================================================
void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
muzzleflash();};
void() player_rocket1 =[$rockatt1, player_rocket2 ] {
self.weaponframe = 1;
muzzleflash ();
};
void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
@ -246,94 +242,103 @@ void(float num_bubbles) DeathBubbles;
void() PainSound =
{
local float rs;
local float rs;
if (self.health < 0)
return;
if (damage_attacker.classname == "teledeath")
{
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
// water pain sounds
if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
{
DeathBubbles(1);
if (random() > 0.5)
sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
return;
}
// slime pain sounds
if (self.watertype == CONTENT_SLIME)
{
// FIX ME put in some steam here
if (random() > 0.5)
switch (self.watertype) {
case CONTENT_WATER: // water pain sounds
if (self.waterlevel == 3) {
DeathBubbles (1);
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
return;
}
break;
case CONTENT_SLIME: // slime pain sounds
// FIXME put in some steam here
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
}
if (self.watertype == CONTENT_LAVA)
{
if (random() > 0.5)
case CONTENT_LAVA:
// FIXME put in some steam here
if (random () > 0.5)
sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
return;
default:
break;
}
if (self.pain_finished > time)
{
if (self.pain_finished > time) {
self.axhitme = 0;
return;
}
self.pain_finished = time + 0.5;
// don't make multiple pain sounds right after each other
// don't make multiple pain sounds right after each other
// ax pain sound
if (self.axhitme == 1)
{
// ax pain sound
if (self.axhitme == 1) {
self.axhitme = 0;
sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
return;
}
rs = rint((random() * 5) + 1);
rs = rint ((random () * 5) + 1);
self.noise = "";
if (rs == 1)
switch (rs) {
case 1:
self.noise = "player/pain1.wav";
else if (rs == 2)
break;
case 2:
self.noise = "player/pain2.wav";
else if (rs == 3)
break;
case 3:
self.noise = "player/pain3.wav";
else if (rs == 4)
break;
case 4:
self.noise = "player/pain4.wav";
else if (rs == 5)
break;
case 5:
self.noise = "player/pain5.wav";
else
break;
default:
self.noise = "player/pain6.wav";
break;
}
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
return;
};
void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
void() player_pain1 = [ $pain1, player_pain2 ] {
PainSound ();
self.weaponframe = 0;
};
void() player_pain2 = [ $pain2, player_pain3 ] {};
void() player_pain3 = [ $pain3, player_pain4 ] {};
void() player_pain4 = [ $pain4, player_pain5 ] {};
void() player_pain5 = [ $pain5, player_pain6 ] {};
void() player_pain6 = [ $pain6, player_run ] {};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
void() player_axpain1 = [ $axpain1, player_axpain2 ] {
PainSound ();
self.weaponframe = 0;
};
void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
@ -344,7 +349,6 @@ void(entity attacker, float damage) player_pain =
{
if (self.weaponframe)
return;
if (self.invisible_finished > time)
return; // eyes don't have pain frames
@ -363,10 +367,12 @@ void() player_die_ax1;
void() DeathBubblesSpawn =
{
local entity bubble;
local entity bubble;
if (self.owner.waterlevel != 3)
return;
bubble = spawn();
bubble = spawn ();
setmodel (bubble, "progs/s_bubble.spr");
setorigin (bubble, self.owner.origin + '0 0 24');
bubble.movetype = MOVETYPE_NOCLIP;
@ -382,14 +388,14 @@ local entity bubble;
self.think = DeathBubblesSpawn;
self.air_finished = self.air_finished + 1;
if (self.air_finished >= self.bubble_count)
remove(self);
remove (self);
};
void(float num_bubbles) DeathBubbles =
{
local entity bubble_spawner;
local entity bubble_spawner;
bubble_spawner = spawn();
bubble_spawner = spawn ();
setorigin (bubble_spawner, self.origin);
bubble_spawner.movetype = MOVETYPE_NONE;
bubble_spawner.solid = SOLID_NOT;
@ -401,20 +407,18 @@ local entity bubble_spawner;
return;
};
void() DeathSound =
{
local float rs;
local float rs;
// water death sounds
if (self.waterlevel == 3)
{
DeathBubbles(5);
if (self.waterlevel == 3) {
DeathBubbles (5);
sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
return;
}
rs = rint ((random() * 4) + 1);
rs = rint (4 * random () + 1);
if (rs == 1)
self.noise = "player/death1.wav";
if (rs == 2)
@ -430,49 +434,35 @@ local float rs;
return;
};
void() PlayerDead =
{
self.nextthink = -1;
// allow respawn after a certain time
// allow respawn after a certain time
self.deadflag = DEAD_DEAD;
};
vector(float dm) VelocityForDamage =
{
local vector v;
local vector v;
if (vlen(damage_inflictor.velocity)>0)
{
if (vlen (damage_inflictor.velocity) > 0) {
// dprint ("Velocity gib\n");
v = 0.5 * damage_inflictor.velocity;
v = v + (25 * normalize(self.origin-damage_inflictor.origin));
v_z = 100 + 240 * random();
v_x = v_x + (200 * crandom());
v_y = v_y + (200 * crandom());
//dprint ("Velocity gib\n");
}
else
{
v_x = 100 * crandom();
v_y = 100 * crandom();
v_z = 200 + 100 * random();
v += 25 * normalize (self.origin - damage_inflictor.origin);
v_x = v_x + (400 * (random () - 0.5));
v_y = v_y + (400 * (random () - 0.5));
v_z = 100 + 240 * random ();
} else {
v_x = 200 * (random () - 0.5);
v_y = 200 * (random () - 0.5);
v_z = 200 + 100 * random ();
}
//v_x = 100 * crandom();
//v_y = 100 * crandom();
//v_z = 200 + 100 * random();
if (dm > -50)
{
// dprint ("level 1\n");
if (dm > -50) {
v = v * 0.7;
}
else if (dm > -200)
{
// dprint ("level 3\n");
} else if (dm > -200) {
v = v * 2;
}
else
} else
v = v * 10;
return v;
@ -480,21 +470,21 @@ vector(float dm) VelocityForDamage =
void(string gibname, float dm) ThrowGib =
{
local entity new;
local entity new;
new = spawn();
new = spawn ();
new.origin = self.origin;
setmodel (new, gibname);
setsize (new, '0 0 0', '0 0 0');
new.velocity = VelocityForDamage (dm);
new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.avelocity_x = 600 * random ();
new.avelocity_y = 600 * random ();
new.avelocity_z = 600 * random ();
new.think = SUB_Remove;
new.ltime = time;
new.nextthink = time + 10 + random()*10;
new.nextthink = time + 10 + 10 * random ();
new.frame = 0;
new.flags = 0;
};
@ -512,10 +502,9 @@ void(string gibname, float dm) ThrowHead =
self.velocity = VelocityForDamage (dm);
self.origin_z = self.origin_z - 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.avelocity = crandom() * '0 600 0';
self.avelocity = crandom () * '0 600 0';
};
void() GibPlayer =
{
ThrowHead ("progs/h_player.mdl", self.health);
@ -525,19 +514,16 @@ void() GibPlayer =
self.deadflag = DEAD_DEAD;
if (damage_attacker.classname == "teledeath")
{
if (damage_attacker.classname == "teledeath") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (damage_attacker.classname == "teledeath2")
{
if (damage_attacker.classname == "teledeath2") {
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (random() < 0.5)
if (random () < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
else
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
@ -545,33 +531,30 @@ void() GibPlayer =
void() PlayerDie =
{
local float i;
local string s;
local float i;
local string s;
self.items = self.items - (self.items & IT_INVISIBILITY);
if ((stof(infokey(world,"dq"))) != 0)
{
if (self.super_damage_finished > 0)
{
if ((stof (infokey (world, "dq"))) != 0) {
if (self.super_damage_finished > 0) {
DropQuad (self.super_damage_finished - time);
bprint (PRINT_LOW, self.netname);
if (deathmatch == 4)
bprint (PRINT_LOW, " lost an OctaPower with ");
else
bprint (PRINT_LOW, " lost a quad with ");
s = ftos(rint(self.super_damage_finished - time));
s = ftos (rint (self.super_damage_finished - time));
bprint (PRINT_LOW, s);
bprint (PRINT_LOW, " seconds remaining\n");
}
}
if ((stof(infokey(world,"dr"))) != 0)
{
if (self.invisible_finished > 0)
{
if ((stof (infokey (world, "dr"))) != 0) {
if (self.invisible_finished > 0) {
bprint (PRINT_LOW, self.netname);
bprint (PRINT_LOW, " lost a ring with ");
s = ftos(rint(self.invisible_finished - time));
s = ftos (rint (self.invisible_finished - time));
bprint (PRINT_LOW, s);
bprint (PRINT_LOW, " seconds remaining\n");
DropRing (self.invisible_finished - time);
@ -584,7 +567,7 @@ void() PlayerDie =
self.radsuit_finished = 0;
self.modelindex = modelindex_player; // don't use eyes
DropBackpack();
DropBackpack ();
self.weaponmodel="";
self.view_ofs = '0 0 -8';
@ -593,46 +576,51 @@ void() PlayerDie =
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.movetype = MOVETYPE_TOSS;
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;
self.velocity_z = self.velocity_z + 300 * random ();
if (self.health < -40)
{
if (self.health < -40) {
GibPlayer ();
return;
}
DeathSound();
self.angles_x = 0;
self.angles_z = 0;
if (self.weapon == IT_AXE)
{
if (self.weapon == IT_AXE) {
player_die_ax1 ();
return;
}
i = cvar("temp1");
i = cvar ("temp1");
if (!i)
i = 1 + floor(random()*6);
if (i == 1)
player_diea1();
else if (i == 2)
player_dieb1();
else if (i == 3)
player_diec1();
else if (i == 4)
player_died1();
else
player_diee1();
i = 1 + floor (6 * random ());
switch (i) {
case 1:
player_diea1 ();
break;
case 2:
player_dieb1 ();
break;
case 3:
player_diec1 ();
break;
case 5:
player_died1 ();
break;
default:
player_diee1 ();
break;
}
};
void() set_suicide_frame =
{ // used by klill command and diconnect command
{ // 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;
@ -640,7 +628,6 @@ void() set_suicide_frame =
self.nextthink = -1;
};
void() player_diea1 = [ $deatha1, player_diea2 ] {};
void() player_diea2 = [ $deatha2, player_diea3 ] {};
void() player_diea3 = [ $deatha3, player_diea4 ] {};

View file

@ -1,4 +1,3 @@
void() monster_ogre = {remove(self);};
void() monster_demon1 = {remove(self);};
void() monster_shambler = {remove(self);};
@ -17,8 +16,7 @@ void() monster_oldone = {remove(self);};
void() event_lightning = {remove(self);};
/*
==============================================================================
=============================================================================
MOVETARGET CODE
The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
@ -31,7 +29,6 @@ the next spot to move to. If not present, stop here for good.
pausetime
The number of seconds to spend standing or bowing for path_stand or path_bow
==============================================================================
*/
@ -45,11 +42,10 @@ moving towards it, change the next destination and continue.
*/
void() t_movetarget =
{
local entity temp;
local entity temp;
if (other.movetarget != self)
return;
if (other.enemy)
return; // fighting, not following a path
@ -58,21 +54,19 @@ local entity temp;
other = temp;
if (self.classname == "monster_ogre")
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
// play chainsaw drag sound
sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
//dprint ("t_movetarget\n");
// dprint ("t_movetarget\n");
self.goalentity = self.movetarget = find (world, targetname, other.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.movetarget)
{
self.ideal_yaw = vectoyaw (self.goalentity.origin - self.origin);
if (!self.movetarget) {
self.pausetime = time + 999999;
self.th_stand ();
return;
}
};
void() movetarget_f =
{
if (!self.targetname)
@ -81,7 +75,6 @@ void() movetarget_f =
self.solid = SOLID_TRIGGER;
self.touch = t_movetarget;
setsize (self, '-8 -8 -8', '8 8 8');
};
/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
@ -91,7 +84,3 @@ void() path_corner =
{
movetarget_f ();
};
//============================================================================

View file

@ -50,13 +50,14 @@ void() SpectatorImpulseCommand =
{
if (self.impulse == 1) {
// teleport the spectator to the next spawn point
// note that if the spectator is tracking, this doesn't do
// much
self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
// note that if the spectator is tracking, this doesn't do much
self.goalentity = find (self.goalentity, classname,
"info_player_deathmatch");
if (self.goalentity == world)
self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
self.goalentity = find (self.goalentity, classname,
"info_player_deathmatch");
if (self.goalentity != world) {
setorigin(self, self.goalentity.origin);
setorigin (self, self.goalentity.origin);
self.angles = self.goalentity.angles;
self.fixangle = TRUE; // turn this way immediately
}
@ -76,9 +77,6 @@ void() SpectatorThink =
{
// self.origin, etc contains spectator position, so you could
// do some neat stuff here
if (self.impulse)
SpectatorImpulseCommand();
SpectatorImpulseCommand ();
};

View file

@ -1,4 +1,3 @@
// these are the only sprites still in the game...
$spritename s_explod
@ -11,16 +10,13 @@ $frame 24 88 56 56
$frame 120 88 56 56
$frame 216 88 56 56
$spritename s_bubble
$type vp_parallel
$load /raid/quake/id1/gfx/sprites/bubble.lbm
$frame 16 16 16 16
$frame 40 16 16 16
$spritename s_light
$type vp_parallel
$load /raid/quake/id1/gfx/sprites/light.lbm
$frame 104 32 32 32

View file

@ -1,10 +1,7 @@
void() SUB_Null = {};
void() SUB_Remove = {remove(self);};
/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles.
@ -15,8 +12,7 @@ vector() SetMovedir =
self.movedir = '0 0 1';
else if (self.angles == '0 -2 0')
self.movedir = '0 0 -1';
else
{
else {
makevectors (self.angles);
self.movedir = v_forward;
}
@ -24,15 +20,10 @@ vector() SetMovedir =
self.angles = '0 0 0';
};
/*
================
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.
// 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.
if (self.angles != '0 0 0')
SetMovedir ();
self.solid = SOLID_TRIGGER;
@ -52,7 +43,7 @@ self.origin traveling at speed
*/
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
{
local entity stemp;
local entity stemp;
stemp = self;
self = ent;
@ -62,57 +53,51 @@ local entity stemp;
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
{
local vector vdestdelta;
local float len, traveltime;
local float len, traveltime;
local vector vdestdelta;
if (!tspeed)
objerror("No speed is defined!");
objerror ("No speed is defined!");
self.think1 = func;
self.finaldest = tdest;
self.think = SUB_CalcMoveDone;
if (tdest == self.origin)
{
if (tdest == self.origin) {
self.velocity = '0 0 0';
self.nextthink = self.ltime + 0.1;
return;
}
// set destdelta to the vector needed to move
// set destdelta to the vector needed to move
vdestdelta = tdest - self.origin;
// calculate length of vector
// calculate length of vector
len = vlen (vdestdelta);
// divide by speed to get time to reach dest
// divide by speed to get time to reach dest
traveltime = len / tspeed;
if (traveltime < 0.03)
traveltime = 0.03;
// set nextthink to trigger a think when dest is reached
// set nextthink to trigger a think when dest is reached
self.nextthink = self.ltime + traveltime;
// scale the destdelta vector by the time spent traveling to get velocity
self.velocity = vdestdelta * (1/traveltime); // qcc won't take vec/float
// scale the destdelta vector by the time spent traveling to get velocity
self.velocity = vdestdelta * (1 / traveltime); // qcc won't take vec/float
};
/*
============
After moving, set origin to exact final destination
============
*/
// After moving, set origin to exact final destination
void() SUB_CalcMoveDone =
{
setorigin(self, self.finaldest);
setorigin (self, self.finaldest);
self.velocity = '0 0 0';
self.nextthink = -1;
if (self.think1)
self.think1();
self.think1 ();
};
/*
=============
SUB_CalcAngleMove
@ -125,7 +110,7 @@ The calling function should make sure self.think is valid
*/
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt =
{
local entity stemp;
local entity stemp;
stemp = self;
self = ent;
SUB_CalcAngleMove (destangle, tspeed, func);
@ -134,47 +119,42 @@ local entity stemp;
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
{
local vector destdelta;
local float len, traveltime;
local vector destdelta;
local float len, traveltime;
if (!tspeed)
objerror("No speed is defined!");
// set destdelta to the vector needed to move
objerror ("No speed is defined!");
// set destdelta to the vector needed to move
destdelta = destangle - self.angles;
// calculate length of vector
// calculate length of vector
len = vlen (destdelta);
// divide by speed to get time to reach dest
// divide by speed to get time to reach dest
traveltime = len / tspeed;
// set nextthink to trigger a think when dest is reached
// set nextthink to trigger a think when dest is reached
self.nextthink = self.ltime + traveltime;
// scale the destdelta vector by the time spent traveling to get velocity
// scale the destdelta vector by the time spent traveling to get velocity
self.avelocity = destdelta * (1 / traveltime);
self.think1 = func;
self.finalangle = destangle;
self.think = SUB_CalcAngleMoveDone;
};
/*
============
After rotating, set angle to exact final angle
============
*/
// After rotating, set angle to exact final angle
void() SUB_CalcAngleMoveDone =
{
self.angles = self.finalangle;
self.avelocity = '0 0 0';
self.nextthink = -1;
if (self.think1)
self.think1();
self.think1 ();
};
//=============================================================================
void() DelayThink =
@ -183,7 +163,7 @@ void() DelayThink =
activator = self.enemy;
SUB_UseTargets ();
if (rem)
remove(self);
remove (self);
};
/*
@ -207,15 +187,12 @@ match (string)self.target and call their .use function
*/
void() SUB_UseTargets =
{
local entity t, stemp, otemp, act;
local entity act, otemp, stemp, t;
//
// check for a delay
//
if (self.delay)
{
// create a temp object to fire at a later time
t = spawn();
// check for a delay
if (self.delay) {
// create a temp object to fire at a later time
t = spawn ();
t.classname = "DelayedUse";
t.nextthink = time + self.delay;
t.think = DelayThink;
@ -225,63 +202,46 @@ void() SUB_UseTargets =
t.target = self.target;
return;
}
//
// print the message
//
if (activator.classname == "player" && self.message != "")
{
// print the message
if (activator.classname == "player" && self.message != "") {
centerprint (activator, self.message);
if (!self.noise)
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
//
// kill the killtagets
//
if (self.killtarget)
{
// kill the killtagets
if (self.killtarget) {
local string kt = self.killtarget;
t = world;
do
{
do {
t = find (t, targetname, kt);
if (!t)
return;
remove (t);
} while ( 1 );
} while (1);
}
//
// fire targets
//
if (self.target)
{
// fire targets
if (self.target) {
act = activator;
t = world;
do
{
do {
t = find (t, targetname, self.target);
if (!t)
{
return;
}
stemp = self;
otemp = other;
self = t;
other = stemp;
if (self.use != SUB_Null)
{
if (self.use != SUB_Null) {
if (self.use)
self.use ();
}
self = stemp;
other = otemp;
activator = act;
} while ( 1 );
} while (1);
}
};

View file

@ -1,7 +1,5 @@
entity stemp, otemp, s, old;
void() trigger_reactivate =
{
self.solid = SOLID_TRIGGER;
@ -15,27 +13,22 @@ float SPAWNFLAG_NOTOUCH = 1;
// the wait time has passed, so set back up for another activation
void() multi_wait =
{
if (self.max_health)
{
if (self.max_health) {
self.health = self.max_health;
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
}
};
// 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 =
{
if (self.nextthink > time)
{
return; // allready been triggered
}
if (self.classname == "trigger_secret")
{
if (self.classname == "trigger_secret") {
if (self.enemy.classname != "player")
return;
found_secrets = found_secrets + 1;
@ -45,21 +38,18 @@ void() multi_trigger =
if (self.noise)
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
// don't trigger again until reset
// don't trigger again until reset
self.takedamage = DAMAGE_NO;
activator = self.enemy;
SUB_UseTargets();
if (self.wait > 0)
{
SUB_UseTargets ();
if (self.wait > 0) {
self.think = multi_wait;
self.nextthink = time + self.wait;
}
else
{ // we can't just remove (self) here, because this is a touch function
// called wheil C code is looping through area links...
} else { // we can't just remove (self) here, because this is a touch
// function called wheil C code is looping through area links..
self.touch = SUB_Null;
self.nextthink = time + 0.1;
self.think = SUB_Remove;
@ -69,28 +59,27 @@ void() multi_trigger =
void() multi_killed =
{
self.enemy = damage_attacker;
multi_trigger();
multi_trigger ();
};
void() multi_use =
{
self.enemy = activator;
multi_trigger();
multi_trigger ();
};
void() multi_touch =
{
if (other.classname != "player")
return;
// if the trigger has an angles field, check player's facing direction
if (self.movedir != '0 0 0')
{
// if the trigger has an angles field, check player's facing direction
if (self.movedir != '0 0 0') {
makevectors (other.angles);
if (v_forward * self.movedir < 0)
return; // not facing the right way
}
self.enemy = other;
multi_trigger ();
};
@ -110,20 +99,20 @@ set "message" to text string
*/
void() trigger_multiple =
{
if (self.sounds == 1)
{
switch (self.sounds) {
case 1:
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
break;
case 2:
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
}
else if (self.sounds == 3)
{
case 3:
precache_sound ("misc/trigger1.wav");
self.noise = "misc/trigger1.wav";
break;
default:
break;
}
if (!self.wait)
@ -132,8 +121,7 @@ void() trigger_multiple =
InitTrigger ();
if (self.health)
{
if (self.health) {
if (self.spawnflags & SPAWNFLAG_NOTOUCH)
objerror ("health and notouch don't make sense\n");
self.max_health = self.health;
@ -141,17 +129,12 @@ void() trigger_multiple =
self.takedamage = DAMAGE_YES;
self.solid = SOLID_BBOX;
setorigin (self, self.origin); // make sure it links into the world
}
else
{
if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
{
} else {
if (!(self.spawnflags & SPAWNFLAG_NOTOUCH))
self.touch = multi_touch;
}
}
};
/*QUAKED trigger_once (.5 .5 .5) ? notouch
Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching
"targetname". If "health" is set, the trigger must be killed to activate.
@ -168,7 +151,7 @@ set "message" to text string
void() trigger_once =
{
self.wait = -1;
trigger_multiple();
trigger_multiple ();
};
//=============================================================================
@ -181,7 +164,6 @@ void() trigger_relay =
self.use = SUB_UseTargets;
};
//=============================================================================
/*QUAKED trigger_secret (.5 .5 .5) ?
@ -201,16 +183,17 @@ void() trigger_secret =
self.message = "You found a secret area!";
if (!self.sounds)
self.sounds = 1;
if (self.sounds == 1)
{
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
}
else if (self.sounds == 2)
{
switch (self.sounds) {
case 2:
precache_sound ("misc/talk.wav");
self.noise = "misc/talk.wav";
break;
default:
case 1:
precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
break;
}
trigger_multiple ();
@ -218,33 +201,36 @@ void() trigger_secret =
//=============================================================================
void() counter_use =
{
self.count = self.count - 1;
if (self.count < 0)
return;
if (self.count != 0)
{
if (self.count != 0) {
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
{
if (self.count >= 4)
centerprint (activator, "There are more to go...");
else if (self.count == 3)
centerprint (activator, "Only 3 more to go...");
else if (self.count == 2)
centerprint (activator, "Only 2 more to go...");
else
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) {
switch (self.count) {
case 1:
centerprint (activator, "Only 1 more to go...");
break;
case 2:
centerprint (activator, "Only 2 more to go...");
break;
case 3:
centerprint (activator, "Only 3 more to go...");
break;
default:
centerprint (activator, "There are more to go...");
break;
}
}
return;
}
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
centerprint(activator, "Sequence completed!");
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
centerprint (activator, "Sequence completed!");
self.enemy = activator;
multi_trigger ();
};
@ -265,24 +251,17 @@ void() trigger_counter =
self.use = counter_use;
};
/*
==============================================================================
TELEPORT TRIGGERS
==============================================================================
*/
// TELEPORT TRIGGERS ==========================================================
float PLAYER_ONLY = 1;
float SILENT = 2;
void() play_teleport =
{
local float v;
local string tmpstr;
local float v;
local string tmpstr;
v = random() * 5;
v = 5 * random ();
if (v < 1)
tmpstr = "misc/r_tele1.wav";
else if (v < 2)
@ -305,25 +284,20 @@ void(vector org) spawn_tfog =
s.nextthink = time + 0.2;
s.think = play_teleport;
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_TELEPORT);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_TELEPORT);
WriteCoordV (MSG_MULTICAST, org);
multicast (org, MULTICAST_PHS);
};
void() tdeath_touch =
{
local entity other2;
local entity other2;
if (other == self.owner)
return;
// frag anyone who teleports in on top of an invincible player
if (other.classname == "player")
{
// frag anyone who teleports in on top of an invincible player
if (other.classname == "player") {
if (other.invincible_finished > time &&
self.owner.invincible_finished > time) {
self.classname = "teledeath3";
@ -334,28 +308,24 @@ void() tdeath_touch =
self.owner = other;
T_Damage (other2, self, self, 50000);
}
if (other.invincible_finished > time)
{
if (other.invincible_finished > time) {
self.classname = "teledeath2";
T_Damage (self.owner, self, self, 50000);
return;
}
}
if (other.health)
{
T_Damage (other, self, self, 50000);
}
};
void(vector org, entity death_owner) spawn_tdeath =
{
local entity death;
local entity death;
death = spawn();
death = spawn ();
death.classname = "teledeath";
death.movetype = MOVETYPE_NONE;
death.solid = SOLID_TRIGGER;
@ -372,62 +342,54 @@ local entity death;
void() teleport_touch =
{
local entity t;
local vector org;
local entity t;
local vector org;
if (self.targetname)
{
if (self.nextthink < time)
{
return; // not fired yet
}
}
if (self.spawnflags & PLAYER_ONLY)
{
if (other.classname != "player")
return;
}
// only teleport living creatures
// only teleport living creatures
if (other.health <= 0 || other.solid != SOLID_SLIDEBOX)
return;
SUB_UseTargets ();
// put a tfog where the player was
// put a tfog where the player was
spawn_tfog (other.origin);
t = find (world, targetname, self.target);
if (!t)
objerror ("couldn't find target");
// spawn a tfog flash in front of the destination
// spawn a tfog flash in front of the destination
makevectors (t.mangle);
org = t.origin + 32 * v_forward;
spawn_tfog (org);
spawn_tdeath(t.origin, other);
spawn_tdeath (t.origin, other);
// move the player and lock him down for a little while
if (!other.health)
{
// move the player and lock him down for a little while
if (!other.health) {
other.origin = t.origin;
other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
other.velocity = v_forward * (other.velocity_x + other.velocity_y);
return;
}
setorigin (other, t.origin);
other.angles = t.mangle;
if (other.classname == "player")
{
if (other.classname == "player") {
other.fixangle = 1; // turn this way immediately
other.teleport_time = time + 0.7;
if (other.flags & FL_ONGROUND)
other.flags = other.flags - FL_ONGROUND;
other.flags &= ~FL_ONGROUND;
other.velocity = v_forward * 300;
}
other.flags = other.flags - other.flags & FL_ONGROUND;
other.flags &= ~FL_ONGROUND;
};
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
@ -435,7 +397,7 @@ This is the destination marker for a teleporter. It should have a "targetname"
*/
void() info_teleport_destination =
{
// this does nothing, just serves as a target spot
// this does nothing, just serves as a target spot
self.mangle = self.angles;
self.angles = '0 0 0';
self.model = "";
@ -458,7 +420,7 @@ If the trigger_teleport has a targetname, it will only teleport entities when it
*/
void() trigger_teleport =
{
local vector o;
local vector o;
InitTrigger ();
self.touch = teleport_touch;
@ -467,21 +429,14 @@ void() trigger_teleport =
objerror ("no target");
self.use = teleport_use;
if (!(self.spawnflags & SILENT))
{
if (!(self.spawnflags & SILENT)) {
precache_sound ("ambience/hum1.wav");
o = (self.mins + self.maxs)*0.5;
ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
o = (self.mins + self.maxs) * 0.5;
ambientsound (o, "ambience/hum1.wav", 0.5 , ATTN_STATIC);
}
};
/*
==============================================================================
trigger_setskill
==============================================================================
*/
// trigger_setskill ===========================================================
/*QUAKED trigger_setskill (.5 .5 .5) ?
sets skill level to the value of "message".
@ -492,14 +447,7 @@ void() trigger_setskill =
remove (self);
};
/*
==============================================================================
ONLY REGISTERED TRIGGERS
==============================================================================
*/
// ONLY REGISTERED TRIGGERS ===================================================
void() trigger_onlyregistered_touch =
{
@ -509,18 +457,14 @@ void() trigger_onlyregistered_touch =
return;
self.attack_finished = time + 2;
if (cvar("registered"))
{
if (cvar ("registered")) {
local integer rem = self.targetname != self.killtarget;
self.message = "";
SUB_UseTargets ();
if (rem)
remove (self);
}
else
{
if (self.message != "")
{
} else {
if (self.message != "") {
centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
@ -547,8 +491,7 @@ void() hurt_on =
void() hurt_touch =
{
if (other.takedamage)
{
if (other.takedamage) {
self.solid = SOLID_NOT;
T_Damage (other, self, self, self.dmg);
self.think = hurt_on;
@ -579,23 +522,19 @@ void() trigger_push_touch =
{
if (other.classname == "grenade")
other.velocity = self.speed * self.movedir * 10;
else if (other.health > 0)
{
else if (other.health > 0) {
other.velocity = self.speed * self.movedir * 10;
if (other.classname == "player")
{
if (other.fly_sound < time)
{
if (other.classname == "player") {
if (other.fly_sound < time) {
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
}
}
}
if (self.spawnflags & PUSH_ONCE)
remove(self);
remove (self);
};
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
Pushes the player
*/
@ -612,16 +551,16 @@ void() trigger_push =
void() trigger_monsterjump_touch =
{
if ( other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER )
if (other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER)
return;
// set XY even if not on ground, so the jump will clear lips
// set XY even if not on ground, so the jump will clear lips
other.velocity_x = self.movedir_x * self.speed;
other.velocity_y = self.movedir_y * self.speed;
if ( !(other.flags & FL_ONGROUND) )
if (!(other.flags & FL_ONGROUND))
return;
other.flags = other.flags - FL_ONGROUND;
other.velocity_z = self.height;
@ -643,4 +582,3 @@ void() trigger_monsterjump =
InitTrigger ();
self.touch = trigger_monsterjump_touch;
};

File diff suppressed because it is too large Load diff

View file

@ -1,159 +1,4 @@
void() InitBodyQue;
void() main =
{
dprint ("main function\n");
// these are just commands the the prog compiler to copy these files
precache_file ("progs.dat");
precache_file ("gfx.wad");
precache_file ("quake.rc");
precache_file ("default.cfg");
precache_file ("end1.bin");
precache_file2 ("end2.bin");
precache_file ("demo1.dem");
precache_file ("demo2.dem");
precache_file ("demo3.dem");
//
// these are all of the lumps from the cached.ls files
//
precache_file ("gfx/palette.lmp");
precache_file ("gfx/colormap.lmp");
precache_file2 ("gfx/pop.lmp");
precache_file ("gfx/complete.lmp");
precache_file ("gfx/inter.lmp");
precache_file ("gfx/ranking.lmp");
precache_file ("gfx/vidmodes.lmp");
precache_file ("gfx/finale.lmp");
precache_file ("gfx/conback.lmp");
precache_file ("gfx/qplaque.lmp");
precache_file ("gfx/menudot1.lmp");
precache_file ("gfx/menudot2.lmp");
precache_file ("gfx/menudot3.lmp");
precache_file ("gfx/menudot4.lmp");
precache_file ("gfx/menudot5.lmp");
precache_file ("gfx/menudot6.lmp");
precache_file ("gfx/menuplyr.lmp");
precache_file ("gfx/bigbox.lmp");
precache_file ("gfx/dim_modm.lmp");
precache_file ("gfx/dim_drct.lmp");
precache_file ("gfx/dim_ipx.lmp");
precache_file ("gfx/dim_tcp.lmp");
precache_file ("gfx/dim_mult.lmp");
precache_file ("gfx/mainmenu.lmp");
precache_file ("gfx/box_tl.lmp");
precache_file ("gfx/box_tm.lmp");
precache_file ("gfx/box_tr.lmp");
precache_file ("gfx/box_ml.lmp");
precache_file ("gfx/box_mm.lmp");
precache_file ("gfx/box_mm2.lmp");
precache_file ("gfx/box_mr.lmp");
precache_file ("gfx/box_bl.lmp");
precache_file ("gfx/box_bm.lmp");
precache_file ("gfx/box_br.lmp");
precache_file ("gfx/sp_menu.lmp");
precache_file ("gfx/ttl_sgl.lmp");
precache_file ("gfx/ttl_main.lmp");
precache_file ("gfx/ttl_cstm.lmp");
precache_file ("gfx/mp_menu.lmp");
precache_file ("gfx/netmen1.lmp");
precache_file ("gfx/netmen2.lmp");
precache_file ("gfx/netmen3.lmp");
precache_file ("gfx/netmen4.lmp");
precache_file ("gfx/netmen5.lmp");
precache_file ("gfx/sell.lmp");
precache_file ("gfx/help0.lmp");
precache_file ("gfx/help1.lmp");
precache_file ("gfx/help2.lmp");
precache_file ("gfx/help3.lmp");
precache_file ("gfx/help4.lmp");
precache_file ("gfx/help5.lmp");
precache_file ("gfx/pause.lmp");
precache_file ("gfx/loading.lmp");
precache_file ("gfx/p_option.lmp");
precache_file ("gfx/p_load.lmp");
precache_file ("gfx/p_save.lmp");
precache_file ("gfx/p_multi.lmp");
// sounds loaded by C code
precache_sound ("misc/menu1.wav");
precache_sound ("misc/menu2.wav");
precache_sound ("misc/menu3.wav");
precache_sound ("ambience/water1.wav");
precache_sound ("ambience/wind2.wav");
// shareware
precache_file ("maps/start.bsp");
precache_file ("maps/e1m1.bsp");
precache_file ("maps/e1m2.bsp");
precache_file ("maps/e1m3.bsp");
precache_file ("maps/e1m4.bsp");
precache_file ("maps/e1m5.bsp");
precache_file ("maps/e1m6.bsp");
precache_file ("maps/e1m7.bsp");
precache_file ("maps/e1m8.bsp");
// registered
precache_file2 ("gfx/pop.lmp");
precache_file2 ("maps/e2m1.bsp");
precache_file2 ("maps/e2m2.bsp");
precache_file2 ("maps/e2m3.bsp");
precache_file2 ("maps/e2m4.bsp");
precache_file2 ("maps/e2m5.bsp");
precache_file2 ("maps/e2m6.bsp");
precache_file2 ("maps/e2m7.bsp");
precache_file2 ("maps/e3m1.bsp");
precache_file2 ("maps/e3m2.bsp");
precache_file2 ("maps/e3m3.bsp");
precache_file2 ("maps/e3m4.bsp");
precache_file2 ("maps/e3m5.bsp");
precache_file2 ("maps/e3m6.bsp");
precache_file2 ("maps/e3m7.bsp");
precache_file2 ("maps/e4m1.bsp");
precache_file2 ("maps/e4m2.bsp");
precache_file2 ("maps/e4m3.bsp");
precache_file2 ("maps/e4m4.bsp");
precache_file2 ("maps/e4m5.bsp");
precache_file2 ("maps/e4m6.bsp");
precache_file2 ("maps/e4m7.bsp");
precache_file2 ("maps/e4m8.bsp");
precache_file2 ("maps/end.bsp");
precache_file2 ("maps/dm1.bsp");
precache_file2 ("maps/dm2.bsp");
precache_file2 ("maps/dm3.bsp");
precache_file2 ("maps/dm4.bsp");
precache_file2 ("maps/dm5.bsp");
precache_file2 ("maps/dm6.bsp");
};
void() InitBodyQueue;
entity lastspawn;
@ -172,61 +17,58 @@ World Types:
void() worldspawn =
{
lastspawn = world;
InitBodyQue ();
InitBodyQueue ();
rj = 1;
// custom map attributes
// custom map attributes
if (self.model == "maps/e1m8.bsp")
cvar_set ("sv_gravity", "100");
else
cvar_set ("sv_gravity", "800");
// the area based ambient sounds MUST be the first precache_sounds
// the area based ambient sounds MUST be the first precache_sounds
// player precaches
W_Precache (); // get weapon precaches
// player precaches
W_Precache (); // get weapon precaches
// sounds used from C physics code
precache_sound ("demon/dland2.wav"); // landing thud
precache_sound ("misc/h2ohit1.wav"); // landing splash
// sounds used from C physics code
precache_sound ("demon/dland2.wav"); // landing thud
precache_sound ("misc/h2ohit1.wav"); // landing splash
// setup precaches allways needed
precache_sound ("items/itembk2.wav"); // item respawn sound
precache_sound ("player/plyrjmp8.wav"); // player jump
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land2.wav"); // player hurt landing
precache_sound ("player/drown1.wav"); // drowning pain
precache_sound ("player/drown2.wav"); // drowning pain
precache_sound ("player/gasp1.wav"); // gasping for air
precache_sound ("player/gasp2.wav"); // taking breath
precache_sound ("player/h2odeath.wav"); // drowning death
// setup precaches allways needed
precache_sound ("items/itembk2.wav"); // item respawn sound
precache_sound ("player/plyrjmp8.wav"); // player jump
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land2.wav"); // player hurt landing
precache_sound ("player/drown1.wav"); // drowning pain
precache_sound ("player/drown2.wav"); // drowning pain
precache_sound ("player/gasp1.wav"); // gasping for air
precache_sound ("player/gasp2.wav"); // taking breath
precache_sound ("player/h2odeath.wav"); // drowning death
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
precache_sound ("misc/r_tele1.wav"); // teleport sounds
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
precache_sound ("misc/r_tele1.wav"); // teleport sounds
precache_sound ("misc/r_tele2.wav");
precache_sound ("misc/r_tele3.wav");
precache_sound ("misc/r_tele4.wav");
precache_sound ("misc/r_tele5.wav");
precache_sound ("weapons/lock4.wav"); // ammo pick up
precache_sound ("weapons/pkup.wav"); // weapon up
precache_sound ("items/armor1.wav"); // armor up
precache_sound ("weapons/lhit.wav"); //lightning
precache_sound ("weapons/lstart.wav"); //lightning start
precache_sound ("weapons/lock4.wav"); // ammo pick up
precache_sound ("weapons/pkup.wav"); // weapon up
precache_sound ("items/armor1.wav"); // armor up
precache_sound ("weapons/lhit.wav"); // lightning
precache_sound ("weapons/lstart.wav"); // lightning start
precache_sound ("items/damage3.wav");
precache_sound ("misc/power.wav"); //lightning for boss
precache_sound ("misc/power.wav"); // lightning for boss
// player gib sounds
precache_sound ("player/gib.wav"); // player gib sound
precache_sound ("player/udeath.wav"); // player gib sound
precache_sound ("player/tornoff2.wav"); // gib sound
// player pain sounds
// player gib sounds
precache_sound ("player/gib.wav"); // player gib sound
precache_sound ("player/udeath.wav"); // player gib sound
precache_sound ("player/tornoff2.wav"); // gib sound
// player pain sounds
precache_sound ("player/pain1.wav");
precache_sound ("player/pain2.wav");
precache_sound ("player/pain3.wav");
@ -234,7 +76,7 @@ void() worldspawn =
precache_sound ("player/pain5.wav");
precache_sound ("player/pain6.wav");
// player death sounds
// player death sounds
precache_sound ("player/death1.wav");
precache_sound ("player/death2.wav");
precache_sound ("player/death3.wav");
@ -243,29 +85,28 @@ void() worldspawn =
precache_sound ("boss1/sight1.wav");
// ax sounds
precache_sound ("weapons/ax1.wav"); // ax swoosh
precache_sound ("player/axhit1.wav"); // ax hit meat
precache_sound ("player/axhit2.wav"); // ax hit world
// ax sounds
precache_sound ("weapons/ax1.wav"); // ax swoosh
precache_sound ("player/axhit1.wav"); // ax hit meat
precache_sound ("player/axhit2.wav"); // ax hit world
precache_sound ("player/h2ojump.wav"); // player jumping into water
precache_sound ("player/slimbrn2.wav"); // player enter slime
precache_sound ("player/inh2o.wav"); // player enter water
precache_sound ("player/inlava.wav"); // player enter lava
precache_sound ("misc/outwater.wav"); // leaving water sound
precache_sound ("player/h2ojump.wav"); // player jump into water
precache_sound ("player/slimbrn2.wav"); // player enter slime
precache_sound ("player/inh2o.wav"); // player enter water
precache_sound ("player/inlava.wav"); // player enter lava
precache_sound ("misc/outwater.wav"); // leaving water sound
precache_sound ("player/lburn1.wav"); // lava burn
precache_sound ("player/lburn2.wav"); // lava burn
precache_sound ("player/lburn1.wav"); // lava burn
precache_sound ("player/lburn2.wav"); // lava burn
precache_sound ("misc/water1.wav"); // swimming
precache_sound ("misc/water2.wav"); // swimming
precache_sound ("misc/water1.wav"); // swimming
precache_sound ("misc/water2.wav"); // swimming
// Invulnerability sounds
// Invulnerability sounds
precache_sound ("items/protect.wav");
precache_sound ("items/protect2.wav");
precache_sound ("items/protect3.wav");
precache_model ("progs/player.mdl");
precache_model ("progs/eyes.mdl");
precache_model ("progs/h_player.mdl");
@ -273,8 +114,8 @@ void() worldspawn =
precache_model ("progs/gib2.mdl");
precache_model ("progs/gib3.mdl");
precache_model ("progs/s_bubble.spr"); // drowning bubbles
precache_model ("progs/s_explod.spr"); // sprite explosion
precache_model ("progs/s_bubble.spr"); // drowning bubbles
precache_model ("progs/s_explod.spr"); // sprite explosion
precache_model ("progs/v_axe.mdl");
precache_model ("progs/v_shot.mdl");
@ -284,10 +125,10 @@ void() worldspawn =
precache_model ("progs/v_nail2.mdl");
precache_model ("progs/v_rock2.mdl");
precache_model ("progs/bolt.mdl"); // for lightning gun
precache_model ("progs/bolt2.mdl"); // for lightning gun
precache_model ("progs/bolt3.mdl"); // for boss shock
precache_model ("progs/lavaball.mdl"); // for testing
precache_model ("progs/bolt.mdl"); // for lightning gun
precache_model ("progs/bolt2.mdl"); // for lightning gun
precache_model ("progs/bolt3.mdl"); // for boss shock
precache_model ("progs/lavaball.mdl"); // for testing
precache_model ("progs/missile.mdl");
precache_model ("progs/grenade.mdl");
@ -299,108 +140,95 @@ void() worldspawn =
precache_model ("progs/zom_gib.mdl");
precache_model ("progs/v_light.mdl");
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
// 0 normal
lightstyle(0, "m");
lightstyle (0, "m");
// 1 FLICKER (first variety)
lightstyle(1, "mmnmmommommnonmmonqnmmo");
lightstyle (1, "mmnmmommommnonmmonqnmmo");
// 2 SLOW STRONG PULSE
lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
lightstyle (2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
// 3 CANDLE (first variety)
lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
lightstyle (3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
// 4 FAST STROBE
lightstyle(4, "mamamamamama");
lightstyle (4, "mamamamamama");
// 5 GENTLE PULSE 1
lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
lightstyle (5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
// 6 FLICKER (second variety)
lightstyle(6, "nmonqnmomnmomomno");
lightstyle (6, "nmonqnmomnmomomno");
// 7 CANDLE (second variety)
lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
lightstyle (7, "mmmaaaabcdefgmmmmaaaammmaamm");
// 8 CANDLE (third variety)
lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
lightstyle (8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
// 9 SLOW STROBE (fourth variety)
lightstyle(9, "aaaaaaaazzzzzzzz");
lightstyle (9, "aaaaaaaazzzzzzzz");
// 10 FLUORESCENT FLICKER
lightstyle(10, "mmamammmmammamamaaamammma");
lightstyle (10, "mmamammmmammamamaaamammma");
// 11 SLOW PULSE NOT FADE TO BLACK
lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
lightstyle (11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
// styles 32-62 are assigned by the light program for switchable lights
// 63 testing
lightstyle(63, "a");
lightstyle (63, "a");
};
void() StartFrame =
{
timelimit = cvar("timelimit") * 60;
fraglimit = cvar("fraglimit");
teamplay = cvar("teamplay");
deathmatch = cvar("deathmatch");
timelimit = cvar ("timelimit") * 60;
fraglimit = cvar ("fraglimit");
teamplay = cvar ("teamplay");
deathmatch = cvar ("deathmatch");
framecount = framecount + 1;
};
/*
==============================================================================
// BODY QUE ===================================================================
BODY QUE
entity bodyqueue_head;
==============================================================================
*/
entity bodyque_head;
void() bodyque =
{ // just here so spawn functions don't complain after the world
// creates bodyques
void() bodyqueue =
{
// just here so spawn functions don't complain after world creates bodyqueues
};
void() InitBodyQue =
void() InitBodyQueue =
{
bodyque_head = spawn();
bodyque_head.classname = "bodyque";
bodyque_head.owner = spawn();
bodyque_head.owner.classname = "bodyque";
bodyque_head.owner.owner = spawn();
bodyque_head.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner = spawn();
bodyque_head.owner.owner.owner.classname = "bodyque";
bodyque_head.owner.owner.owner.owner = bodyque_head;
bodyqueue_head = spawn ();
bodyqueue_head.classname = "bodyqueue";
bodyqueue_head.owner = spawn ();
bodyqueue_head.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner = spawn ();
bodyqueue_head.owner.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner.owner = spawn ();
bodyqueue_head.owner.owner.owner.classname = "bodyqueue";
bodyqueue_head.owner.owner.owner.owner = bodyqueue_head;
};
// make a body que entry for the given ent so the ent can be
// respawned elsewhere
void(entity ent) CopyToBodyQue =
// make body queue entry for the given ent so it can be respawned elsewhere
void(entity ent) CopyToBodyQueue =
{
bodyque_head.angles = ent.angles;
bodyque_head.model = ent.model;
bodyque_head.modelindex = ent.modelindex;
bodyque_head.frame = ent.frame;
bodyque_head.colormap = ent.colormap;
bodyque_head.movetype = ent.movetype;
bodyque_head.velocity = ent.velocity;
bodyque_head.flags = 0;
setorigin (bodyque_head, ent.origin);
setsize (bodyque_head, ent.mins, ent.maxs);
bodyque_head = bodyque_head.owner;
bodyqueue_head.angles = ent.angles;
bodyqueue_head.model = ent.model;
bodyqueue_head.modelindex = ent.modelindex;
bodyqueue_head.frame = ent.frame;
bodyqueue_head.colormap = ent.colormap;
bodyqueue_head.movetype = ent.movetype;
bodyqueue_head.velocity = ent.velocity;
bodyqueue_head.flags = 0;
setorigin (bodyqueue_head, ent.origin);
setsize (bodyqueue_head, ent.mins, ent.maxs);
bodyqueue_head = bodyqueue_head.owner;
};