Cleanup & add player proof flags

This commit is contained in:
Grinch_ 2021-07-23 04:35:20 +06:00
parent 87d8b843c6
commit 7323df8c0c
7 changed files with 88 additions and 46 deletions

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"files.associations": {
"algorithm": "cpp",
"chrono": "cpp",
"functional": "cpp",
"memory": "cpp",
"thread": "cpp",
"xmemory": "cpp"
}
}

View File

@ -223,9 +223,13 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{ {
uint gameVersion = GetGameVersion(); uint gameVersion = GetGameVersion();
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT) if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
else else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR); MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
}
} }
return TRUE; return TRUE;

View File

@ -8,24 +8,24 @@
// hardcoded cloth category names // hardcoded cloth category names
const char* cloth_category[18] = const char* cloth_category[18] =
{ {
"Shirts", // 0 "Shirts",
"Heads", // 1 "Heads",
"Trousers", // 2 "Trousers",
"Shoes", //3 "Shoes",
"Tattoos left lower arm", // 4 "Tattoos left lower arm",
"Tattoos left upper arm", // 5 "Tattoos left upper arm",
"Tattoos right upper arm", // 6 "Tattoos right upper arm",
"Tattoos right lower arm", // 7 "Tattoos right lower arm",
"Tattoos back", // 8 "Tattoos back",
"Tattoos left chest", // 9 "Tattoos left chest",
"Tattoos right chest", // 10 "Tattoos right chest",
"Tattoos stomach", // 11 "Tattoos stomach",
"Tattoos lower back", // 12 "Tattoos lower back",
"Necklaces", // 13 "Necklaces",
"Watches", // 13 "Watches",
"Glasses", // 15 "Glasses",
"Hats", // 16 "Hats",
"Extras" // 17 "Extras"
}; };
inline static void PlayerModelBrokenFix() inline static void PlayerModelBrokenFix()
@ -274,6 +274,33 @@ void Player::Draw()
ImGui::Columns(1); ImGui::Columns(1);
ImGui::NewLine();
ImGui::TextWrapped("Player flags,");
ImGui::Columns(2, 0, false);
bool state = pPlayer->m_nPhysicalFlags.bBulletProof;
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bBulletProof = state;
state = pPlayer->m_nPhysicalFlags.bCollisionProof;
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bCollisionProof = state;
state = pPlayer->m_nPhysicalFlags.bExplosionProof;
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bExplosionProof = state;
ImGui::NextColumn();
state = pPlayer->m_nPhysicalFlags.bFireProof;
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bFireProof = state;
state = pPlayer->m_nPhysicalFlags.bMeeleProof;
if (Ui::CheckboxWithHint("Meele proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bMeeleProof = state;
ImGui::EndChild(); ImGui::EndChild();
ImGui::EndTabItem(); ImGui::EndTabItem();
} }

View File

@ -117,7 +117,9 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
pVeh->m_nAreaCode = interior_id; pVeh->m_nAreaCode = interior_id;
} }
else else
{
pPlayer->Teleport(pos, false); pPlayer->Teleport(pos, false);
}
pPlayer->m_nAreaCode = interior_id; pPlayer->m_nAreaCode = interior_id;
Command<Commands::SET_AREA_VISIBLE>(interior_id); Command<Commands::SET_AREA_VISIBLE>(interior_id);

View File

@ -1,4 +1,5 @@
#include "pch.h" #include "pch.h"
#include "Util.h"
#include "Ui.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)
@ -529,7 +530,8 @@ void Ui::DrawImages(std::vector<std::unique_ptr<STextureStructure>>& img_vec, Im
&& (verify_func == nullptr || verify_func(text)) && (verify_func == nullptr || verify_func(text))
) )
{ {
if (ImGui::ImageButton(img_vec[i]->m_pTexture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), IDirect3DTexture9* texture = (IDirect3DTexture9*)Util::GetTextureFromRaster(img_vec[i]->m_pRwTexture);
if (ImGui::ImageButton(texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1),
ImVec4(1, 1, 1, 1))) ImVec4(1, 1, 1, 1)))
on_left_click(text); on_left_click(text);

View File

@ -4,30 +4,6 @@
#include "psapi.h" #include "psapi.h"
#include "CFileLoader.h" #include "CFileLoader.h"
struct RwD3D9Raster
{
union
{
IDirect3DTexture9* texture;
IDirect3DSurface9* surface;
};
unsigned char* palette;
unsigned char alpha;
unsigned char cubeTextureFlags; /* 0x01 IS_CUBEMAP_TEX */
unsigned char textureFlags; /* 0x10 IS_COMPRESSED */
unsigned char lockedLevel;
IDirect3DSurface9* lockedSurface;
D3DLOCKED_RECT lockedRect;
D3DFORMAT format;
IDirect3DSwapChain9* swapChain;
HWND* hwnd;
};
struct RwRasterEx : public RwRaster
{
RwD3D9Raster *renderResource;
};
void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_name) void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_name)
{ {
RwTexDictionary* pRwTexDictionary = &data.txd; RwTexDictionary* pRwTexDictionary = &data.txd;
@ -44,7 +20,6 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na
SSearchData* sdata = reinterpret_cast<SSearchData*>(data); SSearchData* sdata = reinterpret_cast<SSearchData*>(data);
sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>()); sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>());
sdata->m_ImagesList.back().get()->m_pRwTexture = tex; sdata->m_ImagesList.back().get()->m_pRwTexture = tex;
sdata->m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(tex);
std::stringstream ss(tex->name); std::stringstream ss(tex->name);
std::string str; std::string str;
@ -67,7 +42,6 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na
SSearchData* sdata = reinterpret_cast<SSearchData*>(data); SSearchData* sdata = reinterpret_cast<SSearchData*>(data);
sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>()); sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>());
sdata->m_ImagesList.back().get()->m_pRwTexture = tex; sdata->m_ImagesList.back().get()->m_pRwTexture = tex;
sdata->m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(tex);
std::stringstream ss(tex->name); std::stringstream ss(tex->name);
std::string str; std::string str;

View File

@ -93,12 +93,35 @@ struct HotKeyData
bool m_bPressed; bool m_bPressed;
}; };
struct RwD3D9Raster
{
union
{
IDirect3DTexture9* texture;
IDirect3DSurface9* surface;
};
unsigned char* palette;
unsigned char alpha;
unsigned char cubeTextureFlags; /* 0x01 IS_CUBEMAP_TEX */
unsigned char textureFlags; /* 0x10 IS_COMPRESSED */
unsigned char lockedLevel;
IDirect3DSurface9* lockedSurface;
D3DLOCKED_RECT lockedRect;
D3DFORMAT format;
IDirect3DSwapChain9* swapChain;
HWND* hwnd;
};
struct RwRasterEx : public RwRaster
{
RwD3D9Raster *renderResource;
};
struct STextureStructure struct STextureStructure
{ {
std::string m_FileName; std::string m_FileName;
std::string m_CategoryName; std::string m_CategoryName;
RwTexture *m_pRwTexture = nullptr; RwTexture *m_pRwTexture = nullptr;
void* m_pTexture = nullptr;
}; };
struct SSearchData struct SSearchData