Long overdue tenebrae2 progs update :)
This commit is contained in:
parent
e5a55b2f7e
commit
f295f7ec3a
7 changed files with 3690 additions and 3699 deletions
|
@ -943,10 +943,8 @@ void() PlayerPreThink =
|
||||||
|
|
||||||
if (!self.flashlight) {
|
if (!self.flashlight) {
|
||||||
self.flashlight = spawn ();
|
self.flashlight = spawn ();
|
||||||
|
|
||||||
setmodel(self.flashlight, "progs/w_light.spr");
|
|
||||||
self.flashlight.velocity = '0 0 0';
|
self.flashlight.velocity = '0 0 0';
|
||||||
|
setmodel(self.flashlight, "progs/flashlight.spr");
|
||||||
self.flashlight.style = 0;
|
self.flashlight.style = 0;
|
||||||
self.flashlight.skin = 24;
|
self.flashlight.skin = 24;
|
||||||
self.flashlight.color = '1 1 1';
|
self.flashlight.color = '1 1 1';
|
||||||
|
@ -957,6 +955,7 @@ void() PlayerPreThink =
|
||||||
flatforward = normalize(v_forward);
|
flatforward = normalize(v_forward);
|
||||||
flatforward_z = 0;
|
flatforward_z = 0;
|
||||||
source = self.origin + flatforward * 20;
|
source = self.origin + flatforward * 20;
|
||||||
|
source_z = source_z + 20;
|
||||||
setorigin(self.flashlight, source);
|
setorigin(self.flashlight, source);
|
||||||
// traceline (source, source + v_forward*4096, FALSE, self);
|
// traceline (source, source + v_forward*4096, FALSE, self);
|
||||||
// setorigin(self.flashlight, trace_endpos - v_forward*100);
|
// setorigin(self.flashlight, trace_endpos - v_forward*100);
|
||||||
|
|
486
statics.qc
486
statics.qc
|
@ -1,244 +1,244 @@
|
||||||
void() next_frame =
|
void() next_frame =
|
||||||
{
|
{
|
||||||
if (self.frame < self.button1){
|
if (self.frame < self.button1){
|
||||||
self.frame = self.frame + 1;
|
self.frame = self.frame + 1;
|
||||||
} else {
|
} else {
|
||||||
self.frame = self.button0;
|
self.frame = self.button0;
|
||||||
}
|
}
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
self.think = next_frame;
|
self.think = next_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Put any model in the map
|
Put any model in the map
|
||||||
|
|
||||||
model = filename of model to have
|
model = filename of model to have
|
||||||
|
|
||||||
If button0 and 1 are set it loops the frames:
|
If button0 and 1 are set it loops the frames:
|
||||||
button0 = startframe to play
|
button0 = startframe to play
|
||||||
button1 = endframe to play
|
button1 = endframe to play
|
||||||
|
|
||||||
If target is set it follows the path defined by the target path_corner ents.
|
If target is set it follows the path defined by the target path_corner ents.
|
||||||
noise and noise1 then define the noises to play during movement.
|
noise and noise1 then define the noises to play during movement.
|
||||||
button0 & 1 dont work when target is set.
|
button0 & 1 dont work when target is set.
|
||||||
*/
|
*/
|
||||||
void() misc_model =
|
void() misc_model =
|
||||||
{
|
{
|
||||||
precache_model (self.model);
|
precache_model (self.model);
|
||||||
setmodel (self, self.model);
|
setmodel (self, self.model);
|
||||||
self.solid = SOLID_NOT;
|
self.solid = SOLID_NOT;
|
||||||
|
|
||||||
if (self.target) {
|
if (self.target) {
|
||||||
if (!self.speed)
|
if (!self.speed)
|
||||||
self.speed = 100;
|
self.speed = 100;
|
||||||
self.cnt = 1;
|
self.cnt = 1;
|
||||||
self.solid = SOLID_NOT;
|
self.solid = SOLID_NOT;
|
||||||
self.movetype = MOVETYPE_FAKEPUSH;
|
self.movetype = MOVETYPE_FAKEPUSH;
|
||||||
self.blocked = train_blocked;
|
self.blocked = train_blocked;
|
||||||
self.use = train_use;
|
self.use = train_use;
|
||||||
if (!self.noise) self.noise = "misc/null.wav";
|
if (!self.noise) self.noise = "misc/null.wav";
|
||||||
if (!self.noise1) self.noise1 = "misc/null.wav";
|
if (!self.noise1) self.noise1 = "misc/null.wav";
|
||||||
precache_sound (self.noise);
|
precache_sound (self.noise);
|
||||||
precache_sound (self.noise1);
|
precache_sound (self.noise1);
|
||||||
setsize (self, self.mins , self.maxs);
|
setsize (self, self.mins , self.maxs);
|
||||||
setorigin (self, self.origin);
|
setorigin (self, self.origin);
|
||||||
|
|
||||||
// start trains on the second frame, to make sure their targets have had
|
// start trains on the second frame, to make sure their targets have had
|
||||||
// a chance to spawn
|
// a chance to spawn
|
||||||
self.nextthink = self.ltime + 0.1;
|
self.nextthink = self.ltime + 0.1;
|
||||||
self.think = func_train_find;
|
self.think = func_train_find;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!self.button0){
|
//if (!self.button0){
|
||||||
// if (!self.noise4) {
|
// if (!self.noise4) {
|
||||||
// makestatic(self);
|
// makestatic(self);
|
||||||
// }
|
// }
|
||||||
//} else {
|
//} else {
|
||||||
if (self.button0) {
|
if (self.button1) {
|
||||||
self.think = next_frame;
|
self.think = next_frame;
|
||||||
self.nextthink = self.ltime + 0.1;
|
self.nextthink = self.ltime + 0.1;
|
||||||
self.frame = self.button0;
|
self.frame = self.button0;
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
self.solid = SOLID_NOT;
|
self.solid = SOLID_NOT;
|
||||||
if (self.target)
|
if (self.target)
|
||||||
self.movetype = MOVETYPE_FAKEPUSH;
|
self.movetype = MOVETYPE_FAKEPUSH;
|
||||||
else
|
else
|
||||||
self.movetype = MOVETYPE_NONE;
|
self.movetype = MOVETYPE_NONE;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() static_brush =
|
void() static_brush =
|
||||||
{
|
{
|
||||||
//static_brush == compatibility with old tenebrae maps
|
//static_brush == compatibility with old tenebrae maps
|
||||||
misc_model();
|
misc_model();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() rotateengine_use =
|
void() rotateengine_use =
|
||||||
{
|
{
|
||||||
local entity targ;
|
local entity targ;
|
||||||
|
|
||||||
|
|
||||||
targ = find (world, noise4, self.target);
|
targ = find (world, noise4, self.target);
|
||||||
if (targ)
|
if (targ)
|
||||||
if (self.state == STATE_TOP) {
|
if (self.state == STATE_TOP) {
|
||||||
targ.avelocity = '0 0 0';
|
targ.avelocity = '0 0 0';
|
||||||
self.state = STATE_DOWN;
|
self.state = STATE_DOWN;
|
||||||
} else {
|
} else {
|
||||||
targ.avelocity = self.avelocity;
|
targ.avelocity = self.avelocity;
|
||||||
self.state = STATE_TOP;
|
self.state = STATE_TOP;
|
||||||
}
|
}
|
||||||
else objerror("No target found");
|
else objerror("No target found");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void() misc_rotateengine =
|
void() misc_rotateengine =
|
||||||
{
|
{
|
||||||
self.use = rotateengine_use;
|
self.use = rotateengine_use;
|
||||||
self.state = STATE_DOWN;
|
self.state = STATE_DOWN;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The fan is spinning out
|
The fan is spinning out
|
||||||
*/
|
*/
|
||||||
void () fan_turnoff = {
|
void () fan_turnoff = {
|
||||||
|
|
||||||
local float reached;
|
local float reached;
|
||||||
|
|
||||||
if (self.state == STATE_TOP) {
|
if (self.state == STATE_TOP) {
|
||||||
reached = 1;
|
reached = 1;
|
||||||
if (self.avelocity_x > 0) {
|
if (self.avelocity_x > 0) {
|
||||||
self.avelocity_x = self.avelocity_x - self.waitmin;
|
self.avelocity_x = self.avelocity_x - self.waitmin;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.avelocity_y > 0) {
|
if (self.avelocity_y > 0) {
|
||||||
self.avelocity_y = self.avelocity_y - self.waitmin;
|
self.avelocity_y = self.avelocity_y - self.waitmin;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.avelocity_z > 0) {
|
if (self.avelocity_z > 0) {
|
||||||
self.avelocity_z = self.avelocity_z - self.waitmin;
|
self.avelocity_z = self.avelocity_z - self.waitmin;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reached == 0) {
|
if (reached == 0) {
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
} else {
|
} else {
|
||||||
self.state = STATE_DOWN;
|
self.state = STATE_DOWN;
|
||||||
self.avelocity = '0 0 0';
|
self.avelocity = '0 0 0';
|
||||||
self.nextthink = time + 100000;
|
self.nextthink = time + 100000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The fan is starting up
|
The fan is starting up
|
||||||
*/
|
*/
|
||||||
void () fan_turnon = {
|
void () fan_turnon = {
|
||||||
|
|
||||||
local float reached;
|
local float reached;
|
||||||
self.state = STATE_TOP;
|
self.state = STATE_TOP;
|
||||||
|
|
||||||
reached = 1;
|
reached = 1;
|
||||||
if (self.avelocity_x < self.dest_x) {
|
if (self.avelocity_x < self.dest_x) {
|
||||||
self.avelocity_x = self.avelocity_x + self.waitmax;
|
self.avelocity_x = self.avelocity_x + self.waitmax;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.avelocity_y < self.dest_y) {
|
if (self.avelocity_y < self.dest_y) {
|
||||||
self.avelocity_y = self.avelocity_y + self.waitmax;
|
self.avelocity_y = self.avelocity_y + self.waitmax;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.avelocity_z < self.dest_z) {
|
if (self.avelocity_z < self.dest_z) {
|
||||||
self.avelocity_z = self.avelocity_z + self.waitmax;
|
self.avelocity_z = self.avelocity_z + self.waitmax;
|
||||||
reached = 0;
|
reached = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//We are at the top speed stop thinking
|
//We are at the top speed stop thinking
|
||||||
if (reached == 1) {
|
if (reached == 1) {
|
||||||
self.nextthink = time + 100000;
|
self.nextthink = time + 100000;
|
||||||
} else {
|
} else {
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The fan is toggled
|
The fan is toggled
|
||||||
*/
|
*/
|
||||||
void () fan_use =
|
void () fan_use =
|
||||||
{
|
{
|
||||||
//shootable and destroyed?
|
//shootable and destroyed?
|
||||||
if (self.max_health) {
|
if (self.max_health) {
|
||||||
if (self.health <= 0) {
|
if (self.health <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.state == STATE_TOP) {
|
if (self.state == STATE_TOP) {
|
||||||
self.think = fan_turnoff;
|
self.think = fan_turnoff;
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
} else {
|
} else {
|
||||||
self.think = fan_turnon;
|
self.think = fan_turnon;
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The fan is shot
|
The fan is shot
|
||||||
*/
|
*/
|
||||||
void () fan_die =
|
void () fan_die =
|
||||||
{
|
{
|
||||||
if (self.state == STATE_TOP) {
|
if (self.state == STATE_TOP) {
|
||||||
self.think = fan_turnoff;
|
self.think = fan_turnoff;
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Put a fan in the map. A is any model that spins, it spins slowly up until it reaches max speed.
|
Put a fan in the map. A is any model that spins, it spins slowly up until it reaches max speed.
|
||||||
It can be turned on/ off by triggering. It can be shot out.
|
It can be turned on/ off by triggering. It can be shot out.
|
||||||
model = name of the fan model
|
model = name of the fan model
|
||||||
avelocity = rotation speed around the 3 axis (0 90 0)
|
avelocity = rotation speed around the 3 axis (0 90 0)
|
||||||
health = how long it takes to destroy. (zero is indestuctible)
|
health = how long it takes to destroy. (zero is indestuctible)
|
||||||
waitmin = spin down speed (default 5)
|
waitmin = spin down speed (default 5)
|
||||||
waitmax = spin up speed (default 5)
|
waitmax = spin up speed (default 5)
|
||||||
if spawnlfags 1 is set it starts disabled
|
if spawnlfags 1 is set it starts disabled
|
||||||
*/
|
*/
|
||||||
void() misc_fan =
|
void() misc_fan =
|
||||||
{
|
{
|
||||||
precache_model (self.model);
|
precache_model (self.model);
|
||||||
setmodel (self, self.model);
|
setmodel (self, self.model);
|
||||||
self.solid = SOLID_SLIDEBOX;
|
self.solid = SOLID_SLIDEBOX;
|
||||||
|
|
||||||
if (self.health)
|
if (self.health)
|
||||||
{
|
{
|
||||||
self.max_health = self.health;
|
self.max_health = self.health;
|
||||||
self.th_die = fan_die;
|
self.th_die = fan_die;
|
||||||
self.takedamage = DAMAGE_YES;
|
self.takedamage = DAMAGE_YES;
|
||||||
} else {
|
} else {
|
||||||
self.max_health = 0;
|
self.max_health = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dest = self.avelocity;
|
self.dest = self.avelocity;
|
||||||
self.think = fan_turnon;
|
self.think = fan_turnon;
|
||||||
self.nextthink = time + 100000;
|
self.nextthink = time + 100000;
|
||||||
self.use = fan_use;
|
self.use = fan_use;
|
||||||
self.state = STATE_TOP;
|
self.state = STATE_TOP;
|
||||||
|
|
||||||
//start off?
|
//start off?
|
||||||
if (self.spawnflags & 1) {
|
if (self.spawnflags & 1) {
|
||||||
self.avelocity = '0 0 0';
|
self.avelocity = '0 0 0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.waitmin)
|
if (!self.waitmin)
|
||||||
self.waitmin = 5;
|
self.waitmin = 5;
|
||||||
|
|
||||||
if (!self.waitmax)
|
if (!self.waitmax)
|
||||||
self.waitmax = 5;
|
self.waitmax = 5;
|
||||||
|
|
||||||
setsize(self, self.mins, self.maxs);
|
setsize(self, self.mins, self.maxs);
|
||||||
self.movetype = MOVETYPE_FAKEPUSH;
|
self.movetype = MOVETYPE_FAKEPUSH;
|
||||||
};
|
};
|
669
subs.qc
669
subs.qc
|
@ -1,343 +1,328 @@
|
||||||
|
|
||||||
|
|
||||||
void() SUB_Null = {};
|
void() SUB_Null = {};
|
||||||
|
|
||||||
void() SUB_Remove = {remove(self);};
|
void() SUB_Remove = {remove(self);};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QuakeEd only writes a single float for angles (bad idea), so up and down are
|
QuakeEd only writes a single float for angles (bad idea), so up and down are
|
||||||
just constant angles.
|
just constant angles.
|
||||||
*/
|
*/
|
||||||
vector() SetMovedir =
|
vector() SetMovedir =
|
||||||
{
|
{
|
||||||
if (self.angles == '0 -1 0')
|
if (self.angles == '0 -1 0')
|
||||||
self.movedir = '0 0 1';
|
self.movedir = '0 0 1';
|
||||||
else if (self.angles == '0 -2 0')
|
else if (self.angles == '0 -2 0')
|
||||||
self.movedir = '0 0 -1';
|
self.movedir = '0 0 -1';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
makevectors (self.angles);
|
makevectors (self.angles);
|
||||||
self.movedir = v_forward;
|
self.movedir = v_forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.angles = '0 0 0';
|
self.angles = '0 0 0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
InitTrigger
|
InitTrigger
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void() InitTrigger =
|
void() InitTrigger =
|
||||||
{
|
{
|
||||||
// trigger angles are used for one-way touches. An angle of 0 is assumed
|
// trigger angles are used for one-way touches. An angle of 0 is assumed
|
||||||
// to mean no restrictions, so use a yaw of 360 instead.
|
// to mean no restrictions, so use a yaw of 360 instead.
|
||||||
if (self.angles != '0 0 0')
|
if (self.angles != '0 0 0')
|
||||||
SetMovedir ();
|
SetMovedir ();
|
||||||
self.solid = SOLID_TRIGGER;
|
self.solid = SOLID_TRIGGER;
|
||||||
setmodel (self, self.model); // set size and link into world
|
setmodel (self, self.model); // set size and link into world
|
||||||
self.movetype = MOVETYPE_NONE;
|
self.movetype = MOVETYPE_NONE;
|
||||||
self.modelindex = 0;
|
self.modelindex = 0;
|
||||||
self.model = "";
|
self.model = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
SUB_CalcMove
|
SUB_CalcMove
|
||||||
|
|
||||||
calculate self.velocity and self.nextthink to reach dest from
|
calculate self.velocity and self.nextthink to reach dest from
|
||||||
self.origin traveling at speed
|
self.origin traveling at speed
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
|
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt =
|
||||||
{
|
{
|
||||||
local entity stemp;
|
local entity stemp;
|
||||||
stemp = self;
|
stemp = self;
|
||||||
self = ent;
|
self = ent;
|
||||||
|
|
||||||
SUB_CalcMove (tdest, tspeed, func);
|
SUB_CalcMove (tdest, tspeed, func);
|
||||||
self = stemp;
|
self = stemp;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
|
void(vector tdest, float tspeed, void() func) SUB_CalcMove =
|
||||||
{
|
{
|
||||||
local vector vdestdelta;
|
local vector vdestdelta;
|
||||||
local float len, traveltime;
|
local float len, traveltime;
|
||||||
|
|
||||||
if (!tspeed)
|
if (!tspeed)
|
||||||
objerror("No speed is defined!");
|
objerror("No speed is defined!");
|
||||||
|
|
||||||
self.think1 = func;
|
self.think1 = func;
|
||||||
self.finaldest = tdest;
|
self.finaldest = tdest;
|
||||||
self.think = SUB_CalcMoveDone;
|
self.think = SUB_CalcMoveDone;
|
||||||
|
|
||||||
if (tdest == self.origin)
|
if (tdest == self.origin)
|
||||||
{
|
{
|
||||||
self.velocity = '0 0 0';
|
self.velocity = '0 0 0';
|
||||||
self.nextthink = self.ltime + 0.1;
|
self.nextthink = self.ltime + 0.1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set destdelta to the vector needed to move
|
// set destdelta to the vector needed to move
|
||||||
vdestdelta = tdest - self.origin;
|
vdestdelta = tdest - self.origin;
|
||||||
|
|
||||||
// calculate length of vector
|
// calculate length of vector
|
||||||
len = vlen (vdestdelta);
|
len = vlen (vdestdelta);
|
||||||
|
|
||||||
// divide by speed to get time to reach dest
|
// divide by speed to get time to reach dest
|
||||||
traveltime = len / tspeed;
|
traveltime = len / tspeed;
|
||||||
|
|
||||||
if (traveltime < 0.1)
|
if (traveltime < 0.1)
|
||||||
{
|
{
|
||||||
self.velocity = '0 0 0';
|
self.velocity = '0 0 0';
|
||||||
self.nextthink = self.ltime + 0.1;
|
self.nextthink = self.ltime + 0.1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
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.velocity = vdestdelta * (1/traveltime); // qcc won't take vec/float
|
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 =
|
void() SUB_CalcMoveDone =
|
||||||
{
|
{
|
||||||
setorigin(self, self.finaldest);
|
setorigin(self, self.finaldest);
|
||||||
self.velocity = '0 0 0';
|
self.velocity = '0 0 0';
|
||||||
self.nextthink = -1;
|
self.nextthink = -1;
|
||||||
if (self.think1)
|
if (self.think1)
|
||||||
self.think1();
|
self.think1();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
SUB_CalcAngleMove
|
SUB_CalcAngleMove
|
||||||
|
|
||||||
calculate self.avelocity and self.nextthink to reach destangle from
|
calculate self.avelocity and self.nextthink to reach destangle from
|
||||||
self.angles rotating
|
self.angles rotating
|
||||||
|
|
||||||
The calling function should make sure self.think is valid
|
The calling function should make sure self.think is valid
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt =
|
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt =
|
||||||
{
|
{
|
||||||
local entity stemp;
|
local entity stemp;
|
||||||
stemp = self;
|
stemp = self;
|
||||||
self = ent;
|
self = ent;
|
||||||
SUB_CalcAngleMove (destangle, tspeed, func);
|
SUB_CalcAngleMove (destangle, tspeed, func);
|
||||||
self = stemp;
|
self = stemp;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
|
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove =
|
||||||
{
|
{
|
||||||
local vector destdelta;
|
local vector destdelta;
|
||||||
local float len, traveltime;
|
local float len, traveltime;
|
||||||
|
|
||||||
if (!tspeed)
|
if (!tspeed)
|
||||||
objerror("No speed is defined!");
|
objerror("No speed is defined!");
|
||||||
|
|
||||||
// set destdelta to the vector needed to move
|
// set destdelta to the vector needed to move
|
||||||
destdelta = destangle - self.angles;
|
destdelta = destangle - self.angles;
|
||||||
|
|
||||||
// calculate length of vector
|
// calculate length of vector
|
||||||
len = vlen (destdelta);
|
len = vlen (destdelta);
|
||||||
|
|
||||||
// divide by speed to get time to reach dest
|
// divide by speed to get time to reach dest
|
||||||
traveltime = len / tspeed;
|
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;
|
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.avelocity = destdelta * (1 / traveltime);
|
||||||
|
|
||||||
self.think1 = func;
|
self.think1 = func;
|
||||||
self.finalangle = destangle;
|
self.finalangle = destangle;
|
||||||
self.think = SUB_CalcAngleMoveDone;
|
self.think = SUB_CalcAngleMoveDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
After rotating, set angle to exact final angle
|
After rotating, set angle to exact final angle
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void() SUB_CalcAngleMoveDone =
|
void() SUB_CalcAngleMoveDone =
|
||||||
{
|
{
|
||||||
self.angles = self.finalangle;
|
self.angles = self.finalangle;
|
||||||
self.avelocity = '0 0 0';
|
self.avelocity = '0 0 0';
|
||||||
self.nextthink = -1;
|
self.nextthink = -1;
|
||||||
if (self.think1)
|
if (self.think1)
|
||||||
self.think1();
|
self.think1();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void() DelayThink =
|
void() DelayThink =
|
||||||
{
|
{
|
||||||
activator = self.enemy;
|
activator = self.enemy;
|
||||||
SUB_UseTargets ();
|
SUB_UseTargets ();
|
||||||
remove(self);
|
remove(self);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================
|
==============================
|
||||||
SUB_UseTargets
|
SUB_UseTargets
|
||||||
|
|
||||||
the global "activator" should be set to the entity that initiated the firing.
|
the global "activator" should be set to the entity that initiated the firing.
|
||||||
|
|
||||||
If self.delay is set, a DelayedUse entity will be created that will actually
|
If self.delay is set, a DelayedUse entity will be created that will actually
|
||||||
do the SUB_UseTargets after that many seconds have passed.
|
do the SUB_UseTargets after that many seconds have passed.
|
||||||
|
|
||||||
Centerprints any self.message to the activator.
|
Centerprints any self.message to the activator.
|
||||||
|
|
||||||
Removes all entities with a targetname that match self.killtarget,
|
Removes all entities with a targetname that match self.killtarget,
|
||||||
and removes them, so some events can remove other triggers.
|
and removes them, so some events can remove other triggers.
|
||||||
|
|
||||||
Search for (string)targetname in all entities that
|
Search for (string)targetname in all entities that
|
||||||
match (string)self.target and call their .use function
|
match (string)self.target and call their .use function
|
||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
void() SUB_UseTargets =
|
void() SUB_UseTargets =
|
||||||
{
|
{
|
||||||
local entity t, stemp, otemp, act;
|
local entity t, stemp, otemp, act;
|
||||||
|
|
||||||
//
|
//
|
||||||
// check for a delay
|
// check for a delay
|
||||||
//
|
//
|
||||||
if (self.delay)
|
if (self.delay)
|
||||||
{
|
{
|
||||||
// create a temp object to fire at a later time
|
// create a temp object to fire at a later time
|
||||||
t = spawn();
|
t = spawn();
|
||||||
t.classname = "DelayedUse";
|
t.classname = "DelayedUse";
|
||||||
t.nextthink = time + self.delay;
|
t.nextthink = time + self.delay;
|
||||||
t.think = DelayThink;
|
t.think = DelayThink;
|
||||||
t.enemy = activator;
|
t.enemy = activator;
|
||||||
t.message = self.message;
|
t.message = self.message;
|
||||||
t.killtarget = self.killtarget;
|
t.killtarget = self.killtarget;
|
||||||
t.target = self.target;
|
t.target = self.target;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// print the message
|
// print the message
|
||||||
//
|
//
|
||||||
if (activator.classname == "player" && self.message != "")
|
if (activator.classname == "player" && self.message != "")
|
||||||
{
|
{
|
||||||
centerprint (activator, self.message);
|
centerprint (activator, self.message);
|
||||||
if (!self.noise)
|
if (!self.noise)
|
||||||
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
|
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// kill the killtagets
|
// kill the killtagets
|
||||||
//
|
//
|
||||||
if (self.killtarget)
|
if (self.killtarget)
|
||||||
{
|
{
|
||||||
t = world;
|
t = world;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
t = find (t, targetname, self.killtarget);
|
t = find (t, targetname, self.killtarget);
|
||||||
if (!t)
|
if (!t)
|
||||||
return;
|
return;
|
||||||
remove (t);
|
remove (t);
|
||||||
} while ( 1 );
|
} while ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// fire targets
|
// fire targets
|
||||||
//
|
//
|
||||||
if (self.target)
|
if (self.target)
|
||||||
{
|
{
|
||||||
act = activator;
|
act = activator;
|
||||||
t = world;
|
t = world;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
t = find (t, targetname, self.target);
|
t = find (t, targetname, self.target);
|
||||||
if (!t)
|
if (!t)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stemp = self;
|
stemp = self;
|
||||||
otemp = other;
|
otemp = other;
|
||||||
self = t;
|
self = t;
|
||||||
other = stemp;
|
other = stemp;
|
||||||
if (self.use != SUB_Null)
|
if (self.use != SUB_Null)
|
||||||
{
|
{
|
||||||
if (self.use)
|
if (self.use)
|
||||||
self.use ();
|
self.use ();
|
||||||
}
|
}
|
||||||
self = stemp;
|
self = stemp;
|
||||||
other = otemp;
|
other = otemp;
|
||||||
activator = act;
|
activator = act;
|
||||||
} while ( 1 );
|
} while ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
in nightmare mode, all attack_finished times become 0
|
in nightmare mode, all attack_finished times become 0
|
||||||
some monsters refire twice automatically
|
some monsters refire twice automatically
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void(float normal) SUB_AttackFinished =
|
void(float normal) SUB_AttackFinished =
|
||||||
{
|
{
|
||||||
self.cnt = 0; // refire count for nightmare
|
self.cnt = 0; // refire count for nightmare
|
||||||
if (skill != 3)
|
if (skill != 3)
|
||||||
self.attack_finished = time + normal;
|
self.attack_finished = time + normal;
|
||||||
};
|
};
|
||||||
|
|
||||||
float (entity targ) visible;
|
float (entity targ) visible;
|
||||||
|
|
||||||
void (void() thinkst) SUB_CheckRefire =
|
void (void() thinkst) SUB_CheckRefire =
|
||||||
{
|
{
|
||||||
if (skill != 3)
|
if (skill != 3)
|
||||||
return;
|
return;
|
||||||
if (self.cnt == 1)
|
if (self.cnt == 1)
|
||||||
return;
|
return;
|
||||||
if (!visible (self.enemy))
|
if (!visible (self.enemy))
|
||||||
return;
|
return;
|
||||||
self.cnt = 1;
|
self.cnt = 1;
|
||||||
self.think = thinkst;
|
self.think = thinkst;
|
||||||
};
|
};
|
||||||
|
|
||||||
//PENTA: new particle support
|
//PENTA: new particle support, Fix don't overflow network packets when user spawns to much particles
|
||||||
void (entity ent, float pcount, string effectname) SUB_BasicEmitter =
|
void (entity ent, float pcount, string effectname) SUB_BasicEmitter =
|
||||||
{
|
{
|
||||||
WriteByte (MSG_BROADCAST, SVC_BASICEMITTER);
|
BasicEmitter(ent.origin, pcount, effectname);
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_x);
|
};
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_y);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_z);
|
//PENTA: new particle support
|
||||||
WriteByte (MSG_BROADCAST, pcount);
|
void (entity ent, float pcount, float tick, float life, string effectname) SUB_ExtendedEmitter =
|
||||||
WriteString(MSG_BROADCAST, effectname);
|
{
|
||||||
};
|
ExtendedEmitter(ent.origin, ent.velocity, pcount, tick, life, effectname);
|
||||||
|
|
||||||
//PENTA: new particle support
|
|
||||||
void (entity ent, float pcount, float tick, float life, string effectname) SUB_ExtendedEmitter =
|
|
||||||
{
|
|
||||||
WriteByte (MSG_BROADCAST, SVC_EXTENDEDEMITTER);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_x);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_y);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.origin_z);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.velocity_x);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.velocity_y);
|
|
||||||
WriteCoord (MSG_BROADCAST, ent.velocity_z);
|
|
||||||
WriteByte (MSG_BROADCAST, pcount);
|
|
||||||
WriteLong (MSG_BROADCAST, life*100);
|
|
||||||
WriteLong (MSG_BROADCAST, tick*100);
|
|
||||||
WriteString(MSG_BROADCAST, effectname);
|
|
||||||
};
|
};
|
2845
weapons.qc
2845
weapons.qc
File diff suppressed because it is too large
Load diff
2
world.qc
2
world.qc
|
@ -287,7 +287,7 @@ void() worldspawn =
|
||||||
precache_model ("progs/zom_gib.mdl");
|
precache_model ("progs/zom_gib.mdl");
|
||||||
|
|
||||||
precache_model ("progs/v_light.mdl");
|
precache_model ("progs/v_light.mdl");
|
||||||
|
precache_model ("progs/flashlight.spr");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
|
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
|
||||||
|
|
Loading…
Reference in a new issue