mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2025-07-18 09:27:51 +08:00
fixed some bugs, added default teleports list
This commit is contained in:
@ -175,6 +175,9 @@ namespace impl {
|
||||
}
|
||||
|
||||
static void CleanupRenderTarget() {
|
||||
if (!frameContext)
|
||||
return;
|
||||
|
||||
for (UINT i = 0; i < buffersCounts; ++i) {
|
||||
if (frameContext[i].main_render_target_resource) {
|
||||
frameContext[i].main_render_target_resource->Release();
|
||||
|
@ -4405,7 +4405,7 @@ namespace Config {
|
||||
{ "Camera:Misc", "DisableSafezoneFOVReduction", true, &Menu::Camera::disableSafezoneFOVReduction, OPTION },
|
||||
{ "Camera:Misc", "DisablePhotoModeLimits", true, &Menu::Camera::disablePhotoModeLimits, OPTION },
|
||||
{ "Camera:Misc", "DisableHeadCorrection", false, &Menu::Camera::disableHeadCorrection, OPTION },
|
||||
{ "Teleport:SavedLocations", "SavedTeleportLocations", std::string(""), &Menu::Teleport::savedTeleportLocations, String},
|
||||
{ "Teleport:SavedLocations", "SavedTeleportLocations", std::string("Bazaar - Highest Point:1944,123.6,932.8;Bazaar - Main Entrance:1962.9,50.1,927.9;Colonel Williams Stronghold - Main Entrance Bridge:994.3,22.8,-1138.6;Dynamo Cars Factory - Main Entrance:2295.9,-2.1,-78.6;Fish Eye - Player Safehouse:1180.4,32.4,-146.8;Fish Eye - Top of The Baloon:1122.6,98.8,-101.2;Observatory - Meeting Room:1951.2,-13.4,-329.6;Observatory - The 2 Domes (No Chemicals):1985.4,19.9,-357.2;Out of Bounds - Cut Road Quest:2693.3,-4.7,-241.5;PK Metro Station - Main Entrance:1886.9,50,628.9;PK Ship - Main Entrance:801.8,4.2,139.8;St. Paul Cathedral - GRE Entrance:463.4,4.2,-421;Tolga & Fatin Quest - Underground Loot Box:2343.9,12.2,-661.5;VNC Tower - \"V\" Logo:1434.2,4.3,-319.3;VNC Tower - Highest Player Safehouse:1424.7,354.6,-455;VNC Tower - Highest Point:1403.8,446.7,-389.8;X13 - Tunnel Near the City Walls Towards Facility:2407.9,36.2,-461.7;X13 - Underground Facility:2437.8,12.2,-649.9;X13 - Waltz Arena:2551.9,15.3,-569.1"), &Menu::Teleport::savedTeleportLocations, String},
|
||||
{ "Misc:Misc", "DisableGamePauseWhileAFK", true, &Menu::Misc::disableGamePauseWhileAFK, OPTION },
|
||||
{ "Misc:GameChecks", "DisableSavegameCRCCheck", true, &Menu::Misc::disableSavegameCRCCheck, OPTION },
|
||||
{ "Misc:GameChecks", "DisableDataPAKsCRCCheck", true, &Menu::Misc::disableDataPAKsCRCCheck, OPTION },
|
||||
@ -4550,7 +4550,7 @@ namespace Config {
|
||||
Menu::Player::loadSCRFilePath = {};
|
||||
break;
|
||||
} else if (entry.key == "SavedTeleportLocations") {
|
||||
Menu::Teleport::savedTeleportLocations = Menu::Teleport::ParseTeleportLocations(strValue);
|
||||
Menu::Teleport::savedTeleportLocations = Menu::Teleport::ParseTeleportLocations(strValue.empty() ? std::any_cast<std::string>(entry.value) : strValue);
|
||||
Menu::Teleport::UpdateTeleportLocationVisualNames();
|
||||
break;
|
||||
}
|
||||
|
@ -185,7 +185,6 @@ namespace Menu {
|
||||
static void UpdateDisabledOptions() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
freeCam.SetChangesAreDisabled(!iLevel || !iLevel->IsLoaded() || photoMode.GetValue());
|
||||
teleportPlayerToCamera.SetChangesAreDisabled(!iLevel || !iLevel->IsLoaded());
|
||||
thirdPersonCamera.SetChangesAreDisabled(freeCam.GetValue() || photoMode.GetValue());
|
||||
tpUseTPPModel.SetChangesAreDisabled(freeCam.GetValue() || photoMode.GetValue());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Menu {
|
||||
static std::vector<std::string> savedTeleportLocationNames;
|
||||
static std::vector<const char*> savedTeleportLocationNamesPtrs;
|
||||
static int selectedTPLocation = -1;
|
||||
static char newLocationName[25]{};
|
||||
static char newLocationName[125]{};
|
||||
|
||||
Vector3 waypointCoords{};
|
||||
bool* waypointIsSet = nullptr;
|
||||
@ -27,12 +27,11 @@ namespace Menu {
|
||||
savedTeleportLocationNames.clear();
|
||||
savedTeleportLocationNamesPtrs.clear();
|
||||
for (const auto& loc : savedTeleportLocations) {
|
||||
std::string completeName = loc.name + " (X: " + std::format("{:.1f}", loc.pos.X) + ", Y: " + std::format("{:.1f}", loc.pos.X) + ", Z: " + std::format("{:.1f}", loc.pos.Z) + ")";
|
||||
std::string completeName = loc.name + " (X: " + std::format("{:.1f}", loc.pos.X) + ", Y: " + std::format("{:.1f}", loc.pos.Y) + ", Z: " + std::format("{:.1f}", loc.pos.Z) + ")";
|
||||
savedTeleportLocationNames.emplace_back(completeName);
|
||||
}
|
||||
for (const auto& name : savedTeleportLocationNames) {
|
||||
for (const auto& name : savedTeleportLocationNames)
|
||||
savedTeleportLocationNamesPtrs.emplace_back(name.c_str());
|
||||
}
|
||||
}
|
||||
std::vector<TeleportLocation> ParseTeleportLocations(const std::string& input) {
|
||||
if (input.empty())
|
||||
@ -276,12 +275,13 @@ namespace Menu {
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), 0, ImVec2(0.5f, 0.5f));
|
||||
if (ImGui::BeginPopupModal("Give the location a name", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
bool tpSaveResult = true;
|
||||
ImGui::PushItemWidth(500.0f * Menu::scale);
|
||||
if (ImGui::InputTextWithHint("##TPLocationNameInputText", "Location name", newLocationName, IM_ARRAYSIZE(newLocationName), ImGuiInputTextFlags_EnterReturnsTrue) || ImGui::Button("OK", ImVec2(500.0f, 0.0f) * Menu::scale) && newLocationName[0]) {
|
||||
ImGui::PushItemWidth(510.0f * Menu::scale);
|
||||
if (ImGui::InputTextWithHint("##TPLocationNameInputText", "Location name", newLocationName, IM_ARRAYSIZE(newLocationName), ImGuiInputTextFlags_EnterReturnsTrue) || ImGui::Button("OK", ImVec2(250.0f, 0.0f) * Menu::scale) && newLocationName[0]) {
|
||||
ImGui::PopItemWidth();
|
||||
tpSaveResult = SaveTeleportLocation(newLocationName);
|
||||
newLocationName[0] = 0;
|
||||
}
|
||||
} else if (ImGui::SameLine(); ImGui::Button("Cancel", ImVec2(250.0f, 0.0f) * Menu::scale))
|
||||
ImGui::CloseCurrentPopup();
|
||||
if (tpSaveResult)
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
@ -314,18 +314,17 @@ namespace Menu {
|
||||
}
|
||||
void Tab::Render() {
|
||||
ImGui::SeparatorText("Saved Locations##Teleport");
|
||||
ImGui::BeginDisabled(isTeleportationDisabled()); {
|
||||
ImGui::PushItemWidth(672.0f * Menu::scale);
|
||||
ImGui::ListBox("##SavedTPLocationsListBox", &selectedTPLocation, savedTeleportLocationNamesPtrs.data(), static_cast<int>(savedTeleportLocationNamesPtrs.size()), 5);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::PushItemWidth(672.0f * Menu::scale);
|
||||
ImGui::ListBox("##SavedTPLocationsListBox", &selectedTPLocation, savedTeleportLocationNamesPtrs.data(), static_cast<int>(savedTeleportLocationNamesPtrs.size()), 5);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::BeginDisabled(isTeleportationDisabled() || selectedTPLocation < 0 || selectedTPLocation >= savedTeleportLocations.size()); {
|
||||
if (ImGui::ButtonHotkey("Teleport to Selected Location", &teleportToSelectedLocation, "Teleports player to selected location from the saved locations list"))
|
||||
TeleportPlayerTo(savedTeleportLocations[selectedTPLocation].pos);
|
||||
ImGui::SameLine();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(selectedTPLocation < 0 || selectedTPLocation >= savedTeleportLocations.size()); {
|
||||
if (ImGui::Button("Remove Selected Location")) {
|
||||
savedTeleportLocations.erase(savedTeleportLocations.begin() + selectedTPLocation);
|
||||
UpdateTeleportLocationVisualNames();
|
||||
@ -383,15 +382,21 @@ namespace Menu {
|
||||
ImGui::InputFloat("Z", &teleportCoords.Z, 1.0f, 10.0f, "%.2f");
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (ImGui::ButtonHotkey("Teleport to Waypoint", &teleportToWaypoint, "Teleports player to waypoint.\nWARNING: If the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead.\nWARNING: Your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation") && waypointIsSet && *waypointIsSet)
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::BeginDisabled(isTeleportationDisabled() || !waypointIsSet || !*waypointIsSet); {
|
||||
if (ImGui::ButtonHotkey("Teleport to Waypoint", &teleportToWaypoint, "Teleports player to waypoint.\nWARNING: If the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead.\nWARNING: Your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation"))
|
||||
justTeleportedToWaypoint = TeleportPlayerTo(waypointCoords);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(isTeleportationDisabled()); {
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ButtonHotkey("Teleport to Coords", &teleportToCoords, "Teleports player to the coords specified in the input boxes above"))
|
||||
TeleportPlayerTo(teleportCoords);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Get Player Coords"))
|
||||
SyncTPCoordsToPlayer();
|
||||
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user