Open76
Open76 copied to clipboard
Basic Weapon Firing
With most of the interior car interface out of the way now (with exception of the speedo/tacho) I figured I'd have a go at one of the real fun bits - the weapons.
We've got the models in place now and I've been able to squeeze even more data out of the GDF files through trial and error of editing the files in a hex editor and then observing the changes in the original retail version of the game (it's a lot easier to do that when the ZFS file isn't compressed)
We've got all the basics needed to at least make an attempt of firing the weapons.
Useful GDF bits:
- Ammo count
- Weapon health
- Weapon group
- Burst count
- Weapon mass
- Burst fire rate
- Weapon mesh
- Weapon facing direction (from VDF)
- Fire rate
- Firing sounds
- Projectile velocity
- Projectile damage
- Projectile mesh
What I've got implemented in a branch so far:
- Interface stuff
- Cycling between weapons.
- Weapon grouping.
- Separator between front and rear facing weapons.
- Shooty stuff
- Firing projectiles
- Firing all grouped weapons.
- Multi-shot weapons (e.g. fire-rite rockets fire rockets in a 3-shot burst before a longer reload pause)
- Loading projectile models and textures
I've found that some weapons do not have meshes for the projectiles. Rockets generally do, but things like the 30-cal machine gun does not have a mesh - it only has a texture. Right now creating a 1x1x1 cube and texturing that, then shooting that out of the machine gun. It doesn't look great.
Some misc notes:
-
I believe data blocks in the GDF files prefixed by 'O' refer to the projectile (Ordinance?) and 'G' refers to the actual weapon (Gun?)
-
There is a mysterious string for each weapon in the GDFC block (which stores all the useful weapon info e.g. ammo, firing rate, etc.) - I can't find any references to this string elsewhere in any other files. Changing it doesn't seem to do anything in the original game. Examples are 'slg01' for gmlight.gdf and 'spp01' for gdumb.gdf.
-
The GPOF block is not really understood. At first glance it appears to be the Forward, Right, Up and Position vectors for 4 separate objects. Zeroing this block results in projectiles hitting thin air as soon as they're fired.
-
There's an ORDF block that seems to point at a number of XDF (sprite?) files and sound files, presumably used for hit effects.
-
The OGEO block at the end of the GDF file refers to the name of the projectile with a matching .map and .geo file.
What I'd like to get done for a first pass & pull request:
- Figure out how the projectile is scaled - this should fix machine gun bullets from consisting of ghastly cubes.
- Try and solve the GPOF block data mystery and determine if it's actually needed.
- Simply reduce health of the entire vehicle the bullets hit (which will "explode" when their health reaches 0)
I'll be ignoring 'drop' weapons for the time being as they're a bit more complicated - e.g. oil slicks, fire, landmines
I'm not going to try and get XDF files for rocket smoke or projectile hit effects working yet. I just want the weapons to fire correct looking projectiles - after that I'll probably look at the missing bits.
I'll get some juicy screenshots in later - there's a few things implemented as noted above but I'd like to get it a little further along first.