Kangaroo cheat and bug fixes

Signed-off-by: eray orçunus <erayorcunus@gmail.com>
This commit is contained in:
eray orçunus
2019-07-01 22:46:44 +03:00
parent 8b36718c0a
commit 27838ae0b2
8 changed files with 72 additions and 39 deletions

View File

@ -435,6 +435,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_ped_flagI4 = false;
bRecordedForReplay = false;
m_ped_flagI10 = false;
#ifdef KANGAROO_CHEAT
m_ped_flagI80 = false;
#endif
if ((CGeneral::GetRandomNumber() & 3) == 0)
m_ped_flagD1 = true;
@ -461,12 +464,12 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
for(int i = 0; i < NUM_PED_WEAPONTYPES; i++)
{
CWeapon *weapon = GetWeapon(i);
weapon->m_eWeaponType = WEAPONTYPE_UNARMED;
weapon->m_eWeaponState = WEAPONSTATE_READY;
weapon->m_nAmmoInClip = 0;
weapon->m_nAmmoTotal = 0;
weapon->m_nTimer = 0;
CWeapon &weapon = GetWeapon(i);
weapon.m_eWeaponType = WEAPONTYPE_UNARMED;
weapon.m_eWeaponState = WEAPONSTATE_READY;
weapon.m_nAmmoInClip = 0;
weapon.m_nAmmoTotal = 0;
weapon.m_nTimer = 0;
}
m_lastHitState = 0;
@ -479,23 +482,27 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
CPopulation::UpdatePedCount(m_nPedType, false);
}
void
uint32
CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo)
{
if (HasWeapon(weaponType)) {
if (ammo > 99999)
m_weapons[weaponType].m_nAmmoTotal = 99999;
else
m_weapons[weaponType].m_nAmmoTotal = ammo;
CWeapon &weapon = GetWeapon(weaponType);
m_weapons[weaponType].Reload();
if (HasWeapon(weaponType)) {
if (weapon.m_nAmmoTotal + ammo > 99999)
weapon.m_nAmmoTotal = 99999;
else
weapon.m_nAmmoTotal += ammo;
weapon.Reload();
} else {
m_weapons[weaponType].Initialise(weaponType, ammo);
weapon.Initialise(weaponType, ammo);
// TODO: It seems game uses this as both weapon count and max WeaponType we have, which is ofcourse erroneous.
m_maxWeaponTypeAllowed++;
}
if (m_weapons[weaponType].m_eWeaponState == WEAPONSTATE_OUT_OF_AMMO)
m_weapons[weaponType].m_eWeaponState = WEAPONSTATE_READY;
if (weapon.m_eWeaponState == WEAPONSTATE_OUT_OF_AMMO)
weapon.m_eWeaponState = WEAPONSTATE_READY;
return weaponType;
}
static RwObject*
@ -1227,8 +1234,8 @@ bool
CPed::SelectGunIfArmed(void)
{
for (int i = 0; i < m_maxWeaponTypeAllowed; i++) {
if (GetWeapon(i)->m_nAmmoTotal > 0) {
eWeaponType weaponType = GetWeapon(i)->m_eWeaponType;
if (GetWeapon(i).m_nAmmoTotal > 0) {
eWeaponType weaponType = GetWeapon(i).m_eWeaponType;
if (weaponType >= WEAPONTYPE_COLT45 && weaponType != WEAPONTYPE_M16 && weaponType <= WEAPONTYPE_FLAMETHROWER) {
SetCurrentWeapon(i);
return true;

View File

@ -382,7 +382,7 @@ public:
bool IsPointerValid(void);
void SortPeds(CPed**, int, int);
void BuildPedLists(void);
void GiveWeapon(eWeaponType weaponType, uint32 ammo);
uint32 GiveWeapon(eWeaponType weaponType, uint32 ammo);
void SetPedStats(ePedStats);
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
@ -416,8 +416,8 @@ public:
static void PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
inline bool HasWeapon(uint32 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
inline CWeapon *GetWeapon(uint32 weaponType) { return &m_weapons[weaponType]; }
inline bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
inline CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }
inline CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
inline RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }

View File

@ -27,11 +27,11 @@ CPedIK::GetComponentPosition(RwV3d *pos, PedNode node)
RwMatrix *mat;
f = m_ped->GetNodeFrame(node);
mat = &f->modelling;
mat = RwFrameGetMatrix(f);
*pos = mat->pos;
for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
RwV3dTransformPoints(pos, pos, 1, &f->modelling);
RwV3dTransformPoints(pos, pos, 1, RwFrameGetMatrix(f));
}
RwMatrix*
@ -39,10 +39,10 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
{
RwFrame *i;
*destination = source->modelling;
*destination = *RwFrameGetMatrix(source);
for (i = RwFrameGetParent(source); i; i = RwFrameGetParent(i))
RwMatrixTransform(destination, &i->modelling, rwCOMBINEPOSTCONCAT);
RwMatrixTransform(destination, RwFrameGetMatrix(i), rwCOMBINEPOSTCONCAT);
return destination;
}