summaryrefslogtreecommitdiffstats
path: root/src/peds/Population.cpp
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-05-15 20:30:57 +0200
committerGitHub <noreply@github.com>2020-05-15 20:30:57 +0200
commit8ff72f0728acbba293580042135f43268fa340fe (patch)
tree23cb65ca52efe5e964423ee50eff0e60ce8e155a /src/peds/Population.cpp
parentCPedIK (diff)
parentWeapon layer in Peds (diff)
downloadre3-8ff72f0728acbba293580042135f43268fa340fe.tar
re3-8ff72f0728acbba293580042135f43268fa340fe.tar.gz
re3-8ff72f0728acbba293580042135f43268fa340fe.tar.bz2
re3-8ff72f0728acbba293580042135f43268fa340fe.tar.lz
re3-8ff72f0728acbba293580042135f43268fa340fe.tar.xz
re3-8ff72f0728acbba293580042135f43268fa340fe.tar.zst
re3-8ff72f0728acbba293580042135f43268fa340fe.zip
Diffstat (limited to 'src/peds/Population.cpp')
-rw-r--r--src/peds/Population.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 2dc0bbab..14bd042c 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -471,9 +471,28 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors,
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
if (ms_bGivePedsWeapons) {
- eWeaponType weapon = (eWeaponType)CGeneral::GetRandomNumberInRange(WEAPONTYPE_UNARMED, WEAPONTYPE_DETONATOR);
+ eWeaponType weapon;
+
+ // TODO(Miami): Look here when weapons have been ported
+ switch (CGeneral::GetRandomNumber() & 3) {
+ case 0:
+ weapon = WEAPONTYPE_COLT45;
+ break;
+ case 1:
+ //weapon = WEAPONTYPE_NIGHTSTICK;
+ //break;
+ case 2:
+ //weapon = WEAPONTYPE_GOLFCLUB;
+ //break;
+ case 3:
+ weapon = WEAPONTYPE_TEC9;
+ break;
+ default:
+ break;
+ }
if (weapon != WEAPONTYPE_UNARMED) {
- ped->SetCurrentWeapon(ped->GiveWeapon(weapon, 25001));
+ ped->GiveDelayedWeapon(weapon, 25001);
+ ped->SetCurrentWeapon(CWeaponInfo::GetWeaponInfo(weapon)->m_nWeaponSlot);
}
}
return ped;
@@ -501,12 +520,14 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors,
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
- uint32 weapon;
+ eWeaponType weapon;
if (CGeneral::GetRandomNumberInRange(0, 100) >= 50)
- weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2, 25001);
+ weapon = (eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2;
else
- weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
- ped->SetCurrentWeapon(weapon);
+ weapon = (eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1;
+
+ ped->GiveDelayedWeapon(weapon, 25001);
+ ped->SetCurrentWeapon(CWeaponInfo::GetWeaponInfo(weapon)->m_nWeaponSlot);
return ped;
}
case PEDTYPE_EMERGENCY: