- bugs, todo

- cleaned up some misc bugs in the hook, as well as formatting
This commit is contained in:
Adam Olsen 2001-12-05 18:47:21 +00:00
parent 6cc0a7f26c
commit 0b97684c96
5 changed files with 159 additions and 154 deletions

1
BUGS
View file

@ -26,3 +26,4 @@
- multicast isn't called as often as it should be - multicast isn't called as often as it should be
- nail grenades need a cap on their tempentity creation, in the range of 50 - 100 - nail grenades need a cap on their tempentity creation, in the range of 50 - 100
- hover boots fuel usage should be affected by how fast you're moving, and you should go up faster when you're not moving. the "empty" penalty should be smaller. - hover boots fuel usage should be affected by how fast you're moving, and you should go up faster when you're not moving. the "empty" penalty should be smaller.
- taking over a tesla should set the colormap (?) to the new owner

5
TODO
View file

@ -33,4 +33,7 @@ o Make 50 frag (upgrade from frags? maybe not) teslas change color or do somet
o Medikits should trigger buttons o Medikits should trigger buttons
o Fix Sentry movement on platforms. (Make the top the only real entity, and the bottom one purely visual and adjusted to match it's position every frame) o Fix Sentry movement on platforms. (Make the top the only real entity, and the bottom one purely visual and adjusted to match it's position every frame)
o MegaTF-style caltrops. (requested by Misty-chan) o MegaTF-style caltrops. (requested by Misty-chan)
o specs should have access to admin commands, ceasefire, and query
o chance for detpack disarm/krak to set it off
o random damage from detpacks
o random timer too?

303
hook.qc
View file

@ -32,6 +32,7 @@ Morning Star. Depending on latency, performance should be near exact.
// prototypes for WEAPONS.QC functions // prototypes for WEAPONS.QC functions
float() crandom; float() crandom;
void (entity base) Remove_Chain;
// //
// Reset_Grapple - Removes the hook and resets its owner's state. // Reset_Grapple - Removes the hook and resets its owner's state.
@ -40,11 +41,17 @@ float() crandom;
void (entity rhook) Reset_Grapple = void (entity rhook) Reset_Grapple =
{ {
sound (rhook.owner, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NONE); sound (rhook.owner, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NONE);
if (rhook.goalentity) {
Remove_Chain (rhook.goalentity);
}
rhook.owner.on_hook = FALSE; rhook.owner.on_hook = FALSE;
rhook.owner.hook_out = FALSE; rhook.owner.hook_out = FALSE;
rhook.owner.fire_held_down = FALSE; rhook.owner.fire_held_down = FALSE;
rhook.owner.weaponframe = 0; rhook.owner.weaponframe = 0;
rhook.owner.gravity = 1; // FIXME: interferes with other gravity stuff rhook.owner.gravity = 1; // FIXME: interferes with other gravity stuff
rhook.owner.hook = NIL;
rhook.think = SUB_Remove; rhook.think = SUB_Remove;
rhook.nextthink = time; rhook.nextthink = time;
@ -60,28 +67,23 @@ void () Grapple_Track =
{ {
// drop the hook if owner is dead or has released the button // drop the hook if owner is dead or has released the button
if (!self.owner.on_hook || self.owner.health <= 0) { if (!self.owner.on_hook || self.owner.health <= 0) {
Reset_Grapple (self); Reset_Grapple (self.owner.hook);
return; return;
} }
if (self.owner.health <= 0 || self.owner.has_disconnected) { //CH does a real check if dead if (self.owner.health <= 0 || self.owner.has_disconnected) { //CH does a real check if dead
self.think = SUB_Remove; Reset_Grapple (self.owner.hook);
self.nextthink = time; return;
if (self.goalentity) { }
self.goalentity.think = SUB_Remove;
self.goalentity.nextthink = time; if (!self.enemy.solid) {
if (self.goalentity.goalentity) { Reset_Grapple (self.owner.hook);
self.goalentity.goalentity.think = SUB_Remove;
self.goalentity.goalentity.nextthink = time;
}
}
Reset_Grapple (self);
return; return;
} }
//WK //WK
if (self.enemy.classname == "player" && Teammate(self.enemy.team_no, self.owner.team_no)) { if (self.enemy.classname == "player" && Teammate(self.enemy.team_no, self.owner.team_no)) {
Reset_Grapple (self); Reset_Grapple (self.owner.hook);
return; return;
} }
@ -89,7 +91,7 @@ void () Grapple_Track =
if (self.enemy.classname == "player") { if (self.enemy.classname == "player") {
T_Damage (self.enemy, self, self.owner, 2); T_Damage (self.enemy, self, self.owner, 2);
if (self.enemy.health <= 0) { if (self.enemy.health <= 0) {
Reset_Grapple (self); Reset_Grapple (self.owner.hook);
return; return;
} }
} }
@ -108,19 +110,19 @@ void () Grapple_Track =
// //
entity () MakeLink = entity () MakeLink =
{ {
newmis = spawn (); newmis = spawn ();
newmis.movetype = MOVETYPE_FLYMISSILE; newmis.movetype = MOVETYPE_FLYMISSILE;
newmis.solid = SOLID_NOT; newmis.solid = SOLID_NOT;
newmis.owner = self;// SELF is the hook! newmis.owner = self;// SELF is the hook!
newmis.avelocity = '200 200 200'; newmis.avelocity = '200 200 200';
setmodel (newmis, "progs/s_spike.mdl"); setmodel (newmis, "progs/s_spike.mdl");
setorigin (newmis, self.origin); setorigin (newmis, self.origin);
setsize (newmis, '0 0 0' , '0 0 0'); setsize (newmis, '0 0 0' , '0 0 0');
return newmis; return newmis;
}; };
// //
@ -129,22 +131,20 @@ entity () MakeLink =
// to remove the chain. Only one function required to // to remove the chain. Only one function required to
// remove all links. // remove all links.
// //
void () Remove_Chain = void (entity base) Remove_Chain =
{ {
self.think = SUB_Remove; base.think = SUB_Remove;
self.nextthink = time; base.nextthink = time;
if (base.goalentity) {
if (self.goalentity) base.goalentity.think = SUB_Remove;
{ base.goalentity.nextthink = time;
self.goalentity.think = SUB_Remove; if (base.goalentity.goalentity) {
self.goalentity.nextthink = time; base.goalentity.goalentity.think = SUB_Remove;
base.goalentity.goalentity.nextthink = time;
if (self.goalentity.goalentity) }
{
self.goalentity.goalentity.think = SUB_Remove;
self.goalentity.goalentity.nextthink = time;
}
} }
base.owner.hook.goalentity = NIL;
}; };
// //
@ -158,32 +158,23 @@ void () Update_Chain =
if (!self.owner.hook_out) if (!self.owner.hook_out)
{ {
self.think = Remove_Chain; // Remove_Chain (self);
self.nextthink = time;
return; return;
} }
if (vlen(self.origin - self.owner.origin) >= 3000)
{
Reset_Grapple (self);
return;
}
//CH Using a show grapple loc thing, it was updating while dead. //CH Using a show grapple loc thing, it was updating while dead.
if (self.owner.health <= 0 || self.owner.has_disconnected) if (self.owner.health <= 0 || self.owner.has_disconnected)
{ {
self.think = SUB_Remove; Reset_Grapple (self.owner.hook);
self.nextthink = time; return;
if (self.goalentity) }
{
self.goalentity.think = SUB_Remove; // reset if it gets insane
self.goalentity.nextthink = time; if (vlen (self.origin - self.owner.origin) >= 3000) {
if (self.goalentity.goalentity) Reset_Grapple (self.owner.hook);
{ return;
self.goalentity.goalentity.think = SUB_Remove; } else if (!self.owner.on_hook && vlen (self.owner.hook.velocity) < 10) {
self.goalentity.goalentity.nextthink = time; Reset_Grapple (self.owner.hook);
}
}
Reset_Grapple (self);
return; return;
} }
@ -194,6 +185,9 @@ void () Update_Chain =
setorigin (self, self.owner.origin + temp * 0.25); setorigin (self, self.owner.origin + temp * 0.25);
setorigin (self.goalentity, self.owner.origin + temp * 0.5); setorigin (self.goalentity, self.owner.origin + temp * 0.5);
setorigin (self.goalentity.goalentity, self.owner.origin + temp * 0.75); setorigin (self.goalentity.goalentity, self.owner.origin + temp * 0.75);
self.velocity = '0 0 0';
self.goalentity.velocity = '0 0 0';
self.goalentity.goalentity.velocity = '0 0 0';
self.nextthink = time + 0.1; self.nextthink = time + 0.1;
}; };
@ -203,13 +197,16 @@ void () Update_Chain =
// //
void () Build_Chain = void () Build_Chain =
{ {
self.goalentity = MakeLink(); self.goalentity = MakeLink();
self.goalentity.think = Update_Chain; self.goalentity.think = Update_Chain;
self.goalentity.nextthink = time + 0.1; self.goalentity.nextthink = time + 0.1;
self.goalentity.owner = self.owner; self.goalentity.owner = self.owner;
self.goalentity.goalentity = MakeLink(); self.goalentity.goalentity = MakeLink();
self.goalentity.goalentity.goalentity = MakeLink(); self.goalentity.goalentity.owner = self.owner;
self.goalentity.goalentity.goalentity = MakeLink();
self.goalentity.goalentity.goalentity.owner = self.owner;
}; };
// //
@ -219,48 +216,48 @@ void () Build_Chain =
// //
float () Check_Overhead = float () Check_Overhead =
{ {
local vector src; local vector src;
local vector end; local vector end;
makevectors (self.owner.angles); makevectors (self.owner.angles);
// The following comparisons could be optimized by doing away with // The following comparisons could be optimized by doing away with
// SRC and END, and plugging the values directly into the traceline // SRC and END, and plugging the values directly into the traceline
// function calls. Using SRC and END made debugging easier. You // function calls. Using SRC and END made debugging easier. You
// decide if it's worth it. // decide if it's worth it.
// quick check right above head // quick check right above head
src = self.owner.origin - '0 0 24'; src = self.owner.origin - '0 0 24';
end = self.owner.origin - '0 0 24'; end = self.owner.origin - '0 0 24';
traceline (src, end, FALSE, self.owner); traceline (src, end, FALSE, self.owner);
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
return FALSE; return FALSE;
src = self.owner.origin - '0 0 24' - v_forward * 16; src = self.owner.origin - '0 0 24' - v_forward * 16;
end = self.owner.origin - '0 0 24' - v_forward * 16 + '0 0 58'; end = self.owner.origin - '0 0 24' - v_forward * 16 + '0 0 58';
traceline (src, end, FALSE, self.owner); traceline (src, end, FALSE, self.owner);
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
return FALSE; return FALSE;
src = self.owner.origin - '0 0 24' + v_forward * 16; src = self.owner.origin - '0 0 24' + v_forward * 16;
end = self.owner.origin - '0 0 24' + v_forward * 16 + '0 0 58'; end = self.owner.origin - '0 0 24' + v_forward * 16 + '0 0 58';
traceline (src, end, FALSE, self.owner); traceline (src, end, FALSE, self.owner);
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
return FALSE; return FALSE;
src = self.owner.origin - '0 0 24' - v_right * 16; src = self.owner.origin - '0 0 24' - v_right * 16;
end = self.owner.origin - '0 0 24' - v_right * 16 + '0 0 58'; end = self.owner.origin - '0 0 24' - v_right * 16 + '0 0 58';
traceline (src, end, FALSE, self.owner); traceline (src, end, FALSE, self.owner);
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
return FALSE; return FALSE;
src = self.owner.origin - '0 0 24' + v_right * 16; src = self.owner.origin - '0 0 24' + v_right * 16;
end = self.owner.origin - '0 0 24' + v_right * 16 + '0 0 58'; end = self.owner.origin - '0 0 24' + v_right * 16 + '0 0 58';
traceline (src, end, FALSE, self.owner); traceline (src, end, FALSE, self.owner);
if (trace_fraction != 1.0) if (trace_fraction != 1.0)
return FALSE; return FALSE;
return TRUE; return TRUE;
}; };
@ -278,7 +275,12 @@ void () Anchor_Grapple =
// if you create new types of projectiles, make sure you use one of the // if you create new types of projectiles, make sure you use one of the
// classnames below or write code to exclude your new classname so // classnames below or write code to exclude your new classname so
// grapples will not stick to them. // grapples will not stick to them.
if (other.classname == "missile" || other.classname == "grenade" || other.classname == "spike" || other.classname == "hook" || other.classname == "pipebomb") //CH maybe fix crash? if (other.classname == "missile"
|| other.classname == "grenade"
|| other.classname == "spike"
|| other.classname == "hook"
|| other.classname == "pipebomb"
|| other.classname == "force_field") //CH maybe fix crash?
return; return;
//if (isBuilding(other)) //WK don't hook onto buildings? //if (isBuilding(other)) //WK don't hook onto buildings?
@ -349,37 +351,37 @@ void () Anchor_Grapple =
// //
void () Throw_Grapple = void () Throw_Grapple =
{ {
if (self.hook_out)// reject subsequent calls from player.qc if (self.hook_out)// reject subsequent calls from player.qc
return; return;
KickPlayer(-1, self); KickPlayer(-1, self);
// chain out sound (loops) // chain out sound (loops)
newmis = spawn(); newmis = spawn();
newmis.movetype = MOVETYPE_FLYMISSILE; newmis.movetype = MOVETYPE_FLYMISSILE;
newmis.solid = SOLID_BBOX; newmis.solid = SOLID_BBOX;
newmis.owner = self;// newmis belongs to me newmis.owner = self;// newmis belongs to me
self.hook = newmis;// This is my newmis self.hook = newmis;// This is my newmis
newmis.classname = "hook"; newmis.classname = "hook";
makevectors (self.v_angle); makevectors (self.v_angle);
newmis.velocity = v_forward * 800; newmis.velocity = v_forward * 800;
// newmis.avelocity = '0 0 -500'; // newmis.avelocity = '0 0 -500';
// set the facing of the grapple // set the facing of the grapple
newmis.angles = vectoangles(newmis.velocity); newmis.angles = vectoangles(newmis.velocity);
newmis.touch = Anchor_Grapple; newmis.touch = Anchor_Grapple;
newmis.think = Build_Chain; newmis.think = Build_Chain;
newmis.nextthink = time + 0.1;// don't jam newmis and links into same packet newmis.nextthink = time + 0.1;// don't jam newmis and links into same packet
setmodel (newmis,"progs/hook.mdl"); setmodel (newmis,"progs/hook.mdl");
setorigin (newmis, self.origin + v_forward * 16 + '0 0 16'); setorigin (newmis, self.origin + v_forward * 16 + '0 0 16');
setsize(newmis, '0 0 0' , '0 0 0 '); setsize(newmis, '0 0 0' , '0 0 0 ');
self.hook_out = TRUE; self.hook_out = TRUE;
self.fire_held_down = TRUE; self.fire_held_down = TRUE;
}; };
// //
@ -387,41 +389,40 @@ void () Throw_Grapple =
// //
void () Service_Grapple = void () Service_Grapple =
{ {
local vector hook_dir; local vector hook_dir;
self.gravity = 0; self.gravity = 0;
// drop the hook if player lets go of button // drop the hook if player lets go of button
if (!self.button0) if (!self.button0)
{ {
self.fire_held_down = FALSE; self.fire_held_down = FALSE;
if (self.current_weapon == WEAP_HOOK)
Reset_Grapple (self.hook);
}
// If hooked to a player, track them directly!
if (self.hook.enemy.classname == "player")
hook_dir = (self.hook.enemy.origin - self.origin);
// else, track to hook
else
hook_dir = (self.hook.origin - self.origin);
// set the facing of the grapple if (self.current_weapon == WEAP_HOOK) {
// self.hook.angles = vectoangles(self.hook.velocity); Reset_Grapple (self.hook);
return;
}
}
// If hooked to a player, track them directly!
if (self.hook.enemy.classname == "player")
hook_dir = (self.hook.enemy.origin - self.origin);
else // else, track to hook
hook_dir = (self.hook.origin - self.origin);
self.velocity = normalize(hook_dir) * self.maxspeed * 1.5; // set the facing of the grapple
// self.hook.angles = vectoangles(self.hook.velocity);
if ( vlen(hook_dir) <= 100 && self.lefty) // cancel chain sound self.velocity = normalize(hook_dir) * self.maxspeed * 1.5;
{
// If there is a chain, ditch it now. We're
// close enough. Having extra entities lying around
// is never a good idea.
if (self.hook.goalentity)
{
self.hook.goalentity.think = Remove_Chain;
self.hook.goalentity.nextthink = time;
}
self.lefty = FALSE; // we've reset the sound channel. if (vlen(hook_dir) <= 100 && self.lefty) // cancel chain sound
} {
// If there is a chain, ditch it now. We're
// close enough. Having extra entities lying around
// is never a good idea.
if (self.hook.goalentity) {
Remove_Chain (self.hook.goalentity);
}
self.lefty = FALSE; // we've reset the sound channel.
}
}; };

View file

@ -1262,7 +1262,7 @@ void() PlayerDie =
{ {
Reset_Grapple (self.hook); Reset_Grapple (self.hook);
Attack_Finished(0.75); Attack_Finished(0.75);
self.hook_out = TRUE; // PutClientInServer will reset this // self.hook_out = TRUE; // PutClientInServer will reset this
} }
self.items = self.items & ~(IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD); self.items = self.items & ~(IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD);
self.invisible_finished = 0; // don't die as eyes self.invisible_finished = 0; // don't die as eyes

2
spy.qc
View file

@ -343,7 +343,7 @@ void(float type) TeamFortress_SpyFeignDeath =
{ {
Reset_Grapple (self.hook); Reset_Grapple (self.hook);
Attack_Finished(0.75); Attack_Finished(0.75);
self.hook_out = TRUE; // PutClientInServer will reset this // self.hook_out = TRUE; // PutClientInServer will reset this
} }
if (self.undercover_team == 0 && self.undercover_skin == 0) if (self.undercover_team == 0 && self.undercover_skin == 0)