"THE NOTES" : Chapter
2
HOWTO enable the Grappling Hook in the
Quake 3 Source Code
By
Matt Ownby (see end of this document for contact information)
1/15/99, 5:12
AM
Ok the Q3
source code was just released a few hours ago and I have had my eyes pouring
over the contents ever since. Fortunately, much of it is similar to Quake
2. There is also a lot of new stuff.
As many of you know, the grappling hook was added
into the code, but removed later in development. Therefore, it is just a
matter of patching the code a little bit to unlock the grappling hook for
general use <evil grin>. Here is a quick (very quick) tutorial on
how to patch your source code to turn on the grappling hook.
NOTE: Due to my small modifications, line numbers
will be different from the stock source. All my modifications begin with
"// start MATT" and "// end MATT".
g_client.c (part of the "game"
DLL)
Go to about line 939
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET
);
// start
MATT
client->ps.stats[STAT_WEAPONS] |= ( 1 <<
WP_GRAPPLING_HOOK);
// end MATT
client->ps.ammo[WP_GAUNTLET] = -1;
client->ps.ammo[WP_GRAPPLING_HOOK] =
-1;
Go to about line
991
//
start MATT
for
( i = WP_NUM_WEAPONS - 2 ; i > 0 ; i-- ) {
// changed the -1 to a -2 so the grapple
isn't selected by default
// end MATT
if ( client->ps.stats[STAT_WEAPONS] & ( 1 << i ) ) {
client->ps.weapon =
i;
break;
}
}
ui_controls2.c
(part of the "ui" DLL)
Go to about line 105
#define
ID_JOYTHRESHOLD 40
#define
ID_SMOOTHMOUSE 41
// start
MATT
#define
ID_WEAPON10 42 // grappling hook
// end MATT
Go to about line 170
menuaction_s bfg;
// start MATT
menuaction_s hook;
// end MATT
menuaction_s
attack;
Go to about line
245
{"weapon
9", "BFG", ID_WEAPON9, ANIM_WEAPON9,
'9', -1, -1, -1},
// start MATT
{"weapon 10", "grappling hook",
ID_WEAPON10, ANIM_WEAPON10, '0', -1, -1,
-1},
// stop
MATT
{"+attack", "attack", ID_ATTACK,
ANIM_ATTACK, K_CTRL, -1, -1, -1},
Go to about line 299
(menucommon_s *)&s_controls.bfg,
// start MATT
(menucommon_s
*)&s_controls.hook,
// end MATT
NULL,
Go to about line 1386
s_controls.bfg.generic.type =
MTYPE_ACTION;
s_controls.bfg.generic.flags =
QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN;
s_controls.bfg.generic.callback =
Controls_ActionEvent;
s_controls.bfg.generic.ownerdraw =
Controls_DrawKeyBinding;
s_controls.bfg.generic.id
= ID_WEAPON9;
//
start MATT
s_controls.hook.generic.type =
MTYPE_ACTION;
s_controls.hook.generic.flags =
QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN;
s_controls.hook.generic.callback =
Controls_ActionEvent;
s_controls.hook.generic.ownerdraw =
Controls_DrawKeyBinding;
s_controls.hook.generic.id
= ID_WEAPON10;
// end MATT
s_controls.attack.generic.type =
MTYPE_ACTION;
s_controls.attack.generic.flags =
QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN;
s_controls.attack.generic.callback =
Controls_ActionEvent;
s_controls.attack.generic.ownerdraw =
Controls_DrawKeyBinding;
s_controls.attack.generic.id
= ID_ATTACK;
That's it!
And yes, this patch _does_ work for CTF (I tested it
briefly).
Contact Information:
I can be found on irc.enterthegame.com in
#JUN at all times, although sometimes I will
obviously be away. My nick is JB[JUN].
I am not going to post my email address on this page because I am sick
of getting spam every day.
Here are other
programming projects I am working on (you can get my email address from these
pages hehe):
http://daphne.rulecity.com/
http://www.planetquake.com/bop
(look for the Quake 3 version soon muwahaha)