Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SHVDN nightly #70

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RageCoop.Client/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static string Dump(this Dictionary<TimeStamp, long> d)
public static void ShowTimeStamps()
{
GTA.UI.Notification.Hide(_lastNfHandle);
_lastNfHandle = GTA.UI.Notification.Show(Debug.TimeStamps.Dump());
_lastNfHandle = GTA.UI.Notification.PostTicker(TimeStamps.Dump(), false).Handle;

}
}
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/DevTools/DevTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static void CopyToClipboard(MuzzleDir dir)
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
GTA.UI.Notification.Show("Copied to clipboard, please paste it on the GitHub issue page!");
GTA.UI.Notification.PostTicker("Copied to clipboard, please paste it on the GitHub issue page!", false);
}
}

Expand Down
10 changes: 5 additions & 5 deletions RageCoop.Client/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
catch
{
GTA.UI.Notification.Show("Malformed configuration, overwriting with default values...");
GTA.UI.Notification.PostTicker("Malformed configuration, overwriting with default values...", false);
Settings = new Settings();
Util.SaveSettings();
}
Expand All @@ -79,7 +79,7 @@
}
if (!_gameLoaded)
{
GTA.UI.Notification.Show("~r~Please update your GTA5 to v1.0.1290 or newer!", true);
GTA.UI.Notification.PostTicker("~r~Please update your GTA5 to v1.0.1290 or newer!", true);
_gameLoaded = true;
}
};
Expand Down Expand Up @@ -117,7 +117,7 @@
else if (!_gameLoaded && (_gameLoaded = true))
{
#if !NON_INTERACTIVE
GTA.UI.Notification.Show(GTA.UI.NotificationIcon.AllPlayersConf, "RAGECOOP", "Welcome!", $"Press ~g~{Main.Settings.MenuKey}~s~ to open the menu.");
GTA.UI.Notification.PostMessageText($"Press ~g~{Settings.MenuKey}~s~ to open the menu.", new GTA.Graphics.TextureAsset("CHAR_ALL_PLAYERS_CONF", "CHAR_ALL_PLAYERS_CONF"), false, GTA.UI.FeedTextIcon.Message, "RAGECOOP", "Welcome!");
#endif
}

Expand All @@ -139,7 +139,7 @@
{
EntityPool.DoSync();
}
catch (Exception ex)

Check warning on line 142 in RageCoop.Client/Main.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used

Check warning on line 142 in RageCoop.Client/Main.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used
{
#if DEBUG
Main.Logger.Error(ex);
Expand Down Expand Up @@ -304,7 +304,7 @@
Function.Call(Hash.SET_ENABLE_VEHICLE_SLIPSTREAMING, true);
CoopMenu.ConnectedMenuSetting();
MainChat.Init();
GTA.UI.Notification.Show("~g~Connected!");
GTA.UI.Notification.PostTicker("~g~Connected!", false);
});

Logger.Info(">> Connected <<");
Expand All @@ -327,7 +327,7 @@
Function.Call(Hash.SET_ENABLE_VEHICLE_SLIPSTREAMING, false);
CoopMenu.DisconnectedMenuSetting();
if (reason != "Abort")
GTA.UI.Notification.Show("~r~Disconnected: " + reason);
GTA.UI.Notification.PostTicker("~r~Disconnected: " + reason, false);
LocalPlayerID = default;
});
Memory.RestorePatches();
Expand All @@ -348,7 +348,7 @@
QueuedActions.Remove(action);
}
}
catch (Exception ex)

Check warning on line 351 in RageCoop.Client/Main.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used

Check warning on line 351 in RageCoop.Client/Main.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used
{
#if DEBUG
Logger.Error(ex);
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Menus/CoopMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static bool ShowPopUp(string prompt, string title, string subtitle, strin
Game.DisableAllControlsThisFrame();
MenuPool.Process();

var scaleform = new Scaleform("instructional_buttons");
var scaleform = Scaleform.RequestMovie("instructional_buttons");
scaleform.CallFunction("CLEAR_ALL");
scaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);
scaleform.CallFunction("CREATE_CONTAINER");
Expand Down
6 changes: 3 additions & 3 deletions RageCoop.Client/Menus/Sub/ServersMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static void GetAllServers()
if (server.useZT)
{
address = $"{server.ztAddress}:{server.port}";
Notification.Show($"~y~Joining ZeroTier network... {server.ztID}");
Notification.PostTicker($"~y~Joining ZeroTier network... {server.ztID}", false);
if (ZeroTierHelper.Join(server.ztID) == null)
{
throw new Exception("Failed to obtain ZeroTier network IP");
Expand All @@ -102,10 +102,10 @@ private static void GetAllServers()
}
catch (Exception ex)
{
Notification.Show($"~r~{ex.Message}");
Notification.PostTicker($"~r~{ex.Message}", false);
if (server.useZT)
{
Notification.Show($"Make sure ZeroTier is correctly installed, download it from https://www.zerotier.com/");
Notification.PostTicker($"Make sure ZeroTier is correctly installed, download it from https://www.zerotier.com/", false);
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Networking/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private bool Hidden

public Chat()
{
MainScaleForm = new Scaleform("multiplayer_chat");
MainScaleForm = Scaleform.RequestMovie("multiplayer_chat");
}

public void Init()
Expand Down
10 changes: 5 additions & 5 deletions RageCoop.Client/Networking/Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
_publicKeyReceived.Set();
IsConnecting = false;
Main.QueueAction(() => Notification.Show("Connection has been canceled"));
Main.QueueAction(() => Notification.PostTicker("Connection has been canceled", false));
Peer?.Shutdown("Bye");
}
else if (IsOnServer)
Expand Down Expand Up @@ -97,14 +97,14 @@
Peer.OnMessageReceived += (s, m) =>
{
try { ProcessMessage(m); }
catch (Exception ex)

Check warning on line 100 in RageCoop.Client/Networking/Networking.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used

Check warning on line 100 in RageCoop.Client/Networking/Networking.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used
{
#if DEBUG
Main.Logger.Error(ex);
#endif
}
};
Main.QueueAction(() => { Notification.Show($"~y~Trying to connect..."); });
Main.QueueAction(() => { Notification.PostTicker($"~y~Trying to connect...", false); });
Menus.CoopMenu._serverConnectItem.Enabled = false;
Security.Regen();
if (publicKey == null)
Expand Down Expand Up @@ -139,7 +139,7 @@
catch (Exception ex)
{
Main.Logger.Error("Cannot connect to server: ", ex);
Main.QueueAction(() => Notification.Show("Cannot connect to server: " + ex.Message));
Main.QueueAction(() => Notification.PostTicker("Cannot connect to server: " + ex.Message, false));
}
IsConnecting = false;
});
Expand All @@ -159,7 +159,7 @@

Main.Logger.Debug($"player connected:{p.Username}");
Main.QueueAction(() =>
GTA.UI.Notification.Show($"~h~{p.Username}~h~ connected."));
Notification.PostTicker($"~h~{p.Username}~h~ connected.", false));
}
private static void PlayerDisconnect(Packets.PlayerDisconnect packet)
{
Expand All @@ -169,7 +169,7 @@
Main.QueueAction(() =>
{
EntityPool.RemoveAllFromPlayer(packet.PedID);
GTA.UI.Notification.Show($"~h~{player.Username}~h~ left.");
Notification.PostTicker($"~h~{player.Username}~h~ left.", false);
});
}

Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Networking/Send.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static void SendVehicle(SyncedVehicle v, bool full)
packet.Position = veh.ReadPosition();
packet.Velocity = veh.Velocity;
packet.Quaternion = veh.ReadQuaternion();
packet.RotationVelocity = veh.RotationVelocity;
packet.RotationVelocity = veh.LocalRotationVelocity;
packet.ThrottlePower = veh.ThrottlePower;
packet.BrakePower = veh.BrakePower;
v.LastSentStopWatch.Restart();
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/PlayerList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class PlayerList
{
private const float LEFT_POSITION = 0.122f;
private const float RIGHT_POSITION = 0.9f;
private static readonly Scaleform _mainScaleform = new Scaleform("mp_mm_card_freemode");
private static readonly Scaleform _mainScaleform = Scaleform.RequestMovie("mp_mm_card_freemode");
private static ulong _lastUpdate = Util.GetTickCount64();
public static ulong Pressed { get; set; }

Expand Down
9 changes: 5 additions & 4 deletions RageCoop.Client/Scripting/BaseScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override void OnStart()
API.RegisterCustomEventHandler(CustomEvents.UpdatePedBlip, UpdatePedBlip);
API.RegisterCustomEventHandler(CustomEvents.IsHost, (e) => { _isHost = (bool)e.Args[0]; });
API.RegisterCustomEventHandler(CustomEvents.WeatherTimeSync, WeatherTimeSync);
API.RegisterCustomEventHandler(CustomEvents.OnPlayerDied, (e) => { GTA.UI.Notification.Show((string)e.Args[0]); });
API.RegisterCustomEventHandler(CustomEvents.OnPlayerDied, (e) => { GTA.UI.Notification.PostTicker((string)e.Args[0], false); });
Task.Run(() =>
{
while (true)
Expand All @@ -42,12 +42,11 @@ public override void OnStart()
{
unsafe
{
var time = World.CurrentTimeOfDay;
int weather1 = default(int);
int weather2 = default(int);
float percent2 = default(float);
Function.Call(Hash.GET_CURR_WEATHER_STATE, &weather1, &weather2, &percent2);
API.SendCustomEvent(CustomEvents.WeatherTimeSync, time.Hours, time.Minutes, time.Seconds, weather1, weather2, percent2);
API.SendCustomEvent(CustomEvents.WeatherTimeSync, GTA.Chrono.GameClock.Hour, GTA.Chrono.GameClock.Minute, GTA.Chrono.GameClock.Second, weather1, weather2, percent2);
}
});
}
Expand All @@ -59,7 +58,9 @@ public override void OnStart()

private void WeatherTimeSync(CustomEventReceivedArgs e)
{
World.CurrentTimeOfDay = new TimeSpan((int)e.Args[0], (int)e.Args[1], (int)e.Args[2]);
GTA.Chrono.GameClock.Hour = (int)e.Args[0];
GTA.Chrono.GameClock.Minute = (int)e.Args[1];
GTA.Chrono.GameClock.Second = (int)e.Args[2];
Function.Call(Hash.SET_CURR_WEATHER_STATE, (int)e.Args[3], (int)e.Args[4], (float)e.Args[5]);
}

Expand Down
23 changes: 11 additions & 12 deletions RageCoop.Client/Sync/Entities/Ped/SyncedPed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal SyncedPed(Ped p)
OwnerID = Main.LocalPlayerID;

//Function.Call(Hash.SET_PED_IS_IGNORED_BY_AUTO_OPEN_DOORS, false);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableHurt, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisableHurt, true);
// MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableMelee, true);

}
Expand Down Expand Up @@ -245,16 +245,15 @@ private bool CreateCharacter()
Function.Call(Hash.SET_PED_IS_IGNORED_BY_AUTO_OPEN_DOORS, false);
Function.Call(Hash.SET_PED_CAN_EVASIVE_DIVE, MainPed.Handle, false);

MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DrownsInWater, false);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableHurt, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableExplosionReactions, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_AvoidTearGas, false);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_IgnoreBeingOnFire, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableEvasiveDives, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisablePanicInVehicle, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_BlockNonTemporaryEvents, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableShockingEvents, true);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableHurt, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DrownsInWater, false);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisableHurt, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisableExplosionReactions, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.AvoidTearGas, false);
MainPed.SetConfigFlag(PedConfigFlagToggles.IgnoreBeingOnFire, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisableEvasiveDives, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisablePanicInVehicle, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.BlockNonTemporaryEvents, true);
MainPed.SetConfigFlag(PedConfigFlagToggles.DisableShockingEvents, true);

SetClothes();

Expand Down Expand Up @@ -546,7 +545,7 @@ private void DisplayAiming()
{
if (Velocity == default)
{
MainPed.Task.AimAt(AimCoords, 1000);
MainPed.Task.AimGunAtPosition(AimCoords, 1000);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions RageCoop.Client/Sync/Entities/Vehicle/SyncedVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal override void Update()

if (LightsOn != MainVehicle.AreLightsOn)
{
MainVehicle.AreLightsOn = LightsOn;
MainVehicle.SetScriptedLightSetting(LightsOn ? ScriptedVehicleLightSetting.SetVehicleLightsOn : ScriptedVehicleLightSetting.SetVehicleLightsOff);
}

if (HighBeamsOn != MainVehicle.AreHighBeamsOn)
Expand Down Expand Up @@ -285,10 +285,10 @@ private void DisplayVehicle()
if (IsFlipped || (calirot = GetCalibrationRotation()).Length() > 50)
{
MainVehicle.Quaternion = Quaternion.Slerp(MainVehicle.ReadQuaternion(), Quaternion, 0.5f);
MainVehicle.RotationVelocity = RotationVelocity;
MainVehicle.LocalRotationVelocity = RotationVelocity;
return;
}
MainVehicle.RotationVelocity = RotationVelocity + calirot * 0.2f;
MainVehicle.LocalRotationVelocity = RotationVelocity + calirot * 0.2f;
}
private Vector3 GetCalibrationRotation()
{
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Sync/SyncEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static void HandleBulletShot(Vector3 start, Vector3 end, uint weaponHash
_lastWeaponHash = weaponHash;
}
if (!_weaponAsset.IsLoaded) { _weaponAsset.Request(); }
World.ShootBullet(start, end, p, _weaponAsset, (int)p.GetWeaponDamage(weaponHash));
World.ShootSingleBullet(start, end, (int)p.GetWeaponDamage(weaponHash), _weaponAsset, p);
Prop w;
if (((w = p.Weapons.CurrentWeaponObject) != null) && (p.VehicleWeapon == VehicleWeaponHash.Invalid))
{
Expand Down
4 changes: 2 additions & 2 deletions RageCoop.Client/Util/Memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static Memory()
{
// Weapon/radio wheel slow-mo patch
// Thanks @CamxxCore, https://github.com/CamxxCore/GTAVWeaponWheelMod
var result = NativeMemory.FindPattern("\x38\x51\x64\x74\x19", "xxxxx");
var result = MemScanner.FindPatternBmh("\x38\x51\x64\x74\x19", "xxxxx");
if (result == null) { throw new NotSupportedException("Can't find memory pattern to patch weapon/radio slow-mo"); }
var address = result + 26;
address = address + *(int*)address + 4u;
Expand Down Expand Up @@ -91,7 +91,7 @@ public static List<int> FindOffset(float toSearch, IntPtr start, int range = 100
var foundOffsets = new List<int>(100);
for (int i = 0; i <= range; i++)
{
var val = NativeMemory.ReadFloat(start + i);
var val = MemDataMarshal.ReadFloat(start + i);
if (Math.Abs(val - toSearch) < tolerance)
{
foundOffsets.Add(i);
Expand Down
6 changes: 3 additions & 3 deletions RageCoop.Client/Util/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
}
return true;
}
catch (Exception ex)

Check warning on line 154 in RageCoop.Client/Util/Util.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used

Check warning on line 154 in RageCoop.Client/Util/Util.cs

View workflow job for this annotation

GitHub Actions / build (6.0.x)

The variable 'ex' is declared but never used
{
return false;
// GTA.UI.Notification.Show("Error saving player settings: " + ex.Message);
Expand Down Expand Up @@ -201,7 +201,7 @@
return v;
}

public static void ApplyForce(this Entity e, int boneIndex, Vector3 direction, Vector3 rotation = default(Vector3), ForceType forceType = ForceType.MaxForceRot2)
public static void ApplyForce(this Entity e, int boneIndex, Vector3 direction, Vector3 rotation = default(Vector3), ForceType forceType = ForceType.ExternalImpulse)
{
Function.Call(Hash.APPLY_FORCE_TO_ENTITY, e.Handle, forceType, direction.X, direction.Y, direction.Z, rotation.X, rotation.Y, rotation.Z, boneIndex, false, true, true, false, true);
}
Expand Down Expand Up @@ -244,7 +244,7 @@
}
lineList.Add("ReloadKey=Insert");
File.WriteAllLines("ScriptHookVDotNet.ini", lineList.ToArray());
GTA.UI.Notification.Show("Reload cannot be performed automatically, please type \"Reload()\" manually in the SHVDN console.");
GTA.UI.Notification.PostTicker("Reload cannot be performed automatically, please type \"Reload()\" manually in the SHVDN console.", false);
}
Keys key = (Keys)Enum.Parse(typeof(Keys), reloadKey, true);

Expand All @@ -259,7 +259,7 @@
}
catch (Exception ex)
{
GTA.UI.Notification.Show(ex.Message);
GTA.UI.Notification.PostTicker(ex.Message, false);
}

PostMessage(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, WM_KEYDOWN, (int)key, 0);
Expand Down
Binary file modified libs/ScriptHookVDotNet.dll
Binary file not shown.
Binary file modified libs/ScriptHookVDotNet3.dll
Binary file not shown.
Loading