Add quick teleport for SA, fixes
This commit is contained in:
parent
3d8378419f
commit
2d7ffb089b
Binary file not shown.
@ -228,6 +228,7 @@ Example: tp x y z"""
|
||||
TextColor = "Text color"
|
||||
TextOnlyMode = "Text only"
|
||||
TextOnlyModeHint = "Disables all images and shows only text"
|
||||
TPMarkerKey = "Teleport to marker"
|
||||
Usage = "Usage"
|
||||
UpdaterInfo1 = "It's highly recommanded to update to the latest version. Newer version contains new features and bug fixes."
|
||||
UpdaterInfo2 = "To know what changes are made or to download, click on the 'Download page' button. Follow the instructions there. If you're still having issues, let me know on discord."
|
||||
@ -399,8 +400,9 @@ InvalidLocation = "Invalid location"
|
||||
Location = "Location"
|
||||
LocationHint = "Groove Street"
|
||||
LocationRemoved = "Location removed"
|
||||
QuickTeleport = "Quick teleport"
|
||||
QuickTeleportHint = """
|
||||
QuickTeleport = "Quick Teleport"
|
||||
QuickTeleportHint = "Open quick teleport using "
|
||||
TeleportMarkerHint = """
|
||||
Teleport to the location of your radar
|
||||
target blip using """
|
||||
TargetBlipText = "Target blip not found. You need to place it on the map first"
|
||||
|
@ -300,6 +300,11 @@ void CheatMenu::Init()
|
||||
|
||||
D3dHook::SetMouseState(m_bShowMenu);
|
||||
}
|
||||
|
||||
if (quickTeleport.PressedRealtime())
|
||||
{
|
||||
D3dHook::SetMouseState(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION_NUMBER "3.3"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
|
||||
#define BUILD_NUMBER "20220701"
|
||||
#define BUILD_NUMBER "20220707"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION
|
||||
|
||||
#ifdef GTASA
|
||||
|
@ -91,9 +91,9 @@ void Freecam::Process()
|
||||
speed *= 2;
|
||||
}
|
||||
|
||||
if (freeCamForward.PressedBasic() || freeCamBackward.PressedBasic())
|
||||
if (freeCamForward.PressedRealtime() || freeCamBackward.PressedRealtime())
|
||||
{
|
||||
if (freeCamBackward.PressedBasic())
|
||||
if (freeCamBackward.PressedRealtime())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
@ -105,9 +105,9 @@ void Freecam::Process()
|
||||
pos.z += speed * 2 * sin(m_fTotalMouse.y / 3 * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (freeCamLeft.PressedBasic() || freeCamRight.PressedBasic())
|
||||
if (freeCamLeft.PressedRealtime() || freeCamRight.PressedRealtime())
|
||||
{
|
||||
if (freeCamLeft.PressedBasic())
|
||||
if (freeCamLeft.PressedRealtime())
|
||||
{
|
||||
speed *= -1;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ bool Hotkey::Pressed()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Hotkey::PressedBasic()
|
||||
bool Hotkey::PressedRealtime()
|
||||
{
|
||||
return (m_CurrentHotkey == "") ? KeyPressed(m_key1) && KeyPressed(m_key2) : false;
|
||||
}
|
||||
|
@ -63,6 +63,6 @@ public:
|
||||
// Returns true if the hotkeys are pressed
|
||||
bool Pressed();
|
||||
|
||||
// Returns true if the hotkeys are pressed, with no checks
|
||||
bool PressedBasic();
|
||||
// Returns true if the hotkeys are pressed in realtime
|
||||
bool PressedRealtime();
|
||||
};
|
||||
|
@ -464,6 +464,7 @@ void Menu::ShowPage()
|
||||
freeCamLeft.DrawUI(TEXT("Menu.FreecamLeftKey"));
|
||||
freeCamRight.DrawUI(TEXT("Menu.FreecamRightKey"));
|
||||
quickTeleport.DrawUI(TEXT("Menu.QuickTPKey"));
|
||||
teleportMarker.DrawUI(TEXT("Menu.TPMarkerKey"));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
eRenderer gRenderer = Render_Unknown;
|
||||
DataStore gConfig = DataStore(FILE_NAME, true);
|
||||
|
||||
ResourceStore gTextureList { "misc", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
||||
Hotkey aimSkinChanger {VK_RETURN, VK_RETURN, "AimSkinChanger"};
|
||||
Hotkey freeCam {VK_F6, VK_F6, "Freecam.Toggle"};
|
||||
Hotkey freeCamForward {VK_KEY_I, VK_KEY_I, "Freecam.Forward"};;
|
||||
@ -15,7 +16,8 @@ Hotkey flipVeh {VK_NONE, VK_NONE, "Vehicle.Flip"};
|
||||
Hotkey godMode {VK_NONE, VK_NONE, "GodMode"};
|
||||
Hotkey menuOpen {VK_LCONTROL, VK_KEY_M, "MenuToggle"};
|
||||
Hotkey quickSceenShot {VK_F5, VK_F5, "QuickScreenshot"};
|
||||
Hotkey quickTeleport {VK_KEY_X, VK_KEY_Y, "QuickTeleport"};
|
||||
Hotkey quickTeleport {VK_LSHIFT, VK_KEY_Q, "QuickTeleport"};
|
||||
Hotkey teleportMarker {VK_KEY_X, VK_KEY_Y, "TeleportShortcut"};
|
||||
Hotkey vehEngine {VK_NONE, VK_NONE, "Vehicle.EngineToggle"};
|
||||
Hotkey vehInstantStart {VK_NONE, VK_NONE, "Vehicle.InstantStart"};
|
||||
Hotkey vehInstantStop {VK_NONE, VK_NONE, "Vehicle.InstantStop"};
|
@ -112,6 +112,8 @@ extern Hotkey godMode;
|
||||
extern Hotkey menuOpen;
|
||||
extern Hotkey quickSceenShot;
|
||||
extern Hotkey quickTeleport;
|
||||
extern Hotkey teleportMarker;
|
||||
extern Hotkey vehEngine;
|
||||
extern Hotkey vehInstantStart;
|
||||
extern Hotkey vehInstantStop;
|
||||
extern ResourceStore gTextureList;
|
@ -50,6 +50,18 @@ RwTexDictionary* LoadTexDictionary(char const* filename) {
|
||||
return plugin::CallAndReturnDynGlobal<RwTexDictionary*, char const*>(0x5B3860, filename);
|
||||
}
|
||||
|
||||
RwTexture* ResourceStore::FindTextureByName(std::string&& name)
|
||||
{
|
||||
for (auto& item: m_ImagesList)
|
||||
{
|
||||
if (item->m_FileName == name)
|
||||
{
|
||||
return item->m_pRwTexture;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ResourceStore::LoadTextureResource(std::string&& name)
|
||||
{
|
||||
std::string fullPath = PLUGIN_PATH((char*)FILE_NAME "\\") + name + ".txd";
|
||||
|
@ -66,4 +66,6 @@ public:
|
||||
bool m_bTexturesLoaded = false;
|
||||
|
||||
ResourceStore(const char* text, eResourceType type = TYPE_IMAGE, ImVec2 imageSize = ImVec2(64, 64));
|
||||
|
||||
RwTexture* FindTextureByName(std::string&& name);
|
||||
};
|
@ -112,10 +112,12 @@ void RPC::Process()
|
||||
detailsText = std::format("{}: ${}", TEXT("Player.Money"), pInfo->m_nMoney);
|
||||
}
|
||||
|
||||
#ifndef GTA3
|
||||
if (pPed->m_nAreaCode != 0) // world
|
||||
{
|
||||
stateText = TEXT("RPC.InsideInterior");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (BY_GAME(pPed->m_nPedFlags.bInVehicle, pPed->m_bInVehicle, pPed->m_bInVehicle))
|
||||
{
|
||||
|
@ -36,49 +36,90 @@ void Teleport::FetchRadarSpriteData()
|
||||
|
||||
void Teleport::Init()
|
||||
{
|
||||
m_bTeleportMarker = gConfig.Get("Features.TeleportMarker", false);
|
||||
m_bQuickTeleport = gConfig.Get("Features.QuickTeleport", false);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if ((QuickTP::m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - QuickTP::m_nTimer) > 500))
|
||||
if ((TPMarker::m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - TPMarker::m_nTimer) > 500))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
#ifdef GTASA
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
QuickTP::m_fPos.z = CWorld::FindGroundZFor3DCoord(QuickTP::m_fPos.x, QuickTP::m_fPos.y,
|
||||
QuickTP::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
|
||||
TPMarker::m_fPos.z = CWorld::FindGroundZFor3DCoord(TPMarker::m_fPos.x, TPMarker::m_fPos.y,
|
||||
TPMarker::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
|
||||
#else
|
||||
QuickTP::m_fPos.z = CWorld::FindGroundZFor3DCoord(QuickTP::m_fPos.x, QuickTP::m_fPos.y,
|
||||
QuickTP::m_fPos.z + 100.0f, nullptr) + 1.0f;
|
||||
TPMarker::m_fPos.z = CWorld::FindGroundZFor3DCoord(TPMarker::m_fPos.x, TPMarker::m_fPos.y,
|
||||
TPMarker::m_fPos.z + 100.0f, nullptr) + 1.0f;
|
||||
#endif
|
||||
CVehicle* pVeh = player->m_pVehicle;
|
||||
|
||||
if (pVeh && BY_GAME(player->m_nPedFlags.bInVehicle, player->m_pVehicle, player->m_pVehicle))
|
||||
{
|
||||
BY_GAME(pVeh->Teleport(QuickTP::m_fPos, false), pVeh->Teleport(QuickTP::m_fPos), player->Teleport(QuickTP::m_fPos));
|
||||
BY_GAME(pVeh->Teleport(TPMarker::m_fPos, false), pVeh->Teleport(TPMarker::m_fPos), player->Teleport(TPMarker::m_fPos));
|
||||
}
|
||||
else
|
||||
{
|
||||
BY_GAME(player->Teleport(QuickTP::m_fPos, false), player->Teleport(QuickTP::m_fPos), player->Teleport(QuickTP::m_fPos));
|
||||
BY_GAME(player->Teleport(TPMarker::m_fPos, false), player->Teleport(TPMarker::m_fPos), player->Teleport(TPMarker::m_fPos));
|
||||
}
|
||||
|
||||
QuickTP::m_bEnabled = false;
|
||||
TPMarker::m_bEnabled = false;
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), false);
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
TheCamera.Fade(0, 1);
|
||||
}
|
||||
|
||||
if (m_bQuickTeleport)
|
||||
if (m_bTeleportMarker && teleportMarker.Pressed())
|
||||
{
|
||||
if (quickTeleport.Pressed()
|
||||
&& ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
|
||||
TeleportPlayer(true);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef GTASA
|
||||
Events::drawingEvent += []
|
||||
{
|
||||
if (m_bQuickTeleport && quickTeleport.PressedRealtime())
|
||||
{
|
||||
static CSprite2d map;
|
||||
if (!map.m_pTexture)
|
||||
{
|
||||
m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds;
|
||||
map.m_pTexture = gTextureList.FindTextureByName("map");
|
||||
}
|
||||
float height = screen::GetScreenHeight();
|
||||
float width = screen::GetScreenWidth();
|
||||
float size = width * height / width; // keep aspect ratio
|
||||
float left = (width-size) / 2;
|
||||
float right = left+size;
|
||||
map.Draw(CRect(left, 0.0f, right, height), CRGBA(255, 255, 255, 200));
|
||||
|
||||
if (ImGui::IsMouseClicked(0))
|
||||
{
|
||||
// Convert screen space to image space
|
||||
ImVec2 pos = ImGui::GetMousePos();
|
||||
pos.x = (pos.x < left) ? left : pos.x;
|
||||
pos.x = (pos.x > right) ? right : pos.x;
|
||||
pos.x -= left;
|
||||
pos.x -= size/2;
|
||||
pos.y -= size/2;
|
||||
|
||||
// Convert image space to map space
|
||||
pos.x = pos.x / size * 6000;
|
||||
pos.y = pos.y / size * 6000;
|
||||
pos.y *= -1;
|
||||
|
||||
tRadarTrace &target = CRadar::ms_RadarTrace[FrontEndMenuManager.m_nTargetBlipIndex];
|
||||
CVector temp = target.m_vecPos;
|
||||
unsigned char sprite = target.m_nRadarSprite;
|
||||
target.m_nRadarSprite = RADAR_SPRITE_WAYPOINT;
|
||||
target.m_vecPos = {pos.x, pos.y, 0.0f};
|
||||
TeleportPlayer(true);
|
||||
target.m_vecPos = temp;
|
||||
target.m_nRadarSprite = sprite;
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
@ -100,9 +141,9 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
||||
pos = targetBlip.m_vecPos;
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 500.f;
|
||||
|
||||
QuickTP::m_fPos = pos;
|
||||
QuickTP::m_nTimer = CTimer::m_snTimeInMilliseconds;
|
||||
QuickTP::m_bEnabled = true;
|
||||
TPMarker::m_fPos = pos;
|
||||
TPMarker::m_nTimer = CTimer::m_snTimeInMilliseconds;
|
||||
TPMarker::m_bEnabled = true;
|
||||
TheCamera.Fade(0, 0);
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(pPlayer), true);
|
||||
}
|
||||
@ -214,7 +255,6 @@ void Teleport::ShowPage()
|
||||
{
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
ImGui::Checkbox(TEXT("Teleport.InsertCoord"), &m_bInsertCoord);
|
||||
ImGui::NextColumn();
|
||||
#ifdef GTASA
|
||||
if (Widget::Checkbox(TEXT("Teleport.QuickTeleport"), &m_bQuickTeleport,
|
||||
std::string(TEXT_S("Teleport.QuickTeleportHint")
|
||||
@ -222,6 +262,15 @@ void Teleport::ShowPage()
|
||||
{
|
||||
gConfig.Set("Features.QuickTeleport", m_bQuickTeleport);
|
||||
}
|
||||
#endif
|
||||
ImGui::NextColumn();
|
||||
#ifdef GTASA
|
||||
if (Widget::Checkbox(TEXT("Teleport.TeleportMarker"), &m_bTeleportMarker,
|
||||
std::string(TEXT_S("Teleport.TeleportMarkerHint")
|
||||
+ teleportMarker.GetNameString()).c_str()))
|
||||
{
|
||||
gConfig.Set("Features.TeleportMarker", m_bTeleportMarker);
|
||||
}
|
||||
#endif
|
||||
ImGui::Columns(1);
|
||||
ImGui::Spacing();
|
||||
|
@ -6,12 +6,12 @@ class Teleport
|
||||
private:
|
||||
static inline bool m_bInsertCoord;
|
||||
static inline bool m_bQuickTeleport;
|
||||
static inline bool m_bTeleportMarker;
|
||||
static inline char m_nInputBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline ResourceStore m_tpData{ "locations", eResourceType::TYPE_TEXT };
|
||||
static inline char m_nLocationBuffer[INPUT_BUFFER_SIZE];
|
||||
static inline uint m_nQuickTeleportTimer;
|
||||
|
||||
struct QuickTP
|
||||
struct TPMarker
|
||||
{
|
||||
static inline bool m_bEnabled;
|
||||
static inline CVector m_fPos = { -1, -1, -1 };
|
||||
|
@ -689,7 +689,7 @@ void Visual::ShowPage()
|
||||
{
|
||||
static float var = 0.000001f;
|
||||
static CSprite2d sprite;
|
||||
sprite.m_pTexture = m_MiscData.m_ImagesList[0]->m_pRwTexture;
|
||||
sprite.m_pTexture = gTextureList.FindTextureByName("radardisc");
|
||||
|
||||
// rediect to our texture
|
||||
patch::Set(0x58A8C9, &sprite);
|
||||
|
@ -16,7 +16,6 @@ private:
|
||||
static inline bool m_bNoTextures;
|
||||
static inline bool m_bFullScreenMap;
|
||||
static inline bool m_bSquareRadar;
|
||||
static inline ResourceStore m_MiscData { "misc", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user