Skip to content

Commit

Permalink
Merge branch 'development' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
XdGoldenTigerOfficial authored Apr 17, 2023
2 parents 99ff01f + f9e5390 commit 2e633c7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
88 changes: 35 additions & 53 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ class FunctionsController : BaseScript
private float cameraRotationHeading = 0f;

// show location variables
private Vector3 currentPos = Game.PlayerPed.Position;
private Vector3 nodePos = Game.PlayerPed.Position;
private float heading = 0f;
private float safeZoneSizeX = (1 / GetSafeZoneSize() / 3.0f) - 0.358f;
private uint crossing = 1;
private string crossingName = "";
private string suffix = "";
private string zoneDisplay = "";
private string streetDisplay = "";
private string headingDisplay = "";

private List<int> waypointPlayerIdsToRemove = new List<int>();
private int voiceTimer = 0;
private int voiceCycle = 1;
Expand Down Expand Up @@ -717,26 +715,44 @@ private async Task UpdateLocation()
if (MainMenu.MiscSettingsMenu.ShowLocation)
{
// Get the current location.
currentPos = GetEntityCoords(Game.PlayerPed.Handle, true);
var currentPos = GetEntityCoords(Game.PlayerPed.Handle, true);
var heading = Game.PlayerPed.Heading;
zoneDisplay = World.GetZoneLocalizedName(currentPos);

// Get the nearest vehicle node.
nodePos = currentPos;
var nodePos = Vector3.Zero;
GetNthClosestVehicleNode(currentPos.X, currentPos.Y, currentPos.Z, 0, ref nodePos, 0, 0, 0);
heading = Game.PlayerPed.Heading;

// Get the safezone size for x and y to be able to move with the minimap.
safeZoneSizeX = (1 / GetSafeZoneSize() / 3.0f) - 0.358f;
//safeZoneSizeY = GetSafeZoneSize() - 0.27f;
//safeZoneSizeY = (1 / GetSafeZoneSize() / 3.6f) - 0.27f;

// Get the cross road.
var p1 = (uint)1; // unused
crossing = (uint)1;
GetStreetNameAtCoord(currentPos.X, currentPos.Y, currentPos.Z, ref p1, ref crossing);
crossingName = GetStreetNameFromHashKey(crossing);
uint mainSt = 0, crossSt = 0;
GetStreetNameAtCoord(currentPos.X, currentPos.Y, currentPos.Z, ref mainSt, ref crossSt);
var mainName = GetStreetNameFromHashKey(mainSt);
var crossName = GetStreetNameFromHashKey(crossSt);

// Set the suffix for the road name to the corssing name, or to an empty string if there's no crossing.
suffix = (crossingName != "" && crossingName != "NULL" && crossingName != null) ? "~t~ / " + crossingName : "";
var prefix = currentPos.DistanceToSquared(nodePos) > 1400f ? "~m~Near ~s~" : "~s~";
var suffix = crossSt != 0 ? "~t~ / " + crossName : "";
streetDisplay = prefix + mainName + suffix;

if (heading > 320 || heading < 45) // North
{
headingDisplay = "N";
}
else if (heading >= 45 && heading <= 135) // West
{
headingDisplay = "W";
}
else if (heading > 135 && heading < 225) // South
{
headingDisplay = "S";
}
else // East
{
headingDisplay = "E";
}

await Delay(200);
}
Expand All @@ -753,54 +769,20 @@ private async Task UpdateLocation()
/// </summary>
private void ShowLocation()
{
// Create the default prefix.
var prefix = "~s~";

// If the vehicle node is further away than 1400f, then the player is not near a valid road.
// So we set the prefix to "Near " (<streetname>).
if (Vdist2(currentPos.X, currentPos.Y, currentPos.Z, nodePos.X, nodePos.Y, nodePos.Z) > 1400f)
{
prefix = "~m~Near ~s~";
}

string headingCharacter;

// Heading Facing North
if (heading > 320 || heading < 45)
{
headingCharacter = "N";
}
// Heading Facing West
else if (heading >= 45 && heading <= 135)
{
headingCharacter = "W";
}
// Heading Facing South
else if (heading > 135 && heading < 225)
{
headingCharacter = "S";
}
// Heading Facing East
else
{
headingCharacter = "E";
}

// Draw the street name + crossing.
SetTextWrap(0f, 1f);
DrawTextOnScreen(prefix + World.GetStreetName(currentPos) + suffix, 0.234f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(0.48f, 6) - GetTextScaleHeight(0.48f, 6)/*0.925f - safeZoneSizeY*/, 0.48f);
DrawTextOnScreen(streetDisplay, 0.234f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(0.48f, 6) - GetTextScaleHeight(0.48f, 6)/*0.925f - safeZoneSizeY*/, 0.48f);

// Draw the zone name.
SetTextWrap(0f, 1f);
DrawTextOnScreen(World.GetZoneLocalizedName(currentPos), 0.234f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(0.45f, 6) - GetTextScaleHeight(0.95f, 6)/*0.9485f - safeZoneSizeY*/, 0.45f);
DrawTextOnScreen(zoneDisplay, 0.234f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(0.45f, 6) - GetTextScaleHeight(0.95f, 6)/*0.9485f - safeZoneSizeY*/, 0.45f);

// Draw the left border for the heading character.
SetTextWrap(0f, 1f);
DrawTextOnScreen("~t~|", 0.188f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(1.2f, 6) - GetTextScaleHeight(0.4f, 6)/*0.915f - safeZoneSizeY*/, 1.2f, Alignment.Left);

// Draw the heading character.
SetTextWrap(0f, 1f);
DrawTextOnScreen(headingCharacter, 0.208f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(1.2f, 6) - GetTextScaleHeight(0.4f, 6)/*0.915f - safeZoneSizeY*/, 1.2f, Alignment.Center);
DrawTextOnScreen(headingDisplay, 0.208f + safeZoneSizeX, GetSafeZoneSize() - GetTextScaleHeight(1.2f, 6) - GetTextScaleHeight(0.4f, 6)/*0.915f - safeZoneSizeY*/, 1.2f, Alignment.Center);

// Draw the right border for the heading character.
SetTextWrap(0f, 1f);
Expand Down
20 changes: 19 additions & 1 deletion vMenu/menus/Recording.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -21,12 +21,20 @@ public class Recording

private void CreateMenu()
{
AddTextEntryByHash(0x86F10CE6, "Upload To Cfx.re Forum"); // Replace the "Upload To Social Club" button in gallery
AddTextEntry("ERROR_UPLOAD", "Are you sure you want to upload this photo to Cfx.re forum?"); // Replace the warning message text for uploading

// Create the menu.
menu = new Menu("Recording", "Recording Options");

MenuItem takePic = new MenuItem("Take Photo", "Takes a photo and saves it to the Pause Menu gallery.");
MenuItem openPmGallery = new MenuItem("Open Gallery", "Opens the Pause Menu gallery.");
MenuItem startRec = new MenuItem("Start Recording", "Start a new game recording using GTA V's built in recording.");
MenuItem stopRec = new MenuItem("Stop Recording", "Stop and save your current recording.");
MenuItem openEditor = new MenuItem("Rockstar Editor", "Open the rockstar editor, note you might want to quit the session first before doing this to prevent some issues.");

menu.AddMenuItem(takePic);
menu.AddMenuItem(openPmGallery);
menu.AddMenuItem(startRec);
menu.AddMenuItem(stopRec);
menu.AddMenuItem(openEditor);
Expand All @@ -44,6 +52,16 @@ private void CreateMenu()
StartRecording(1);
}
}
else if (item == openPmGallery)
{
ActivateFrontendMenu((uint)GetHashKey("FE_MENU_VERSION_MP_PAUSE"), true, 3);
}
else if (item == takePic)
{
BeginTakeHighQualityPhoto();
SaveHighQualityPhoto(-1);
FreeMemoryForHighQualityPhoto();
}
else if (item == stopRec)
{
if (!IsRecording())
Expand Down

0 comments on commit 2e633c7

Please sign in to comment.