1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-02-24 23:42:49 +01:00

fix pistols pickups and ammo after load game

This commit is contained in:
XProger 2018-10-15 03:56:00 +03:00
parent 7313cebdfb
commit 9b40610cef
2 changed files with 6 additions and 5 deletions

View File

@ -681,6 +681,10 @@ struct Inventory {
if (smart) {
switch (type) {
case TR::Entity::INV_PISTOLS :
case TR::Entity::INV_AMMO_PISTOLS :
addAmmo(type, count, 10, TR::Entity::INV_PISTOLS, TR::Entity::INV_AMMO_PISTOLS);
break;
case TR::Entity::INV_SHOTGUN :
case TR::Entity::INV_AMMO_SHOTGUN :
addAmmo(type, count, 2, TR::Entity::INV_SHOTGUN, TR::Entity::INV_AMMO_SHOTGUN);

View File

@ -246,7 +246,6 @@ struct Lara : Character {
TR::Entity::Type wpnCurrent;
TR::Entity::Type wpnNext;
Weapon::State wpnState;
int *wpnAmmo;
struct Arm {
Controller *tracking; // tracking target (main target)
@ -698,10 +697,6 @@ struct Lara : Character {
wpnCurrent = wType;
wpnState = Weapon::IS_FIRING;
TR::Entity::Type invType = wpnCurrent;
wpnAmmo = game->invCount(invType);
arms[0].animation = arms[1].animation = Animation(level, &level->models[wType == TR::Entity::SHOTGUN ? TR::MODEL_SHOTGUN : TR::MODEL_PISTOLS]);
wpnSetAnim(arms[0], Weapon::IS_HIDDEN, Weapon::Anim::NONE, 0.0f, 0.0f);
@ -952,6 +947,8 @@ struct Lara : Character {
}
void doShot(bool rightHand, bool leftHand) {
int *wpnAmmo = game->invCount(wpnCurrent);
if (wpnAmmo && *wpnAmmo != UNLIMITED_AMMO && *wpnAmmo <= 0) { // check for no ammo
game->playSound(TR::SND_EMPTY, pos, Sound::PAN);
wpnChange(TR::Entity::PISTOLS);