From e3f91995ede8c1dac5bc339dcf71fd8f9927839e Mon Sep 17 00:00:00 2001
From: ermaccer <40604575+ermaccer@users.noreply.github.com>
Date: Thu, 8 Sep 2022 20:04:44 +0200
Subject: [PATCH] modloader updates, fun stuff and weapon adjuster things
---
README.md | 3 +-
source/PluginMH.vcxproj | 16 ++
source/PluginMH.vcxproj.filters | 48 +++++
source/code/RenderWare.cpp | 12 ++
source/code/RenderWare.h | 4 +-
source/code/core/eSettingsManager.cpp | 10 +
source/code/core/eSettingsManager.h | 1 -
source/code/manhunt/AI.cpp | 22 +-
source/code/manhunt/AI.h | 16 +-
source/code/manhunt/AmmoWeapon.cpp | 5 +
source/code/manhunt/AmmoWeapon.h | 1 +
source/code/manhunt/AudioManager.cpp | 25 +++
source/code/manhunt/AudioManager.h | 20 ++
source/code/manhunt/ClumpDict.cpp | 5 +
source/code/manhunt/ClumpDict.h | 4 +-
source/code/manhunt/ColLine.cpp | 12 ++
source/code/manhunt/ColLine.h | 17 ++
source/code/manhunt/Collectable.h | 71 ++++++-
source/code/manhunt/ContactInfo.h | 23 ++
source/code/manhunt/Decal.cpp | 7 +
source/code/manhunt/Decal.h | 50 +++++
source/code/manhunt/Frontend.cpp | 30 +++
source/code/manhunt/Frontend.h | 8 +
source/code/manhunt/Graph.cpp | 8 +
source/code/manhunt/Graph.h | 24 ++-
source/code/manhunt/Ped.cpp | 10 +
source/code/manhunt/Ped.h | 5 +-
source/code/manhunt/Script.cpp | 10 +
source/code/manhunt/Script.h | 8 +-
source/code/manhunt/String.cpp | 5 +
source/code/manhunt/String.h | 2 +
source/code/manhunt/TexDictionary.cpp | 7 +
source/code/manhunt/TexDictionary.h | 7 +
source/code/manhunt/TextOverlay.cpp | 17 ++
source/code/manhunt/TextOverlay.h | 16 ++
source/code/manhunt/TypeData.h | 108 ++++++++++
source/code/manhunt/Vector.cpp | 5 +
source/code/plugin/MHcommon.cpp | 38 +++-
source/code/plugin/MHcommon.h | 4 +-
source/code/plugin/classes/eCustomPed.cpp | 21 +-
source/code/plugin/classes/eCustomPed.h | 2 +
source/code/plugin/console/eConsole.cpp | 153 +++++++++++++-
source/code/plugin/console/eConsole.h | 4 +
source/code/plugin/eAchievements.cpp | 76 +++++++
source/code/plugin/eAchievements.h | 24 +++
source/code/plugin/eCommonHooks.cpp | 61 ++++--
source/code/plugin/eCustomAnimManager.cpp | 10 +-
source/code/plugin/eCustomTableOfContents.cpp | 4 +-
source/code/plugin/eLaserSights.cpp | 92 ++++++++
source/code/plugin/eLaserSights.h | 9 +
source/code/plugin/eLevelsLoader.cpp | 5 +
source/code/plugin/eLog.cpp | 12 ++
source/code/plugin/eLog.h | 1 +
source/code/plugin/eNewFrontend.cpp | 88 ++++----
source/code/plugin/eNewFrontend.h | 3 +-
source/code/plugin/eQoLChanges.cpp | 11 +-
source/code/plugin/menu/eMenu.cpp | 198 ++++++++++++++----
source/code/plugin/menu/eMenu.h | 24 ++-
.../plugin/modloader/eCustomClumpDict.cpp | 75 +++++--
.../code/plugin/modloader/eCustomClumpDict.h | 9 +
source/code/plugin/modloader/eModLoader.cpp | 31 +--
source/code/plugin/modloader/eModLoader.h | 6 +-
source/code/plugin/script/eScriptExtender.cpp | 24 +--
source/code/plugin/script/eScriptExtender.h | 16 +-
.../weapon_adjuster/eWeaponAdjuster.cpp | 12 +-
.../plugin/weapon_adjuster/eWeaponAdjuster.h | 6 +-
source/dllmain.cpp | 13 +-
source/resource.h | 2 +-
68 files changed, 1473 insertions(+), 203 deletions(-)
create mode 100644 source/code/manhunt/AudioManager.cpp
create mode 100644 source/code/manhunt/AudioManager.h
create mode 100644 source/code/manhunt/ColLine.cpp
create mode 100644 source/code/manhunt/ColLine.h
create mode 100644 source/code/manhunt/ContactInfo.h
create mode 100644 source/code/manhunt/Decal.cpp
create mode 100644 source/code/manhunt/Decal.h
create mode 100644 source/code/manhunt/TexDictionary.cpp
create mode 100644 source/code/manhunt/TexDictionary.h
create mode 100644 source/code/manhunt/TextOverlay.cpp
create mode 100644 source/code/manhunt/TextOverlay.h
create mode 100644 source/code/manhunt/Vector.cpp
create mode 100644 source/code/plugin/eAchievements.cpp
create mode 100644 source/code/plugin/eAchievements.h
create mode 100644 source/code/plugin/eLaserSights.cpp
create mode 100644 source/code/plugin/eLaserSights.h
diff --git a/README.md b/README.md
index 34efcf2..014b47e 100644
--- a/README.md
+++ b/README.md
@@ -167,8 +167,7 @@ Currently, Manhunt version of modloader doesn't support swapping:
It depends on type, but every mod needs a folder.
Create a folder with any name inside modloader folder.
-Modloader comes with a custom DFF loader which allows to load multiple .dff files a
-nd append them to the model list.
+Modloader comes with a custom DFF loader which allows to load multiple .dff files and append them to the model list.
Some files are ignored from beign loaded, they are specified
in modloader.ini file.
diff --git a/source/PluginMH.vcxproj b/source/PluginMH.vcxproj
index 6a6cb61..556789f 100644
--- a/source/PluginMH.vcxproj
+++ b/source/PluginMH.vcxproj
@@ -106,14 +106,18 @@
+
+
+
+
@@ -138,7 +142,9 @@
+
+
@@ -148,10 +154,12 @@
+
+
@@ -180,12 +188,15 @@
+
+
+
@@ -205,18 +216,23 @@
+
+
+
+
+
diff --git a/source/PluginMH.vcxproj.filters b/source/PluginMH.vcxproj.filters
index b71edd9..22d63a5 100644
--- a/source/PluginMH.vcxproj.filters
+++ b/source/PluginMH.vcxproj.filters
@@ -261,6 +261,30 @@
Header Files\manhunt
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\plugin
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\plugin
+
@@ -449,6 +473,30 @@
Header Files\manhunt
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\plugin
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\manhunt
+
+
+ Header Files\plugin
+
diff --git a/source/code/RenderWare.cpp b/source/code/RenderWare.cpp
index a2b9564..9a15735 100644
--- a/source/code/RenderWare.cpp
+++ b/source/code/RenderWare.cpp
@@ -201,3 +201,15 @@ RwInt32 RpHAnimIDGetIndex(RpHAnimHierarchy* hierarchy, RwInt32 ID)
{
return CallAndReturn(hierarchy, ID);
}
+
+RwMatrix* RwFrameGetLTM(RwFrame* frame)
+{
+ return CallAndReturn(frame);
+}
+
+RpHAnimHierarchy* GetAnimHierarchyFromSkinClump(RpClump* clump)
+{
+ RpHAnimHierarchy result;
+ RpClumpForAllAtomics(clump, GetAnimHierarchyCallback, &result);
+ return &result;
+}
diff --git a/source/code/RenderWare.h b/source/code/RenderWare.h
index 2d709c9..7e1bc82 100644
--- a/source/code/RenderWare.h
+++ b/source/code/RenderWare.h
@@ -13,6 +13,6 @@
#define SCREEN_VIEWWINDOW (tanf(DEGTORAD(45.0f * 0.5f)))
RpClump* RpClumpRender(RpClump* clump);
+RpHAnimHierarchy* GetAnimHierarchyFromSkinClump(RpClump*);
-
-void CameraSize(RwCamera * camera, RwRect * rect, RwReal viewWindow, RwReal aspectRatio);
\ No newline at end of file
+void CameraSize(RwCamera * camera, RwRect * rect, RwReal viewWindow, RwReal aspectRatio);
diff --git a/source/code/core/eSettingsManager.cpp b/source/code/core/eSettingsManager.cpp
index 25325ec..4e6ff62 100644
--- a/source/code/core/eSettingsManager.cpp
+++ b/source/code/core/eSettingsManager.cpp
@@ -1,6 +1,7 @@
#include "eSettingsManager.h"
#include "..\..\IniReader.h"
#include "..\manhunt\core.h"
+#include "..\plugin\menu\eMenu.h"
bool eSettingsManager::bEnableLog;
bool eSettingsManager::bHideVersionInfo;
@@ -90,4 +91,13 @@ void eSettingsManager::Init()
keyToggleConsole = reader.ReadInteger("Keys", "keyToggleConsole", VK_OEM_3);
keyToggleScreenshotMode = reader.ReadInteger("Keys", "keyToggleScreenshotMode", VK_F3);
keyToggleHUD = reader.ReadInteger("Keys", "keyToggleHUD", VK_F4);
+
+
+ TheMenu.KeyEnableMenu = reader.ReadInteger("Keys.Menu", "keyMenuEnable", VK_F2);
+ TheMenu.KeyMenuExecute = reader.ReadInteger("Keys.Menu", "keyMenuExecute", VK_RETURN);
+ TheMenu.KeyMenuGoBack = reader.ReadInteger("Keys.Menu", "keyMenuBack", VK_BACK);
+ TheMenu.KeyMenuItemDOWN = reader.ReadInteger("Keys.Menu", "keyMenuDown", VK_DOWN);
+ TheMenu.KeyMenuItemUP = reader.ReadInteger("Keys.Menu", "keyMenuUp", VK_UP);
+ TheMenu.KeyMenuItemLEFT = reader.ReadInteger("Keys.Menu", "keyMenuLeft", VK_LEFT);
+ TheMenu.KeyMenuItemRIGHT = reader.ReadInteger("Keys.Menu", "keyMenuRight", VK_RIGHT);
}
diff --git a/source/code/core/eSettingsManager.h b/source/code/core/eSettingsManager.h
index 2841e05..61659b1 100644
--- a/source/code/core/eSettingsManager.h
+++ b/source/code/core/eSettingsManager.h
@@ -48,7 +48,6 @@ class eSettingsManager {
static bool bForceFXMode;
static bool bEnableFirstPersonMode;
-
// keys
static int keyToggleDebugMenu;
static int keyToggleConsole;
diff --git a/source/code/manhunt/AI.cpp b/source/code/manhunt/AI.cpp
index f710b1a..fe99d4f 100644
--- a/source/code/manhunt/AI.cpp
+++ b/source/code/manhunt/AI.cpp
@@ -29,7 +29,7 @@ int AISCRIPT_SetEntityVoiceID(char * entity, int voiceID)
return CallMethodAndReturn(0x799B50, entity, voiceID);
}
-int AIScript_BuddyFollow(char * entity)
+int AISCRIPT_BuddyFollow(char * entity)
{
return CallMethodAndReturn(0x799B50, entity);
}
@@ -54,6 +54,26 @@ int AISCRIPT_DefineGoal_BeBuddy(char * goalName, char * entityName, char * whoTo
return CallMethodAndReturn(0x799B50, goalName, entityName, whoToBeBuddyWith, home, radius);
}
+int AISCRIPT_SetSubpackCombatType(char* entityName, char* pack, int type)
+{
+ return CallMethodAndReturn(0x799B50, entityName, pack, type);
+}
+
+int AISCRIPT_AddSubpack_ForLeader(char* entity, char* subpack)
+{
+ return CallMethodAndReturn(0x799B50, entity, subpack);
+}
+
+int AISCRIPT_AddAllHuntersInPackAsLeaderEnemies(char* entity, char* leaderName)
+{
+ return CallMethodAndReturn(0x799B50, entity, leaderName);
+}
+
+int AISCRIPT_AddGoal_Subpack(char* entity, char* subpack, char* goalName)
+{
+ return CallMethodAndReturn(0x799B50, entity, subpack, goalName);
+}
+
int modAI_Audio_RegisterAISound(eAISounds sound, CEntity * entity, int unk, int unk2)
{
return CallMethodAndReturn(0x7957BC, sound, entity, unk, unk2);
diff --git a/source/code/manhunt/AI.h b/source/code/manhunt/AI.h
index d66f995..df390f1 100644
--- a/source/code/manhunt/AI.h
+++ b/source/code/manhunt/AI.h
@@ -93,17 +93,29 @@ enum eAISounds {
VOLUME_DISTANCES,
};
+
+enum eAICombatTypes {
+ COMBATTYPEID_MELEE,
+ COMBATTYPEID_OPEN,
+ COMBATTYPEID_COVER,
+ COMBATTYPEID_OPEN_MELEE,
+};
+
int AISCRIPT_EntityAlwaysEnabled(char* instance);
int AISCRIPT_AddAIEntity(char* entity);
int AISCRIPT_SetAIEntityAsLeader(char* entity);
int AISCRIPT_AddLeaderEnemy(char* entity, char* enemy);
int AISCRIPT_SetEntityVoiceID(char* entity, int voiceID);
-int AIScript_BuddyFollow(char* entity);
+int AISCRIPT_BuddyFollow(char* entity);
int AISCRIPT_CancelIdle(char* entity, int action);
int AISCRIPT_AddHunterToLeaderSubpack(char* leader, char* subpack, char* entity);
int AISCRIPT_DefineGoal_HuntEnemy(char* refName, char* who, bool unk, int unk2);
-// AIDefineGoalBeBuddy('gTrampy', 'Tramp','player', 'Timer404', 2);
int AISCRIPT_DefineGoal_BeBuddy(char* goalName, char* entityName, char* whoToBeBuddyWith, char* home, float radius);
+int AISCRIPT_SetSubpackCombatType(char* entityName, char* pack, int type);
+int AISCRIPT_AddSubpack_ForLeader(char* entity, char* subpack);
+int AISCRIPT_AddAllHuntersInPackAsLeaderEnemies(char* entity, char* leaderName);
+
+int AISCRIPT_AddGoal_Subpack(char* entity, char* subpack, char* goalName);
int modAI_Audio_RegisterAISound(eAISounds sound, CEntity* entity, int unk, int unk2);
diff --git a/source/code/manhunt/AmmoWeapon.cpp b/source/code/manhunt/AmmoWeapon.cpp
index 8d21a5c..d0f9b12 100644
--- a/source/code/manhunt/AmmoWeapon.cpp
+++ b/source/code/manhunt/AmmoWeapon.cpp
@@ -15,6 +15,11 @@ void CAmmoWeapon::GetFiringDirection(CVector * dest, float unk, int unk2, int un
CallMethod<0x4F92F0, CAmmoWeapon*, CVector*, float, int, int>(this, dest, unk, unk2, unk3);
}
+void CAmmoWeapon::GetFiringPoint(CVector* dest, int unk)
+{
+ CallMethod<0x4F90C0, CAmmoWeapon*, CVector*, int>(this, dest, unk);
+}
+
void CAmmoWeapon::UpdateFiringDirection(float unk)
{
CallMethod<0x4F96C0, CAmmoWeapon*, float>(this, unk);
diff --git a/source/code/manhunt/AmmoWeapon.h b/source/code/manhunt/AmmoWeapon.h
index 6c4e969..1748301 100644
--- a/source/code/manhunt/AmmoWeapon.h
+++ b/source/code/manhunt/AmmoWeapon.h
@@ -260,6 +260,7 @@ class CAmmoWeapon {
void Reload(int flag);
void SetAmmo(unsigned int amount);
void GetFiringDirection(CVector* dest, float unk, int unk2, int unk3);
+ void GetFiringPoint(CVector* dest, int unk);
void UpdateFiringDirection(float unk);
static bool& ms_bHeadShot;
diff --git a/source/code/manhunt/AudioManager.cpp b/source/code/manhunt/AudioManager.cpp
new file mode 100644
index 0000000..fb7d70b
--- /dev/null
+++ b/source/code/manhunt/AudioManager.cpp
@@ -0,0 +1,25 @@
+#include "AudioManager.h"
+#include "core.h"
+
+cAudioManager& AudioManager = *(cAudioManager*)0x6B53D8;
+cDMAudio& DMAudio = *(cDMAudio*)0x6C5244;
+
+void cAudioManager::ResetLevel()
+{
+ CallMethod<0x455C70, cAudioManager*>(this);
+}
+
+void cAudioManager::RequestMiscOneShot(CVector* pos, eSampleIDs sample, int unk, int unk2)
+{
+ CallMethod<0x5B5810, cAudioManager*, CVector*, eSampleIDs, int, int>(this, pos, sample, unk, unk2);
+}
+
+int cAudioManager::ProcessWeapon_Fire(eCollectableType item, int a2, int a3, float* freq, float* a5)
+{
+ return CallMethodAndReturn(this, item, a2, a3, freq, a5);
+}
+
+void cDMAudio::PlayFrontEndSound(short sample, float unk)
+{
+ CallMethod<0x456280,cDMAudio*, short, float>(this, sample, unk);
+}
diff --git a/source/code/manhunt/AudioManager.h b/source/code/manhunt/AudioManager.h
new file mode 100644
index 0000000..1901614
--- /dev/null
+++ b/source/code/manhunt/AudioManager.h
@@ -0,0 +1,20 @@
+#pragma once
+#include "Collectable.h"
+#include "SampleIDs.h"
+
+class cAudioManager {
+public:
+ void ResetLevel();
+ void RequestMiscOneShot(CVector* pos, eSampleIDs sample, int unk, int unk2);
+ int ProcessWeapon_Fire(eCollectableType item, int a2, int a3, float* freq, float* a5);
+};
+
+
+class cDMAudio {
+public:
+ void PlayFrontEndSound(short sample, float unk);
+};
+
+extern cAudioManager& AudioManager;
+
+extern cDMAudio& DMAudio;
\ No newline at end of file
diff --git a/source/code/manhunt/ClumpDict.cpp b/source/code/manhunt/ClumpDict.cpp
index 1c812be..3784d30 100644
--- a/source/code/manhunt/ClumpDict.cpp
+++ b/source/code/manhunt/ClumpDict.cpp
@@ -16,6 +16,11 @@ int CClumpDict::CheckDict()
return CallMethodAndReturn(this);
}
+int CClumpDict::sub_59B860(const char* name)
+{
+ return CallMethodAndReturn(this, name);
+}
+
CClump * CClumpDict::FindClumpDescription(const char * name)
{
return CallMethodAndReturn(this, name);
diff --git a/source/code/manhunt/ClumpDict.h b/source/code/manhunt/ClumpDict.h
index a252b11..4278e02 100644
--- a/source/code/manhunt/ClumpDict.h
+++ b/source/code/manhunt/ClumpDict.h
@@ -3,7 +3,7 @@
class CClumpDict {
private:
- char data[0x288];
+ char data[1024];
public:
void Initialise(const char* texture, const char* name);
@@ -13,4 +13,6 @@ class CClumpDict {
int CheckDict();
+ int sub_59B860(const char* name);
+
};
\ No newline at end of file
diff --git a/source/code/manhunt/ColLine.cpp b/source/code/manhunt/ColLine.cpp
new file mode 100644
index 0000000..b30d856
--- /dev/null
+++ b/source/code/manhunt/ColLine.cpp
@@ -0,0 +1,12 @@
+#include "ColLine.h"
+#include "core.h"
+
+void CColLine::Calculate()
+{
+ CallMethod<0x4044F0, CColLine*>(this);
+}
+
+bool CColLine::TestBSP(CContactInfo* contact, float* unk)
+{
+ return CallMethodAndReturn(this, contact, unk);
+}
\ No newline at end of file
diff --git a/source/code/manhunt/ColLine.h b/source/code/manhunt/ColLine.h
new file mode 100644
index 0000000..9924c09
--- /dev/null
+++ b/source/code/manhunt/ColLine.h
@@ -0,0 +1,17 @@
+#pragma once
+#include "Vector.h"
+#include "ContactInfo.h"
+
+class CColLine {
+public:
+ CVector vstart;
+ CVector vend;
+ CVector vdist;
+ CVector vdistnorm;
+ int fdist;
+ float fdistsqr;
+
+
+ void Calculate();
+ bool TestBSP(CContactInfo* contact, float* unk);
+};
\ No newline at end of file
diff --git a/source/code/manhunt/Collectable.h b/source/code/manhunt/Collectable.h
index e930b43..c7b8f32 100644
--- a/source/code/manhunt/Collectable.h
+++ b/source/code/manhunt/Collectable.h
@@ -92,7 +92,8 @@ enum eCollectableType {
CT_WIRE,
CT_CAN,
CT_WOODEN_SPIKE,
- CT_PIGSY_SHARD = 94,
+ CT_SNIPER_RIFLE_SILENCED,
+ CT_PIGSY_SHARD,
CT_PIGSY_WIRE,
CT_PIGSY_SPIKE,
CT_HAMMER,
@@ -172,7 +173,73 @@ class CCollectable: public CEntity {
};
class CWeaponCollectable : public CCollectable {
-public:
+public:int field_1A8;
+ int* m_pWeapon;
+ char field_1B0;
+ char field_1B1;
+ char field_1B2;
+ char field_1B3;
+ char field_1B4;
+ char field_1B5;
+ char field_1B6;
+ char field_1B7;
+ char field_1B8;
+ char field_1B9;
+ char field_1BA;
+ char field_1BB;
+ char field_1BC;
+ char field_1BD;
+ char field_1BE;
+ char field_1BF;
+ int field_1C0;
+ char field_1C4;
+ char field_1C5;
+ char field_1C6;
+ char field_1C7;
+ int field_1C8;
+ char gap1CC[8];
+ int m_pLaserBone;
+ char field_1D8;
+ char field_1D9;
+ char field_1DA;
+ char field_1DB;
+ char field_1DC;
+ char field_1DD;
+ char field_1DE;
+ char field_1DF;
+ char field_1E0;
+ char field_1E1;
+ char field_1E2;
+ char field_1E3;
+ char field_1E4;
+ char field_1E5;
+ char field_1E6;
+ char field_1E7;
+ char field_1E8;
+ char field_1E9;
+ char field_1EA;
+ char field_1EB;
+ char field_1EC;
+ char field_1ED;
+ char field_1EE;
+ char field_1EF;
+ char field_1F0;
+ char field_1F1;
+ char field_1F2;
+ char field_1F3;
+ char field_1F4;
+ char field_1F5;
+ char field_1F6;
+ char field_1F7;
+ char field_1F8;
+ char field_1F9;
+ char field_1FA;
+ char field_1FB;
+ char field_1FC;
+ char field_1FD;
+ char field_1FE;
+ char field_1FF;
+
eExecuteAnimClass GetExecuteAnimClass();
void Spawn(RwMatrix* mat);
void Drop();
diff --git a/source/code/manhunt/ContactInfo.h b/source/code/manhunt/ContactInfo.h
new file mode 100644
index 0000000..5d0da25
--- /dev/null
+++ b/source/code/manhunt/ContactInfo.h
@@ -0,0 +1,23 @@
+#pragma once
+#include "Vector.h"
+
+class CContactInfo {
+public:
+ CVector m_vContactPosition;
+ int field_C;
+ int field_10;
+ int field_14;
+ int field_18;
+ int field_1C;
+ int field_20;
+ int field_24;
+ int field_28;
+ int field_2C;
+ int field_30;
+ int field_34;
+ char field_38;
+ char field_39;
+ char field_3A;
+ char field_3B;
+ int field_3C;
+};
\ No newline at end of file
diff --git a/source/code/manhunt/Decal.cpp b/source/code/manhunt/Decal.cpp
new file mode 100644
index 0000000..d254f03
--- /dev/null
+++ b/source/code/manhunt/Decal.cpp
@@ -0,0 +1,7 @@
+#include "Decal.h"
+#include "core.h"
+
+int CDecal::DecalSet(CVector* pos, CVector* a2, int a3, float size1, float size2, float a6, float a7, int a8, int a9, int a10, int a11, float a12, eDecalTypes decal)
+{
+ return CallAndReturn(pos, a2, a3, size1, size2, a6, a7, a8, a9, a10, a11, a12, decal);
+}
\ No newline at end of file
diff --git a/source/code/manhunt/Decal.h b/source/code/manhunt/Decal.h
new file mode 100644
index 0000000..afdf5e8
--- /dev/null
+++ b/source/code/manhunt/Decal.h
@@ -0,0 +1,50 @@
+#pragma once
+#include "Vector.h"
+
+enum eDecalTypes {
+ DT_TEST,
+ DT_BLOOD,
+ DT_BLOOD2,
+ DT_BLOOD3,
+ DT_BLOOD_DEAD,
+ DT_MELEE,
+ DT_EXPLOSION,
+ DT_FLUID,
+ DT_TEST_2,
+ DT_METAL,
+ DT_STONE,
+ DT_WOOD,
+ DT_METAL_2,
+ DT_STONE_2,
+ DT_METAL_3,
+ DT_GLASS,
+ DT_STONE_3,
+ DT_METAL_4,
+ DT_WOOD_2,
+ DT_FABRIC,
+ DT_STONE_4,
+ DT_FABRIC_2,
+ DT_FABRIC_3,
+ DT_FABRIC_4,
+ DT_FABRIC_5,
+ DT_TOTAL_DECALS,
+};
+
+struct CDecalEntry {
+ eDecalTypes m_nDecalID;
+ int m_bIsVisible;
+ int m_nAlpha;
+ int field_C;
+ int m_pPointer;
+ int field_14;
+ int field_18;
+ int field_1C;
+ int field_20;
+ int field_24;
+};
+
+class CDecal {
+public:
+
+ static int DecalSet(CVector* pos, CVector* a2 /* rot?*/, int a3, float size1, float size2, float a6, float a7, int r, int g, int b, int a, float a12, eDecalTypes decal);
+};
\ No newline at end of file
diff --git a/source/code/manhunt/Frontend.cpp b/source/code/manhunt/Frontend.cpp
index 91cbd5d..6db1627 100644
--- a/source/code/manhunt/Frontend.cpp
+++ b/source/code/manhunt/Frontend.cpp
@@ -85,6 +85,16 @@ void CFrontend::PrintInfo(wchar_t * button1, wchar_t * button2, wchar_t * button
Call<0x5D5BB0, wchar_t*, wchar_t*, wchar_t*, wchar_t*>(button1, button2, button3, button4);
}
+int CFrontend::GetInfoBarInput3()
+{
+ return *(int*)0x7C8F9C;
+}
+
+int CFrontend::GetInfoBarInput4()
+{
+ return *(int*)0x7C8FA0;
+}
+
void CFrontend::PrintDebugInfo(int lineID, char * format, ...)
{
((void(__cdecl*)(int,char*,...))0x5E5480)(lineID, format);
@@ -110,6 +120,11 @@ float CFrontend::CalculateTextLen(wchar_t * text, float charScale, int byteLen)
return CallAndReturn(text, charScale, byteLen);
}
+float CFrontend::CalculateTextLen8(char* text, float charScale, int byteLen)
+{
+ return CallAndReturn(text, charScale, byteLen);
+}
+
void CFrontend::DrawDisc2D(CVector* pos, float scale, int red, int green, int blue, float a6)
{
Call<0x5FB6D0, CVector*, float, int, int, int, float>(pos, scale, red, green, blue, a6);
@@ -129,3 +144,18 @@ RwCamera * CFrontend::GetFrontendCamera()
{
return *(RwCamera**)0x7CF078;
}
+
+RwCamera* CFrontend::GetSceneCamera()
+{
+ return *(RwCamera**)0x715B94;
+}
+
+float CFrontend::GetAspectRatio()
+{
+ return (float)(*(int*)0x829584 / *(int*)0x829588);
+}
+
+void CFrontend::LaserDraw(CVector* start, CVector* end)
+{
+ Call<0x5FA7D0, CVector*, CVector*>(start, end);
+}
diff --git a/source/code/manhunt/Frontend.h b/source/code/manhunt/Frontend.h
index 140ac8b..b202699 100644
--- a/source/code/manhunt/Frontend.h
+++ b/source/code/manhunt/Frontend.h
@@ -126,6 +126,8 @@ class CFrontend {
static void Print8(const char* text, float x, float y, float sizex, float sizey, float unk, eFontType font);
static void SetMenuBackground(char* file);
static void PrintInfo(wchar_t* button1, wchar_t* button2, wchar_t* button3, wchar_t* button4);
+ static int GetInfoBarInput3();
+ static int GetInfoBarInput4();
static void PrintDebugInfo(int lineID, char* format, ...);
static int GetTextureFromTXD(int txd, const char* texture);
@@ -133,6 +135,7 @@ class CFrontend {
static void ForceAndPlayLevel(int levelID, int unk);
static float CalculateTextLen(wchar_t* text, float charScale, int byteLen);
+ static float CalculateTextLen8(char* text, float charScale, int byteLen);
static void DrawDisc2D(CVector* pos, float scale, int red, int green, int blue, float a6);
static void DrawDisc3D(CVector* pos, float scale, int red, int green, int blue, float a6);
@@ -140,4 +143,9 @@ class CFrontend {
static void Set_Difficulty(int difficulty);
static RwCamera* GetFrontendCamera();
+ static RwCamera* GetSceneCamera();
+
+ static float GetAspectRatio();
+
+ static void LaserDraw(CVector* start, CVector* end);
};
\ No newline at end of file
diff --git a/source/code/manhunt/Graph.cpp b/source/code/manhunt/Graph.cpp
index e2b5aae..d8caf8a 100644
--- a/source/code/manhunt/Graph.cpp
+++ b/source/code/manhunt/Graph.cpp
@@ -1,7 +1,15 @@
#include "Graph.h"
#include "core.h"
+CGraphManager& TheGraph = *(CGraphManager*)0x682848;
+
+
bool CGraph::CheckForLineOfSightObstruction(CVector * a, CVector * b)
{
return CallAndReturn(a, b);
}
+
+CGraphEntry* GetGraphEntry(int id)
+{
+ return &TheGraph.nodes[id];
+}
diff --git a/source/code/manhunt/Graph.h b/source/code/manhunt/Graph.h
index e7caf26..43f1fd2 100644
--- a/source/code/manhunt/Graph.h
+++ b/source/code/manhunt/Graph.h
@@ -1,7 +1,29 @@
#pragma once
#include "Vector.h"
+struct CGraphNode {
+ char pad[32];
+ char name[16];
+};
+
+struct CGraphEntry {
+ int unk;
+ CGraphNode* node;
+};
+
+
+struct CGraphManager {
+ char pad[12];
+ CGraphEntry* nodes;
+};
+
+
class CGraph {
public:
static bool CheckForLineOfSightObstruction(CVector* a, CVector* b);
-};
\ No newline at end of file
+};
+
+
+CGraphEntry* GetGraphEntry(int id);
+
+extern CGraphManager& TheGraph;
\ No newline at end of file
diff --git a/source/code/manhunt/Ped.cpp b/source/code/manhunt/Ped.cpp
index c053ad9..7d21dc6 100644
--- a/source/code/manhunt/Ped.cpp
+++ b/source/code/manhunt/Ped.cpp
@@ -26,6 +26,16 @@ void CPed::SelectInventoryItem(eHolsterSlot slot, int unk)
CallMethod<0x4ABE70, CPed*, eHolsterSlot, int>(this,slot, unk);
}
+void CPed::PreUpdate()
+{
+ CallMethod<0x4A7550, CPed*>(this);
+}
+
+void CPed::PostUpdate()
+{
+ CallMethod<0x4A7730, CPed*>(this);
+}
+
void CPed::UseCollectable(eCollectableType item, bool createIfDoesntExist)
{
CallMethod<0x4ABB50, CPed*, eCollectableType, bool>(this, item, createIfDoesntExist);
diff --git a/source/code/manhunt/Ped.h b/source/code/manhunt/Ped.h
index 900b243..72ac8cd 100644
--- a/source/code/manhunt/Ped.h
+++ b/source/code/manhunt/Ped.h
@@ -374,7 +374,7 @@ class CPed : public CCharacter {
int field_1A0;
int field_1A4;
int field_1A8;
- int field_1AC;
+ float m_fAngle;
int field_1B0;
float field_1B4;
int field_1B8;
@@ -1089,6 +1089,9 @@ class CPed : public CCharacter {
void SetHeading(float heading, bool unk);
void SelectInventoryItem(eHolsterSlot slot, int unk);
+ void PreUpdate();
+ void PostUpdate();
+
void UseCollectable(eCollectableType item, bool createIfDoesntExist);
RwFrame* GetBoneFrame(int id);
diff --git a/source/code/manhunt/Script.cpp b/source/code/manhunt/Script.cpp
index 862aa5c..270c760 100644
--- a/source/code/manhunt/Script.cpp
+++ b/source/code/manhunt/Script.cpp
@@ -20,3 +20,13 @@ CEntity* CScriptVM::PopEntity()
{
return CallMethodAndReturn(this);
}
+
+void ScriptCommands::SetCameraPosition(CVector* pos)
+{
+ Call<0x5432A0, CVector*>(pos);
+}
+
+void ScriptCommands::SetAllVideoEffects(bool status)
+{
+ Call<0x58DB90, bool>(status);
+}
diff --git a/source/code/manhunt/Script.h b/source/code/manhunt/Script.h
index fc06a4c..d61be76 100644
--- a/source/code/manhunt/Script.h
+++ b/source/code/manhunt/Script.h
@@ -21,4 +21,10 @@ class CScriptVM {
char* PopCharStar();
CEntity* PopEntity();
-};
\ No newline at end of file
+};
+
+
+namespace ScriptCommands {
+ void SetCameraPosition(CVector* pos);
+ void SetAllVideoEffects(bool status);
+}
\ No newline at end of file
diff --git a/source/code/manhunt/String.cpp b/source/code/manhunt/String.cpp
index 41b2415..978f05e 100644
--- a/source/code/manhunt/String.cpp
+++ b/source/code/manhunt/String.cpp
@@ -22,3 +22,8 @@ void CString::__as(CString * src, CString * dest)
{
Call<0x4F2A90, CString*, CString*>(src, dest);
}
+
+bool CString::Identical(const char* text)
+{
+ return CallMethodAndReturn(this, text);
+}
diff --git a/source/code/manhunt/String.h b/source/code/manhunt/String.h
index ae32457..f13b02b 100644
--- a/source/code/manhunt/String.h
+++ b/source/code/manhunt/String.h
@@ -11,4 +11,6 @@ struct CString
~CString();
void __as(CString* src, CString* dest);
+
+ bool Identical(const char* text);
};
diff --git a/source/code/manhunt/TexDictionary.cpp b/source/code/manhunt/TexDictionary.cpp
new file mode 100644
index 0000000..c6c09b0
--- /dev/null
+++ b/source/code/manhunt/TexDictionary.cpp
@@ -0,0 +1,7 @@
+#include "TexDictionary.h"
+#include "core.h"
+
+int CTexDictionary::FindNamedTexture(CClumpDict* dict, const char* name)
+{
+ return CallAndReturn(dict, name);
+}
\ No newline at end of file
diff --git a/source/code/manhunt/TexDictionary.h b/source/code/manhunt/TexDictionary.h
new file mode 100644
index 0000000..0c59dae
--- /dev/null
+++ b/source/code/manhunt/TexDictionary.h
@@ -0,0 +1,7 @@
+#pragma once
+#include "ClumpDict.h"
+
+class CTexDictionary {
+public:
+ static int FindNamedTexture(CClumpDict* dict, const char* name);
+};
\ No newline at end of file
diff --git a/source/code/manhunt/TextOverlay.cpp b/source/code/manhunt/TextOverlay.cpp
new file mode 100644
index 0000000..28ba28c
--- /dev/null
+++ b/source/code/manhunt/TextOverlay.cpp
@@ -0,0 +1,17 @@
+#include "TextOverlay.h"
+#include "core.h"
+
+CTextOverlay& COverlayMgr::m_textOverlay = *(CTextOverlay*)0x71D2D4;
+CTextOverlay& COverlayMgr::m_textPickUpOverlay = *(CTextOverlay*)0x71ECBC;
+CTextOverlay& COverlayMgr::m_textProducerOverlay = *(CTextOverlay*)0x7206A4;
+CTextOverlay& COverlayMgr::m_textPeripheralOverlay = *(CTextOverlay*)0x72208C;
+
+void CTextOverlay::DisplayText16(wchar_t* text, int unk)
+{
+ CallMethod<0x48AD90, CTextOverlay*, wchar_t*, int>(this, text, unk);
+}
+
+void CTextOverlay::SetCurrentTextDisplaying(bool display)
+{
+ CallMethod<0x48B350, CTextOverlay*, bool>(this, display);
+}
diff --git a/source/code/manhunt/TextOverlay.h b/source/code/manhunt/TextOverlay.h
new file mode 100644
index 0000000..e3bc1f3
--- /dev/null
+++ b/source/code/manhunt/TextOverlay.h
@@ -0,0 +1,16 @@
+#pragma once
+
+class CTextOverlay {
+public:
+ void DisplayText16(wchar_t* text, int unk);
+ void SetCurrentTextDisplaying(bool display);
+};
+
+
+class COverlayMgr {
+public:
+ static CTextOverlay& m_textOverlay;
+ static CTextOverlay& m_textPickUpOverlay;
+ static CTextOverlay& m_textProducerOverlay;
+ static CTextOverlay& m_textPeripheralOverlay;
+};
\ No newline at end of file
diff --git a/source/code/manhunt/TypeData.h b/source/code/manhunt/TypeData.h
index fce658e..f5a0fed 100644
--- a/source/code/manhunt/TypeData.h
+++ b/source/code/manhunt/TypeData.h
@@ -193,6 +193,114 @@ class CCharacterTypeData : public CTypeData
eCharacterVoiceType m_nVoice;
};
+class CPedTypeData : public CCharacterTypeData
+{
+public:
+ CString m_strLowLodModel;
+ CString m_strHead;
+ int m_nHeadSelection;
+ float m_fKnockoutTime;
+ float m_fStunTime;
+ float m_fSneakWalkSpeed;
+ float m_fSneakRunSpeed;
+ float m_fWalkSpeed;
+ float m_fRunSpeed;
+ float m_fSprintSpeed;
+ float m_fRunTime;
+ float m_fMaxLegDamage;
+ float m_fMaxArmDamage;
+ float m_fBlockDamage;
+ float m_fWalkCycleRightFoot;
+ float m_fWalkCycleLeftFoot;
+ float field_144;
+ char field_148;
+ char field_149;
+ char field_14A;
+ char field_14B;
+ char field_14C;
+ char field_14D;
+ char field_14E;
+ char field_14F;
+ char field_150;
+ char field_151;
+ char field_152;
+ char field_153;
+ char field_154;
+ char field_155;
+ char field_156;
+ char field_157;
+ char field_158;
+ char field_159;
+ char field_15A;
+ char field_15B;
+ int m_nNumSkins;
+};
+
+class CPlayerTypeData : public CPedTypeData
+{
+public:
+ CVector m_vCamPosition;
+ float m_fKORecoverySpeed;
+ float m_fMoveThresholds[2];
+ float m_fMoveTransSpeed;
+ float m_fAcceleration[2];
+ float m_fStickDeadZone;
+ float m_fCrouchForwardSpeed;
+ float m_fCrouchBackwardSpeed;
+ float m_fCrouchSidewaysSpeed;
+ float m_fAimZones[10];
+ float m_fAimZonesMonkey[10];
+ float m_fAimAxisWidth;
+ float m_fMoveAxisWidth;
+ float m_fVerticalAimLimit;
+ float m_fTurnPause;
+ float m_fTurnAcceleration;
+ float m_fExtraTurnSpeed;
+ float m_fTurnPauseMonkey;
+ float m_fTurnAccelerationMonkey;
+ float m_fExtraTurnSpeedMonkey;
+ float m_fMaxQuickTurnSpeed;
+ float m_fStandTurnScaleMonkey;
+ float m_fWalkTurnScaleMonkey;
+ float m_fRunTurnScaleMonkey;
+ float m_fSprintTurnScaleMonkey;
+ float m_fLadderUseTime;
+ float m_fCamRecentreSpeed;
+ float m_fCamStairSpeed;
+ float m_fZoomAimScale;
+ float m_fZoomAimScaleMoving;
+ float m_fZoomLevels[2];
+ float m_fZoomSpeed;
+ float m_fZoomMoveScales[2];
+ float m_fZoomMaxZones[2];
+ float m_fCrosshairSizes[3];
+ float m_fThrowChargeTime;
+ float m_fMinReleaseTime;
+ CVector m_fMinThrowVelocity;
+ CVector m_fMaxThrowVelocity;
+ float m_fSkidTimer;
+ float m_fCrouchRecoil;
+ float m_fMonkeyTurnAngle;
+ float m_fMonkeyMoveAngle;
+ float m_fMonkeyWalkAngle;
+ float m_fRunThreshold;
+ int m_dwInvertStick;
+ float m_fAimLockOnAngles[2];
+ float m_fAimLockOnDist;
+ char field_2A0;
+ char field_2A1;
+ char field_2A2;
+ char field_2A3;
+ float m_fStaminaTotalSprintTime;
+ float m_fStaminaNoSprintTime;
+ float m_fStaminaRecoveryRunning;
+ float m_fStaminaRecoveryMoving;
+ float m_fStaminaRecoveryStill;
+ float m_fStaminaRecoveryPause;
+ float m_fWiggleTimeDecay;
+ float m_fExecuteStageTimes[2];
+};
+
struct CCollectableTypeData : public CTypeData
{
diff --git a/source/code/manhunt/Vector.cpp b/source/code/manhunt/Vector.cpp
new file mode 100644
index 0000000..eef5b6f
--- /dev/null
+++ b/source/code/manhunt/Vector.cpp
@@ -0,0 +1,5 @@
+#include "Vector.h"
+CVector CrossProduct(const CVector& v1, const CVector& v2)
+{
+ return CVector(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
+}
\ No newline at end of file
diff --git a/source/code/plugin/MHcommon.cpp b/source/code/plugin/MHcommon.cpp
index 1e4d3a3..917cb5e 100644
--- a/source/code/plugin/MHcommon.cpp
+++ b/source/code/plugin/MHcommon.cpp
@@ -11,19 +11,19 @@
#include "..\manhunt\AI.h"
#include "..\manhunt\Player.h"
#include "..\manhunt\Ped.h"
+#include "..\manhunt\Graph.h"
-void CreateEntity(char * name, CVector* pos)
-{
-
+CEntity* CreateEntity(char * name, CVector* pos)
+{
CTypeData* typeData = CEntityManager::GetEntityTypeDataFromName(name);
-
+ CEntity* entity = nullptr;
if (!typeData)
{
TheConsole.m_messages.push_back("Entity does not exist - " + (std::string)name);
}
if (typeData)
{
- CEntity* entity = CCreationManager::CreateEntity(typeData);
+ entity = CCreationManager::CreateEntity(typeData);
if (entity)
{
char ent[256];
@@ -37,6 +37,8 @@ void CreateEntity(char * name, CVector* pos)
TheConsole.m_entityID++;
}
}
+
+ return entity;
}
void GiveWeaponToEntity(CEntity * ent, int weaponID)
@@ -84,6 +86,32 @@ void StripAllWeapons(CEntity * ent)
}
+void MakeABodyguard(char* name, int weaponID, CVector* pos)
+{
+ CVector position;
+
+ RwMatrix* matrix = CScene::FindPlayer()->GetEntityMatrix();
+ CVector forward(matrix->at.x, matrix->at.y, matrix->at.z);
+ position = *CScene::FindPlayer()->GetLocation();
+
+ position += forward * 1.5f;
+
+
+ if (pos)
+ position = *pos;
+
+
+ CAutoPed* bodyguard = (CAutoPed*)CreateEntity(name, &position);
+ if (bodyguard)
+ {
+ if (!(weaponID == CT_FISTS))
+ GiveWeaponToEntity(bodyguard, weaponID);
+ char line[256] = {};
+ sprintf(line, "buddy %s", bodyguard->m_szName);
+ ConsoleCommands::ai(line);
+ }
+}
+
CEntity * GetHunterAboutToBeExecuted()
{
CPlayer* plr = (CPlayer*)CScene::FindPlayer();
diff --git a/source/code/plugin/MHcommon.h b/source/code/plugin/MHcommon.h
index 8906de0..5663481 100644
--- a/source/code/plugin/MHcommon.h
+++ b/source/code/plugin/MHcommon.h
@@ -1,10 +1,12 @@
#pragma once
#include "..\manhunt\Vector.h"
#include "..\manhunt\Entity.h"
-void CreateEntity(char* name, CVector* pos);
+CEntity* CreateEntity(char* name, CVector* pos);
void GiveWeaponToEntity(CEntity* ent, int weaponID);
void GiveWeaponToPlayer(int weaponID);
void StripAllWeapons(CEntity* ent);
+void MakeABodyguard(char* name, int weaponID, CVector* pos = nullptr);
+
CEntity* GetHunterAboutToBeExecuted();
\ No newline at end of file
diff --git a/source/code/plugin/classes/eCustomPed.cpp b/source/code/plugin/classes/eCustomPed.cpp
index 65ba8ca..f27263f 100644
--- a/source/code/plugin/classes/eCustomPed.cpp
+++ b/source/code/plugin/classes/eCustomPed.cpp
@@ -1,5 +1,7 @@
#include "eCustomPed.h"
#include "..\..\manhunt\core.h"
+#include "..\..\core\eSettingsManager.h"
+#include "..\.\weapon_adjuster\eWeaponAdjuster.h"
void CPedEx::UseCollectableEx(eCollectableType item, bool createIfDoesntExist)
{
@@ -8,8 +10,21 @@ void CPedEx::UseCollectableEx(eCollectableType item, bool createIfDoesntExist)
void CPedEx::ExplodeHeadEx(CVector* pos, int headSelection)
{
- if (m_pPedHead->m_bIsHidden)
- return;
+ if (eSettingsManager::bFixExplodingDecappedHeads)
+ {
+ if (m_pPedHead->m_bIsHidden)
+ return;
+ }
- ExplodeHead(pos, headSelection);
+ if (eWeaponAdjuster::ms_bShouldDecapHead)
+ {
+ CVector newPos = {1.0f, 1.0f, 1.0f};
+ SeverHead(&newPos);
+ }
+ else
+ ExplodeHead(pos, headSelection);
+}
+
+void CPedEx::PreUpdateEx()
+{
}
diff --git a/source/code/plugin/classes/eCustomPed.h b/source/code/plugin/classes/eCustomPed.h
index 4a2b085..64c57bf 100644
--- a/source/code/plugin/classes/eCustomPed.h
+++ b/source/code/plugin/classes/eCustomPed.h
@@ -6,4 +6,6 @@ class CPedEx : public CPed {
void UseCollectableEx(eCollectableType item, bool createIfDoesntExist);
void ExplodeHeadEx(CVector* pos, int headSelection);
+
+ void PreUpdateEx();
};
diff --git a/source/code/plugin/console/eConsole.cpp b/source/code/plugin/console/eConsole.cpp
index 91a9feb..c025b81 100644
--- a/source/code/plugin/console/eConsole.cpp
+++ b/source/code/plugin/console/eConsole.cpp
@@ -6,9 +6,13 @@
#include "..\..\manhunt\Scene.h"
#include "..\..\manhunt\SpecialFX.h"
#include "..\..\manhunt\Ped.h"
+#include "..\..\manhunt\AudioManager.h"
#include "..\..\manhunt\Character.h"
+#include "..\..\manhunt\AI.h"
+#include "..\..\manhunt\Graph.h"
#include "..\MHcommon.h"
#include "..\menu\eMenu.h"
+#include "..\..\manhunt\App.h"
eConsole TheConsole;
using namespace ConsoleCommands;
@@ -87,7 +91,7 @@ void eConsole::ExecuteCommand(char * command, char * args)
{
char* tmp = command;
- for (int i = 0; i < strlen(tmp); i++)
+ for (unsigned int i = 0; i < strlen(tmp); i++)
tmp[i] = tolower(tmp[i]);
std::string cmd = tmp;
@@ -112,6 +116,10 @@ void eConsole::ExecuteCommand(char * command, char * args)
else if (cmd == "list") list(args);
else if (cmd == "kill") kill(args);
else if (cmd == "anim") anim(args);
+ else if (cmd == "sound") sound(args);
+ else if (cmd == "ai") ai(args);
+ else if (cmd == "bodyguard") bodyguard(args);
+ else if (cmd == "level") level(args);
command[0] = 0;
args[0] = 0;
}
@@ -245,7 +253,7 @@ void ConsoleCommands::help(char * args)
int argc = sscanf(args, "%d", &pageID);
if (strlen(args) <= 0)
- TheConsole.m_messages.push_back("Usage: help <1-2>");
+ TheConsole.m_messages.push_back("Usage: help <1-3>");
switch (pageID)
{
@@ -269,9 +277,14 @@ void ConsoleCommands::help(char * args)
TheConsole.m_messages.push_back("list - Does something to selected entity. Type - inv, invr, data");
TheConsole.m_messages.push_back("kill ");
TheConsole.m_messages.push_back("anim - Makes entity play a body animation");
+ TheConsole.m_messages.push_back("sound - Play a sound");
+ break;
+ case 3:
+ TheConsole.m_messages.push_back("ai - Sets up a simple ai for an entity instance");
+ TheConsole.m_messages.push_back("bodyguard - Creates a bodyguard with specified entity and weapon or item");
+ TheConsole.m_messages.push_back("level - Prints current level name");
break;
default:
- TheConsole.m_messages.push_back("Usage: help <1-2>");
break;
}
}
@@ -391,7 +404,7 @@ void ConsoleCommands::kill(char * args)
return;
}
- entity->Kill();
+ CallMethod<0x4A1EC0, CEntity*>(entity);
}
void ConsoleCommands::anim(char* args)
@@ -418,6 +431,138 @@ void ConsoleCommands::anim(char* args)
}
+void ConsoleCommands::sound(char* args)
+{
+ eSampleIDs soundID = (eSampleIDs)-1;
+ int argc = sscanf(args, "%d", &soundID);
+
+ if (soundID == -1)
+ {
+ TheConsole.m_messages.push_back("No sound ID specified.");
+ return;
+ }
+
+ AudioManager.RequestMiscOneShot(CScene::FindPlayer()->GetLocation(), soundID, -1, -1);
+
+}
+
+void ConsoleCommands::ai(char* args)
+{
+ char aiType[64] = {};
+ char entityName[256] = {};
+ char enemyName[256] = {};
+ int argc = sscanf(args, "%s %s %s",&aiType, &entityName, &enemyName);
+
+ CEntity* entity = CEntityManager::FindInstance(entityName);
+
+ if (!entity)
+ {
+ TheConsole.m_messages.push_back("Entity instance does not exist - " + (std::string)entityName);
+ return;
+ }
+
+ if (strcmp(aiType, "enemy") == 0)
+ {
+ AISCRIPT_AddAIEntity(entityName);
+ AISCRIPT_SetAIEntityAsLeader(entityName);
+
+ char pack[256];
+
+ sprintf(pack, "TestPack%d", TheConsole.m_entityID);
+
+ AISCRIPT_AddSubpack_ForLeader(entityName, pack);
+
+ CAutoPed* ped = (CAutoPed*)(entity);
+
+ CWeaponCollectable* weapon_collectable = (CWeaponCollectable*)ped->m_pInventory->m_inventory[ped->m_nCurrentSlot];
+ if (weapon_collectable)
+ {
+ CWeapon* wep = (CWeapon*)*(int*)((int)weapon_collectable + 428);
+
+ if (wep->m_TypeData->m_eWeaponClass == WC_AMMO)
+ AISCRIPT_SetSubpackCombatType(entityName, pack, COMBATTYPEID_COVER);
+ else
+ AISCRIPT_SetSubpackCombatType(entityName, pack, COMBATTYPEID_MELEE);
+ }
+
+
+
+ AISCRIPT_AddHunterToLeaderSubpack(entityName, pack, entityName);
+ AISCRIPT_AddLeaderEnemy(entityName, enemyName);
+
+
+ char goal[256];
+ sprintf(goal, "Goal%d", TheConsole.m_entityID);
+ AISCRIPT_DefineGoal_HuntEnemy(goal, enemyName, false, 1);
+ AISCRIPT_AddGoal_Subpack(entityName, pack, goal);
+
+
+ }
+ if (strcmp(aiType, "buddy") == 0)
+ {
+ AISCRIPT_AddAIEntity(entityName);
+ AISCRIPT_EntityAlwaysEnabled(entityName);
+ AISCRIPT_SetAIEntityAsLeader(entityName);
+
+ char pack[256];
+
+ sprintf(pack, "TestPack%d", TheConsole.m_entityID);
+
+ AISCRIPT_AddSubpack_ForLeader(entityName, pack);
+ CAutoPed* ped = (CAutoPed*)(entity);
+
+ CWeaponCollectable* weapon_collectable = (CWeaponCollectable*)ped->m_pInventory->m_inventory[ped->m_nCurrentSlot];
+ if (weapon_collectable)
+ {
+ CWeapon* wep = (CWeapon*)*(int*)((int)weapon_collectable + 428);
+
+ if (wep->m_TypeData->m_eWeaponClass == WC_AMMO)
+ AISCRIPT_SetSubpackCombatType(entityName, pack, COMBATTYPEID_COVER);
+ else
+ AISCRIPT_SetSubpackCombatType(entityName, pack, COMBATTYPEID_MELEE);
+ }
+
+ char* leaderNames[] = { "LEADER", "hLeader","hLeader2","LEADER_HOODS","LEADER_SMILE","LEADER_INNO", "Barman", "LEADER_STARTGUYS", "MONKEYCUT1",};
+
+ for (int i = 0; i < sizeof(leaderNames) / sizeof(leaderNames[0]); i++)
+ {
+ if (CEntityManager::FindInstance(leaderNames[i]))
+ AISCRIPT_AddAllHuntersInPackAsLeaderEnemies(entityName, leaderNames[i]);
+ }
+
+
+ AISCRIPT_AddHunterToLeaderSubpack(entityName, pack, entityName);
+
+
+ char goal[256];
+ sprintf(goal, "Goal%d", TheConsole.m_entityID);
+
+
+ AISCRIPT_DefineGoal_BeBuddy(goal, entityName, "player", TheGraph.nodes[0].node->name, 53.0);
+ AISCRIPT_AddGoal_Subpack(entityName, pack, goal);
+ AISCRIPT_BuddyFollow(entityName);
+ }
+
+
+}
+
+void ConsoleCommands::bodyguard(char* args)
+{
+ char entityName[256] = {};
+ int weaponID;
+ int argc = sscanf(args, "%s %d", &entityName, &weaponID);
+
+ MakeABodyguard(entityName, weaponID);
+
+}
+
+void ConsoleCommands::level(char* args)
+{
+ char msg[512] = {};
+ sprintf(msg, "%s %d", (char*)(0x756034 + 20 * CApp::ms_currLevelNum), CApp::ms_currLevelNum);
+ TheConsole.m_messages.push_back(msg);
+}
+
void __fastcall HookAddLine(int console, char * line)
{
TheConsole.m_messages.push_back(line);
diff --git a/source/code/plugin/console/eConsole.h b/source/code/plugin/console/eConsole.h
index 412d81d..f4944a4 100644
--- a/source/code/plugin/console/eConsole.h
+++ b/source/code/plugin/console/eConsole.h
@@ -60,4 +60,8 @@ namespace ConsoleCommands {
void list(char* args);
void kill(char* args);
void anim(char* args);
+ void sound(char* args);
+ void ai(char* args);
+ void bodyguard(char* args);
+ void level(char* args);
};
\ No newline at end of file
diff --git a/source/code/plugin/eAchievements.cpp b/source/code/plugin/eAchievements.cpp
new file mode 100644
index 0000000..9d76089
--- /dev/null
+++ b/source/code/plugin/eAchievements.cpp
@@ -0,0 +1,76 @@
+#include "eAchievements.h"
+#include "../manhunt/Frontend.h"
+#include "../manhunt/Renderer.h"
+#include "../manhunt/Collectable.h"
+#include "../manhunt/core.h"
+
+bool eAchievements::m_bIsTransitionDone = false;
+float eAchievements::m_faStartY = -0.03f;
+float eAchievements::m_fStartY = 0.0f;
+int eAchievements::m_nAlpha = 255;
+bool eAchievements::m_bWantsToPlayUnlock = false;
+
+void eAchievements::Start()
+{
+ m_fStartY = 0.0f;
+ m_nAlpha = 255;
+ m_faStartY = -0.03f;
+ m_bWantsToPlayUnlock = true;
+ m_bIsTransitionDone = false;
+}
+
+void eAchievements::PlaySlider()
+{
+ if (!CFrontend::m_gameIsRunning)
+ return;
+ float arScale = ((4.0f/ 3.0f) / CFrontend::GetAspectRatio());
+ char* atext_str = "ACHIEVEMENT UNLOCKED";
+ char* text_str = "ACHIEVEMENT NAME";
+
+ const float achievementSize = 0.6f;
+ const float textSize = 0.4f;
+
+ float x_pos = 0.5f;
+
+ if (!m_bIsTransitionDone)
+ {
+ m_faStartY += 0.001f;
+ m_fStartY += 0.001f;
+ }
+
+
+ if (m_fStartY >= 0.07f && m_faStartY >= 0.06f)
+ {
+ m_bIsTransitionDone = true;
+ }
+
+ if (m_bIsTransitionDone)
+ {
+ m_nAlpha -= 1;
+ if (m_nAlpha < 0)
+ m_nAlpha = 0;
+ }
+
+ {
+ float afinal_x = x_pos - CFrontend::CalculateTextLen8(atext_str, achievementSize, 1) * x_pos;
+ CFrontend::SetDrawRGBA(0,0,0, m_nAlpha);
+ CFrontend::Print8(atext_str, afinal_x + 0.005f, m_faStartY + 0.005f, achievementSize, achievementSize, 0, FONT_TYPE_DEFAULT);
+ CFrontend::SetDrawRGBA(160, 160, 255, m_nAlpha);
+ CFrontend::Print8(atext_str, afinal_x, m_faStartY, achievementSize, achievementSize, 0, FONT_TYPE_DEFAULT);
+ }
+ {
+ float final_x = x_pos - CFrontend::CalculateTextLen8(text_str, textSize, 1) * x_pos;
+ CFrontend::SetDrawRGBA(0,0,0, m_nAlpha);
+ CFrontend::Print8(text_str, final_x + 0.005f, m_fStartY + 0.005f, textSize, textSize, 0, FONT_TYPE_DEFAULT);
+ CFrontend::SetDrawRGBA(255, 255, 255, m_nAlpha);
+ CFrontend::Print8(text_str, final_x, m_fStartY, textSize, textSize, 0, FONT_TYPE_DEFAULT);
+ }
+
+ {
+
+ CRenderer::DrawQuad2d(0.225f * arScale, m_faStartY, 0.06f * arScale, 0.10f, 255, 255, 255, m_nAlpha, *(int*)(CallAndReturn(CT_GLOCK, 0)));
+ }
+
+ if (m_nAlpha <= 0)
+ m_bWantsToPlayUnlock = false;
+}
diff --git a/source/code/plugin/eAchievements.h b/source/code/plugin/eAchievements.h
new file mode 100644
index 0000000..93de176
--- /dev/null
+++ b/source/code/plugin/eAchievements.h
@@ -0,0 +1,24 @@
+#pragma once
+
+enum eAchivementID
+{
+ ACHIEVEMENT_HE_NEVER_SAW_IT_COMING,
+ ACHIEVEMENT_5_STAR_KILLER,
+ ACHIEVEMENT_DRUG_FREE_IS_THE_WAY_TO_BE,
+ ACHIEVEMENT_BANG_BANG_BOOM,
+ ACHIEVEMENT_NO_CRANE_NO_GAIN
+};
+
+class eAchievements
+{
+public:
+ static bool m_bIsTransitionDone;
+ static bool m_bWantsToPlayUnlock;
+ static float m_faStartY;
+ static float m_fStartY;
+ static int m_nAlpha;
+
+ static void Start();
+ static void PlaySlider();
+};
+
diff --git a/source/code/plugin/eCommonHooks.cpp b/source/code/plugin/eCommonHooks.cpp
index 7813131..b9544fb 100644
--- a/source/code/plugin/eCommonHooks.cpp
+++ b/source/code/plugin/eCommonHooks.cpp
@@ -19,7 +19,9 @@
#include "classes/eCustomProjectile.h"
#include "..\manhunt\String.h"
#include "..\manhunt\SpecialFX.h"
+#include "eAchievements.h"
#include "MHcommon.h"
+#include "classes/eCustomPed.h"
void HookCommonShutdown()
{
eStatsManager::SaveToFile();
@@ -31,7 +33,6 @@ void HookCommonShutdown()
void InitCommonHooks()
{
-
InjectHook(0x4D7F70, HookCommonShutdown, PATCH_CALL);
InjectHook(0x489B69, CommonHooks::CreateCamera, PATCH_CALL);
@@ -44,10 +45,15 @@ void InitCommonHooks()
InjectHook(0x49DE68, ClassHooks::CPed_SetTranqed, PATCH_CALL);
InjectHook(0x49CDC1, ClassHooks::CPedHead_Explode, PATCH_CALL);
+
+ InjectHook(0x49D765, &CPedEx::ExplodeHeadEx, PATCH_CALL);
+ InjectHook(0x49D92F, &CPedEx::ExplodeHeadEx, PATCH_CALL);
+ InjectHook(0x49D96C, &CPedEx::ExplodeHeadEx, PATCH_CALL);
+ InjectHook(0x49DCE7, &CPedEx::ExplodeHeadEx, PATCH_CALL);
+
if (strlen(eSettingsManager::szCustomUserFilesDirectory) > 0)
InjectHook(0x4BE990, CommonHooks::GetMyDocumentsDirectory, PATCH_JUMP);
- InjectHook(0x4D7A58, CommonHooks::HookLoadSFX, PATCH_CALL);
InjectHook(0x474A02, CommonHooks::CCheatHandler_SetupForLevel, PATCH_CALL); // open
InjectHook(0x473F53, CommonHooks::CCheatHandler_SetupForLevel, PATCH_CALL); // reset
InjectHook(0x5F189F, CommonHooks::HookRenderMenu, PATCH_CALL);
@@ -63,15 +69,14 @@ void InitCommonHooks()
Nop(0x59032B, 7);
InjectHook(0x59032B, CommonHooks::DisableExecutionCamera, PATCH_JUMP);
}
+ InjectHook(0x4375AA, CommonHooks::Hook_LoadEntityTypeData, PATCH_CALL);
if (eSettingsManager::bHookExtraWeapons)
{
InjectHook(0x443F95, &CCustomProjectileShot::NewDestroy, PATCH_CALL);
InjectHook(0x4F7806, &CCustomProjectile::Spawn, PATCH_CALL);
- InjectHook(0x4375AA, CommonHooks::Hook_LoadEntityTypeData, PATCH_CALL);
}
-
}
@@ -128,12 +133,6 @@ void __declspec(naked) CommonHooks::HookSkipIntroSeq()
_asm jmp jmpPoint
}
-void CommonHooks::HookLoadSFX()
-{
- TheMenu.PreInitialize();
- Call<0x4D7BB0>();
-}
-
void CommonHooks::CCheatHandler_SetupForLevel()
{
CCheatHandler::SetupForLevel();
@@ -167,6 +166,9 @@ void CommonHooks::HookRenderMenu()
TheMenu.ProcessMenu();
Call<0x5D7070>();
+ if (eAchievements::m_bWantsToPlayUnlock)
+ eAchievements::PlaySlider();
+
}
char * CommonHooks::GetMyDocumentsDirectory()
@@ -209,7 +211,7 @@ void CommonHooks::CGameInfo_RenderDamageDirections(int id)
void CommonHooks::GameStartInit()
{
- Call<0x5EF510 >();
+ Call<0x5EF510>();
if (eSettingsManager::iForcePlayerSkin > 0)
CEntityManager::ms_playerCharacterID = eSettingsManager::iForcePlayerSkin;
@@ -281,12 +283,39 @@ void __declspec(naked) CommonHooks::DisableExecutionCamera()
void CommonHooks::Hook_LoadEntityTypeData()
{
CEntityManager::CreateEntityTypesFromIni();
- // load extraTypeData
- CString newPath("./data/extraTypeData.ini");
- Patch(0x4395B0 + 1,(int)&newPath);
- Patch(0x439435 + 1,(int)&newPath);
+ if (eSettingsManager::bHookExtraWeapons)
+ {
+ // load extraTypeData
+ CString newPath("./data/extraTypeData.ini");
+ Patch(0x4395B0 + 1, (int)&newPath);
+ Patch(0x439435 + 1, (int)&newPath);
+
+ CEntityManager::CreateEntityTypesFromIni();
+ }
+
+
+ // modloader entries
+
+ for (unsigned int i = 0; i < eModLoader::m_vMods.size(); i++)
+ {
+ for (unsigned int a = 0; a < eModLoader::m_vMods[i].files.size(); a++)
+ {
+ std::string fileName = eModLoader::m_vMods[i].files[a];
+ if (fileName.find(EXTRATYPEDATA_EXTENSION) != std::string::npos)
+ {
+ CString newPath(fileName.c_str());
+ Patch(0x4395B0 + 1, (int)&newPath);
+ Patch(0x439435 + 1, (int)&newPath);
+
+ CEntityManager::CreateEntityTypesFromIni();
+ }
+ }
+
+
+ }
+
+
- CEntityManager::CreateEntityTypesFromIni();
// patch back
Patch(0x4395B0 + 1, 0x69BC7C);
Patch(0x439435 + 1, 0x69BC7C);
diff --git a/source/code/plugin/eCustomAnimManager.cpp b/source/code/plugin/eCustomAnimManager.cpp
index e8ec18f..d87fa40 100644
--- a/source/code/plugin/eCustomAnimManager.cpp
+++ b/source/code/plugin/eCustomAnimManager.cpp
@@ -97,7 +97,7 @@ bool CCustomAnimManager::Initialise()
else
{
if (eSettingsManager::bCustomLevelsLoader)
- sprintf(tmpPath, "%s%s/", CFileNames::ms_CurrentLevelPath.str, eLevelsLoader::m_levelNames[CApp::ms_currLevelNum]);
+ sprintf(tmpPath, "%s%s/", CFileNames::ms_CurrentLevelPath.str, eLevelsLoader::m_levelNames[CApp::ms_currLevelNum].name);
else
sprintf(tmpPath, "%s%s/", CFileNames::ms_CurrentLevelPath.str, (char*)(0x756034 + 20 * CApp::ms_currLevelNum));
}
@@ -113,7 +113,13 @@ bool CCustomAnimManager::Initialise()
else
result = false;
- eLog::Message(__FUNCTION__, "Loaded file %s Animations - %d/%d", tmpPath, CAnimManager::ms_nAvailableAnims, eSettingsManager::iCustomAnimManagerSize);
+ if (!result)
+ {
+ eLog::ErrorMsg(__FUNCTION__, "Failed to load animations! The allanims.ifp file might be missing or corrupted.");
+ }
+
+ else
+ eLog::Message(__FUNCTION__, "Loaded file %s Animations - %d/%d", tmpPath, CAnimManager::ms_nAvailableAnims, eSettingsManager::iCustomAnimManagerSize);
return result;
diff --git a/source/code/plugin/eCustomTableOfContents.cpp b/source/code/plugin/eCustomTableOfContents.cpp
index f0752c8..c1776c0 100644
--- a/source/code/plugin/eCustomTableOfContents.cpp
+++ b/source/code/plugin/eCustomTableOfContents.cpp
@@ -10,12 +10,10 @@ char& unk_67D000 = *(char*)0x67D000;
void eCustomTableOfContents::InitHooks()
{
- //InjectHook(0x4D5090, LoadFile, PATCH_JUMP);
InjectHook(0x4D61B0, GetTOCFileSize, PATCH_JUMP);
}
int eCustomTableOfContents::GetTOCFileSize(char * name)
{
- //printf("File %s\n", name);
- return std::filesystem::file_size(name);
+ return (int)std::filesystem::file_size(name);
}
diff --git a/source/code/plugin/eLaserSights.cpp b/source/code/plugin/eLaserSights.cpp
new file mode 100644
index 0000000..7962f06
--- /dev/null
+++ b/source/code/plugin/eLaserSights.cpp
@@ -0,0 +1,92 @@
+#include "eLaserSights.h"
+#include "..\manhunt\core.h"
+#include "..\manhunt\Player.h"
+#include "..\manhunt\Scene.h"
+#include "..\manhunt\ColLine.h"
+#include "..\manhunt\ContactInfo.h"
+#include "..\manhunt\Collectable.h"
+#include "..\manhunt\Frontend.h"
+#include "..\manhunt\AmmoWeapon.h"
+
+
+void eLaserSights::Initialize()
+{
+ Nop(0x487EE3, 8);
+ InjectHook(0x487EE3, Hook_Draw, PATCH_JUMP);
+}
+
+void eLaserSights::Draw()
+{
+ CPlayer* plr = (CPlayer*)CScene::FindPlayer();
+
+ if (plr)
+ {
+ CWeaponCollectable* wep;
+ CInventory* inv = plr->m_pInventory;
+ eHolsterSlot slot = (eHolsterSlot)plr->m_nCurrentSlot;
+
+ if (slot > 0)
+ {
+ wep = (CWeaponCollectable*)inv->m_inventory[slot];
+
+ if (wep && wep->m_pLaserBone)
+ {
+ RwMatrix* laserBone = RwFrameGetLTM((RwFrame*)wep->m_pLaserBone);
+ RwMatrix* plrMatrix = plr->GetEntityMatrix();
+ CVector* pos = (CVector*)&laserBone->pos;
+ CVector forward(plrMatrix->at.x, plrMatrix->at.y, plrMatrix->at.z);
+
+
+
+ CVector target = forward;
+ target.y = -(plr->m_fAngle / 47.0f);
+
+ target.Normalise();
+
+
+ CVector start = *pos;
+
+ CVector end = start;
+ end += target * 15.5f;
+
+ //CVector aimPos = {};
+ //
+ //CWeapon* w = (CWeapon*)*(int*)((int)wep + 428);
+ //
+ //if (w->m_TypeData->m_eWeaponClass == WC_AMMO)
+ //{
+ //
+ // CAmmoWeapon* ammo = (CAmmoWeapon*)*(int*)((int)wep + 428);
+ // ammo->GetFiringPoint(&aimPos, 0);
+ //}
+ //
+ //end.x = aimPos.x;
+ //end.y = aimPos.y;
+ //end.z = aimPos.z;
+ //
+
+ CFrontend::LaserDraw(&start, &end);
+ CFrontend::LaserDraw(&start, &end);
+ CFrontend::LaserDraw(&start, &end);
+ CFrontend::LaserDraw(&start, &end);
+ CFrontend::LaserDraw(&start, &end);
+ CFrontend::LaserDraw(&start, &end);
+ }
+ }
+
+
+ }
+}
+
+void __declspec(naked) eLaserSights::Hook_Draw()
+{
+ static int jmp_continue = 0x487EEB;
+
+ _asm {
+ pushad
+ call eLaserSights::Draw
+ popad
+ mov dword ptr[esp + 8], 0
+ jmp jmp_continue
+ }
+}
diff --git a/source/code/plugin/eLaserSights.h b/source/code/plugin/eLaserSights.h
new file mode 100644
index 0000000..e3aacd3
--- /dev/null
+++ b/source/code/plugin/eLaserSights.h
@@ -0,0 +1,9 @@
+#pragma once
+
+class eLaserSights {
+public:
+ static void Initialize();
+ static void Draw();
+
+ static void Hook_Draw();
+};
\ No newline at end of file
diff --git a/source/code/plugin/eLevelsLoader.cpp b/source/code/plugin/eLevelsLoader.cpp
index 2356016..cf9f6cd 100644
--- a/source/code/plugin/eLevelsLoader.cpp
+++ b/source/code/plugin/eLevelsLoader.cpp
@@ -90,4 +90,9 @@ void eLevelsLoader::Init()
m_levelMaps = std::make_unique(TOTAL_LEVELS);
GetLevels();
printf("Levels found: %d\n", m_nLevels);
+
+ for (int i = 0; i < m_nLevels; i++)
+ {
+ printf("%s\n", m_levelNames[i].name);
+ }
}
diff --git a/source/code/plugin/eLog.cpp b/source/code/plugin/eLog.cpp
index 814367d..abc75a0 100644
--- a/source/code/plugin/eLog.cpp
+++ b/source/code/plugin/eLog.cpp
@@ -49,3 +49,15 @@ void eLog::Message(char* function, char* format, ...)
}
}
+
+void eLog::ErrorMsg(char* function, char* format, ...)
+{
+ char msg[2048];
+
+ va_list args;
+ va_start(args, format);
+ wvsprintf(msg, format, args);
+ va_end(args);
+
+ MessageBoxA(0, msg, 0, MB_ICONERROR);
+}
diff --git a/source/code/plugin/eLog.h b/source/code/plugin/eLog.h
index dbc2c51..2425dad 100644
--- a/source/code/plugin/eLog.h
+++ b/source/code/plugin/eLog.h
@@ -7,4 +7,5 @@ class eLog {
static void Initialise();
static void Message(char* function, char* format, ...);
+ static void ErrorMsg(char* function, char* format, ...);
};
\ No newline at end of file
diff --git a/source/code/plugin/eNewFrontend.cpp b/source/code/plugin/eNewFrontend.cpp
index 9adee56..61e19b4 100644
--- a/source/code/plugin/eNewFrontend.cpp
+++ b/source/code/plugin/eNewFrontend.cpp
@@ -20,6 +20,7 @@
#include "eSkinLoader.h"
#include "..\core\eSettingsManager.h"
#include "eGUI.h"
+#include "..\manhunt\AudioManager.h"
#include
int eNewFrontend::m_pStatsMenu[2] = { (int)eNewFrontend::ProcessStatsMenu, (int)eNewFrontend::StatsMenu };
@@ -42,6 +43,7 @@ wchar_t* eNewFrontend::m_szCheatText = (wchar_t*)0x7D6360;
RpWorld * eNewFrontend::ms_pMenuWorld;
RpLight * eNewFrontend::ms_pMenuLight;
bool eNewFrontend::m_bNewLevels;
+bool eNewFrontend::m_bSkinsFreezeRotation;
void eNewFrontend::InitHooks()
{
@@ -77,6 +79,7 @@ void eNewFrontend::Init()
m_nSkinAdjustID = eSkinLoader::ms_iCurrentSkinAdjust;
m_nModAdjustID = 0;
m_nCurrentModPos = 0;
+ m_bSkinsFreezeRotation = false;
}
@@ -165,7 +168,6 @@ bool __declspec(naked) eNewFrontend::ProcessMainMenu()
static int maxButton = MB_QUITPRG;
static int totalButton = MB_TOTAL_MENUS;
-
if (m_bNewLevels)
{
maxButton = MB_LOADG;
@@ -361,12 +363,12 @@ void eNewFrontend::StatsMenu()
}
- CFrontend::PrintInfo(L"Press ESC to quit, ~up~ or ~down~ to navigate", (wchar_t*)0x7D6360, (wchar_t*)0x7D6360, (wchar_t*)0x7D6360);
+ CFrontend::PrintInfo(L"Press ~up~ or ~down~ to navigate", L"", CText::GetFromKey16("IBACK"), L"");
}
void eNewFrontend::ProcessStatsMenu()
{
- if (CInputManager::FrontendPressedEscape())
+ if (CInputManager::FrontendPressedEscape() || CFrontend::GetInfoBarInput3())
CFrontend::SetCurrentMenu(MENU_19);
if (CInputManager::FrontendPressedUp())
@@ -385,16 +387,17 @@ void eNewFrontend::ProcessStatsMenu()
void eNewFrontend::ModsMenu()
{
+ float infoBarOffset = -0.08f;
int mods = eModLoader::modFolders.size();
char tmp[128];
CFrontend::SetDrawRGBA(255,255,255, 255);
sprintf(tmp, "LOADED MODIFICATIONS: %d", mods);
- CFrontend::Print8(tmp, m_fBoxPositionX, m_fBoxPositionY - 0.10f, 1.0, 1.0, 0.0, FONT_FRONTEND);
+ CFrontend::Print8(tmp, m_fBoxPositionX, m_fBoxPositionY - 0.10f + (infoBarOffset / 2), 1.0, 1.0, 0.0, FONT_FRONTEND);
CFrontend::DrawMenuCameraCounter(L"MODIFICATIONS");
- CRenderer::DrawQuad2d(m_fSkinsBoxPositionX - 0.40f, m_fSkinsBoxPositionY, 0.80f, 0.6f, 180, 180, 180, 90, 0);
+ CRenderer::DrawQuad2d(m_fSkinsBoxPositionX - 0.40f, m_fSkinsBoxPositionY + infoBarOffset, 0.80f, 0.6f, 180, 180, 180, 90, 0);
/*const char* modHelp = "Press ~up~ or ~down~ or use mouse to select a mod. ESC to quit.";
CFrontend::SetDrawRGBA(0, 0, 0, 255);
@@ -405,15 +408,17 @@ void eNewFrontend::ModsMenu()
for (int i = 0; i < mods; i++)
{
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(eModLoader::modFolders[i].c_str(), m_fSkinsBoxPositionX - 0.40f + 0.02 + 0.004, m_fBoxPositionY + 0.05 * i + 0.004, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(eModLoader::modFolders[i].c_str(), m_fSkinsBoxPositionX - 0.40f + 0.02f + 0.004f, m_fBoxPositionY + 0.05f * i + 0.004f + infoBarOffset, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(eModLoader::modFolders[i].c_str(), m_fSkinsBoxPositionX - 0.40f + 0.02, m_fBoxPositionY + 0.05 * i, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(eModLoader::modFolders[i].c_str(), m_fSkinsBoxPositionX - 0.40f + 0.02f, m_fBoxPositionY + 0.05f * i + infoBarOffset, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
}
+
+ CFrontend::PrintInfo(L"", L"", CText::GetFromKey16("IBACK"), L"");
}
void eNewFrontend::ProcessModsMenu()
{
- if (CInputManager::FrontendPressedEscape())
+ if (CInputManager::FrontendPressedEscape() || CFrontend::GetInfoBarInput3())
CFrontend::SetCurrentMenu(MENU_19);
}
@@ -502,7 +507,7 @@ void eNewFrontend::ProcessNewSettingMenu()
void eNewFrontend::Skins()
{
-
+ float infoBarOffset = -0.08f;
CFrontend::DrawMenuCameraCounter(L"SKINS");
@@ -511,10 +516,10 @@ void eNewFrontend::Skins()
static float rotation = 0.0f;
static unsigned int LastFlash = 0;
- const RwV3d pos = { 1.15f, -1.25f, 4.05f };
+ const RwV3d pos = { 1.15f, -1.00f, 4.05f };
const RwV3d axis2 = { 0.0f, 1.0f, 0.0f };
- RwRGBAReal AmbientColor = { 0.80, 0.80, 0.80, 1.0f };
- if (GetTickCount() - LastFlash > 7) {
+ RwRGBAReal AmbientColor = { 0.80f, 0.80f, 0.80f, 1.0f };
+ if (GetTickCount() - LastFlash > 7 && !m_bSkinsFreezeRotation) {
rotation += 1.0f;
if (rotation > 360.0f)
rotation -= 360.0f;
@@ -539,27 +544,17 @@ void eNewFrontend::Skins()
CRenderer::SetIngameInfoRenderStates(0);
}
- CRenderer::DrawQuad2d(m_fSkinsBoxPositionX, m_fSkinsBoxPositionY, 0.40f, 0.6f, 180, 180, 180, 90, 0);
+ CRenderer::DrawQuad2d(m_fSkinsBoxPositionX, m_fSkinsBoxPositionY + infoBarOffset, 0.40f, 0.6f, 180, 180, 180, 90, 0);
- const char* skinsHelp = "Press ~up~ or ~down~ to change skin. ESC to save & quit.";
- CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(skinsHelp, 0.05f + 0.004f, 0.90f + 0.004, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
- CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(skinsHelp, 0.05f, 0.90f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
-
- static char skinNo[128] = {};
- sprintf(skinNo, "Skins: %d", eSkinLoader::vSkins.size());
- CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(skinNo, m_fSkinsBoxPositionX + 0.30f + 0.004f, m_fSkinsBoxPositionY + 0.60f + 0.004, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
- CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(skinNo, m_fSkinsBoxPositionX + 0.30f, m_fSkinsBoxPositionY + 0.60f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ wsprintfW(m_szStatsBuffer, L"Skins: %d", eSkinLoader::vSkins.size());
+ CFrontend::PrintInfo(L"Press ~up~ or ~down~ to change skin", m_szStatsBuffer, CText::GetFromKey16("IBACK"), m_bSkinsFreezeRotation ? L"Rotate" : L"Freeze");
int skins = eSkinLoader::vSkins.size();
float arrowX = m_fSkinsBoxPositionX + 0.37f;
- float downY = m_fSkinsBoxPositionY + 0.52f;
- float upY = m_fSkinsBoxPositionY;
+ float downY = m_fSkinsBoxPositionY + 0.52f + infoBarOffset;
+ float upY = m_fSkinsBoxPositionY + infoBarOffset;
float arrow_x = 0.05f;
float arrow_y = 0.055f;
bool isDown = false;
@@ -625,7 +620,7 @@ void eNewFrontend::Skins()
{
skins = 11;
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8("~down~", arrowX + 0.004f, downY + 0.004, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8("~down~", arrowX + 0.004f, downY + 0.004f, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
if (isDown)
CFrontend::SetDrawRGBA(180, 180, 255, 255);
else
@@ -633,12 +628,12 @@ void eNewFrontend::Skins()
CFrontend::Print8("~down~", arrowX, downY, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8("~up~", m_fSkinsBoxPositionX + 0.37 + 0.004f, upY + 0.004, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8("~up~", m_fSkinsBoxPositionX + 0.37f + 0.004f, upY + 0.004f, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
if (isUp)
CFrontend::SetDrawRGBA(180, 180, 255, 255);
else
CFrontend::SetDrawRGBA(120, 120, 170, 255);
- CFrontend::Print8("~up~", m_fSkinsBoxPositionX + 0.37, upY, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8("~up~", m_fSkinsBoxPositionX + 0.37f, upY, 1.25f, 1.25f, 0.0, FONT_TYPE_DEFAULT);
}
@@ -675,7 +670,7 @@ void eNewFrontend::Skins()
for (int i = 0; i < skins; i++)
{
- AddSkinButton(i + m_nSkinAdjustID, i);
+ AddSkinButton(i + m_nSkinAdjustID, i, infoBarOffset);
}
@@ -685,12 +680,15 @@ void eNewFrontend::ProcessSkins()
{
eSkinLoader::LoadPlayerDff();
- if (CInputManager::FrontendPressedEscape())
+ if (CInputManager::FrontendPressedEscape() || CFrontend::GetInfoBarInput3())
{
eSkinLoader::SaveFile(m_nCurrentSkinPos,m_nSkinAdjustID);
CFrontend::SetCurrentMenu(MENU_19);
}
+ if (CFrontend::GetInfoBarInput4())
+ m_bSkinsFreezeRotation ^= 1;
+
if (CInputManager::FrontendPressedUp())
{
@@ -739,12 +737,12 @@ void eNewFrontend::ProcessSkins()
}
-void eNewFrontend::AddSkinButton(int id, int pos)
+void eNewFrontend::AddSkinButton(int id, int pos, float offset)
{
int len = eSkinLoader::vSkins[id].sName.length();
float x = m_fSkinsBoxPositionX + 0.01f;
- float y = m_fSkinsBoxPositionY + 0.03f + 0.05f* pos;
+ float y = m_fSkinsBoxPositionY + 0.03f + 0.05f* pos + offset;
float x_size = len * 0.0097f;
float y_size = 0.045f;
@@ -759,10 +757,11 @@ void eNewFrontend::AddSkinButton(int id, int pos)
if (isInside)
{
- if (CPad::NewMouseControllerState.lmb)
+ if (CPad::NewMouseControllerState.lmb && !CPad::OldMouseControllerState.lmb)
{
m_nCurrentSkinPos = pos;
eSkinLoader::ReloadPlayerDff(id);
+ DMAudio.PlayFrontEndSound(0, -1.0f);
}
}
@@ -785,18 +784,18 @@ void eNewFrontend::DrawStatText(int id)
// stat names
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(eStatsManager::GetStatName(id), m_fBoxPositionX + 0.02 + 0.004, m_fBoxPositionY + 0.05 * drawID + 0.004, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(eStatsManager::GetStatName(id), m_fBoxPositionX + 0.02f + 0.004f, m_fBoxPositionY + 0.05f * drawID + 0.004f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(eStatsManager::GetStatName(id), m_fBoxPositionX + 0.02, m_fBoxPositionY + 0.05 * drawID, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(eStatsManager::GetStatName(id), m_fBoxPositionX + 0.02f, m_fBoxPositionY + 0.05f * drawID, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
// stat values
sprintf(statsBuffer, "%d", eStatsManager::GetStat(id));
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(statsBuffer, m_fBoxPositionX + 0.02 + 0.55 + 0.004, m_fBoxPositionY + 0.05 * drawID + 0.004, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(statsBuffer, m_fBoxPositionX + 0.02f + 0.55f + 0.004f, m_fBoxPositionY + 0.05f * drawID + 0.004f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(statsBuffer, m_fBoxPositionX + 0.02 + 0.55, m_fBoxPositionY + 0.05 * drawID, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(statsBuffer, m_fBoxPositionX + 0.02f + 0.55f, m_fBoxPositionY + 0.05f * drawID, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
}
}
@@ -857,7 +856,7 @@ void __declspec(naked) eNewFrontend::HookExecuteMenuProcess()
else if (CFrontend::ms_currentMenu == MENU_NEW_SETTINGS)
{
ProcessNewSettingMenu();
- NewSettingMenu();
+ NewSettingMenu();
}
else if (CFrontend::ms_currentMenu == MENU_SKINS)
{
@@ -910,7 +909,10 @@ void eNewFrontend::HookCreateMenuLight()
void eNewFrontend::DestroyMenuLightWorld()
{
- RpWorldRemoveLight(ms_pMenuWorld, ms_pMenuLight);
- RpLightDestroy(ms_pMenuLight);
- RpWorldDestroy(ms_pMenuWorld);
+ if (ms_pMenuWorld && ms_pMenuLight)
+ RpWorldRemoveLight(ms_pMenuWorld, ms_pMenuLight);
+ if (ms_pMenuLight)
+ RpLightDestroy(ms_pMenuLight);
+ if (ms_pMenuWorld)
+ RpWorldDestroy(ms_pMenuWorld);
}
diff --git a/source/code/plugin/eNewFrontend.h b/source/code/plugin/eNewFrontend.h
index e494012..fa1b18a 100644
--- a/source/code/plugin/eNewFrontend.h
+++ b/source/code/plugin/eNewFrontend.h
@@ -44,6 +44,7 @@ class eNewFrontend {
static float m_fBoxPositionY;
static float m_fSkinsBoxPositionX;
static float m_fSkinsBoxPositionY;
+ static bool m_bSkinsFreezeRotation;
static int m_pStatsMenu[2];
static int m_allStatsPages;
@@ -72,7 +73,7 @@ class eNewFrontend {
static void Skins();
static void ProcessSkins();
- static void AddSkinButton(int id, int pos);
+ static void AddSkinButton(int id, int pos, float offset);
static void DrawStatText(int id);
diff --git a/source/code/plugin/eQoLChanges.cpp b/source/code/plugin/eQoLChanges.cpp
index b8ce08d..86338ed 100644
--- a/source/code/plugin/eQoLChanges.cpp
+++ b/source/code/plugin/eQoLChanges.cpp
@@ -9,8 +9,7 @@
void eQoLChanges::Init()
{
- if (eSettingsManager::bSkipIntroSequence) SkipIntro();
- if (eSettingsManager::bFixExplodingDecappedHeads) FixDecappedHeadsExploding();
+ if (eSettingsManager::bSkipIntroSequence)SkipIntro();
// InjectHook(0x5A53A7, FixCerberusExecutionAudio, PATCH_JUMP);
}
@@ -22,6 +21,9 @@ void eQoLChanges::SkipIntro()
Nop(0x5E2652, 5);
Nop(0x5E26DC, 5);
+ // movie
+ Nop(0x4C17AF, 5);
+
}
void __declspec(naked) eQoLChanges::FixCerberusExecutionAudio()
@@ -74,10 +76,7 @@ void __declspec(naked) eQoLChanges::FixCerberusExecutionAudio()
void eQoLChanges::FixDecappedHeadsExploding()
{
- InjectHook(0x49D765, &CPedEx::ExplodeHeadEx, PATCH_CALL);
- InjectHook(0x49D92F, &CPedEx::ExplodeHeadEx, PATCH_CALL);
- InjectHook(0x49D96C, &CPedEx::ExplodeHeadEx, PATCH_CALL);
- InjectHook(0x49DCE7, &CPedEx::ExplodeHeadEx, PATCH_CALL);
+
}
diff --git a/source/code/plugin/menu/eMenu.cpp b/source/code/plugin/menu/eMenu.cpp
index 00b9299..a7d6fb7 100644
--- a/source/code/plugin/menu/eMenu.cpp
+++ b/source/code/plugin/menu/eMenu.cpp
@@ -1,6 +1,7 @@
#include "eMenu.h"
#include
#include
+#include "..\..\RenderWare.h"
// manhunt includes
@@ -25,8 +26,11 @@
#include "..\..\manhunt\Graph.h"
#include "..\..\manhunt\Camera.h"
#include "..\..\manhunt\MusicManager.h"
-
-
+#include "..\..\manhunt\TextOverlay.h"
+#include "..\..\manhunt\Time.h"
+#include "..\..\manhunt\SpecialFX.h"
+#include "..\..\manhunt\Script.h"
+#include "..\..\manhunt\ColLine.h"
#include "..\..\core\eSettingsManager.h"
#include "..\..\core\eMain.h"
@@ -36,7 +40,7 @@
#include "..\..\..\IniReader.h"
#include "..\eMapLimits.h"
#include "..\MHcommon.h"
-
+#include "..\eAchievements.h"
// custom
@@ -50,18 +54,6 @@ char buffer[256];
eMenu TheMenu;
-void eMenu::PreInitialize()
-{
- CIniReader ini("");
-
- KeyEnableMenu = ini.ReadInteger("Keys.Menu", "keyMenuEnable", VK_F2);
- KeyMenuExecute = ini.ReadInteger("Keys.Menu", "keyMenuExecute", VK_RETURN);
- KeyMenuGoBack = ini.ReadInteger("Keys.Menu", "keyMenuBack", VK_BACK);
- KeyMenuItemDOWN = ini.ReadInteger("Keys.Menu", "keyMenuDown", VK_DOWN);
- KeyMenuItemUP = ini.ReadInteger("Keys.Menu", "keyMenuUp", VK_UP);
- KeyMenuItemLEFT = ini.ReadInteger("Keys.Menu", "keyMenuLeft", VK_LEFT);
- KeyMenuItemRIGHT = ini.ReadInteger("Keys.Menu", "keyMenuRight", VK_RIGHT);
-}
void eMenu::Initialize()
{
@@ -149,6 +141,7 @@ void eMenu::Initialize()
AddToggleCharEntry("Body Count", &bBodyCount);
AddToggleIntEntry("Enable Body Count", &m_enableKillCounter);
AddToggleIntEntry("Hide Lock-on Triangles (use with free cam)", &m_disableLockOnTriangles);
+ AddToggleIntEntry("Level Timer", &m_levelTimer);
AddCategory("HUD");
@@ -168,6 +161,31 @@ void eMenu::Initialize()
AddToggleIntEntry("Hide Stars", &m_hideStars);
AddCategory("World");
+ if (CEntityManager::GetEntityTypeDataFromName("Hod_BodB1") && CEntityManager::GetEntityTypeDataFromName("Shard_(CT)"))
+ AddFunctionEntry("Hood with Shard", CreateHood);
+ if (CEntityManager::GetEntityTypeDataFromName("Cop_BodB1") && CEntityManager::GetEntityTypeDataFromName("Glock_(CT)"))
+ AddFunctionEntry("Cop with Glock", CreateCop);
+ if (CEntityManager::GetEntityTypeDataFromName("Cop_BodS1") && CEntityManager::GetEntityTypeDataFromName("Shotgun_(CT)"))
+ AddFunctionEntry("Cop with Shotgun", CreateCopShotgun);
+ if (CEntityManager::GetEntityTypeDataFromName("Cop_BodM1") && CEntityManager::GetEntityTypeDataFromName("Uzi_(CT)"))
+ AddFunctionEntry("SWAT with SMG", CreateSwat);
+ if (CEntityManager::GetEntityTypeDataFromName("Cerberus") && CEntityManager::GetEntityTypeDataFromName("C_Commando_(CT)"))
+ AddFunctionEntry("Cerberus with Assault Rifle", CreateCerberusM16);
+ if (CEntityManager::GetEntityTypeDataFromName("Cerberus") && CEntityManager::GetEntityTypeDataFromName("Desert_Eagle_(CT)"))
+ AddFunctionEntry("Cerberus with Desert Eagle", CreateCerberusDeagle);
+ if (CEntityManager::GetEntityTypeDataFromName("Cerberus") && CEntityManager::GetEntityTypeDataFromName("Shotgun_(CT)"))
+ AddFunctionEntry("Cerberus with Shotgun", CreateCerberusShotgun);
+ if (CEntityManager::GetEntityTypeDataFromName("Cerberus") && CEntityManager::GetEntityTypeDataFromName("Shotgun_Torch_(CT)"))
+ AddFunctionEntry("Cerberus with Shotgun + Torch", CreateCerberusShotgunTorch);
+ if (CEntityManager::GetEntityTypeDataFromName("Cerberus") && CEntityManager::GetEntityTypeDataFromName("Sniper_Rifle_(CT)"))
+ AddFunctionEntry("Cerberus with Sniper", CreateCerberusSniper);
+
+ AddCategory("Bodyguards");
+
+ AddToggleIntEntry("Change Gamespeed", &m_slowmo);
+ AddSliderIntEntry("New Value", &m_timestepval, 0, 200);
+ AddCategory("Speed");
+
AddSliderFloatEntry("Camera Offset X", &TheCamera.m_vCameraOffsets.x, -INT_MAX, INT_MAX);
AddSliderFloatEntry("Camera Offset Y", &TheCamera.m_vCameraOffsets.y, -INT_MAX, INT_MAX);
@@ -195,26 +213,33 @@ void eMenu::Initialize()
AddFunctionEntry("Set Difficulty To Hardcore", SetDifficultyHard);
AddFunctionEntry("Place Bag On Head", PutBagOnPlayerHead);
AddToggleIntEntry("Execution Debug", &m_displayHunter);
+ AddToggleIntEntry("Fire Head", &m_fireHead);
AddToggleCharEntry("Disable Hunters", (char*)&CEntityManager::ms_disableHunters);
+
+ //AddFunctionEntry("Achievement Test", PrintAchievementTest);
AddCategory("Misc.");
}
void eMenu::ProcessMenu()
{
- if (m_infiniteHealth)
+ if (CPlayer* plr = (CPlayer*)CScene::FindPlayer())
{
- if (CScene::FindPlayer())
+ if (m_infiniteHealth)
+ plr->m_fHealth = 100.0f;
+
+ plr->SetFlag(0x100, m_godMode);
+ if (m_fireHead)
{
- CScene::FindPlayer()->m_fHealth = 100.0f;
+ RwFrame* head = plr->GetBoneFrame(1001);
+ if (head)
+ {
+ CVector* pos = (CVector*)&head->ltm.pos;
+ if (CGameTime::ms_currGameTime & 32)
+ FXSystem_Play("FLM001", pos, nullptr, false);
+ }
}
- }
- if (CScene::FindPlayer())
- CScene::FindPlayer()->SetFlag(0x100, m_godMode);
- if (m_displayHunter)
- {
- CPlayer* plr = (CPlayer*)CScene::FindPlayer();
- if (plr)
+ if (m_displayHunter)
{
CHunter* hunter = plr->m_pExecuteHunter;
@@ -229,6 +254,7 @@ void eMenu::ProcessMenu()
CFrontend::Print8(buffer, 0.15f, 0, 0.5, 0.5, 0.0, FONT_TYPE_DEFAULT);
}
}
+
if (m_enableKillCounter)
CFrontend::ms_cnt = *(int*)0x7B7D84 + *(int*)0x7B7DA0;
@@ -294,14 +320,14 @@ void eMenu::ProcessMenu()
sprintf(buffer, "ANALOG STICK %d", *(short*)(0x725684 + 2));
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(buffer, 0.152f, 0.55, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(buffer, 0.152f, 0.55f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(180, 255, 180, 255);
CFrontend::Print8(buffer, 0.154f, 0.55f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
sprintf(buffer, "STICK STATES %f %f", *(float*)0x725674 ,*(float*)0x725678);
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(buffer, 0.152f, 0.6, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(buffer, 0.152f, 0.6f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
CFrontend::SetDrawRGBA(180, 255, 180, 255);
CFrontend::Print8(buffer, 0.154f, 0.6f, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
}
@@ -323,6 +349,21 @@ void eMenu::ProcessMenu()
CFrontend::Print8(buffer, 0.1f, 0, 0.7f, 0.7f, 0.0, FONT_TYPE_DEFAULT);
}
+ if (m_levelTimer)
+ {
+ // Time
+ {
+ int minutes = (CGameTime::ms_currGameTimePaused / 1000 / 60) % 60;
+ int seconds = (CGameTime::ms_currGameTimePaused / 1000 % 60);
+
+
+ sprintf(buffer, "%02d:%02d", minutes, seconds);
+ CFrontend::SetDrawRGBA(0, 0, 0, 255);
+ CFrontend::Print8(buffer, 0.47f + 0.005f,0.03f + 0.005f, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::SetDrawRGBA(255,255,255,255);
+ CFrontend::Print8(buffer, 0.47f, 0.03f, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ }
+ }
if (m_active)
{
@@ -596,12 +637,12 @@ void eMenu::DrawMenu()
for (int i = 0; i < vCategories.size(); i++)
{
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(vCategories[i].strName.c_str(), 0.052f, 0.102f + 0.04 * i, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(vCategories[i].strName.c_str(), 0.052f, 0.102f + 0.04f * i, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
if (i == iCurrentCategory)
CFrontend::SetDrawRGBA(51, 153, 255, 255);
else
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(vCategories[i].strName.c_str(), 0.050f, 0.10f + 0.04 * i, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(vCategories[i].strName.c_str(), 0.050f, 0.10f + 0.04f * i, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
// draw sub items
if (vCategories[i].bHasItems && m_bCategoryOpen)
@@ -626,15 +667,16 @@ void eMenu::DrawMenu()
if (!vCategories[iCurrentCategory].bHaveBeenPagesCalculated)
{
+ const int weaponsPerPage = 14;
eMenuPage page;
int itemCounter = 0;
- int fullPages = vCategories[iCurrentCategory].vWeapons.size() / 15;
- int leftOver = vCategories[iCurrentCategory].vWeapons.size() % 15;
+ int fullPages = vCategories[iCurrentCategory].vWeapons.size() / weaponsPerPage;
+ int leftOver = vCategories[iCurrentCategory].vWeapons.size() % weaponsPerPage;
int lastEnd = 0;
page.iStart = 0;
for (int p = 0; p < vCategories[iCurrentCategory].vWeapons.size(); p++)
{
- if (itemCounter >= 15)
+ if (itemCounter >= weaponsPerPage)
{
page.iEnd = p;
page.iStart += lastEnd;
@@ -657,12 +699,12 @@ void eMenu::DrawMenu()
iActualItemID = j;
std::string entry = vCategories[i].vWeapons[j].name.c_str();
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04 * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04f * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
if ((j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)) == iCurrentItem)
CFrontend::SetDrawRGBA(51, 153, 255, 255);
else
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04 * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04f * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
}
if (vCategories[iCurrentCategory].vPages.size() > 1)
{
@@ -682,7 +724,7 @@ void eMenu::DrawMenu()
{
if (vCategories[i].vItems[j].bIsEntity)
{
- if (CEntityManager::GetEntityTypeDataFromName((char*)vCategories[i].vItems[j].strEntity.c_str()));
+ if (CEntityManager::GetEntityTypeDataFromName((char*)vCategories[i].vItems[j].strEntity.c_str()))
vTempEntities.push_back(vCategories[i].vItems[j]);
}
}
@@ -723,12 +765,12 @@ void eMenu::DrawMenu()
iActualItemID = j;
std::string entry = vCategories[i].vEntities[j].name.c_str();
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04 * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04f * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
if ((j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)) == iCurrentItem)
CFrontend::SetDrawRGBA(51, 153, 255, 255);
else
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04 * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04f * (j - (vCategories[iCurrentCategory].vPages[iCurrentPage].iStart)), 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
}
if (vCategories[iCurrentCategory].vPages.size() > 1)
{
@@ -803,12 +845,12 @@ void eMenu::DrawMenu()
entry.append(" >");
}
CFrontend::SetDrawRGBA(0, 0, 0, 255);
- CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04 * j, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.138f, 0.102f + 0.04f * j, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
if (j == iCurrentItem)
CFrontend::SetDrawRGBA(51, 153, 255, 255);
else
CFrontend::SetDrawRGBA(255, 255, 255, 255);
- CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04 * j, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
+ CFrontend::Print8(entry.c_str(), 0.136f, 0.10f + 0.04f * j, 0.6f, 0.6f, 0.0, FONT_TYPE_DEFAULT);
@@ -1016,6 +1058,7 @@ void PutBagOnPlayerHead()
{
CPed* ped = (CPed*)CScene::FindPlayer();
ped->ChangePedHead("Bag_Head");
+
}
void PlayerDropAllWeapons()
@@ -1053,7 +1096,7 @@ void PlayerDropAllWeapons()
void PrintEntities()
{
- int list = *(int*)0x69BBC4;
+ int list = *(int*)0x7917E8;
CEntity* entity;
do
{
@@ -1066,7 +1109,7 @@ void PrintEntities()
if (entity)
{
- TheConsole.m_messages.push_back(entity->m_pTypeData->m_szRecordName);
+ printf("%s\n", entity->m_szName);
}
} while (entity);
@@ -1078,11 +1121,17 @@ void PrintExecuteHunter()
CPlayer* plr = (CPlayer*)CScene::FindPlayer();
CEntity* hunt = *(CEntity**)((int)plr + 0x8B4);
if (hunt)
- printf("%x %s\n", hunt, hunt->m_pTypeData->m_szRecordName);
+ printf("%p %s\n", hunt, hunt->m_pTypeData->m_szRecordName);
else
printf("no execute\n");
}
+void PrintAchievementTest()
+{
+ if (!eAchievements::m_bWantsToPlayUnlock)
+ eAchievements::Start();
+}
+
void PlayAnim()
{
CFrontend::PrintDebugInfo(4, "Playing %d", TheMenu.m_animationID);
@@ -1095,6 +1144,56 @@ void PlayAnim()
}
+void ResetTimeStep()
+{
+ TheMenu.m_timestepval = CGameTime::ms_timeStep;
+}
+
+void CreateHood()
+{
+ MakeABodyguard("Hod_BodB1", CT_SHARD);
+}
+
+void CreateCop()
+{
+ MakeABodyguard("Cop_BodB1", CT_GLOCK);
+}
+
+void CreateCopShotgun()
+{
+ MakeABodyguard("Cop_BodS1", CT_SHOTGUN);
+}
+
+void CreateSwat()
+{
+ MakeABodyguard("Cop_BodM1", CT_UZI);
+}
+
+void CreateCerberusM16()
+{
+ MakeABodyguard("Cerberus", CT_COLT_COMMANDO);
+}
+
+void CreateCerberusDeagle()
+{
+ MakeABodyguard("Cerberus", CT_DESERT_EAGLE);
+}
+
+void CreateCerberusShotgun()
+{
+ MakeABodyguard("Cerberus", CT_SHOTGUN);
+}
+
+void CreateCerberusShotgunTorch()
+{
+ MakeABodyguard("Cerberus", CT_SHOTGUN_TORCH);
+}
+
+void CreateCerberusSniper()
+{
+ MakeABodyguard("Cerberus", CT_SNIPER_RIFLE);
+}
+
bool KeyHit(unsigned int keyCode)
{
if (IsWindowFocused() && CFrontend::m_gameIsRunning)
@@ -1111,3 +1210,18 @@ bool KeyHitOnce(unsigned int keyCode)
return false;
}
+void __declspec(naked) Hook_Timestep()
+{
+ static int jmp_continue = 0x4D88C4;
+ _asm pushad
+ if (TheMenu.m_slowmo)
+ CGameTime::ms_timeStep = TheMenu.m_timestepval;
+
+ _asm {
+ popad
+ add ds:0x75628C, 1
+ jmp jmp_continue
+ }
+
+}
+
diff --git a/source/code/plugin/menu/eMenu.h b/source/code/plugin/menu/eMenu.h
index 0423703..fd9c07c 100644
--- a/source/code/plugin/menu/eMenu.h
+++ b/source/code/plugin/menu/eMenu.h
@@ -92,6 +92,9 @@ class eMenu {
int m_obstructTest = 0;
int m_displayHunter = 0;
int m_animationID = 0;
+ int m_fireHead = 0;
+ int m_slowmo = 0;
+ int m_timestepval = 0;
int m_enableKillCounter = 0;
int m_infiniteAmmo = 0;
@@ -112,7 +115,6 @@ class eMenu {
- void PreInitialize();
void Initialize();
void ProcessMenu();
void ProcessControls();
@@ -161,12 +163,22 @@ void PutBagOnPlayerHead();
void PlayerDropAllWeapons();
void PrintEntities();
void PrintExecuteHunter();
-
+void PrintAchievementTest();
void PlayAnim();
-
-
+void ResetTimeStep();
+void CreateHood();
+void CreateCop();
+void CreateCopShotgun();
+void CreateSwat();
+void CreateCerberusM16();
+void CreateCerberusDeagle();
+void CreateCerberusShotgun();
+void CreateCerberusShotgunTorch();
+void CreateCerberusSniper();
extern eMenu TheMenu;
-bool KeyHit(unsigned int keyCode);
-bool KeyHitOnce(unsigned int keyCode);
\ No newline at end of file
+static bool KeyHit(unsigned int keyCode);
+static bool KeyHitOnce(unsigned int keyCode);
+
+void Hook_Timestep();
\ No newline at end of file
diff --git a/source/code/plugin/modloader/eCustomClumpDict.cpp b/source/code/plugin/modloader/eCustomClumpDict.cpp
index 7ac4bdb..6069b61 100644
--- a/source/code/plugin/modloader/eCustomClumpDict.cpp
+++ b/source/code/plugin/modloader/eCustomClumpDict.cpp
@@ -1,6 +1,7 @@
#include "eCustomClumpDict.h"
#include "..\..\manhunt\ClumpDict.h"
#include "..\..\manhunt\core.h"
+#include "..\..\manhunt\TexDictionary.h"
#include "..\eLog.h"
#include
@@ -12,12 +13,14 @@ CClump * eCustomClumpDict::FindClumpDescription(const char * name)
CClumpDict* dict = (CClumpDict*)this;
// custom dffs first
- for (int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
+ for (unsigned int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
{
clump = eCustomClumpDictManager::m_vecClumps[i]->FindClumpDescription(name);
if (clump)
+ {
+ eLog::Message(__FUNCTION__, "Loaded model %s!", name);
break;
-
+ }
}
@@ -39,16 +42,16 @@ CClump * eCustomClumpDict::FindClump(const char * name)
CClumpDict* dict = (CClumpDict*)this;
// custom dffs first
- for (int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
+ for (unsigned int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
{
clump = eCustomClumpDictManager::m_vecClumps[i]->FindClump(name);
if (clump)
+ {
+ eLog::Message(__FUNCTION__, "Loaded model %s!", name);
break;
-
+ }
}
-
-
if (!clump)
clump = dict->FindClump(name);
@@ -63,24 +66,51 @@ void eCustomClumpDict::Destroy()
CClumpDict* dict = (CClumpDict*)this;
dict->Destroy();
- for (int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
+ for (unsigned int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
eCustomClumpDictManager::m_vecClumps[i]->Destroy();
}
+int eCustomClumpDict::CustomUnkFunc(const char* name)
+{
+ int clump = 0;
+ CClumpDict* dict = (CClumpDict*)this;
+
+ // custom dffs first
+ for (unsigned int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
+ {
+ clump = eCustomClumpDictManager::m_vecClumps[i]->sub_59B860(name);
+ if (clump)
+ {
+ eLog::Message(__FUNCTION__, "Loaded model %s!", name);
+ break;
+ }
+ }
+
+ if (!clump)
+ clump = dict->sub_59B860(name);
+
+ if (!clump)
+ eLog::Message(__FUNCTION__, "Could not load model %s!", name);
+
+ return clump;
+}
+
void eCustomClumpDictManager::InitHooks()
{
- InjectHook(0x433A91, &eCustomClumpDict::FindClumpDescription, PATCH_CALL);
InjectHook(0x433BFF, &eCustomClumpDict::FindClumpDescription, PATCH_CALL);
InjectHook(0x433C10, &eCustomClumpDict::FindClumpDescription, PATCH_CALL);
-//
+
InjectHook(0x4F1239, &eCustomClumpDict::FindClump, PATCH_CALL);
- //InjectHook(0x4F1269, &eCustomClumpDict::FindClump, PATCH_CALL);
- //InjectHook(0x5CE2E1, &eCustomClumpDict::FindClump, PATCH_CALL);
- //InjectHook(0x5D0132, &eCustomClumpDict::FindClump, PATCH_CALL);
- //InjectHook(0x5D04D3, &eCustomClumpDict::FindClump, PATCH_CALL);
InjectHook(0x43797B, &eCustomClumpDict::Destroy, PATCH_CALL);
+
+ // skinned peds support
+ InjectHook(0x433B66, &eCustomClumpDict::CustomUnkFunc, PATCH_CALL);
+
+ // randomized textures from all dicts
+ InjectHook(0x49D162, &eCustomTexDict::FindNamedTexture, PATCH_CALL);
+ InjectHook(0x4F134A, &eCustomTexDict::FindNamedTexture, PATCH_CALL);
}
char * eCustomClumpDictManager::TranslateClumpPtr(int ptr)
@@ -121,3 +151,22 @@ int eCustomClumpDictManager::LoadDffBank(const char * name, int arg)
printf("Loading DFF: %s [%x]\n", name, dff);
return dff;
}
+
+int eCustomTexDict::FindNamedTexture(CClumpDict* dict, const char* name)
+{
+ int tex = 0;
+ // custom dffs first
+ for (unsigned int i = 0; i < eCustomClumpDictManager::m_vecClumps.size(); i++)
+ {
+ CClumpDict d = *eCustomClumpDictManager::m_vecClumps[i];
+ tex = CTexDictionary::FindNamedTexture((CClumpDict*)*(int*)eCustomClumpDictManager::m_vecClumps[i], name);
+ if (tex)
+ break;
+ }
+
+ if (!tex)
+ tex = CTexDictionary::FindNamedTexture(dict, name);
+
+
+ return tex;
+}
diff --git a/source/code/plugin/modloader/eCustomClumpDict.h b/source/code/plugin/modloader/eCustomClumpDict.h
index 249c0e0..4a3179d 100644
--- a/source/code/plugin/modloader/eCustomClumpDict.h
+++ b/source/code/plugin/modloader/eCustomClumpDict.h
@@ -17,7 +17,16 @@ class eCustomClumpDictManager {
class eCustomClumpDict {
public:
+
CClump* FindClumpDescription(const char* name);
CClump* FindClump(const char* name);
void Destroy();
+
+ int CustomUnkFunc(const char* name);
+};
+
+
+class eCustomTexDict {
+public:
+ static int FindNamedTexture(CClumpDict*dict, const char* name);
};
\ No newline at end of file
diff --git a/source/code/plugin/modloader/eModLoader.cpp b/source/code/plugin/modloader/eModLoader.cpp
index d014c3c..102400b 100644
--- a/source/code/plugin/modloader/eModLoader.cpp
+++ b/source/code/plugin/modloader/eModLoader.cpp
@@ -3,6 +3,8 @@
#include "..\..\core\FileFunctions.h"
#include "..\..\core\eMain.h"
#include "..\..\manhunt\core.h"
+#include "..\..\manhunt\String.h"
+#include "..\..\manhunt\EntityManager.h"
#include
#include
#include "..\eLog.h"
@@ -51,6 +53,7 @@ void eModLoader::InitClumpDicts()
dict->Initialise(possibleTXD.c_str(), m_vMods[i].files[a].c_str());
eLog::Message(__FUNCTION__, "Initialising custom clump [%x] %s [%s]", dict, m_vMods[i].files[a].c_str(), possibleTXD.c_str());
+ dict->CheckDict();
eCustomClumpDictManager::m_vecClumps.push_back(dict);
}
@@ -96,7 +99,7 @@ void eModLoader::ScanFolderForFiles(const char* folder)
std::vector tmp_files;
std::vector tmp_gfiles;
std::vector tmp_sfiles;
- for (int i = 0; i < m_vMods.size(); i++)
+ for (unsigned int i = 0; i < m_vMods.size(); i++)
{
std::filesystem::current_path(getExecutablePath_str());
std::filesystem::current_path(folder);
@@ -111,7 +114,7 @@ void eModLoader::ScanFolderForFiles(const char* folder)
char buffer[MAX_PATH];
sprintf(buffer, tmp.c_str());
- for (int i = 0; i < strlen(buffer); i++)
+ for (unsigned int i = 0; i < strlen(buffer); i++)
{
buffer[i] = tolower(buffer[i]);
}
@@ -155,7 +158,7 @@ void eModLoader::ScanFolderForFiles(const char* folder)
if (szLine[0] == ';' || szLine[0] == '\n' || szLine[0] == '#')
continue;
- for (int i = 0; i < strlen(szLine); i++)
+ for (unsigned int i = 0; i < strlen(szLine); i++)
szLine[i] = tolower(szLine[i]);
std::string name(szLine, strlen(szLine) - sizeof('\n') - 1);
@@ -179,13 +182,13 @@ char * eModLoader::FindFile(char * input)
input = tmpBuff;
}
- for (int i = 0; i < strlen(input); i++)
+ for (unsigned int i = 0; i < strlen(input); i++)
{
if (input[i] == '/')
input[i] = '\\';
}
- for (int i = 0; i < strlen(input); i++)
+ for (unsigned int i = 0; i < strlen(input); i++)
input[i] = tolower(input[i]);
// check file
@@ -195,9 +198,9 @@ char * eModLoader::FindFile(char * input)
if (IsFileIgnored(file))
return result;
- for (int i = 0; i < m_vMods.size(); i++)
+ for (unsigned int i = 0; i < m_vMods.size(); i++)
{
- for (int a = 0; a < m_vMods[i].files.size(); a++)
+ for (unsigned int a = 0; a < m_vMods[i].files.size(); a++)
{
if (strcmp(m_vMods[i].files_game[a].c_str(), input) == 0)
@@ -230,13 +233,13 @@ bool eModLoader::CustomFileExists(char * input)
sprintf(result, tmpBuff);
}
- for (int i = 0; i < strlen(result); i++)
+ for (unsigned int i = 0; i < strlen(result); i++)
{
if (result[i] == '/')
result[i] = '\\';
}
- for (int i = 0; i < strlen(result); i++)
+ for (unsigned int i = 0; i < strlen(result); i++)
result[i] = tolower(result[i]);
// check file
@@ -246,9 +249,9 @@ bool eModLoader::CustomFileExists(char * input)
if (IsFileIgnored(file))
return false;
- for (int i = 0; i < m_vMods.size(); i++)
+ for (unsigned int i = 0; i < m_vMods.size(); i++)
{
- for (int a = 0; a < m_vMods[i].files.size(); a++)
+ for (unsigned int a = 0; a < m_vMods[i].files.size(); a++)
{
if (strcmp(m_vMods[i].files_game[a].c_str(), result) == 0)
{
@@ -263,7 +266,7 @@ bool eModLoader::CustomFileExists(char * input)
bool eModLoader::IsFileIgnored(std::string & name)
{
bool result = false;
- for (int i = 0; i < ignoredFiles.size(); i++)
+ for (unsigned int i = 0; i < ignoredFiles.size(); i++)
{
if (strcmp(name.c_str(), ignoredFiles[i].c_str()) == 0)
{
@@ -272,6 +275,4 @@ bool eModLoader::IsFileIgnored(std::string & name)
}
}
return result;
-}
-
-
+}
\ No newline at end of file
diff --git a/source/code/plugin/modloader/eModLoader.h b/source/code/plugin/modloader/eModLoader.h
index d8d51cb..453f123 100644
--- a/source/code/plugin/modloader/eModLoader.h
+++ b/source/code/plugin/modloader/eModLoader.h
@@ -5,6 +5,8 @@
#include "..\..\manhunt\Misc.h"
+#define EXTRATYPEDATA_EXTENSION ".eini"
+
struct file_entry {
char path[MAX_PATH];
};
@@ -31,4 +33,6 @@ class eModLoader {
static CFile* LoadFile(char* fileName, int* fileBuffer, int* arg3, CFile** pFile, int* fileSize);
static bool CustomFileExists(char* input);
static bool IsFileIgnored(std::string& name);
-};
\ No newline at end of file
+
+};
+
diff --git a/source/code/plugin/script/eScriptExtender.cpp b/source/code/plugin/script/eScriptExtender.cpp
index 2b14e15..4dfe0da 100644
--- a/source/code/plugin/script/eScriptExtender.cpp
+++ b/source/code/plugin/script/eScriptExtender.cpp
@@ -44,11 +44,11 @@ void eScriptExtender::ProcessNewCommands()
CEntity* ent;
switch (m_commandID)
{
- case PushMessage:
+ case NC_PushMessage:
PopInt();
printf("%s\n", PopCharStar());
break;
- case WriteMemory:
+ case NC_WriteMemory:
value =PopInt();
size = PopInt();
addr = PopInt();
@@ -64,11 +64,11 @@ void eScriptExtender::ProcessNewCommands()
Memory::VP::Patch(addr, value);
break;
default:
- eLog::Message(__FUNCTION__, "Command %d | Invalid size (%d)! ", WriteMemory, size);
+ eLog::Message(__FUNCTION__, "Command %d | Invalid size (%d)! ", NC_WriteMemory, size);
break;
}
break;
- case ReadMemory:
+ case NC_ReadMemory:
size = PopInt();
addr = PopInt();
@@ -84,18 +84,18 @@ void eScriptExtender::ProcessNewCommands()
retn = *(int*)(addr);
break;
default:
- eLog::Message(__FUNCTION__, "Command %d | Invalid size (%d)! Returning 0", ReadMemory, size);
+ eLog::Message(__FUNCTION__, "Command %d | Invalid size (%d)! Returning 0", NC_ReadMemory, size);
retn = 0;
break;
}
m_returnValue = retn;
break;
- case KeyHit:
+ case NC_KeyHit:
int key;
key = PopInt();
m_returnValue = GetAsyncKeyState(key);
break;
- case SetEntityFlag:
+ case NC_SetEntityFlag:
int flag, status;
status = PopInt();
@@ -105,9 +105,9 @@ void eScriptExtender::ProcessNewCommands()
if (ent)
ent->SetFlag(flag, status);
else
- eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", SetEntityFlag);
+ eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", NC_SetEntityFlag);
break;
- case SetPedHead:
+ case NC_SetPedHead:
char* headName;
PopInt();
@@ -120,9 +120,9 @@ void eScriptExtender::ProcessNewCommands()
ped->ChangePedHead(headName);
}
else
- eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", SetPedHead);
+ eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", NC_SetPedHead);
break;
- case PedPlayAnim:
+ case NC_PedPlayAnim:
int animID;
@@ -137,7 +137,7 @@ void eScriptExtender::ProcessNewCommands()
body->Update(0);
}
else
- eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", PedPlayAnim);
+ eLog::Message(__FUNCTION__, "Command %d | Invalid entity!", NC_PedPlayAnim);
break;
default:
return;
diff --git a/source/code/plugin/script/eScriptExtender.h b/source/code/plugin/script/eScriptExtender.h
index 9a633ad..9cb70b8 100644
--- a/source/code/plugin/script/eScriptExtender.h
+++ b/source/code/plugin/script/eScriptExtender.h
@@ -4,14 +4,14 @@
#include
enum eNewCommands {
- PushMessage = 1001,
- WriteMemory,
- ReadMemory,
- KeyHit,
- SetEntityFlag,
- SetPedHead,
- PedPlayAnim,
- TOTAL_NEW_SCRIPT_COMMANDS
+ NC_PushMessage = 1001,
+ NC_WriteMemory,
+ NC_ReadMemory,
+ NC_KeyHit,
+ NC_SetEntityFlag,
+ NC_SetPedHead,
+ NC_PedPlayAnim,
+ TOTAL_NEW_SCRIPT_COMMANDS
};
class eScriptExtender : public CScriptVM {
diff --git a/source/code/plugin/weapon_adjuster/eWeaponAdjuster.cpp b/source/code/plugin/weapon_adjuster/eWeaponAdjuster.cpp
index 05bad8d..b86d5ca 100644
--- a/source/code/plugin/weapon_adjuster/eWeaponAdjuster.cpp
+++ b/source/code/plugin/weapon_adjuster/eWeaponAdjuster.cpp
@@ -12,6 +12,7 @@
#include
eWeaponEntry eWeaponAdjuster::m_vWeapons[TOTAL_COLLECTABLES];
+bool eWeaponAdjuster::ms_bShouldDecapHead = false;
void eWeaponAdjuster::InitHooks()
{
@@ -113,7 +114,7 @@ eCollectableType eWeaponAdjuster::GetTypeFromStr(char * string)
"CT_D_HUNTLORD","CT_E_L_SIGHT","CT_S_SILENCER","CT_RADIO","CT_BAR_KEY","CT_SYARD_COMB","CT_CAMERA",
"CT_BODY_P1","CT_BODY_P2","CT_PREC_KEY","CT_PREC_CARD","CT_PREC_DOCS","CT_PHARM_HAND",
"CT_EST_G_KEY","CT_EST_A_KEY","CT_DOLL","CT_ANTIDOTE","CT_KEY","CT_SWIPE_CARD","null","null","null","CT_CHAINSAW",
- "CT_NAILGUN","CT_WIRE","CT_CAN","CT_WOODEN_SPIKE","null","CT_PIGSY_SHARD","CT_PIGSY_WIRE","CT_PIGSY_SPIKE","CT_HAMMER",
+ "CT_NAILGUN","CT_WIRE","CT_CAN","CT_WOODEN_SPIKE","CT_SNIPER_RIFLE_SILENCED","CT_PIGSY_SHARD","CT_PIGSY_WIRE","CT_PIGSY_SPIKE","CT_HAMMER",
"CT_DOLL_1","CT_DOLL_2","CT_DOLL_3","CT_HEAD","CT_AMMO_NAILS","CT_AMMO_SHOTGUN","CT_AMMO_PISTOL",
"CT_AMMO_MGUN", "CT_AMMO_TRANQ","CT_AMMO_SNIPER","CT_CHAINSAW_PLAYER","CT_DVTAPE","CT_HANDYCAM"
};
@@ -186,6 +187,15 @@ void __declspec(naked) eWeaponAdjuster::CPed_SetShotDamageStates_ExplodeHead_Mel
if (m_vWeapons[id_melee].m_nType > 0 && m_vWeapons[id_melee].m_iFlags & EXPLODE_HEAD_BODY)
{
+ ms_bShouldDecapHead = false;
+ _asm {
+ popad
+ jmp jmpTrue_melee
+ }
+ }
+ else if (m_vWeapons[id_melee].m_nType > 0 && m_vWeapons[id_melee].m_iFlags & DECAP_HEAD)
+ {
+ ms_bShouldDecapHead = true;
_asm {
popad
jmp jmpTrue_melee
diff --git a/source/code/plugin/weapon_adjuster/eWeaponAdjuster.h b/source/code/plugin/weapon_adjuster/eWeaponAdjuster.h
index e1304c8..66651e6 100644
--- a/source/code/plugin/weapon_adjuster/eWeaponAdjuster.h
+++ b/source/code/plugin/weapon_adjuster/eWeaponAdjuster.h
@@ -2,6 +2,7 @@
#include "..\..\manhunt\Collectable.h"
#include "..\..\manhunt\Anim.h"
#include "..\..\manhunt\AnimID.h"
+#include "..\..\manhunt\Decal.h"
#include
enum eWeaponFlags {
@@ -10,7 +11,8 @@ enum eWeaponFlags {
EXPLODE_HEAD_BODY = 4,
FIREARM_SILENCED = 8,
FIREARM_SCOPE = 16,
- FIREARM_LASER = 32
+ FIREARM_LASER = 32,
+ DECAP_HEAD = 64
};
struct eWeaponEntry {
@@ -40,6 +42,8 @@ class eWeaponAdjuster {
static eWeaponEntry GetWeapon(int type);
static eCollectableType GetTypeFromStr(char* string);
+ static bool ms_bShouldDecapHead;
+
static eExecuteAnimClass GetExecutionTypeFromString(char* string);
static int __fastcall CCollectable_IsSniperRifle(int ptr);
diff --git a/source/dllmain.cpp b/source/dllmain.cpp
index 6712403..5987747 100644
--- a/source/dllmain.cpp
+++ b/source/dllmain.cpp
@@ -18,6 +18,8 @@
#include "code/manhunt/core.h"
#include "code/plugin/eQoLChanges.h"
#include "code/manhunt/Renderer.h"
+#include "code/manhunt/Scene.h"
+#include "code/manhunt/Player.h"
#include "code/manhunt/Frontend.h"
#include "code/plugin/eSkinLoader.h"
#include "code/plugin/eMapLimits.h"
@@ -28,7 +30,8 @@
#include "code/plugin/script/eScriptExtender.h"
#include "code/manhunt/Inventory.h"
#include "code/plugin/classes/eCustomPed.h"
-
+#include "code/plugin/menu/eMenu.h"
+#include "code/plugin/eLaserSights.h"
using namespace Memory::VP;
@@ -36,7 +39,6 @@ int GenericTrueReturn() { return 1; }
int GenericFalseReturn() { return 0; }
void GenericDummy() { }
-
void Init()
{
eSettingsManager::Init();
@@ -78,7 +80,8 @@ void Init()
DoCommonPatches();
eStatsManager::Initialize();
eNewFrontend::Init();
-
+ Nop(0x4D88BD, 7);
+ InjectHook(0x4D88BD, Hook_Timestep, PATCH_JUMP);
eCustomTableOfContents::InitHooks();
if (eSettingsManager::bHookCustomAnimManager)
CCustomAnimManager::InitHooks();
@@ -94,8 +97,6 @@ void Init()
Patch(0x460545, 0x00000000);
// lock arms for player only
- // filtering only player fixes a bug where peds
- // wouldn't move torso while aiming
InjectHook(0x4AB54D, CommonHooks::ArmsPosition_PlayerFPS, PATCH_JUMP);
// disable resetting camera on x press
@@ -109,6 +110,8 @@ void Init()
if (eSettingsManager::bHookExtraScriptCommands)
eScriptExtender::InitHooks();
+ //eLaserSights::Initialize();
+
InjectHook(0x5E279F, MainHooks::HookWndProc, PATCH_CALL);
eLog::Message(__FUNCTION__, "PluginMH initialized!");
diff --git a/source/resource.h b/source/resource.h
index 30f8bb8..00f36d1 100644
--- a/source/resource.h
+++ b/source/resource.h
@@ -18,7 +18,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
-#define VERSION_REVISION 8
+#define VERSION_REVISION 9
#define DEF_TO_STR(a) #a