clang format code
This commit is contained in:
parent
4676894169
commit
26a671c4e5
11
.clang-format
Normal file
11
.clang-format
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
# We'll use defaults from the LLVM style, but with 4 columns indentation.
|
||||
BasedOnStyle: Microsoft
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
# Force pointers to the type for C++.
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
AccessModifierOffset: -4
|
||||
---
|
@ -1,18 +1,19 @@
|
||||
#include "pch.h"
|
||||
#include "animation.h"
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
Animation::Animation()
|
||||
{
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
Events::processScriptsEvent += [this] {
|
||||
if (m_Cutscene::m_bRunning)
|
||||
{
|
||||
if (Command<Commands::HAS_CUTSCENE_FINISHED>())
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
@ -35,7 +36,7 @@ Animation::Animation()
|
||||
};
|
||||
}
|
||||
|
||||
void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
void Animation::PlayCutscene(std::string &rootKey, std::string &cutsceneId, std::string &interior)
|
||||
{
|
||||
if (Util::IsOnCutscene())
|
||||
{
|
||||
@ -43,7 +44,7 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
|
||||
return;
|
||||
}
|
||||
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
@ -61,7 +62,7 @@ void Animation::Draw()
|
||||
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
int hPlayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -147,7 +148,7 @@ void Animation::Draw()
|
||||
Command<Commands::CLEAR_CUTSCENE>();
|
||||
m_Cutscene::m_bRunning = false;
|
||||
m_Cutscene::m_SceneName = "";
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
player->m_nAreaCode = m_Cutscene::m_nInterior;
|
||||
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
|
||||
m_Cutscene::m_nInterior = 0;
|
||||
@ -168,7 +169,7 @@ void Animation::Draw()
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
void Animation::PlayAnimation(std::string &ifp, std::string &anim, std::string &ifpRepeat)
|
||||
{
|
||||
int hplayer = CPools::GetPedRef(FindPlayerPed());
|
||||
|
||||
@ -194,7 +195,7 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
void Animation::RemoveAnimation(std::string &ifp, std::string &anim, std::string &ifpRepeat)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
|
@ -5,9 +5,8 @@
|
||||
class Animation
|
||||
{
|
||||
private:
|
||||
|
||||
// Animation player
|
||||
static inline ResourceStore m_AnimData{ "animation", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_AnimData{"animation", 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
|
||||
@ -16,7 +15,7 @@ private:
|
||||
// Cutscene player
|
||||
struct m_Cutscene
|
||||
{
|
||||
static inline ResourceStore m_Data{ "cutscene", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_Data{"cutscene", eResourceType::TYPE_TEXT};
|
||||
static inline std::string m_SceneName;
|
||||
static inline int m_nInterior; // player interior backup
|
||||
static inline bool m_bRunning;
|
||||
@ -24,26 +23,26 @@ private:
|
||||
|
||||
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"
|
||||
};
|
||||
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"};
|
||||
|
||||
protected:
|
||||
Animation();
|
||||
|
||||
public:
|
||||
static void Draw();
|
||||
static void PlayAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
static void RemoveAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void PlayAnimation(std::string &rootKey, std::string &anim, std::string &ifp);
|
||||
static void PlayCutscene(std::string &rootKey, std::string &cutsceneId, std::string &interior);
|
||||
static void RemoveAnimation(std::string &rootKey, std::string &anim, std::string &ifp);
|
||||
};
|
||||
#else
|
||||
|
||||
// Dummy Class for VC & III
|
||||
class Animation{};
|
||||
class Animation
|
||||
{
|
||||
};
|
||||
#endif
|
@ -1,15 +1,16 @@
|
||||
#include "pch.h"
|
||||
#include "cheatMenu.h"
|
||||
#include "menuinfo.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "updater.h"
|
||||
|
||||
void CheatMenu::DrawWindow()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
static bool bRunning = true;
|
||||
|
||||
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
|
||||
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible,
|
||||
FrontEndMenuManager.m_bMenuActive))
|
||||
{
|
||||
if (bRunning)
|
||||
{
|
||||
@ -76,9 +77,9 @@ CheatMenu::CheatMenu()
|
||||
m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
|
||||
srand(CTimer::m_snTimeInMilliseconds);
|
||||
|
||||
Events::processScriptsEvent += []()
|
||||
{
|
||||
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
|
||||
Events::processScriptsEvent += []() {
|
||||
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible,
|
||||
FrontEndMenuManager.m_bMenuActive))
|
||||
{
|
||||
if (menuOpen.Pressed())
|
||||
{
|
||||
@ -110,8 +111,8 @@ CheatMenu::CheatMenu()
|
||||
|
||||
void CheatMenu::ApplyStyle()
|
||||
{
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
ImVec4* colors = style->Colors;
|
||||
ImGuiStyle *style = &ImGui::GetStyle();
|
||||
ImVec4 *colors = style->Colors;
|
||||
|
||||
style->WindowRounding = 1;
|
||||
style->ScrollbarRounding = 1;
|
||||
|
@ -14,13 +14,13 @@
|
||||
#endif
|
||||
#include "animation.h"
|
||||
#include "game.h"
|
||||
#include "hook.h"
|
||||
#include "menu.h"
|
||||
#include "ped.h"
|
||||
#include "player.h"
|
||||
#include "teleport.h"
|
||||
#include "menu.h"
|
||||
#include "hook.h"
|
||||
#include "weapon.h"
|
||||
#include "vehicle.h"
|
||||
#include "weapon.h"
|
||||
|
||||
#ifndef GTA3
|
||||
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
|
||||
@ -33,24 +33,20 @@ private:
|
||||
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
|
||||
|
||||
#ifdef GTA3
|
||||
static inline CallbackTable header
|
||||
{
|
||||
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
|
||||
{"Dummy", nullptr}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
|
||||
{"Game", &Game::Draw}, {"Menu", &Menu::Draw},
|
||||
static inline CallbackTable header{
|
||||
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw}, {"Dummy", nullptr},
|
||||
{"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, {"Game", &Game::Draw}, {"Menu", &Menu::Draw},
|
||||
};
|
||||
#else
|
||||
static inline CallbackTable header
|
||||
{
|
||||
static inline CallbackTable header{
|
||||
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
|
||||
#ifdef GTASA
|
||||
{"Animation", &Animation::Draw},
|
||||
#else
|
||||
{"Dummy", nullptr},
|
||||
#endif
|
||||
{"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
|
||||
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
|
||||
};
|
||||
{"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, {"Game", &Game::Draw},
|
||||
{"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}};
|
||||
#endif
|
||||
|
||||
static void ApplyStyle();
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "hook.h"
|
||||
#include "cheatmenu.h"
|
||||
#include "updater.h"
|
||||
#include "hook.h"
|
||||
#include "menuinfo.h"
|
||||
#include "pch.h"
|
||||
#include "updater.h"
|
||||
|
||||
void MenuThread(void* param)
|
||||
void MenuThread(void *param)
|
||||
{
|
||||
/*
|
||||
Had to put this in place since some people put the folder in root
|
||||
@ -12,9 +12,11 @@ void MenuThread(void* param)
|
||||
|
||||
TODO: Unlikely they'd even read the log so have to do something else
|
||||
*/
|
||||
if (!std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
|
||||
if (!std::filesystem::is_directory(PLUGIN_PATH((char *)"CheatMenu")))
|
||||
{
|
||||
gLog << "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory" << std::endl;
|
||||
gLog << "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same "
|
||||
"directory"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -25,10 +27,7 @@ void MenuThread(void* param)
|
||||
static bool bGameInit = false;
|
||||
|
||||
// Wait till game init
|
||||
Events::initRwEvent += []
|
||||
{
|
||||
bGameInit = true;
|
||||
};
|
||||
Events::initRwEvent += [] { bGameInit = true; };
|
||||
|
||||
while (!bGameInit)
|
||||
{
|
||||
@ -48,11 +47,11 @@ void MenuThread(void* param)
|
||||
CFastman92limitAdjuster::Init();
|
||||
#endif
|
||||
|
||||
gLog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
|
||||
GITHUB_LINK "\n" << std::endl;
|
||||
gLog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE
|
||||
"\nMore Info: " GITHUB_LINK "\n"
|
||||
<< std::endl;
|
||||
CheatMenu menu;
|
||||
|
||||
|
||||
// Checking for updates once a day
|
||||
time_t now = time(0);
|
||||
struct tm tstruct = *localtime(&now);
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "pch.h"
|
||||
#include "filehandler.h"
|
||||
#include "pch.h"
|
||||
#include "visual.h"
|
||||
|
||||
// TODO: Clean up this mess, use structures instead?
|
||||
void FileHandler::GenerateHandlingFile(int pHandling, std::map<int, std::string>& storeMap)
|
||||
void FileHandler::GenerateHandlingFile(int pHandling, std::map<int, std::string> &storeMap)
|
||||
{
|
||||
FILE* fp = fopen("handling.txt", "w");
|
||||
FILE *fp = fopen("handling.txt", "w");
|
||||
|
||||
std::string handlingId = storeMap[FindPlayerPed()->m_pVehicle->m_nModelIndex];
|
||||
float fMass = patch::Get<float>(pHandling + 0x4);
|
||||
@ -46,24 +46,23 @@ void FileHandler::GenerateHandlingFile(int pHandling, std::map<int, std::string>
|
||||
float fSeatOffsetDistance = patch::Get<float>(pHandling + 0xD4);
|
||||
|
||||
// TODO: make this more readable
|
||||
fprintf(
|
||||
fp,
|
||||
"\n%s\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%d\t%d\t%.5g\t%.5g\t%c\t%c\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%d\t%d\t%d\t%d\t%d",
|
||||
handlingId.c_str(), fMass, fTurnMass, fDragMult, CentreOfMassX, CentreOfMassY, CentreOfMassZ, nPercentSubmerged,
|
||||
fTractionMultiplier, fTractionLoss, TractionBias, nNumberOfGears,
|
||||
MaxVelocity, fEngineAcceleration, fEngineInertia, nDriveType, nEngineType, BrakeDeceleration, BrakeBias, ABS,
|
||||
SteeringLock, SuspensionForceLevel, SuspensionDampingLevel,
|
||||
SuspensionHighSpdComDamp, Suspension_upper_limit, Suspension_lower_limit, Suspension_bias,
|
||||
Suspension_anti_dive_multiplier, fSeatOffsetDistance,
|
||||
fCollisionDamageMultiplier, nMonetaryValue, modelFlags, handlingFlags, front_lights, rear_lights,
|
||||
vehicle_anim_group);
|
||||
fprintf(fp,
|
||||
"\n%s\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%d\t%d\t%.5g\t%.5g\t%c\t%c\t%.5g\t%.5g\t%"
|
||||
"d\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%d\t%d\t%d\t%d\t%d",
|
||||
handlingId.c_str(), fMass, fTurnMass, fDragMult, CentreOfMassX, CentreOfMassY, CentreOfMassZ,
|
||||
nPercentSubmerged, fTractionMultiplier, fTractionLoss, TractionBias, nNumberOfGears, MaxVelocity,
|
||||
fEngineAcceleration, fEngineInertia, nDriveType, nEngineType, BrakeDeceleration, BrakeBias, ABS,
|
||||
SteeringLock, SuspensionForceLevel, SuspensionDampingLevel, SuspensionHighSpdComDamp,
|
||||
Suspension_upper_limit, Suspension_lower_limit, Suspension_bias, Suspension_anti_dive_multiplier,
|
||||
fSeatOffsetDistance, fCollisionDamageMultiplier, nMonetaryValue, modelFlags, handlingFlags, front_lights,
|
||||
rear_lights, vehicle_anim_group);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec)
|
||||
void FileHandler::FetchColorData(std::vector<std::vector<float>> &storeVec)
|
||||
{
|
||||
std::string m_FilePath = GAME_PATH((char*)"/data/carcols.dat");
|
||||
std::string m_FilePath = GAME_PATH((char *)"/data/carcols.dat");
|
||||
|
||||
if (std::filesystem::exists(m_FilePath))
|
||||
{
|
||||
@ -112,7 +111,7 @@ void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec)
|
||||
std::replace(temp.begin(), temp.end(), '.', ',');
|
||||
|
||||
// Format: red, green, blue
|
||||
int r,g,b;
|
||||
int r, g, b;
|
||||
getline(ss, temp, ',');
|
||||
r = std::stoi(temp);
|
||||
getline(ss, temp, ',');
|
||||
@ -138,9 +137,9 @@ void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec)
|
||||
}
|
||||
}
|
||||
|
||||
void FileHandler::FetchHandlingID(std::map<int, std::string>& storeMap)
|
||||
void FileHandler::FetchHandlingID(std::map<int, std::string> &storeMap)
|
||||
{
|
||||
std::string m_FilePath = GAME_PATH((char*)"/data/vehicles.ide");
|
||||
std::string m_FilePath = GAME_PATH((char *)"/data/vehicles.ide");
|
||||
|
||||
if (std::filesystem::exists(m_FilePath))
|
||||
{
|
||||
|
@ -1,24 +1,23 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class FileHandler
|
||||
{
|
||||
public:
|
||||
FileHandler() = delete;
|
||||
FileHandler(FileHandler&) = delete;
|
||||
FileHandler(FileHandler &) = delete;
|
||||
|
||||
/*
|
||||
Parses data/carcols.dat file and stores color data
|
||||
TODO: Implement something that also parses modloader data
|
||||
*/
|
||||
static void FetchColorData(std::vector<std::vector<float>>& storeVec);
|
||||
static void FetchColorData(std::vector<std::vector<float>> &storeVec);
|
||||
/*
|
||||
Parses data/vehicles.ide file and stores handingId in a map
|
||||
TODO: Implement something that also parses modloader data
|
||||
*/
|
||||
static void FetchHandlingID(std::map<int, std::string>& storeMap);
|
||||
static void GenerateHandlingFile(int pHandling, std::map<int, std::string>& storeMap);
|
||||
static void FetchHandlingID(std::map<int, std::string> &storeMap);
|
||||
static void GenerateHandlingFile(int pHandling, std::map<int, std::string> &storeMap);
|
||||
};
|
||||
|
||||
|
85
src/game.cpp
85
src/game.cpp
@ -1,8 +1,9 @@
|
||||
#include "pch.h"
|
||||
#include "menu.h"
|
||||
#include "game.h"
|
||||
#include "menu.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include <CIplStore.h>
|
||||
#include <CMessages.h>
|
||||
@ -15,7 +16,7 @@ static bool bSaveGameFlag = false;
|
||||
void Game::RealTimeClock()
|
||||
{
|
||||
time_t tmp = time(nullptr);
|
||||
struct tm* now = localtime(&tmp);
|
||||
struct tm *now = localtime(&tmp);
|
||||
|
||||
#ifdef GTASA
|
||||
static int lastday;
|
||||
@ -50,8 +51,7 @@ Game::Game()
|
||||
m_RandomCheats::m_EnabledCheats[std::stoi(element.key())][1] = "true";
|
||||
}
|
||||
|
||||
Events::drawMenuBackgroundEvent += []()
|
||||
{
|
||||
Events::drawMenuBackgroundEvent += []() {
|
||||
if (bSaveGameFlag)
|
||||
{
|
||||
FrontEndMenuManager.m_nCurrentMenuPage = MENUPAGE_GAME_SAVE;
|
||||
@ -59,8 +59,7 @@ Game::Game()
|
||||
}
|
||||
};
|
||||
|
||||
Events::drawingEvent += []()
|
||||
{
|
||||
Events::drawingEvent += []() {
|
||||
if (m_RandomCheats::m_bEnabled && m_RandomCheats::m_bProgressBar)
|
||||
{
|
||||
// Next cheat timer bar
|
||||
@ -70,8 +69,8 @@ Game::Game()
|
||||
uint totalTime = m_RandomCheats::m_nInterval;
|
||||
float progress = (totalTime - (timer - m_RandomCheats::m_nTimer) / 1000.0f) / totalTime;
|
||||
|
||||
CRect sizeBox = CRect(0,0, screenWidth, screenHeight/50);
|
||||
CRect sizeProgress = CRect(0,0, screenWidth*progress, screenHeight/50);
|
||||
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);
|
||||
|
||||
@ -81,10 +80,9 @@ Game::Game()
|
||||
};
|
||||
#endif
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
Events::processScriptsEvent += [] {
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
#ifdef GTASA
|
||||
@ -165,7 +163,7 @@ Game::Game()
|
||||
if (m_bSyncTime && timer - syncTimer > 50)
|
||||
{
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm* now = std::localtime(&t);
|
||||
std::tm *now = std::localtime(&t);
|
||||
|
||||
CClock::ms_nGameClockHours = now->tm_hour;
|
||||
CClock::ms_nGameClockMinutes = now->tm_min;
|
||||
@ -187,7 +185,8 @@ Game::Game()
|
||||
if (m_RandomCheats::m_EnabledCheats[i][1] == "true")
|
||||
{
|
||||
Call<0x00438370>(id); // cheatEnableLegimate(int CheatID)
|
||||
CMessages::AddMessage((char*)m_RandomCheats::m_EnabledCheats[i][0].c_str(), 2000, 0, false);
|
||||
CMessages::AddMessage((char *)m_RandomCheats::m_EnabledCheats[i][0].c_str(), 2000, 0,
|
||||
false);
|
||||
m_RandomCheats::m_nTimer = timer;
|
||||
}
|
||||
break;
|
||||
@ -199,9 +198,9 @@ Game::Game()
|
||||
};
|
||||
}
|
||||
|
||||
void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
|
||||
void SetPlayerMission(std::string &rootkey, std::string &name, std::string &id)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
uint hplayer = CPools::GetPedRef(player);
|
||||
int interior = 0;
|
||||
|
||||
@ -223,15 +222,14 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
|
||||
#ifdef GTASA
|
||||
void Game::FreeCam()
|
||||
{
|
||||
int delta = (CTimer::m_snTimeInMillisecondsNonClipped -
|
||||
CTimer::m_snPreviousTimeInMillisecondsNonClipped);
|
||||
int delta = (CTimer::m_snTimeInMillisecondsNonClipped - CTimer::m_snPreviousTimeInMillisecondsNonClipped);
|
||||
|
||||
int ratio = 1 / (1 + (delta * m_Freecam::m_nMul));
|
||||
int speed = m_Freecam::m_nMul + m_Freecam::m_nMul * ratio * delta;
|
||||
|
||||
if (!m_Freecam::m_bInitDone)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
CPlayerPed *player = FindPlayerPed(-1);
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
|
||||
|
||||
m_Freecam::m_bHudState = patch::Get<BYTE>(0xBA6769); // hud
|
||||
@ -279,9 +277,9 @@ void Game::FreeCam()
|
||||
|
||||
if (freeCamTeleportPlayer.Pressed())
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
CPlayerPed *player = FindPlayerPed(-1);
|
||||
CVector pos = m_Freecam::m_pPed->GetPosition();
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
CEntity *player_entity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &player_entity) + 0.5f;
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player), pos.x, pos.y, pos.z);
|
||||
|
||||
@ -353,7 +351,8 @@ void Game::FreeCam()
|
||||
}
|
||||
|
||||
m_Freecam::m_pPed->SetHeading(m_Freecam::m_fTotalMouse.x);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(m_Freecam::m_nPed, 0.0, 0.0, 20.0, 90.0, 180, m_Freecam::m_fTotalMouse.y, 0.0, 2);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(m_Freecam::m_nPed, 0.0, 0.0, 20.0, 90.0, 180, m_Freecam::m_fTotalMouse.y,
|
||||
0.0, 2);
|
||||
m_Freecam::m_pPed->SetPosn(pos);
|
||||
CIplStore::AddIplsNeededAtPosn(pos);
|
||||
}
|
||||
@ -376,7 +375,7 @@ void Game::ClearFreecamStuff()
|
||||
void Game::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
#ifdef GTASA
|
||||
@ -417,11 +416,11 @@ void Game::Draw()
|
||||
patch::SetInt(0x4384D1, -0x7DF0F908, false); // correct?
|
||||
patch::SetInt(0x4384D5, 0xCC, false);
|
||||
#elif GTAVC
|
||||
patch::SetRaw(0x602BD8, (char*)"\x88\xD8\x89\xF1\x50", 5);
|
||||
patch::SetRaw(0x602BE7, (char*)"\xE8\x34\x91\xEA\xFF", 5);
|
||||
patch::SetRaw(0x602BD8, (char *)"\x88\xD8\x89\xF1\x50", 5);
|
||||
patch::SetRaw(0x602BE7, (char *)"\xE8\x34\x91\xEA\xFF", 5);
|
||||
#else // GTA3
|
||||
patch::SetRaw(0x5841B8, (char*)"\x88\xD8\x89\xF1\x50", 5);
|
||||
patch::SetRaw(0x5841C7, (char*)"\xE8\x84\xE2\xF0\xFF", 5);
|
||||
patch::SetRaw(0x5841B8, (char *)"\x88\xD8\x89\xF1\x50", 5);
|
||||
patch::SetRaw(0x5841C7, (char *)"\xE8\x84\xE2\xF0\xFF", 5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -464,11 +463,12 @@ of LS without completing missions"))
|
||||
{
|
||||
if (m_bFreezeTime)
|
||||
{
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010, 0x473460), (char*)"\xEB\xEF", 2);
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010, 0x473460), (char *)"\xEB\xEF", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010, 0x473460), (char*)BY_GAME("\x56\x8B", "\x6A\x01", "\x6A\x01"), 2);
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010, 0x473460),
|
||||
(char *)BY_GAME("\x56\x8B", "\x6A\x01", "\x6A\x01"), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,10 +480,11 @@ of LS without completing missions"))
|
||||
Command<Commands::FREEZE_ONSCREEN_TIMER>(m_bMissionTimer);
|
||||
}
|
||||
#ifdef GTASA
|
||||
if (Ui::CheckboxWithHint("Hard mode", &m_HardMode::m_bEnabled, "Makes the game more challanging to play. \n\
|
||||
if (Ui::CheckboxWithHint("Hard mode", &m_HardMode::m_bEnabled,
|
||||
"Makes the game more challanging to play. \n\
|
||||
Lowers armour, health, stamina etc."))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
if (m_HardMode::m_bEnabled)
|
||||
{
|
||||
@ -508,8 +509,9 @@ Lowers armour, health, stamina etc."))
|
||||
Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff);
|
||||
}
|
||||
Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot,
|
||||
(("Take screenshot using ") + quickSceenShot.GetNameString()
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
(("Take screenshot using ") + quickSceenShot.GetNameString() +
|
||||
"\nSaved inside 'GTA San Andreas User Files\\Gallery'")
|
||||
.c_str());
|
||||
Ui::CheckboxWithHint("Solid water", &m_bSolidWater,
|
||||
"Player can walk on water\nTurn this off if you want to swim.");
|
||||
#endif
|
||||
@ -576,15 +578,19 @@ Lowers armour, health, stamina etc."))
|
||||
|
||||
if (ImGui::InputInt("Hour", &hour))
|
||||
{
|
||||
if (hour < 0) hour = 23;
|
||||
if (hour > 23) hour = 0;
|
||||
if (hour < 0)
|
||||
hour = 23;
|
||||
if (hour > 23)
|
||||
hour = 0;
|
||||
CClock::ms_nGameClockHours = hour;
|
||||
}
|
||||
|
||||
if (ImGui::InputInt("Minute", &minute))
|
||||
{
|
||||
if (minute < 0) minute = 59;
|
||||
if (minute > 59) minute = 0;
|
||||
if (minute < 0)
|
||||
minute = 59;
|
||||
if (minute > 59)
|
||||
minute = 0;
|
||||
CClock::ms_nGameClockMinutes = minute;
|
||||
}
|
||||
|
||||
@ -593,8 +599,7 @@ Lowers armour, health, stamina etc."))
|
||||
}
|
||||
#ifdef GTASA
|
||||
static std::vector<Ui::NamedMemory> themes{
|
||||
{"Beach", 0x969159}, {"Country", 0x96917D}, {"Fun house", 0x969176}, {"Ninja", 0x96915C}
|
||||
};
|
||||
{"Beach", 0x969159}, {"Country", 0x96917D}, {"Fun house", 0x969176}, {"Ninja", 0x96915C}};
|
||||
Ui::EditRadioButtonAddress("Themes", themes);
|
||||
#endif
|
||||
if (ImGui::CollapsingHeader("Weather"))
|
||||
@ -747,7 +752,7 @@ It's recommanded not to save after using the mission loader. Use it at your own
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("Cheats list"))
|
||||
{
|
||||
for (std::string* element : m_RandomCheats::m_EnabledCheats)
|
||||
for (std::string *element : m_RandomCheats::m_EnabledCheats)
|
||||
{
|
||||
bool selected = (element[1] == "true") ? true : false;
|
||||
|
||||
|
12
src/game.h
12
src/game.h
@ -3,7 +3,7 @@
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
static inline ResourceStore m_MissionData{ "mission", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_MissionData{"mission", eResourceType::TYPE_TEXT};
|
||||
|
||||
static inline bool m_bDisableCheats;
|
||||
static inline bool m_bDisableReplay;
|
||||
@ -15,12 +15,10 @@ public:
|
||||
static inline bool m_bSolidWater; // walk on water hack
|
||||
static inline bool m_bScreenShot;
|
||||
static inline bool m_bKeepStuff;
|
||||
static inline ResourceStore m_StatData{ "stat", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_StatData{"stat", eResourceType::TYPE_TEXT};
|
||||
|
||||
static inline std::vector<std::string> m_DayNames =
|
||||
{
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
static inline std::vector<std::string> m_DayNames = {"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"};
|
||||
|
||||
struct m_RandomCheats
|
||||
{
|
||||
@ -37,7 +35,7 @@ public:
|
||||
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 CPed *m_pPed;
|
||||
static inline int m_nPed = -1;
|
||||
static inline CVector m_fMouse;
|
||||
static inline CVector m_fTotalMouse;
|
||||
|
54
src/hook.cpp
54
src/hook.cpp
@ -1,10 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "hook.h"
|
||||
#include "../depend/imgui/imgui_impl_dx11.h"
|
||||
#include "../depend/imgui/imgui_impl_dx9.h"
|
||||
#include "../depend/imgui/imgui_impl_win32.h"
|
||||
#include "../depend/kiero/kiero.h"
|
||||
#include "../depend/kiero/minhook/MinHook.h"
|
||||
#include "../depend/imgui/imgui_impl_dx9.h"
|
||||
#include "../depend/imgui/imgui_impl_dx11.h"
|
||||
#include "../depend/imgui/imgui_impl_win32.h"
|
||||
#include "pch.h"
|
||||
#include <dinput.h>
|
||||
|
||||
#define DIMOUSE ((LPDIRECTINPUTDEVICE8)(RsGlobal.ps->diMouse))
|
||||
@ -24,21 +24,21 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
HRESULT Hook::Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
||||
HRESULT Hook::Reset(IDirect3DDevice9 *pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters)
|
||||
{
|
||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
|
||||
return oReset(pDevice, pPresentationParameters);
|
||||
}
|
||||
|
||||
void Hook::RenderFrame(void* ptr)
|
||||
void Hook::RenderFrame(void *ptr)
|
||||
{
|
||||
if (!ImGui::GetCurrentContext())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
static bool bInit = false;
|
||||
|
||||
if (bInit)
|
||||
@ -64,7 +64,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
}
|
||||
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
ImGuiStyle *style = &ImGui::GetStyle();
|
||||
float scaleX = size.x / 1366.0f;
|
||||
float scaleY = size.y / 768.0f;
|
||||
|
||||
@ -109,7 +109,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
else
|
||||
{
|
||||
bInit = true;
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGuiStyle &style = ImGui::GetStyle();
|
||||
ImGui_ImplWin32_Init(RsGlobal.ps->window);
|
||||
|
||||
#ifdef GTASA
|
||||
@ -119,16 +119,16 @@ void Hook::RenderFrame(void* ptr)
|
||||
|
||||
if (gRenderer == Render_DirectX9)
|
||||
{
|
||||
ImGui_ImplDX9_Init(reinterpret_cast<IDirect3DDevice9*>(ptr));
|
||||
ImGui_ImplDX9_Init(reinterpret_cast<IDirect3DDevice9 *>(ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
// for dx11 device ptr is swapchain
|
||||
reinterpret_cast<IDXGISwapChain*>(ptr)->GetDevice(__uuidof(ID3D11Device), &ptr);
|
||||
ID3D11DeviceContext* context;
|
||||
reinterpret_cast<ID3D11Device*>(ptr)->GetImmediateContext(&context);
|
||||
reinterpret_cast<IDXGISwapChain *>(ptr)->GetDevice(__uuidof(ID3D11Device), &ptr);
|
||||
ID3D11DeviceContext *context;
|
||||
reinterpret_cast<ID3D11Device *>(ptr)->GetImmediateContext(&context);
|
||||
|
||||
ImGui_ImplDX11_Init(reinterpret_cast<ID3D11Device*>(ptr), context);
|
||||
ImGui_ImplDX11_Init(reinterpret_cast<ID3D11Device *>(ptr), context);
|
||||
}
|
||||
|
||||
ImGui_ImplWin32_EnableDpiAwareness();
|
||||
@ -142,13 +142,13 @@ void Hook::RenderFrame(void* ptr)
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Hook::Dx9Handler(IDirect3DDevice9* pDevice)
|
||||
HRESULT Hook::Dx9Handler(IDirect3DDevice9 *pDevice)
|
||||
{
|
||||
RenderFrame(pDevice);
|
||||
return oEndScene(pDevice);
|
||||
}
|
||||
|
||||
HRESULT Hook::Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
|
||||
HRESULT Hook::Dx11Handler(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
RenderFrame(pSwapChain);
|
||||
return oPresent11(pSwapChain, SyncInterval, Flags);
|
||||
@ -168,7 +168,6 @@ void Hook::ShowMouse(bool state)
|
||||
isController = patch::Get<BYTE>(0xBA6818);
|
||||
#endif
|
||||
|
||||
|
||||
if (isController && (m_bShowMouse || bMouseDisabled))
|
||||
{
|
||||
|
||||
@ -186,7 +185,7 @@ void Hook::ShowMouse(bool state)
|
||||
bMouseDisabled = true;
|
||||
#ifdef GTA3
|
||||
pad->m_bDisablePlayerControls = true;
|
||||
#else //GTAVC & GTASA
|
||||
#else // GTAVC & GTASA
|
||||
pad->DisablePlayerControls = true;
|
||||
#endif
|
||||
}
|
||||
@ -195,7 +194,7 @@ void Hook::ShowMouse(bool state)
|
||||
bMouseDisabled = false;
|
||||
#ifdef GTA3
|
||||
pad->m_bDisablePlayerControls = false;
|
||||
#else //GTAVC & GTASA
|
||||
#else // GTAVC & GTASA
|
||||
pad->DisablePlayerControls = false;
|
||||
#endif
|
||||
}
|
||||
@ -220,9 +219,9 @@ void Hook::ShowMouse(bool state)
|
||||
|
||||
patch::SetUChar(BY_GAME(0, 0x6020A0, 0x580D20), 0x53);
|
||||
#ifdef GTAVC
|
||||
patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5);
|
||||
patch::SetRaw(0x4AB6CA, (char *)"\xE8\x51\x21\x00\x00", 5);
|
||||
#else // GTA3
|
||||
patch::SetRaw(0x49272F, (char*)"\xE8\x6C\xF5\xFF\xFF", 5);
|
||||
patch::SetRaw(0x49272F, (char *)"\xE8\x6C\xF5\xFF\xFF", 5);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -247,8 +246,8 @@ Hook::Hook()
|
||||
if (init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
{
|
||||
gRenderer = Render_DirectX9;
|
||||
kiero::bind(16, (void**)&oReset, Reset);
|
||||
kiero::bind(42, (void**)&oEndScene, Dx9Handler);
|
||||
kiero::bind(16, (void **)&oReset, Reset);
|
||||
kiero::bind(42, (void **)&oEndScene, Dx9Handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -256,7 +255,7 @@ Hook::Hook()
|
||||
if (init(kiero::RenderType::D3D11) == kiero::Status::Success)
|
||||
{
|
||||
gRenderer = Render_DirectX11;
|
||||
kiero::bind(8, (void**)&oPresent11, Dx11Handler);
|
||||
kiero::bind(8, (void **)&oPresent11, Dx11Handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -296,7 +295,7 @@ static BOOL __stdcall _SetCursorPos(int X, int Y)
|
||||
return SetCursorPos(X, Y);
|
||||
}
|
||||
|
||||
static LRESULT __stdcall _DispatchMessage(MSG* lpMsg)
|
||||
static LRESULT __stdcall _DispatchMessage(MSG *lpMsg)
|
||||
{
|
||||
if (lpMsg->message == WM_MOUSEWHEEL && !Hook::m_bShowMouse)
|
||||
{
|
||||
@ -306,7 +305,7 @@ static LRESULT __stdcall _DispatchMessage(MSG* lpMsg)
|
||||
return DispatchMessageA(lpMsg);
|
||||
}
|
||||
|
||||
static int _cdecl _GetMouseState(Mouse* pMouse)
|
||||
static int _cdecl _GetMouseState(Mouse *pMouse)
|
||||
{
|
||||
if (Hook::m_bShowMouse || !RsGlobal.ps->diMouse)
|
||||
{
|
||||
@ -318,7 +317,8 @@ static int _cdecl _GetMouseState(Mouse* pMouse)
|
||||
{
|
||||
if (DIMOUSE->Acquire() == DIERR_NOTINITIALIZED)
|
||||
{
|
||||
while (DIMOUSE->Acquire() == DIERR_NOTINITIALIZED);
|
||||
while (DIMOUSE->Acquire() == DIERR_NOTINITIALIZED)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
14
src/hook.h
14
src/hook.h
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
using f_EndScene = HRESULT(CALLBACK*)(IDirect3DDevice9*);
|
||||
using f_Present11 = HRESULT(CALLBACK*)(IDXGISwapChain*, UINT, UINT);
|
||||
using f_Reset = HRESULT(CALLBACK*)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
||||
using f_EndScene = HRESULT(CALLBACK *)(IDirect3DDevice9 *);
|
||||
using f_Present11 = HRESULT(CALLBACK *)(IDXGISwapChain *, UINT, UINT);
|
||||
using f_Reset = HRESULT(CALLBACK *)(IDirect3DDevice9 *, D3DPRESENT_PARAMETERS *);
|
||||
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@ -16,10 +16,10 @@ private:
|
||||
static inline f_Reset oReset;
|
||||
static inline bool m_bMouseVisibility;
|
||||
|
||||
static void CALLBACK RenderFrame(void* ptr);
|
||||
static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice);
|
||||
static HRESULT CALLBACK Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT CALLBACK Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
static void CALLBACK RenderFrame(void *ptr);
|
||||
static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9 *pDevice);
|
||||
static HRESULT CALLBACK Dx11Handler(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT CALLBACK Reset(IDirect3DDevice9 *pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters);
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static void ShowMouse(bool state);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "hotkeys.h"
|
||||
#include "pch.h"
|
||||
|
||||
Hotkey aimSkinChanger;
|
||||
Hotkey freeCam;
|
||||
@ -15,7 +15,7 @@ Hotkey vehEngine;
|
||||
Hotkey vehInstantStart;
|
||||
Hotkey vehInstantStop;
|
||||
|
||||
bool Hotkey::DrawUI(const char* label)
|
||||
bool Hotkey::DrawUI(const char *label)
|
||||
{
|
||||
bool active = m_CurrentHotkey == label;
|
||||
bool state = false;
|
||||
|
@ -11,12 +11,12 @@ public:
|
||||
int m_key1;
|
||||
int m_key2;
|
||||
|
||||
Hotkey(int key1 = -1, int key2 = -1)
|
||||
: m_key1(key1), m_key2(key2)
|
||||
{}
|
||||
Hotkey(int key1 = -1, int key2 = -1) : m_key1(key1), m_key2(key2)
|
||||
{
|
||||
}
|
||||
|
||||
// Draws ui to change the hotkeys from frontend
|
||||
bool DrawUI(const char* label);
|
||||
bool DrawUI(const char *label);
|
||||
bool Pressed();
|
||||
std::string GetNameString();
|
||||
};
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "pch.h"
|
||||
#include "json.h"
|
||||
#include "pch.h"
|
||||
|
||||
CJson::CJson(const char* name)
|
||||
CJson::CJson(const char *name)
|
||||
{
|
||||
if (name == "" || !std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
|
||||
if (name == "" || !std::filesystem::is_directory(PLUGIN_PATH((char *)"CheatMenu")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_FilePath = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json";
|
||||
m_FilePath = PLUGIN_PATH((char *)"/CheatMenu/json/") + std::string(name) + ".json";
|
||||
|
||||
if (std::filesystem::exists(m_FilePath))
|
||||
{
|
||||
|
23
src/json.h
23
src/json.h
@ -19,15 +19,14 @@ public:
|
||||
*/
|
||||
// specialize since typeid(std::string) doesn't work
|
||||
|
||||
template <typename T>
|
||||
T GetValue(std::string&& key, T&& defaultVal)
|
||||
template <typename T> T GetValue(std::string &&key, T &&defaultVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &m_Data;
|
||||
nlohmann::json *json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
{
|
||||
@ -47,15 +46,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string GetValue(std::string&& key, std::string&& defaultVal)
|
||||
template <> std::string GetValue(std::string &&key, std::string &&defaultVal)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &m_Data;
|
||||
nlohmann::json *json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
{
|
||||
@ -74,18 +72,16 @@ public:
|
||||
Allows to save values in json hierarchy using '.'
|
||||
Example: "Menu.Window.X"
|
||||
*/
|
||||
template <typename T>
|
||||
void SetValue(std::string&& key, T& val)
|
||||
template <typename T> void SetValue(std::string &&key, T &val)
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &m_Data;
|
||||
nlohmann::json *json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
{
|
||||
json = &((*json)[line]);
|
||||
|
||||
}
|
||||
|
||||
// json library bugs with bool, using int instead
|
||||
@ -99,13 +95,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void SetValue(std::string&& key, std::string& val)
|
||||
template <> void SetValue(std::string &&key, std::string &val)
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &m_Data;
|
||||
nlohmann::json *json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
{
|
||||
@ -119,5 +114,5 @@ public:
|
||||
Saves json data to disk
|
||||
*/
|
||||
void WriteToDisk();
|
||||
CJson(const char* text = "");
|
||||
CJson(const char *text = "");
|
||||
};
|
||||
|
42
src/menu.cpp
42
src/menu.cpp
@ -1,14 +1,15 @@
|
||||
#include "pch.h"
|
||||
#include "menuinfo.h"
|
||||
#include "menu.h"
|
||||
#include "menuinfo.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "updater.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include "teleport.h"
|
||||
#include "weapon.h"
|
||||
#include "vehicle.h"
|
||||
#include "weapon.h"
|
||||
|
||||
#endif
|
||||
|
||||
Menu::Menu()
|
||||
@ -74,16 +75,19 @@ Menu::Menu()
|
||||
|
||||
void Menu::DrawOverlay()
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
if (pPlayer)
|
||||
{
|
||||
bool m_bShowMenu = m_Overlay::bCoord || m_Overlay::bFPS || m_Overlay::bLocName || m_Overlay::bCpuUsage || m_Overlay::bMemUsage ||
|
||||
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && pPlayer && pPlayer->m_pVehicle && pPlayer->m_pVehicle->m_pDriver == pPlayer);
|
||||
bool m_bShowMenu = m_Overlay::bCoord || m_Overlay::bFPS || m_Overlay::bLocName || m_Overlay::bCpuUsage ||
|
||||
m_Overlay::bMemUsage ||
|
||||
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && pPlayer && pPlayer->m_pVehicle &&
|
||||
pPlayer->m_pVehicle->m_pDriver == pPlayer);
|
||||
|
||||
const float offset = 10.0f;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoNav;
|
||||
|
||||
if (m_Overlay::mSelectedPos == DISPLAY_POS::CUSTOM)
|
||||
{
|
||||
@ -130,7 +134,7 @@ void Menu::DrawOverlay()
|
||||
|
||||
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
|
||||
{
|
||||
CVector pos{0,0,0};
|
||||
CVector pos{0, 0, 0};
|
||||
pos = pPlayer->GetPosition();
|
||||
|
||||
size_t game_ms = CTimer::m_snTimeInMilliseconds;
|
||||
@ -143,7 +147,8 @@ void Menu::DrawOverlay()
|
||||
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
GlobalMemoryStatusEx(&memInfo);
|
||||
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
|
||||
m_Overlay::fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam));
|
||||
m_Overlay::fMemUsage =
|
||||
100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam));
|
||||
|
||||
m_Overlay::mFPS = static_cast<size_t>(BY_GAME(CTimer::game_FPS, io.Framerate, io.Framerate));
|
||||
m_Overlay::mLastInterval = game_ms;
|
||||
@ -206,8 +211,7 @@ void Menu::DrawShortcutsWindow()
|
||||
ImGui::SetNextWindowSize(ImVec2(resX, 40));
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize +
|
||||
ImGuiWindowFlags_NoSavedSettings
|
||||
+ ImGuiWindowFlags_NoMove;
|
||||
ImGuiWindowFlags_NoSavedSettings + ImGuiWindowFlags_NoMove;
|
||||
|
||||
if (ImGui::Begin("Shortcuts window", nullptr, flags))
|
||||
{
|
||||
@ -268,7 +272,7 @@ void Menu::ProcessCommands()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
#ifdef GTASA
|
||||
if (command == "tp")
|
||||
{
|
||||
try
|
||||
@ -306,9 +310,9 @@ void Menu::ProcessCommands()
|
||||
}
|
||||
else
|
||||
{
|
||||
eWeaponType weapon = CWeaponInfo::FindWeaponType((char*)wep_name.c_str());
|
||||
eWeaponType weapon = CWeaponInfo::FindWeaponType((char *)wep_name.c_str());
|
||||
std::string weapon_name = std::to_string(weapon);
|
||||
CWeaponInfo* pweaponinfo = CWeaponInfo::GetWeaponInfo(weapon, 1);
|
||||
CWeaponInfo *pweaponinfo = CWeaponInfo::GetWeaponInfo(weapon, 1);
|
||||
|
||||
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
|
||||
{
|
||||
@ -336,7 +340,7 @@ void Menu::ProcessCommands()
|
||||
else
|
||||
SetHelpMessage("Invalid command", false, false, false);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Menu::Draw()
|
||||
@ -348,7 +352,7 @@ void Menu::Draw()
|
||||
ImGui::Spacing();
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine();
|
||||
if (Ui::ListBox("Overlay", m_Overlay::posNames, (int&)m_Overlay::mSelectedPos))
|
||||
if (Ui::ListBox("Overlay", m_Overlay::posNames, (int &)m_Overlay::mSelectedPos))
|
||||
gConfig.SetValue("overlay.selected_pos", m_Overlay::mSelectedPos);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -538,7 +542,7 @@ void Menu::Draw()
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
ImGui::Text("Author: Grinch_");
|
||||
|
||||
ImGui::Text("Version: %s",MENU_VERSION);
|
||||
ImGui::Text("Version: %s", MENU_VERSION);
|
||||
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("ImGui: %s", ImGui::GetVersion());
|
||||
|
@ -3,7 +3,6 @@
|
||||
class Menu
|
||||
{
|
||||
private:
|
||||
|
||||
enum DISPLAY_POS
|
||||
{
|
||||
CUSTOM,
|
||||
@ -26,9 +25,8 @@ private:
|
||||
static inline float fCpuUsage = 0.0f;
|
||||
static inline bool bMemUsage = false;
|
||||
static inline float fMemUsage = 0.0f;
|
||||
static inline std::vector<std::string> posNames = {
|
||||
"Custom", "Top left", "Top right", "Bottom left", "Bottom right"
|
||||
};
|
||||
static inline std::vector<std::string> posNames = {"Custom", "Top left", "Top right", "Bottom left",
|
||||
"Bottom right"};
|
||||
static inline DISPLAY_POS mSelectedPos = DISPLAY_POS::BOTTOM_RIGHT;
|
||||
static inline float fPosX = 0.0f;
|
||||
static inline float fPosY = 0.0f;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION_NUMBER "3.0"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER "-beta"
|
||||
#define BUILD_NUMBER "20211020"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"
|
||||
|
278
src/neon.cpp
278
src/neon.cpp
@ -1,187 +1,119 @@
|
||||
#include "pch.h"
|
||||
#include "neon.h"
|
||||
#include "pch.h"
|
||||
#include "util.h"
|
||||
|
||||
// Neon sprite
|
||||
const unsigned char neon_mask[1689] =
|
||||
{
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
|
||||
0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
|
||||
0x00, 0x80, 0x08, 0x06, 0x00, 0x00, 0x00, 0xbb, 0x81, 0x6f, 0x6a,
|
||||
0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b,
|
||||
0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00,
|
||||
0x00, 0x00, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x00, 0x00, 0x7a, 0x25,
|
||||
0x00, 0x00, 0x80, 0x83, 0x00, 0x00, 0xf9, 0xff, 0x00, 0x00, 0x80,
|
||||
0xe9, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0xea, 0x60, 0x00, 0x00,
|
||||
0x3a, 0x98, 0x00, 0x00, 0x17, 0x6f, 0x92, 0x5f, 0xc5, 0x46, 0x00,
|
||||
0x00, 0x06, 0x1f, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xec, 0x5d,
|
||||
0xdb, 0x8e, 0xe4, 0x2a, 0x0c, 0x64, 0xa3, 0xf3, 0x10, 0x45, 0x49,
|
||||
0x2b, 0xe2, 0xff, 0xbf, 0x11, 0x45, 0x09, 0x42, 0x79, 0x9b, 0xf3,
|
||||
0x34, 0xda, 0xde, 0x08, 0x70, 0xd9, 0x18, 0x42, 0x66, 0x1a, 0x69,
|
||||
0xb4, 0xdb, 0x37, 0x3a, 0x55, 0x2e, 0x97, 0x0d, 0xdd, 0x6a, 0xfe,
|
||||
0x7c, 0x7d, 0x7d, 0x99, 0x86, 0x63, 0x01, 0x9f, 0x77, 0xb4, 0xba,
|
||||
0xa0, 0x3f, 0x95, 0x09, 0x58, 0x14, 0xe6, 0x38, 0x9e, 0x46, 0x00,
|
||||
0x02, 0xda, 0x26, 0xee, 0x77, 0xad, 0xc9, 0xd0, 0x24, 0x60, 0x11,
|
||||
0x82, 0x36, 0x02, 0x32, 0x8e, 0xde, 0x08, 0x58, 0x98, 0xa0, 0x2d,
|
||||
0x03, 0xb0, 0xab, 0x49, 0x82, 0x06, 0x01, 0x4b, 0x21, 0x70, 0x14,
|
||||
0x74, 0x15, 0x22, 0x4a, 0x09, 0x40, 0xc1, 0x53, 0xf7, 0xa1, 0xd1,
|
||||
0x77, 0xbd, 0x10, 0x80, 0x4a, 0xde, 0x0a, 0x14, 0xe0, 0x84, 0x6a,
|
||||
0x38, 0x5a, 0x11, 0xa0, 0x01, 0x7e, 0x8d, 0xbc, 0x7e, 0x63, 0x12,
|
||||
0xa1, 0x42, 0x82, 0x16, 0x01, 0x96, 0x41, 0xc4, 0x9a, 0x99, 0xbb,
|
||||
0x39, 0x09, 0x5c, 0x02, 0x16, 0x66, 0xe4, 0x53, 0x51, 0x7f, 0x45,
|
||||
0xe6, 0xd9, 0x41, 0x22, 0x9c, 0xa6, 0x31, 0x72, 0x08, 0xa8, 0x01,
|
||||
0x7e, 0x36, 0xc6, 0x78, 0x90, 0x08, 0x0e, 0x09, 0x4d, 0x08, 0x48,
|
||||
0x81, 0x4f, 0x49, 0xfe, 0x0a, 0x3c, 0x36, 0x7c, 0x6b, 0x12, 0x50,
|
||||
0x02, 0x16, 0x41, 0xe4, 0x63, 0x51, 0x9f, 0x13, 0x24, 0x78, 0x06,
|
||||
0x11, 0xaa, 0x24, 0x0c, 0xca, 0x2d, 0xae, 0x04, 0xfc, 0xf7, 0xed,
|
||||
0xd8, 0xe3, 0xaf, 0x88, 0x92, 0x2c, 0x68, 0xbe, 0xd0, 0x18, 0x04,
|
||||
0xaf, 0xb1, 0x05, 0xe0, 0xdf, 0x81, 0x4e, 0x97, 0xbf, 0xeb, 0xe3,
|
||||
0x73, 0xc6, 0x30, 0x45, 0x60, 0xb5, 0x08, 0x40, 0xc0, 0xbf, 0x12,
|
||||
0xe0, 0xcd, 0x05, 0xf0, 0xf4, 0x36, 0xc7, 0x14, 0x51, 0xc0, 0x95,
|
||||
0x84, 0x95, 0x59, 0x82, 0x97, 0x52, 0x02, 0x16, 0x01, 0xf3, 0xaf,
|
||||
0x4b, 0x34, 0xaf, 0x51, 0xbf, 0x02, 0x9e, 0x12, 0xff, 0xa7, 0x48,
|
||||
0xb0, 0x77, 0x2a, 0x80, 0x92, 0x7e, 0xcc, 0xe5, 0x63, 0x20, 0x4d,
|
||||
0x42, 0x01, 0x14, 0x09, 0xb9, 0xca, 0xc3, 0x52, 0xc1, 0x50, 0x18,
|
||||
0x7d, 0x4b, 0x94, 0xba, 0x58, 0xbe, 0x5f, 0x41, 0x4f, 0x89, 0xdb,
|
||||
0x29, 0x12, 0x90, 0x54, 0x68, 0xe2, 0x01, 0xa9, 0x31, 0x67, 0x22,
|
||||
0x9b, 0x03, 0x9e, 0x52, 0xcb, 0x75, 0x4e, 0x24, 0x15, 0xac, 0x36,
|
||||
0x01, 0x36, 0x23, 0xbb, 0xf7, 0xe8, 0xc7, 0x0c, 0xcf, 0x10, 0x60,
|
||||
0x29, 0x52, 0x26, 0xa2, 0x3c, 0x16, 0xed, 0x56, 0x0d, 0xc2, 0xda,
|
||||
0x9f, 0x32, 0x3e, 0x29, 0x78, 0x8e, 0xb2, 0xe6, 0x4c, 0x6f, 0xc0,
|
||||
0xee, 0x0b, 0xb8, 0x29, 0x60, 0x41, 0xe3, 0x2b, 0x01, 0x3f, 0x31,
|
||||
0x53, 0xa1, 0x48, 0x05, 0x03, 0x53, 0xfe, 0x68, 0xf4, 0x0d, 0xe0,
|
||||
0x03, 0xc6, 0x18, 0x33, 0x0a, 0x48, 0xa0, 0x54, 0x50, 0x6c, 0x82,
|
||||
0x4b, 0x85, 0xe8, 0xe7, 0xc0, 0x8f, 0x09, 0x22, 0x26, 0x66, 0xea,
|
||||
0x89, 0xda, 0xe3, 0xd2, 0x2a, 0x50, 0x12, 0x7d, 0x54, 0x0d, 0x57,
|
||||
0x52, 0x67, 0xe2, 0xfd, 0x6e, 0x2f, 0x83, 0x14, 0xe8, 0x31, 0x03,
|
||||
0x76, 0x14, 0x92, 0xb7, 0x12, 0x4b, 0x72, 0x31, 0x01, 0x16, 0x94,
|
||||
0xff, 0x4c, 0xd4, 0x73, 0x24, 0xca, 0x1c, 0x52, 0xa5, 0x66, 0xb8,
|
||||
0x68, 0x2a, 0xe0, 0x55, 0x49, 0x3d, 0x94, 0x0a, 0x28, 0x33, 0x64,
|
||||
0x99, 0xf8, 0x50, 0x58, 0xff, 0x73, 0xdd, 0x9b, 0x66, 0xf4, 0x29,
|
||||
0xf0, 0xc8, 0xce, 0x14, 0x3b, 0x05, 0x90, 0x09, 0x38, 0x46, 0x74,
|
||||
0x2a, 0x7a, 0xca, 0xa4, 0xa5, 0x46, 0x4e, 0x1f, 0x60, 0x13, 0x52,
|
||||
0x9b, 0x19, 0xe6, 0x27, 0x4d, 0x83, 0x6a, 0x63, 0xa8, 0x94, 0xff,
|
||||
0x1a, 0xf2, 0x47, 0x5f, 0xc3, 0xf5, 0x81, 0x25, 0x45, 0x00, 0x37,
|
||||
0xff, 0x6b, 0x44, 0x9e, 0xe3, 0x31, 0x2a, 0x3e, 0xc0, 0x55, 0xc0,
|
||||
0x5a, 0xe0, 0x01, 0xb5, 0x87, 0xa8, 0x1c, 0x0e, 0xcc, 0xfa, 0x2f,
|
||||
0x6d, 0x7e, 0x6a, 0x37, 0x5b, 0x73, 0x4b, 0x0f, 0x78, 0x11, 0xf2,
|
||||
0xd7, 0x24, 0x62, 0x14, 0x80, 0x5f, 0x6b, 0x11, 0xb0, 0x0a, 0xa2,
|
||||
0x3f, 0x56, 0x8c, 0x3a, 0x55, 0x0e, 0x21, 0x15, 0x0f, 0x40, 0xfd,
|
||||
0xb7, 0x8c, 0x1e, 0x60, 0x32, 0x0f, 0x1b, 0x43, 0xa6, 0x02, 0x58,
|
||||
0x81, 0xfc, 0x6b, 0x44, 0x7f, 0x04, 0xab, 0xc1, 0x2c, 0x49, 0x83,
|
||||
0x5a, 0xab, 0xc1, 0xb1, 0x93, 0xf9, 0x48, 0x35, 0x7f, 0x13, 0x70,
|
||||
0x30, 0xf3, 0x5f, 0xb2, 0x01, 0xd2, 0xaa, 0x1a, 0xb0, 0x3e, 0x4a,
|
||||
0x1b, 0x88, 0x26, 0xc8, 0x66, 0xea, 0xac, 0xd4, 0xf8, 0x90, 0xcf,
|
||||
0x07, 0xa8, 0x79, 0xd5, 0x48, 0xff, 0x8f, 0xb9, 0x10, 0x2a, 0xdd,
|
||||
0xf5, 0xa9, 0x65, 0x98, 0xdf, 0x73, 0xf9, 0x8b, 0x6a, 0x37, 0x29,
|
||||
0x01, 0x5c, 0xf9, 0x6b, 0x01, 0xbd, 0x3e, 0x37, 0x44, 0x54, 0x70,
|
||||
0xbe, 0x3d, 0x37, 0x64, 0x7a, 0x95, 0x5d, 0x62, 0x82, 0xb6, 0x30,
|
||||
0x7a, 0x31, 0xf9, 0x87, 0x4a, 0xb9, 0x1f, 0x12, 0xd7, 0x32, 0x97,
|
||||
0x6c, 0x88, 0xe4, 0xf2, 0x7f, 0x06, 0xca, 0x91, 0xb6, 0xd4, 0xa7,
|
||||
0x0c, 0xc9, 0x31, 0x1f, 0x61, 0x77, 0x85, 0xdc, 0x32, 0x38, 0xdf,
|
||||
0x98, 0xe7, 0xa5, 0xf3, 0x5b, 0x0d, 0x02, 0x24, 0x0d, 0x4b, 0x0d,
|
||||
0x90, 0xd4, 0x7b, 0xcd, 0xc0, 0xea, 0x70, 0x41, 0x5a, 0xe1, 0x95,
|
||||
0xb8, 0xa0, 0x1e, 0x5b, 0xdf, 0x99, 0xc0, 0x64, 0xb9, 0x0a, 0x78,
|
||||
0x01, 0x51, 0x19, 0xcd, 0x43, 0xc7, 0x60, 0xb0, 0x9d, 0xa0, 0xbb,
|
||||
0x73, 0x1f, 0x35, 0xc3, 0x89, 0xb9, 0x8a, 0x25, 0x37, 0x44, 0x7a,
|
||||
0x5a, 0xed, 0x55, 0xa9, 0x36, 0x43, 0x06, 0xf4, 0x4a, 0xa8, 0x60,
|
||||
0xea, 0x90, 0x24, 0xae, 0x11, 0x8a, 0xaa, 0x40, 0x4f, 0xf9, 0x3f,
|
||||
0x82, 0xcd, 0x50, 0x76, 0x35, 0x78, 0x30, 0x0d, 0xb0, 0xf7, 0x31,
|
||||
0x49, 0x53, 0x40, 0xcb, 0x00, 0xbb, 0x01, 0xa7, 0xd9, 0x08, 0x3d,
|
||||
0x25, 0xff, 0xd9, 0xef, 0xcf, 0x59, 0x0c, 0x21, 0x1d, 0x59, 0xaf,
|
||||
0x2a, 0x58, 0x35, 0x4c, 0x30, 0x74, 0x92, 0x06, 0xaa, 0xd7, 0x31,
|
||||
0x34, 0xca, 0xbf, 0x3b, 0x15, 0xf0, 0xd2, 0x2e, 0x83, 0x3f, 0x6a,
|
||||
0xfc, 0x74, 0x02, 0xe6, 0xdf, 0x4e, 0xc0, 0xaf, 0x57, 0x80, 0xff,
|
||||
0x28, 0x40, 0x91, 0x80, 0xa7, 0x96, 0xc1, 0xfd, 0xb7, 0x97, 0x41,
|
||||
0x96, 0x02, 0x1c, 0x93, 0xf9, 0xf3, 0x01, 0x0a, 0x30, 0x26, 0xf3,
|
||||
0x01, 0x09, 0xaa, 0x00, 0x0f, 0x5e, 0x44, 0x78, 0x58, 0x7a, 0x40,
|
||||
0x04, 0x78, 0xd3, 0xcf, 0x28, 0x21, 0xd8, 0xa5, 0x08, 0x58, 0xa4,
|
||||
0x06, 0xd2, 0xe9, 0x08, 0xda, 0x0a, 0xa0, 0xde, 0xe0, 0xbc, 0x11,
|
||||
0xec, 0x99, 0xb8, 0x26, 0x8f, 0xaa, 0x60, 0xc8, 0x3c, 0xb8, 0x3d,
|
||||
0xd4, 0x07, 0xde, 0xaf, 0x77, 0x97, 0x2a, 0xc0, 0x75, 0x08, 0x2e,
|
||||
0xd4, 0xf0, 0x07, 0x6a, 0x4f, 0x50, 0x6a, 0x84, 0xa1, 0x01, 0xf8,
|
||||
0x98, 0xfc, 0x03, 0xa7, 0x04, 0xa2, 0x1e, 0xb0, 0x77, 0xee, 0x03,
|
||||
0xea, 0xad, 0xb0, 0x23, 0xd8, 0x0b, 0x1d, 0xe6, 0x3b, 0xa5, 0xd6,
|
||||
0xe4, 0x0f, 0x2d, 0x68, 0x2e, 0x86, 0xce, 0x4a, 0x69, 0x10, 0x04,
|
||||
0xef, 0x85, 0x18, 0xe0, 0x21, 0x21, 0xe0, 0x6e, 0x2f, 0x28, 0x99,
|
||||
0xdf, 0x71, 0x3d, 0xc0, 0x5d, 0x7c, 0x20, 0x55, 0x06, 0x43, 0x45,
|
||||
0x12, 0x50, 0xf3, 0xfb, 0xbe, 0xed, 0x39, 0x06, 0xc8, 0x5d, 0x0c,
|
||||
0x21, 0xa0, 0xce, 0x86, 0xab, 0xc8, 0x09, 0x6c, 0x82, 0xb2, 0x98,
|
||||
0x90, 0x6f, 0x89, 0x6d, 0xe6, 0xdf, 0x7d, 0x75, 0x6f, 0xfe, 0xee,
|
||||
0xb5, 0x05, 0x00, 0x60, 0x60, 0x10, 0x12, 0x18, 0x3e, 0x13, 0x34,
|
||||
0x5a, 0x78, 0x6e, 0x23, 0xe4, 0x15, 0x65, 0x1e, 0xde, 0xfe, 0x34,
|
||||
0xbc, 0x80, 0x2d, 0xff, 0x77, 0x02, 0x0e, 0xd0, 0x07, 0xa4, 0x69,
|
||||
0x10, 0x03, 0x4e, 0xdd, 0x87, 0x44, 0xbf, 0x98, 0x3c, 0xea, 0xab,
|
||||
0xb2, 0xc8, 0xba, 0x40, 0xed, 0x62, 0x14, 0x8c, 0x32, 0x55, 0xfe,
|
||||
0x9c, 0xe6, 0x6a, 0x50, 0xd2, 0x13, 0xdc, 0x35, 0x1f, 0xf9, 0xeb,
|
||||
0x73, 0xb9, 0x14, 0x70, 0x09, 0x73, 0xf1, 0x60, 0xee, 0x9f, 0x95,
|
||||
0xc0, 0x87, 0x44, 0xe4, 0x3d, 0x37, 0xff, 0x91, 0x56, 0x98, 0x6b,
|
||||
0x88, 0x3d, 0xb6, 0xc6, 0x6a, 0x1b, 0x22, 0x9b, 0x52, 0x5f, 0xa0,
|
||||
0xd9, 0xf9, 0x85, 0x4c, 0xf9, 0x73, 0x89, 0x7f, 0x8b, 0x3d, 0x80,
|
||||
0x4a, 0x83, 0xd0, 0x20, 0xf7, 0x43, 0x46, 0x89, 0x9b, 0x86, 0x02,
|
||||
0x20, 0xf6, 0x6e, 0x96, 0x7f, 0x28, 0x58, 0xa3, 0x88, 0x15, 0xb0,
|
||||
0x15, 0x2e, 0x8e, 0x6a, 0x0e, 0xce, 0x06, 0xee, 0x11, 0x23, 0x80,
|
||||
0xfb, 0x8b, 0xac, 0xad, 0xab, 0x41, 0x60, 0x44, 0x1e, 0x56, 0xee,
|
||||
0x50, 0x89, 0x6d, 0x8d, 0x1d, 0xa3, 0x53, 0x10, 0x88, 0x0d, 0xe8,
|
||||
0x07, 0x0e, 0x2e, 0x01, 0x57, 0x36, 0xb7, 0x06, 0x4a, 0x68, 0xb6,
|
||||
0xc5, 0x86, 0xee, 0x07, 0x68, 0x6c, 0x90, 0x8c, 0x0a, 0xf2, 0x47,
|
||||
0xca, 0x5f, 0x11, 0x01, 0x87, 0x62, 0x8e, 0xd6, 0xd8, 0x38, 0x55,
|
||||
0xcd, 0xff, 0xd2, 0xb5, 0x40, 0xad, 0x8f, 0xcd, 0x4e, 0x46, 0xf4,
|
||||
0xb9, 0xf9, 0xcf, 0x26, 0xc0, 0x01, 0x3e, 0xf0, 0xde, 0x87, 0x53,
|
||||
0x52, 0x3d, 0x2b, 0x44, 0x5f, 0x54, 0xfe, 0x6a, 0xaf, 0x06, 0x29,
|
||||
0x33, 0x3c, 0x85, 0xd1, 0xa7, 0xfa, 0x13, 0x96, 0xfc, 0x35, 0x08,
|
||||
0xd8, 0x81, 0x9c, 0x0c, 0x42, 0xe9, 0xa7, 0xfc, 0xc5, 0x6b, 0x36,
|
||||
0x61, 0x03, 0x22, 0x13, 0x30, 0x0d, 0xb8, 0x1b, 0x24, 0x27, 0xa1,
|
||||
0x88, 0x20, 0xf4, 0x21, 0x87, 0xe6, 0x3f, 0xb7, 0x0f, 0xa8, 0xa1,
|
||||
0x02, 0x64, 0xb1, 0x43, 0x75, 0x80, 0x1b, 0x57, 0xf6, 0x25, 0x29,
|
||||
0x50, 0xa2, 0x82, 0x20, 0xf0, 0x8f, 0xeb, 0x3c, 0x52, 0xf3, 0x4b,
|
||||
0x2a, 0x7b, 0xe0, 0x3c, 0x99, 0xa9, 0x82, 0x12, 0x12, 0x72, 0x4d,
|
||||
0x97, 0x07, 0xcd, 0x4f, 0xb5, 0x0f, 0x70, 0x80, 0x0a, 0xf6, 0xc8,
|
||||
0x45, 0x72, 0x48, 0x08, 0x0c, 0xe9, 0xab, 0x44, 0xbf, 0x56, 0x19,
|
||||
0x44, 0xbe, 0x49, 0x12, 0x08, 0x52, 0x10, 0xe9, 0xe7, 0x72, 0x5f,
|
||||
0xa5, 0x0c, 0x1e, 0xc0, 0xa4, 0x31, 0x15, 0xa4, 0x1a, 0x24, 0xe4,
|
||||
0xf3, 0x80, 0x90, 0x01, 0x4f, 0x75, 0x7d, 0x4d, 0x4c, 0x30, 0x97,
|
||||
0x12, 0x1b, 0x51, 0x0d, 0x42, 0x02, 0x74, 0xce, 0xfc, 0x3c, 0x21,
|
||||
0x7d, 0x24, 0xf7, 0x8f, 0x12, 0x02, 0x0e, 0x01, 0xcb, 0xfb, 0x45,
|
||||
0x01, 0xa9, 0x56, 0x39, 0x24, 0xa2, 0x4e, 0x81, 0x2f, 0x2a, 0x7b,
|
||||
0x9a, 0x1e, 0xe0, 0x88, 0x54, 0xd8, 0x13, 0x40, 0x02, 0x60, 0x8e,
|
||||
0x14, 0x78, 0xb4, 0xf1, 0x39, 0x6a, 0x10, 0xe0, 0x18, 0xa9, 0x10,
|
||||
0x23, 0x21, 0xe6, 0x0b, 0x21, 0xf2, 0xb8, 0x07, 0xbb, 0xbd, 0xea,
|
||||
0x0a, 0x38, 0x0a, 0xfd, 0x60, 0x8f, 0xf8, 0x42, 0xec, 0x50, 0x15,
|
||||
0x4f, 0x94, 0xbb, 0x0d, 0x0c, 0x00, 0x6b, 0x7c, 0x8e, 0xd9, 0xf9,
|
||||
0x1c, 0xb4, 0xf4, 0x39, 0x6a, 0xeb, 0x73, 0xd8, 0x9a, 0x06, 0x01,
|
||||
0x08, 0xf0, 0x1f, 0x73, 0xdc, 0x9e, 0x16, 0x09, 0xe8, 0xfe, 0x43,
|
||||
0x77, 0x07, 0x2e, 0x72, 0x3d, 0x01, 0xb9, 0xef, 0x71, 0x47, 0x6e,
|
||||
0x4a, 0x48, 0x40, 0x15, 0xc0, 0x5d, 0xe1, 0xdd, 0x4e, 0x00, 0x27,
|
||||
0x25, 0x72, 0xf7, 0x3f, 0xf6, 0xd8, 0x5d, 0x8a, 0x04, 0x6e, 0xf4,
|
||||
0x91, 0xce, 0xae, 0xbb, 0x83, 0x97, 0x39, 0x44, 0xe4, 0xc8, 0x78,
|
||||
0xf4, 0xd1, 0xdb, 0x52, 0x32, 0x4c, 0x6b, 0xd0, 0x2d, 0x09, 0x90,
|
||||
0x12, 0x72, 0xb4, 0xba, 0xa0, 0xff, 0x07, 0x00, 0x48, 0x04, 0x71,
|
||||
0x83, 0x9e, 0xcc, 0x51, 0xce, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
|
||||
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
|
||||
};
|
||||
const unsigned char neon_mask[1689] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x80, 0x08, 0x06, 0x00, 0x00, 0x00, 0xbb, 0x81, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x09, 0x70,
|
||||
0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00,
|
||||
0x20, 0x63, 0x48, 0x52, 0x4d, 0x00, 0x00, 0x7a, 0x25, 0x00, 0x00, 0x80, 0x83, 0x00, 0x00, 0xf9, 0xff, 0x00, 0x00,
|
||||
0x80, 0xe9, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0xea, 0x60, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00, 0x17, 0x6f, 0x92,
|
||||
0x5f, 0xc5, 0x46, 0x00, 0x00, 0x06, 0x1f, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xec, 0x5d, 0xdb, 0x8e, 0xe4, 0x2a,
|
||||
0x0c, 0x64, 0xa3, 0xf3, 0x10, 0x45, 0x49, 0x2b, 0xe2, 0xff, 0xbf, 0x11, 0x45, 0x09, 0x42, 0x79, 0x9b, 0xf3, 0x34,
|
||||
0xda, 0xde, 0x08, 0x70, 0xd9, 0x18, 0x42, 0x66, 0x1a, 0x69, 0xb4, 0xdb, 0x37, 0x3a, 0x55, 0x2e, 0x97, 0x0d, 0xdd,
|
||||
0x6a, 0xfe, 0x7c, 0x7d, 0x7d, 0x99, 0x86, 0x63, 0x01, 0x9f, 0x77, 0xb4, 0xba, 0xa0, 0x3f, 0x95, 0x09, 0x58, 0x14,
|
||||
0xe6, 0x38, 0x9e, 0x46, 0x00, 0x02, 0xda, 0x26, 0xee, 0x77, 0xad, 0xc9, 0xd0, 0x24, 0x60, 0x11, 0x82, 0x36, 0x02,
|
||||
0x32, 0x8e, 0xde, 0x08, 0x58, 0x98, 0xa0, 0x2d, 0x03, 0xb0, 0xab, 0x49, 0x82, 0x06, 0x01, 0x4b, 0x21, 0x70, 0x14,
|
||||
0x74, 0x15, 0x22, 0x4a, 0x09, 0x40, 0xc1, 0x53, 0xf7, 0xa1, 0xd1, 0x77, 0xbd, 0x10, 0x80, 0x4a, 0xde, 0x0a, 0x14,
|
||||
0xe0, 0x84, 0x6a, 0x38, 0x5a, 0x11, 0xa0, 0x01, 0x7e, 0x8d, 0xbc, 0x7e, 0x63, 0x12, 0xa1, 0x42, 0x82, 0x16, 0x01,
|
||||
0x96, 0x41, 0xc4, 0x9a, 0x99, 0xbb, 0x39, 0x09, 0x5c, 0x02, 0x16, 0x66, 0xe4, 0x53, 0x51, 0x7f, 0x45, 0xe6, 0xd9,
|
||||
0x41, 0x22, 0x9c, 0xa6, 0x31, 0x72, 0x08, 0xa8, 0x01, 0x7e, 0x36, 0xc6, 0x78, 0x90, 0x08, 0x0e, 0x09, 0x4d, 0x08,
|
||||
0x48, 0x81, 0x4f, 0x49, 0xfe, 0x0a, 0x3c, 0x36, 0x7c, 0x6b, 0x12, 0x50, 0x02, 0x16, 0x41, 0xe4, 0x63, 0x51, 0x9f,
|
||||
0x13, 0x24, 0x78, 0x06, 0x11, 0xaa, 0x24, 0x0c, 0xca, 0x2d, 0xae, 0x04, 0xfc, 0xf7, 0xed, 0xd8, 0xe3, 0xaf, 0x88,
|
||||
0x92, 0x2c, 0x68, 0xbe, 0xd0, 0x18, 0x04, 0xaf, 0xb1, 0x05, 0xe0, 0xdf, 0x81, 0x4e, 0x97, 0xbf, 0xeb, 0xe3, 0x73,
|
||||
0xc6, 0x30, 0x45, 0x60, 0xb5, 0x08, 0x40, 0xc0, 0xbf, 0x12, 0xe0, 0xcd, 0x05, 0xf0, 0xf4, 0x36, 0xc7, 0x14, 0x51,
|
||||
0xc0, 0x95, 0x84, 0x95, 0x59, 0x82, 0x97, 0x52, 0x02, 0x16, 0x01, 0xf3, 0xaf, 0x4b, 0x34, 0xaf, 0x51, 0xbf, 0x02,
|
||||
0x9e, 0x12, 0xff, 0xa7, 0x48, 0xb0, 0x77, 0x2a, 0x80, 0x92, 0x7e, 0xcc, 0xe5, 0x63, 0x20, 0x4d, 0x42, 0x01, 0x14,
|
||||
0x09, 0xb9, 0xca, 0xc3, 0x52, 0xc1, 0x50, 0x18, 0x7d, 0x4b, 0x94, 0xba, 0x58, 0xbe, 0x5f, 0x41, 0x4f, 0x89, 0xdb,
|
||||
0x29, 0x12, 0x90, 0x54, 0x68, 0xe2, 0x01, 0xa9, 0x31, 0x67, 0x22, 0x9b, 0x03, 0x9e, 0x52, 0xcb, 0x75, 0x4e, 0x24,
|
||||
0x15, 0xac, 0x36, 0x01, 0x36, 0x23, 0xbb, 0xf7, 0xe8, 0xc7, 0x0c, 0xcf, 0x10, 0x60, 0x29, 0x52, 0x26, 0xa2, 0x3c,
|
||||
0x16, 0xed, 0x56, 0x0d, 0xc2, 0xda, 0x9f, 0x32, 0x3e, 0x29, 0x78, 0x8e, 0xb2, 0xe6, 0x4c, 0x6f, 0xc0, 0xee, 0x0b,
|
||||
0xb8, 0x29, 0x60, 0x41, 0xe3, 0x2b, 0x01, 0x3f, 0x31, 0x53, 0xa1, 0x48, 0x05, 0x03, 0x53, 0xfe, 0x68, 0xf4, 0x0d,
|
||||
0xe0, 0x03, 0xc6, 0x18, 0x33, 0x0a, 0x48, 0xa0, 0x54, 0x50, 0x6c, 0x82, 0x4b, 0x85, 0xe8, 0xe7, 0xc0, 0x8f, 0x09,
|
||||
0x22, 0x26, 0x66, 0xea, 0x89, 0xda, 0xe3, 0xd2, 0x2a, 0x50, 0x12, 0x7d, 0x54, 0x0d, 0x57, 0x52, 0x67, 0xe2, 0xfd,
|
||||
0x6e, 0x2f, 0x83, 0x14, 0xe8, 0x31, 0x03, 0x76, 0x14, 0x92, 0xb7, 0x12, 0x4b, 0x72, 0x31, 0x01, 0x16, 0x94, 0xff,
|
||||
0x4c, 0xd4, 0x73, 0x24, 0xca, 0x1c, 0x52, 0xa5, 0x66, 0xb8, 0x68, 0x2a, 0xe0, 0x55, 0x49, 0x3d, 0x94, 0x0a, 0x28,
|
||||
0x33, 0x64, 0x99, 0xf8, 0x50, 0x58, 0xff, 0x73, 0xdd, 0x9b, 0x66, 0xf4, 0x29, 0xf0, 0xc8, 0xce, 0x14, 0x3b, 0x05,
|
||||
0x90, 0x09, 0x38, 0x46, 0x74, 0x2a, 0x7a, 0xca, 0xa4, 0xa5, 0x46, 0x4e, 0x1f, 0x60, 0x13, 0x52, 0x9b, 0x19, 0xe6,
|
||||
0x27, 0x4d, 0x83, 0x6a, 0x63, 0xa8, 0x94, 0xff, 0x1a, 0xf2, 0x47, 0x5f, 0xc3, 0xf5, 0x81, 0x25, 0x45, 0x00, 0x37,
|
||||
0xff, 0x6b, 0x44, 0x9e, 0xe3, 0x31, 0x2a, 0x3e, 0xc0, 0x55, 0xc0, 0x5a, 0xe0, 0x01, 0xb5, 0x87, 0xa8, 0x1c, 0x0e,
|
||||
0xcc, 0xfa, 0x2f, 0x6d, 0x7e, 0x6a, 0x37, 0x5b, 0x73, 0x4b, 0x0f, 0x78, 0x11, 0xf2, 0xd7, 0x24, 0x62, 0x14, 0x80,
|
||||
0x5f, 0x6b, 0x11, 0xb0, 0x0a, 0xa2, 0x3f, 0x56, 0x8c, 0x3a, 0x55, 0x0e, 0x21, 0x15, 0x0f, 0x40, 0xfd, 0xb7, 0x8c,
|
||||
0x1e, 0x60, 0x32, 0x0f, 0x1b, 0x43, 0xa6, 0x02, 0x58, 0x81, 0xfc, 0x6b, 0x44, 0x7f, 0x04, 0xab, 0xc1, 0x2c, 0x49,
|
||||
0x83, 0x5a, 0xab, 0xc1, 0xb1, 0x93, 0xf9, 0x48, 0x35, 0x7f, 0x13, 0x70, 0x30, 0xf3, 0x5f, 0xb2, 0x01, 0xd2, 0xaa,
|
||||
0x1a, 0xb0, 0x3e, 0x4a, 0x1b, 0x88, 0x26, 0xc8, 0x66, 0xea, 0xac, 0xd4, 0xf8, 0x90, 0xcf, 0x07, 0xa8, 0x79, 0xd5,
|
||||
0x48, 0xff, 0x8f, 0xb9, 0x10, 0x2a, 0xdd, 0xf5, 0xa9, 0x65, 0x98, 0xdf, 0x73, 0xf9, 0x8b, 0x6a, 0x37, 0x29, 0x01,
|
||||
0x5c, 0xf9, 0x6b, 0x01, 0xbd, 0x3e, 0x37, 0x44, 0x54, 0x70, 0xbe, 0x3d, 0x37, 0x64, 0x7a, 0x95, 0x5d, 0x62, 0x82,
|
||||
0xb6, 0x30, 0x7a, 0x31, 0xf9, 0x87, 0x4a, 0xb9, 0x1f, 0x12, 0xd7, 0x32, 0x97, 0x6c, 0x88, 0xe4, 0xf2, 0x7f, 0x06,
|
||||
0xca, 0x91, 0xb6, 0xd4, 0xa7, 0x0c, 0xc9, 0x31, 0x1f, 0x61, 0x77, 0x85, 0xdc, 0x32, 0x38, 0xdf, 0x98, 0xe7, 0xa5,
|
||||
0xf3, 0x5b, 0x0d, 0x02, 0x24, 0x0d, 0x4b, 0x0d, 0x90, 0xd4, 0x7b, 0xcd, 0xc0, 0xea, 0x70, 0x41, 0x5a, 0xe1, 0x95,
|
||||
0xb8, 0xa0, 0x1e, 0x5b, 0xdf, 0x99, 0xc0, 0x64, 0xb9, 0x0a, 0x78, 0x01, 0x51, 0x19, 0xcd, 0x43, 0xc7, 0x60, 0xb0,
|
||||
0x9d, 0xa0, 0xbb, 0x73, 0x1f, 0x35, 0xc3, 0x89, 0xb9, 0x8a, 0x25, 0x37, 0x44, 0x7a, 0x5a, 0xed, 0x55, 0xa9, 0x36,
|
||||
0x43, 0x06, 0xf4, 0x4a, 0xa8, 0x60, 0xea, 0x90, 0x24, 0xae, 0x11, 0x8a, 0xaa, 0x40, 0x4f, 0xf9, 0x3f, 0x82, 0xcd,
|
||||
0x50, 0x76, 0x35, 0x78, 0x30, 0x0d, 0xb0, 0xf7, 0x31, 0x49, 0x53, 0x40, 0xcb, 0x00, 0xbb, 0x01, 0xa7, 0xd9, 0x08,
|
||||
0x3d, 0x25, 0xff, 0xd9, 0xef, 0xcf, 0x59, 0x0c, 0x21, 0x1d, 0x59, 0xaf, 0x2a, 0x58, 0x35, 0x4c, 0x30, 0x74, 0x92,
|
||||
0x06, 0xaa, 0xd7, 0x31, 0x34, 0xca, 0xbf, 0x3b, 0x15, 0xf0, 0xd2, 0x2e, 0x83, 0x3f, 0x6a, 0xfc, 0x74, 0x02, 0xe6,
|
||||
0xdf, 0x4e, 0xc0, 0xaf, 0x57, 0x80, 0xff, 0x28, 0x40, 0x91, 0x80, 0xa7, 0x96, 0xc1, 0xfd, 0xb7, 0x97, 0x41, 0x96,
|
||||
0x02, 0x1c, 0x93, 0xf9, 0xf3, 0x01, 0x0a, 0x30, 0x26, 0xf3, 0x01, 0x09, 0xaa, 0x00, 0x0f, 0x5e, 0x44, 0x78, 0x58,
|
||||
0x7a, 0x40, 0x04, 0x78, 0xd3, 0xcf, 0x28, 0x21, 0xd8, 0xa5, 0x08, 0x58, 0xa4, 0x06, 0xd2, 0xe9, 0x08, 0xda, 0x0a,
|
||||
0xa0, 0xde, 0xe0, 0xbc, 0x11, 0xec, 0x99, 0xb8, 0x26, 0x8f, 0xaa, 0x60, 0xc8, 0x3c, 0xb8, 0x3d, 0xd4, 0x07, 0xde,
|
||||
0xaf, 0x77, 0x97, 0x2a, 0xc0, 0x75, 0x08, 0x2e, 0xd4, 0xf0, 0x07, 0x6a, 0x4f, 0x50, 0x6a, 0x84, 0xa1, 0x01, 0xf8,
|
||||
0x98, 0xfc, 0x03, 0xa7, 0x04, 0xa2, 0x1e, 0xb0, 0x77, 0xee, 0x03, 0xea, 0xad, 0xb0, 0x23, 0xd8, 0x0b, 0x1d, 0xe6,
|
||||
0x3b, 0xa5, 0xd6, 0xe4, 0x0f, 0x2d, 0x68, 0x2e, 0x86, 0xce, 0x4a, 0x69, 0x10, 0x04, 0xef, 0x85, 0x18, 0xe0, 0x21,
|
||||
0x21, 0xe0, 0x6e, 0x2f, 0x28, 0x99, 0xdf, 0x71, 0x3d, 0xc0, 0x5d, 0x7c, 0x20, 0x55, 0x06, 0x43, 0x45, 0x12, 0x50,
|
||||
0xf3, 0xfb, 0xbe, 0xed, 0x39, 0x06, 0xc8, 0x5d, 0x0c, 0x21, 0xa0, 0xce, 0x86, 0xab, 0xc8, 0x09, 0x6c, 0x82, 0xb2,
|
||||
0x98, 0x90, 0x6f, 0x89, 0x6d, 0xe6, 0xdf, 0x7d, 0x75, 0x6f, 0xfe, 0xee, 0xb5, 0x05, 0x00, 0x60, 0x60, 0x10, 0x12,
|
||||
0x18, 0x3e, 0x13, 0x34, 0x5a, 0x78, 0x6e, 0x23, 0xe4, 0x15, 0x65, 0x1e, 0xde, 0xfe, 0x34, 0xbc, 0x80, 0x2d, 0xff,
|
||||
0x77, 0x02, 0x0e, 0xd0, 0x07, 0xa4, 0x69, 0x10, 0x03, 0x4e, 0xdd, 0x87, 0x44, 0xbf, 0x98, 0x3c, 0xea, 0xab, 0xb2,
|
||||
0xc8, 0xba, 0x40, 0xed, 0x62, 0x14, 0x8c, 0x32, 0x55, 0xfe, 0x9c, 0xe6, 0x6a, 0x50, 0xd2, 0x13, 0xdc, 0x35, 0x1f,
|
||||
0xf9, 0xeb, 0x73, 0xb9, 0x14, 0x70, 0x09, 0x73, 0xf1, 0x60, 0xee, 0x9f, 0x95, 0xc0, 0x87, 0x44, 0xe4, 0x3d, 0x37,
|
||||
0xff, 0x91, 0x56, 0x98, 0x6b, 0x88, 0x3d, 0xb6, 0xc6, 0x6a, 0x1b, 0x22, 0x9b, 0x52, 0x5f, 0xa0, 0xd9, 0xf9, 0x85,
|
||||
0x4c, 0xf9, 0x73, 0x89, 0x7f, 0x8b, 0x3d, 0x80, 0x4a, 0x83, 0xd0, 0x20, 0xf7, 0x43, 0x46, 0x89, 0x9b, 0x86, 0x02,
|
||||
0x20, 0xf6, 0x6e, 0x96, 0x7f, 0x28, 0x58, 0xa3, 0x88, 0x15, 0xb0, 0x15, 0x2e, 0x8e, 0x6a, 0x0e, 0xce, 0x06, 0xee,
|
||||
0x11, 0x23, 0x80, 0xfb, 0x8b, 0xac, 0xad, 0xab, 0x41, 0x60, 0x44, 0x1e, 0x56, 0xee, 0x50, 0x89, 0x6d, 0x8d, 0x1d,
|
||||
0xa3, 0x53, 0x10, 0x88, 0x0d, 0xe8, 0x07, 0x0e, 0x2e, 0x01, 0x57, 0x36, 0xb7, 0x06, 0x4a, 0x68, 0xb6, 0xc5, 0x86,
|
||||
0xee, 0x07, 0x68, 0x6c, 0x90, 0x8c, 0x0a, 0xf2, 0x47, 0xca, 0x5f, 0x11, 0x01, 0x87, 0x62, 0x8e, 0xd6, 0xd8, 0x38,
|
||||
0x55, 0xcd, 0xff, 0xd2, 0xb5, 0x40, 0xad, 0x8f, 0xcd, 0x4e, 0x46, 0xf4, 0xb9, 0xf9, 0xcf, 0x26, 0xc0, 0x01, 0x3e,
|
||||
0xf0, 0xde, 0x87, 0x53, 0x52, 0x3d, 0x2b, 0x44, 0x5f, 0x54, 0xfe, 0x6a, 0xaf, 0x06, 0x29, 0x33, 0x3c, 0x85, 0xd1,
|
||||
0xa7, 0xfa, 0x13, 0x96, 0xfc, 0x35, 0x08, 0xd8, 0x81, 0x9c, 0x0c, 0x42, 0xe9, 0xa7, 0xfc, 0xc5, 0x6b, 0x36, 0x61,
|
||||
0x03, 0x22, 0x13, 0x30, 0x0d, 0xb8, 0x1b, 0x24, 0x27, 0xa1, 0x88, 0x20, 0xf4, 0x21, 0x87, 0xe6, 0x3f, 0xb7, 0x0f,
|
||||
0xa8, 0xa1, 0x02, 0x64, 0xb1, 0x43, 0x75, 0x80, 0x1b, 0x57, 0xf6, 0x25, 0x29, 0x50, 0xa2, 0x82, 0x20, 0xf0, 0x8f,
|
||||
0xeb, 0x3c, 0x52, 0xf3, 0x4b, 0x2a, 0x7b, 0xe0, 0x3c, 0x99, 0xa9, 0x82, 0x12, 0x12, 0x72, 0x4d, 0x97, 0x07, 0xcd,
|
||||
0x4f, 0xb5, 0x0f, 0x70, 0x80, 0x0a, 0xf6, 0xc8, 0x45, 0x72, 0x48, 0x08, 0x0c, 0xe9, 0xab, 0x44, 0xbf, 0x56, 0x19,
|
||||
0x44, 0xbe, 0x49, 0x12, 0x08, 0x52, 0x10, 0xe9, 0xe7, 0x72, 0x5f, 0xa5, 0x0c, 0x1e, 0xc0, 0xa4, 0x31, 0x15, 0xa4,
|
||||
0x1a, 0x24, 0xe4, 0xf3, 0x80, 0x90, 0x01, 0x4f, 0x75, 0x7d, 0x4d, 0x4c, 0x30, 0x97, 0x12, 0x1b, 0x51, 0x0d, 0x42,
|
||||
0x02, 0x74, 0xce, 0xfc, 0x3c, 0x21, 0x7d, 0x24, 0xf7, 0x8f, 0x12, 0x02, 0x0e, 0x01, 0xcb, 0xfb, 0x45, 0x01, 0xa9,
|
||||
0x56, 0x39, 0x24, 0xa2, 0x4e, 0x81, 0x2f, 0x2a, 0x7b, 0x9a, 0x1e, 0xe0, 0x88, 0x54, 0xd8, 0x13, 0x40, 0x02, 0x60,
|
||||
0x8e, 0x14, 0x78, 0xb4, 0xf1, 0x39, 0x6a, 0x10, 0xe0, 0x18, 0xa9, 0x10, 0x23, 0x21, 0xe6, 0x0b, 0x21, 0xf2, 0xb8,
|
||||
0x07, 0xbb, 0xbd, 0xea, 0x0a, 0x38, 0x0a, 0xfd, 0x60, 0x8f, 0xf8, 0x42, 0xec, 0x50, 0x15, 0x4f, 0x94, 0xbb, 0x0d,
|
||||
0x0c, 0x00, 0x6b, 0x7c, 0x8e, 0xd9, 0xf9, 0x1c, 0xb4, 0xf4, 0x39, 0x6a, 0xeb, 0x73, 0xd8, 0x9a, 0x06, 0x01, 0x08,
|
||||
0xf0, 0x1f, 0x73, 0xdc, 0x9e, 0x16, 0x09, 0xe8, 0xfe, 0x43, 0x77, 0x07, 0x2e, 0x72, 0x3d, 0x01, 0xb9, 0xef, 0x71,
|
||||
0x47, 0x6e, 0x4a, 0x48, 0x40, 0x15, 0xc0, 0x5d, 0xe1, 0xdd, 0x4e, 0x00, 0x27, 0x25, 0x72, 0xf7, 0x3f, 0xf6, 0xd8,
|
||||
0x5d, 0x8a, 0x04, 0x6e, 0xf4, 0x91, 0xce, 0xae, 0xbb, 0x83, 0x97, 0x39, 0x44, 0xe4, 0xc8, 0x78, 0xf4, 0xd1, 0xdb,
|
||||
0x52, 0x32, 0x4c, 0x6b, 0xd0, 0x2d, 0x09, 0x90, 0x12, 0x72, 0xb4, 0xba, 0xa0, 0xff, 0x07, 0x00, 0x48, 0x04, 0x71,
|
||||
0x83, 0x9e, 0xcc, 0x51, 0xce, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
|
||||
Neon::Neon()
|
||||
{
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
Events::processScriptsEvent += [this] {
|
||||
if (!m_pNeonTexture)
|
||||
{
|
||||
m_pNeonTexture = Util::LoadTextureFromMemory((char*)neon_mask, sizeof(neon_mask));
|
||||
m_pNeonTexture = Util::LoadTextureFromMemory((char *)neon_mask, sizeof(neon_mask));
|
||||
}
|
||||
};
|
||||
|
||||
Events::vehicleRenderEvent += [](CVehicle* pVeh)
|
||||
{
|
||||
NeonData* data = &m_VehNeon.Get(pVeh);
|
||||
Events::vehicleRenderEvent += [](CVehicle *pVeh) {
|
||||
NeonData *data = &m_VehNeon.Get(pVeh);
|
||||
if (data->m_bNeonInstalled && !pVeh->IsUpsideDown())
|
||||
{
|
||||
CVector Pos = CModelInfo::GetModelInfo(pVeh->m_nModelIndex)->m_pColModel->m_boundBox.m_vecMin;
|
||||
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
|
||||
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->m_fVal, 0.0f)) - center;
|
||||
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->m_fVal, 0.0f, 0.0f)) - center;
|
||||
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, ¢er, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
|
||||
data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true);
|
||||
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, ¢er, up.x, up.y, right.x, right.y, 180,
|
||||
data->m_Color.r, data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0,
|
||||
true);
|
||||
|
||||
if (data->m_bPulsing)
|
||||
{
|
||||
@ -219,24 +151,24 @@ Neon::~Neon()
|
||||
}
|
||||
}
|
||||
|
||||
bool Neon::IsNeonInstalled(CVehicle* pVeh)
|
||||
bool Neon::IsNeonInstalled(CVehicle *pVeh)
|
||||
{
|
||||
return m_VehNeon.Get(pVeh).m_bNeonInstalled;
|
||||
}
|
||||
|
||||
bool Neon::IsPulsingEnabled(CVehicle* pVeh)
|
||||
bool Neon::IsPulsingEnabled(CVehicle *pVeh)
|
||||
{
|
||||
return m_VehNeon.Get(pVeh).m_bPulsing;
|
||||
}
|
||||
|
||||
void Neon::SetPulsing(CVehicle* pVeh, bool state)
|
||||
void Neon::SetPulsing(CVehicle *pVeh, bool state)
|
||||
{
|
||||
m_VehNeon.Get(pVeh).m_bPulsing = state;
|
||||
}
|
||||
|
||||
void Neon::InstallNeon(CVehicle* pVeh, int red, int green, int blue)
|
||||
void Neon::InstallNeon(CVehicle *pVeh, int red, int green, int blue)
|
||||
{
|
||||
CRGBA& color = m_VehNeon.Get(pVeh).m_Color;
|
||||
CRGBA &color = m_VehNeon.Get(pVeh).m_Color;
|
||||
|
||||
color.r = red;
|
||||
color.g = green;
|
||||
@ -246,9 +178,7 @@ void Neon::InstallNeon(CVehicle* pVeh, int red, int green, int blue)
|
||||
m_VehNeon.Get(pVeh).m_bNeonInstalled = true;
|
||||
}
|
||||
|
||||
void Neon::RemoveNeon(CVehicle* pVeh)
|
||||
void Neon::RemoveNeon(CVehicle *pVeh)
|
||||
{
|
||||
m_VehNeon.Get(pVeh).m_bNeonInstalled = false;
|
||||
}
|
||||
|
||||
|
||||
|
14
src/neon.h
14
src/neon.h
@ -13,7 +13,7 @@ private:
|
||||
bool m_bIncrement;
|
||||
bool m_bPulsing;
|
||||
|
||||
NeonData(CVehicle* pVeh)
|
||||
NeonData(CVehicle *pVeh)
|
||||
{
|
||||
m_bNeonInstalled = false;
|
||||
m_fVal = 0.0;
|
||||
@ -21,15 +21,15 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
static inline RwTexture* m_pNeonTexture = nullptr; // pointer to the neon mask texture
|
||||
static inline RwTexture *m_pNeonTexture = nullptr; // pointer to the neon mask texture
|
||||
static inline VehicleExtendedData<NeonData> m_VehNeon;
|
||||
|
||||
public:
|
||||
Neon();
|
||||
~Neon();
|
||||
static void InstallNeon(CVehicle* veh, int red, int green, int blue);
|
||||
static bool IsNeonInstalled(CVehicle* veh);
|
||||
static bool IsPulsingEnabled(CVehicle* veh);
|
||||
static void SetPulsing(CVehicle* veh, bool state);
|
||||
static void RemoveNeon(CVehicle* veh);
|
||||
static void InstallNeon(CVehicle *veh, int red, int green, int blue);
|
||||
static bool IsNeonInstalled(CVehicle *veh);
|
||||
static bool IsPulsingEnabled(CVehicle *veh);
|
||||
static void SetPulsing(CVehicle *veh, bool state);
|
||||
static void RemoveNeon(CVehicle *veh);
|
||||
};
|
||||
|
152
src/paint.cpp
152
src/paint.cpp
@ -22,29 +22,27 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "pch.h"
|
||||
#include "paint.h"
|
||||
#include "NodeName.h"
|
||||
#include "pch.h"
|
||||
#include "util.h"
|
||||
|
||||
Paint::Paint()
|
||||
{
|
||||
Events::vehicleRenderEvent.before += [](CVehicle* pVeh)
|
||||
{
|
||||
VehData& data = m_VehData.Get(pVeh);
|
||||
Events::vehicleRenderEvent.before += [](CVehicle *pVeh) {
|
||||
VehData &data = m_VehData.Get(pVeh);
|
||||
|
||||
// reset custom color if color id changed
|
||||
if (pVeh->m_nPrimaryColor != data.primary_color
|
||||
|| pVeh->m_nSecondaryColor != data.secondary_color)
|
||||
if (pVeh->m_nPrimaryColor != data.primary_color || pVeh->m_nSecondaryColor != data.secondary_color)
|
||||
{
|
||||
for (auto& it : data.materialProperties)
|
||||
for (auto &it : data.materialProperties)
|
||||
data.resetMaterialColor(it.first);
|
||||
|
||||
data.primary_color = pVeh->m_nPrimaryColor;
|
||||
data.secondary_color = pVeh->m_nSecondaryColor;
|
||||
}
|
||||
|
||||
for (auto& it : data.materialProperties)
|
||||
for (auto &it : data.materialProperties)
|
||||
{
|
||||
if (it.second._recolor)
|
||||
{
|
||||
@ -69,10 +67,10 @@ Paint::Paint()
|
||||
}
|
||||
};
|
||||
|
||||
ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)> vehicleResetAfterRender;
|
||||
vehicleResetAfterRender += [](CVehicle* pVeh)
|
||||
{
|
||||
for (auto& it : m_VehData.Get(pVeh).materialProperties)
|
||||
ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle *, 0>, void(CVehicle *)>
|
||||
vehicleResetAfterRender;
|
||||
vehicleResetAfterRender += [](CVehicle *pVeh) {
|
||||
for (auto &it : m_VehData.Get(pVeh).materialProperties)
|
||||
{
|
||||
if (it.second._recolor)
|
||||
{
|
||||
@ -87,13 +85,12 @@ Paint::Paint()
|
||||
};
|
||||
}
|
||||
|
||||
void Paint::VehData::setMaterialColor(RpMaterial* material, RpGeometry* geometry, RwRGBA color, bool filter_mat)
|
||||
void Paint::VehData::setMaterialColor(RpMaterial *material, RpGeometry *geometry, RwRGBA color, bool filter_mat)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
auto &matProps = materialProperties[material];
|
||||
|
||||
if (!filter_mat
|
||||
|| (material->color.red == 0x3C && material->color.green == 0xFF && material->color.blue == 0x00)
|
||||
|| (material->color.red == 0xFF && material->color.green == 0x00 && material->color.blue == 0xAF))
|
||||
if (!filter_mat || (material->color.red == 0x3C && material->color.green == 0xFF && material->color.blue == 0x00) ||
|
||||
(material->color.red == 0xFF && material->color.green == 0x00 && material->color.blue == 0xAF))
|
||||
{
|
||||
matProps._recolor = true;
|
||||
matProps._color = color;
|
||||
@ -101,53 +98,51 @@ void Paint::VehData::setMaterialColor(RpMaterial* material, RpGeometry* geometry
|
||||
}
|
||||
}
|
||||
|
||||
void Paint::VehData::setMaterialTexture(RpMaterial* material, RwTexture* texture, bool filter_mat)
|
||||
void Paint::VehData::setMaterialTexture(RpMaterial *material, RwTexture *texture, bool filter_mat)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
auto &matProps = materialProperties[material];
|
||||
|
||||
if (!filter_mat
|
||||
|| (material->color.red == 0x3C && material->color.green == 0xFF && material->color.blue == 0x00)
|
||||
|| (material->color.red == 0xFF && material->color.green == 0x00 && material->color.blue == 0xAF))
|
||||
if (!filter_mat || (material->color.red == 0x3C && material->color.green == 0xFF && material->color.blue == 0x00) ||
|
||||
(material->color.red == 0xFF && material->color.green == 0x00 && material->color.blue == 0xAF))
|
||||
{
|
||||
matProps._retexture = true;
|
||||
matProps._texture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void Paint::VehData::resetMaterialColor(RpMaterial* material)
|
||||
void Paint::VehData::resetMaterialColor(RpMaterial *material)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
auto &matProps = materialProperties[material];
|
||||
matProps._recolor = false;
|
||||
matProps._color = {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
void Paint::VehData::resetMaterialTexture(RpMaterial* material)
|
||||
void Paint::VehData::resetMaterialTexture(RpMaterial *material)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
auto &matProps = materialProperties[material];
|
||||
matProps._retexture = false;
|
||||
matProps._texture = nullptr;
|
||||
}
|
||||
|
||||
void Paint::NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func)
|
||||
void Paint::NodeWrapperRecursive(RwFrame *frame, CVehicle *pVeh, std::function<void(RwFrame *)> func)
|
||||
{
|
||||
if (frame)
|
||||
{
|
||||
func(frame);
|
||||
|
||||
if (RwFrame* newFrame = frame->child)
|
||||
if (RwFrame *newFrame = frame->child)
|
||||
NodeWrapperRecursive(newFrame, pVeh, func);
|
||||
if (RwFrame* newFrame = frame->next)
|
||||
if (RwFrame *newFrame = frame->next)
|
||||
NodeWrapperRecursive(newFrame, pVeh, func);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Paint::UpdateNodeListRecursive(CVehicle* pVeh)
|
||||
void Paint::UpdateNodeListRecursive(CVehicle *pVeh)
|
||||
{
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [](RwFrame* frame)
|
||||
{
|
||||
NodeWrapperRecursive(frame, pVeh, [](RwFrame *frame) {
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
if (!(std::find(veh_nodes::names_vec.begin(), veh_nodes::names_vec.end(), name) != veh_nodes::names_vec.end()))
|
||||
@ -155,12 +150,11 @@ void Paint::UpdateNodeListRecursive(CVehicle* pVeh)
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat)
|
||||
void Paint::SetNodeColor(CVehicle *pVeh, std::string node_name, CRGBA color, bool filter_mat)
|
||||
{
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame) {
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
struct ST
|
||||
@ -174,34 +168,36 @@ void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, boo
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
RwFrameForAllObjects(
|
||||
frame,
|
||||
[](RwObject *object, void *data) -> RwObject * {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic *>(object);
|
||||
|
||||
ST* st = reinterpret_cast<ST*>(data);
|
||||
CRGBA* color = &st->_color;
|
||||
ST *st = reinterpret_cast<ST *>(data);
|
||||
CRGBA *color = &st->_color;
|
||||
bool filter_mat = st->_filter;
|
||||
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData &data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.setMaterialColor(atomic->geometry->matList.materials[i], atomic->geometry,
|
||||
{color->r, color->g, color->b, 255}, filter_mat);
|
||||
}
|
||||
return object;
|
||||
}, &st);
|
||||
},
|
||||
&st);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat)
|
||||
void Paint::SetNodeTexture(CVehicle *pVeh, std::string node_name, std::string texturename, bool filter_mat)
|
||||
{
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
RwTexture* texture = nullptr;
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
RwTexture *texture = nullptr;
|
||||
|
||||
for (auto const& tex : m_TextureData.m_ImagesList)
|
||||
for (auto const &tex : m_TextureData.m_ImagesList)
|
||||
{
|
||||
if (tex.get()->m_FileName == texturename)
|
||||
{
|
||||
@ -210,13 +206,12 @@ void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string te
|
||||
}
|
||||
}
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame) {
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
struct ST
|
||||
{
|
||||
RwTexture* _tex;
|
||||
RwTexture *_tex;
|
||||
bool _filter;
|
||||
} st;
|
||||
|
||||
@ -225,76 +220,79 @@ void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string te
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
RwFrameForAllObjects(
|
||||
frame,
|
||||
[](RwObject *object, void *data) -> RwObject * {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic *>(object);
|
||||
|
||||
ST* st = reinterpret_cast<ST*>(data);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
ST *st = reinterpret_cast<ST *>(data);
|
||||
VehData &data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
{
|
||||
data.setMaterialTexture(atomic->geometry->matList.materials[i], st->_tex,
|
||||
st->_filter);
|
||||
data.setMaterialTexture(atomic->geometry->matList.materials[i], st->_tex, st->_filter);
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}, &st);
|
||||
},
|
||||
&st);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::ResetNodeColor(CVehicle* pVeh, std::string node_name)
|
||||
void Paint::ResetNodeColor(CVehicle *pVeh, std::string node_name)
|
||||
{
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame) {
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
RwFrameForAllObjects(
|
||||
frame,
|
||||
[](RwObject *object, void *data) -> RwObject * {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic *>(object);
|
||||
VehData &data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.resetMaterialColor(atomic->geometry->matList.materials[i]);
|
||||
}
|
||||
return object;
|
||||
}, nullptr);
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::ResetNodeTexture(CVehicle* pVeh, std::string node_name)
|
||||
void Paint::ResetNodeTexture(CVehicle *pVeh, std::string node_name)
|
||||
{
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame) {
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
RwFrameForAllObjects(
|
||||
frame,
|
||||
[](RwObject *object, void *data) -> RwObject * {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic *>(object);
|
||||
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData &data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.resetMaterialTexture(atomic->geometry->matList.materials[i]);
|
||||
}
|
||||
return object;
|
||||
}, nullptr);
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
43
src/paint.h
43
src/paint.h
@ -32,47 +32,42 @@ private:
|
||||
{
|
||||
struct MaterialProperties
|
||||
{
|
||||
MaterialProperties() :
|
||||
_color{0, 0, 0, 0},
|
||||
_recolor(false),
|
||||
_retexture(false),
|
||||
_geometry(nullptr),
|
||||
_originalColor{0, 0, 0, 0},
|
||||
_originalTexture(nullptr),
|
||||
_originalGeometryFlags(0)
|
||||
MaterialProperties()
|
||||
: _color{0, 0, 0, 0}, _recolor(false), _retexture(false),
|
||||
_geometry(nullptr), _originalColor{0, 0, 0, 0}, _originalTexture(nullptr), _originalGeometryFlags(0)
|
||||
{
|
||||
}
|
||||
|
||||
RwRGBA _color;
|
||||
RwTexture* _texture;
|
||||
RwTexture *_texture;
|
||||
bool _recolor;
|
||||
bool _retexture;
|
||||
RpGeometry* _geometry;
|
||||
RpGeometry *_geometry;
|
||||
RwRGBA _originalColor;
|
||||
RwTexture* _originalTexture;
|
||||
RwTexture *_originalTexture;
|
||||
RwInt32 _originalGeometryFlags;
|
||||
};
|
||||
|
||||
// carcols color id
|
||||
uchar primary_color = 0;
|
||||
uchar secondary_color = 0;
|
||||
std::unordered_map<RpMaterial*, MaterialProperties> materialProperties;
|
||||
std::unordered_map<RpMaterial *, MaterialProperties> materialProperties;
|
||||
|
||||
VehData(CVehicle* veh)
|
||||
VehData(CVehicle *veh)
|
||||
{
|
||||
primary_color = veh->m_nPrimaryColor;
|
||||
secondary_color = veh->m_nSecondaryColor;
|
||||
}
|
||||
|
||||
void setMaterialColor(RpMaterial* material, RpGeometry* geometry, RwRGBA color, bool filter_mat = false);
|
||||
void setMaterialTexture(RpMaterial* material, RwTexture* texture, bool filter_mat = false);
|
||||
void resetMaterialColor(RpMaterial* material);
|
||||
void resetMaterialTexture(RpMaterial* material);
|
||||
void setMaterialColor(RpMaterial *material, RpGeometry *geometry, RwRGBA color, bool filter_mat = false);
|
||||
void setMaterialTexture(RpMaterial *material, RwTexture *texture, bool filter_mat = false);
|
||||
void resetMaterialColor(RpMaterial *material);
|
||||
void resetMaterialTexture(RpMaterial *material);
|
||||
};
|
||||
static inline VehicleExtendedData<VehData> m_VehData;
|
||||
|
||||
protected:
|
||||
static inline ResourceStore m_TextureData { "textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
||||
static inline ResourceStore m_TextureData{"textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80)};
|
||||
|
||||
struct veh_nodes
|
||||
{
|
||||
@ -81,10 +76,10 @@ protected:
|
||||
};
|
||||
|
||||
Paint();
|
||||
static void UpdateNodeListRecursive(CVehicle* pVeh);
|
||||
static void NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func);
|
||||
static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
|
||||
static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
|
||||
static void ResetNodeColor(CVehicle* veh, std::string node_name);
|
||||
static void ResetNodeTexture(CVehicle* pVeh, std::string node_name);
|
||||
static void UpdateNodeListRecursive(CVehicle *pVeh);
|
||||
static void NodeWrapperRecursive(RwFrame *frame, CVehicle *pVeh, std::function<void(RwFrame *)> func);
|
||||
static void SetNodeColor(CVehicle *pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
|
||||
static void SetNodeTexture(CVehicle *pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
|
||||
static void ResetNodeColor(CVehicle *veh, std::string node_name);
|
||||
static void ResetNodeTexture(CVehicle *pVeh, std::string node_name);
|
||||
};
|
||||
|
38
src/pch.h
38
src/pch.h
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#pragma warning(disable:4503 4244 4005)
|
||||
#pragma warning(disable : 4503 4244 4005)
|
||||
|
||||
#define INPUT_BUFFER_SIZE 64
|
||||
#define SPAWN_PED_LIMIT 20
|
||||
@ -14,65 +14,67 @@
|
||||
#define BY_GAME(sa, vc, iii) iii
|
||||
#endif
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <d3d11.h>
|
||||
#include <d3d11Shader.h>
|
||||
#include <d3d9.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
|
||||
#include <plugin.h>
|
||||
#include <CCamera.h>
|
||||
#include <CClock.h>
|
||||
#include <CCivilianPed.h>
|
||||
#include <CClock.h>
|
||||
#include <CGangs.h>
|
||||
#include <CHud.h>
|
||||
#include <CMenuManager.h>
|
||||
#include <CModelInfo.h>
|
||||
#include <RenderWare.h>
|
||||
#include <CStats.h>
|
||||
#include <CStreaming.h>
|
||||
#include <CTheScripts.h>
|
||||
#include <CTimer.h>
|
||||
#include <CTimeCycle.h>
|
||||
#include <CTimer.h>
|
||||
#include <CTrain.h>
|
||||
#include <CWeather.h>
|
||||
#include <CWorld.h>
|
||||
#include <extensions/ScriptCommands.h>
|
||||
#include <extensions/Screen.h>
|
||||
#include <RenderWare.h>
|
||||
#include <extensions/Paths.h>
|
||||
#include <extensions/Screen.h>
|
||||
#include <extensions/ScriptCommands.h>
|
||||
#include <plugin.h>
|
||||
|
||||
#ifndef GTA3
|
||||
#include <CBike.h>
|
||||
#include <cHandlingDataMgr.h>
|
||||
#include <CTheZones.h>
|
||||
#include <CZoneInfo.h>
|
||||
#include <cHandlingDataMgr.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
#include <CCheat.h>
|
||||
#include <CClothes.h>
|
||||
#include <CCutsceneMgr.h>
|
||||
#include <CGangWars.h>
|
||||
#include <CRadar.h>
|
||||
#include <CShadows.h>
|
||||
#include <eVehicleClass.h>
|
||||
#include <CGangWars.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "../depend/fla/IDaccess.h"
|
||||
#include "../depend/imgui/imgui.h"
|
||||
|
||||
#include "json.h"
|
||||
#include "hotkeys.h"
|
||||
#include "vKeys.h"
|
||||
#include "json.h"
|
||||
#include "resourcestore.h"
|
||||
#include "vKeys.h"
|
||||
|
||||
using CallbackTable = std::vector<std::pair<std::string, void(*)()>>;
|
||||
using CallbackTable = std::vector<std::pair<std::string, void (*)()>>;
|
||||
using namespace plugin;
|
||||
|
||||
enum eRenderer
|
||||
@ -96,9 +98,9 @@ static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3)
|
||||
#elif GTAVC
|
||||
CHud::SetHelpMessage(message, b1, b2);
|
||||
#else // GTA3
|
||||
const size_t cSize = strlen(message)+1;
|
||||
wchar_t* wc = new wchar_t[cSize];
|
||||
mbstowcs (wc, message, cSize);
|
||||
CHud::SetHelpMessage((wchar_t*)wc, b1);
|
||||
const size_t cSize = strlen(message) + 1;
|
||||
wchar_t *wc = new wchar_t[cSize];
|
||||
mbstowcs(wc, message, cSize);
|
||||
CHud::SetHelpMessage((wchar_t *)wc, b1);
|
||||
#endif
|
||||
}
|
68
src/ped.cpp
68
src/ped.cpp
@ -1,5 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "ped.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "weapon.h"
|
||||
@ -23,20 +23,18 @@ Ped::Ped()
|
||||
|
||||
TODO: Implement in VC too
|
||||
*/
|
||||
Events::pedRenderEvent += [](CPed *ped)
|
||||
{
|
||||
|
||||
Events::pedRenderEvent += [](CPed *ped) {
|
||||
if (m_bBigHead || m_bThinBody)
|
||||
{
|
||||
auto animHier = GetAnimHierarchyFromSkinClump (ped->m_pRwClump);
|
||||
auto matrices = RpHAnimHierarchyGetMatrixArray (animHier);
|
||||
auto animHier = GetAnimHierarchyFromSkinClump(ped->m_pRwClump);
|
||||
auto matrices = RpHAnimHierarchyGetMatrixArray(animHier);
|
||||
|
||||
RwV3d scale = {0.7f, 0.7f, 0.7f};
|
||||
if (m_bThinBody)
|
||||
{
|
||||
for (int i = 1; i <= 52; i++)
|
||||
{
|
||||
RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT);
|
||||
RwMatrixScale(&matrices[RpHAnimIDGetIndex(animHier, i)], &scale, rwCOMBINEPRECONCAT);
|
||||
}
|
||||
}
|
||||
scale = {3.0f, 3.0f, 3.0f};
|
||||
@ -44,7 +42,7 @@ Ped::Ped()
|
||||
{
|
||||
for (int i = BONE_NECK; i <= BONE_HEAD; i++)
|
||||
{
|
||||
RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT);
|
||||
RwMatrixScale(&matrices[RpHAnimIDGetIndex(animHier, i)], &scale, rwCOMBINEPRECONCAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,7 +52,7 @@ Ped::Ped()
|
||||
|
||||
Ped::~Ped()
|
||||
{
|
||||
for (CPed* ped : m_SpawnPed::m_List)
|
||||
for (CPed *ped : m_SpawnPed::m_List)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
ped->Remove();
|
||||
@ -62,9 +60,9 @@ Ped::~Ped()
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
void Ped::SpawnPed(std::string& model)
|
||||
void Ped::SpawnPed(std::string &model)
|
||||
#else // GTA3 & GTAVC
|
||||
void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
void Ped::SpawnPed(std::string &cat, std::string &name, std::string &model)
|
||||
#endif
|
||||
{
|
||||
if (m_SpawnPed::m_List.size() == SPAWN_PED_LIMIT)
|
||||
@ -75,11 +73,11 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
|
||||
if (BY_GAME(m_PedData.m_pJson->m_Data.contains(model), true, true))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
pos.y += 1;
|
||||
|
||||
CPed* ped;
|
||||
CPed *ped;
|
||||
int hplayer;
|
||||
static size_t currentSlot = 1;
|
||||
|
||||
@ -95,7 +93,8 @@ 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>(m_SpawnPed::m_nSelectedPedType + 4, 290 + currentSlot, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed::m_nSelectedPedType + 4, 290 + currentSlot, pos.x, pos.y,
|
||||
pos.z + 1, &hplayer);
|
||||
CStreaming::SetSpecialCharIsDeletable(290 + currentSlot);
|
||||
|
||||
// SA has 10 slots
|
||||
@ -115,7 +114,8 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
|
||||
Command<Commands::LOAD_SPECIAL_CHARACTER>(currentSlot, model.c_str());
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed::m_nSelectedPedType + 4, 108+currentSlot, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed::m_nSelectedPedType + 4, 108 + currentSlot, pos.x, pos.y,
|
||||
pos.z + 1, &hplayer);
|
||||
Command<Commands::UNLOAD_SPECIAL_CHARACTER>(currentSlot);
|
||||
|
||||
++currentSlot;
|
||||
@ -132,7 +132,8 @@ 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>(m_SpawnPed::m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed::m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1,
|
||||
&hplayer);
|
||||
CStreaming::SetModelIsDeletable(iModel);
|
||||
}
|
||||
|
||||
@ -251,9 +252,9 @@ void Ped::Draw()
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZone szone = CZone();
|
||||
CZone* pZone = &szone;
|
||||
CZone *pZone = &szone;
|
||||
|
||||
CZoneInfo* zoneInfo = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
CZoneInfo *zoneInfo = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
int density = zoneInfo->m_nGangDensity[i];
|
||||
|
||||
if (ImGui::SliderInt(m_GangNames[i].c_str(), &density, 0, 127))
|
||||
@ -286,8 +287,7 @@ void Ped::Draw()
|
||||
if (ImGui::CollapsingHeader("Recruit anyone"))
|
||||
{
|
||||
static std::vector<Ui::NamedMemory> selectWeapon{
|
||||
{"9mm", 0x96917C}, {"AK47", 0x96917D}, {"Rockets", 0x96917E}
|
||||
};
|
||||
{"9mm", 0x96917C}, {"AK47", 0x96917D}, {"Rockets", 0x96917E}};
|
||||
Ui::RadioButtonAddress("Select weapon", selectWeapon);
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
@ -300,11 +300,11 @@ void Ped::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove peds", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CPed* ped : CPools::ms_pPedPool)
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
for (CPed *ped : CPools::ms_pPedPool)
|
||||
{
|
||||
if (DistanceBetweenPoints(ped->GetPosition(), player->GetPosition()) < m_nPedRemoveRadius
|
||||
&& ped->m_pVehicle == nullptr && ped != player)
|
||||
if (DistanceBetweenPoints(ped->GetPosition(), player->GetPosition()) < m_nPedRemoveRadius &&
|
||||
ped->m_pVehicle == nullptr && ped != player)
|
||||
{
|
||||
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(ped));
|
||||
}
|
||||
@ -321,7 +321,7 @@ void Ped::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove frozen peds", Ui::GetSize(1)))
|
||||
{
|
||||
for (CPed* ped : m_SpawnPed::m_List)
|
||||
for (CPed *ped : m_SpawnPed::m_List)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
ped->Remove();
|
||||
@ -374,20 +374,20 @@ void Ped::Draw()
|
||||
ImGui::Text("Selected weapon: %s", m_SpawnPed::m_nWeaponName.c_str());
|
||||
ImGui::Spacing();
|
||||
#ifdef GTASA
|
||||
Ui::DrawImages(Weapon::m_WeaponData,
|
||||
[](std::string str) { m_SpawnPed::m_nWeaponId = std::stoi(str); },
|
||||
Ui::DrawImages(
|
||||
Weapon::m_WeaponData, [](std::string str) { m_SpawnPed::m_nWeaponId = std::stoi(str); },
|
||||
nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
[](std::string str) {
|
||||
m_SpawnPed::m_nWeaponName = Weapon::m_WeaponData.m_pJson->m_Data[str].get<std::string>();
|
||||
return m_SpawnPed::m_nWeaponName;
|
||||
},
|
||||
[](std::string str) { return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
[](std::string str) {
|
||||
return str != "-1"; /*Jetpack*/
|
||||
});
|
||||
#else // GTA3 & GTAVC
|
||||
Ui::DrawJSON(Weapon::m_WeaponData,
|
||||
[](std::string& root, std::string& key, std::string& id)
|
||||
{
|
||||
Ui::DrawJSON(
|
||||
Weapon::m_WeaponData,
|
||||
[](std::string &root, std::string &key, std::string &id) {
|
||||
m_SpawnPed::m_nWeaponId = std::stoi(id);
|
||||
m_SpawnPed::m_nWeaponName = key;
|
||||
},
|
||||
|
46
src/ped.h
46
src/ped.h
@ -14,11 +14,9 @@ private:
|
||||
static inline CJson m_SpecialPedJson = CJson("ped special");
|
||||
static inline ResourceStore m_PedData{"ped", eResourceType::TYPE_BOTH, ImVec2(65, 110)};
|
||||
|
||||
static inline std::vector<std::string> m_GangNames =
|
||||
{
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
static inline std::vector<std::string> m_GangNames = {
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa", "Da nang boys",
|
||||
"Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"};
|
||||
#else // GTA3 & GTAVC
|
||||
static inline ResourceStore m_PedData{"ped", eResourceType::TYPE_TEXT};
|
||||
#endif
|
||||
@ -27,7 +25,7 @@ private:
|
||||
static inline int m_nPedRemoveRadius = 5;
|
||||
struct m_SpawnPed
|
||||
{
|
||||
static inline std::vector<CPed*> m_List;
|
||||
static inline std::vector<CPed *> m_List;
|
||||
static inline int m_nAccuracy = 50;
|
||||
static inline int m_nPedHealth = 100;
|
||||
static inline bool m_bPedMove;
|
||||
@ -35,19 +33,33 @@ private:
|
||||
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 =
|
||||
{
|
||||
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"
|
||||
"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"
|
||||
"Security Guards", "Biker Gang", "Vercetti Gang", "Golfers", "Gang 9", "Emergency", "Fireman",
|
||||
"Criminal", "Unused", "Prostitute", "Special"
|
||||
#else // GTA3
|
||||
"Civ Male", "Civ Female", "Cop", "Leones", "Triads", "Diablos", "Yakuza", "Yardies", "Colombians",
|
||||
"Hoods", "unused", "unused", "Emergency", "Fireman", "Criminal", "unused", "Prostitute", "Special"
|
||||
"Civ Male", "Civ Female", "Cop", "Leones", "Triads", "Diablos", "Yakuza",
|
||||
"Yardies", "Colombians", "Hoods", "unused", "unused", "Emergency", "Fireman",
|
||||
"Criminal", "unused", "Prostitute", "Special"
|
||||
#endif
|
||||
};
|
||||
};
|
||||
@ -63,9 +75,9 @@ public:
|
||||
static void Draw();
|
||||
|
||||
#ifdef GTASA
|
||||
static void SpawnPed(std::string& model);
|
||||
static void SpawnPed(std::string &model);
|
||||
static void BigHeadEffect(CPed *ped);
|
||||
#else // GTA3 & GTAVC
|
||||
static void SpawnPed(std::string& cat, std::string& name, std::string& model);
|
||||
static void SpawnPed(std::string &cat, std::string &name, std::string &model);
|
||||
#endif
|
||||
};
|
||||
|
149
src/player.cpp
149
src/player.cpp
@ -1,15 +1,14 @@
|
||||
#include "pch.h"
|
||||
#include "player.h"
|
||||
#include "menu.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include "ped.h"
|
||||
|
||||
// hardcoded cloth category names
|
||||
const char* cloth_category[18] =
|
||||
{
|
||||
"Shirts",
|
||||
const char *cloth_category[18] = {"Shirts",
|
||||
"Heads",
|
||||
"Trousers",
|
||||
"Shoes",
|
||||
@ -26,30 +25,28 @@ const char* cloth_category[18] =
|
||||
"Watches",
|
||||
"Glasses",
|
||||
"Hats",
|
||||
"Extras"
|
||||
};
|
||||
"Extras"};
|
||||
|
||||
static inline void PlayerModelBrokenFix()
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
|
||||
if (pPlayer->m_nModelIndex == 0)
|
||||
Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Taken from gta chaos mod by Lordmau5
|
||||
https://github.com/gta-chaos-mod/Trilogy-ASI-Script
|
||||
*/
|
||||
void Player::TopDownCameraView()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed ();
|
||||
CVector pos = player->GetPosition ();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
float curOffset = m_TopDownCamera::m_fOffset;
|
||||
|
||||
// drunk effect causes issues
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS>(0, 0);
|
||||
|
||||
CVehicle *vehicle = FindPlayerVehicle(-1, false);
|
||||
|
||||
@ -73,31 +70,27 @@ void Player::TopDownCameraView()
|
||||
curOffset += speed;
|
||||
}
|
||||
|
||||
CVector playerOffset = CVector (pos.x, pos.y, pos.z + 2.0f);
|
||||
CVector cameraPos
|
||||
= CVector (playerOffset.x, playerOffset.y, playerOffset.z + curOffset);
|
||||
CVector playerOffset = CVector(pos.x, pos.y, pos.z + 2.0f);
|
||||
CVector cameraPos = CVector(playerOffset.x, playerOffset.y, playerOffset.z + curOffset);
|
||||
|
||||
CColPoint outColPoint;
|
||||
CEntity * outEntity;
|
||||
CEntity *outEntity;
|
||||
|
||||
// TODO: Which variable? X, Y or Z for the look direction?
|
||||
|
||||
if (CWorld::ProcessLineOfSight (playerOffset, cameraPos, outColPoint,
|
||||
outEntity, true, true, true, true, true,
|
||||
true, true, true))
|
||||
if (CWorld::ProcessLineOfSight(playerOffset, cameraPos, outColPoint, outEntity, true, true, true, true, true, true,
|
||||
true, true))
|
||||
{
|
||||
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
|
||||
outColPoint.m_vecPoint.x, outColPoint.m_vecPoint.y,
|
||||
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION>(outColPoint.m_vecPoint.x, outColPoint.m_vecPoint.y,
|
||||
outColPoint.m_vecPoint.z, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
|
||||
cameraPos.x, cameraPos.y, cameraPos.z, 0.0f, 0.0f, 0.0f);
|
||||
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION>(cameraPos.x, cameraPos.y, cameraPos.z, 0.0f, 0.0f,
|
||||
0.0f);
|
||||
}
|
||||
|
||||
Command<eScriptCommands::COMMAND_POINT_CAMERA_AT_POINT> (pos.x, pos.y,
|
||||
pos.z, 2);
|
||||
Command<eScriptCommands::COMMAND_POINT_CAMERA_AT_POINT>(pos.x, pos.y, pos.z, 2);
|
||||
|
||||
TheCamera.m_fGenerationDistMultiplier = 10.0f;
|
||||
TheCamera.m_fLODDistMultiplier = 10.0f;
|
||||
@ -107,7 +100,7 @@ void Player::TopDownCameraView()
|
||||
Player::Player()
|
||||
{
|
||||
#ifdef GTASA
|
||||
// Fix player model being broken after rebuild
|
||||
// Fix player model being broken after rebuild
|
||||
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
|
||||
m_bAimSkinChanger = gConfig.GetValue("aim_skin_changer", false);
|
||||
#endif
|
||||
@ -118,7 +111,7 @@ Player::Player()
|
||||
#ifdef GTASA
|
||||
if (std::filesystem::is_directory(m_CustomSkins::m_Path))
|
||||
{
|
||||
for (auto& p : std::filesystem::recursive_directory_iterator(m_CustomSkins::m_Path))
|
||||
for (auto &p : std::filesystem::recursive_directory_iterator(m_CustomSkins::m_Path))
|
||||
{
|
||||
if (p.path().extension() == ".dff")
|
||||
{
|
||||
@ -140,10 +133,9 @@ Player::Player()
|
||||
m_bModloaderInstalled = true;
|
||||
}
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
Events::processScriptsEvent += [] {
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
if (m_KeepPosition::m_bEnabled)
|
||||
@ -156,11 +148,10 @@ Player::Player()
|
||||
{
|
||||
CVector cur_pos = player->GetPosition();
|
||||
|
||||
if (m_KeepPosition::m_fPos.x != 0 && m_KeepPosition::m_fPos.x != cur_pos.x
|
||||
&& m_KeepPosition::m_fPos.y != 0 && m_KeepPosition::m_fPos.y != cur_pos.y)
|
||||
if (m_KeepPosition::m_fPos.x != 0 && m_KeepPosition::m_fPos.x != cur_pos.x &&
|
||||
m_KeepPosition::m_fPos.y != 0 && m_KeepPosition::m_fPos.y != cur_pos.y)
|
||||
{
|
||||
BY_GAME(player->Teleport(m_KeepPosition::m_fPos, false)
|
||||
, player->Teleport(m_KeepPosition::m_fPos));
|
||||
BY_GAME(player->Teleport(m_KeepPosition::m_fPos, false), player->Teleport(m_KeepPosition::m_fPos));
|
||||
m_KeepPosition::m_fPos = CVector(0, 0, 0);
|
||||
}
|
||||
}
|
||||
@ -193,7 +184,7 @@ Player::Player()
|
||||
#ifdef GTASA
|
||||
if (m_bDrunkEffect && !m_TopDownCamera::m_bEnabled)
|
||||
{
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 100);
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS>(0, 100);
|
||||
}
|
||||
|
||||
if (m_TopDownCamera::m_bEnabled)
|
||||
@ -203,7 +194,7 @@ Player::Player()
|
||||
|
||||
if (m_bAimSkinChanger && aimSkinChanger.Pressed())
|
||||
{
|
||||
CPed* targetPed = player->m_pPlayerTargettedPed;
|
||||
CPed *targetPed = player->m_pPlayerTargettedPed;
|
||||
if (targetPed)
|
||||
{
|
||||
player->SetModelIndex(targetPed->m_nModelIndex);
|
||||
@ -249,7 +240,7 @@ Player::Player()
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
void Player::ChangePlayerCloth(std::string& name)
|
||||
void Player::ChangePlayerCloth(std::string &name)
|
||||
{
|
||||
std::stringstream ss(name);
|
||||
std::string temp;
|
||||
@ -263,7 +254,7 @@ void Player::ChangePlayerCloth(std::string& name)
|
||||
getline(ss, temp, '$');
|
||||
std::string texName = temp.c_str();
|
||||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
if (texName == "cutoffchinosblue")
|
||||
{
|
||||
@ -292,14 +283,14 @@ void Player::ChangePlayerCloth(std::string& name)
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
void Player::ChangePlayerModel(std::string& model)
|
||||
void Player::ChangePlayerModel(std::string &model)
|
||||
{
|
||||
bool custom_skin = std::find(m_CustomSkins::m_List.begin(), m_CustomSkins::m_List.end(), model) !=
|
||||
m_CustomSkins::m_List.end();
|
||||
bool custom_skin =
|
||||
std::find(m_CustomSkins::m_List.begin(), m_CustomSkins::m_List.end(), model) != m_CustomSkins::m_List.end();
|
||||
|
||||
if (Ped::m_PedData.m_pJson->m_Data.contains(model) || custom_skin)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
if (Ped::m_SpecialPedJson.m_Data.contains(model) || custom_skin)
|
||||
{
|
||||
std::string name;
|
||||
@ -328,9 +319,9 @@ void Player::ChangePlayerModel(std::string& model)
|
||||
}
|
||||
}
|
||||
#else // GTA3 & GTAVC
|
||||
void Player::ChangePlayerModel(std::string& cat, std::string& key, std::string& val)
|
||||
void Player::ChangePlayerModel(std::string &cat, std::string &key, std::string &val)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
#ifdef GTAVC
|
||||
player->Undress(id.c_str());
|
||||
@ -359,10 +350,10 @@ void Player::ChangePlayerModel(std::string& cat, std::string& key, std::string&
|
||||
|
||||
void Player::Draw()
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
#ifdef GTASA
|
||||
CPad* pad = pPlayer->GetPadFromPlayer();
|
||||
CPad *pad = pPlayer->GetPadFromPlayer();
|
||||
#endif
|
||||
CPlayerInfo *pInfo = &CWorld::Players[CWorld::PlayerInFocus];
|
||||
|
||||
@ -400,12 +391,12 @@ void Player::Draw()
|
||||
{
|
||||
if (!m_bDrunkEffect)
|
||||
{
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
|
||||
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS>(0, 0);
|
||||
}
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Fast Sprint", &m_bFastSprint, "Best to enable God Mode & Infinite sprint too"))
|
||||
{
|
||||
if(m_bFastSprint)
|
||||
if (m_bFastSprint)
|
||||
{
|
||||
patch::Set<float>(0x8D2458, 0.1f);
|
||||
}
|
||||
@ -416,8 +407,9 @@ void Player::Draw()
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
#endif
|
||||
Ui::CheckboxAddress("Free healthcare", BY_GAME((int)&pInfo->m_bFreeHealthCare,
|
||||
(int)&pInfo->m_bFreeHealthCare, (int)&pInfo->m_bGetOutOfHospitalFree));
|
||||
Ui::CheckboxAddress("Free healthcare",
|
||||
BY_GAME((int)&pInfo->m_bFreeHealthCare, (int)&pInfo->m_bFreeHealthCare,
|
||||
(int)&pInfo->m_bGetOutOfHospitalFree));
|
||||
|
||||
if (Ui::CheckboxWithHint("God mode", &m_bGodMode))
|
||||
{
|
||||
@ -451,7 +443,8 @@ void Player::Draw()
|
||||
}
|
||||
Ui::CheckboxAddress("Infinite sprint", 0xB7CEE4);
|
||||
#else // GTA3 & GTAVC
|
||||
Ui::CheckboxAddress("Infinite sprint", BY_GAME(NULL, (int)&pInfo->m_bNeverGetsTired, (int)&pInfo->m_bInfiniteSprint));
|
||||
Ui::CheckboxAddress("Infinite sprint",
|
||||
BY_GAME(NULL, (int)&pInfo->m_bNeverGetsTired, (int)&pInfo->m_bInfiniteSprint));
|
||||
#endif
|
||||
|
||||
ImGui::NextColumn();
|
||||
@ -483,7 +476,8 @@ void Player::Draw()
|
||||
pPlayer->m_pWanted->CheatWantedLevel(0);
|
||||
#endif
|
||||
pPlayer->m_pWanted->Update();
|
||||
patch::SetRaw(BY_GAME(NULL, 0x4D2110, 0x4AD900), (char*)"\xC3\x90\x90\x90\x90\x90", 6); // CWanted::UpdateWantedLevel()
|
||||
patch::SetRaw(BY_GAME(NULL, 0x4D2110, 0x4AD900), (char *)"\xC3\x90\x90\x90\x90\x90",
|
||||
6); // CWanted::UpdateWantedLevel()
|
||||
patch::Nop(BY_GAME(NULL, 0x5373D0, 0x4EFE73), 5); // CWanted::Update();
|
||||
}
|
||||
else
|
||||
@ -491,18 +485,19 @@ void Player::Draw()
|
||||
pPlayer->m_pWanted->ClearQdCrimes();
|
||||
#ifdef GTA3
|
||||
pPlayer->m_pWanted->SetWantedLevel(0);
|
||||
patch::SetRaw(0x4AD900, (char*)"\xA1\x18\x77\x5F\x00", 6);
|
||||
patch::SetRaw(0x4EFE73, (char*)"\xE8\x38\xD9\xFB\xFF", 5);
|
||||
patch::SetRaw(0x4AD900, (char *)"\xA1\x18\x77\x5F\x00", 6);
|
||||
patch::SetRaw(0x4EFE73, (char *)"\xE8\x38\xD9\xFB\xFF", 5);
|
||||
#else
|
||||
pPlayer->m_pWanted->CheatWantedLevel(0);
|
||||
patch::SetRaw(0x4D2110, (char*)"\x8B\x15\xDC\x10\x69\x00", 6);
|
||||
patch::SetRaw(0x5373D0, (char*)"\xE8\x8B\xAE\xF9\xFF", 5);
|
||||
patch::SetRaw(0x4D2110, (char *)"\x8B\x15\xDC\x10\x69\x00", 6);
|
||||
patch::SetRaw(0x5373D0, (char *)"\xE8\x8B\xAE\xF9\xFF", 5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Ui::CheckboxAddress("No arrest fee", (int)&pInfo->m_bGetOutOfJailFree);
|
||||
Ui::CheckboxWithHint("Respawn die location", &m_KeepPosition::m_bEnabled, "Respawn to the location you died from");
|
||||
Ui::CheckboxWithHint("Respawn die location", &m_KeepPosition::m_bEnabled,
|
||||
"Respawn to the location you died from");
|
||||
|
||||
ImGui::Columns(1);
|
||||
|
||||
@ -601,7 +596,8 @@ void Player::Draw()
|
||||
Ui::EditStat("Energy", STAT_ENERGY);
|
||||
Ui::EditStat("Fat", STAT_FAT);
|
||||
#endif
|
||||
Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, BY_GAME(static_cast<int>(pPlayer->m_fMaxHealth), 100, 100));
|
||||
Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100,
|
||||
BY_GAME(static_cast<int>(pPlayer->m_fMaxHealth), 100, 100));
|
||||
#ifdef GTASA
|
||||
Ui::EditStat("Lung capacity", STAT_LUNG_CAPACITY);
|
||||
Ui::EditStat("Max health", STAT_MAX_HEALTH, 0, 569, 1450);
|
||||
@ -613,7 +609,6 @@ void Player::Draw()
|
||||
pInfo->m_nDisplayMoney = money;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GTASA
|
||||
Ui::EditStat("Muscle", STAT_MUSCLE);
|
||||
Ui::EditStat("Respect", STAT_RESPECT);
|
||||
@ -713,8 +708,9 @@ void Player::Draw()
|
||||
ImGui::Spacing();
|
||||
|
||||
if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger,
|
||||
(("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ")
|
||||
+ aimSkinChanger.Pressed())))
|
||||
(("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with "
|
||||
"a weapon and press ") +
|
||||
aimSkinChanger.Pressed())))
|
||||
gConfig.SetValue("aim_skin_changer", m_bAimSkinChanger);
|
||||
if (ImGui::BeginTabBar("AppearanceTabBar"))
|
||||
{
|
||||
@ -730,9 +726,9 @@ void Player::Draw()
|
||||
{
|
||||
if (bClothOption == 0)
|
||||
{
|
||||
Ui::DrawImages(m_ClothData, ChangePlayerCloth, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
Ui::DrawImages(
|
||||
m_ClothData, ChangePlayerCloth, nullptr,
|
||||
[](std::string str) {
|
||||
std::stringstream ss(str);
|
||||
std::string temp;
|
||||
|
||||
@ -740,7 +736,8 @@ void Player::Draw()
|
||||
getline(ss, temp, '$');
|
||||
|
||||
return temp;
|
||||
}, nullptr, cloth_category, sizeof(cloth_category) / sizeof(const char*));
|
||||
},
|
||||
nullptr, cloth_category, sizeof(cloth_category) / sizeof(const char *));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -748,7 +745,7 @@ void Player::Draw()
|
||||
|
||||
if (ImGui::Button("Remove all", ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
for (uint i = 0; i < 18; i++)
|
||||
{
|
||||
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, i);
|
||||
@ -756,11 +753,11 @@ void Player::Draw()
|
||||
CClothes::RebuildPlayer(player, false);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
for (const char* clothName : cloth_category)
|
||||
for (const char *clothName : cloth_category)
|
||||
{
|
||||
if (ImGui::Button(clothName, ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, count);
|
||||
CClothes::RebuildPlayer(player, false);
|
||||
}
|
||||
@ -773,7 +770,8 @@ void Player::Draw()
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped("If CJ is wearing a full suit, click 'Extras/ Remove all' to remove it.");
|
||||
ImGui::TextWrapped(
|
||||
"If CJ is wearing a full suit, click 'Extras/ Remove all' to remove it.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -791,8 +789,9 @@ void Player::Draw()
|
||||
}
|
||||
if (ImGui::BeginTabItem("Ped skins"))
|
||||
{
|
||||
Ui::DrawImages(Ped::m_PedData, ChangePlayerModel, nullptr,
|
||||
[](std::string str) { return Ped::m_PedData.m_pJson->m_Data[str].get<std::string>(); });
|
||||
Ui::DrawImages(Ped::m_PedData, ChangePlayerModel, nullptr, [](std::string str) {
|
||||
return Ped::m_PedData.m_pJson->m_Data[str].get<std::string>();
|
||||
});
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Custom skins"))
|
||||
@ -801,13 +800,13 @@ void Player::Draw()
|
||||
|
||||
if (m_bModloaderInstalled)
|
||||
{
|
||||
Ui::FilterWithHint("Search", m_ClothData.m_Filter,
|
||||
std::string("Total skins: " + std::to_string(m_CustomSkins::m_List.size()))
|
||||
.c_str());
|
||||
Ui::FilterWithHint(
|
||||
"Search", m_ClothData.m_Filter,
|
||||
std::string("Total skins: " + std::to_string(m_CustomSkins::m_List.size())).c_str());
|
||||
Ui::ShowTooltip("Place your dff & txd files inside 'modloader/Custom Skins'");
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped(
|
||||
"Note: Your txd & dff names can't exceed 8 characters. Don't change names while the game is running.");
|
||||
ImGui::TextWrapped("Note: Your txd & dff names can't exceed 8 characters. Don't change names "
|
||||
"while the game is running.");
|
||||
ImGui::Spacing();
|
||||
for (std::string name : m_CustomSkins::m_List)
|
||||
{
|
||||
|
13
src/player.h
13
src/player.h
@ -17,10 +17,11 @@ private:
|
||||
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)};
|
||||
static inline ResourceStore m_ClothData{"clothes", eResourceType::TYPE_IMAGE, ImVec2(70, 100)};
|
||||
struct m_CustomSkins
|
||||
{
|
||||
static inline std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
|
||||
static inline std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");
|
||||
;
|
||||
static inline ImGuiTextFilter m_Filter;
|
||||
static inline std::vector<std::string> m_List;
|
||||
};
|
||||
@ -31,7 +32,7 @@ private:
|
||||
static inline float m_fOffset = 40.0f;
|
||||
};
|
||||
#else // GTA3 & GTAVC
|
||||
static inline ResourceStore skinData{ BY_GAME(NULL, "skin", "ped"), eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore skinData{BY_GAME(NULL, "skin", "ped"), eResourceType::TYPE_TEXT};
|
||||
#endif
|
||||
|
||||
public:
|
||||
@ -39,10 +40,10 @@ public:
|
||||
static void Draw();
|
||||
|
||||
#ifdef GTASA
|
||||
static void ChangePlayerModel(std::string& model);
|
||||
static void ChangePlayerCloth(std::string& model);
|
||||
static void ChangePlayerModel(std::string &model);
|
||||
static void ChangePlayerCloth(std::string &model);
|
||||
static void TopDownCameraView();
|
||||
#else // GTA3 & GTAVC
|
||||
static void ChangePlayerModel(std::string& cat, std::string& name, std::string& id);
|
||||
static void ChangePlayerModel(std::string &cat, std::string &name, std::string &id);
|
||||
#endif
|
||||
};
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "CFileLoader.h"
|
||||
#include "extensions/Paths.h"
|
||||
#include "pch.h"
|
||||
|
||||
ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageSize)
|
||||
: m_ImageSize(imageSize)
|
||||
ResourceStore::ResourceStore(const char *text, eResourceType type, ImVec2 imageSize) : m_ImageSize(imageSize)
|
||||
{
|
||||
if (type == eResourceType::TYPE_TEXT
|
||||
|| type == eResourceType::TYPE_BOTH)
|
||||
if (type == eResourceType::TYPE_TEXT || type == eResourceType::TYPE_BOTH)
|
||||
{
|
||||
m_pJson = std::make_unique<CJson>(text);
|
||||
|
||||
@ -20,15 +18,13 @@ ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageS
|
||||
}
|
||||
}
|
||||
|
||||
if (type == eResourceType::TYPE_IMAGE
|
||||
|| type == eResourceType::TYPE_BOTH)
|
||||
if (type == eResourceType::TYPE_IMAGE || type == eResourceType::TYPE_BOTH)
|
||||
{
|
||||
/*
|
||||
Textures need to be loaded from main thread
|
||||
Loading it directly here doesn't work
|
||||
*/
|
||||
Events::processScriptsEvent += [text, this]()
|
||||
{
|
||||
Events::processScriptsEvent += [text, this]() {
|
||||
if (!m_bTexturesLoaded)
|
||||
{
|
||||
LoadTextureResource(text);
|
||||
@ -38,26 +34,26 @@ ResourceStore::ResourceStore(const char* text, eResourceType type, ImVec2 imageS
|
||||
}
|
||||
}
|
||||
|
||||
static void* GetTextureFromRaster(RwTexture* pTexture)
|
||||
static void *GetTextureFromRaster(RwTexture *pTexture)
|
||||
{
|
||||
RwRasterEx* raster = (RwRasterEx*)(&pTexture->raster->parent);
|
||||
RwRasterEx *raster = (RwRasterEx *)(&pTexture->raster->parent);
|
||||
|
||||
return (&raster->m_pRenderResource->texture);
|
||||
}
|
||||
|
||||
void ResourceStore::LoadTextureResource(std::string&& name)
|
||||
void ResourceStore::LoadTextureResource(std::string &&name)
|
||||
{
|
||||
std::string fullPath = PLUGIN_PATH((char*)"CheatMenu\\") + name + ".txd";
|
||||
RwTexDictionary* pRwTexDictionary = CFileLoader::LoadTexDictionary(fullPath.c_str());
|
||||
std::string fullPath = PLUGIN_PATH((char *)"CheatMenu\\") + name + ".txd";
|
||||
RwTexDictionary *pRwTexDictionary = CFileLoader::LoadTexDictionary(fullPath.c_str());
|
||||
|
||||
if (pRwTexDictionary)
|
||||
{
|
||||
RwLinkList *pRLL = (RwLinkList*)pRwTexDictionary->texturesInDict.link.next;
|
||||
RwLinkList *pRLL = (RwLinkList *)pRwTexDictionary->texturesInDict.link.next;
|
||||
RwTexDictionary *pEndDic;
|
||||
do
|
||||
{
|
||||
pEndDic = (RwTexDictionary*)pRLL->link.next;
|
||||
RwTexture *pTex = (RwTexture*)&pRLL[-1];
|
||||
pEndDic = (RwTexDictionary *)pRLL->link.next;
|
||||
RwTexture *pTex = (RwTexture *)&pRLL[-1];
|
||||
|
||||
m_ImagesList.push_back(std::make_unique<TextureResource>());
|
||||
m_ImagesList.back().get()->m_pRwTexture = pTex;
|
||||
@ -88,8 +84,7 @@ void ResourceStore::LoadTextureResource(std::string&& name)
|
||||
{
|
||||
m_Categories.push_back(m_ImagesList.back().get()->m_CategoryName);
|
||||
}
|
||||
pRLL = (RwLinkList*)pEndDic;
|
||||
}
|
||||
while ( pEndDic != (RwTexDictionary*)&pRwTexDictionary->texturesInDict );
|
||||
pRLL = (RwLinkList *)pEndDic;
|
||||
} while (pEndDic != (RwTexDictionary *)&pRwTexDictionary->texturesInDict);
|
||||
}
|
||||
}
|
@ -1,26 +1,25 @@
|
||||
#include <string>
|
||||
#include <rw/rwcore.h>
|
||||
#include "json.h"
|
||||
#include "../depend/imgui/imgui.h"
|
||||
#include "d3d9.h"
|
||||
#include "json.h"
|
||||
#include <rw/rwcore.h>
|
||||
#include <string>
|
||||
|
||||
struct RwD3D9Raster
|
||||
{
|
||||
union
|
||||
{
|
||||
IDirect3DTexture9* texture;
|
||||
IDirect3DSurface9* surface;
|
||||
union {
|
||||
IDirect3DTexture9 *texture;
|
||||
IDirect3DSurface9 *surface;
|
||||
};
|
||||
unsigned char* palette;
|
||||
unsigned char *palette;
|
||||
unsigned char alpha;
|
||||
unsigned char cubeTextureFlags; /* 0x01 IS_CUBEMAP_TEX */
|
||||
unsigned char textureFlags; /* 0x10 IS_COMPRESSED */
|
||||
unsigned char lockedLevel;
|
||||
IDirect3DSurface9* lockedSurface;
|
||||
IDirect3DSurface9 *lockedSurface;
|
||||
D3DLOCKED_RECT lockedRect;
|
||||
D3DFORMAT format;
|
||||
IDirect3DSwapChain9* swapChain;
|
||||
HWND* hwnd;
|
||||
IDirect3DSwapChain9 *swapChain;
|
||||
HWND *hwnd;
|
||||
};
|
||||
|
||||
struct RwRasterEx : public RwRaster
|
||||
@ -47,7 +46,7 @@ using TextureResourceList = std::vector<std::unique_ptr<TextureResource>>;
|
||||
class ResourceStore
|
||||
{
|
||||
private:
|
||||
void LoadTextureResource(std::string&& path);
|
||||
void LoadTextureResource(std::string &&path);
|
||||
|
||||
public:
|
||||
ImGuiTextFilter m_Filter = "";
|
||||
@ -58,5 +57,5 @@ public:
|
||||
ImVec2 m_ImageSize;
|
||||
bool m_bTexturesLoaded = false;
|
||||
|
||||
ResourceStore(const char* text, eResourceType type = TYPE_IMAGE, ImVec2 imageSize = ImVec2(64, 64));
|
||||
ResourceStore(const char *text, eResourceType type = TYPE_IMAGE, ImVec2 imageSize = ImVec2(64, 64));
|
||||
};
|
@ -1,12 +1,12 @@
|
||||
#include "pch.h"
|
||||
#include "teleport.h"
|
||||
#include "menu.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef GTASA
|
||||
// FlA
|
||||
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2));
|
||||
tRadarTrace *CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace *>(patch::GetPointer(0x5838B0 + 2));
|
||||
|
||||
void Teleport::FetchRadarSpriteData()
|
||||
{
|
||||
@ -29,8 +29,8 @@ void Teleport::FetchRadarSpriteData()
|
||||
auto sprite_name = m_SpriteJson.m_Data[std::to_string(sprite)].get<std::string>();
|
||||
std::string key_name = sprite_name + ", " + Util::GetLocationName(&pos);
|
||||
|
||||
m_tpData.m_pJson->m_Data["Radar"][key_name] = "0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " +
|
||||
std::to_string(pos.z);
|
||||
m_tpData.m_pJson->m_Data["Radar"][key_name] =
|
||||
"0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||
|
||||
/*
|
||||
"Radar" : {
|
||||
@ -45,21 +45,23 @@ Teleport::Teleport()
|
||||
{
|
||||
m_bQuickTeleport = gConfig.GetValue("quick_teleport", false);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
Events::processScriptsEvent += [] {
|
||||
if ((m_Teleport::m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - m_Teleport::m_nTimer) > 500))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
#ifdef GTASA
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y,
|
||||
m_Teleport::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
|
||||
CEntity *player_entity = FindPlayerEntity(-1);
|
||||
m_Teleport::m_fPos.z =
|
||||
CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y, m_Teleport::m_fPos.z + 100.0f,
|
||||
nullptr, &player_entity) +
|
||||
1.0f;
|
||||
#else // GTA3 & GTAVC
|
||||
m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y,
|
||||
m_Teleport::m_fPos.z + 100.0f, nullptr) + 1.0f;
|
||||
m_Teleport::m_fPos.z + 100.0f, nullptr) +
|
||||
1.0f;
|
||||
#endif
|
||||
CVehicle* pVeh = player->m_pVehicle;
|
||||
CVehicle *pVeh = player->m_pVehicle;
|
||||
|
||||
if (pVeh && BY_GAME(player->m_nPedFlags.bInVehicle, player->m_pVehicle, player->m_pVehicle))
|
||||
{
|
||||
@ -78,8 +80,7 @@ Teleport::Teleport()
|
||||
|
||||
if (m_bQuickTeleport)
|
||||
{
|
||||
if (quickTeleport.Pressed()
|
||||
&& ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
|
||||
if (quickTeleport.Pressed() && ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
|
||||
{
|
||||
m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds;
|
||||
TeleportPlayer(true);
|
||||
@ -90,8 +91,8 @@ Teleport::Teleport()
|
||||
|
||||
void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CVehicle* pVeh = pPlayer->m_pVehicle;
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
CVehicle *pVeh = pPlayer->m_pVehicle;
|
||||
|
||||
#ifdef GTASA
|
||||
if (get_marker)
|
||||
@ -103,7 +104,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
SetHelpMessage("Target blip not found. You need to place it on the map first.", false, false, false);
|
||||
return;
|
||||
}
|
||||
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||
CEntity *pPlayerEntity = FindPlayerEntity(-1);
|
||||
pos = targetBlip.m_vPosition;
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 50.f;
|
||||
|
||||
@ -129,9 +130,9 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
pVeh->Teleport(pos, false);
|
||||
|
||||
if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
|
||||
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
|
||||
reinterpret_cast<CBike *>(pVeh)->PlaceOnRoadProperly();
|
||||
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
|
||||
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
|
||||
reinterpret_cast<CAutomobile *>(pVeh)->PlaceOnRoadProperly();
|
||||
|
||||
BY_GAME(pVeh->m_nAreaCode, pVeh->m_nInterior) = interior_id;
|
||||
}
|
||||
@ -159,7 +160,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
Command<Commands::SET_AREA_VISIBLE>(interior_id);
|
||||
}
|
||||
|
||||
void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, std::string& loc)
|
||||
void Teleport::TeleportToLocation(std::string &rootkey, std::string &bLocName, std::string &loc)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -174,7 +175,7 @@ void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, s
|
||||
}
|
||||
}
|
||||
|
||||
void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std::string& val)
|
||||
void Teleport::RemoveTeleportEntry(std::string &category, std::string &key, std::string &val)
|
||||
{
|
||||
if (category == "Custom")
|
||||
{
|
||||
@ -202,9 +203,11 @@ void Teleport::Draw()
|
||||
ImGui::Checkbox("Insert coordinates", &m_bInsertCoord);
|
||||
ImGui::NextColumn();
|
||||
#ifdef GTASA
|
||||
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
|
||||
std::string(std::string("Teleport to the location of your radar\ntarget blip using ")
|
||||
+ quickTeleport.GetNameString()).c_str()))
|
||||
if (Ui::CheckboxWithHint(
|
||||
"Quick teleport", &m_bQuickTeleport,
|
||||
std::string(std::string("Teleport to the location of your radar\ntarget blip using ") +
|
||||
quickTeleport.GetNameString())
|
||||
.c_str()))
|
||||
{
|
||||
gConfig.SetValue("quick_teleport", m_bQuickTeleport);
|
||||
}
|
||||
@ -218,7 +221,8 @@ void Teleport::Draw()
|
||||
|
||||
strcpy(m_nInputBuffer,
|
||||
(std::to_string(static_cast<int>(pos.x)) + ", " + std::to_string(static_cast<int>(pos.y)) +
|
||||
", " + std::to_string(static_cast<int>(pos.z))).c_str());
|
||||
", " + std::to_string(static_cast<int>(pos.z)))
|
||||
.c_str());
|
||||
}
|
||||
|
||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||
@ -231,7 +235,7 @@ void Teleport::Draw()
|
||||
|
||||
try
|
||||
{
|
||||
sscanf(m_nInputBuffer,"%f,%f,%f", &pos.x, &pos.y, &pos.z);
|
||||
sscanf(m_nInputBuffer, "%f,%f,%f", &pos.x, &pos.y, &pos.z);
|
||||
pos.z += 1.0f;
|
||||
TeleportPlayer(false, pos);
|
||||
}
|
||||
@ -264,7 +268,7 @@ void Teleport::Draw()
|
||||
#endif
|
||||
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(m_tpData, TeleportToLocation,RemoveTeleportEntry);
|
||||
Ui::DrawJSON(m_tpData, TeleportToLocation, RemoveTeleportEntry);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "pch.h"
|
||||
#include <vector>
|
||||
|
||||
class Teleport
|
||||
{
|
||||
@ -8,7 +8,7 @@ private:
|
||||
static inline bool m_bInsertCoord;
|
||||
static inline bool m_bQuickTeleport;
|
||||
static inline char m_nInputBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline ResourceStore m_tpData{ "teleport", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_tpData{"teleport", eResourceType::TYPE_TEXT};
|
||||
static inline char m_nLocationBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline uint m_nQuickTeleportTimer;
|
||||
|
||||
@ -19,24 +19,24 @@ private:
|
||||
struct m_Teleport
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
static inline CVector m_fPos = { -1, -1, -1 };
|
||||
static inline CVector m_fPos = {-1, -1, -1};
|
||||
static inline uint m_nTimer;
|
||||
};
|
||||
|
||||
|
||||
#ifdef GTASA
|
||||
/*
|
||||
/*
|
||||
Generates radar sprite coordinates on the fly.
|
||||
Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown.
|
||||
*/
|
||||
*/
|
||||
static void FetchRadarSpriteData();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Teleport();
|
||||
|
||||
public:
|
||||
static void Draw();
|
||||
static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0, 0, 0), int interior_id = 0);
|
||||
static void TeleportToLocation(std::string& rootkey, std::string& bLocName, std::string& loc);
|
||||
static void RemoveTeleportEntry(std::string& rootkey, std::string& key, std::string& val);
|
||||
static void TeleportToLocation(std::string &rootkey, std::string &bLocName, std::string &loc);
|
||||
static void RemoveTeleportEntry(std::string &rootkey, std::string &key, std::string &val);
|
||||
};
|
||||
|
134
src/timecycle.h
134
src/timecycle.h
@ -1,89 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
uchar* m_nAmbientRed = (uchar*)BY_GAME(0x560C61, 0x9388C8);
|
||||
uchar* m_nAmbientGreen = (uchar*)BY_GAME(0x55F4D6, 0x78D508);
|
||||
uchar* m_nAmbientBlue = (uchar*)BY_GAME(0x55F4E8, 0x813D48);
|
||||
uchar *m_nAmbientRed = (uchar *)BY_GAME(0x560C61, 0x9388C8);
|
||||
uchar *m_nAmbientGreen = (uchar *)BY_GAME(0x55F4D6, 0x78D508);
|
||||
uchar *m_nAmbientBlue = (uchar *)BY_GAME(0x55F4E8, 0x813D48);
|
||||
|
||||
uchar* m_nAmbientRed_Obj = (uchar*)BY_GAME(0x55F4FA, 0x7D53B0);
|
||||
uchar* m_nAmbientGreen_Obj = (uchar*)BY_GAME(0x55F50C, 0x7D9370);
|
||||
uchar* m_nAmbientBlue_Obj = (uchar*)BY_GAME(0x55F51E, 0x94C038);
|
||||
uchar *m_nAmbientRed_Obj = (uchar *)BY_GAME(0x55F4FA, 0x7D53B0);
|
||||
uchar *m_nAmbientGreen_Obj = (uchar *)BY_GAME(0x55F50C, 0x7D9370);
|
||||
uchar *m_nAmbientBlue_Obj = (uchar *)BY_GAME(0x55F51E, 0x94C038);
|
||||
|
||||
uchar* m_nSkyTopRed = (uchar*)BY_GAME(0x55F531, 0x94BE98);
|
||||
uchar* m_nSkyTopGreen = (uchar*)BY_GAME(0x55F53D, 0x933A58);
|
||||
uchar* m_nSkyTopBlue = (uchar*)BY_GAME(0x55F549, 0x94A170);
|
||||
uchar *m_nSkyTopRed = (uchar *)BY_GAME(0x55F531, 0x94BE98);
|
||||
uchar *m_nSkyTopGreen = (uchar *)BY_GAME(0x55F53D, 0x933A58);
|
||||
uchar *m_nSkyTopBlue = (uchar *)BY_GAME(0x55F549, 0x94A170);
|
||||
|
||||
uchar* m_nSkyBottomRed = (uchar*)BY_GAME(0x55F555, 0x7E44A0);
|
||||
uchar* m_nSkyBottomGreen = (uchar*)BY_GAME(0x55F561, 0x7E9CD0);
|
||||
uchar* m_nSkyBottomBlue = (uchar*)BY_GAME(0x55F56D, 0x92D420);
|
||||
uchar *m_nSkyBottomRed = (uchar *)BY_GAME(0x55F555, 0x7E44A0);
|
||||
uchar *m_nSkyBottomGreen = (uchar *)BY_GAME(0x55F561, 0x7E9CD0);
|
||||
uchar *m_nSkyBottomBlue = (uchar *)BY_GAME(0x55F56D, 0x92D420);
|
||||
|
||||
uchar* m_nSunCoreRed = (uchar*)BY_GAME(0x55F59D, 0x944098);
|
||||
uchar* m_nSunCoreGreen = (uchar*)BY_GAME(0x55F5A9, 0x7D94C0);
|
||||
uchar* m_nSunCoreBlue = (uchar*)BY_GAME(0x55F5B5, 0x8614F8);
|
||||
uchar *m_nSunCoreRed = (uchar *)BY_GAME(0x55F59D, 0x944098);
|
||||
uchar *m_nSunCoreGreen = (uchar *)BY_GAME(0x55F5A9, 0x7D94C0);
|
||||
uchar *m_nSunCoreBlue = (uchar *)BY_GAME(0x55F5B5, 0x8614F8);
|
||||
|
||||
uchar* m_nSunCoronaRed = (uchar*)BY_GAME(0x55F579, 0x78CCD8);
|
||||
uchar* m_nSunCoronaGreen = (uchar*)BY_GAME(0x55F585, 0x7DBC08);
|
||||
uchar* m_nSunCoronaBlue = (uchar*)BY_GAME(0x55F591, 0x7D1818);
|
||||
uchar *m_nSunCoronaRed = (uchar *)BY_GAME(0x55F579, 0x78CCD8);
|
||||
uchar *m_nSunCoronaGreen = (uchar *)BY_GAME(0x55F585, 0x7DBC08);
|
||||
uchar *m_nSunCoronaBlue = (uchar *)BY_GAME(0x55F591, 0x7D1818);
|
||||
|
||||
uchar* m_nLowCloudsRed = (uchar*)BY_GAME(0x55F653, 0x8100C0);
|
||||
uchar* m_nLowCloudsGreen = (uchar*)BY_GAME(0x55F65F, 0x94AEA0);
|
||||
uchar* m_nLowCloudsBlue = (uchar*)BY_GAME(0x55F66B, 0x94BDF0);
|
||||
uchar *m_nLowCloudsRed = (uchar *)BY_GAME(0x55F653, 0x8100C0);
|
||||
uchar *m_nLowCloudsGreen = (uchar *)BY_GAME(0x55F65F, 0x94AEA0);
|
||||
uchar *m_nLowCloudsBlue = (uchar *)BY_GAME(0x55F66B, 0x94BDF0);
|
||||
|
||||
uchar* m_fLightsOnGroundBrightness = (uchar*)BY_GAME(0x55F640, 0x92D378);
|
||||
uchar* m_nPoleShadowStrength = (uchar*)BY_GAME(0x55F60F, 0x812090);
|
||||
uchar* m_nLightShadowStrength = (uchar*)BY_GAME(0x55F603, 0x811828);
|
||||
uchar* m_nShadowStrength = (uchar*)BY_GAME(0x55F5F7, 0x92D260);
|
||||
uchar* m_fSpriteBrightness = (uchar*)BY_GAME(0x55F5E4, 0x7D5308);
|
||||
uchar* m_fSpriteSize = (uchar*)BY_GAME(0x55F5D2, 0x94B848);
|
||||
uchar* m_fSunSize = (uchar*)BY_GAME(0x55F5C0, 0x818720);
|
||||
short* m_fFogStart = (short*)BY_GAME(0x55F62E, 0x94D638);
|
||||
short* m_fFarClip = (short*)BY_GAME(0x55F61B, 0x94D4E8);
|
||||
uchar *m_fLightsOnGroundBrightness = (uchar *)BY_GAME(0x55F640, 0x92D378);
|
||||
uchar *m_nPoleShadowStrength = (uchar *)BY_GAME(0x55F60F, 0x812090);
|
||||
uchar *m_nLightShadowStrength = (uchar *)BY_GAME(0x55F603, 0x811828);
|
||||
uchar *m_nShadowStrength = (uchar *)BY_GAME(0x55F5F7, 0x92D260);
|
||||
uchar *m_fSpriteBrightness = (uchar *)BY_GAME(0x55F5E4, 0x7D5308);
|
||||
uchar *m_fSpriteSize = (uchar *)BY_GAME(0x55F5D2, 0x94B848);
|
||||
uchar *m_fSunSize = (uchar *)BY_GAME(0x55F5C0, 0x818720);
|
||||
short *m_fFogStart = (short *)BY_GAME(0x55F62E, 0x94D638);
|
||||
short *m_fFarClip = (short *)BY_GAME(0x55F61B, 0x94D4E8);
|
||||
|
||||
uchar* m_fWaterRed = (uchar*)BY_GAME(0x55F69C, 0x7E5560);
|
||||
uchar* m_fWaterGreen = (uchar*)BY_GAME(0x55F6B0, 0x7DE148);
|
||||
uchar* m_fWaterBlue = (uchar*)BY_GAME(0x55F6C3, 0x862248);
|
||||
uchar* m_fWaterAlpha = (uchar*)BY_GAME(0x55F6D6, 0x7DDAE0);
|
||||
uchar *m_fWaterRed = (uchar *)BY_GAME(0x55F69C, 0x7E5560);
|
||||
uchar *m_fWaterGreen = (uchar *)BY_GAME(0x55F6B0, 0x7DE148);
|
||||
uchar *m_fWaterBlue = (uchar *)BY_GAME(0x55F6C3, 0x862248);
|
||||
uchar *m_fWaterAlpha = (uchar *)BY_GAME(0x55F6D6, 0x7DDAE0);
|
||||
|
||||
#ifdef GTASA
|
||||
uchar* m_fPostFx2Alpha = (uchar*)0x55F77D;
|
||||
uchar* m_fPostFx2Blue = (uchar*)0x55F767;
|
||||
uchar* m_fPostFx2Green = (uchar*)0x55F751;
|
||||
uchar* m_fPostFx2Red = (uchar*)0x55F73B;
|
||||
uchar* m_fPostFx1Alpha = (uchar*)0x55F725;
|
||||
uchar* m_fPostFx1Blue = (uchar*)0x55F70F;
|
||||
uchar* m_fPostFx1Green = (uchar*)0x55F6FC;
|
||||
uchar* m_fPostFx1Red = (uchar*)0x55F6E9;
|
||||
uchar *m_fPostFx2Alpha = (uchar *)0x55F77D;
|
||||
uchar *m_fPostFx2Blue = (uchar *)0x55F767;
|
||||
uchar *m_fPostFx2Green = (uchar *)0x55F751;
|
||||
uchar *m_fPostFx2Red = (uchar *)0x55F73B;
|
||||
uchar *m_fPostFx1Alpha = (uchar *)0x55F725;
|
||||
uchar *m_fPostFx1Blue = (uchar *)0x55F70F;
|
||||
uchar *m_fPostFx1Green = (uchar *)0x55F6FC;
|
||||
uchar *m_fPostFx1Red = (uchar *)0x55F6E9;
|
||||
|
||||
uchar* m_nFluffyCloudsBottomRed = (uchar*)0x55F677;
|
||||
uchar* m_nFluffyCloudsBottomGreen = (uchar*)0x55F683;
|
||||
uchar* m_nFluffyCloudsBottomBlue = (uchar*)0x55F690;
|
||||
uchar *m_nFluffyCloudsBottomRed = (uchar *)0x55F677;
|
||||
uchar *m_nFluffyCloudsBottomGreen = (uchar *)0x55F683;
|
||||
uchar *m_nFluffyCloudsBottomBlue = (uchar *)0x55F690;
|
||||
|
||||
uchar* m_nDirectionalMult = (uchar*)0x55F7C7;
|
||||
uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8;
|
||||
uchar* m_nHighLightMinIntensity = (uchar*)0x55F7A9;
|
||||
uchar* m_fCloudAlpha = (uchar*)0x55F793;
|
||||
uchar *m_nDirectionalMult = (uchar *)0x55F7C7;
|
||||
uchar *m_nWaterFogAlpha = (uchar *)0x55F7B8;
|
||||
uchar *m_nHighLightMinIntensity = (uchar *)0x55F7A9;
|
||||
uchar *m_fCloudAlpha = (uchar *)0x55F793;
|
||||
|
||||
#elif GTAVC
|
||||
uchar* m_nAmbientBlRed = (uchar*)0x78D5B0;
|
||||
uchar* m_nAmbientBlGreen = (uchar*)0x861430;
|
||||
uchar* m_nAmbientBlBlue = (uchar*)0x811740;
|
||||
uchar *m_nAmbientBlRed = (uchar *)0x78D5B0;
|
||||
uchar *m_nAmbientBlGreen = (uchar *)0x861430;
|
||||
uchar *m_nAmbientBlBlue = (uchar *)0x811740;
|
||||
|
||||
uchar* m_nAmbientBlRed_Obj = (uchar*)0x7D9418;
|
||||
uchar* m_nAmbientBlGreen_Obj = (uchar*)0x818FC0;
|
||||
uchar* m_nAmbientBlBlue_Obj = (uchar*)0x813B68;
|
||||
uchar *m_nAmbientBlRed_Obj = (uchar *)0x7D9418;
|
||||
uchar *m_nAmbientBlGreen_Obj = (uchar *)0x818FC0;
|
||||
uchar *m_nAmbientBlBlue_Obj = (uchar *)0x813B68;
|
||||
|
||||
uchar* m_nDirRed = (uchar*)0x7E45E0;
|
||||
uchar* m_nDirGreen = (uchar*)0x7DDDF8;
|
||||
uchar* m_nDirBlue = (uchar*)0x92D1B8;
|
||||
uchar *m_nDirRed = (uchar *)0x7E45E0;
|
||||
uchar *m_nDirGreen = (uchar *)0x7DDDF8;
|
||||
uchar *m_nDirBlue = (uchar *)0x92D1B8;
|
||||
|
||||
uchar* m_nTopCloudsRed = (uchar*)0x7F3C80;
|
||||
uchar* m_nTopCloudsGreen = (uchar*)0x813F70;
|
||||
uchar* m_nTopCloudsBlue = (uchar*)0x938980;
|
||||
uchar *m_nTopCloudsRed = (uchar *)0x7F3C80;
|
||||
uchar *m_nTopCloudsGreen = (uchar *)0x813F70;
|
||||
uchar *m_nTopCloudsBlue = (uchar *)0x938980;
|
||||
|
||||
uchar* m_nBottomCloudsRed = (uchar*)0x7D3D98;
|
||||
uchar* m_nBottomCloudsGreen = (uchar*)0x7FFE38;
|
||||
uchar* m_nBottomCloudsBlue = (uchar*)0x7D9630;
|
||||
uchar *m_nBottomCloudsRed = (uchar *)0x7D3D98;
|
||||
uchar *m_nBottomCloudsGreen = (uchar *)0x7FFE38;
|
||||
uchar *m_nBottomCloudsBlue = (uchar *)0x7D9630;
|
||||
|
||||
uchar* m_nBlurRed = (uchar*)0x94B790;
|
||||
uchar* m_nBlurGreen = (uchar*)0x8621A0;
|
||||
uchar* m_nBlurBlue = (uchar*)0x945728;
|
||||
uchar *m_nBlurRed = (uchar *)0x94B790;
|
||||
uchar *m_nBlurGreen = (uchar *)0x8621A0;
|
||||
uchar *m_nBlurBlue = (uchar *)0x945728;
|
||||
#endif
|
||||
|
97
src/ui.cpp
97
src/ui.cpp
@ -1,8 +1,8 @@
|
||||
#include "ui.h"
|
||||
#include "pch.h"
|
||||
#include "util.h"
|
||||
#include "ui.h"
|
||||
|
||||
bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& selected)
|
||||
bool Ui::ListBox(const char *label, std::vector<std::string> &all_items, int &selected)
|
||||
{
|
||||
bool rtn = false;
|
||||
if (ImGui::BeginCombo(label, all_items[selected].c_str()))
|
||||
@ -23,7 +23,7 @@ bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& se
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected)
|
||||
bool Ui::ListBoxStr(const char *label, std::vector<std::string> &all_items, std::string &selected)
|
||||
{
|
||||
bool rtn = false;
|
||||
if (ImGui::BeginCombo(label, selected.c_str()))
|
||||
@ -42,7 +42,8 @@ bool Ui::ListBoxStr(const char* label, std::vector<std::string>& all_items, std:
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::ListBoxCustomNames(const char* label, std::vector<std::string>& all_items, std::string& selected, const char* customNames[], size_t length)
|
||||
bool Ui::ListBoxCustomNames(const char *label, std::vector<std::string> &all_items, std::string &selected,
|
||||
const char *customNames[], size_t length)
|
||||
{
|
||||
bool rtn = false;
|
||||
std::string display_selected = (selected == "All") ? selected : customNames[std::stoi(selected)];
|
||||
@ -88,7 +89,7 @@ ImVec2 Ui::GetSize(short count, bool spacing)
|
||||
return ImVec2(x, ImGui::GetFrameHeight() * 1.3f);
|
||||
}
|
||||
|
||||
void Ui::CenterdText(const std::string& text)
|
||||
void Ui::CenterdText(const std::string &text)
|
||||
{
|
||||
float font_size = ImGui::GetFontSize() * text.size() / 2;
|
||||
ImGui::NewLine();
|
||||
@ -96,17 +97,17 @@ void Ui::CenterdText(const std::string& text)
|
||||
ImGui::Text(text.c_str());
|
||||
}
|
||||
|
||||
void Ui::DrawHeaders(CallbackTable& data)
|
||||
void Ui::DrawHeaders(CallbackTable &data)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
|
||||
short i = 1;
|
||||
auto colors = ImGui::GetStyle().Colors;
|
||||
ImVec4 btn_col = colors[ImGuiCol_Button];
|
||||
static void* func;
|
||||
static void *func;
|
||||
for (auto it = data.begin(); it != data.end(); ++it)
|
||||
{
|
||||
const char* btn_text = it->first.c_str();
|
||||
const char *btn_text = it->first.c_str();
|
||||
|
||||
if (btn_text == m_HeaderId)
|
||||
{
|
||||
@ -114,7 +115,6 @@ void Ui::DrawHeaders(CallbackTable& data)
|
||||
func = it->second;
|
||||
}
|
||||
|
||||
|
||||
if (ImGui::Button(btn_text, GetSize(3, false)))
|
||||
{
|
||||
m_HeaderId = btn_text;
|
||||
@ -159,13 +159,13 @@ void Ui::DrawHeaders(CallbackTable& data)
|
||||
{
|
||||
if (func != nullptr && ImGui::BeginChild("TABSBAR"))
|
||||
{
|
||||
static_cast<void(*)()>(func)();
|
||||
static_cast<void (*)()>(func)();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::ShowTooltip(const char* text)
|
||||
void Ui::ShowTooltip(const char *text)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("?");
|
||||
@ -178,14 +178,14 @@ void Ui::ShowTooltip(const char* text)
|
||||
}
|
||||
}
|
||||
|
||||
bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_disabled)
|
||||
bool Ui::CheckboxWithHint(const char *label, bool *v, const char *hint, bool is_disabled)
|
||||
{
|
||||
// set things up
|
||||
bool pressed = false;
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
const ImGuiStyle &style = ImGui::GetStyle();
|
||||
const ImVec2 textSize = ImGui::CalcTextSize(label, nullptr, true);
|
||||
float square_sz = ImGui::GetFrameHeight();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImU32 color = ImGui::GetColorU32(ImGuiCol_FrameBg);
|
||||
std::string slabel = "##InvCheckboxBtn" + std::string(label);
|
||||
|
||||
@ -264,7 +264,7 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddress(const char* label, const int addr, const char* hint)
|
||||
bool Ui::CheckboxAddress(const char *label, const int addr, const char *hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = patch::Get<bool>(addr, false);
|
||||
@ -278,7 +278,7 @@ bool Ui::CheckboxAddress(const char* label, const int addr, const char* hint)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddressEx(const char* label, const int addr, int enabled_val, int disabled_val, const char* hint)
|
||||
bool Ui::CheckboxAddressEx(const char *label, const int addr, int enabled_val, int disabled_val, const char *hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
|
||||
@ -301,7 +301,7 @@ bool Ui::CheckboxAddressEx(const char* label, const int addr, int enabled_val, i
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddressVar(const char* label, bool val, int addr, const char* hint)
|
||||
bool Ui::CheckboxAddressVar(const char *label, bool val, int addr, const char *hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = val;
|
||||
@ -314,8 +314,8 @@ bool Ui::CheckboxAddressVar(const char* label, bool val, int addr, const char* h
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char* hint)
|
||||
bool Ui::CheckboxAddressVarEx(const char *label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char *hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = val;
|
||||
@ -332,7 +332,7 @@ bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint)
|
||||
bool Ui::CheckboxBitFlag(const char *label, uint flag, const char *hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = (flag == 1) ? true : false;
|
||||
@ -345,9 +345,8 @@ bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
void Ui::DrawJSON(ResourceStore& data,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_right_click)
|
||||
void Ui::DrawJSON(ResourceStore &data, std::function<void(std::string &, std::string &, std::string &)> func_left_click,
|
||||
std::function<void(std::string &, std::string &, std::string &)> func_right_click)
|
||||
{
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
ListBoxStr("##Categories", data.m_Categories, data.m_Selected);
|
||||
@ -356,7 +355,7 @@ void Ui::DrawJSON(ResourceStore& data,
|
||||
data.m_Filter.Draw("##Filter");
|
||||
if (strlen(data.m_Filter.InputBuf) == 0)
|
||||
{
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 min = ImGui::GetItemRectMin();
|
||||
min.x += ImGui::GetStyle().FramePadding.x;
|
||||
@ -374,7 +373,6 @@ void Ui::DrawJSON(ResourceStore& data,
|
||||
jsonPopup.function = nullptr;
|
||||
}
|
||||
|
||||
|
||||
ImGui::BeginChild(1);
|
||||
for (auto root : data.m_pJson->m_Data.items())
|
||||
{
|
||||
@ -415,7 +413,6 @@ void Ui::DrawJSON(ResourceStore& data,
|
||||
if (ImGui::MenuItem("Remove"))
|
||||
jsonPopup.function(jsonPopup.rootKey, jsonPopup.key, jsonPopup.value);
|
||||
|
||||
|
||||
if (ImGui::MenuItem("Close"))
|
||||
jsonPopup.function = nullptr;
|
||||
|
||||
@ -426,7 +423,7 @@ void Ui::DrawJSON(ResourceStore& data,
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
void Ui::EditStat(const char* label, const int stat_id, const int min, const int def, const int max)
|
||||
void Ui::EditStat(const char *label, const int stat_id, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -466,13 +463,13 @@ void Ui::EditStat(const char* label, const int stat_id, const int min, const int
|
||||
}
|
||||
#endif
|
||||
|
||||
void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint)
|
||||
void Ui::FilterWithHint(const char *label, ImGuiTextFilter &filter, const char *hint)
|
||||
{
|
||||
filter.Draw(label);
|
||||
|
||||
if (strlen(filter.InputBuf) == 0)
|
||||
{
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 min = ImGui::GetItemRectMin();
|
||||
min.x += ImGui::GetStyle().FramePadding.x;
|
||||
@ -482,9 +479,9 @@ void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char*
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLeftClick, std::function<void(std::string&)> onRightClick,
|
||||
std::function<std::string(std::string&)> getName, std::function<bool(std::string&)> verifyFunc,
|
||||
const char** customNames, size_t length)
|
||||
void Ui::DrawImages(ResourceStore &store, std::function<void(std::string &)> onLeftClick,
|
||||
std::function<void(std::string &)> onRightClick, std::function<std::string(std::string &)> getName,
|
||||
std::function<bool(std::string &)> verifyFunc, const char **customNames, size_t length)
|
||||
{
|
||||
/*
|
||||
Trying to scale images based on resolutions
|
||||
@ -496,7 +493,8 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
|
||||
|
||||
int imageCount = 1;
|
||||
int imagesInRow = static_cast<int>(ImGui::GetWindowContentRegionWidth() / m_ImageSize.x);
|
||||
m_ImageSize.x = ImGui::GetWindowContentRegionWidth() / imagesInRow - static_cast<int>(ImGuiStyleVar_ItemSpacing) * 0.65f;
|
||||
m_ImageSize.x =
|
||||
ImGui::GetWindowContentRegionWidth() / imagesInRow - static_cast<int>(ImGuiStyleVar_ItemSpacing) * 0.65f;
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
@ -527,10 +525,9 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
|
||||
std::string text = store.m_ImagesList[i]->m_FileName;
|
||||
std::string modelName = getName(text);
|
||||
|
||||
if (store.m_Filter.PassFilter(modelName.c_str())
|
||||
&& (store.m_ImagesList[i]->m_CategoryName == store.m_Selected || store.m_Selected == "All")
|
||||
&& (verifyFunc == nullptr || verifyFunc(text))
|
||||
)
|
||||
if (store.m_Filter.PassFilter(modelName.c_str()) &&
|
||||
(store.m_ImagesList[i]->m_CategoryName == store.m_Selected || store.m_Selected == "All") &&
|
||||
(verifyFunc == nullptr || verifyFunc(text)))
|
||||
{
|
||||
/*
|
||||
Couldn't figure out how to laod images for Dx11
|
||||
@ -545,7 +542,8 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui::ImageButton(store.m_ImagesList[i]->m_pTexture, m_ImageSize, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
|
||||
if (ImGui::ImageButton(store.m_ImagesList[i]->m_pTexture, m_ImageSize, ImVec2(0, 0), ImVec2(1, 1), 1,
|
||||
ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
|
||||
{
|
||||
onLeftClick(text);
|
||||
}
|
||||
@ -562,7 +560,7 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
// Drawing selected overlay
|
||||
ImVec2 btnMin = ImGui::GetItemRectMin();
|
||||
@ -626,7 +624,7 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem)
|
||||
void Ui::RadioButtonAddress(const char *label, std::vector<NamedMemory> &named_mem)
|
||||
{
|
||||
size_t btn_in_column = named_mem.size() / 2 - 1;
|
||||
|
||||
@ -665,7 +663,7 @@ void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_m
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val)
|
||||
void Ui::RadioButtonAddressEx(const char *label, int addr, std::vector<NamedValue> &named_val)
|
||||
{
|
||||
size_t btn_in_column = named_val.size() / 2;
|
||||
|
||||
@ -686,7 +684,7 @@ void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValu
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
void Ui::EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem)
|
||||
void Ui::EditRadioButtonAddress(const char *label, std::vector<NamedMemory> &named_mem)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -696,7 +694,7 @@ void Ui::EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& nam
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val)
|
||||
void Ui::EditRadioButtonAddressEx(const char *label, int addr, std::vector<NamedValue> &named_val)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -706,7 +704,7 @@ void Ui::EditRadioButtonAddressEx(const char* label, int addr, std::vector<Named
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_color)
|
||||
void Ui::ColorPickerAddress(const char *label, int base_addr, ImVec4 &&default_color)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -750,9 +748,9 @@ void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_c
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditBits(const char* label, const int address, const std::vector<std::string>& names)
|
||||
void Ui::EditBits(const char *label, const int address, const std::vector<std::string> &names)
|
||||
{
|
||||
auto mem_val = (int*)address;
|
||||
auto mem_val = (int *)address;
|
||||
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -776,7 +774,7 @@ void Ui::EditBits(const char* label, const int address, const std::vector<std::s
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditFloat(const char* label, const int address, const float min, const float def, const float max,
|
||||
void Ui::EditFloat(const char *label, const int address, const float min, const float def, const float max,
|
||||
const float mul, const float change)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
@ -824,7 +822,6 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
ImGui::Text("Set");
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), GetSize(items)))
|
||||
@ -848,7 +845,7 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
|
||||
}
|
||||
}
|
||||
|
||||
bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size)
|
||||
bool Ui::ColorButton(int color_id, std::vector<float> &color, ImVec2 size)
|
||||
{
|
||||
bool rtn = false;
|
||||
std::string label = "Color " + std::to_string(color_id);
|
||||
@ -858,7 +855,7 @@ bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size)
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
drawlist->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(),
|
||||
ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg));
|
||||
}
|
||||
|
82
src/ui.h
82
src/ui.h
@ -18,7 +18,7 @@ public:
|
||||
|
||||
struct JsonPopUpData
|
||||
{
|
||||
std::function<void(std::string&, std::string&, std::string&)> function;
|
||||
std::function<void(std::string &, std::string &, std::string &)> function;
|
||||
std::string key;
|
||||
std::string rootKey;
|
||||
std::string value;
|
||||
@ -26,68 +26,69 @@ public:
|
||||
|
||||
struct ImgPopUpData
|
||||
{
|
||||
std::function<void(std::string&)> function;
|
||||
std::function<void(std::string &)> function;
|
||||
std::string value;
|
||||
};
|
||||
static inline std::string m_HeaderId;
|
||||
static inline JsonPopUpData jsonPopup;
|
||||
static inline ImgPopUpData imgPopup;
|
||||
|
||||
|
||||
Ui() = delete;
|
||||
Ui(Ui&) = delete;
|
||||
Ui(Ui &) = delete;
|
||||
|
||||
static void CenterdText(const std::string& text);
|
||||
static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size);
|
||||
static bool CheckboxAddress(const char* label, int addr = NULL, const char* hint = nullptr);
|
||||
static bool CheckboxAddressEx(const char* label, int addr = NULL, int enabled_val = 1, int disabled_val = 0,
|
||||
const char* hint = nullptr);
|
||||
static bool CheckboxAddressVar(const char* label, bool val, int addr, const char* hint = nullptr);
|
||||
static bool CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char* hint = nullptr);
|
||||
static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr);
|
||||
static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false);
|
||||
static void DrawHeaders(CallbackTable& data);
|
||||
static void CenterdText(const std::string &text);
|
||||
static bool ColorButton(int color_id, std::vector<float> &color, ImVec2 size);
|
||||
static bool CheckboxAddress(const char *label, int addr = NULL, const char *hint = nullptr);
|
||||
static bool CheckboxAddressEx(const char *label, int addr = NULL, int enabled_val = 1, int disabled_val = 0,
|
||||
const char *hint = nullptr);
|
||||
static bool CheckboxAddressVar(const char *label, bool val, int addr, const char *hint = nullptr);
|
||||
static bool CheckboxAddressVarEx(const char *label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char *hint = nullptr);
|
||||
static bool CheckboxBitFlag(const char *label, uint flag, const char *hint = nullptr);
|
||||
static bool CheckboxWithHint(const char *label, bool *state, const char *hint = nullptr, bool is_disabled = false);
|
||||
static void DrawHeaders(CallbackTable &data);
|
||||
|
||||
static void DrawJSON(ResourceStore& data,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_right_click);
|
||||
static void DrawImages(ResourceStore &store, std::function<void(std::string&)> on_left_click,
|
||||
std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func,
|
||||
std::function<bool(std::string&)> verify_func = nullptr,
|
||||
const char** custom_names = nullptr, size_t length = 0);
|
||||
static void DrawJSON(ResourceStore &data,
|
||||
std::function<void(std::string &, std::string &, std::string &)> func_left_click,
|
||||
std::function<void(std::string &, std::string &, std::string &)> func_right_click);
|
||||
static void DrawImages(ResourceStore &store, std::function<void(std::string &)> on_left_click,
|
||||
std::function<void(std::string &)> on_right_click,
|
||||
std::function<std::string(std::string &)> get_name_func,
|
||||
std::function<bool(std::string &)> verify_func = nullptr,
|
||||
const char **custom_names = nullptr, size_t length = 0);
|
||||
|
||||
template <typename T>
|
||||
static void EditAddress(const char* label, int address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditBits(const char* label, int address, const std::vector<std::string>& names);
|
||||
static void EditFloat(const char* label, int address, float min, float def, float max, float mul = 1, float change = 1.0f);
|
||||
static void EditAddress(const char *label, int address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditBits(const char *label, int address, const std::vector<std::string> &names);
|
||||
static void EditFloat(const char *label, int address, float min, float def, float max, float mul = 1,
|
||||
float change = 1.0f);
|
||||
template <typename T>
|
||||
static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
|
||||
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
|
||||
static void EditReference(const char *label, T &address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditRadioButtonAddress(const char *label, std::vector<NamedMemory> &named_mem);
|
||||
static void EditRadioButtonAddressEx(const char *label, int addr, std::vector<NamedValue> &named_val);
|
||||
|
||||
#ifdef GTASA
|
||||
static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000);
|
||||
static void EditStat(const char *label, int stat_id, int min = 0, int def = 0, int max = 1000);
|
||||
#endif
|
||||
|
||||
static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint);
|
||||
static void FilterWithHint(const char *label, ImGuiTextFilter &filter, const char *hint);
|
||||
|
||||
static ImVec2 GetSize(short count = 1, bool spacing = true);
|
||||
|
||||
static bool ListBox(const char* label, std::vector<std::string>& all_items, int& selected);
|
||||
static bool ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected);
|
||||
static bool ListBoxCustomNames(const char* label, std::vector<std::string>& all_items, std::string& selected, const char* custom_names[] = nullptr, size_t length = 0);
|
||||
static bool ListBox(const char *label, std::vector<std::string> &all_items, int &selected);
|
||||
static bool ListBoxStr(const char *label, std::vector<std::string> &all_items, std::string &selected);
|
||||
static bool ListBoxCustomNames(const char *label, std::vector<std::string> &all_items, std::string &selected,
|
||||
const char *custom_names[] = nullptr, size_t length = 0);
|
||||
|
||||
static void RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
|
||||
static void RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
|
||||
static void RadioButtonAddress(const char *label, std::vector<NamedMemory> &named_mem);
|
||||
static void RadioButtonAddressEx(const char *label, int addr, std::vector<NamedValue> &named_val);
|
||||
|
||||
static void ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_color);
|
||||
static void ShowTooltip(const char* text);
|
||||
static void ColorPickerAddress(const char *label, int base_addr, ImVec4 &&default_color);
|
||||
static void ShowTooltip(const char *text);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void Ui::EditAddress(const char* label, const int address, const int min, const int def, const int max)
|
||||
void Ui::EditAddress(const char *label, const int address, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -145,8 +146,7 @@ void Ui::EditAddress(const char* label, const int address, const int min, const
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Ui::EditReference(const char* label, T& address, const int min, const int def, const int max)
|
||||
template <typename T> void Ui::EditReference(const char *label, T &address, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "pch.h"
|
||||
#include "updater.h"
|
||||
#include "ui.h"
|
||||
#include "menuinfo.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
void Updater::CheckForUpdate()
|
||||
{
|
||||
const char* link = "https://api.github.com/repos/user-grinch/Cheat-Menu/tags";
|
||||
char* path = PLUGIN_PATH((char*)"CheatMenu/json/versioninfo.json");
|
||||
const char *link = "https://api.github.com/repos/user-grinch/Cheat-Menu/tags";
|
||||
char *path = PLUGIN_PATH((char *)"CheatMenu/json/versioninfo.json");
|
||||
HRESULT res = URLDownloadToFile(NULL, link, path, 0, NULL);
|
||||
|
||||
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
|
||||
@ -63,8 +63,10 @@ void Updater::ShowUpdateScreen()
|
||||
|
||||
if (ImGui::Button("Download page", Ui::GetSize(3)))
|
||||
{
|
||||
ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" +
|
||||
Updater::m_LatestVersion).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(
|
||||
NULL, "open",
|
||||
std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" + Updater::m_LatestVersion).c_str(),
|
||||
NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
46
src/util.cpp
46
src/util.cpp
@ -1,8 +1,8 @@
|
||||
#include "pch.h"
|
||||
#include "util.h"
|
||||
#include "pch.h"
|
||||
#include "psapi.h"
|
||||
|
||||
std::string Util::GetLocationName(CVector* pos)
|
||||
std::string Util::GetLocationName(CVector *pos)
|
||||
{
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
|
||||
@ -39,7 +39,7 @@ std::string Util::GetLocationName(CVector* pos)
|
||||
#elif GTAVC
|
||||
if (pPlayer)
|
||||
{
|
||||
return std::to_string(pPlayer->m_nInterior) + ", Vice City" ;
|
||||
return std::to_string(pPlayer->m_nInterior) + ", Vice City";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -52,16 +52,16 @@ std::string Util::GetLocationName(CVector* pos)
|
||||
|
||||
#ifdef GTASA
|
||||
// Thanks DKPac22
|
||||
RwTexture* Util::LoadTextureFromMemory(char* data, unsigned int size)
|
||||
RwTexture *Util::LoadTextureFromMemory(char *data, unsigned int size)
|
||||
{
|
||||
patch::SetChar(0x7CF9CA, rwSTREAMMEMORY);
|
||||
RwMemory memoryImage;
|
||||
RwInt32 width, height, depth, flags;
|
||||
memoryImage.start = (RwUInt8*)data;
|
||||
memoryImage.start = (RwUInt8 *)data;
|
||||
memoryImage.length = size;
|
||||
RwImage* image = RtPNGImageRead((char*)&memoryImage);
|
||||
RwImage *image = RtPNGImageRead((char *)&memoryImage);
|
||||
RwImageFindRasterFormat(image, 4, &width, &height, &depth, &flags);
|
||||
RwRaster* raster = RwRasterCreate(width, height, depth, flags);
|
||||
RwRaster *raster = RwRasterCreate(width, height, depth, flags);
|
||||
RwRasterSetFromImage(raster, image);
|
||||
RwImageDestroy(image);
|
||||
patch::SetChar(0x7CF9CA, rwSTREAMFILENAME);
|
||||
@ -69,7 +69,7 @@ RwTexture* Util::LoadTextureFromMemory(char* data, unsigned int size)
|
||||
return RwTextureCreate(raster);
|
||||
}
|
||||
|
||||
void Util::ClearCharTasksVehCheck(CPed* ped)
|
||||
void Util::ClearCharTasksVehCheck(CPed *ped)
|
||||
{
|
||||
uint hped = CPools::GetPedRef(ped);
|
||||
uint hveh = NULL;
|
||||
@ -95,8 +95,8 @@ void Util::ClearCharTasksVehCheck(CPed* ped)
|
||||
|
||||
bool Util::IsOnMission()
|
||||
{
|
||||
return FindPlayerPed()->CanPlayerStartMission() && !*(patch::Get<char*>(0x5D5380, false) +
|
||||
CTheScripts::OnAMissionFlag);
|
||||
return FindPlayerPed()->CanPlayerStartMission() &&
|
||||
!*(patch::Get<char *>(0x5D5380, false) + CTheScripts::OnAMissionFlag);
|
||||
}
|
||||
|
||||
int Util::GetLargestGangInZone()
|
||||
@ -107,7 +107,7 @@ int Util::GetLargestGangInZone()
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
|
||||
CZoneInfo* zone_info = CTheZones::GetZoneInfo(&pos, nullptr);
|
||||
CZoneInfo *zone_info = CTheZones::GetZoneInfo(&pos, nullptr);
|
||||
int density = zone_info->m_nGangDensity[i];
|
||||
|
||||
if (density > max_density)
|
||||
@ -123,18 +123,18 @@ int Util::GetLargestGangInZone()
|
||||
|
||||
// implemention of opcode 0AB5 (STORE_CLOSEST_ENTITIES)
|
||||
// https://github.com/cleolibrary/CLEO4/blob/916d400f4a731ba1dd0ff16e52bdb056f42b7038/source/CCustomOpcodeSystem.cpp#L1671
|
||||
CVehicle* Util::GetClosestVehicle()
|
||||
CVehicle *Util::GetClosestVehicle()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
#ifdef GTASA
|
||||
CPedIntelligence* pedintel;
|
||||
CPedIntelligence *pedintel;
|
||||
if (player && (pedintel = player->m_pIntelligence))
|
||||
{
|
||||
CVehicle* veh = nullptr;
|
||||
CVehicle *veh = nullptr;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
veh = static_cast<CVehicle*>(pedintel->m_vehicleScanner.m_apEntities[i]);
|
||||
veh = static_cast<CVehicle *>(pedintel->m_vehicleScanner.m_apEntities[i]);
|
||||
if (veh && !veh->m_nVehicleFlags.bFadeOut)
|
||||
break;
|
||||
veh = nullptr;
|
||||
@ -165,18 +165,18 @@ CPlayerPed* player = FindPlayerPed();
|
||||
#endif
|
||||
}
|
||||
|
||||
CPed* Util::GetClosestPed()
|
||||
CPed *Util::GetClosestPed()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
#ifdef GTASA
|
||||
CPedIntelligence* pedintel;
|
||||
CPedIntelligence *pedintel;
|
||||
if (player && (pedintel = player->m_pIntelligence))
|
||||
{
|
||||
CPed* ped = nullptr;
|
||||
CPed *ped = nullptr;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
ped = static_cast<CPed*>(pedintel->m_pedScanner.m_apEntities[i]);
|
||||
ped = static_cast<CPed *>(pedintel->m_pedScanner.m_apEntities[i]);
|
||||
if (ped && ped != player && (ped->m_nCreatedBy & 0xFF) == 1 && !ped->m_nPedFlags.bFadeOut)
|
||||
break;
|
||||
ped = nullptr;
|
||||
@ -192,10 +192,10 @@ CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
bool Util::IsOnCutscene()
|
||||
{
|
||||
return BY_GAME(CCutsceneMgr::ms_running, *(bool*)0xA10AB2, *(bool*)0x95CCF5);
|
||||
return BY_GAME(CCutsceneMgr::ms_running, *(bool *)0xA10AB2, *(bool *)0x95CCF5);
|
||||
}
|
||||
|
||||
void Util::RainbowValues(int& r, int& g, int& b, float speed)
|
||||
void Util::RainbowValues(int &r, int &g, int &b, float speed)
|
||||
{
|
||||
int timer = CTimer::m_snTimeInMilliseconds / 150;
|
||||
r = sin(timer * speed) * 127 + 128;
|
||||
|
15
src/util.h
15
src/util.h
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "tchar.h"
|
||||
#include "pdh.h"
|
||||
#include "tchar.h"
|
||||
|
||||
static PDH_HQUERY cpuQuery;
|
||||
static PDH_HCOUNTER cpuTotal;
|
||||
@ -11,19 +11,18 @@ static HANDLE self;
|
||||
class Util
|
||||
{
|
||||
public:
|
||||
|
||||
#ifdef GTASA
|
||||
static void ClearCharTasksVehCheck(CPed* ped);
|
||||
static void ClearCharTasksVehCheck(CPed *ped);
|
||||
static int GetLargestGangInZone();
|
||||
static RwTexture* LoadTextureFromMemory(char* data, unsigned int size);
|
||||
static RwTexture *LoadTextureFromMemory(char *data, unsigned int size);
|
||||
#endif
|
||||
|
||||
static CPed* GetClosestPed();
|
||||
static CVehicle* GetClosestVehicle();
|
||||
static std::string GetLocationName(CVector* pos);
|
||||
static CPed *GetClosestPed();
|
||||
static CVehicle *GetClosestVehicle();
|
||||
static std::string GetLocationName(CVector *pos);
|
||||
static bool IsOnMission();
|
||||
static bool IsOnCutscene();
|
||||
static void RainbowValues(int& r, int& g, int& b, float speed);
|
||||
static void RainbowValues(int &r, int &g, int &b, float speed);
|
||||
static void GetCPUUsageInit();
|
||||
static double GetCurrentCPUUsage();
|
||||
};
|
||||
|
243
src/vehicle.cpp
243
src/vehicle.cpp
@ -1,11 +1,11 @@
|
||||
#include "pch.h"
|
||||
#include "vehicle.h"
|
||||
#include "filehandler.h"
|
||||
#include "menu.h"
|
||||
#include "pch.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "filehandler.h"
|
||||
#include <CPopulation.h>
|
||||
#include <CDamageManager.h>
|
||||
#include <CPopulation.h>
|
||||
|
||||
void Vehicle::FixVehicle(CVehicle *pVeh)
|
||||
{
|
||||
@ -14,14 +14,12 @@ void Vehicle::FixVehicle(CVehicle *pVeh)
|
||||
#else // GTA3 & GTAVC
|
||||
switch (pVeh->m_nVehicleClass)
|
||||
{
|
||||
case VEHICLE_AUTOMOBILE:
|
||||
{
|
||||
case VEHICLE_AUTOMOBILE: {
|
||||
reinterpret_cast<CAutomobile *>(pVeh)->Fix();
|
||||
break;
|
||||
}
|
||||
#ifdef GTAVC
|
||||
case VEHICLE_BIKE:
|
||||
{
|
||||
case VEHICLE_BIKE: {
|
||||
reinterpret_cast<CBike *>(pVeh)->Fix();
|
||||
break;
|
||||
}
|
||||
@ -38,11 +36,10 @@ Vehicle::Vehicle()
|
||||
#endif
|
||||
FileHandler::FetchColorData(m_CarcolsColorData);
|
||||
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
Events::processScriptsEvent += [this] {
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CVehicle* pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle());
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
CVehicle *pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle());
|
||||
|
||||
if (pPlayer && pVeh)
|
||||
{
|
||||
@ -67,7 +64,8 @@ Vehicle::Vehicle()
|
||||
|
||||
if (vehEngine.Pressed())
|
||||
{
|
||||
bool state = BY_GAME(!pVeh->m_nVehicleFlags.bEngineBroken, true, true) || pVeh->m_nVehicleFlags.bEngineOn;
|
||||
bool state =
|
||||
BY_GAME(!pVeh->m_nVehicleFlags.bEngineBroken, true, true) || pVeh->m_nVehicleFlags.bEngineOn;
|
||||
|
||||
if (state)
|
||||
{
|
||||
@ -124,8 +122,8 @@ Vehicle::Vehicle()
|
||||
#ifdef GTASA
|
||||
pPlayer->m_nPedFlags.CantBeKnockedOffBike = m_bDontFallBike ? 1 : 2;
|
||||
|
||||
if (m_UnlimitedNitro::m_bEnabled
|
||||
&& BY_GAME(pVeh->m_nVehicleSubClass, pVeh->m_nVehicleClass) == VEHICLE_AUTOMOBILE)
|
||||
if (m_UnlimitedNitro::m_bEnabled &&
|
||||
BY_GAME(pVeh->m_nVehicleSubClass, pVeh->m_nVehicleClass) == VEHICLE_AUTOMOBILE)
|
||||
{
|
||||
patch::Set<BYTE>(0x969165, 0, true); // All cars have nitro
|
||||
patch::Set<BYTE>(0x96918B, 0, true); // All taxis have nitro
|
||||
@ -163,7 +161,7 @@ Vehicle::Vehicle()
|
||||
// Traffic neons
|
||||
if (m_Neon::m_bApplyOnTraffic && timer - m_Neon::m_bTrafficTimer > 1000)
|
||||
{
|
||||
for (CVehicle* veh : CPools::ms_pVehiclePool)
|
||||
for (CVehicle *veh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
int chance = 0;
|
||||
|
||||
@ -194,11 +192,10 @@ Vehicle::Vehicle()
|
||||
{
|
||||
if (pVeh->m_nVehicleSubClass == VEHICLE_BIKE || pVeh->m_nVehicleSubClass == VEHICLE_BMX)
|
||||
{
|
||||
if (sqrt(pVeh->m_vecMoveSpeed.x * pVeh->m_vecMoveSpeed.x
|
||||
+ pVeh->m_vecMoveSpeed.y * pVeh->m_vecMoveSpeed.y
|
||||
+ pVeh->m_vecMoveSpeed.z * pVeh->m_vecMoveSpeed.z
|
||||
) > 0.0
|
||||
&& CTimer::ms_fTimeStep > 0.0)
|
||||
if (sqrt(pVeh->m_vecMoveSpeed.x * pVeh->m_vecMoveSpeed.x +
|
||||
pVeh->m_vecMoveSpeed.y * pVeh->m_vecMoveSpeed.y +
|
||||
pVeh->m_vecMoveSpeed.z * pVeh->m_vecMoveSpeed.z) > 0.0 &&
|
||||
CTimer::ms_fTimeStep > 0.0)
|
||||
{
|
||||
pVeh->FlyingControl(3, -9999.9902f, -9999.9902f, -9999.9902f, -9999.9902f);
|
||||
}
|
||||
@ -209,11 +206,11 @@ Vehicle::Vehicle()
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
||||
void Vehicle::AddComponent(const std::string &component, const bool display_message)
|
||||
{
|
||||
try
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
|
||||
@ -231,12 +228,11 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Vehicle::RemoveComponent(const std::string& component, const bool display_message)
|
||||
void Vehicle::RemoveComponent(const std::string &component, const bool display_message)
|
||||
{
|
||||
try
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
|
||||
@ -290,9 +286,9 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId)
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
pPlayer->m_bInVehicle = true;
|
||||
pPlayer->m_pVehicle = pVeh;
|
||||
pPlayer->RegisterReference((CEntity**)&pPlayer->m_pVehicle);
|
||||
pPlayer->RegisterReference((CEntity **)&pPlayer->m_pVehicle);
|
||||
pPlayer->m_pObjectiveVehicle = pVeh;
|
||||
pPlayer->RegisterReference((CEntity**)&pPlayer->m_pObjectiveVehicle);
|
||||
pPlayer->RegisterReference((CEntity **)&pPlayer->m_pObjectiveVehicle);
|
||||
pPlayer->m_dwAction = ePedAction::Driving;
|
||||
pPlayer->m_dwObjective = OBJECTIVE_NO_OBJ;
|
||||
patch::Set<BYTE>(0x7838CD, 1); // player got in car flag
|
||||
@ -303,7 +299,7 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId)
|
||||
pVeh->m_passengers[seatId]->Remove();
|
||||
}
|
||||
pVeh->m_passengers[seatId] = pPlayer;
|
||||
pVeh->RegisterReference((CEntity**)&pVeh->m_passengers[seatId]);
|
||||
pVeh->RegisterReference((CEntity **)&pVeh->m_passengers[seatId]);
|
||||
|
||||
// Set player position
|
||||
CWorld::Remove(pPlayer);
|
||||
@ -322,16 +318,16 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId)
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
#else // GTA3 & GTAVC
|
||||
void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::string& smodel)
|
||||
void Vehicle::SpawnVehicle(std::string &rootkey, std::string &vehName, std::string &smodel)
|
||||
#endif
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
int imodel = std::stoi(smodel);
|
||||
CVehicle* veh = nullptr;
|
||||
CVehicle *veh = nullptr;
|
||||
|
||||
int interior = BY_GAME(player->m_nAreaCode, player->m_nInterior, 0);
|
||||
|
||||
@ -341,7 +337,7 @@ void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::stri
|
||||
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||
if (bInVehicle && m_Spawner::m_bSpawnInside)
|
||||
{
|
||||
CVehicle* pveh = player->m_pVehicle;
|
||||
CVehicle *pveh = player->m_pVehicle;
|
||||
int hveh = CPools::GetVehicleRef(pveh);
|
||||
pos = pveh->GetPosition();
|
||||
|
||||
@ -395,14 +391,14 @@ void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::stri
|
||||
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
CTrain* train = nullptr;
|
||||
CTrain* carraige = nullptr;
|
||||
CTrain *train = nullptr;
|
||||
CTrain *carraige = nullptr;
|
||||
int track = Random(0, 1);
|
||||
int node = CTrain::FindClosestTrackNode(pos, &track);
|
||||
CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node,
|
||||
track, false);
|
||||
CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node, track,
|
||||
false);
|
||||
|
||||
veh = (CVehicle*)train;
|
||||
veh = (CVehicle *)train;
|
||||
hveh = CPools::GetVehicleRef(veh);
|
||||
if (veh->m_pDriver)
|
||||
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(veh->m_pDriver));
|
||||
@ -440,11 +436,11 @@ void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::stri
|
||||
#ifdef GTASA
|
||||
veh->SetHeading(player->GetHeading());
|
||||
#elif GTAVC
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
player->m_placement.GetOrientation(x, y, z);
|
||||
veh->m_placement.SetOrientation(x, y, z);
|
||||
#else // GTA3
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
player->GetOrientation(x, y, z);
|
||||
veh->SetOrientation(x, y, z);
|
||||
#endif
|
||||
@ -463,11 +459,11 @@ void Vehicle::SpawnVehicle(std::string& rootkey, std::string& vehName, std::stri
|
||||
#ifdef GTASA
|
||||
veh->SetHeading(player->GetHeading() + 55.0f);
|
||||
#elif GTAVC
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
player->m_placement.GetOrientation(x, y, z);
|
||||
veh->m_placement.SetOrientation(x, y, z);
|
||||
#else // GTA3
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
player->GetOrientation(x, y, z);
|
||||
veh->SetOrientation(x, y, z);
|
||||
#endif
|
||||
@ -491,14 +487,14 @@ std::string Vehicle::GetNameFromModel(int model)
|
||||
#ifdef GTA3
|
||||
return std::to_string(model);
|
||||
#else
|
||||
return (const char*)CModelInfo::GetModelInfo(model) + 0x32;
|
||||
return (const char *)CModelInfo::GetModelInfo(model) + 0x32;
|
||||
#endif
|
||||
}
|
||||
|
||||
int Vehicle::GetModelFromName(const char* name)
|
||||
int Vehicle::GetModelFromName(const char *name)
|
||||
{
|
||||
int model = 0;
|
||||
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo((char*)name, &model);
|
||||
CBaseModelInfo *pModelInfo = CModelInfo::GetModelInfo((char *)name, &model);
|
||||
|
||||
if (model > 0 && model < 1000000 && GetNameFromModel(model) != "")
|
||||
{
|
||||
@ -513,11 +509,11 @@ int Vehicle::GetModelFromName(const char* name)
|
||||
void Vehicle::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
CVehicle *pVeh = pPlayer->m_pVehicle;
|
||||
|
||||
if (ImGui::Button("Blow up cars", ImVec2(Ui::GetSize(BY_GAME(3,2,2)))))
|
||||
if (ImGui::Button("Blow up cars", ImVec2(Ui::GetSize(BY_GAME(3, 2, 2)))))
|
||||
{
|
||||
for (CVehicle *pVeh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
@ -527,7 +523,7 @@ void Vehicle::Draw()
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Fix vehicle", ImVec2(Ui::GetSize(BY_GAME(3,2,2)))))
|
||||
if (ImGui::Button("Fix vehicle", ImVec2(Ui::GetSize(BY_GAME(3, 2, 2)))))
|
||||
{
|
||||
if (pPlayer && pVeh)
|
||||
{
|
||||
@ -557,7 +553,7 @@ void Vehicle::Draw()
|
||||
|
||||
if (ImGui::BeginTabBar("Vehicle", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
CVehicle* pVeh = pPlayer->m_pVehicle;
|
||||
CVehicle *pVeh = pPlayer->m_pVehicle;
|
||||
bool is_driver = pVeh && (pPlayer->m_pVehicle->m_pDriver == pPlayer);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -575,14 +571,15 @@ void Vehicle::Draw()
|
||||
#ifdef GTA3
|
||||
Ui::CheckboxAddress("Cars fly", 0x95CD75);
|
||||
#else
|
||||
Ui::CheckboxAddress("Aggressive drivers", BY_GAME(0x96914F,0xA10B47, NULL));
|
||||
Ui::CheckboxAddress("All taxis have nitro", BY_GAME(0x96918B,0xA10B3A, NULL));
|
||||
Ui::CheckboxAddress("Aggressive drivers", BY_GAME(0x96914F, 0xA10B47, NULL));
|
||||
Ui::CheckboxAddress("All taxis have nitro", BY_GAME(0x96918B, 0xA10B3A, NULL));
|
||||
Ui::CheckboxWithHint("Bikes fly", &m_bBikeFly);
|
||||
Ui::CheckboxAddress("Boats fly", BY_GAME(0x969153, 0xA10B11, NULL));
|
||||
Ui::CheckboxAddress("Cars fly", BY_GAME(0x969160, 0xA10B28, NULL));
|
||||
Ui::CheckboxWithHint("Cars heavy", &m_bVehHeavy);
|
||||
#endif
|
||||
if (Ui::CheckboxWithHint("Damage proof", &m_bNoDamage,
|
||||
if (Ui::CheckboxWithHint(
|
||||
"Damage proof", &m_bNoDamage,
|
||||
"Every vehicle entered will be damage proof\nBullet, Collision, Explosion, Fire, Meele etc"))
|
||||
{
|
||||
if (pVeh && !m_bNoDamage)
|
||||
@ -640,20 +637,21 @@ void Vehicle::Draw()
|
||||
Ui::CheckboxWithHint("Don't fall off bike", &m_bDontFallBike);
|
||||
#endif
|
||||
#ifndef GTA3
|
||||
Ui::CheckboxAddress("Drive on water", BY_GAME(0x969152,0xA10B81));
|
||||
Ui::CheckboxAddress("Drive on water", BY_GAME(0x969152, 0xA10B81));
|
||||
#endif
|
||||
#ifdef GTASA
|
||||
Ui::CheckboxAddressEx("Lock train camera", 0x52A52F, 171, 6);
|
||||
Ui::CheckboxAddress("Float away when hit", 0x969166);
|
||||
#endif
|
||||
#ifndef GTA3
|
||||
Ui::CheckboxAddress("Green traffic lights", BY_GAME(0x96914E,0xA10ADC));
|
||||
Ui::CheckboxAddress("Green traffic lights", BY_GAME(0x96914E, 0xA10ADC));
|
||||
#endif
|
||||
#ifdef GTASA
|
||||
Ui::CheckboxAddress("Perfect handling", 0x96914C);
|
||||
Ui::CheckboxAddress("Tank mode", 0x969164);
|
||||
|
||||
Ui::CheckboxWithHint("Unlimited nitro", &m_UnlimitedNitro::m_bEnabled, "Nitro will activate when left clicked\n\
|
||||
Ui::CheckboxWithHint("Unlimited nitro", &m_UnlimitedNitro::m_bEnabled,
|
||||
"Nitro will activate when left clicked\n\
|
||||
\nEnabling this would disable\nAll cars have nitro\nAll taxis have nitro");
|
||||
#elif GTA3
|
||||
Ui::CheckboxAddress("Perfect handling", 0x95CD66);
|
||||
@ -681,16 +679,20 @@ void Vehicle::Draw()
|
||||
pVeh->m_nVehicleFlags.bAlwaysSkidMarks = state;
|
||||
#endif
|
||||
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nEntityFlags.bBulletProof);
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof,
|
||||
pVeh->m_nEntityFlags.bBulletProof);
|
||||
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, m_bNoDamage))
|
||||
{
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nEntityFlags.bBulletProof) = state;
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof,
|
||||
pVeh->m_nEntityFlags.bBulletProof) = state;
|
||||
}
|
||||
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nEntityFlags.bCollisionProof);
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof,
|
||||
pVeh->m_nEntityFlags.bCollisionProof);
|
||||
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, m_bNoDamage))
|
||||
{
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nEntityFlags.bCollisionProof) = state;
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof,
|
||||
pVeh->m_nEntityFlags.bCollisionProof) = state;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
@ -716,16 +718,20 @@ void Vehicle::Draw()
|
||||
pVeh->m_nVehicleFlags.bEngineOn = state;
|
||||
}
|
||||
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nEntityFlags.bExplosionProof);
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof,
|
||||
pVeh->m_nEntityFlags.bExplosionProof);
|
||||
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, m_bNoDamage))
|
||||
{
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nEntityFlags.bExplosionProof) = state;
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof,
|
||||
pVeh->m_nEntityFlags.bExplosionProof) = state;
|
||||
}
|
||||
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nEntityFlags.bFireProof);
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof,
|
||||
pVeh->m_nEntityFlags.bFireProof);
|
||||
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, m_bNoDamage))
|
||||
{
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nEntityFlags.bFireProof) = state;
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof,
|
||||
pVeh->m_nEntityFlags.bFireProof) = state;
|
||||
}
|
||||
|
||||
ImGui::NextColumn();
|
||||
@ -744,18 +750,22 @@ void Vehicle::Draw()
|
||||
BY_GAME(pVeh->m_bIsVisible, pVeh->m_nFlags.bIsVisible, pVeh->m_nEntityFlags.bIsVisible) = !state;
|
||||
}
|
||||
|
||||
state = BY_GAME(!pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn, pVeh->m_nVehicleFlags.bLightsOn);
|
||||
state = BY_GAME(!pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn,
|
||||
pVeh->m_nVehicleFlags.bLightsOn);
|
||||
if (Ui::CheckboxWithHint("Lights on", &state, nullptr, !is_driver))
|
||||
{
|
||||
BY_GAME(pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn, pVeh->m_nVehicleFlags.bLightsOn) = state;
|
||||
BY_GAME(pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn,
|
||||
pVeh->m_nVehicleFlags.bLightsOn) = state;
|
||||
}
|
||||
|
||||
state = BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) == CARLOCK_LOCKED_PLAYER_INSIDE;
|
||||
state =
|
||||
BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) == CARLOCK_LOCKED_PLAYER_INSIDE;
|
||||
if (Ui::CheckboxWithHint("Lock doors", &state, nullptr, !is_driver))
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) = CARLOCK_LOCKED_PLAYER_INSIDE;
|
||||
BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) =
|
||||
CARLOCK_LOCKED_PLAYER_INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -763,10 +773,12 @@ void Vehicle::Draw()
|
||||
}
|
||||
}
|
||||
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nEntityFlags.bMeleeProof);
|
||||
state = BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof,
|
||||
pVeh->m_nEntityFlags.bMeleeProof);
|
||||
if (Ui::CheckboxWithHint("Melee proof", &state, nullptr, m_bNoDamage))
|
||||
{
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nEntityFlags.bMeleeProof) = state;
|
||||
BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof,
|
||||
pVeh->m_nEntityFlags.bMeleeProof) = state;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
@ -804,7 +816,7 @@ void Vehicle::Draw()
|
||||
if (ImGui::CollapsingHeader("Enter nearest vehicle as"))
|
||||
{
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
CVehicle* pClosestVeh = Util::GetClosestVehicle();
|
||||
CVehicle *pClosestVeh = Util::GetClosestVehicle();
|
||||
|
||||
if (pClosestVeh)
|
||||
{
|
||||
@ -861,11 +873,11 @@ void Vehicle::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove vehicles", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CVehicle* pVeh : CPools::ms_pVehiclePool)
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
for (CVehicle *pVeh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
if (DistanceBetweenPoints(pVeh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius
|
||||
&& player->m_pVehicle != pVeh)
|
||||
if (DistanceBetweenPoints(pVeh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius &&
|
||||
player->m_pVehicle != pVeh)
|
||||
{
|
||||
Command<Commands::DELETE_CAR>(CPools::GetVehicleRef(pVeh));
|
||||
}
|
||||
@ -879,17 +891,13 @@ void Vehicle::Draw()
|
||||
if (ImGui::CollapsingHeader("Traffic options"))
|
||||
{
|
||||
|
||||
static std::vector<Ui::NamedMemory> color
|
||||
{
|
||||
{"Black", BY_GAME(0x969151, 0xA10B82)},
|
||||
{"Pink", BY_GAME(0x969150, 0xA10B26)}
|
||||
};
|
||||
static std::vector<Ui::NamedMemory> color{{"Black", BY_GAME(0x969151, 0xA10B82)},
|
||||
{"Pink", BY_GAME(0x969150, 0xA10B26)}};
|
||||
Ui::RadioButtonAddress("Color", color);
|
||||
ImGui::Spacing();
|
||||
#ifdef GTASA
|
||||
static std::vector<Ui::NamedMemory> type{
|
||||
{"Cheap", 0x96915E}, {"Country", 0x96917B}, {"Fast", 0x96915F}
|
||||
};
|
||||
{"Cheap", 0x96915E}, {"Country", 0x96917B}, {"Fast", 0x96915F}};
|
||||
Ui::RadioButtonAddress("Type", type);
|
||||
#endif
|
||||
ImGui::Spacing();
|
||||
@ -898,7 +906,7 @@ void Vehicle::Draw()
|
||||
#endif
|
||||
if (pPlayer && pPlayer->m_pVehicle)
|
||||
{
|
||||
CVehicle* pVeh = pPlayer->m_pVehicle;
|
||||
CVehicle *pVeh = pPlayer->m_pVehicle;
|
||||
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||
|
||||
#ifdef GTASA
|
||||
@ -1010,17 +1018,13 @@ void Vehicle::Draw()
|
||||
Ui::CheckboxWithHint("Spawn aircraft in air", &m_Spawner::m_bSpawnInAir);
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
#ifdef GTASA
|
||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
||||
ImGui::InputTextWithHint("##LicenseText", "License plate text", m_Spawner::m_nLicenseText, 9);
|
||||
|
||||
Ui::DrawImages(m_Spawner::m_VehData, SpawnVehicle, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
return GetNameFromModel(std::stoi(str));
|
||||
});
|
||||
[](std::string str) { return GetNameFromModel(std::stoi(str)); });
|
||||
#else // GTA3 & GTAVC
|
||||
Ui::DrawJSON(m_Spawner::m_VehData, SpawnVehicle, nullptr);
|
||||
#endif
|
||||
@ -1029,7 +1033,7 @@ void Vehicle::Draw()
|
||||
|
||||
if (pPlayer->m_pVehicle && Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer))
|
||||
{
|
||||
CVehicle* veh = FindPlayerPed()->m_pVehicle;
|
||||
CVehicle *veh = FindPlayerPed()->m_pVehicle;
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
if (ImGui::BeginTabItem("Color"))
|
||||
{
|
||||
@ -1051,7 +1055,7 @@ void Vehicle::Draw()
|
||||
uchar r = m_Color::m_fColorPicker[0] * 255;
|
||||
uchar g = m_Color::m_fColorPicker[1] * 255;
|
||||
uchar b = m_Color::m_fColorPicker[2] * 255;
|
||||
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, { r, g, b, 255 }, m_Color::m_bMatFilter);
|
||||
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, {r, g, b, 255}, m_Color::m_bMatFilter);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1080,8 +1084,9 @@ void Vehicle::Draw()
|
||||
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btnsInRow = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btnsInRow -
|
||||
0.6 * btnsInRow)) / btnsInRow;
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() -
|
||||
int(ImGuiStyleVar_ItemSpacing) * (btnsInRow - 0.6 * btnsInRow)) /
|
||||
btnsInRow;
|
||||
|
||||
ImGui::BeginChild("Colorss");
|
||||
|
||||
@ -1089,7 +1094,8 @@ void Vehicle::Draw()
|
||||
{
|
||||
if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId], ImVec2(btnSize, btnSize)))
|
||||
{
|
||||
*(uint8_replacement*)(int(veh) + BY_GAME(0x433, 0x19F, 0x19B) + m_Color::m_nRadioButton) = colorId;
|
||||
*(uint8_replacement *)(int(veh) + BY_GAME(0x433, 0x19F, 0x19B) + m_Color::m_nRadioButton) =
|
||||
colorId;
|
||||
}
|
||||
|
||||
if ((colorId + 1) % btnsInRow != 0)
|
||||
@ -1122,7 +1128,8 @@ void Vehicle::Draw()
|
||||
|
||||
Ui::CheckboxWithHint("Rainbow neons", &m_Neon::m_bRainbowEffect, "Rainbow effect to neon lights");
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Traffic neons", &m_Neon::m_bApplyOnTraffic, "Adds neon lights to traffic vehicles.\n\
|
||||
Ui::CheckboxWithHint("Traffic neons", &m_Neon::m_bApplyOnTraffic,
|
||||
"Adds neon lights to traffic vehicles.\n\
|
||||
Only some vehicles will have them.");
|
||||
ImGui::Columns(1);
|
||||
|
||||
@ -1138,8 +1145,9 @@ void Vehicle::Draw()
|
||||
int count = (int)m_CarcolsColorData.size();
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btnsInRow = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btnsInRow -
|
||||
0.6 * btnsInRow)) / btnsInRow;
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() -
|
||||
int(ImGuiStyleVar_ItemSpacing) * (btnsInRow - 0.6 * btnsInRow)) /
|
||||
btnsInRow;
|
||||
|
||||
ImGui::BeginChild("Neonss");
|
||||
|
||||
@ -1147,7 +1155,7 @@ void Vehicle::Draw()
|
||||
{
|
||||
if (Ui::ColorButton(color_id, m_CarcolsColorData[color_id], ImVec2(btnSize, btnSize)))
|
||||
{
|
||||
std::vector<float>& color = m_CarcolsColorData[color_id];
|
||||
std::vector<float> &color = m_CarcolsColorData[color_id];
|
||||
InstallNeon(veh, color[0] * 255, color[1] * 255, color[2] * 255);
|
||||
}
|
||||
|
||||
@ -1197,17 +1205,13 @@ void Vehicle::Draw()
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Material filter", &m_Color::m_bMatFilter);
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(m_TextureData,
|
||||
[](std::string& str)
|
||||
{
|
||||
Ui::DrawImages(
|
||||
m_TextureData,
|
||||
[](std::string &str) {
|
||||
Paint::SetNodeTexture(FindPlayerPed()->m_pVehicle, Paint::veh_nodes::selected, str,
|
||||
m_Color::m_bMatFilter);
|
||||
},
|
||||
nullptr,
|
||||
[](std::string& str)
|
||||
{
|
||||
return str;
|
||||
});
|
||||
nullptr, [](std::string &str) { return str; });
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -1215,15 +1219,12 @@ void Vehicle::Draw()
|
||||
if (ImGui::BeginTabItem("Tune"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(m_TuneData,
|
||||
[](std::string& str) { AddComponent(str); },
|
||||
[](std::string& str) { RemoveComponent(str); },
|
||||
[](std::string& str) { return str; },
|
||||
[pPlayer](std::string& str)
|
||||
{
|
||||
return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), pPlayer->m_pVehicle);
|
||||
}
|
||||
);
|
||||
Ui::DrawImages(
|
||||
m_TuneData, [](std::string &str) { AddComponent(str); },
|
||||
[](std::string &str) { RemoveComponent(str); }, [](std::string &str) { return str; },
|
||||
[pPlayer](std::string &str) {
|
||||
return ((bool (*)(int, CVehicle *))0x49B010)(std::stoi(str), pPlayer->m_pVehicle);
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -1231,7 +1232,7 @@ void Vehicle::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
CBaseModelInfo* info = CModelInfo::GetModelInfo(pPlayer->m_pVehicle->m_nModelIndex);
|
||||
CBaseModelInfo *info = CModelInfo::GetModelInfo(pPlayer->m_pVehicle->m_nModelIndex);
|
||||
int pHandling = patch::Get<WORD>((int)info + 0x4A, false);
|
||||
pHandling *= 0xE0;
|
||||
pHandling += 0xC2B9DC;
|
||||
@ -1260,7 +1261,7 @@ void Vehicle::Draw()
|
||||
|
||||
ImGui::BeginChild("HandlingChild");
|
||||
|
||||
static std::vector<Ui::NamedValue> abs{ {"On", 1}, {"Off", 0} };
|
||||
static std::vector<Ui::NamedValue> abs{{"On", 1}, {"Off", 0}};
|
||||
Ui::EditRadioButtonAddressEx("Abs", pHandling + 0x9C, abs);
|
||||
|
||||
Ui::EditFloat("Anti dive multiplier", pHandling + 0xC4, 0.0f, 0.0f, 1.0f);
|
||||
@ -1274,17 +1275,16 @@ void Vehicle::Draw()
|
||||
Ui::EditFloat("Drag mult", pHandling + 0x10, 0.0f, 0.0f, 30.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> drive_type{
|
||||
{"Front wheel drive", 70}, {"Rear wheel drive", 82}, {"Four wheel drive", 52}
|
||||
};
|
||||
{"Front wheel drive", 70}, {"Rear wheel drive", 82}, {"Four wheel drive", 52}};
|
||||
Ui::EditRadioButtonAddressEx("Drive type", pHandling + 0x74, drive_type);
|
||||
|
||||
Ui::EditFloat("Engine acceleration", pHandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f);
|
||||
Ui::EditFloat("Engine inertia", pHandling + 0x80, 0.1f, 0.1f, 400.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> engine_type{ {"Petrol", 80}, {"Diseal", 68}, {"Electric", 69} };
|
||||
static std::vector<Ui::NamedValue> engine_type{{"Petrol", 80}, {"Diseal", 68}, {"Electric", 69}};
|
||||
Ui::EditRadioButtonAddressEx("Engine type", pHandling + 0x75, engine_type);
|
||||
|
||||
std::vector<Ui::NamedValue> front_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} };
|
||||
std::vector<Ui::NamedValue> front_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Front lights", pHandling + 0xDC, front_lights);
|
||||
|
||||
Ui::EditFloat("Force level", pHandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later
|
||||
@ -1295,7 +1295,8 @@ void Vehicle::Draw()
|
||||
Ui::EditFloat("Lower limit", pHandling + 0xBC, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Mass", pHandling + 0x4, 1.0f, 1.0f, 50000.0f);
|
||||
|
||||
///fcommon.UpdateAddress({ name = 'Max velocity',address = phandling + 0x84 ,size = 4,min = 0,max = 2,is_float = true,cvalue = 0.01 , save = false })
|
||||
/// fcommon.UpdateAddress({ name = 'Max velocity',address = phandling + 0x84 ,size = 4,min = 0,max =
|
||||
/// 2,is_float = true,cvalue = 0.01 , save = false })
|
||||
|
||||
Ui::EditBits("Model flags", pHandling + 0xCC, m_ModelFlagNames);
|
||||
|
||||
@ -1303,7 +1304,7 @@ void Vehicle::Draw()
|
||||
Ui::EditAddress<BYTE>("Number of gears", pHandling + 0x76, 1, 1, 10);
|
||||
Ui::EditAddress<BYTE>("Percent submerged", pHandling + 0x20, 10, 10, 120);
|
||||
|
||||
static std::vector<Ui::NamedValue> rear_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} };
|
||||
static std::vector<Ui::NamedValue> rear_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Rear lights", pHandling + 0xDD, rear_lights);
|
||||
|
||||
Ui::EditFloat("Seat offset distance", pHandling + 0xD4, 0.0f, 0.0f, 1.0f);
|
||||
|
@ -18,8 +18,8 @@ private:
|
||||
static inline bool m_bVehWatertight;
|
||||
static inline bool m_bNoDamage;
|
||||
static inline int m_nDoorMenuButton;
|
||||
static inline std::string m_DoorNames[6] =
|
||||
{ "Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door" };
|
||||
static inline std::string m_DoorNames[6] = {
|
||||
"Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door"};
|
||||
static inline int m_nVehRemoveRadius;
|
||||
static inline bool m_bLockSpeed;
|
||||
static inline float m_fLockSpeed;
|
||||
@ -28,7 +28,7 @@ private:
|
||||
{
|
||||
static inline bool m_bMatFilter = true;
|
||||
static inline int m_nRadioButton = 1;
|
||||
static inline float m_fColorPicker[3]{ 0, 0, 0 };
|
||||
static inline float m_fColorPicker[3]{0, 0, 0};
|
||||
};
|
||||
|
||||
#ifdef GTASA
|
||||
@ -36,19 +36,19 @@ private:
|
||||
static inline std::map<int, std::string> m_VehicleIDE;
|
||||
struct m_Neon
|
||||
{
|
||||
static inline float m_fColorPicker[3]{ 0, 0, 0 };
|
||||
static inline float m_fColorPicker[3]{0, 0, 0};
|
||||
static inline bool m_bRainbowEffect;
|
||||
static inline uint m_nRainbowTimer;
|
||||
static inline bool m_bApplyOnTraffic;
|
||||
static inline uint m_bTrafficTimer;
|
||||
};
|
||||
static inline ResourceStore m_TuneData { "components", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
||||
static inline ResourceStore m_TuneData{"components", eResourceType::TYPE_IMAGE, ImVec2(100, 80)};
|
||||
#endif
|
||||
|
||||
struct m_Spawner
|
||||
{
|
||||
#ifdef GTASA
|
||||
static inline ResourceStore m_VehData { "vehicles", eResourceType::TYPE_IMAGE, ImVec2(100, 75)};
|
||||
static inline ResourceStore m_VehData{"vehicles", eResourceType::TYPE_IMAGE, ImVec2(100, 75)};
|
||||
#else // GTA3 & GTAVC
|
||||
static inline ResourceStore m_VehData{"vehicle", eResourceType::TYPE_TEXT};
|
||||
#endif
|
||||
@ -64,46 +64,67 @@ private:
|
||||
|
||||
#ifdef GTASA
|
||||
static inline std::vector<std::string>(m_HandlingFlagNames) = // 32 flags
|
||||
{
|
||||
"1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS",
|
||||
"HB_REARWHEEL_STEER", "ALT_STEER_OPT",
|
||||
"WHEEL_F_NARROW2", "WHEEL_F_NARROW", "WHEEL_F_WIDE", "WHEEL_F_WIDE2", "WHEEL_R_NARROW2", "WHEEL_R_NARROW",
|
||||
"WHEEL_R_WIDE", "WHEEL_R_WIDE2",
|
||||
"HYDRAULIC_GEOM", "HYDRAULIC_INST", "HYDRAULIC_NONE", "NOS_INST", "OFFROAD_ABILITY", "OFFROAD_ABILITY2",
|
||||
"HALOGEN_LIGHTS", "PROC_REARWHEEL_1ST",
|
||||
"USE_MAXSP_LIMIT", "LOW_RIDER", "STREET_RACER", "SWINGING_CHASSIS", "Unused 1", "Unused 2", "Unused 3",
|
||||
"Unused 4"
|
||||
};
|
||||
{"1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL",
|
||||
"NO_HANDBRAKE", "STEER_REARWHEELS", "HB_REARWHEEL_STEER", "ALT_STEER_OPT",
|
||||
"WHEEL_F_NARROW2", "WHEEL_F_NARROW", "WHEEL_F_WIDE", "WHEEL_F_WIDE2",
|
||||
"WHEEL_R_NARROW2", "WHEEL_R_NARROW", "WHEEL_R_WIDE", "WHEEL_R_WIDE2",
|
||||
"HYDRAULIC_GEOM", "HYDRAULIC_INST", "HYDRAULIC_NONE", "NOS_INST",
|
||||
"OFFROAD_ABILITY", "OFFROAD_ABILITY2", "HALOGEN_LIGHTS", "PROC_REARWHEEL_1ST",
|
||||
"USE_MAXSP_LIMIT", "LOW_RIDER", "STREET_RACER", "SWINGING_CHASSIS",
|
||||
"Unused 1", "Unused 2", "Unused 3", "Unused 4"};
|
||||
|
||||
static inline std::vector<std::string>(m_ModelFlagNames) = // 32 flags
|
||||
{
|
||||
"IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT",
|
||||
"NO_DOORS", "TANDEM_SEATS",
|
||||
"SIT_IN_BOAT", "CONVERTIBLE", "NO_EXHAUST", "DOUBLE_EXHAUST", "NO1FPS_LOOK_BEHIND", "FORCE_DOOR_CHECK",
|
||||
"AXLE_F_NOTILT", "AXLE_F_SOLID", "AXLE_F_MCPHERSON",
|
||||
"AXLE_F_REVERSE", "AXLE_R_NOTILT", "AXLE_R_SOLID", "AXLE_R_MCPHERSON", "AXLE_R_REVERSE", "IS_BIKE", "IS_HELI",
|
||||
"IS_PLANE", "IS_BOAT", "BOUNCE_PANELS",
|
||||
"DOUBLE_RWHEELS", "FORCE_GROUND_CLEARANCE", "IS_HATCHBAC1K"
|
||||
};
|
||||
{"IS_VAN",
|
||||
"IS_BUS",
|
||||
"IS_LOW",
|
||||
"IS_BIG",
|
||||
"REVERSE_BONNET",
|
||||
"HANGING_BOOT",
|
||||
"TAILGATE_BOOT",
|
||||
"NOSWING_BOOT",
|
||||
"NO_DOORS",
|
||||
"TANDEM_SEATS",
|
||||
"SIT_IN_BOAT",
|
||||
"CONVERTIBLE",
|
||||
"NO_EXHAUST",
|
||||
"DOUBLE_EXHAUST",
|
||||
"NO1FPS_LOOK_BEHIND",
|
||||
"FORCE_DOOR_CHECK",
|
||||
"AXLE_F_NOTILT",
|
||||
"AXLE_F_SOLID",
|
||||
"AXLE_F_MCPHERSON",
|
||||
"AXLE_F_REVERSE",
|
||||
"AXLE_R_NOTILT",
|
||||
"AXLE_R_SOLID",
|
||||
"AXLE_R_MCPHERSON",
|
||||
"AXLE_R_REVERSE",
|
||||
"IS_BIKE",
|
||||
"IS_HELI",
|
||||
"IS_PLANE",
|
||||
"IS_BOAT",
|
||||
"BOUNCE_PANELS",
|
||||
"DOUBLE_RWHEELS",
|
||||
"FORCE_GROUND_CLEARANCE",
|
||||
"IS_HATCHBAC1K"};
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void FixVehicle(CVehicle *pVeh);
|
||||
#ifdef GTASA
|
||||
static void AddComponent(const std::string& component, bool display_message = true);
|
||||
static void RemoveComponent(const std::string& component, bool display_message = true);
|
||||
static void AddComponent(const std::string &component, bool display_message = true);
|
||||
static void RemoveComponent(const std::string &component, bool display_message = true);
|
||||
static int GetRandomTrainIdForModel(int model);
|
||||
static void GenerateHandlingDataFile(int phandling);
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef GTASA
|
||||
static void SpawnVehicle(std::string& name);
|
||||
static void SpawnVehicle(std::string &name);
|
||||
#else // GTA3 & GTAVC
|
||||
static void SpawnVehicle(std::string& rootkey, std::string& vehName, std::string& model);
|
||||
static void SpawnVehicle(std::string &rootkey, std::string &vehName, std::string &model);
|
||||
#endif
|
||||
static std::string GetNameFromModel(int model);
|
||||
static int GetModelFromName(const char* name);
|
||||
static int GetModelFromName(const char *name);
|
||||
static void Draw();
|
||||
Vehicle();
|
||||
};
|
||||
|
279
src/visual.cpp
279
src/visual.cpp
@ -1,9 +1,9 @@
|
||||
#include "pch.h"
|
||||
#include "visual.h"
|
||||
#include "game.h"
|
||||
#include "pch.h"
|
||||
#include "timecycle.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "game.h"
|
||||
#include "timecycle.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include "CHudColours.h"
|
||||
@ -18,8 +18,7 @@ Visual::Visual()
|
||||
}
|
||||
#endif
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
Events::processScriptsEvent += [] {
|
||||
// TODO: Needs improvement
|
||||
static short m_nBacWeatherType;
|
||||
if (m_bLockWeather)
|
||||
@ -34,13 +33,12 @@ Visual::Visual()
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int GetTCVal(T* addr, int index)
|
||||
template <typename T> int GetTCVal(T *addr, int index)
|
||||
{
|
||||
#ifdef GTASA
|
||||
T* arr = static_cast<T*>(patch::GetPointer(int(addr)));
|
||||
T *arr = static_cast<T *>(patch::GetPointer(int(addr)));
|
||||
#elif GTAVC
|
||||
T* arr = static_cast<T*>(addr);
|
||||
T *arr = static_cast<T *>(addr);
|
||||
#endif
|
||||
return static_cast<int>(arr[index]);
|
||||
}
|
||||
@ -62,7 +60,11 @@ void Visual::GenerateTimecycFile()
|
||||
for (uint i = 0; i < m_WeatherNames.size(); ++i)
|
||||
{
|
||||
buffer += "\n// " + m_WeatherNames[i] + "\n";
|
||||
buffer += "// Amb Amb Obj Dir Sky top Sky bot SunCore SunCorona SunSz SprSz SprBght Shdw LightShd PoleShd FarClp FogSt LightOnGround LowCloudsRGB BottomCloudRGB WaterRGBA ARGB1 ARGB2 CloudAlpha IntensityLimit WaterFogAlpha DirMult";
|
||||
buffer += "// Amb Amb Obj Dir Sky top Sky "
|
||||
"bot SunCore SunCorona SunSz SprSz SprBght Shdw "
|
||||
"LightShd PoleShd FarClp FogSt LightOnGround LowCloudsRGB BottomCloudRGB "
|
||||
"WaterRGBA ARGB1 ARGB2 CloudAlpha IntensityLimit "
|
||||
" WaterFogAlpha DirMult";
|
||||
|
||||
file << buffer << std::endl;
|
||||
for (int j = 0; j < m_nTimecycHour; ++j)
|
||||
@ -80,35 +82,47 @@ void Visual::GenerateTimecycFile()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j == 0) buffer = "// Midnight\n";
|
||||
if (j == 1) buffer = "// 5 AM\n";
|
||||
if (j == 2) buffer = "// 6 AM\n";
|
||||
if (j == 3) buffer = "// 7 AM\n";
|
||||
if (j == 4) buffer = "// Midday\n";
|
||||
if (j == 5) buffer = "// 7 PM\n";
|
||||
if (j == 6) buffer = "// 8 PM\n";
|
||||
if (j == 7) buffer = "// 10 PM\n";
|
||||
if (j == 0)
|
||||
buffer = "// Midnight\n";
|
||||
if (j == 1)
|
||||
buffer = "// 5 AM\n";
|
||||
if (j == 2)
|
||||
buffer = "// 6 AM\n";
|
||||
if (j == 3)
|
||||
buffer = "// 7 AM\n";
|
||||
if (j == 4)
|
||||
buffer = "// Midday\n";
|
||||
if (j == 5)
|
||||
buffer = "// 7 PM\n";
|
||||
if (j == 6)
|
||||
buffer = "// 8 PM\n";
|
||||
if (j == 7)
|
||||
buffer = "// 10 PM\n";
|
||||
}
|
||||
|
||||
int val = 23 * j + i;
|
||||
|
||||
buffer += std::format("{} {} {}\t{} {} {}\t255 255 255\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}",
|
||||
buffer += std::format(
|
||||
"{} {} {}\t{} {} {}\t255 255 255\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} "
|
||||
"{}\t{} {} {}\t{} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}",
|
||||
GetTCVal(m_nAmbientRed, val), GetTCVal(m_nAmbientGreen, val), GetTCVal(m_nAmbientBlue, val),
|
||||
GetTCVal(m_nAmbientRed_Obj, val), GetTCVal(m_nAmbientGreen_Obj, val), GetTCVal(m_nAmbientBlue_Obj, val),
|
||||
GetTCVal(m_nSkyTopRed, val), GetTCVal(m_nSkyTopGreen, val), GetTCVal(m_nSkyTopBlue, val),
|
||||
GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val),
|
||||
GetTCVal(m_nSunCoreRed, val), GetTCVal(m_nSunCoreGreen, val), GetTCVal(m_nSunCoreBlue, val),
|
||||
GetTCVal(m_nSunCoronaRed, val), GetTCVal(m_nSunCoronaGreen, val), GetTCVal(m_nSunCoronaBlue, val),
|
||||
GetTCVal(m_fSunSize, val) / 10.0f, GetTCVal(m_fSpriteSize, val) / 10.0f, GetTCVal(m_fSpriteBrightness, val) / 10.0f,
|
||||
GetTCVal(m_nShadowStrength, val), GetTCVal(m_nLightShadowStrength, val), GetTCVal(m_nPoleShadowStrength, val),
|
||||
GetTCVal(m_fFarClip, val), GetTCVal(m_fFogStart, val), GetTCVal(m_fLightsOnGroundBrightness, val)/ 10.0f,
|
||||
GetTCVal(m_fSunSize, val) / 10.0f, GetTCVal(m_fSpriteSize, val) / 10.0f,
|
||||
GetTCVal(m_fSpriteBrightness, val) / 10.0f, GetTCVal(m_nShadowStrength, val),
|
||||
GetTCVal(m_nLightShadowStrength, val), GetTCVal(m_nPoleShadowStrength, val), GetTCVal(m_fFarClip, val),
|
||||
GetTCVal(m_fFogStart, val), GetTCVal(m_fLightsOnGroundBrightness, val) / 10.0f,
|
||||
GetTCVal(m_nLowCloudsRed, val), GetTCVal(m_nLowCloudsGreen, val), GetTCVal(m_nLowCloudsBlue, val),
|
||||
GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val),
|
||||
GetTCVal(m_fWaterRed, val), GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val), GetTCVal(m_fWaterAlpha, val),
|
||||
GetTCVal(m_fPostFx1Red, val), GetTCVal(m_fPostFx1Green, val), GetTCVal(m_fPostFx1Blue, val), GetTCVal(m_fPostFx1Alpha, val),
|
||||
GetTCVal(m_fPostFx2Red, val), GetTCVal(m_fPostFx2Green, val), GetTCVal(m_fPostFx2Blue, val), GetTCVal(m_fPostFx2Alpha, val),
|
||||
GetTCVal(m_fCloudAlpha, val), GetTCVal(m_nHighLightMinIntensity, val), GetTCVal(m_nWaterFogAlpha, val), GetTCVal(m_nDirectionalMult, val) / 100.0
|
||||
);
|
||||
GetTCVal(m_fWaterRed, val), GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val),
|
||||
GetTCVal(m_fWaterAlpha, val), GetTCVal(m_fPostFx1Red, val), GetTCVal(m_fPostFx1Green, val),
|
||||
GetTCVal(m_fPostFx1Blue, val), GetTCVal(m_fPostFx1Alpha, val), GetTCVal(m_fPostFx2Red, val),
|
||||
GetTCVal(m_fPostFx2Green, val), GetTCVal(m_fPostFx2Blue, val), GetTCVal(m_fPostFx2Alpha, val),
|
||||
GetTCVal(m_fCloudAlpha, val), GetTCVal(m_nHighLightMinIntensity, val), GetTCVal(m_nWaterFogAlpha, val),
|
||||
GetTCVal(m_nDirectionalMult, val) / 100.0);
|
||||
file << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
@ -118,7 +132,7 @@ void Visual::GenerateTimecycFile()
|
||||
for (uint i = 0; i < 4; ++i)
|
||||
{
|
||||
std::string buffer;
|
||||
switch(i)
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
buffer = "\n// SUNNY\n";
|
||||
@ -133,7 +147,9 @@ void Visual::GenerateTimecycFile()
|
||||
buffer = "\n// FOGGY\n";
|
||||
}
|
||||
|
||||
buffer += "// Amb Amb_Obj Amb_bl Amb_Obj_bl Dir Sky top Sky bot SunCore SunCorona SunSz SprSz SprBght Shdw LightShd PoleShd FarClp FogSt LightOnGround LowCloudsRGB TopCloudRGB BottomCloudRGB BlurRGB WaterRGBA";
|
||||
buffer += "// Amb Amb_Obj Amb_bl Amb_Obj_bl Dir Sky top Sky bot SunCore "
|
||||
" SunCorona SunSz SprSz SprBght Shdw LightShd PoleShd FarClp FogSt LightOnGround "
|
||||
"LowCloudsRGB TopCloudRGB BottomCloudRGB BlurRGB WaterRGBA";
|
||||
|
||||
file << buffer << std::endl;
|
||||
|
||||
@ -151,25 +167,28 @@ void Visual::GenerateTimecycFile()
|
||||
|
||||
size_t val = 7 * i + j;
|
||||
|
||||
buffer += std::format("{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {} {}",
|
||||
buffer += std::format(
|
||||
"{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} "
|
||||
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {} {}",
|
||||
GetTCVal(m_nAmbientRed, val), GetTCVal(m_nAmbientGreen, val), GetTCVal(m_nAmbientBlue, val),
|
||||
GetTCVal(m_nAmbientRed_Obj, val), GetTCVal(m_nAmbientGreen_Obj, val), GetTCVal(m_nAmbientBlue_Obj, val),
|
||||
GetTCVal(m_nAmbientBlRed, val), GetTCVal(m_nAmbientBlGreen, val), GetTCVal(m_nAmbientBlBlue, val),
|
||||
GetTCVal(m_nAmbientBlRed_Obj, val), GetTCVal(m_nAmbientBlGreen_Obj, val), GetTCVal(m_nAmbientBlBlue_Obj, val),
|
||||
GetTCVal(m_nDirRed, val), GetTCVal(m_nDirGreen, val), GetTCVal(m_nDirBlue, val),
|
||||
GetTCVal(m_nSkyTopRed, val), GetTCVal(m_nSkyTopGreen, val), GetTCVal(m_nSkyTopBlue, val),
|
||||
GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val),
|
||||
GetTCVal(m_nSunCoreRed, val), GetTCVal(m_nSunCoreGreen, val), GetTCVal(m_nSunCoreBlue, val),
|
||||
GetTCVal(m_nSunCoronaRed, val), GetTCVal(m_nSunCoronaGreen, val), GetTCVal(m_nSunCoronaBlue, val),
|
||||
GetTCVal(m_fSunSize, val) / 10.0f, GetTCVal(m_fSpriteSize, val) / 10.0f, GetTCVal(m_fSpriteBrightness, val) / 10.0f,
|
||||
GetTCVal(m_nShadowStrength, val), GetTCVal(m_nLightShadowStrength, val), GetTCVal(m_nPoleShadowStrength, val),
|
||||
GetTCVal(m_fFarClip, val), GetTCVal(m_fFogStart, val), GetTCVal(m_fLightsOnGroundBrightness, val)/ 10.0f,
|
||||
GetTCVal(m_nLowCloudsRed, val), GetTCVal(m_nLowCloudsGreen, val), GetTCVal(m_nLowCloudsBlue, val),
|
||||
GetTCVal(m_nTopCloudsRed, val), GetTCVal(m_nTopCloudsGreen, val), GetTCVal(m_nTopCloudsBlue, val),
|
||||
GetTCVal(m_nBottomCloudsRed, val), GetTCVal(m_nBottomCloudsGreen, val), GetTCVal(m_nBottomCloudsBlue, val),
|
||||
GetTCVal(m_nBlurRed, val), GetTCVal(m_nBlurGreen, val), GetTCVal(m_nBlurBlue, val),
|
||||
GetTCVal(m_fWaterRed, val), GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val), GetTCVal(m_fWaterAlpha, val)
|
||||
);
|
||||
GetTCVal(m_nAmbientBlRed_Obj, val), GetTCVal(m_nAmbientBlGreen_Obj, val),
|
||||
GetTCVal(m_nAmbientBlBlue_Obj, val), GetTCVal(m_nDirRed, val), GetTCVal(m_nDirGreen, val),
|
||||
GetTCVal(m_nDirBlue, val), GetTCVal(m_nSkyTopRed, val), GetTCVal(m_nSkyTopGreen, val),
|
||||
GetTCVal(m_nSkyTopBlue, val), GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val),
|
||||
GetTCVal(m_nSkyBottomBlue, val), GetTCVal(m_nSunCoreRed, val), GetTCVal(m_nSunCoreGreen, val),
|
||||
GetTCVal(m_nSunCoreBlue, val), GetTCVal(m_nSunCoronaRed, val), GetTCVal(m_nSunCoronaGreen, val),
|
||||
GetTCVal(m_nSunCoronaBlue, val), GetTCVal(m_fSunSize, val) / 10.0f,
|
||||
GetTCVal(m_fSpriteSize, val) / 10.0f, GetTCVal(m_fSpriteBrightness, val) / 10.0f,
|
||||
GetTCVal(m_nShadowStrength, val), GetTCVal(m_nLightShadowStrength, val),
|
||||
GetTCVal(m_nPoleShadowStrength, val), GetTCVal(m_fFarClip, val), GetTCVal(m_fFogStart, val),
|
||||
GetTCVal(m_fLightsOnGroundBrightness, val) / 10.0f, GetTCVal(m_nLowCloudsRed, val),
|
||||
GetTCVal(m_nLowCloudsGreen, val), GetTCVal(m_nLowCloudsBlue, val), GetTCVal(m_nTopCloudsRed, val),
|
||||
GetTCVal(m_nTopCloudsGreen, val), GetTCVal(m_nTopCloudsBlue, val), GetTCVal(m_nBottomCloudsRed, val),
|
||||
GetTCVal(m_nBottomCloudsGreen, val), GetTCVal(m_nBottomCloudsBlue, val), GetTCVal(m_nBlurRed, val),
|
||||
GetTCVal(m_nBlurGreen, val), GetTCVal(m_nBlurBlue, val), GetTCVal(m_fWaterRed, val),
|
||||
GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val), GetTCVal(m_fWaterAlpha, val));
|
||||
file << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
@ -189,14 +208,22 @@ int Visual::CalcArrayIndex()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hour < 5) result = 0;
|
||||
if (hour == 5) result = 1;
|
||||
if (hour == 6) result = 2;
|
||||
if (7 <= hour && hour < 12) result = 3;
|
||||
if (12 <= hour && hour < 19) result = 4;
|
||||
if (hour == 19) result = 5;
|
||||
if (hour == 20 || hour == 21) result = 6;
|
||||
if (hour == 22 || hour == 23) result = 7;
|
||||
if (hour < 5)
|
||||
result = 0;
|
||||
if (hour == 5)
|
||||
result = 1;
|
||||
if (hour == 6)
|
||||
result = 2;
|
||||
if (7 <= hour && hour < 12)
|
||||
result = 3;
|
||||
if (12 <= hour && hour < 19)
|
||||
result = 4;
|
||||
if (hour == 19)
|
||||
result = 5;
|
||||
if (hour == 20 || hour == 21)
|
||||
result = 6;
|
||||
if (hour == 22 || hour == 23)
|
||||
result = 7;
|
||||
}
|
||||
|
||||
return 23 * result + CWeather::OldWeatherType;
|
||||
@ -205,22 +232,22 @@ int Visual::CalcArrayIndex()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Visual::TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags)
|
||||
bool Visual::TimeCycColorEdit3(const char *label, uchar *r, uchar *g, uchar *b, ImGuiColorEditFlags flags)
|
||||
{
|
||||
bool rtn = false;
|
||||
int val = CalcArrayIndex();
|
||||
|
||||
#ifdef GTASA
|
||||
auto red = static_cast<uchar*>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar*>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
|
||||
auto red = static_cast<uchar *>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar *>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar *>(patch::GetPointer(int(b)));
|
||||
#elif GTAVC
|
||||
auto red = static_cast<uchar*>(r);
|
||||
auto green = static_cast<uchar*>(g);
|
||||
auto blue = static_cast<uchar*>(b);
|
||||
auto red = static_cast<uchar *>(r);
|
||||
auto green = static_cast<uchar *>(g);
|
||||
auto blue = static_cast<uchar *>(b);
|
||||
#endif
|
||||
|
||||
float col[3]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f };
|
||||
float col[3]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f};
|
||||
|
||||
if (ImGui::ColorEdit3(label, col, flags))
|
||||
{
|
||||
@ -233,24 +260,24 @@ bool Visual::TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b,
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Visual::TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags)
|
||||
bool Visual::TimeCycColorEdit4(const char *label, uchar *r, uchar *g, uchar *b, uchar *a, ImGuiColorEditFlags flags)
|
||||
{
|
||||
bool rtn = false;
|
||||
int val = CalcArrayIndex();
|
||||
|
||||
#ifdef GTASA
|
||||
auto red = static_cast<uchar*>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar*>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
|
||||
auto alpha = static_cast<uchar*>(patch::GetPointer(int(a)));
|
||||
auto red = static_cast<uchar *>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar *>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar *>(patch::GetPointer(int(b)));
|
||||
auto alpha = static_cast<uchar *>(patch::GetPointer(int(a)));
|
||||
#elif GTAVC
|
||||
auto red = static_cast<uchar*>(r);
|
||||
auto green = static_cast<uchar*>(g);
|
||||
auto blue = static_cast<uchar*>(b);
|
||||
auto alpha = static_cast<uchar*>(a);
|
||||
auto red = static_cast<uchar *>(r);
|
||||
auto green = static_cast<uchar *>(g);
|
||||
auto blue = static_cast<uchar *>(b);
|
||||
auto alpha = static_cast<uchar *>(a);
|
||||
#endif
|
||||
|
||||
float col[4]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f };
|
||||
float col[4]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f};
|
||||
|
||||
if (ImGui::ColorEdit4(label, col, flags))
|
||||
{
|
||||
@ -287,7 +314,7 @@ void Visual::Draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin::patch::SetRaw(0x4A0D70, (char*)"\xE9\x94\x3F\xF6\xFF", 5);
|
||||
plugin::patch::SetRaw(0x4A0D70, (char *)"\xE9\x94\x3F\xF6\xFF", 5);
|
||||
}
|
||||
}
|
||||
Ui::CheckboxAddress("Gray radar", 0xA444A4);
|
||||
@ -320,8 +347,8 @@ void Visual::Draw()
|
||||
else
|
||||
{
|
||||
// restore call CWaterLevel::RenderWater()
|
||||
plugin::patch::SetRaw(0x53E004, (char*)"\xE8\x47\x16\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E142, (char*)"\xE8\x09\x15\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E004, (char *)"\xE8\x47\x16\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E142, (char *)"\xE8\x09\x15\x1B\x00", 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -335,16 +362,16 @@ void Visual::Draw()
|
||||
plugin::patch::Nop(0x53E142, 5);
|
||||
|
||||
// rtn CWaterLevel::GetWaterLevelNoWaves
|
||||
plugin::patch::SetRaw(0x6E8580, (char*)"\x32\xC0\xC3", 3);
|
||||
plugin::patch::SetRaw(0x6E8580, (char *)"\x32\xC0\xC3", 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore call CWaterLevel::RenderWater()
|
||||
plugin::patch::SetRaw(0x53E004, (char*)"\xE8\x47\x16\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E142, (char*)"\xE8\x09\x15\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E004, (char *)"\xE8\x47\x16\x1B\x00", 5);
|
||||
plugin::patch::SetRaw(0x53E142, (char *)"\xE8\x09\x15\x1B\x00", 5);
|
||||
|
||||
// restore CWaterLevel::GetWaterLevelNoWaves
|
||||
plugin::patch::SetRaw(0x6E8580, (char*)"\x51\xD9\x44", 3);
|
||||
plugin::patch::SetRaw(0x6E8580, (char *)"\x51\xD9\x44", 3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,25 +400,25 @@ void Visual::Draw()
|
||||
{
|
||||
#ifdef GTASA
|
||||
static bool init_patches = false;
|
||||
static float clock_posX = *(float*)*(int*)0x58EC16;
|
||||
static float clock_posY = *(float*)*(int*)0x58EC04;
|
||||
static float radar_posX = *(float*)*(int*)0x5834D4;
|
||||
static float radar_posY = *(float*)*(int*)0x583500;
|
||||
static float radar_width = *(float*)*(int*)0x5834C2;
|
||||
static float radar_height = *(float*)*(int*)0x5834F6;
|
||||
static float clock_posX = *(float *)*(int *)0x58EC16;
|
||||
static float clock_posY = *(float *)*(int *)0x58EC04;
|
||||
static float radar_posX = *(float *)*(int *)0x5834D4;
|
||||
static float radar_posY = *(float *)*(int *)0x583500;
|
||||
static float radar_width = *(float *)*(int *)0x5834C2;
|
||||
static float radar_height = *(float *)*(int *)0x5834F6;
|
||||
static CHudColour armour_bar = HudColour.m_aColours[4];
|
||||
static CHudColour clock_bar = HudColour.m_aColours[4];
|
||||
static CHudColour health_bar = HudColour.m_aColours[0];
|
||||
static CHudColour breath_bar = HudColour.m_aColours[3];
|
||||
static CHudColour wanted_bar = HudColour.m_aColours[6];
|
||||
static float money_posX = *(float*)*(int*)0x58F5FC;
|
||||
static float breath_posX = *(float*)*(int*)0x58F11F;
|
||||
static float breath_posY = *(float*)*(int*)0x58F100;
|
||||
static float weapon_icon_posX = *(float*)*(int*)0x58F927;
|
||||
static float weapon_icon_posY = *(float*)*(int*)0x58F913;
|
||||
static float weapon_ammo_posX = *(float*)*(int*)0x58FA02;
|
||||
static float weapon_ammo_posY = *(float*)*(int*)0x58F9E6;
|
||||
static float wanted_posX = *(float*)*(int*)0x58DD0F;
|
||||
static float money_posX = *(float *)*(int *)0x58F5FC;
|
||||
static float breath_posX = *(float *)*(int *)0x58F11F;
|
||||
static float breath_posY = *(float *)*(int *)0x58F100;
|
||||
static float weapon_icon_posX = *(float *)*(int *)0x58F927;
|
||||
static float weapon_icon_posY = *(float *)*(int *)0x58F913;
|
||||
static float weapon_ammo_posX = *(float *)*(int *)0x58FA02;
|
||||
static float weapon_ammo_posY = *(float *)*(int *)0x58F9E6;
|
||||
static float wanted_posX = *(float *)*(int *)0x58DD0F;
|
||||
|
||||
if (!init_patches)
|
||||
{
|
||||
@ -442,45 +469,44 @@ void Visual::Draw()
|
||||
if (ImGui::BeginChild("VisualsChild"))
|
||||
{
|
||||
#ifdef GTASA
|
||||
ImGui::TextWrapped(
|
||||
"These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc.");
|
||||
ImGui::TextWrapped("These options won't work if you got any mods that drastically changes the game "
|
||||
"hud. i.e. Mobile Hud, GTA 5 Hud etc.");
|
||||
ImGui::Spacing();
|
||||
Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(225, 225, 225, 255));
|
||||
Ui::ColorPickerAddress("Armourbar color", *(int *)0x5890FC, ImVec4(225, 225, 225, 255));
|
||||
Ui::EditAddress<float>("Armourbar posX", 0x866B78, -999, 94, 999);
|
||||
Ui::EditAddress<float>("Armourbar posY", 0x862D38, -999, 48, 999);
|
||||
Ui::ColorPickerAddress("Breathbar color", *(int*)0x5891EB, ImVec4(172, 203, 241, 255));
|
||||
Ui::EditAddress<float>("Breathbar posX", *(int*)0x58F11F, -999, 94, 999);
|
||||
Ui::EditAddress<float>("Breathbar posY", *(int*)0x58F100, -999, 62, 999);
|
||||
Ui::ColorPickerAddress("Clock color", *(int*)0x58EBD1, ImVec4(180, 25, 29, 255));
|
||||
Ui::EditAddress<float>("Clock posX", *(int*)0x58EC16, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Clock posY", *(int*)0x58EC04, -999, 22, 999);
|
||||
Ui::ColorPickerAddress("Healthbar color", *(int*)0x589331, ImVec4(180, 25, 29, 255));
|
||||
Ui::ColorPickerAddress("Breathbar color", *(int *)0x5891EB, ImVec4(172, 203, 241, 255));
|
||||
Ui::EditAddress<float>("Breathbar posX", *(int *)0x58F11F, -999, 94, 999);
|
||||
Ui::EditAddress<float>("Breathbar posY", *(int *)0x58F100, -999, 62, 999);
|
||||
Ui::ColorPickerAddress("Clock color", *(int *)0x58EBD1, ImVec4(180, 25, 29, 255));
|
||||
Ui::EditAddress<float>("Clock posX", *(int *)0x58EC16, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Clock posY", *(int *)0x58EC04, -999, 22, 999);
|
||||
Ui::ColorPickerAddress("Healthbar color", *(int *)0x589331, ImVec4(180, 25, 29, 255));
|
||||
Ui::EditAddress<float>("Healthbar posX", 0x86535C, -999, 141, 999);
|
||||
Ui::EditAddress<float>("Healthbar posY", 0x866CA8, -999, 77, 999);
|
||||
Ui::ColorPickerAddress("Draw menu title border color", 0xBAB240, ImVec4(0, 0, 0, 255));
|
||||
Ui::ColorPickerAddress("Money color", 0xBAB230, ImVec4(54, 104, 44, 255));
|
||||
Ui::EditAddress<float>("Money posX", *(int*)0x58F5FC, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Money posX", *(int *)0x58F5FC, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Money posY", 0x866C88, -999, 89, 999);
|
||||
static std::vector<Ui::NamedValue> font_outline{
|
||||
{"No outline", 0}, {"Thin outline", 1}, {"Default outline", 2}
|
||||
};
|
||||
{"No outline", 0}, {"Thin outline", 1}, {"Default outline", 2}};
|
||||
Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline);
|
||||
static std::vector<Ui::NamedValue> style{ {"Style 1", 1}, {"Style 2", 2}, {"Default style", 3} };
|
||||
static std::vector<Ui::NamedValue> style{{"Style 1", 1}, {"Style 2", 2}, {"Default style", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Money font style", 0x58F57F, style);
|
||||
Ui::EditAddress<float>("Radar Height", *(int*)0x5834F6, 0, 76, 999);
|
||||
Ui::EditAddress<float>("Radar Width", *(int*)0x5834C2, 0, 94, 999);
|
||||
Ui::EditAddress<float>("Radar posX", *(int*)0x5834D4, -999, 40, 999);
|
||||
Ui::EditAddress<float>("Radar posY", *(int*)0x583500, -999, 104, 999);
|
||||
Ui::EditAddress<float>("Radar Height", *(int *)0x5834F6, 0, 76, 999);
|
||||
Ui::EditAddress<float>("Radar Width", *(int *)0x5834C2, 0, 94, 999);
|
||||
Ui::EditAddress<float>("Radar posX", *(int *)0x5834D4, -999, 40, 999);
|
||||
Ui::EditAddress<float>("Radar posY", *(int *)0x583500, -999, 104, 999);
|
||||
Ui::EditAddress<int>("Radar zoom", 0xA444A3, 0, 0, 170);
|
||||
Ui::ColorPickerAddress("Radio station color", 0xBAB24C, ImVec4(150, 150, 150, 255));
|
||||
static std::vector<Ui::NamedValue> star_border{ {"No border", 0}, {"Default", 1}, {"Bold border", 2} };
|
||||
static std::vector<Ui::NamedValue> star_border{{"No border", 0}, {"Default", 1}, {"Bold border", 2}};
|
||||
Ui::EditRadioButtonAddressEx("Wanted star border", 0x58DD41, star_border);
|
||||
Ui::EditAddress<float>("Wanted posX", *(int*)0x58DD0F, -999, 29, 999);
|
||||
Ui::EditAddress<float>("Wanted posY", *(int*)0x58DDFC, -999, 114, 999);
|
||||
Ui::EditAddress<float>("Weapon ammo posX", *(int*)0x58FA02, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Weapon ammo posY", *(int*)0x58F9E6, -999, 43, 999);
|
||||
Ui::EditAddress<float>("Weapon icon posX", *(int*)0x58F927, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Weapon icon posY", *(int*)0x58F913, -999, 20, 999);
|
||||
Ui::EditAddress<float>("Wanted posX", *(int *)0x58DD0F, -999, 29, 999);
|
||||
Ui::EditAddress<float>("Wanted posY", *(int *)0x58DDFC, -999, 114, 999);
|
||||
Ui::EditAddress<float>("Weapon ammo posX", *(int *)0x58FA02, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Weapon ammo posY", *(int *)0x58F9E6, -999, 43, 999);
|
||||
Ui::EditAddress<float>("Weapon icon posX", *(int *)0x58F927, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Weapon icon posY", *(int *)0x58F913, -999, 20, 999);
|
||||
#elif GTAVC
|
||||
Ui::EditAddress<float>("Radar posX", 0x68FD2C, -999, 40, 999);
|
||||
Ui::EditAddress<float>("Radar posY", 0x68FD34, -999, 104, 999);
|
||||
@ -533,15 +559,19 @@ void Visual::Draw()
|
||||
|
||||
if (ImGui::InputInt("Hour", &hour) & !Game::m_bSyncTime)
|
||||
{
|
||||
if (hour < 0) hour = 23;
|
||||
if (hour > 23) hour = 0;
|
||||
if (hour < 0)
|
||||
hour = 23;
|
||||
if (hour > 23)
|
||||
hour = 0;
|
||||
CClock::ms_nGameClockHours = hour;
|
||||
}
|
||||
|
||||
if (ImGui::InputInt("Minute", &minute) & !Game::m_bSyncTime)
|
||||
{
|
||||
if (minute < 0) minute = 59;
|
||||
if (minute > 59) minute = 0;
|
||||
if (minute < 0)
|
||||
minute = 59;
|
||||
if (minute > 59)
|
||||
minute = 0;
|
||||
CClock::ms_nGameClockMinutes = minute;
|
||||
}
|
||||
|
||||
@ -555,11 +585,11 @@ void Visual::Draw()
|
||||
{
|
||||
if (Game::m_bFreezeTime)
|
||||
{
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010), (char*)"\xEB\xEF", 2);
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010), (char *)"\xEB\xEF", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010), (char*)BY_GAME("\x56\x8B","\x6A\x01"), 2);
|
||||
patch::SetRaw(BY_GAME(0x52CF10, 0x487010), (char *)BY_GAME("\x56\x8B", "\x6A\x01"), 2);
|
||||
}
|
||||
}
|
||||
ImGui::Spacing();
|
||||
@ -578,7 +608,8 @@ void Visual::Draw()
|
||||
m_nFluffyCloudsBottomBlue);
|
||||
#elif GTAVC
|
||||
TimeCycColorEdit3("Ambient bl", m_nAmbientBlRed, m_nAmbientBlGreen, m_nAmbientBlBlue);
|
||||
TimeCycColorEdit3("Ambient obj bl", m_nAmbientBlRed_Obj, m_nAmbientBlGreen_Obj, m_nAmbientBlBlue_Obj);
|
||||
TimeCycColorEdit3("Ambient obj bl", m_nAmbientBlRed_Obj, m_nAmbientBlGreen_Obj,
|
||||
m_nAmbientBlBlue_Obj);
|
||||
TimeCycColorEdit3("Blur", m_nBlurRed, m_nBlurGreen, m_nBlurBlue);
|
||||
TimeCycColorEdit3("Clouds bottom", m_nBottomCloudsRed, m_nBottomCloudsGreen, m_nBottomCloudsBlue);
|
||||
TimeCycColorEdit3("Clouds top", m_nTopCloudsRed, m_nTopCloudsGreen, m_nTopCloudsBlue);
|
||||
|
36
src/visual.h
36
src/visual.h
@ -14,35 +14,39 @@ private:
|
||||
|
||||
// Timecyc stuff
|
||||
static inline int m_nTimecycHour = 8;
|
||||
static inline std::vector<std::string> m_WeatherNames
|
||||
{
|
||||
"EXTRASUNNY LA", "SUNNY LA", "EXTRASUNNY SMOG LA", "SUNNY SMOG LA", "CLOUDY LA", "SUNNY SF", "EXTRASUNNY SF",
|
||||
"CLOUDY SF", "RAINY SF", "FOGGY SF",
|
||||
"SUNNY VEGAS", "EXTRASUNNY VEGAS", "CLOUDY VEGAS", "EXTRASUNNY COUNTRYSIDE", "SUNNY COUNTRYSIDE",
|
||||
"CLOUDY COUNTRYSIDE", "RAINY COUNTRYSIDE",
|
||||
"EXTRASUNNY DESERT", "SUNNY DESERT", "SANDSTORM DESERT", "UNDERWATER", "EXTRACOLOURS 1", "EXTRACOLOURS 2"
|
||||
};
|
||||
static inline std::vector<std::string> m_WeatherNames{"EXTRASUNNY LA", "SUNNY LA",
|
||||
"EXTRASUNNY SMOG LA", "SUNNY SMOG LA",
|
||||
"CLOUDY LA", "SUNNY SF",
|
||||
"EXTRASUNNY SF", "CLOUDY SF",
|
||||
"RAINY SF", "FOGGY SF",
|
||||
"SUNNY VEGAS", "EXTRASUNNY VEGAS",
|
||||
"CLOUDY VEGAS", "EXTRASUNNY COUNTRYSIDE",
|
||||
"SUNNY COUNTRYSIDE", "CLOUDY COUNTRYSIDE",
|
||||
"RAINY COUNTRYSIDE", "EXTRASUNNY DESERT",
|
||||
"SUNNY DESERT", "SANDSTORM DESERT",
|
||||
"UNDERWATER", "EXTRACOLOURS 1",
|
||||
"EXTRACOLOURS 2"};
|
||||
|
||||
static void GenerateTimecycFile();
|
||||
static int CalcArrayIndex();
|
||||
static bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags = 0);
|
||||
template <typename T>
|
||||
static void TimecycSlider(const char* label, T* data, int min, int max);
|
||||
static bool TimeCycColorEdit3(const char *label, uchar *r, uchar *g, uchar *b, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit4(const char *label, uchar *r, uchar *g, uchar *b, uchar *a,
|
||||
ImGuiColorEditFlags flags = 0);
|
||||
template <typename T> static void TimecycSlider(const char *label, T *data, int min, int max);
|
||||
|
||||
public:
|
||||
Visual();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void Visual::TimecycSlider(const char* label, T* ptr, int min, int max)
|
||||
template <typename T> void Visual::TimecycSlider(const char *label, T *ptr, int min, int max)
|
||||
{
|
||||
int val = CalcArrayIndex();
|
||||
#ifdef GTASA
|
||||
// Compatable with 24h TimeCyc
|
||||
T* arr = static_cast<T*>(patch::GetPointer(int(ptr)));
|
||||
T *arr = static_cast<T *>(patch::GetPointer(int(ptr)));
|
||||
#else // GTA3 & GTAVC
|
||||
T* arr = static_cast<T*>(ptr);
|
||||
T *arr = static_cast<T *>(ptr);
|
||||
#endif
|
||||
int a = arr[val];
|
||||
|
||||
|
@ -38,10 +38,7 @@
|
||||
#define VK_KEY_Y 0x59
|
||||
#define VK_KEY_Z 0x5A
|
||||
|
||||
|
||||
static std::string key_names[]
|
||||
{
|
||||
"LMB",
|
||||
static std::string key_names[]{"LMB",
|
||||
"RMB",
|
||||
"Cancel",
|
||||
"MMB",
|
||||
@ -206,5 +203,4 @@ static std::string key_names[]
|
||||
"LCtrl",
|
||||
"RCtrl",
|
||||
"LMenu",
|
||||
"RMenu"
|
||||
};
|
||||
"RMenu"};
|
||||
|
@ -1,15 +1,14 @@
|
||||
#include "pch.h"
|
||||
#include "weapon.h"
|
||||
#include "CWeaponInfo.h"
|
||||
#include "pch.h"
|
||||
#include "ped.h"
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "ped.h"
|
||||
#include "CWeaponInfo.h"
|
||||
|
||||
Weapon::Weapon()
|
||||
{
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
Events::processScriptsEvent += [] {
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
#ifdef GTASA
|
||||
if (m_bAutoAim)
|
||||
@ -28,7 +27,6 @@ Weapon::Weapon()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
uchar slot = BY_GAME(player->m_nActiveWeaponSlot, player->m_nActiveWeaponSlot, player->m_nCurrentWeapon);
|
||||
if (m_nCurrentWeaponSlot != slot)
|
||||
{
|
||||
@ -40,11 +38,11 @@ Weapon::Weapon()
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType));
|
||||
CWeaponInfo *pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType));
|
||||
#else // GTA3 & GTAVC
|
||||
CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType);
|
||||
CWeaponInfo *pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType);
|
||||
|
||||
if(m_bInfiniteAmmo)
|
||||
if (m_bInfiniteAmmo)
|
||||
{
|
||||
Command<Commands::SET_PLAYER_AMMO>(0, weaponType, 999999);
|
||||
}
|
||||
@ -68,14 +66,14 @@ Weapon::Weapon()
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
if (m_bRapidFire && weaponType != BY_GAME(WEAPON_MINIGUN, WEAPONTYPE_MINIGUN)) // mingun doesn't work with rapidfire
|
||||
if (m_bRapidFire &&
|
||||
weaponType != BY_GAME(WEAPON_MINIGUN, WEAPONTYPE_MINIGUN)) // mingun doesn't work with rapidfire
|
||||
{
|
||||
pWeaponInfo->m_nFlags.bContinuosFire = true;
|
||||
|
||||
}
|
||||
|
||||
if (m_bDualWeild && (weaponType == WEAPON_PISTOL || weaponType == WEAPON_MICRO_UZI || weaponType ==
|
||||
WEAPON_TEC9 || weaponType == WEAPON_SAWNOFF))
|
||||
if (m_bDualWeild && (weaponType == WEAPON_PISTOL || weaponType == WEAPON_MICRO_UZI ||
|
||||
weaponType == WEAPON_TEC9 || weaponType == WEAPON_SAWNOFF))
|
||||
{
|
||||
pWeaponInfo->m_nFlags.bTwinPistol = true;
|
||||
}
|
||||
@ -96,11 +94,11 @@ Weapon::Weapon()
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
void Weapon::SetGangWeapon(std::string& weapon_type)
|
||||
void Weapon::SetGangWeapon(std::string &weapon_type)
|
||||
{
|
||||
m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon] = std::stoi(weapon_type);
|
||||
CGangs::SetGangWeapons(m_nSelectedGang, m_nGangWeaponList[m_nSelectedGang][0], m_nGangWeaponList[m_nSelectedGang][1],
|
||||
m_nGangWeaponList[m_nSelectedGang][2]);
|
||||
CGangs::SetGangWeapons(m_nSelectedGang, m_nGangWeaponList[m_nSelectedGang][0],
|
||||
m_nGangWeaponList[m_nSelectedGang][1], m_nGangWeaponList[m_nSelectedGang][2]);
|
||||
}
|
||||
#else // GTA3 & GTAVC
|
||||
// Implementation of SA opcode 0x555
|
||||
@ -114,7 +112,7 @@ static void ClearPlayerWeapon(eWeaponType weaponType)
|
||||
int weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_WeaponSlot;
|
||||
#endif
|
||||
|
||||
if ( weaponSlot != -1 )
|
||||
if (weaponSlot != -1)
|
||||
{
|
||||
CWeapon *pWeapon = &pPlayer->m_aWeapons[weaponSlot];
|
||||
|
||||
@ -152,7 +150,8 @@ static eWeaponType GetWeaponTypeFromModel(int model)
|
||||
for (size_t i = 0; i < 37; i++)
|
||||
{
|
||||
|
||||
int temp = CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(i); // int __cdecl CPickups::ModelForWeapon(int a1)
|
||||
int temp =
|
||||
CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(i); // int __cdecl CPickups::ModelForWeapon(int a1)
|
||||
|
||||
if (temp == model)
|
||||
{
|
||||
@ -166,9 +165,9 @@ static eWeaponType GetWeaponTypeFromModel(int model)
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
||||
void Weapon::GiveWeaponToPlayer(std::string &weapon_type)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
if (weapon_type == "-1") // Jetpack
|
||||
@ -210,9 +209,9 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
||||
}
|
||||
}
|
||||
#else // GTA3 & GTAVC
|
||||
void Weapon::GiveWeaponToPlayer(std::string& rootkey, std::string& name, std::string& model)
|
||||
void Weapon::GiveWeaponToPlayer(std::string &rootkey, std::string &name, std::string &model)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
int iModel = std::stoi(model);
|
||||
CStreaming::RequestModel(iModel, PRIORITY_REQUEST);
|
||||
@ -229,7 +228,7 @@ void Weapon::GiveWeaponToPlayer(std::string& rootkey, std::string& name, std::st
|
||||
|
||||
void Weapon::Draw()
|
||||
{
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
uint hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -250,7 +249,8 @@ void Weapon::Draw()
|
||||
#ifdef GTASA
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(weaponType, &model);
|
||||
#else // GTA3 & GTAVC
|
||||
model = CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(weaponType); // int __cdecl CPickups::ModelForWeapon(int a1)
|
||||
model = CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(
|
||||
weaponType); // int __cdecl CPickups::ModelForWeapon(int a1)
|
||||
#endif
|
||||
Command<Commands::CREATE_PICKUP_WITH_AMMO>(model, 3, 999, x, y, z, &pickup);
|
||||
|
||||
@ -292,7 +292,9 @@ void Weapon::Draw()
|
||||
Ui::ShowTooltip("Weapon tweaks apply globally\nto every ped weapon type");
|
||||
ImGui::Columns(2, 0, false);
|
||||
#ifdef GTASA
|
||||
Ui::CheckboxWithHint("Fast aim", &m_bAutoAim, "Enables aim assist on keyboard\n\nQ = left E = right\n\nPress Q and E to switch targets.\nMoving mouse removes the target!");
|
||||
Ui::CheckboxWithHint("Fast aim", &m_bAutoAim,
|
||||
"Enables aim assist on keyboard\n\nQ = left E = right\n\nPress Q and E to switch "
|
||||
"targets.\nMoving mouse removes the target!");
|
||||
if (Ui::CheckboxWithHint("Dual wield", &m_bDualWeild,
|
||||
"Dual wield pistol, shawoff, uzi, tec9\n(Other weapons don't work)"))
|
||||
{
|
||||
@ -302,7 +304,8 @@ void Weapon::Draw()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (Ui::CheckboxWithHint("Huge damage", &m_bHugeDamage, "Also enable 'Long range' if weapon range is short"))
|
||||
if (Ui::CheckboxWithHint("Huge damage", &m_bHugeDamage,
|
||||
"Also enable 'Long range' if weapon range is short"))
|
||||
{
|
||||
if (!m_bHugeDamage)
|
||||
{
|
||||
@ -364,10 +367,12 @@ void Weapon::Draw()
|
||||
m_nAmmoCount = (m_nAmmoCount > 99999) ? 99999 : m_nAmmoCount;
|
||||
}
|
||||
#ifdef GTASA
|
||||
Ui::DrawImages(m_WeaponData, GiveWeaponToPlayer, nullptr,
|
||||
Ui::DrawImages(
|
||||
m_WeaponData, GiveWeaponToPlayer, nullptr,
|
||||
[](std::string str) { return m_WeaponData.m_pJson->m_Data[str].get<std::string>(); },
|
||||
[](std::string str) { return str != "0"; /*Unarmed*/ }
|
||||
);
|
||||
[](std::string str) {
|
||||
return str != "0"; /*Unarmed*/
|
||||
});
|
||||
#else // GTA3 & GTAVC
|
||||
Ui::DrawJSON(m_WeaponData, GiveWeaponToPlayer, nullptr);
|
||||
#endif
|
||||
@ -388,14 +393,18 @@ void Weapon::Draw()
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Current weapon: %s",
|
||||
m_WeaponData.m_pJson->m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])].get<
|
||||
std::string>().c_str());
|
||||
ImGui::Text(
|
||||
"Current weapon: %s",
|
||||
m_WeaponData.m_pJson->m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])]
|
||||
.get<std::string>()
|
||||
.c_str());
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(m_WeaponData, SetGangWeapon, nullptr,
|
||||
Ui::DrawImages(
|
||||
m_WeaponData, SetGangWeapon, nullptr,
|
||||
[](std::string str) { return m_WeaponData.m_pJson->m_Data[str].get<std::string>(); },
|
||||
[](std::string str) { return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
[](std::string str) {
|
||||
return str != "-1"; /*Jetpack*/
|
||||
});
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif
|
||||
|
13
src/weapon.h
13
src/weapon.h
@ -5,7 +5,7 @@ class Weapon
|
||||
{
|
||||
public:
|
||||
#ifdef GTASA
|
||||
static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_BOTH, ImVec2(65, 65) };
|
||||
static inline ResourceStore m_WeaponData{"weapon", eResourceType::TYPE_BOTH, ImVec2(65, 65)};
|
||||
|
||||
static inline bool m_bAutoAim;
|
||||
static inline bool m_bRapidFire;
|
||||
@ -14,7 +14,7 @@ public:
|
||||
static inline bool m_bMoveFire;
|
||||
static inline int m_nSelectedGang;
|
||||
#else // GTA3 & GTAVC
|
||||
static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_TEXT };
|
||||
static inline ResourceStore m_WeaponData{"weapon", eResourceType::TYPE_TEXT};
|
||||
static inline bool m_bInfiniteAmmo;
|
||||
#endif
|
||||
static inline bool m_bFastReload;
|
||||
@ -25,8 +25,7 @@ public:
|
||||
static inline int m_nSelectedWeapon;
|
||||
|
||||
#ifdef GTASA
|
||||
static inline int m_nGangWeaponList[10][3] =
|
||||
{
|
||||
static inline int m_nGangWeaponList[10][3] = {
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Ballas
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Vagos
|
||||
@ -45,12 +44,12 @@ public:
|
||||
static void Draw();
|
||||
|
||||
#ifdef GTASA
|
||||
static void GiveWeaponToPlayer(std::string& weapon_type);
|
||||
static void GiveWeaponToPlayer(std::string &weapon_type);
|
||||
#else // GTA3 & GTAVC
|
||||
static void GiveWeaponToPlayer(std::string& rootkey, std::string& model, std::string& name);
|
||||
static void GiveWeaponToPlayer(std::string &rootkey, std::string &model, std::string &name);
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
static void SetGangWeapon(std::string& weapon_type);
|
||||
static void SetGangWeapon(std::string &weapon_type);
|
||||
#endif
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user