Skip to content

Commit

Permalink
Use long values for the time
Browse files Browse the repository at this point in the history
Closes #152
  • Loading branch information
justalemon committed Dec 19, 2023
1 parent 9f12ff3 commit cbdf910
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 72 deletions.
16 changes: 7 additions & 9 deletions LemonUI/Elements/ScaledAnim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#elif RAGEMP
using RAGE.Game;
#elif RPH
using Rage.Native;
using Rage;
#elif SHVDN3 || SHVDNC
using GTA;
#endif
Expand All @@ -22,7 +22,7 @@ public class ScaledAnim : ScaledTexture
#region Fields

private float frameRate;
private int start = 0;
private long start = 0;
private int duration;

#endregion
Expand Down Expand Up @@ -107,16 +107,14 @@ public override void Draw()
}

#if ALTV
int time = Alt.Natives.GetGameTimer();
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
int time = Misc.GetGameTimer();
#elif RPH
int time = NativeFunction.CallByHash<int>(0x9CD27B0045628463);
#elif FIVEM || SHVDN3 || SHVDNC
int time = Game.GameTime;
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

int end = start + Duration;
long end = start + Duration;

if (start == 0 || end <= time)
{
Expand Down
14 changes: 6 additions & 8 deletions LemonUI/Menus/NativeMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,14 +1163,12 @@ private void ProcessControls()
return;
}

#if RAGEMP
int time = Misc.GetGameTimer();
#elif ALTV
int time = Alt.Natives.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#else
int time = Game.GameTime;
#if ALTV
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

if (HeldTime > 0 && (upHeld || downHeld || leftHeld || rightHeld))
Expand Down
32 changes: 14 additions & 18 deletions LemonUI/Scaleform/BigMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class BigMessage : BaseScaleform

private MessageType type;
private uint weaponHash;
private uint hideAfter;
private long hideAfter;

#endregion

Expand Down Expand Up @@ -278,28 +278,24 @@ public void FadeOut(int time)

CallFunction("SHARD_ANIM_OUT", 0, time);

#if RAGEMP
uint currentTime = (uint)Misc.GetGameTimer();
#elif ALTV
uint currentTime = (uint)Alt.Natives.GetGameTimer();
#elif RPH
uint currentTime = Game.GameTime;
#else
uint currentTime = (uint)Game.GameTime;
#if ALTV
long currentTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
long currentTime = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long currentTime = Game.GameTime;
#endif
hideAfter = currentTime + (uint)time;
hideAfter = currentTime + time;
}
/// <inheritdoc/>
public override void DrawFullScreen()
{
#if RAGEMP
uint time = (uint)Misc.GetGameTimer();
#elif ALTV
uint time = (uint)Alt.Natives.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#else
uint time = (uint)Game.GameTime;
#if ALTV
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

if (hideAfter > 0 && time > hideAfter)
Expand Down
28 changes: 12 additions & 16 deletions LemonUI/Scaleform/BruteForce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,12 @@ public void Reset()
Word = word;
ShowLives = showLives;

#if RAGEMP
int time = Misc.GetGameTimer();
#elif ALTV
int time = Alt.Natives.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#else
int time = Game.GameTime;
#if ALTV
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

end = TimeSpan.FromMilliseconds(time) + countdown;
Expand Down Expand Up @@ -234,14 +232,12 @@ public void RunProgram(int program)
/// </summary>
public override void Update()
{
#if RAGEMP
int time = Misc.GetGameTimer();
#elif ALTV
int time = Alt.Natives.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#else
int time = Game.GameTime;
#if ALTV
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

// If there is a time set to hide the Hack window
Expand Down
20 changes: 8 additions & 12 deletions LemonUI/Scaleform/Celebration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@ public void Show()
// 333ms going in
// 333ms going out
#if ALTV
int time = Alt.Natives.GetGameTimer();
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
int time = Misc.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#elif FIVEM || SHVDN3 || SHVDNC
int time = Game.GameTime;
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif
showUntil = time + 333 + 333 + (Duration * 1000);
}
Expand Down Expand Up @@ -170,13 +168,11 @@ public override void Process()
DrawFullScreen();

#if ALTV
int time = Alt.Natives.GetGameTimer();
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
int time = Misc.GetGameTimer();
#elif RPH
uint time = Game.GameTime;
#elif FIVEM || SHVDN3 || SHVDNC
int time = Game.GameTime;
long time = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long time = Game.GameTime;
#endif

if (showUntil < time)
Expand Down
14 changes: 5 additions & 9 deletions LemonUI/Scaleform/Countdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ public void Start()
lastStepTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
lastStepTime = Misc.GetGameTimer();
#elif RPH
lastStepTime = Game.GameTime;
#elif FIVEM || SHVDN3 || SHVDNC
#elif FIVEM || RPH || SHVDN3 || SHVDNC
lastStepTime = Game.GameTime;
#endif

Expand All @@ -153,13 +151,11 @@ public override void Process()
if (lastStepTime > 0)
{
#if ALTV
int currentTime = Alt.Natives.GetGameTimer();
long currentTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
int currentTime = Misc.GetGameTimer();
#elif RPH
uint currentTime = Game.GameTime;
#elif FIVEM || SHVDN3 || SHVDNC
int currentTime = Game.GameTime;
long currentTime = Misc.GetGameTimer();
#elif FIVEM || RPH || SHVDN3 || SHVDNC
long currentTime = Game.GameTime;
#endif

if (currentTime - lastStepTime >= 1000)
Expand Down

0 comments on commit cbdf910

Please sign in to comment.