project-navigation
Personal tools

Author Topic: Weapons with several ammo-types  (Read 2691 times)

HaJo

  • Guest
Weapons with several ammo-types
« on: August 09, 2006, 05:19:49 am »
Some weapons can use different kinds of ammo (rocketlauncher,
grenadelauncher...), but currently we cannot see what is loaded.

It would be useful to have an indicator to display the type of ammo
currently loaded into the weapon.

An unload-button would also be nice, so ammo could be changed
without wasting it.

For the grenadelauncher, this would need bookkeeping about
partially used shells.

Rei

  • Guest
Weapons with several ammo-types
« Reply #1 on: August 09, 2006, 06:01:18 pm »
I know that there was resistance to tracking partially-used clips, so the same would probably hold here.  

However...

Perhaps it's not as tough as they're thinking.  Whatever variable stores how many you have of something, change it from an int to a float.  Look for all instances of that variable and change them from 'foo' to 'floor(foo+0.001)' (the plus is to eliminate floating point rounding errors).  Now you can keep track of fractional clips.  Since you're using floor in most places, you won't see any ammo that doesn't fully fill up a clip -- but whenever your fractional clips add up to enough, you'll end up with another clip.

That would be a first step, of course.  The next step would be to make the hidden, partially filled clip visible and usable (perhaps turn it red to show that it's not full).  This would be more difficult; however, you can still do the first step and get part of the goal accomplished without doing the second step.

Just one possible way (among many) to approach the issue.

Offline Bandobras

  • Captain
  • *****
  • Posts: 586
    • View Profile
Weapons with several ammo-types
« Reply #2 on: August 09, 2006, 10:44:36 pm »
I may be wrong, but I think, at least in the code that reloads a weapon, partial clips are legal (and are chosen only if there are no full clips)...

HaJo

  • Guest
Weapons with several ammo-types
« Reply #3 on: August 09, 2006, 10:56:16 pm »
A first step might be the indicator for the ammo-type.
Maybe a simple colored background for the ammo-count.

A second step might be a button for unloading the rocket-launcher.

That wouldn't need partially filled clips, and would be very useful
for switching between high-explosive and incendiary ammo.