Add translation support to teleport tab, Fix a game crash when teleporting from inside a train/tram
This commit is contained in:
parent
ba8db05ba1
commit
1606869430
@ -1,7 +1,41 @@
|
|||||||
{
|
{
|
||||||
"Main" :
|
"Main" :
|
||||||
{
|
{
|
||||||
"TranslatorName" : "Grinch_"
|
"TranslatorName" : "Grinch_",
|
||||||
|
"TranslationLanguage" : "English",
|
||||||
|
"TranslationLanguageDisclaimer" : "Translated to English by Grinch_"
|
||||||
|
},
|
||||||
|
"Teleport" :
|
||||||
|
{
|
||||||
|
"TargetBlipText" : "Target blip not found. You need to place it on the map first",
|
||||||
|
"InvalidLocation" : "Invalid location",
|
||||||
|
"LocationRemoved" : "Location removed",
|
||||||
|
"CustomLocationRemoveOnly" : "You can only remove custom location",
|
||||||
|
"InsertCoord" : "Insert coordinates",
|
||||||
|
"QuickTeleport" : "Quick teleport",
|
||||||
|
"QuickTeleportHint" : "Teleport to the location of your radar\ntarget blip using ",
|
||||||
|
"Coordinates" : "Coordinates",
|
||||||
|
"TeleportToCoord" : "Teleport to coordinates",
|
||||||
|
"InvalidCoord" : "Invalid coordinates",
|
||||||
|
"TeleportMarker" : "Teleport to marker",
|
||||||
|
"TeleportCenter" : "Teleport to center",
|
||||||
|
"Location" : "Location",
|
||||||
|
"LocationHint" : "Groove Street",
|
||||||
|
"AddLocation" : "Add location"
|
||||||
|
},
|
||||||
|
"Window" :
|
||||||
|
{
|
||||||
|
"TeleportPage" : "Teleport",
|
||||||
|
"PlayerPage" : "Player",
|
||||||
|
"PedPage" : "Ped",
|
||||||
|
"VehiclePage" : "Vehicle",
|
||||||
|
"WeaponPage" : "Weapon",
|
||||||
|
"AnimationPage" : "Animation",
|
||||||
|
"GamePage" : "Game",
|
||||||
|
"VisualPage" : "Visual",
|
||||||
|
"MenuPage" : "Menu",
|
||||||
|
"Search" : "Search",
|
||||||
|
"AddNew" : "Add new"
|
||||||
},
|
},
|
||||||
"Menu" :
|
"Menu" :
|
||||||
{
|
{
|
||||||
|
@ -180,6 +180,23 @@ CheatMenu::CheatMenu()
|
|||||||
srand(CTimer::m_snTimeInMilliseconds);
|
srand(CTimer::m_snTimeInMilliseconds);
|
||||||
|
|
||||||
Locale::Init("CheatMenu/locale/");
|
Locale::Init("CheatMenu/locale/");
|
||||||
|
|
||||||
|
CheatMenu::m_headerList =
|
||||||
|
{
|
||||||
|
{TEXT_S("Window.TeleportPage"), &Teleport::ShowPage, eMenuPages::TELEPORT},
|
||||||
|
{TEXT_S("Window.PlayerPage"), &Player::ShowPage, eMenuPages::PLAYER},
|
||||||
|
{TEXT_S("Window.PedPage"), &Ped::ShowPage, eMenuPages::PED},
|
||||||
|
{TEXT_S("Window.AnimationPage"), &Animation::ShowPage, eMenuPages::ANIMATION},
|
||||||
|
{TEXT_S("Window.VehiclePage"), &Vehicle::ShowPage, eMenuPages::VEHICLE},
|
||||||
|
{TEXT_S("Window.WeaponPage"), &Weapon::ShowPage, eMenuPages::WEAPON},
|
||||||
|
{TEXT_S("Window.GamePage"), &Game::ShowPage, eMenuPages::GAME},
|
||||||
|
{TEXT_S("Window.VisualPage"), &Visual::ShowPage, eMenuPages::VISUAL},
|
||||||
|
{TEXT_S("Window.MenuPage"), &Menu::ShowPage, eMenuPages::MENU},
|
||||||
|
{"Welcome", &ShowWelcomePage, eMenuPages::WELCOME, true},
|
||||||
|
{"Update", &ShowUpdatePage, eMenuPages::UPDATE, true},
|
||||||
|
{"Anniversary", &ShowAnniversaryPage, eMenuPages::ANNIVERSARY, true}
|
||||||
|
};
|
||||||
|
|
||||||
Events::processScriptsEvent += []()
|
Events::processScriptsEvent += []()
|
||||||
{
|
{
|
||||||
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
|
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
static inline bool m_bShowMenu = false;
|
static inline bool m_bShowMenu = false;
|
||||||
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
|
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
|
||||||
static inline bool m_bSizeChangedExternal = false;
|
static inline bool m_bSizeChangedExternal = false;
|
||||||
|
static inline std::vector<HeaderData> m_headerList;
|
||||||
|
|
||||||
static void ApplyStyle();
|
static void ApplyStyle();
|
||||||
static void DrawWindow();
|
static void DrawWindow();
|
||||||
@ -46,22 +47,6 @@ private:
|
|||||||
static void ShowWelcomePage();
|
static void ShowWelcomePage();
|
||||||
static void ProcessPages();
|
static void ProcessPages();
|
||||||
|
|
||||||
static inline std::vector<HeaderData> m_headerList
|
|
||||||
{
|
|
||||||
{"Teleport", &Teleport::ShowPage, eMenuPages::TELEPORT},
|
|
||||||
{"Player", &Player::ShowPage, eMenuPages::PLAYER},
|
|
||||||
{"Ped", &Ped::ShowPage, eMenuPages::PED},
|
|
||||||
{"Animation", &Animation::ShowPage, eMenuPages::ANIMATION},
|
|
||||||
{"Vehicle", &Vehicle::ShowPage, eMenuPages::VEHICLE},
|
|
||||||
{"Weapon", &Weapon::ShowPage, eMenuPages::WEAPON},
|
|
||||||
{"Game", &Game::ShowPage, eMenuPages::GAME},
|
|
||||||
{"Visual", &Visual::ShowPage, eMenuPages::VISUAL},
|
|
||||||
{"Menu", &Menu::ShowPage, eMenuPages::MENU},
|
|
||||||
{"Welcome", &ShowWelcomePage, eMenuPages::WELCOME, true},
|
|
||||||
{"Update", &ShowUpdatePage, eMenuPages::UPDATE, true},
|
|
||||||
{"Anniversary", &ShowAnniversaryPage, eMenuPages::ANNIVERSARY, true}
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CheatMenu();
|
CheatMenu();
|
||||||
~CheatMenu();
|
~CheatMenu();
|
||||||
|
@ -55,6 +55,11 @@ public:
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _GTA_
|
||||||
|
// Wanted to do this in the macro TEXT/ TEXT_S
|
||||||
|
// But VS Code complains about it so..
|
||||||
|
defaultValue += "##" + key;
|
||||||
|
#endif
|
||||||
return m_pJson->GetValueStr(key, defaultValue);
|
return m_pJson->GetValueStr(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@
|
|||||||
#include "fontmgr.h"
|
#include "fontmgr.h"
|
||||||
#include "locale.h"
|
#include "locale.h"
|
||||||
|
|
||||||
#define TEXT(x) Locale::GetText(x, "Unknown##"x).c_str()
|
#define TEXT(x) Locale::GetText(x, "Unknown").c_str()
|
||||||
#define TEXT_S(x) Locale::GetText(x,"Unknown##"x).c_str()
|
#define TEXT_S(x) Locale::GetText(x,"Unknown")
|
||||||
|
|
||||||
using namespace plugin;
|
using namespace plugin;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
|||||||
|
|
||||||
if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
|
if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
|
||||||
{
|
{
|
||||||
SetHelpMessage("Target blip not found. You need to place it on the map first.", false, false, false);
|
SetHelpMessage(TEXT("Teleport.TargetBlipText"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||||
@ -123,16 +123,42 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
|||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
|
|
||||||
|
if (CModelInfo::IsTrainModel(pVeh->m_nModelIndex))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
|
if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
|
||||||
{
|
{
|
||||||
pVeh->Teleport(pos, false);
|
|
||||||
|
|
||||||
if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
|
if (CModelInfo::IsTrainModel(pVeh->m_nModelIndex))
|
||||||
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
|
{
|
||||||
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
|
CVector vehPos = pVeh->GetPosition();
|
||||||
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
|
Command<Commands::WARP_CHAR_FROM_CAR_TO_COORD>(CPools::GetPedRef(pPlayer), vehPos.x, vehPos.y, vehPos.z + 2.0f);
|
||||||
|
|
||||||
BY_GAME(pVeh->m_nAreaCode, pVeh->m_nInterior, NULL) = interior_id;
|
if (DistanceBetweenPoints(pos, vehPos) > 100.0f)
|
||||||
|
{
|
||||||
|
Command<Commands::DELETE_ALL_TRAINS>();
|
||||||
|
}
|
||||||
|
|
||||||
|
pPlayer->Teleport(pos, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pVeh->Teleport(pos, false);
|
||||||
|
|
||||||
|
if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
|
||||||
|
{
|
||||||
|
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
|
||||||
|
}
|
||||||
|
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
|
||||||
|
{
|
||||||
|
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
|
||||||
|
}
|
||||||
|
|
||||||
|
pVeh->m_nAreaCode = interior_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -141,8 +167,8 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
|||||||
#else
|
#else
|
||||||
if (pVeh && pPlayer->m_pVehicle)
|
if (pVeh && pPlayer->m_pVehicle)
|
||||||
{
|
{
|
||||||
#ifndef GTA3
|
#ifdef GTAVC
|
||||||
BY_GAME(pPlayer->m_nAreaCode, pPlayer->m_nInterior, NULL) = interior_id;
|
pPlayer->m_nInterior = interior_id;
|
||||||
#endif
|
#endif
|
||||||
pVeh->Teleport(pos);
|
pVeh->Teleport(pos);
|
||||||
}
|
}
|
||||||
@ -152,7 +178,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GTA3
|
#if defined GTASA || defined GTAVC
|
||||||
BY_GAME(pPlayer->m_nAreaCode, pPlayer->m_nInterior, NULL) = interior_id;
|
BY_GAME(pPlayer->m_nAreaCode, pPlayer->m_nInterior, NULL) = interior_id;
|
||||||
Command<Commands::SET_AREA_VISIBLE>(interior_id);
|
Command<Commands::SET_AREA_VISIBLE>(interior_id);
|
||||||
#endif
|
#endif
|
||||||
@ -169,7 +195,7 @@ void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, s
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
SetHelpMessage("Invalid location", false, false, false);
|
SetHelpMessage(TEXT("Teleport.InvalidLocation"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,12 +204,12 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
|
|||||||
if (category == "Custom")
|
if (category == "Custom")
|
||||||
{
|
{
|
||||||
m_tpData.m_pJson->m_Data["Custom"].erase(key);
|
m_tpData.m_pJson->m_Data["Custom"].erase(key);
|
||||||
SetHelpMessage("Location removed", false, false, false);
|
SetHelpMessage(TEXT("Teleport.LocationRemoved"));
|
||||||
m_tpData.m_pJson->WriteToDisk();
|
m_tpData.m_pJson->WriteToDisk();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetHelpMessage("You can only remove custom location", false, false, false);
|
SetHelpMessage(TEXT("Teleport.CustomLocationRemoveOnly"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,18 +218,18 @@ void Teleport::ShowPage()
|
|||||||
if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||||
{
|
{
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::BeginTabItem("Teleport"))
|
if (ImGui::BeginTabItem(TEXT("Window.TeleportPage")))
|
||||||
{
|
{
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::BeginChild("Teleport Child"))
|
if (ImGui::BeginChild("Teleport Child"))
|
||||||
{
|
{
|
||||||
ImGui::Columns(2, nullptr, false);
|
ImGui::Columns(2, nullptr, false);
|
||||||
ImGui::Checkbox("Insert coordinates", &m_bInsertCoord);
|
ImGui::Checkbox(TEXT("Teleport.InsertCoord"), &m_bInsertCoord);
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
|
if (Ui::CheckboxWithHint(TEXT("Teleport.QuickTeleport"), &m_bQuickTeleport,
|
||||||
std::string(std::string("Teleport to the location of your radar\ntarget blip using ")
|
std::string(TEXT_S("Teleport.QuickTeleportHint")
|
||||||
+ quickTeleport.GetNameString()).c_str()))
|
+ quickTeleport.GetNameString()).c_str()))
|
||||||
{
|
{
|
||||||
gConfig.SetValue("quick_teleport", m_bQuickTeleport);
|
gConfig.SetValue("quick_teleport", m_bQuickTeleport);
|
||||||
}
|
}
|
||||||
@ -220,11 +246,11 @@ void Teleport::ShowPage()
|
|||||||
", " + 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));
|
ImGui::InputTextWithHint(TEXT("Teleport.Coordinates"), "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
if (ImGui::Button("Teleport to coord", Ui::GetSize(2)))
|
if (ImGui::Button(TEXT("Teleport.TeleportToCoord"), Ui::GetSize(2)))
|
||||||
{
|
{
|
||||||
CVector pos{0, 0, 10};
|
CVector pos{0, 0, 10};
|
||||||
|
|
||||||
@ -236,17 +262,17 @@ void Teleport::ShowPage()
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
SetHelpMessage("Invalid coordinate", false, false, false);
|
SetHelpMessage(TEXT("Teleport.InvalidCoord"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
if (ImGui::Button("Teleport to marker", Ui::GetSize(2)))
|
if (ImGui::Button(TEXT("Teleport.TeleportMarker"), Ui::GetSize(2)))
|
||||||
{
|
{
|
||||||
TeleportPlayer(true);
|
TeleportPlayer(true);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (ImGui::Button("Teleport to map center", Ui::GetSize(2)))
|
if (ImGui::Button(TEXT("Teleport.TeleportCenter"), Ui::GetSize(2)))
|
||||||
{
|
{
|
||||||
TeleportPlayer(false, CVector(0, 0, 23));
|
TeleportPlayer(false, CVector(0, 0, 23));
|
||||||
}
|
}
|
||||||
@ -256,19 +282,19 @@ void Teleport::ShowPage()
|
|||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("Search"))
|
if (ImGui::BeginTabItem(TEXT("Window.Search")))
|
||||||
{
|
{
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
FetchRadarSpriteData();
|
FetchRadarSpriteData();
|
||||||
#endif
|
#endif
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::CollapsingHeader("Add new"))
|
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
||||||
{
|
{
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::InputTextWithHint("Location", "Groove Street", m_nLocationBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
ImGui::InputTextWithHint(TEXT("Teleport.Location"), TEXT("Teleport.LocationHint"), m_nLocationBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
ImGui::InputTextWithHint(TEXT("Teleport.Coordinates"), "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::Button("Add location", Ui::GetSize()))
|
if (ImGui::Button(TEXT("Teleport.AddLocation"), Ui::GetSize()))
|
||||||
{
|
{
|
||||||
m_tpData.m_pJson->m_Data["Custom"][m_nLocationBuffer] = ("0, " + std::string(m_nInputBuffer));
|
m_tpData.m_pJson->m_Data["Custom"][m_nLocationBuffer] = ("0, " + std::string(m_nInputBuffer));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user