From d57b64ee86b96cb28da87d8678086233eba4c98d Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Thu, 16 Feb 2006 06:10:48 +0000 Subject: [PATCH] changed +/-hook aliases to use +/-button6 instead of impulses 20 and 21, and changed code accordingly, this should improve packet loss tolerance when using the grapple git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1062 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/default.cfg | 4 ++-- data/qcsrc/server/gamec/g_hook.c | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/data/default.cfg b/data/default.cfg index 8e8c7debe..4acf6bc67 100644 --- a/data/default.cfg +++ b/data/default.cfg @@ -18,8 +18,8 @@ alias team_yellow "color 12" alias "+scores" "+showscores; ping" alias "-scores" "-showscores" -alias "+hook" "impulse 20" -alias "-hook" "impulse 21" +alias "+hook" "+button6" +alias "-hook" "-button6" alias "ready" "cmd ready" alias "bsp" "ls maps/*.bsp" diff --git a/data/qcsrc/server/gamec/g_hook.c b/data/qcsrc/server/gamec/g_hook.c index 766cec869..900f5989e 100644 --- a/data/qcsrc/server/gamec/g_hook.c +++ b/data/qcsrc/server/gamec/g_hook.c @@ -26,7 +26,7 @@ float GRAPHOOK_FIRE = 20; float GRAPHOOK_RELEASE = 21; // (note: you can change the hook impulse #'s to whatever you please) -4. Open client.c and add this to the top of PutClientInServer(): +4. Open client.c and add this to the top of PutClientInServer(): RemoveGrapplingHook(self); // Wazat's Grappling Hook @@ -83,7 +83,7 @@ void GrapplingHookThink() dir = normalize(dir); end = self.origin - dir*minlength; - + dist = vlen(end - org); if(dist < 200) @@ -170,6 +170,18 @@ void FireGrapplingHook (void) void GrapplingHookFrame() { + // this function has been modified for Nexuiz + if (self.button6 && cvar("g_grappling_hook")) + { + if (!self.hook && self.hook_time <= time) + FireGrapplingHook(); + } + else + { + if (self.hook) + RemoveGrapplingHook(self); + } + /* // if I have no hook or it's not pulling yet, make sure I'm not flying! if((self.hook == world || !self.hook.state) && self.movetype == MOVETYPE_FLY) { @@ -181,12 +193,13 @@ void GrapplingHookFrame() FireGrapplingHook(); return; } - else if(self.impulse == GRAPHOOK_RELEASE) + else if(self.hookimpulse == GRAPHOOK_RELEASE) { // remove hook, reset movement type RemoveGrapplingHook(self); return; } + */ /*else // make sure the player's movetype is correct { //if(self.hook == world && self.movetype == MOVETYPE_FLY) @@ -200,6 +213,9 @@ void GrapplingHookFrame() void SetGrappleHookBindings() { + // this function has been modified for Nexuiz + /* stuffcmd(self, strcat("alias +hook \"impulse ", ftos(GRAPHOOK_FIRE), "\"\n")); stuffcmd(self, strcat("alias -hook \"impulse ", ftos(GRAPHOOK_RELEASE), "\"\n")); + */ } -- 2.39.2