Skip to content

Commit

Permalink
1.2.1 Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
catsmackaroo authored Oct 6, 2023
1 parent c070836 commit 54af378
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 113 deletions.
138 changes: 65 additions & 73 deletions LibertyTweaks/GunMags/WeaponMagazines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class WeaponMagazines
private static float currentReloadAnimTime;
private static bool isAnyGunReloadingAnimPlaying;
private static int magObj1, magObj2;

public static void Init(SettingsFile settings)
{
enableFix = settings.GetBoolean("Main", "Gun Magazines", true);
Expand Down Expand Up @@ -73,8 +73,8 @@ private static void ProcessHandgunReloading(CPed playerPed, int playerPedHandle,
return;

// Handgun / Deagle
bool isHandgunReloading = animController.IsPlaying("gun@handgun", isPlayerDucking ? "reload_crouch" : "reload");
bool isDeagleReloading = animController.IsPlaying("gun@deagle", isPlayerDucking ? "reload_crouch" : "reload");
bool isHandgunReloading = animController.IsPlaying("gun@handgun", isPlayerDucking ? "reload_crouch" : "reload");
bool isDeagleReloading = animController.IsPlaying("gun@deagle", isPlayerDucking ? "reload_crouch" : "reload");

if (isHandgunReloading || isDeagleReloading)
{
Expand Down Expand Up @@ -185,8 +185,8 @@ private static void ProcessUziReloading(CPed playerPed, int playerPedHandle, Ped
if (!enableFix)
return;

bool isUziReloading = animController.IsPlaying("gun@uzi", isPlayerDucking ? "reload_crouch" : "reload");
bool isMp5Reloading = animController.IsPlaying("gun@mp5k", isPlayerDucking ? "reload_crouch" : "p_load");
bool isUziReloading = animController.IsPlaying("gun@uzi", isPlayerDucking ? "reload_crouch" : "reload");
bool isMp5Reloading = animController.IsPlaying("gun@mp5k", isPlayerDucking ? "reload_crouch" : "p_load");

if (isUziReloading || isMp5Reloading)
{
Expand Down Expand Up @@ -292,8 +292,8 @@ private static void ProcessRifleReloading(CPed playerPed, int playerPedHandle, P
if (!enableFix)
return;

bool isRifleReloading = animController.IsPlaying("gun@rifle", isPlayerDucking ? "reload_crouch" : "p_load");
bool isRifle2Reloading = animController.IsPlaying("gun@rifle", isPlayerDucking ? "reload_crouch" : "reload");
bool isRifleReloading = animController.IsPlaying("gun@rifle", isPlayerDucking ? "reload_crouch" : "p_load");
bool isRifle2Reloading = animController.IsPlaying("gun@rifle", isPlayerDucking ? "reload_crouch" : "reload");

if (isRifleReloading || isRifle2Reloading)
{
Expand Down Expand Up @@ -348,7 +348,7 @@ private static void ProcessRPGReloading(CPed playerPed, int playerPedHandle, Ped
return;

bool isRPGReloading = animController.IsPlaying("gun@rocket", isPlayerDucking ? "reload_crouch" : "reload");

if (isRPGReloading)
{
isAnyGunReloadingAnimPlaying = true;
Expand Down Expand Up @@ -378,22 +378,20 @@ private static void ProcessRPGReloading(CPed playerPed, int playerPedHandle, Ped
isAnyGunReloadingAnimPlaying = false;
}
}

public static void LoadFiles()
{
if (!enableFix)
return;

CdStream.CdStreamAddImage("IVSDKDotNet/scripts/LibertyTweaks/WeaponMagazineFiles/mags.img", 1, -1);
CFileLoader.LoadLevel("IVSDKDotNet/scripts/LibertyTweaks/WeaponMagazineFiles/mags.dat", 0);
}
// Below was removed as results were inconsistent. IV Tweaker is required for now
//public static void LoadFiles()
//{
// CdStream.CdStreamAddImage("IVSDKDotNet/scripts/LibertyTweaks/WeaponMagazineFiles/mags.img", 1, -1);
// CFileLoader.LoadLevel("IVSDKDotNet/scripts/LibertyTweaks/WeaponMagazineFiles/mags.dat", 0);
//}

public static void Tick()
{
if (!enableFix)
return;

// If amb_magazine is not in cdimage then return so game will not crash when we try to use this model (Does it even crash?)
// If amb_magazine is not in cdimage then return so game will not crash when we try to use this model
if (!IS_MODEL_IN_CDIMAGE(GET_HASH_KEY("amb_magazine")))
return;

Expand All @@ -403,12 +401,6 @@ public static void Tick()
// Gets the handle of the player ped
int playerPedHandle = playerPed.GetHandle();

// Debug
//if (Helper.IsKeyPressedAsync(System.Windows.Forms.Keys.K))
//NativeGame.TimeScale = 0.15f;
//if (Helper.IsKeyPressedAsync(System.Windows.Forms.Keys.L))
//NativeGame.TimeScale = 1f;

// Gets the current weapon of the player
GET_CURRENT_CHAR_WEAPON(playerPedHandle, out uint currentWeapon);

Expand Down Expand Up @@ -488,56 +480,56 @@ public static void Tick()
break;

// TODO(Clonk): Do episode weapons later...
//case eWeaponType.WEAPON_EPISODIC_1:
// break;
//case eWeaponType.WEAPON_EPISODIC_2:
// break;
//case eWeaponType.WEAPON_EPISODIC_3:
// break;
//case eWeaponType.WEAPON_EPISODIC_4:
// break;
//case eWeaponType.WEAPON_EPISODIC_5:
// break;
//case eWeaponType.WEAPON_EPISODIC_6:
// break;
//case eWeaponType.WEAPON_EPISODIC_7:
// break;
//case eWeaponType.WEAPON_EPISODIC_8:
// break;
//case eWeaponType.WEAPON_EPISODIC_9:
// break;
//case eWeaponType.WEAPON_EPISODIC_10:
// break;
//case eWeaponType.WEAPON_EPISODIC_11:
// break;
//case eWeaponType.WEAPON_EPISODIC_12:
// break;
//case eWeaponType.WEAPON_EPISODIC_13:
// break;
//case eWeaponType.WEAPON_EPISODIC_14:
// break;
//case eWeaponType.WEAPON_EPISODIC_15:
// break;
//case eWeaponType.WEAPON_EPISODIC_16:
// break;
//case eWeaponType.WEAPON_EPISODIC_17:
// break;
//case eWeaponType.WEAPON_EPISODIC_18:
// break;
//case eWeaponType.WEAPON_EPISODIC_19:
// break;
//case eWeaponType.WEAPON_EPISODIC_20:
// break;
//case eWeaponType.WEAPON_EPISODIC_21:
// break;
//case eWeaponType.WEAPON_EPISODIC_22:
// break;
//case eWeaponType.WEAPON_EPISODIC_23:
// break;
//case eWeaponType.WEAPON_EPISODIC_24:
// break;
//case eWeaponType.WEAPON_EPISODIC_1:
// break;
//case eWeaponType.WEAPON_EPISODIC_2:
// break;
//case eWeaponType.WEAPON_EPISODIC_3:
// break;
//case eWeaponType.WEAPON_EPISODIC_4:
// break;
//case eWeaponType.WEAPON_EPISODIC_5:
// break;
//case eWeaponType.WEAPON_EPISODIC_6:
// break;
//case eWeaponType.WEAPON_EPISODIC_7:
// break;
//case eWeaponType.WEAPON_EPISODIC_8:
// break;
//case eWeaponType.WEAPON_EPISODIC_9:
// break;
//case eWeaponType.WEAPON_EPISODIC_10:
// break;
//case eWeaponType.WEAPON_EPISODIC_11:
// break;
//case eWeaponType.WEAPON_EPISODIC_12:
// break;
//case eWeaponType.WEAPON_EPISODIC_13:
// break;
//case eWeaponType.WEAPON_EPISODIC_14:
// break;
//case eWeaponType.WEAPON_EPISODIC_15:
// break;
//case eWeaponType.WEAPON_EPISODIC_16:
// break;
//case eWeaponType.WEAPON_EPISODIC_17:
// break;
//case eWeaponType.WEAPON_EPISODIC_18:
// break;
//case eWeaponType.WEAPON_EPISODIC_19:
// break;
//case eWeaponType.WEAPON_EPISODIC_20:
// break;
//case eWeaponType.WEAPON_EPISODIC_21:
// break;
//case eWeaponType.WEAPON_EPISODIC_22:
// break;
//case eWeaponType.WEAPON_EPISODIC_23:
// break;
//case eWeaponType.WEAPON_EPISODIC_24:
// break;
}
}

}
}
}
11 changes: 1 addition & 10 deletions LibertyTweaks/HolsterWeapons/HolsterWeapons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,7 @@ public static void Process()
GIVE_DELAYED_WEAPON_TO_CHAR(playerId, 0, 1, true);
}
else
{
// This if statement is for MoveWithSniper compatibility
// Need to use GET_CHAR_WEAPON_IN_SLOT or smth
//if (lastWeaponSlot == 16)
//{
// GET_CHAR_WEAPON_IN_SLOT(playerId, 6, out uint pSniper, out uint temp1, out uint temp2);
// SET_CURRENT_CHAR_WEAPON(playerId, pSniper, true);
// CGame.ShowSubtitleMessage(pSniper.ToString());
// //GIVE_DELAYED_WEAPON_TO_CHAR(playerId, 16, 1, true);
//}
{
GIVE_DELAYED_WEAPON_TO_CHAR(playerId, (int)lastWeapon, 1, true);
}
}
Expand Down
2 changes: 1 addition & 1 deletion LibertyTweaks/IceCreamSpeech/IceCreamSpeechFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Credits: ClonkAndre

namespace LibertyTweaks.IceCreamSpeech
namespace LibertyTweaks
{
internal class IceCreamSpeechFix
{
Expand Down
9 changes: 0 additions & 9 deletions LibertyTweaks/ImprovedAI/HigherPedAccuracy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static void Tick(int pedAccuracy, int pedFirerate)
if (!enableFix)
return;

//GET_CURRENT_BASIC_COP_MODEL(out uint copModel);

// Grab all peds
CPool pedPool = CPools.GetPedPool();
Expand All @@ -35,16 +34,8 @@ public static void Tick(int pedAccuracy, int pedFirerate)
{
int pedHandle = (int)pedPool.GetIndex(ptr);

//GET_CHAR_MODEL(pedHandle, out uint pedModel);

SET_CHAR_ACCURACY(pedHandle, (uint)pedAccuracy);
SET_CHAR_SHOOT_RATE(pedHandle, pedFirerate);

//if (pedModel == copModel)
//{
// SET_CHAR_ACCURACY(pedHandle, (uint)Main.GenerateRandomNumber(80, 100));
// SET_CHAR_SHOOT_RATE(pedHandle, Main.GenerateRandomNumber(95, 100));
//}
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions LibertyTweaks/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ private void Main_Initialized(object sender, EventArgs e)
WheelFix.Init(Settings);

// HOTKEYS & CONFIG
quickSaveKey = Settings.GetKey("HOTKEYS", "Quick Save Key", Keys.F9);
holsterKey = Settings.GetKey("HOTKEYS", "Holster Key", Keys.H);
fovMulti = Settings.GetFloat("SETTINGS", "Field of View Modifier", 1.07f);
pedAccuracy = Settings.GetInteger("SETTINGS", "Ped Accuracy", 85);
pedFirerate = Settings.GetInteger("SETTINGS", "Ped Firerate", 85);
quickSaveKey = Settings.GetKey("Hotkeys", "Quick Save Key", Keys.F9);
holsterKey = Settings.GetKey("Hotkeys", "Holster Key", Keys.H);
fovMulti = Settings.GetFloat("Settings", "Field of View Modifier", 1.07f);
pedAccuracy = Settings.GetInteger("Settings", "Ped Accuracy", 85);
pedFirerate = Settings.GetInteger("Settings", "Ped Firerate", 85);

}

Expand Down
13 changes: 3 additions & 10 deletions LibertyTweaks/MoveWithSniper/MoveWithSniper.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using CCL.GTAIV;
using CCL.GTAIV;

using IVSDKDotNet;
using static IVSDKDotNet.Native.Natives;

// Credits: catsmackaroo

namespace LibertyTweaks.MoveWithSniper
namespace LibertyTweaks
{
internal class MoveWithSniper
{
Expand Down Expand Up @@ -40,7 +33,7 @@ public static void Tick()
{
if (NativeControls.IsGameKeyPressed(0, GameKey.Aim))
{
CWeaponInfo.GetWeaponInfo(currentWeapon).Slot = 15;
CWeaponInfo.GetWeaponInfo(currentWeapon).Slot = 16;
}
else if (!NativeControls.IsGameKeyPressed(0, GameKey.Aim))
{
Expand Down
2 changes: 1 addition & 1 deletion LibertyTweaks/NoOvertaking/NoOvertaking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Credits: AssaultKifle47, catsmackaroo & ClonkAndre

namespace LibertyTweaks.NoOvertaking
namespace LibertyTweaks
{
internal class NoOvertaking
{
Expand Down
2 changes: 1 addition & 1 deletion LibertyTweaks/RemoveWeaponsOnDeath/RemoveWeapons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Credits: ClonkAndre

namespace LibertyTweaks.RemoveWeapons
namespace LibertyTweaks
{
internal class RemoveWeapons
{
Expand Down
2 changes: 1 addition & 1 deletion LibertyTweaks/TweakableFOV/TweakableFOV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// Credits: catsmackaroo, ClonkAndre

namespace LibertyTweaks.TweakableFOV
namespace LibertyTweaks
{
internal class TweakableFOV
{
Expand Down
4 changes: 2 additions & 2 deletions LibertyTweaks/WheelFix/WheelFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Credits: ClonkAndre

namespace LibertyTweaks.WheelFix
namespace LibertyTweaks
{
internal class WheelFix
{
Expand All @@ -17,7 +17,7 @@ internal class WheelFix

public static void Init(SettingsFile settings)
{
enableFix = settings.GetBoolean("Main", "Wheel Fix", true);
enableFix = settings.GetBoolean("Fixes", "Wheel Fix", true);
}

public static void PreChecks()
Expand Down

0 comments on commit 54af378

Please sign in to comment.