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

@ -14,6 +14,7 @@
#include "Game.h" #include "Game.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "Font.h" #include "Font.h"
#include "Hud.h"
#include "Text.h" #include "Text.h"
#include "Timer.h" #include "Timer.h"
#include "World.h" #include "World.h"
@ -24,7 +25,6 @@
#include "Weather.h" #include "Weather.h"
#include "win.h" #include "win.h"
CPad *Pads = (CPad*)0x6F0360; // [2] CPad *Pads = (CPad*)0x6F0360; // [2]
CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C; CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
@ -70,6 +70,28 @@ WRAPPER void StrongGripCheat() { EAXJMP(0x491670); }
WRAPPER void NastyLimbsCheat() { EAXJMP(0x4916A0); } WRAPPER void NastyLimbsCheat() { EAXJMP(0x4916A0); }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef KANGAROO_CHEAT
void KangarooCheat()
{
wchar *string;
CPed *playerPed = FindPlayerPed();
int m_fMass;
if (playerPed->m_ped_flagI80) {
string = TheText.Get("CHEATOF");
m_fMass = 70.0f;
} else {
string = TheText.Get("CHEAT1");
m_fMass = 15.0f;
}
CHud::SetHelpMessage(string, 1);
playerPed->m_ped_flagI80 = !playerPed->m_ped_flagI80;
playerPed->m_fMass = m_fMass;
playerPed->m_fAirResistance = 0.4f / m_fMass;
}
#endif
void void
CControllerState::Clear(void) CControllerState::Clear(void)
{ {
@ -510,6 +532,12 @@ void CPad::AddToPCCheatString(char c)
if ( !_CHEATCMP("TAEHCSBMILYTSAN") ) if ( !_CHEATCMP("TAEHCSBMILYTSAN") )
NastyLimbsCheat(); NastyLimbsCheat();
#ifdef KANGAROO_CHEAT
// "KANGAROO"
if (!_CHEATCMP("OORAGNAK"))
KangarooCheat();
#endif
#undef _CHEATCMP #undef _CHEATCMP
} }

View File

@ -78,4 +78,4 @@ enum Config {
//#define USE_MY_DOCUMENTS //#define USE_MY_DOCUMENTS
#define NASTY_GAME #define NASTY_GAME
#define PS2_MATFX #define PS2_MATFX
#define KANGAROO_CHEAT

View File

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

View File

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

View File

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

View File

@ -300,10 +300,10 @@ void CHud::Draw()
/* /*
DrawAmmo DrawAmmo
*/ */
int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition; uint32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; uint32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; uint32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
int32 Ammo, Clip; uint32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000) if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo); sprintf(sTemp, "%d", TotalAmmo);
@ -1359,7 +1359,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
CMessages::InsertPlayerControlKeysInString(m_HelpMessage); CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
m_LastHelpMessage[i] = message[i]; m_LastHelpMessage[i] = 0;
} }
m_HelpMessageState = 0; m_HelpMessageState = 0;
@ -1443,7 +1443,7 @@ STARTPATCHES
InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP); InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP);
InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP); InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP);
InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP); InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP);
//InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP);
InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP); InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP);
InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP); InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP);
InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP); InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP);

View File

@ -47,7 +47,7 @@ public:
eWeaponState m_eWeaponState; eWeaponState m_eWeaponState;
uint32 m_nAmmoInClip; uint32 m_nAmmoInClip;
uint32 m_nAmmoTotal; uint32 m_nAmmoTotal;
int32 m_nTimer; uint32 m_nTimer;
bool m_bAddRotOffset; bool m_bAddRotOffset;
CWeapon() { CWeapon() {

View File

@ -61,7 +61,7 @@ CWeaponInfo::LoadWeaponData(void)
char animToPlay[32], anim2ToPlay[32]; char animToPlay[32], anim2ToPlay[32];
CAnimBlendAssociation *animAssoc; CAnimBlendAssociation *animAssoc;
AnimationId animId, anim2Id; AnimationId animId;
int bp, buflen; int bp, buflen;
int lp, linelen; int lp, linelen;
@ -101,7 +101,6 @@ CWeaponInfo::LoadWeaponData(void)
fireOffsetY = 0.0f; fireOffsetY = 0.0f;
fireOffsetZ = 0.0f; fireOffsetZ = 0.0f;
animId = ANIM_WALK; animId = ANIM_WALK;
anim2Id = ANIM_WALK;
sscanf( sscanf(
&line[lp], &line[lp],
"%s %s %f %d %d %d %d %f %f %f %f %f %f %f %s %s %f %f %f %f %d %d", "%s %s %f %d %d %d %d %f %f %f %f %f %f %f %s %s %f %f %f %f %d %d",
@ -136,9 +135,9 @@ CWeaponInfo::LoadWeaponData(void)
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay); animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay);
animId = static_cast<AnimationId>(animAssoc->animId); animId = static_cast<AnimationId>(animAssoc->animId);
if (strncmp(anim2ToPlay, "null", 5) != 0) { if (strncmp(anim2ToPlay, "null", 4) != 0) {
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay); animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay);
anim2Id = static_cast<AnimationId>(animAssoc->animId); ms_apWeaponInfos[weaponType].m_Anim2ToPlay = static_cast<AnimationId>(animAssoc->animId);
} }
CVector vecFireOffset(fireOffsetX, fireOffsetY, fireOffsetZ); CVector vecFireOffset(fireOffsetX, fireOffsetY, fireOffsetZ);
@ -155,7 +154,6 @@ CWeaponInfo::LoadWeaponData(void)
ms_apWeaponInfos[weaponType].m_fSpread = spread; ms_apWeaponInfos[weaponType].m_fSpread = spread;
ms_apWeaponInfos[weaponType].m_vecFireOffset = vecFireOffset; ms_apWeaponInfos[weaponType].m_vecFireOffset = vecFireOffset;
ms_apWeaponInfos[weaponType].m_AnimToPlay = animId; ms_apWeaponInfos[weaponType].m_AnimToPlay = animId;
ms_apWeaponInfos[weaponType].m_Anim2ToPlay = anim2Id;
ms_apWeaponInfos[weaponType].m_fAnimLoopStart = animLoopStart * 0.03f; ms_apWeaponInfos[weaponType].m_fAnimLoopStart = animLoopStart * 0.03f;
ms_apWeaponInfos[weaponType].m_fAnimLoopEnd = animLoopEnd * 0.03f; ms_apWeaponInfos[weaponType].m_fAnimLoopEnd = animLoopEnd * 0.03f;
ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire * 0.03f; ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire * 0.03f;