forked from id/quake-qw-qc
as released 1997-06-13
This commit is contained in:
parent
1b11597f42
commit
ba33f2e180
8 changed files with 390 additions and 136 deletions
122
client.qc
122
client.qc
|
@ -28,6 +28,7 @@ Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitc
|
|||
*/
|
||||
void() info_intermission =
|
||||
{
|
||||
self.angles = self.mangle; // so C can get at it
|
||||
};
|
||||
|
||||
|
||||
|
@ -302,8 +303,14 @@ Returns the entity to spawn at
|
|||
*/
|
||||
entity() SelectSpawnPoint =
|
||||
{
|
||||
local entity spot, thing;
|
||||
local float pcount;
|
||||
local entity spot, newspot, thing;
|
||||
local float numspots, totalspots;
|
||||
local float rnum, pcount;
|
||||
local float rs;
|
||||
local entity spots;
|
||||
|
||||
numspots = 0;
|
||||
totalspots = 0;
|
||||
|
||||
// testinfo_player_start is only found in regioned levels
|
||||
spot = find (world, classname, "testplayerstart");
|
||||
|
@ -311,37 +318,61 @@ entity() SelectSpawnPoint =
|
|||
return spot;
|
||||
|
||||
// choose a info_player_deathmatch point
|
||||
spot = lastspawn;
|
||||
while (1)
|
||||
|
||||
// ok, find all spots that don't have players nearby
|
||||
|
||||
spots = world;
|
||||
spot = find (world, classname, "info_player_deathmatch");
|
||||
while (spot)
|
||||
{
|
||||
spot = find(spot, classname, "info_player_deathmatch");
|
||||
if (spot != world)
|
||||
{
|
||||
if (spot == lastspawn)
|
||||
return lastspawn;
|
||||
pcount = 0;
|
||||
thing = findradius(spot.origin, 50);
|
||||
while(thing)
|
||||
totalspots = totalspots + 1;
|
||||
|
||||
thing=findradius(spot.origin, 256);
|
||||
pcount=0;
|
||||
while (thing)
|
||||
{
|
||||
if (thing.classname == "player")
|
||||
pcount = pcount + 1;
|
||||
thing = thing.chain;
|
||||
}
|
||||
if (pcount == 0)
|
||||
{
|
||||
lastspawn = spot;
|
||||
return spot;
|
||||
}
|
||||
pcount=pcount + 1;
|
||||
thing=thing.chain;
|
||||
}
|
||||
if (pcount == 0) {
|
||||
spot.goalentity = spots;
|
||||
spots = spot;
|
||||
numspots = numspots + 1;
|
||||
}
|
||||
|
||||
spot = find (world, classname, "info_player_start");
|
||||
if (!spot)
|
||||
error ("PutClientInServer: no info_player_start on level");
|
||||
|
||||
// Get the next spot in the chain
|
||||
spot = find (spot, classname, "info_player_deathmatch");
|
||||
}
|
||||
totalspots=totalspots - 1;
|
||||
if (!numspots) {
|
||||
// ack, they are all full, just pick one at random
|
||||
// bprint (PRINT_HIGH, "Ackk! All spots are full. Selecting random spawn spot\n");
|
||||
totalspots = rint((random() * totalspots));
|
||||
spot = find (world, classname, "info_player_deathmatch");
|
||||
while (totalspots > 0) {
|
||||
totalspots = totalspots - 1;
|
||||
spot = find (spot, classname, "info_player_deathmatch");
|
||||
}
|
||||
return spot;
|
||||
}
|
||||
|
||||
// We now have the number of spots available on the map in numspots
|
||||
|
||||
// Generate a random number between 1 and numspots
|
||||
|
||||
numspots = numspots - 1;
|
||||
|
||||
numspots = rint((random() * numspots ) );
|
||||
|
||||
spot = spots;
|
||||
while (numspots > 0) {
|
||||
spot = spot.goalentity;
|
||||
numspots = numspots - 1;
|
||||
}
|
||||
return spot;
|
||||
|
||||
};
|
||||
|
||||
void() DecodeLevelParms;
|
||||
void() PlayerDie;
|
||||
|
||||
|
@ -459,6 +490,11 @@ void() PutClientInServer =
|
|||
|
||||
self.view_ofs = '0 0 22';
|
||||
|
||||
// Mod - Xian (May.20.97)
|
||||
// Bug where player would have velocity from their last kill
|
||||
|
||||
self.velocity = '0 0 0';
|
||||
|
||||
player_stand1 ();
|
||||
|
||||
makevectors(self.angles);
|
||||
|
@ -1113,6 +1149,19 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
return;
|
||||
}
|
||||
|
||||
if (targ.deathtype == "squish")
|
||||
{
|
||||
targ.deathtype = "";
|
||||
if (attacker != world)
|
||||
{
|
||||
bprint (PRINT_MEDIUM, attacker.netname);
|
||||
bprint (PRINT_MEDIUM," squishes ");
|
||||
bprint (PRINT_MEDIUM,targ.netname);
|
||||
bprint (PRINT_MEDIUM,"\n");
|
||||
attacker.frags = attacker.frags + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (attacker.classname == "player")
|
||||
{
|
||||
//ZOID 12-13-96: self.team doesn't work in QW. Use keys
|
||||
|
@ -1199,6 +1248,26 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
}
|
||||
}
|
||||
if (rnum == IT_ROCKET_LAUNCHER)
|
||||
{
|
||||
|
||||
if (attacker.super_damage_finished > 0)
|
||||
{
|
||||
rnum = random();
|
||||
if (rnum < 0.3)
|
||||
deathstring = " was brutalized by ";
|
||||
else if (rnum < 0.6)
|
||||
deathstring = " was smeared by ";
|
||||
else
|
||||
{
|
||||
bprint (PRINT_MEDIUM, attacker.netname);
|
||||
bprint (PRINT_MEDIUM, " rips ");
|
||||
bprint (PRINT_MEDIUM, targ.netname);
|
||||
bprint (PRINT_MEDIUM, " a new one\n");
|
||||
return;
|
||||
}
|
||||
deathstring2 = "'s quad rocket\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
deathstring = " rides ";
|
||||
deathstring2 = "'s rocket\n";
|
||||
|
@ -1208,6 +1277,9 @@ void(entity targ, entity attacker) ClientObituary =
|
|||
deathstring2 = "'s rocket\n" ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (rnum == IT_LIGHTNING)
|
||||
{
|
||||
deathstring = " accepts ";
|
||||
|
|
1
defs.qc
1
defs.qc
|
@ -486,6 +486,7 @@ float AS_MISSILE = 4;
|
|||
//
|
||||
// player only fields
|
||||
//
|
||||
.float voided;
|
||||
.float walkframe;
|
||||
|
||||
.float attack_finished;
|
||||
|
|
8
doors.qc
8
doors.qc
|
@ -31,8 +31,9 @@ void() door_go_up;
|
|||
|
||||
void() door_blocked =
|
||||
{
|
||||
T_Damage (other, self, self, self.dmg);
|
||||
|
||||
other.deathtype = "squish";
|
||||
T_Damage (other, self, self.goalentity, self.dmg);
|
||||
other.deathtype = "";
|
||||
// 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)
|
||||
|
@ -134,8 +135,10 @@ void() door_fire =
|
|||
|
||||
// trigger all paired doors
|
||||
starte = self;
|
||||
|
||||
do
|
||||
{
|
||||
self.goalentity = activator; // Who fired us
|
||||
door_go_up ();
|
||||
self = self.enemy;
|
||||
} while ( (self != starte) && (self != world) );
|
||||
|
@ -150,6 +153,7 @@ void() door_use =
|
|||
self.message = ""; // door message are for touch only
|
||||
self.owner.message = "";
|
||||
self.enemy.message = "";
|
||||
|
||||
oself = self;
|
||||
self = self.owner;
|
||||
door_fire ();
|
||||
|
|
125
items.qc
125
items.qc
|
@ -24,6 +24,129 @@ void() noclass =
|
|||
remove (self);
|
||||
};
|
||||
|
||||
void() q_touch;
|
||||
|
||||
void() q_touch =
|
||||
{
|
||||
local entity stemp;
|
||||
local float best;
|
||||
local string s;
|
||||
|
||||
if (other.classname != "player")
|
||||
return;
|
||||
if (other.health <= 0)
|
||||
return;
|
||||
|
||||
self.mdl = self.model;
|
||||
|
||||
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
stuffcmd (other, "bf\n");
|
||||
self.solid = SOLID_NOT;
|
||||
other.items = other.items | IT_QUAD;
|
||||
self.model = string_null;
|
||||
|
||||
// do the apropriate action
|
||||
other.super_time = 1;
|
||||
other.super_damage_finished = self.cnt;
|
||||
|
||||
s=ftos(rint(other.super_damage_finished - time));
|
||||
|
||||
bprint (PRINT_LOW, other.netname);
|
||||
bprint (PRINT_LOW, " recovered a Quad with ");
|
||||
bprint (PRINT_LOW, s);
|
||||
bprint (PRINT_LOW, " seconds remaining!\n");
|
||||
|
||||
|
||||
|
||||
activator = other;
|
||||
SUB_UseTargets(); // fire all targets / killtargets
|
||||
};
|
||||
|
||||
|
||||
void(float timeleft) DropQuad =
|
||||
{
|
||||
local entity item;
|
||||
|
||||
item = spawn();
|
||||
item.origin = self.origin - '0 0 24';
|
||||
|
||||
item.velocity_z = 300;
|
||||
item.velocity_x = -100 + (random() * 200);
|
||||
item.velocity_y = -100 + (random() * 200);
|
||||
|
||||
item.flags = FL_ITEM;
|
||||
item.solid = SOLID_TRIGGER;
|
||||
item.movetype = MOVETYPE_TOSS;
|
||||
item.noise = "items/damage.wav";
|
||||
setmodel (item, "progs/quaddama.mdl");
|
||||
setsize (item, '-16 -16 -24', '16 16 32');
|
||||
item.cnt = time + timeleft;
|
||||
item.touch = q_touch;
|
||||
item.nextthink = time + timeleft; // remove it with the time left on it
|
||||
item.think = SUB_Remove;
|
||||
};
|
||||
|
||||
|
||||
void() r_touch;
|
||||
|
||||
void() r_touch =
|
||||
{
|
||||
local entity stemp;
|
||||
local float best;
|
||||
local string s;
|
||||
|
||||
if (other.classname != "player")
|
||||
return;
|
||||
if (other.health <= 0)
|
||||
return;
|
||||
|
||||
self.mdl = self.model;
|
||||
|
||||
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
stuffcmd (other, "bf\n");
|
||||
self.solid = SOLID_NOT;
|
||||
other.items = other.items | IT_INVISIBILITY;
|
||||
self.model = string_null;
|
||||
|
||||
// do the apropriate action
|
||||
other.invisible_time = 1;
|
||||
other.invisible_finished = self.cnt;
|
||||
s=ftos(rint(other.invisible_finished - time));
|
||||
bprint (PRINT_LOW, other.netname);
|
||||
bprint (PRINT_LOW, " recovered a Ring with ");
|
||||
bprint (PRINT_LOW, s);
|
||||
bprint (PRINT_LOW, " seconds remaining!\n");
|
||||
|
||||
|
||||
activator = other;
|
||||
SUB_UseTargets(); // fire all targets / killtargets
|
||||
};
|
||||
|
||||
|
||||
void(float timeleft) DropRing =
|
||||
{
|
||||
local entity item;
|
||||
|
||||
item = spawn();
|
||||
item.origin = self.origin - '0 0 24';
|
||||
|
||||
item.velocity_z = 300;
|
||||
item.velocity_x = -100 + (random() * 200);
|
||||
item.velocity_y = -100 + (random() * 200);
|
||||
|
||||
item.flags = FL_ITEM;
|
||||
item.solid = SOLID_TRIGGER;
|
||||
item.movetype = MOVETYPE_TOSS;
|
||||
item.noise = "items/inv1.wav";
|
||||
setmodel (item, "progs/invisibl.mdl");
|
||||
setsize (item, '-16 -16 -24', '16 16 32');
|
||||
item.cnt = time + timeleft;
|
||||
item.touch = r_touch;
|
||||
item.nextthink = time + timeleft; // remove after 30 seconds
|
||||
item.think = SUB_Remove;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1438,3 +1561,5 @@ void() DropBackpack =
|
|||
item.nextthink = time + 120; // remove after 2 minutes
|
||||
item.think = SUB_Remove;
|
||||
};
|
||||
|
||||
|
||||
|
|
31
player.qc
31
player.qc
|
@ -409,7 +409,7 @@ local float rs;
|
|||
// water death sounds
|
||||
if (self.waterlevel == 3)
|
||||
{
|
||||
DeathBubbles(20);
|
||||
DeathBubbles(5);
|
||||
sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
|
||||
return;
|
||||
}
|
||||
|
@ -546,8 +546,35 @@ void() GibPlayer =
|
|||
void() PlayerDie =
|
||||
{
|
||||
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)
|
||||
{
|
||||
DropQuad (self.super_damage_finished - time);
|
||||
bprint (PRINT_LOW, self.netname);
|
||||
bprint (PRINT_LOW, " lost a quad with ");
|
||||
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)
|
||||
{
|
||||
bprint (PRINT_LOW, self.netname);
|
||||
bprint (PRINT_LOW, " lost a ring with ");
|
||||
s = ftos(rint(self.invisible_finished - time));
|
||||
bprint (PRINT_LOW, s);
|
||||
bprint (PRINT_LOW, " seconds remaining\n");
|
||||
DropRing (self.invisible_finished - time);
|
||||
}
|
||||
}
|
||||
|
||||
self.invisible_finished = 0; // don't die as eyes
|
||||
self.invincible_finished = 0;
|
||||
self.super_damage_finished = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
../progs.dat
|
||||
./qwprogs.dat
|
||||
|
||||
defs.qc
|
||||
subs.qc
|
||||
|
|
25
weapons.qc
25
weapons.qc
|
@ -352,6 +352,11 @@ void() T_MissileTouch =
|
|||
if (other == self.owner)
|
||||
return; // don't explode on owner
|
||||
|
||||
if (self.voided) {
|
||||
return;
|
||||
}
|
||||
self.voided = 1;
|
||||
|
||||
if (pointcontents(self.origin) == CONTENT_SKY)
|
||||
{
|
||||
remove(self);
|
||||
|
@ -413,6 +418,7 @@ void() W_FireRocket =
|
|||
newmis.angles = vectoangles(newmis.velocity);
|
||||
|
||||
newmis.touch = T_MissileTouch;
|
||||
newmis.voided = 0;
|
||||
|
||||
// set newmis duration
|
||||
newmis.nextthink = time + 5;
|
||||
|
@ -545,6 +551,12 @@ void() W_FireLightning =
|
|||
|
||||
void() GrenadeExplode =
|
||||
{
|
||||
if (self.voided) {
|
||||
return;
|
||||
}
|
||||
self.voided = 1;
|
||||
|
||||
|
||||
T_RadiusDamage (self, self.owner, 120, world);
|
||||
|
||||
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
|
@ -586,6 +598,7 @@ void() W_FireGrenade =
|
|||
WriteByte (MSG_ONE, SVC_SMALLKICK);
|
||||
|
||||
newmis = spawn ();
|
||||
newmis.voided=0;
|
||||
newmis.owner = self;
|
||||
newmis.movetype = MOVETYPE_BOUNCE;
|
||||
newmis.solid = SOLID_BBOX;
|
||||
|
@ -636,6 +649,7 @@ Used for both the player and the ogre
|
|||
void(vector org, vector dir) launch_spike =
|
||||
{
|
||||
newmis = spawn ();
|
||||
newmis.voided=0;
|
||||
newmis.owner = self;
|
||||
newmis.movetype = MOVETYPE_FLYMISSILE;
|
||||
newmis.solid = SOLID_BBOX;
|
||||
|
@ -709,6 +723,11 @@ local float rand;
|
|||
if (other == self.owner)
|
||||
return;
|
||||
|
||||
if (self.voided) {
|
||||
return;
|
||||
}
|
||||
self.voided = 1;
|
||||
|
||||
if (other.solid == SOLID_TRIGGER)
|
||||
return; // trigger field, do nothing
|
||||
|
||||
|
@ -749,6 +768,12 @@ local float rand;
|
|||
if (other == self.owner)
|
||||
return;
|
||||
|
||||
if (self.voided) {
|
||||
return;
|
||||
}
|
||||
self.voided = 1;
|
||||
|
||||
|
||||
if (other.solid == SOLID_TRIGGER)
|
||||
return; // trigger field, do nothing
|
||||
|
||||
|
|
Loading…
Reference in a new issue