
|
|
Intro First of
all, I would like to take this opportunity to agree completely with what
dmgoober wrote. It is a bad idea
to download random DLL's. You can be sure that someone will write a malicious
Quake2 DLL, and you don't want that DLL on your system! This is a
small demo that makes your rocket launcher fire three rockets at a time.
Also, the two outer rockets rotate around the center rocket as the rockets
fly away from you. It demonstrates how to make quake entities think over a
period of time. Sorry if this article is a little long. You will
need: |
|
General
Setup You will,
of course, need to have you source code set up and ready to go. If you
haven't done so, see dmgoober's first Tutorial. One addition,
though. If you want to avoid all that DLL copying everytime you recompile and
you have MSVC 4.0 or above, perform the following: 1. Go to
the Project menu and choose Settings... (or
hit Alt-F7) 2. The Project
Settings dialog box will come up. Click on the Link
tab. 3. In the
upper left hand corner of the box, there is a combo box labeled "Settings
for:". Change the combo box to All Configurations. 4. In the Output
file name: field, type "f:\Quake2\mygame\gamex86.dll" (Of
course, you will have to change the path to wherever your quake game
directory is). That's it.
Now, on with the tutorial! |
|
|
|
Tutorial
Code
Paste the following code into the file q_weapon.c /*************************************************************************** RotatePointAroundVector(ent->velocity,
ent->pos1, ent->velocity, 30); /*The velocity vector must be /***********
fire_rocket2 ********************************************
Open the file p_weapon.c
You will need to find the Weapon_RocketLauncher_Fire (edict_t *ent) procedure. Replace it with the following code there /***********
Weapon_RocketLauncher_Fire ********************** void
Weapon_RocketLauncher_Fire (edict_t *ent)
Notice the forward declaration before the above procedure. It must be there so the compiler knows that the function exists elsewhere.
If you have set quake up to run as suggested by dmgoober, then quake will start up with your DLL and in deathmatch mode. So, simply and find a rocket launcher and shoot at something to see the rockets spiral. |
||
|
|
|
|
|
Ending
traj_angle[1]
= ent->client->v_angle[1]+5; Where added
in order to launch the second rocket. Then, the same code is repeated, except
the first line of this code snippet is changed to traj_angle[1]
= ent->client->v_angle[1]-5; /*five degrees to the left, this time*/ This fires
the second rocket 5 degrees to the left, instead of five degrees to the right
like the first statement.That's about it for this procedure.
VectorCopy
(los, rocket->pos1); /*Added: Save the line of sight of the center rocket.
This is VectorCopy
(start, rocket->pos2); /*Added: Save the start position of the rocket (Not
sure if These lines
just copy the line of sight and start position into the pos1 and pos2 fields,
respectively (I'm not sure what these fields are used for, but doing this
doesn't seem to affect the rocket's behavior at all, so I used them). The
reason a whole new copy of fire_rocket() had to be made is
because the line of site variable had to be passed into the function. Also, the
rocket->think and rocket->nextthink fields
had to be changed to: rocket->think
= mod_SpiralThink; This is
because our rocket needs to "think" every so often. (Every .1
seconds to be exact)
|
Tutorial html coding
modified by legion.
If it is created, then
it is copyrighted. Quake 4 Tutorial #1 is (c)1997-98 by Tim
Matthews
and the Inside3D
staff. The site is hosted by the one and only TeleFragged.
Please direct any
flames, comments, or praises to the author. Any and all information found in
this tutorial may
be used in any Quake modification provided that the author and the Inside3D
staff are credited.