Refactor
This commit is contained in:
parent
d0434379d3
commit
d6e9eb5f80
42
README.md
42
README.md
@ -1,6 +1,6 @@
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/logo.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/logo.png">
|
||||
</p>
|
||||
<p align="center">
|
||||
Press <kbd>Left Ctrl</kbd> + <kbd>M</kbd> to open the menu. Doesn't work in multiplayer
|
||||
@ -56,25 +56,25 @@ You can either open a issue here or directly contact me on discord (Recommended)
|
||||
## Images
|
||||
<details>
|
||||
<summary>Show Images</summary>
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/1.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/2.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/3.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/4.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/5.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/6.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/7.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/8.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/9.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/10.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/11.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/12.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/13.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/14.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/15.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/16.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/17.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/18.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/rewrite/images/19.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/1.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/2.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/3.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/4.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/5.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/6.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/7.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/8.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/9.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/10.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/11.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/12.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/13.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/14.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/15.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/16.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/17.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/18.png">
|
||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/19.png">
|
||||
</details>
|
||||
|
||||
## Submit Translations
|
||||
@ -82,7 +82,7 @@ You can either open a issue here or directly contact me on discord (Recommended)
|
||||
|
||||
The translations are loaded from `CheatMenuXX/locale/*.toml` files. Make a copy of the `English.toml` file and translate the texts there to your language. Rename the file to `your_language.toml` and make a pull request.
|
||||
|
||||
If you're language isn't supported ( Appears `???` in the menu. Check [here](https://github.com/user-grinch/Cheat-Menu/tree/rewrite/tools/subset/in.txt) for supported languages), open a [issue](https://github.com/user-grinch/Cheat-Menu/issues) asking for support.
|
||||
If you're language isn't supported ( Appears `???` in the menu. Check [here](https://github.com/user-grinch/Cheat-Menu/tree/master/tools/subset/in.txt) for supported languages), open a [issue](https://github.com/user-grinch/Cheat-Menu/issues) asking for support.
|
||||
|
||||
|
||||
## Required to build
|
||||
|
@ -109,6 +109,7 @@ RandomCheats = "Random cheats"
|
||||
Sandstorm = "Sandstorm"
|
||||
SaveGame = "Save game (might cause game bugs)"
|
||||
Screenshot = "Screenshot shortcut"
|
||||
ScreenshotTip = "Take screenshot using"
|
||||
ScreenshotTaken = "Screenshot taken"
|
||||
SelectCheats = "Select cheats"
|
||||
SelectDay = "Select day"
|
||||
@ -249,7 +250,7 @@ EveryoneAtk = "Everyone attacks players"
|
||||
ExGangWarsTip = "You'll need ExGangWars plugin to display some turf colors"
|
||||
GangsControl = "Gangs control streets"
|
||||
GangsEverywhere = "Gangs everywhere"
|
||||
GangWars = "Gang wars"
|
||||
GangWars = "Gangs"
|
||||
Health = "Health"
|
||||
MaxLimit = "Max limit reached"
|
||||
NastyLimbs = "Nasty limbs"
|
||||
@ -273,7 +274,7 @@ SpawnerTab = "Spawner"
|
||||
StartWar = "Start gang war"
|
||||
ThinBody = "Thin body effect"
|
||||
WeaponAll = "Weapons for all"
|
||||
ZoneDensity = "Gang zone density:"
|
||||
ZoneDensity = "Gang zone density (0-127):"
|
||||
|
||||
[Player]
|
||||
AimSkinChanger = "Aim skin changer"
|
||||
|
@ -3,23 +3,24 @@
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef GTASA
|
||||
#ifdef GTA3
|
||||
#include <RpAnimBlend.h>
|
||||
#include <CAnimationStyleDescriptor.h>
|
||||
#include <CAnimManager.h>
|
||||
#include "eAnimations.h"
|
||||
#include <CAnimBlendAssociation.h>
|
||||
|
||||
#elif GTAVC
|
||||
|
||||
#include "../depend/kiero/minhook/MinHook.h"
|
||||
#include <CAnimationStyleDescriptor.h>
|
||||
#include <CAnimManager.h>
|
||||
#include "eAnimations.h"
|
||||
#include <CAnimBlendAssociation.h>
|
||||
#endif
|
||||
|
||||
#ifdef GTA3
|
||||
#include <RpAnimBlend.h>
|
||||
#endif
|
||||
|
||||
#ifdef GTAVC
|
||||
#include "../depend/kiero/minhook/MinHook.h"
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
void Cutscene::Play(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
{
|
||||
if (Util::IsOnCutscene())
|
||||
{
|
||||
@ -30,15 +31,15 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
if (pPlayer)
|
||||
{
|
||||
Cutscene::m_SceneName = cutsceneId;
|
||||
m_SceneName = cutsceneId;
|
||||
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
|
||||
Cutscene::m_nInterior = pPlayer->m_nAreaCode;
|
||||
m_nInterior = pPlayer->m_nAreaCode;
|
||||
pPlayer->m_nAreaCode = std::stoi(interior);
|
||||
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::PlayParticle(std::string& rootKey, std::string& particle, std::string& dummy)
|
||||
void Particle::Play(std::string& rootKey, std::string& particle, std::string& dummy)
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
if (pPlayer)
|
||||
@ -47,12 +48,12 @@ void Animation::PlayParticle(std::string& rootKey, std::string& particle, std::s
|
||||
int handle;
|
||||
Command<Commands::CREATE_FX_SYSTEM>(particle.c_str(), pos.x, pos.y, pos.z, 1, &handle);
|
||||
Command<Commands::PLAY_FX_SYSTEM>(handle);
|
||||
Particle::m_nParticleList.push_back(handle);
|
||||
m_nParticleList.push_back(handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Animation::RemoveParticle(std::string& ifp, std::string& particle, std::string& dummy)
|
||||
void Particle::Remove(std::string& ifp, std::string& particle, std::string& dummy)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
@ -67,8 +68,8 @@ void Animation::RemoveParticle(std::string& ifp, std::string& particle, std::str
|
||||
}
|
||||
|
||||
#elif GTAVC
|
||||
// Thanks to codenulls(https://github.com/codenulls/)
|
||||
|
||||
// Thanks to codenulls(https://github.com/codenulls/)
|
||||
static auto OLD_CStreaming_RemoveModel = (bool(__cdecl*)(int))0x40D6E0;
|
||||
static bool NEW_CStreaming_RemoveModel(int modelID)
|
||||
{
|
||||
@ -81,7 +82,30 @@ static bool NEW_CStreaming_RemoveModel(int modelID)
|
||||
return OLD_CStreaming_RemoveModel(modelID);
|
||||
}
|
||||
|
||||
void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend)
|
||||
bool _LoadAnimationBlock(const char* szBlockName)
|
||||
{
|
||||
CAnimBlock* pAnimBlock = CAnimManager::GetAnimationBlock(szBlockName);
|
||||
if (pAnimBlock)
|
||||
{
|
||||
if (!pAnimBlock->bLoaded)
|
||||
{
|
||||
int animIndex = ((unsigned char*)pAnimBlock - (unsigned char*)CAnimManager::ms_aAnimBlocks) / 32;
|
||||
CStreaming::RequestModel(7916 + animIndex, 0x20 | MISSION_REQUIRED | PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
if (pAnimBlock->bLoaded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void _PlayAnim(RpClump* pClump, int animGroup, int animID, float blend, bool loop, bool secondary)
|
||||
{
|
||||
if (animGroup < CAnimManager::ms_numAnimAssocDefinitions)
|
||||
{
|
||||
@ -109,42 +133,20 @@ void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float
|
||||
pAnimAssoc = CAnimManager::BlendAnimation(pClump, animGroup, animID, blend);
|
||||
pAnimAssoc->m_nFlags = ANIMATION_STARTED | ANIMATION_MOVEMENT;
|
||||
|
||||
if (m_Loop)
|
||||
if (loop)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= ANIMATION_LOOPED;
|
||||
}
|
||||
|
||||
if (m_bSecondary)
|
||||
if (secondary)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= ANIMATION_PARTIAL;
|
||||
}
|
||||
}
|
||||
|
||||
bool Animation::_LoadAnimationBlock(const char* szBlockName)
|
||||
{
|
||||
CAnimBlock* pAnimBlock = CAnimManager::GetAnimationBlock(szBlockName);
|
||||
if (pAnimBlock)
|
||||
{
|
||||
if (!pAnimBlock->bLoaded)
|
||||
{
|
||||
int animIndex = ((unsigned char*)pAnimBlock - (unsigned char*)CAnimManager::ms_aAnimBlocks) / 32;
|
||||
CStreaming::RequestModel(7916 + animIndex, 0x20 | MISSION_REQUIRED | PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
if (pAnimBlock->bLoaded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
|
||||
void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend)
|
||||
void _PlayAnim(RpClump* pClump, int animGroup, int animID, float blend, bool loop, bool secondary)
|
||||
{
|
||||
CAnimBlendAssociation* pAnimStaticAssoc = CAnimManager::GetAnimAssociation(animGroup, animID);
|
||||
CAnimBlendAssociation* pAnimAssoc = RpAnimBlendClumpGetFirstAssociation(pClump);
|
||||
@ -161,23 +163,21 @@ void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float
|
||||
pAnimAssoc = CAnimManager::BlendAnimation(pClump, animGroup, animID, blend);
|
||||
pAnimAssoc->m_nFlags = 0x1 | 0x20;
|
||||
|
||||
if (m_Loop)
|
||||
if (loop)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= 0x2;
|
||||
}
|
||||
|
||||
if (m_bSecondary)
|
||||
if (secondary)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= 0x10;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& _)
|
||||
void Animation::Play(std::string& ifp, std::string& anim, std::string& _)
|
||||
{
|
||||
CPed *pPed = m_PedAnim ? m_pTarget : FindPlayerPed();
|
||||
|
||||
if (!pPed)
|
||||
{
|
||||
return;
|
||||
@ -208,15 +208,26 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
|
||||
}
|
||||
|
||||
#else
|
||||
if (pPed)
|
||||
{
|
||||
int groupID, animID;
|
||||
sscanf(ifp.c_str(), "%d$%d,", &groupID, &animID);
|
||||
_PlayAnimation(pPed->m_pRwClump, groupID, animID, 4.0f);
|
||||
}
|
||||
_PlayAnim(pPed->m_pRwClump, groupID, animID, 4.0f, m_Loop, m_bSecondary);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Animation::Remove(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
m_AnimData.m_pData->RemoveKey("Custom", anim.c_str());
|
||||
m_AnimData.m_pData->Save();
|
||||
SetHelpMessage(TEXT("Animation.AnimationRemoved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetHelpMessage(TEXT("Animation.CustomAnimsOnly"));
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::Init()
|
||||
{
|
||||
#ifdef GTASA
|
||||
@ -291,7 +302,7 @@ void Animation::ShowPage()
|
||||
#ifdef GTASA
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hPlayer);
|
||||
#else
|
||||
_PlayAnimation(pPlayer->m_pRwClump, ANIM_GROUP_MAN, ANIM_MAN_IDLE_STANCE, 4.0f);
|
||||
_PlayAnim(pPlayer->m_pRwClump, ANIM_GROUP_MAN, ANIM_MAN_IDLE_STANCE, 4.0f, m_Loop, m_bSecondary);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -315,13 +326,16 @@ void Animation::ShowPage()
|
||||
{
|
||||
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
||||
{
|
||||
ImGui::InputTextWithHint(TEXT("Animation.IFPName"), "ped", m_nIfpBuffer, INPUT_BUFFER_SIZE);
|
||||
ImGui::InputTextWithHint(TEXT("Animation.AnimName"), "cower", m_nAnimBuffer, INPUT_BUFFER_SIZE);
|
||||
static char animBuf[INPUT_BUFFER_SIZE];
|
||||
static char ifpBuf[INPUT_BUFFER_SIZE];
|
||||
|
||||
ImGui::InputTextWithHint(TEXT("Animation.IFPName"), "ped", ifpBuf, INPUT_BUFFER_SIZE);
|
||||
ImGui::InputTextWithHint(TEXT("Animation.AnimName"), "cower", animBuf, INPUT_BUFFER_SIZE);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Animation.AddAnimation"), Ui::GetSize()))
|
||||
{
|
||||
std::string key = std::string("Custom.") + m_nAnimBuffer;
|
||||
m_AnimData.m_pData->Set(key.c_str(), std::string(m_nIfpBuffer));
|
||||
std::string key = std::string("Custom.") + animBuf;
|
||||
m_AnimData.m_pData->Set(key.c_str(), std::string(ifpBuf));
|
||||
m_AnimData.m_pData->Save();
|
||||
}
|
||||
}
|
||||
@ -330,7 +344,7 @@ void Animation::ShowPage()
|
||||
if (ImGui::BeginChild("Anims Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawList(m_AnimData, PlayAnimation, RemoveAnimation);
|
||||
Ui::DrawList(m_AnimData, Play, Remove);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
@ -359,7 +373,7 @@ void Animation::ShowPage()
|
||||
if (ImGui::BeginChild("Cutscene Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawList(Cutscene::m_Data, PlayCutscene, nullptr);
|
||||
Ui::DrawList(Cutscene::m_Data, Cutscene::Play, nullptr);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -389,11 +403,12 @@ void Animation::ShowPage()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
||||
{
|
||||
ImGui::InputTextWithHint(TEXT("Animation.ParticleName"), "kkjj_on_fire", Particle::m_NameBuffer, INPUT_BUFFER_SIZE);
|
||||
static char buf[INPUT_BUFFER_SIZE];
|
||||
ImGui::InputTextWithHint(TEXT("Animation.ParticleName"), "kkjj_on_fire", buf, INPUT_BUFFER_SIZE);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Animation.AddParticle"), Ui::GetSize()))
|
||||
{
|
||||
std::string key = std::string("Custom.") + Particle::m_NameBuffer;
|
||||
std::string key = std::string("Custom.") + buf;
|
||||
m_AnimData.m_pData->Set(key.c_str(), std::string("Dummy"));
|
||||
Particle::m_Data.m_pData->Save();
|
||||
}
|
||||
@ -402,7 +417,7 @@ void Animation::ShowPage()
|
||||
if (ImGui::BeginChild("Anims Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawList(Particle::m_Data, PlayParticle, RemoveParticle);
|
||||
Ui::DrawList(Particle::m_Data, Particle::Play, Particle::Remove);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -410,14 +425,25 @@ void Animation::ShowPage()
|
||||
if (ImGui::BeginTabItem(TEXT("Animation.Styles")))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (Ui::ListBox(TEXT("Animation.FightingStyle"), m_FightingStyleList, m_nFightingStyle))
|
||||
|
||||
static int fightStyle;
|
||||
static const char* fightStyles = "Default\0Boxing\0Kung Fu\0Kick Boxing\0Punch Kick\0";
|
||||
static std::string walkStyle = "default";
|
||||
static std::vector<std::string> walkStyles =
|
||||
{
|
||||
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, m_nFightingStyle + 4, 6);
|
||||
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",
|
||||
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate"
|
||||
};
|
||||
|
||||
if (ImGui::Combo(TEXT("Animation.FightingStyle"), &fightStyle, fightStyles))
|
||||
{
|
||||
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, fightStyle + 4, 6);
|
||||
SetHelpMessage(TEXT("Animation.FightingStyleSet"));
|
||||
}
|
||||
if (Ui::ListBoxStr(TEXT("Animation.WalkingStyle"), m_WalkingStyleList, m_nWalkingStyle))
|
||||
if (Ui::ListBoxStr(TEXT("Animation.WalkingStyle"), walkStyles, walkStyle))
|
||||
{
|
||||
if (m_nWalkingStyle == "default")
|
||||
if (walkStyle == "default")
|
||||
{
|
||||
patch::Set<DWORD>(0x609A4E, 0x4D48689);
|
||||
patch::Set<WORD>(0x609A52, 0);
|
||||
@ -425,10 +451,10 @@ void Animation::ShowPage()
|
||||
else
|
||||
{
|
||||
patch::Nop(0x609A4E, 6);
|
||||
Command<Commands::REQUEST_ANIMATION>(m_nWalkingStyle.c_str());
|
||||
Command<Commands::REQUEST_ANIMATION>(walkStyle.c_str());
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, m_nWalkingStyle.c_str());
|
||||
Command<Commands::REMOVE_ANIMATION>(m_nWalkingStyle.c_str());
|
||||
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, walkStyle.c_str());
|
||||
Command<Commands::REMOVE_ANIMATION>(walkStyle.c_str());
|
||||
}
|
||||
SetHelpMessage(TEXT("Animation.WalkingStyleSet"));
|
||||
}
|
||||
@ -438,17 +464,3 @@ void Animation::ShowPage()
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
m_AnimData.m_pData->RemoveKey("Custom", anim.c_str());
|
||||
m_AnimData.m_pData->Save();
|
||||
SetHelpMessage(TEXT("Animation.AnimationRemoved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetHelpMessage(TEXT("Animation.CustomAnimsOnly"));
|
||||
}
|
||||
}
|
@ -1,60 +1,40 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
#ifdef GTASA
|
||||
class Cutscene
|
||||
{
|
||||
public:
|
||||
static inline ResourceStore m_Data{ "cutscenes", eResourceType::TYPE_TEXT };
|
||||
static inline std::string m_SceneName;
|
||||
static inline int m_nInterior; // player interior backup
|
||||
static inline bool m_bRunning;
|
||||
|
||||
static void Play(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
};
|
||||
|
||||
class Particle
|
||||
{
|
||||
public:
|
||||
static inline ResourceStore m_Data{ "particles", eResourceType::TYPE_TEXT };
|
||||
static inline std::vector<int> m_nParticleList;
|
||||
|
||||
static void Play(std::string& rootKey, std::string& particle, std::string& dummy);
|
||||
static void Remove(std::string& ifp, std::string& anim, std::string& ifpRepeat);
|
||||
};
|
||||
#endif
|
||||
|
||||
class Animation
|
||||
{
|
||||
private:
|
||||
// Animation player
|
||||
static inline ResourceStore m_AnimData{ "animations", eResourceType::TYPE_TEXT };
|
||||
static inline char m_nAnimBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline char m_nIfpBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline bool m_Loop; // loop animation
|
||||
static inline bool m_bSecondary; // play animation as secondary
|
||||
static inline bool m_PedAnim;
|
||||
static inline CPed *m_pTarget = nullptr;
|
||||
|
||||
#ifdef GTASA
|
||||
// Cutscene player
|
||||
struct Cutscene
|
||||
{
|
||||
static inline ResourceStore m_Data{ "cutscenes", eResourceType::TYPE_TEXT };
|
||||
static inline std::string m_SceneName;
|
||||
static inline int m_nInterior; // player interior backup
|
||||
static inline bool m_bRunning;
|
||||
};
|
||||
|
||||
static inline int m_nFightingStyle;
|
||||
static inline std::string m_nWalkingStyle = "default";
|
||||
static inline std::vector<std::string> m_FightingStyleList =
|
||||
{ "Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick" };
|
||||
static inline std::vector<std::string> m_WalkingStyleList =
|
||||
{
|
||||
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",
|
||||
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate"
|
||||
};
|
||||
|
||||
// Particle player
|
||||
struct Particle
|
||||
{
|
||||
static inline ResourceStore m_Data{ "particles", eResourceType::TYPE_TEXT };
|
||||
static inline char m_NameBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline std::vector<int> m_nParticleList;
|
||||
};
|
||||
#endif
|
||||
|
||||
static void PlayAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void RemoveAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void RemoveParticle(std::string& ifp, std::string& anim, std::string& ifpRepeat);
|
||||
#ifdef GTASA
|
||||
static void PlayParticle(std::string& rootKey, std::string& particle, std::string& dummy);
|
||||
static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
#elif GTAVC
|
||||
static bool _LoadAnimationBlock(const char* szBlockName);
|
||||
#endif
|
||||
#ifndef GTASA
|
||||
static void _PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend);
|
||||
#endif
|
||||
static void Play(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void Remove(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
|
||||
public:
|
||||
Animation() = delete;
|
||||
|
@ -63,7 +63,7 @@ void CheatMenu::DrawWindow()
|
||||
#ifdef GTASA
|
||||
else
|
||||
{
|
||||
Menu::DrawShortcutsWindow();
|
||||
Menu::DrawCommandWindow();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -261,54 +261,11 @@ void CheatMenu::Init()
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* YIKES YOU AREN"T SUPPOSED TO FIND THIS!!!
|
||||
* Probably a good easter egg for the upcoming anniversary ;)
|
||||
*/
|
||||
void CheatMenu::ShowAnniversaryPage()
|
||||
{
|
||||
Ui::CenterdText("Happy Anniversary!");
|
||||
ImGui::NewLine();
|
||||
|
||||
static bool showHistory;
|
||||
if (showHistory)
|
||||
{
|
||||
ImGui::Checkbox("Show backstory", &showHistory);
|
||||
ImGui::BeginChild("BACKSTORY");
|
||||
ImGui::TextWrapped("I wanted to share the backstory behind the initial idea or planning behind the menu."
|
||||
" This is gonna be long so feel free to skip it if you're not interested.");
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::TextWrapped("The original idea of the menu comes way back from 2016! The inspiration for the menu"
|
||||
" is from the 'CLEO CheatMenu by UNRATED69'. I wanted something that had more features and worked with SAxVCxLC."
|
||||
" But there wasn't any other CheatMenu's back then. So, I wanted to create one myself but lacked the knowledge to do so.");
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::TextWrapped("In 2018, I finally got an opportunity to learn CLEO or GTA3Script after Junior-Djjr released"
|
||||
" his tutorial. I started from basics but it soon became apparent that due to the limitations of CLEO, creating menus were"
|
||||
" really tedious.");
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("Later that year I found Moonloader, which had ImGui support. Meaning I could make menus"
|
||||
" without brain fucking myself (kudos to everyone who writes 100s of lines in CLEO). I recall starting working on"
|
||||
" the menu in October/November that same year.");
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("I had high hopes the mod would succeed and the menu was nowhere near the state I wanted"
|
||||
" it to be. But over a hot conversation with KKJJ, I finally decided to add the absolute bare minimum of features and"
|
||||
" see what happens. And to my surprise, it even surpassed all of my expectations and became my most popular mod to this day.");
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("A part of me is already cringing telling the story but it is what it is. I've learned"
|
||||
" a lot working on this mod and I'm grateful. If you made it through all this way, kudos, you're awesome.");
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("Again, thanks to you and everyone who used or helped me along the way. Enjoy ;)");
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextWrapped("On this day, in 2019, the first public version of menu was released in MixMods Forum."
|
||||
" It's been a blast working on it and I've learned a lot in the process.\n\nThanks to you and everyone who used or"
|
||||
" contributed to the modification in any form or shape.");
|
||||
@ -326,11 +283,6 @@ void CheatMenu::ShowAnniversaryPage()
|
||||
{
|
||||
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::Checkbox("Show backstory", &showHistory);
|
||||
}
|
||||
}
|
||||
|
||||
void CheatMenu::ShowWelcomePage()
|
||||
|
498
src/game.cpp
498
src/game.cpp
@ -9,9 +9,241 @@
|
||||
#include <CSprite2d.h>
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
static bool bSaveGameFlag = false;
|
||||
void Freecam::Process()
|
||||
{
|
||||
static CVector m_fTotalMouse;
|
||||
|
||||
void Game::RealTimeClock()
|
||||
int delta = (CTimer::m_snTimeInMilliseconds - CTimer::m_snPreviousTimeInMilliseconds);
|
||||
|
||||
int ratio = 1 / (1 + (delta * m_nMul));
|
||||
int speed = m_nMul + m_nMul * ratio * delta;
|
||||
|
||||
if (!m_bInitDone)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
|
||||
|
||||
m_bHudState = patch::Get<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL)); // hud
|
||||
patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), 0); // hud
|
||||
m_bRadarState = patch::Get<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL)); // radar
|
||||
|
||||
CVector playerPos = player->GetPosition();
|
||||
CPad::GetPad(0)->DisablePlayerControls = true;
|
||||
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(playerPos.x, playerPos.y, playerPos.z, &m_nPed);
|
||||
m_pPed = CPools::GetPed(m_nPed);
|
||||
|
||||
m_fTotalMouse.x = player->GetHeading() + 89.6f;
|
||||
m_fTotalMouse.y = 0;
|
||||
playerPos.z -= 20;
|
||||
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(m_nPed, true);
|
||||
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(m_nPed, false);
|
||||
|
||||
m_pPed->m_bIsVisible = false;
|
||||
Command<Commands::SET_CHAR_COLLISION>(m_nPed, false);
|
||||
m_pPed->SetPosn(playerPos);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 1000, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
patch::Set<BYTE>(0xBA676C, 2); // disable radar
|
||||
m_bInitDone = true;
|
||||
}
|
||||
|
||||
CVector pos = m_pPed->GetPosition();
|
||||
|
||||
m_fTotalMouse.x = m_fTotalMouse.x - CPad::NewMouseControllerState.x / 250;
|
||||
m_fTotalMouse.y = m_fTotalMouse.y + CPad::NewMouseControllerState.y / 3;
|
||||
|
||||
if (m_fTotalMouse.x > 150)
|
||||
{
|
||||
m_fTotalMouse.y = 150;
|
||||
}
|
||||
|
||||
if (m_fTotalMouse.y < -150)
|
||||
{
|
||||
m_fTotalMouse.y = -150;
|
||||
}
|
||||
|
||||
if (freeCamTeleport.Pressed())
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = m_pPed->GetPosition();
|
||||
|
||||
CEntity* playerEntity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &playerEntity) + 0.5f;
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player), pos.x, pos.y, pos.z);
|
||||
|
||||
// disble them again cause they get enabled
|
||||
CHud::bScriptDontDisplayRadar = true;
|
||||
CHud::m_Wants_To_Draw_Hud = false;
|
||||
SetHelpMessage(TEXT("Game.PlayerTeleported"));
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_RCONTROL))
|
||||
{
|
||||
speed /= 2;
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_RSHIFT))
|
||||
{
|
||||
speed *= 2;
|
||||
}
|
||||
|
||||
if (freeCamForward.PressedBasic() || freeCamBackward.PressedBasic())
|
||||
{
|
||||
if (freeCamBackward.PressedBasic())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(m_nPed, &angle);
|
||||
pos.x += speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += speed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.z += speed * 2 * sin(m_fTotalMouse.y / 3 * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (freeCamLeft.PressedBasic() || freeCamRight.PressedBasic())
|
||||
{
|
||||
if (freeCamLeft.PressedBasic())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(m_nPed, &angle);
|
||||
angle -= 90;
|
||||
|
||||
pos.x += speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += speed * sin(angle * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (CPad::NewMouseControllerState.wheelUp)
|
||||
{
|
||||
if (m_fFOV > 10.0f)
|
||||
{
|
||||
m_fFOV -= 2.0f * speed;
|
||||
}
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
if (CPad::NewMouseControllerState.wheelDown)
|
||||
{
|
||||
if (m_fFOV < 115.0f)
|
||||
{
|
||||
m_fFOV += 2.0f * speed;
|
||||
}
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
m_pPed->SetHeading(m_fTotalMouse.x);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(m_nPed, 0.0, 0.0, 20.0, 90.0, 180, m_fTotalMouse.y, 0.0, 2);
|
||||
m_pPed->SetPosn(pos);
|
||||
CIplStore::AddIplsNeededAtPosn(pos);
|
||||
}
|
||||
|
||||
void Freecam::Clear()
|
||||
{
|
||||
m_bInitDone = false;
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
|
||||
patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), m_bHudState); // hud
|
||||
patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_bRadarState); // radar
|
||||
|
||||
CPad::GetPad(0)->DisablePlayerControls = false;
|
||||
|
||||
Command<Commands::DELETE_CHAR>(m_nPed);
|
||||
m_pPed = nullptr;
|
||||
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(false);
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
}
|
||||
|
||||
void RandomCheats::Process()
|
||||
{
|
||||
if (m_bEnabled)
|
||||
{
|
||||
static bool genCheats = false;
|
||||
if (!genCheats)
|
||||
{
|
||||
// Generate enabled cheats vector
|
||||
for (auto [k, v] : m_pData.Items())
|
||||
{
|
||||
/*
|
||||
[
|
||||
cheat_id = [ cheat_name, state (true/false) ]
|
||||
]
|
||||
*/
|
||||
std::string key { k.str() };
|
||||
m_EnabledCheats[std::stoi(key)][0] = v.value_or<std::string>("Unknown");
|
||||
m_EnabledCheats[std::stoi(key)][1] = "true";
|
||||
}
|
||||
genCheats = true;
|
||||
}
|
||||
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
if ((timer - m_nTimer) > (static_cast<uint>(m_nInterval) * 1000))
|
||||
{
|
||||
int id = Random(0, 91);
|
||||
|
||||
for (int i = 0; i < 92; i++)
|
||||
{
|
||||
if (i == id)
|
||||
{
|
||||
if (m_EnabledCheats[i][1] == "true")
|
||||
{
|
||||
Call<0x438370>(id); // cheatEnableLegimate(int CheatID)
|
||||
CMessages::AddMessage((char*)m_EnabledCheats[i][0].c_str(), 2000, 0, false);
|
||||
m_nTimer = timer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RandomCheats::DrawBar()
|
||||
{
|
||||
if (m_bEnabled && m_bProgressBar)
|
||||
{
|
||||
// Next cheat timer bar
|
||||
uint screenWidth = screen::GetScreenWidth();
|
||||
uint screenHeight = screen::GetScreenHeight();
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
uint totalTime = m_nInterval;
|
||||
float progress = (totalTime - (timer - m_nTimer) / 1000.0f) / totalTime;
|
||||
|
||||
CRect sizeBox = CRect(0,0, screenWidth, screenHeight/50);
|
||||
CRect sizeProgress = CRect(0,0, screenWidth*progress, screenHeight/50);
|
||||
CRGBA colorBG = CRGBA(24, 99, 44, 255);
|
||||
CRGBA colorProgress = CRGBA(33, 145, 63, 255);
|
||||
|
||||
CSprite2d::DrawRect(sizeBox, colorBG);
|
||||
CSprite2d::DrawRect(sizeProgress, colorProgress);
|
||||
}
|
||||
}
|
||||
|
||||
void RandomCheats::DrawList()
|
||||
{
|
||||
for (std::string* element : m_EnabledCheats)
|
||||
{
|
||||
bool selected = (element[1] == "true") ? true : false;
|
||||
|
||||
if (ImGui::MenuItem(element[0].c_str(), nullptr, selected))
|
||||
{
|
||||
element[1] = selected ? "false" : "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void RealTimeClock()
|
||||
{
|
||||
time_t tmp = time(nullptr);
|
||||
struct tm* now = localtime(&tmp);
|
||||
@ -37,19 +269,6 @@ void Game::RealTimeClock()
|
||||
void Game::Init()
|
||||
{
|
||||
#ifdef GTASA
|
||||
// Generate enabled cheats vector
|
||||
for (auto [k, v] : RandomCheats::m_pData.Items())
|
||||
{
|
||||
/*
|
||||
[
|
||||
cheat_id = [ cheat_name, state (true/false) ]
|
||||
]
|
||||
*/
|
||||
std::string key { k.str() };
|
||||
RandomCheats::m_EnabledCheats[std::stoi(key)][0] = v.value_or<std::string>("Unknown");
|
||||
RandomCheats::m_EnabledCheats[std::stoi(key)][1] = "true";
|
||||
}
|
||||
|
||||
Events::drawMenuBackgroundEvent += []()
|
||||
{
|
||||
if (bSaveGameFlag)
|
||||
@ -59,26 +278,7 @@ void Game::Init()
|
||||
}
|
||||
};
|
||||
|
||||
Events::drawingEvent += []()
|
||||
{
|
||||
if (RandomCheats::m_bEnabled && RandomCheats::m_bProgressBar)
|
||||
{
|
||||
// Next cheat timer bar
|
||||
uint screenWidth = screen::GetScreenWidth();
|
||||
uint screenHeight = screen::GetScreenHeight();
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
uint totalTime = RandomCheats::m_nInterval;
|
||||
float progress = (totalTime - (timer - RandomCheats::m_nTimer) / 1000.0f) / totalTime;
|
||||
|
||||
CRect sizeBox = CRect(0,0, screenWidth, screenHeight/50);
|
||||
CRect sizeProgress = CRect(0,0, screenWidth*progress, screenHeight/50);
|
||||
CRGBA colorBG = CRGBA(24, 99, 44, 255);
|
||||
CRGBA colorProgress = CRGBA(33, 145, 63, 255);
|
||||
|
||||
CSprite2d::DrawRect(sizeBox, colorBG);
|
||||
CSprite2d::DrawRect(sizeProgress, colorProgress);
|
||||
}
|
||||
};
|
||||
Events::drawingEvent.Add(RandomCheats::DrawBar);
|
||||
#endif
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
@ -90,7 +290,9 @@ void Game::Init()
|
||||
if (HardMode::m_bEnabled)
|
||||
{
|
||||
if (pPlayer->m_fHealth > 50.0f)
|
||||
{
|
||||
pPlayer->m_fHealth = 50.0f;
|
||||
}
|
||||
|
||||
pPlayer->m_fArmour = 0.0f;
|
||||
|
||||
@ -144,6 +346,7 @@ void Game::Init()
|
||||
}
|
||||
}
|
||||
|
||||
RandomCheats::Process();
|
||||
#endif
|
||||
|
||||
if (freeCam.Pressed())
|
||||
@ -151,7 +354,7 @@ void Game::Init()
|
||||
if (Freecam::m_bEnabled)
|
||||
{
|
||||
Freecam::m_bEnabled = false;
|
||||
ClearFreecamStuff();
|
||||
Freecam::Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -161,7 +364,7 @@ void Game::Init()
|
||||
|
||||
if (Freecam::m_bEnabled)
|
||||
{
|
||||
FreeCam();
|
||||
Freecam::Process();
|
||||
}
|
||||
|
||||
// improve this later
|
||||
@ -176,30 +379,6 @@ void Game::Init()
|
||||
|
||||
syncTimer = timer;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
if (RandomCheats::m_bEnabled)
|
||||
{
|
||||
if ((timer - RandomCheats::m_nTimer) > (static_cast<uint>(RandomCheats::m_nInterval) * 1000))
|
||||
{
|
||||
int id = Random(0, 91);
|
||||
|
||||
for (int i = 0; i < 92; i++)
|
||||
{
|
||||
if (i == id)
|
||||
{
|
||||
if (RandomCheats::m_EnabledCheats[i][1] == "true")
|
||||
{
|
||||
Call<0x00438370>(id); // cheatEnableLegimate(int CheatID)
|
||||
CMessages::AddMessage((char*)RandomCheats::m_EnabledCheats[i][0].c_str(), 2000, 0, false);
|
||||
RandomCheats::m_nTimer = timer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
@ -224,187 +403,6 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
|
||||
}
|
||||
}
|
||||
|
||||
void Game::FreeCam()
|
||||
{
|
||||
int delta = (CTimer::m_snTimeInMilliseconds - CTimer::m_snPreviousTimeInMilliseconds);
|
||||
|
||||
int ratio = 1 / (1 + (delta * Freecam::m_nMul));
|
||||
int speed = Freecam::m_nMul + Freecam::m_nMul * ratio * delta;
|
||||
|
||||
if (!Freecam::m_bInitDone)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
|
||||
|
||||
Freecam::m_bHudState = patch::Get<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL)); // hud
|
||||
patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), 0); // hud
|
||||
Freecam::m_bRadarState = patch::Get<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL)); // radar
|
||||
|
||||
CVector playerPos = player->GetPosition();
|
||||
CPad::GetPad(0)->DisablePlayerControls = true;
|
||||
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(playerPos.x, playerPos.y, playerPos.z, &Freecam::m_nPed);
|
||||
Freecam::m_pPed = CPools::GetPed(Freecam::m_nPed);
|
||||
|
||||
Freecam::m_fTotalMouse.x = player->GetHeading() + 89.6f;
|
||||
Freecam::m_fTotalMouse.y = 0;
|
||||
playerPos.z -= 20;
|
||||
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(Freecam::m_nPed, true);
|
||||
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(Freecam::m_nPed, false);
|
||||
|
||||
#ifdef GTASA
|
||||
Freecam::m_pPed->m_bIsVisible = false;
|
||||
Command<Commands::SET_CHAR_COLLISION>(Freecam::m_nPed, false);
|
||||
Freecam::m_pPed->SetPosn(playerPos);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), Freecam::m_fFOV, 1000, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
patch::Set<BYTE>(0xBA676C, 2); // disable radar
|
||||
#elif GTAVC
|
||||
Freecam::m_pPed->m_nFlags.bIsVisible = false;
|
||||
Freecam::m_pPed->m_nFlags.bUseCollision = false;
|
||||
Freecam::m_pPed->SetPosition(playerPos);
|
||||
patch::Set<BYTE>(0xA10AB6, 1); // disable radar
|
||||
#else
|
||||
Freecam::m_pPed->m_nFlags.bIsVisible = false;
|
||||
Freecam::m_pPed->m_nFlags.bUsesCollision = false;
|
||||
Freecam::m_pPed->SetPosition(playerPos.x, playerPos.y, playerPos.z);
|
||||
#endif
|
||||
|
||||
Freecam::m_bInitDone = true;
|
||||
}
|
||||
|
||||
CVector pos = Freecam::m_pPed->GetPosition();
|
||||
|
||||
Freecam::m_fMouse.x = CPad::NewMouseControllerState.x;
|
||||
Freecam::m_fMouse.y = CPad::NewMouseControllerState.y;
|
||||
Freecam::m_fTotalMouse.x = Freecam::m_fTotalMouse.x - Freecam::m_fMouse.x / 250;
|
||||
Freecam::m_fTotalMouse.y = Freecam::m_fTotalMouse.y + Freecam::m_fMouse.y / 3;
|
||||
|
||||
if (Freecam::m_fTotalMouse.x > 150)
|
||||
{
|
||||
Freecam::m_fTotalMouse.y = 150;
|
||||
}
|
||||
|
||||
if (Freecam::m_fTotalMouse.y < -150)
|
||||
{
|
||||
Freecam::m_fTotalMouse.y = -150;
|
||||
}
|
||||
|
||||
if (freeCamTeleport.Pressed())
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = Freecam::m_pPed->GetPosition();
|
||||
|
||||
#ifdef GTASA
|
||||
CEntity* playerEntity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &playerEntity) + 0.5f;
|
||||
#else
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr) + 0.5f;
|
||||
#endif
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player), pos.x, pos.y, pos.z);
|
||||
|
||||
// disble them again cause they get enabled
|
||||
#ifndef GTA3
|
||||
CHud::bScriptDontDisplayRadar = true;
|
||||
#endif
|
||||
CHud::m_Wants_To_Draw_Hud = false;
|
||||
SetHelpMessage(TEXT("Game.PlayerTeleported"));
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_RCONTROL))
|
||||
{
|
||||
speed /= 2;
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_RSHIFT))
|
||||
{
|
||||
speed *= 2;
|
||||
}
|
||||
|
||||
if (freeCamForward.PressedBasic() || freeCamBackward.PressedBasic())
|
||||
{
|
||||
if (freeCamBackward.PressedBasic())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(Freecam::m_nPed, &angle);
|
||||
pos.x += speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += speed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.z += speed * 2 * sin(Freecam::m_fTotalMouse.y / 3 * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (freeCamLeft.PressedBasic() || freeCamRight.PressedBasic())
|
||||
{
|
||||
if (freeCamLeft.PressedBasic())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(Freecam::m_nPed, &angle);
|
||||
angle -= 90;
|
||||
|
||||
pos.x += speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += speed * sin(angle * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
if (CPad::NewMouseControllerState.wheelUp)
|
||||
{
|
||||
if (Freecam::m_fFOV > 10.0f)
|
||||
{
|
||||
Freecam::m_fFOV -= 2.0f * speed;
|
||||
}
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), Freecam::m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
if (CPad::NewMouseControllerState.wheelDown)
|
||||
{
|
||||
if (Freecam::m_fFOV < 115.0f)
|
||||
{
|
||||
Freecam::m_fFOV += 2.0f * speed;
|
||||
}
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), Freecam::m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
Freecam::m_pPed->SetHeading(Freecam::m_fTotalMouse.x);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(Freecam::m_nPed, 0.0, 0.0, 20.0, 90.0, 180, Freecam::m_fTotalMouse.y, 0.0, 2);
|
||||
Freecam::m_pPed->SetPosn(pos);
|
||||
CIplStore::AddIplsNeededAtPosn(pos);
|
||||
#elif GTAVC
|
||||
Freecam::m_pPed->m_placement.SetHeading(Freecam::m_fTotalMouse.x);
|
||||
Freecam::m_pPed->SetPosition(pos);
|
||||
#else
|
||||
Freecam::m_pPed->SetHeading(Freecam::m_fTotalMouse.x);
|
||||
Freecam::m_pPed->SetPosition(pos.x, pos.y, pos.z);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Game::ClearFreecamStuff()
|
||||
{
|
||||
Freecam::m_bInitDone = false;
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
|
||||
patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), Freecam::m_bHudState); // hud
|
||||
patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), Freecam::m_bRadarState); // radar
|
||||
|
||||
CPad::GetPad(0)->DisablePlayerControls = false;
|
||||
|
||||
Command<Commands::DELETE_CHAR>(Freecam::m_nPed);
|
||||
Freecam::m_pPed = nullptr;
|
||||
|
||||
#ifdef GTASA
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(false);
|
||||
#endif
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
}
|
||||
|
||||
void Game::ShowPage()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
@ -549,8 +547,8 @@ void Game::ShowPage()
|
||||
Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff);
|
||||
}
|
||||
Ui::CheckboxWithHint(TEXT("Game.Screenshot"), &m_bScreenShot,
|
||||
(("Take screenshot using ") + quickSceenShot.GetNameString()
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
std::format("{} {}", TEXT("Game.ScreenshotTip"),
|
||||
quickSceenShot.GetNameString()).c_str());
|
||||
Ui::CheckboxWithHint(TEXT("Game.SolidWater"), &m_bSolidWater, TEXT("Game.SolidWaterText"));
|
||||
#endif
|
||||
if (ImGui::Checkbox(TEXT("Game.SyncSystemTime"), &m_bSyncTime))
|
||||
@ -574,7 +572,7 @@ void Game::ShowPage()
|
||||
if (ImGui::CollapsingHeader(TEXT("Game.CurrentDay")))
|
||||
{
|
||||
int day = CClock::CurrentDay - 1;
|
||||
if (Ui::ListBox(TEXT("Game.SelectDay"), m_DayNames, day))
|
||||
if (ImGui::Combo(TEXT("Game.SelectDay"), &day, "Sunday\0Monday\0Tuesday\0Wednesday\0Thursday\0Friday\0Saturday\0"))
|
||||
{
|
||||
CClock::CurrentDay = day + 1;
|
||||
}
|
||||
@ -592,7 +590,7 @@ void Game::ShowPage()
|
||||
{
|
||||
if (!Freecam::m_bEnabled)
|
||||
{
|
||||
ClearFreecamStuff();
|
||||
Freecam::Clear();
|
||||
}
|
||||
}
|
||||
ImGui::Spacing();
|
||||
@ -851,15 +849,7 @@ void Game::ShowPage()
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("Cheats list"))
|
||||
{
|
||||
for (std::string* element : RandomCheats::m_EnabledCheats)
|
||||
{
|
||||
bool selected = (element[1] == "true") ? true : false;
|
||||
|
||||
if (ImGui::MenuItem(element[0].c_str(), nullptr, selected))
|
||||
{
|
||||
element[1] = selected ? "false" : "true";
|
||||
}
|
||||
}
|
||||
RandomCheats::DrawList();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
|
69
src/game.h
69
src/game.h
@ -1,6 +1,43 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
#ifdef GTASA
|
||||
class Freecam
|
||||
{
|
||||
private:
|
||||
static inline bool m_bInitDone;
|
||||
static inline CPed* m_pPed;
|
||||
static inline int m_nPed = -1;
|
||||
static inline BYTE m_bHudState;
|
||||
static inline BYTE m_bRadarState;
|
||||
|
||||
public:
|
||||
static inline bool m_bEnabled;
|
||||
static inline int m_nMul = 1;
|
||||
static inline float m_fFOV = 60.0f;
|
||||
|
||||
static void Clear();
|
||||
static void Process();
|
||||
};
|
||||
|
||||
class RandomCheats
|
||||
{
|
||||
private:
|
||||
static inline std::string m_EnabledCheats[92][2];
|
||||
static inline DataStore m_pData {"cheats"};
|
||||
static inline uint m_nTimer;
|
||||
|
||||
public:
|
||||
static inline bool m_bEnabled;
|
||||
static inline bool m_bProgressBar = true;
|
||||
static inline int m_nInterval = 10;
|
||||
|
||||
static void DrawBar();
|
||||
static void DrawList();
|
||||
static void Process();
|
||||
};
|
||||
#endif
|
||||
|
||||
class Game
|
||||
{
|
||||
private:
|
||||
@ -9,19 +46,6 @@ private:
|
||||
static inline bool m_bDisableReplay;
|
||||
static inline bool m_bMissionTimer;
|
||||
|
||||
struct Freecam
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
static inline int m_nMul = 1;
|
||||
static inline float m_fFOV = 60.0f;
|
||||
static inline bool m_bInitDone;
|
||||
static inline CPed* m_pPed;
|
||||
static inline int m_nPed = -1;
|
||||
static inline CVector m_fMouse;
|
||||
static inline CVector m_fTotalMouse;
|
||||
static inline BYTE m_bHudState;
|
||||
static inline BYTE m_bRadarState;
|
||||
};
|
||||
struct HardMode
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
@ -38,27 +62,8 @@ private:
|
||||
static inline bool m_bScreenShot;
|
||||
static inline bool m_bKeepStuff;
|
||||
static inline ResourceStore m_StatData{ "stats", eResourceType::TYPE_TEXT };
|
||||
|
||||
static inline std::vector<std::string> m_DayNames =
|
||||
{
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
struct RandomCheats
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
static inline bool m_bProgressBar = true;
|
||||
static inline std::string m_EnabledCheats[92][2];
|
||||
static inline int m_nInterval = 10;
|
||||
static inline DataStore m_pData {"cheats"};
|
||||
static inline uint m_nTimer;
|
||||
};
|
||||
#endif
|
||||
|
||||
static void RealTimeClock();
|
||||
static void FreeCam();
|
||||
static void ClearFreecamStuff();
|
||||
|
||||
public:
|
||||
static inline bool m_bFreezeTime;
|
||||
static inline bool m_bSyncTime;
|
||||
|
@ -173,7 +173,7 @@ void Menu::DrawOverlay()
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::DrawShortcutsWindow()
|
||||
void Menu::DrawCommandWindow()
|
||||
{
|
||||
int resX = static_cast<int>(screen::GetScreenWidth());
|
||||
int resY = static_cast<int>(screen::GetScreenHeight());
|
||||
|
@ -53,6 +53,6 @@ public:
|
||||
static void Init();
|
||||
static void ShowPage();
|
||||
static void DrawOverlay();
|
||||
static void DrawShortcutsWindow();
|
||||
static void DrawCommandWindow();
|
||||
static void ProcessCommands();
|
||||
};
|
||||
|
198
src/ped.cpp
198
src/ped.cpp
@ -7,17 +7,24 @@
|
||||
|
||||
#ifdef GTASA
|
||||
#include <ePedBones.h>
|
||||
|
||||
static const char* pedTypeList = "Civ Male\0Civ Female\0Cop\0Ballas\0Grove Street Families"
|
||||
"\0Los Santos Vagos\0San Fierro Rifa\0Da Nang Boys\0Mafia\0Mountain Cloud Triads"
|
||||
"\0Varrio Los Aztecas\0Gang 9\0Medic\0Dealer\0Criminal\0Fireman\0Prostitute\0";
|
||||
|
||||
#elif GTAVC
|
||||
static const char* pedTypeList = "Civ Male\0Civ Female\0Cop (crash)\0Cubans\0Haitians\0Streetwannabe's"
|
||||
"\0Diaz' Gang\0Security Guards\0Biker Gang\0Vercetti Gang\0Golfers\0Gang 9\0Emergency\0Fireman"
|
||||
"\0Criminal\0Unused\0Prostitute\0Special\0";
|
||||
|
||||
#else
|
||||
static const char* pedTypeList = L"Civ Male\0Civ Female\0Cop\0Leones\0Triads\0Diablos\0Yakuza\0Yardies\0Colombians\0"
|
||||
L"Hoods\0unused\0unused\0Emergency\0Fireman\0Criminal\0unused\0Prostitute\0Special\0";
|
||||
|
||||
#endif
|
||||
|
||||
void Ped::Init()
|
||||
{
|
||||
#ifdef GTASA
|
||||
if (GetModuleHandle("ExGangWars.asi"))
|
||||
{
|
||||
m_bExGangWarsInstalled = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Taken from gta chaos mod by Lordmau5 & _AG
|
||||
TODO: Implement in VC too
|
||||
@ -85,7 +92,7 @@ void Ped::SpawnPed(std::string& model)
|
||||
void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
#endif
|
||||
{
|
||||
if (SpawnPed::m_List.size() == SPAWN_PED_LIMIT)
|
||||
if (Spawner::m_List.size() == SPAWN_PED_LIMIT)
|
||||
{
|
||||
SetHelpMessage(TEXT("Ped.MaxLimit"));
|
||||
return;
|
||||
@ -117,7 +124,7 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
CStreaming::RequestSpecialChar(currentSlot, name.c_str(), PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
|
||||
Command<Commands::CREATE_CHAR>(SpawnPed::m_nSelectedPedType + 4, 290 + currentSlot, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(Spawner::m_nSelectedPedType + 4, 290 + currentSlot, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetSpecialCharIsDeletable(290 + currentSlot);
|
||||
|
||||
// SA has 10 slots
|
||||
@ -154,31 +161,31 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
CStreaming::RequestModel(iModel, eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
Command<Commands::CREATE_CHAR>(SpawnPed::m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(Spawner::m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetModelIsDeletable(iModel);
|
||||
}
|
||||
|
||||
ped = CPools::GetPed(hplayer);
|
||||
|
||||
if (SpawnPed::m_bPedMove)
|
||||
if (Spawner::m_bPedMove)
|
||||
{
|
||||
SpawnPed::m_List.push_back(ped);
|
||||
Spawner::m_List.push_back(ped);
|
||||
}
|
||||
else
|
||||
{
|
||||
Command<Commands::MARK_CHAR_AS_NO_LONGER_NEEDED>(hplayer);
|
||||
}
|
||||
ped->m_nPedFlags.bPedIsBleeding = SpawnPed::m_bPedBleed;
|
||||
ped->m_nWeaponAccuracy = SpawnPed::m_nAccuracy;
|
||||
ped->m_fHealth = SpawnPed::m_nPedHealth;
|
||||
ped->m_nPedFlags.bPedIsBleeding = Spawner::m_bPedBleed;
|
||||
ped->m_nWeaponAccuracy = Spawner::m_nAccuracy;
|
||||
ped->m_fHealth = Spawner::m_nPedHealth;
|
||||
#ifdef GTASA
|
||||
if (SpawnPed::m_nWeaponId != 0)
|
||||
if (Spawner::m_nWeaponId != 0)
|
||||
{
|
||||
int model = 0;
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(SpawnPed::m_nWeaponId, &model);
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(Spawner::m_nWeaponId, &model);
|
||||
CStreaming::RequestModel(model, PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, SpawnPed::m_nWeaponId, 999);
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, Spawner::m_nWeaponId, 999);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -240,67 +247,6 @@ void Ped::ShowPage()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::BeginChild("MenusChild");
|
||||
|
||||
#ifdef GTASA
|
||||
if (ImGui::CollapsingHeader(TEXT("Ped.GangWars")))
|
||||
{
|
||||
if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
if (Util::GetLargestGangInZone() == 1)
|
||||
{
|
||||
CGangWars::StartDefensiveGangWar();
|
||||
}
|
||||
else
|
||||
{
|
||||
CGangWars::StartOffensiveGangWar();
|
||||
}
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(TEXT("Ped.EndWar"), ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
CGangWars::EndGangWar(true);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 20));
|
||||
ImGui::TextWrapped(TEXT("Ped.ZoneDensity"));
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2);
|
||||
for (int i = 0; i != 10; ++i)
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZone szone = CZone();
|
||||
CZone* pZone = &szone;
|
||||
|
||||
CZoneInfo* zoneInfo = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
int density = zoneInfo->m_nGangDensity[i];
|
||||
|
||||
if (ImGui::SliderInt(m_GangList[i].c_str(), &density, 0, 127))
|
||||
{
|
||||
zoneInfo->m_nGangDensity[i] = static_cast<char>(density);
|
||||
Command<Commands::CLEAR_SPECIFIC_ZONES_TO_TRIGGER_GANG_WAR>();
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::Spacing();
|
||||
|
||||
if (!m_bExGangWarsInstalled)
|
||||
{
|
||||
ImGui::TextWrapped(TEXT("Ped.ExGangWarsTip"));
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Ped.DownloadExGangWars"), Ui::GetSize(1)))
|
||||
{
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/682194-extended-gang-wars/", NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
#endif
|
||||
Ui::EditReference<float>(TEXT("Ped.PedDensityMul"), CPopulation::PedDensityMultiplier, 0, 1, 10);
|
||||
#ifdef GTASA
|
||||
if (ImGui::CollapsingHeader(TEXT("Ped.RecruitAnyone")))
|
||||
@ -343,12 +289,12 @@ void Ped::ShowPage()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Ped.RemoveFrozen"), Ui::GetSize(1)))
|
||||
{
|
||||
for (CPed* ped : SpawnPed::m_List)
|
||||
for (CPed* ped : Spawner::m_List)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
ped->Remove();
|
||||
}
|
||||
SpawnPed::m_List.clear();
|
||||
Spawner::m_List.clear();
|
||||
}
|
||||
ImGui::Spacing();
|
||||
if (ImGui::BeginTabBar("SpawnPedBar"))
|
||||
@ -374,41 +320,42 @@ void Ped::ShowPage()
|
||||
ImGui::Spacing();
|
||||
ImGui::BeginChild("PedCOnfig");
|
||||
ImGui::Columns(2, 0, false);
|
||||
Ui::CheckboxWithHint(TEXT("Ped.NoMove"), &SpawnPed::m_bPedMove);
|
||||
Ui::CheckboxWithHint(TEXT("Ped.NoMove"), &Spawner::m_bPedMove);
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint(TEXT("Ped.PedBleed"), &SpawnPed::m_bPedBleed);
|
||||
Ui::CheckboxWithHint(TEXT("Ped.PedBleed"), &Spawner::m_bPedBleed);
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SliderInt(TEXT("Ped.Accuracy"), &SpawnPed::m_nAccuracy, 0.0, 100.0);
|
||||
if (ImGui::InputInt(TEXT("Ped.Health"), &SpawnPed::m_nPedHealth))
|
||||
ImGui::SliderInt(TEXT("Ped.Accuracy"), &Spawner::m_nAccuracy, 0.0, 100.0);
|
||||
if (ImGui::InputInt(TEXT("Ped.Health"), &Spawner::m_nPedHealth))
|
||||
{
|
||||
if (SpawnPed::m_nPedHealth > 1000)
|
||||
if (Spawner::m_nPedHealth > 1000)
|
||||
{
|
||||
SpawnPed::m_nPedHealth = 1000;
|
||||
Spawner::m_nPedHealth = 1000;
|
||||
}
|
||||
|
||||
if (SpawnPed::m_nPedHealth < 0)
|
||||
if (Spawner::m_nPedHealth < 0)
|
||||
{
|
||||
SpawnPed::m_nPedHealth = 0;
|
||||
Spawner::m_nPedHealth = 0;
|
||||
}
|
||||
}
|
||||
Ui::ListBox(TEXT("Ped.PedType"), SpawnPed::m_PedTypeList, SpawnPed::m_nSelectedPedType);
|
||||
ImGui::Combo(TEXT("Ped.PedType"), &Spawner::m_nSelectedPedType, pedTypeList);
|
||||
|
||||
static std::string weaponName = "None";
|
||||
ImGui::Spacing();
|
||||
ImGui::Text(TEXT("Ped.SelectedWeapon"), SpawnPed::m_nWeaponName.c_str());
|
||||
ImGui::Text(TEXT("Ped.SelectedWeapon"), weaponName.c_str());
|
||||
ImGui::Spacing();
|
||||
#ifdef GTASA
|
||||
Ui::DrawImages(Weapon::m_WeaponData,
|
||||
[](std::string str)
|
||||
{
|
||||
SpawnPed::m_nWeaponId = std::stoi(str);
|
||||
Spawner::m_nWeaponId = std::stoi(str);
|
||||
},
|
||||
nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
SpawnPed::m_nWeaponName = Weapon::m_WeaponData.m_pData->Get(str.c_str(), "Unknown");
|
||||
return SpawnPed::m_nWeaponName;
|
||||
weaponName = Weapon::m_WeaponData.m_pData->Get(str.c_str(), "Unknown");
|
||||
return weaponName;
|
||||
},
|
||||
[](std::string str)
|
||||
{
|
||||
@ -420,7 +367,7 @@ void Ped::ShowPage()
|
||||
[](std::string& root, std::string& key, std::string& id)
|
||||
{
|
||||
SpawnPed::m_nWeaponId = std::stoi(id);
|
||||
SpawnPed::m_nWeaponName = key;
|
||||
weaponName = key;
|
||||
},
|
||||
nullptr);
|
||||
#endif
|
||||
@ -432,6 +379,67 @@ void Ped::ShowPage()
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#ifdef GTASA
|
||||
if (ImGui::BeginTabItem(TEXT("Ped.GangWars")))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
if (Util::GetLargestGangInZone() == 1)
|
||||
{
|
||||
CGangWars::StartDefensiveGangWar();
|
||||
}
|
||||
else
|
||||
{
|
||||
CGangWars::StartOffensiveGangWar();
|
||||
}
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(TEXT("Ped.EndWar"), ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
CGangWars::EndGangWar(true);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 20));
|
||||
ImGui::TextWrapped(TEXT("Ped.ZoneDensity"));
|
||||
ImGui::Spacing();
|
||||
|
||||
static const char* m_GangList[] =
|
||||
{
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2);
|
||||
for (int i = 0; i != 10; ++i)
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZoneInfo* info = CTheZones::GetZoneInfo(&pos, nullptr);
|
||||
int density = info->m_nGangDensity[i];
|
||||
if (ImGui::SliderInt(m_GangList[i], &density, 0, 127))
|
||||
{
|
||||
info->m_nGangDensity[i] = static_cast<int8_t>(density);
|
||||
Command<Commands::CLEAR_SPECIFIC_ZONES_TO_TRIGGER_GANG_WAR>();
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
static bool pluginRequired = (GetModuleHandle("ExGangWars.asi") == 0);
|
||||
if (pluginRequired)
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped(TEXT("Ped.ExGangWarsTip"));
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button(TEXT("Ped.DownloadExGangWars"), Ui::GetSize(1)))
|
||||
{
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/682194-extended-gang-wars/", NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
27
src/ped.h
27
src/ped.h
@ -5,17 +5,9 @@ class Ped
|
||||
{
|
||||
private:
|
||||
static inline bool m_bBigHead;
|
||||
#ifdef GTASA
|
||||
static inline bool m_bExGangWarsInstalled;
|
||||
static inline bool m_bThinBody;
|
||||
static inline std::vector<std::string> m_GangList =
|
||||
{
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
#endif
|
||||
|
||||
struct SpawnPed
|
||||
struct Spawner
|
||||
{
|
||||
static inline std::vector<CPed*> m_List;
|
||||
static inline int m_nAccuracy = 50;
|
||||
@ -24,27 +16,10 @@ private:
|
||||
static inline bool m_bPedBleed;
|
||||
static inline int m_nSelectedPedType;
|
||||
static inline int m_nWeaponId;
|
||||
static inline std::string m_nWeaponName = "None";
|
||||
static inline std::vector<std::string> m_PedTypeList =
|
||||
{
|
||||
#ifdef GTASA
|
||||
"Civ Male", "Civ Female", "Cop", "Ballas", "Grove Street Families", "Los Santos Vagos",
|
||||
"San Fierro Rifa", "Da Nang Boys", "Mafia", "Mountain Cloud Triads", "Varrio Los Aztecas",
|
||||
"Gang 9", "Medic", "Dealer", "Criminal", "Fireman", "Prostitute"
|
||||
#elif GTAVC
|
||||
"Civ Male", "Civ Female", "Cop (crash)", "Cubans", "Haitians", "Streetwannabe's", "Diaz' Gang",
|
||||
"Security Guards", "Biker Gang", "Vercetti Gang", "Golfers", "Gang 9", "Emergency",
|
||||
"Fireman", "Criminal", "Unused", "Prostitute", "Special"
|
||||
#else
|
||||
"Civ Male", "Civ Female", "Cop", "Leones", "Triads", "Diablos", "Yakuza", "Yardies", "Colombians",
|
||||
"Hoods", "unused", "unused", "Emergency", "Fireman", "Criminal", "unused", "Prostitute", "Special"
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef GTASA
|
||||
static void SpawnPed(std::string& model);
|
||||
static void BigHeadEffect(CPed *ped);
|
||||
#else
|
||||
static void SpawnPed(std::string& cat, std::string& name, std::string& model);
|
||||
#endif
|
||||
|
@ -7,6 +7,14 @@
|
||||
#ifdef GTASA
|
||||
#include "ped.h"
|
||||
|
||||
static inline const char* clothNameList[18] =
|
||||
{
|
||||
"Shirts", "Heads", "Trousers", "Shoes", "Tattoos left lower arm", "Tattoos left upper arm",
|
||||
"Tattoos right upper arm", "Tattoos right lower arm", "Tattoos back", "Tattoos left chest",
|
||||
"Tattoos right chest", "Tattoos stomach", "Tattoos lower back", "Necklaces", "Watches",
|
||||
"Glasses", "Hats", "Extras"
|
||||
};
|
||||
|
||||
static inline void PlayerModelBrokenFix()
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
@ -21,11 +29,11 @@ static inline void PlayerModelBrokenFix()
|
||||
Taken from gta chaos mod by Lordmau5
|
||||
https://github.com/gta-chaos-mod/Trilogy-ASI-Script
|
||||
*/
|
||||
void Player::TopDownCameraView()
|
||||
void Player::TopDownCamera::Process()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed ();
|
||||
CVector pos = player->GetPosition ();
|
||||
float curOffset = TopDownCamera::m_fOffset;
|
||||
float curOffset = m_fOffset;
|
||||
|
||||
// drunk effect causes issues
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
|
||||
@ -207,7 +215,7 @@ void Player::Init()
|
||||
|
||||
if (TopDownCamera::m_bEnabled)
|
||||
{
|
||||
TopDownCameraView();
|
||||
TopDownCamera::Process();
|
||||
}
|
||||
|
||||
if (m_bAimSkinChanger && aimSkinChanger.Pressed())
|
||||
@ -612,21 +620,22 @@ void Player::ShowPage()
|
||||
if (pPlayer->m_nModelIndex == 0)
|
||||
{
|
||||
ImGui::Columns(3, 0, false);
|
||||
if (ImGui::RadioButton(TEXT("Player.Fat"), &m_nUiBodyState, 2))
|
||||
static int bodyState = 0;
|
||||
if (ImGui::RadioButton(TEXT("Player.Fat"), &bodyState, 2))
|
||||
{
|
||||
CCheat::FatCheat();
|
||||
}
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (ImGui::RadioButton(TEXT("Player.Muscle"), &m_nUiBodyState, 1))
|
||||
if (ImGui::RadioButton(TEXT("Player.Muscle"), &bodyState, 1))
|
||||
{
|
||||
CCheat::MuscleCheat();
|
||||
}
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (ImGui::RadioButton(TEXT("Player.Skinny"), &m_nUiBodyState, 0))
|
||||
if (ImGui::RadioButton(TEXT("Player.Skinny"), &bodyState, 0))
|
||||
{
|
||||
CCheat::SkinnyCheat();
|
||||
}
|
||||
|
18
src/player.h
18
src/player.h
@ -18,7 +18,6 @@ private:
|
||||
static inline bool m_bAimSkinChanger;
|
||||
static inline bool m_bDrunkEffect;
|
||||
static inline bool m_bFastSprint;
|
||||
static inline int m_nUiBodyState;
|
||||
static inline ResourceStore m_ClothData { "clothes", eResourceType::TYPE_IMAGE, ImVec2(70, 100)};
|
||||
struct CustomSkins
|
||||
{
|
||||
@ -28,26 +27,17 @@ private:
|
||||
|
||||
struct TopDownCamera
|
||||
{
|
||||
public:
|
||||
static inline bool m_bEnabled = false;
|
||||
static inline float m_fOffset = 40.0f;
|
||||
|
||||
static void Process();
|
||||
};
|
||||
|
||||
static inline const char* clothNameList[18] =
|
||||
{
|
||||
"Shirts", "Heads", "Trousers", "Shoes", "Tattoos left lower arm", "Tattoos left upper arm",
|
||||
"Tattoos right upper arm", "Tattoos right lower arm", "Tattoos back", "Tattoos left chest",
|
||||
"Tattoos right chest", "Tattoos stomach", "Tattoos lower back", "Necklaces", "Watches",
|
||||
"Glasses", "Hats", "Extras"
|
||||
};
|
||||
#else
|
||||
static inline ResourceStore skinData { BY_GAME(NULL, "skins", "peds"), eResourceType::TYPE_TEXT };
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
static void ChangePlayerModel(std::string& model);
|
||||
static void ChangePlayerCloth(std::string& model);
|
||||
static void TopDownCameraView();
|
||||
#else
|
||||
static inline ResourceStore skinData { BY_GAME(NULL, "skins", "peds"), eResourceType::TYPE_TEXT };
|
||||
static void ChangePlayerModel(std::string& cat, std::string& name, std::string& id);
|
||||
#endif
|
||||
|
||||
|
@ -11,10 +11,6 @@ private:
|
||||
static inline char m_nLocationBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline uint m_nQuickTeleportTimer;
|
||||
|
||||
#ifdef GTASA
|
||||
static inline DataStore m_SpriteData {"sprites"};
|
||||
#endif
|
||||
|
||||
struct QuickTP
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
@ -22,8 +18,9 @@ private:
|
||||
static inline uint m_nTimer;
|
||||
};
|
||||
|
||||
|
||||
#ifdef GTASA
|
||||
static inline DataStore m_SpriteData {"sprites"};
|
||||
|
||||
/*
|
||||
Generates radar sprite coordinates on the fly.
|
||||
Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown.
|
||||
|
@ -27,9 +27,9 @@ void Weapon::Init()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
uchar slot = BY_GAME(player->m_nActiveWeaponSlot, player->m_nSelectedWepSlot, player->m_nSelectedWepSlot);
|
||||
if (m_nCurrentWeaponSlot != slot)
|
||||
static uint8_t curWeaponSlot;
|
||||
uint8_t slot = BY_GAME(player->m_nActiveWeaponSlot, player->m_nSelectedWepSlot, player->m_nSelectedWepSlot);
|
||||
if (curWeaponSlot != slot)
|
||||
{
|
||||
eWeaponType weaponType = player->m_aWeapons[slot].m_eWeaponType;
|
||||
|
||||
@ -83,7 +83,7 @@ void Weapon::Init()
|
||||
pWeaponInfo->m_nFlags.bMoveFire = true;
|
||||
}
|
||||
#endif
|
||||
m_nCurrentWeaponSlot = slot;
|
||||
curWeaponSlot = slot;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -366,9 +366,15 @@ void Weapon::ShowPage()
|
||||
if (ImGui::BeginTabItem(TEXT("Weapon.GangWeaponEditor")))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::ListBox(TEXT("Weapon.SelectGang"), m_GangList, m_nSelectedGang);
|
||||
std::vector<std::string> vec = {TEXT("Weapon.Weapon1"), TEXT("Weapon.Weapon2"), TEXT("Weapon.Weapon3")};
|
||||
Ui::ListBox(TEXT("Ped.SelectWeapon"), vec, m_nSelectedWeapon);
|
||||
static const char* gangList =
|
||||
{
|
||||
"Ballas\0Grove street families\0Los santos vagos\0San fierro rifa\0Da nang boys\0"
|
||||
"Mafia\0Mountain cloud triad\0Varrio los aztecas\0Gang9\0Gang10\0"
|
||||
};
|
||||
std::string str = std::format("{}\0{}\0{}\0", TEXT("Weapon.Weapon1"), TEXT("Weapon.Weapon2"),
|
||||
TEXT("Weapon.Weapon3"));
|
||||
ImGui::Combo(TEXT("Weapon.SelectGang"), &m_nSelectedGang, gangList);
|
||||
ImGui::Combo(TEXT("Ped.SelectWeapon"), &m_nSelectedWeapon, str.c_str());
|
||||
ImGui::Spacing();
|
||||
|
||||
std::string key = std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon]);
|
||||
|
37
src/weapon.h
37
src/weapon.h
@ -4,6 +4,12 @@
|
||||
class Weapon
|
||||
{
|
||||
private:
|
||||
static inline bool m_bFastReload;
|
||||
static inline bool m_bHugeDamage;
|
||||
static inline bool m_bLongRange;
|
||||
static inline int m_nAmmoCount = 99999;
|
||||
static inline int m_nSelectedWeapon;
|
||||
|
||||
#ifdef GTASA
|
||||
static inline bool m_bAutoAim;
|
||||
static inline bool m_bRapidFire;
|
||||
@ -24,37 +30,26 @@ private:
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10
|
||||
};
|
||||
|
||||
static inline std::vector<std::string> m_GangList =
|
||||
{
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
#else
|
||||
static inline bool m_bInfiniteAmmo;
|
||||
#endif
|
||||
static inline bool m_bFastReload;
|
||||
static inline bool m_bHugeDamage;
|
||||
static inline bool m_bLongRange;
|
||||
static inline int m_nAmmoCount = 99999;
|
||||
static inline uchar m_nCurrentWeaponSlot = -1;
|
||||
static inline int m_nSelectedWeapon;
|
||||
|
||||
public:
|
||||
#ifdef GTASA
|
||||
static inline ResourceStore m_WeaponData { "weapons", eResourceType::TYPE_BOTH, ImVec2(65, 65) };
|
||||
|
||||
static void GiveWeaponToPlayer(std::string& weapon_type);
|
||||
static void SetGangWeapon(std::string& weapon_type);
|
||||
#else
|
||||
static inline bool m_bInfiniteAmmo;
|
||||
static inline ResourceStore m_WeaponData { "weapons", eResourceType::TYPE_TEXT };
|
||||
|
||||
static void GiveWeaponToPlayer(std::string& rootkey, std::string& model, std::string& name);
|
||||
#endif
|
||||
|
||||
public:
|
||||
Weapon() = delete;
|
||||
Weapon(const Weapon&) = delete;
|
||||
|
||||
static void Init();
|
||||
static void ShowPage();
|
||||
|
||||
#ifdef GTASA
|
||||
static void GiveWeaponToPlayer(std::string& weapon_type);
|
||||
static void SetGangWeapon(std::string& weapon_type);
|
||||
#else
|
||||
static void GiveWeaponToPlayer(std::string& rootkey, std::string& model, std::string& name);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user