diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7fc04fd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "files.associations": { + "algorithm": "cpp", + "chrono": "cpp", + "functional": "cpp", + "memory": "cpp", + "thread": "cpp", + "xmemory": "cpp" + } +} \ No newline at end of file diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 19fa320..3e5e967 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -223,9 +223,13 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { uint gameVersion = GetGameVersion(); if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT) + { CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); + } else + { MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR); + } } return TRUE; diff --git a/src/Player.cpp b/src/Player.cpp index 0629956..812c2e8 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -8,24 +8,24 @@ // hardcoded cloth category names const char* cloth_category[18] = { - "Shirts", // 0 - "Heads", // 1 - "Trousers", // 2 - "Shoes", //3 - "Tattoos left lower arm", // 4 - "Tattoos left upper arm", // 5 - "Tattoos right upper arm", // 6 - "Tattoos right lower arm", // 7 - "Tattoos back", // 8 - "Tattoos left chest", // 9 - "Tattoos right chest", // 10 - "Tattoos stomach", // 11 - "Tattoos lower back", // 12 - "Necklaces", // 13 - "Watches", // 13 - "Glasses", // 15 - "Hats", // 16 - "Extras" // 17 + "Shirts", + "Heads", + "Trousers", + "Shoes", + "Tattoos left lower arm", + "Tattoos left upper arm", + "Tattoos right upper arm", + "Tattoos right lower arm", + "Tattoos back", + "Tattoos left chest", + "Tattoos right chest", + "Tattoos stomach", + "Tattoos lower back", + "Necklaces", + "Watches", + "Glasses", + "Hats", + "Extras" }; inline static void PlayerModelBrokenFix() @@ -274,6 +274,33 @@ void Player::Draw() 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::EndTabItem(); } diff --git a/src/Teleport.cpp b/src/Teleport.cpp index e94e161..673a746 100644 --- a/src/Teleport.cpp +++ b/src/Teleport.cpp @@ -117,7 +117,9 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id) pVeh->m_nAreaCode = interior_id; } else + { pPlayer->Teleport(pos, false); + } pPlayer->m_nAreaCode = interior_id; Command(interior_id); diff --git a/src/Ui.cpp b/src/Ui.cpp index 0bd463d..9163dc7 100644 --- a/src/Ui.cpp +++ b/src/Ui.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "Util.h" #include "Ui.h" bool Ui::ListBox(const char* label, std::vector& all_items, int& selected) @@ -529,7 +530,8 @@ void Ui::DrawImages(std::vector>& img_vec, Im && (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))) on_left_click(text); diff --git a/src/Util.cpp b/src/Util.cpp index 5ea54e5..5f25b39 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -4,30 +4,6 @@ #include "psapi.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) { RwTexDictionary* pRwTexDictionary = &data.txd; @@ -44,7 +20,6 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na SSearchData* sdata = reinterpret_cast(data); sdata->m_ImagesList.push_back(std::make_unique()); sdata->m_ImagesList.back().get()->m_pRwTexture = tex; - sdata->m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(tex); std::stringstream ss(tex->name); std::string str; @@ -67,7 +42,6 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na SSearchData* sdata = reinterpret_cast(data); sdata->m_ImagesList.push_back(std::make_unique()); sdata->m_ImagesList.back().get()->m_pRwTexture = tex; - sdata->m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(tex); std::stringstream ss(tex->name); std::string str; diff --git a/src/pch.h b/src/pch.h index 71db7b7..d0032ca 100644 --- a/src/pch.h +++ b/src/pch.h @@ -93,12 +93,35 @@ struct HotKeyData 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 { std::string m_FileName; std::string m_CategoryName; RwTexture *m_pRwTexture = nullptr; - void* m_pTexture = nullptr; }; struct SSearchData