Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Dropped weapons should remember ammo count. #26

Open Raptor007 opened 8 years ago

Raptor007 commented 8 years ago

The weapons should remember their ammo count when dropped. If you drop an MP5 with 12 rounds in it, the next person who picks it up should have 12 rounds in it. This will be an optional cvar because it changes the gameplay.

Raptor007 commented 7 years ago

Ammo when picking up a weapon is controlled by p_weapon.c Pickup_Weapon: https://github.com/Raptor007/aq2-tng/blob/ff13fc5b37ce31e67ec14c76f0e92ccf543438bf/source/p_weapon.c#L264

The weapon's current ammo will need to be assigned to the dropped item in p_weapon.c Drop_Weapon: https://github.com/Raptor007/aq2-tng/blob/ff13fc5b37ce31e67ec14c76f0e92ccf543438bf/source/p_weapon.c#L806

It looks like temp->count would be a good variable to use.

Raptor007 commented 7 years ago

When this cvar is enabled, dead players should also drop their extra magazines.

Raptor007 commented 7 years ago

This cvar should also prevent pistols from refilling automatically when you pick up another.

Raptor007 commented 4 years ago

Actually it looks like g_items.c Drop_Item would be the appropriate place to set the dropped ammo count, so that it also applies to dying players: https://github.com/Raptor007/aq2-tng/blob/1317847b3ee94291c3e9493af06350af9ea4b3da/source/g_items.c#L908-L972