summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-02 07:43:00 +0200
committerGitHub <noreply@github.com>2019-07-02 07:43:00 +0200
commitb2d1433392483c3e1faafcf5127885cb425527e0 (patch)
tree477b9853bea245d9cbdaa8700e02ff980abe79d5 /src
parentMerge pull request #85 from erorcun/erorcun (diff)
parentKangaroo cheat and bug fixes (diff)
downloadre3-b2d1433392483c3e1faafcf5127885cb425527e0.tar
re3-b2d1433392483c3e1faafcf5127885cb425527e0.tar.gz
re3-b2d1433392483c3e1faafcf5127885cb425527e0.tar.bz2
re3-b2d1433392483c3e1faafcf5127885cb425527e0.tar.lz
re3-b2d1433392483c3e1faafcf5127885cb425527e0.tar.xz
re3-b2d1433392483c3e1faafcf5127885cb425527e0.tar.zst
re3-b2d1433392483c3e1faafcf5127885cb425527e0.zip
Diffstat (limited to 'src')
-rw-r--r--src/Pad.cpp30
-rw-r--r--src/config.h2
-rw-r--r--src/entities/Ped.cpp39
-rw-r--r--src/entities/Ped.h6
-rw-r--r--src/entities/PedIK.cpp8
-rw-r--r--src/render/Hud.cpp12
-rw-r--r--src/weapons/Weapon.h2
-rw-r--r--src/weapons/WeaponInfo.cpp8
8 files changed, 70 insertions, 37 deletions
diff --git a/src/Pad.cpp b/src/Pad.cpp
index 13b9b589..002e7180 100644
--- a/src/Pad.cpp
+++ b/src/Pad.cpp
@@ -14,6 +14,7 @@
#include "Game.h"
#include "CutsceneMgr.h"
#include "Font.h"
+#include "Hud.h"
#include "Text.h"
#include "Timer.h"
#include "World.h"
@@ -24,7 +25,6 @@
#include "Weather.h"
#include "win.h"
-
CPad *Pads = (CPad*)0x6F0360; // [2]
CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
@@ -70,6 +70,28 @@ WRAPPER void StrongGripCheat() { EAXJMP(0x491670); }
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
CControllerState::Clear(void)
{
@@ -509,6 +531,12 @@ void CPad::AddToPCCheatString(char c)
// "NASTYLIMBSCHEAT"
if ( !_CHEATCMP("TAEHCSBMILYTSAN") )
NastyLimbsCheat();
+
+#ifdef KANGAROO_CHEAT
+ // "KANGAROO"
+ if (!_CHEATCMP("OORAGNAK"))
+ KangarooCheat();
+#endif
#undef _CHEATCMP
}
diff --git a/src/config.h b/src/config.h
index 61b4f9b6..b43a3a9f 100644
--- a/src/config.h
+++ b/src/config.h
@@ -78,4 +78,4 @@ enum Config {
//#define USE_MY_DOCUMENTS
#define NASTY_GAME
#define PS2_MATFX
-
+#define KANGAROO_CHEAT
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index 963454b8..e908f14c 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -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)
{
+ CWeapon &weapon = GetWeapon(weaponType);
+
if (HasWeapon(weaponType)) {
- if (ammo > 99999)
- m_weapons[weaponType].m_nAmmoTotal = 99999;
+ if (weapon.m_nAmmoTotal + ammo > 99999)
+ weapon.m_nAmmoTotal = 99999;
else
- m_weapons[weaponType].m_nAmmoTotal = ammo;
+ weapon.m_nAmmoTotal += ammo;
- m_weapons[weaponType].Reload();
+ 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;
diff --git a/src/entities/Ped.h b/src/entities/Ped.h
index 572ed17d..92fa32c1 100644
--- a/src/entities/Ped.h
+++ b/src/entities/Ped.h
@@ -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; }
diff --git a/src/entities/PedIK.cpp b/src/entities/PedIK.cpp
index 9d688ff9..fa773bbf 100644
--- a/src/entities/PedIK.cpp
+++ b/src/entities/PedIK.cpp
@@ -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;
}
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 83e62ba0..2547ab2b 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -300,10 +300,10 @@ void CHud::Draw()
/*
DrawAmmo
*/
- int16 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;
- int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
- int32 Ammo, Clip;
+ uint32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
+ uint32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
+ uint32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
+ uint32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo);
@@ -1359,7 +1359,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
for (int i = 0; i < 256; i++) {
- m_LastHelpMessage[i] = message[i];
+ m_LastHelpMessage[i] = 0;
}
m_HelpMessageState = 0;
@@ -1443,7 +1443,7 @@ STARTPATCHES
InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP);
InjectHook(0x504CC0, &CHud::ReInitialise, 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(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP);
InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP);
diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h
index 055e2ff3..8cb435ce 100644
--- a/src/weapons/Weapon.h
+++ b/src/weapons/Weapon.h
@@ -47,7 +47,7 @@ public:
eWeaponState m_eWeaponState;
uint32 m_nAmmoInClip;
uint32 m_nAmmoTotal;
- int32 m_nTimer;
+ uint32 m_nTimer;
bool m_bAddRotOffset;
CWeapon() {
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index 46ecfb54..4830c86a 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -61,7 +61,7 @@ CWeaponInfo::LoadWeaponData(void)
char animToPlay[32], anim2ToPlay[32];
CAnimBlendAssociation *animAssoc;
- AnimationId animId, anim2Id;
+ AnimationId animId;
int bp, buflen;
int lp, linelen;
@@ -101,7 +101,6 @@ CWeaponInfo::LoadWeaponData(void)
fireOffsetY = 0.0f;
fireOffsetZ = 0.0f;
animId = ANIM_WALK;
- anim2Id = ANIM_WALK;
sscanf(
&line[lp],
"%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);
animId = static_cast<AnimationId>(animAssoc->animId);
- if (strncmp(anim2ToPlay, "null", 5) != 0) {
+ if (strncmp(anim2ToPlay, "null", 4) != 0) {
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);
@@ -155,7 +154,6 @@ CWeaponInfo::LoadWeaponData(void)
ms_apWeaponInfos[weaponType].m_fSpread = spread;
ms_apWeaponInfos[weaponType].m_vecFireOffset = vecFireOffset;
ms_apWeaponInfos[weaponType].m_AnimToPlay = animId;
- ms_apWeaponInfos[weaponType].m_Anim2ToPlay = anim2Id;
ms_apWeaponInfos[weaponType].m_fAnimLoopStart = animLoopStart * 0.03f;
ms_apWeaponInfos[weaponType].m_fAnimLoopEnd = animLoopEnd * 0.03f;
ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire * 0.03f;