by Mike Melzner
September 19, 1998
weapons.c Modification, v0.10 Modified using Microsoft Visual C++4.0 Standard Tested using Beta 2 of the Genesis 3D SDK
* * * * * * D I S C L A I M E R * * * * * * * * * I am not a professional programmer. Utilize this mod at your own risk. Although this has been tested, I accept no responsibility if it blows your computer up! :) Please make sure you backup the original file. * * * * * * * * * * * * * * * * * * * * * * * * *
=================NOTE============================ You should notice that all modifications made to this file by me are annotated similar to: // Modified RMM980919 (my initials and date) whatever is modified goes here; // End modification =================================================
In going through the weapons.c file, I noticed that the Grenade Launcher was the only weapon that seemed to
be
affected by gravity and projectile drop over distance. This current modification simply adds minimal projectile
drop to the
Blaster and Rocket Launcher. I also reduced the gravity effect on the Grenade Launcher in order for it to have
a bit more
range. The velocity of the Rockets and Blaster Bolts were also increased. I think they were too slow, and would
be a bit
easy to dodge if you saw them coming.
Here are the details:
The Grenade Launcher, in the section labeled:
geBoolean Grenade_Control( ... )
has a statement of:
// Add gravity
Player->Inertia.Y -= 1000*Time;
As best I can tell, this is telling the engine to increase the inertia in the Y or verticle axis by 1000 for
each increment of time.
All this does is make the calculation of the effect gravity will have on the projectile.
You also must add a line. In the case of the Rocket launcher, it follows:
geXForm3d_GetIn(&Player->XForm, &In);
geVec3d_Scale(&In, -Speed*Time, &In); // - speed since xform was rotated 180!!!
geXForm3d_Translate(&DestXForm, In.X, In.Y, In.Z);
The new line is:
geVec3d_AddScaled(&(DestXForm.Translation), &Player->Inertia, Time, &(DestXForm.Translation));
This implements the calculated effect of gravity from the earlier calculation.
I tried playing with the values a bit. Increasing it to 5000 caused the Grenade to drop very rapidly. I ended
up going with
650, in order to increase the weapon's range a bit. At 1000, I think I could spit a grenade farther than I could
shoot it! :)
I then copied this statement into each weapons (weapon)_Control( ... ) section, and just varied the value used.
I wasn't
positive where this gravity statement should be placed in each section, so I just made an educated guess. Special
thanks to
Royce Pipkins for answering numerous silly questions and pointing me in the right direction!
Since the engine does not normally use extremely large outdoor areas, maybe this is irrelevant. I partially
did this as a learning
exercise for myself. However, perhaps a bit of "Kentucky Windage (or elevation)" might add some spice
to DM play.
---Known Bugs---
None.
However I have a bug issue with the engine that has limited my ability to thoroughly test this mod.
---Future Plans---
I think I'd like to modify the weapons to create a Super Shredder out of the Shredder (2-3 times the
rate of fire) and make a Super Blaster (either shoot double shots, or maybe 2-3 times the damage per shot).
Any feedback you may have on this would be greatly appreciated!
You may download a copy of the .c file associated with this tutorial by clicking here.