feat: Add full bright
This commit is contained in:
1 parent
73a90f47f1
commit
a9081d28d9
8 files changed
+47
-2
No files matched your search
@@ -70,6 +70,7 @@ public static class Hotkeys
|
||||
Toggle("Visuals", "BiomeSight", "Biome Sight", () => Settings.BiomeSight, v => Settings.BiomeSight = v),
|
||||
Toggle("Visuals", "NightOwl", "Night Owl", () => Settings.NightOwl, v => Settings.NightOwl = v),
|
||||
Toggle("Visuals", "Shine", "Shine", () => Settings.Shine, v => Settings.Shine = v),
|
||||
Toggle("Visuals", "FullBright", "Full Bright", () => Settings.FullBright, v => Settings.FullBright = v),
|
||||
|
||||
Toggle("World", "FreezeTime", "Freeze Time", () => Settings.FreezeTime, v => Settings.FreezeTime = v),
|
||||
Toggle("World", "SpawnRate", "Spawn Rate", () => Settings.SpawnRateBoost, v => Settings.SpawnRateBoost = v),
|
||||
|
||||
@@ -116,6 +116,7 @@ public static partial class Settings
|
||||
[nameof(NightOwl)] = "Vision.NightOwl",
|
||||
[nameof(DangerSense)] = "Vision.DangerSense",
|
||||
[nameof(BiomeSight)] = "Vision.BiomeSight",
|
||||
[nameof(FullBright)] = "Vision.FullBright",
|
||||
|
||||
[nameof(FreezeTime)] = "World.FreezeTime",
|
||||
[nameof(SpawnRateBoost)] = "World.SpawnRate.Enabled",
|
||||
|
||||
@@ -48,7 +48,7 @@ public static partial class Settings
|
||||
public static Color ColLocal = Color.White, ColPlayers = new(70, 200, 255), ColHostile = new(235, 60, 60), ColCritters = new(200, 170, 120), ColTown = new(80, 220, 110), ColBoss = new(255, 120, 40), ColItems = new(255, 210, 70), ColProjHostile = new(255, 80, 200), ColProjFriendly = new(120, 160, 255), ColWaypoint = new(220, 90, 255);
|
||||
public static bool DamageMelee, DamageRanged, DamageMagic, DamageSummon;
|
||||
public static Color ColDamageMelee = new(255, 110, 60), ColDamageRanged = new(120, 230, 90), ColDamageMagic = new(90, 150, 255), ColDamageSummon = new(200, 110, 255);
|
||||
public static bool Spelunker, Hunter, Shine, NightOwl, DangerSense, BiomeSight;
|
||||
public static bool Spelunker, Hunter, Shine, NightOwl, DangerSense, BiomeSight, FullBright;
|
||||
|
||||
public static bool FreezeTime, SpawnRateBoost;
|
||||
public static float SpawnRateMult = 5f;
|
||||
|
||||
@@ -22,6 +22,7 @@ internal sealed class HookRegistry : IDisposable
|
||||
PlayerPatches.Install(hooks);
|
||||
NpcPatches.Install(hooks);
|
||||
DamageNumberPatches.Install(hooks);
|
||||
VisionPatches.Install(hooks);
|
||||
SpawnRatePatch.Install(hooks);
|
||||
ItemCheckShootPatch.Install(hooks);
|
||||
SandboxGuards.Install(hooks);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Mono.Cecil.Cil;
|
||||
using MonoMod.Cil;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Light;
|
||||
using TerraSharp.Core;
|
||||
|
||||
namespace TerraSharp.Patches;
|
||||
|
||||
internal static class VisionPatches
|
||||
{
|
||||
internal static void Install(HookRegistry hooks)
|
||||
{
|
||||
FullBrightPatch.Install(hooks);
|
||||
}
|
||||
}
|
||||
|
||||
// Every Lighting query reaches the active engine's GetColor, millions of times per frame, so the check is a bare field load.
|
||||
internal static class FullBrightPatch
|
||||
{
|
||||
internal static void Install(HookRegistry hooks)
|
||||
{
|
||||
hooks.Modify(HookRegistry.Method(typeof(LightingEngine), nameof(LightingEngine.GetColor)), ReturnWhite);
|
||||
hooks.Modify(HookRegistry.Method(typeof(LegacyLighting), nameof(LegacyLighting.GetColor)), ReturnWhite);
|
||||
}
|
||||
|
||||
static void ReturnWhite(ILContext context)
|
||||
{
|
||||
var cursor = new ILCursor(context);
|
||||
ILLabel body = cursor.DefineLabel();
|
||||
cursor.Emit(OpCodes.Ldsfld, typeof(Settings).GetField(nameof(Settings.FullBright))!);
|
||||
cursor.Emit(OpCodes.Brfalse, body);
|
||||
cursor.Emit(OpCodes.Call, typeof(Vector3).GetProperty(nameof(Vector3.One))!.GetGetMethod()!);
|
||||
cursor.Emit(OpCodes.Ret);
|
||||
cursor.Emit(OpCodes.Nop);
|
||||
body.Target = cursor.Prev;
|
||||
}
|
||||
}
|
||||
@@ -185,6 +185,9 @@ public sealed partial class MainWindow
|
||||
ToggleColor("Melee", ref Settings.DamageMelee, ref Settings.ColDamageMelee, nameof(Settings.ColDamageMelee));
|
||||
ToggleColor("Ranged", ref Settings.DamageRanged, ref Settings.ColDamageRanged, nameof(Settings.ColDamageRanged));
|
||||
ToggleColor("Summon", ref Settings.DamageSummon, ref Settings.ColDamageSummon, nameof(Settings.ColDamageSummon));
|
||||
|
||||
Group("View");
|
||||
Toggle("Full Bright", ref Settings.FullBright);
|
||||
}
|
||||
|
||||
void WorldPage()
|
||||
|
||||
@@ -55,6 +55,7 @@ public sealed partial class MainWindow
|
||||
["Night Owl"] = "Brightens dark areas.",
|
||||
["Danger Sense"] = "Makes traps and hazards glow.",
|
||||
["Biome Sight"] = "Makes Corruption, Crimson and Hallow blocks glow.",
|
||||
["Full Bright"] = "Lights everything at full brightness.",
|
||||
["Full Heal"] = "Refills health and mana.",
|
||||
["TP to Spawn"] = "Recalls like a Magic Mirror: to your bed if set, otherwise the world's spawn point.",
|
||||
["Reset Learned Ballistics"] = "Clears learned projectile data. Learns it again as you shoot.",
|
||||
|
||||
@@ -34,7 +34,7 @@ public sealed partial class MainWindow : Window
|
||||
new Page("Movement", MovementPage, () => Count(Settings.Fly, Settings.SuperSpeed, Settings.HighJump, Settings.GravityFlip, Settings.NoFallDamage, Settings.LavaImmune, Settings.WaterWalk, Settings.NoKnockback, Settings.ExtendedReach)),
|
||||
new Page("Combat", CombatPage, () => Count(Settings.RapidAttack, Settings.AutoSwing, Settings.DamageBoost, Settings.NoManaCost, Settings.NoSpread, Settings.Aimbot, Settings.AutoAttack, Settings.KillAura, Settings.HitMagnet, Settings.FreezeEnemies, Settings.WeakenEnemies)),
|
||||
new Page("Items", ItemsPage, () => Count(Settings.InstantBreak, Settings.InfItems, Settings.ItemVacuum, Settings.AutoFish, Settings.Sonar)),
|
||||
new Page("Visuals", VisualsPage, () => Count(Settings.Esp, Settings.Spelunker, Settings.Hunter, Settings.Shine, Settings.NightOwl, Settings.DangerSense, Settings.BiomeSight)),
|
||||
new Page("Visuals", VisualsPage, () => Count(Settings.Esp, Settings.Spelunker, Settings.Hunter, Settings.Shine, Settings.NightOwl, Settings.DangerSense, Settings.BiomeSight, Settings.FullBright)),
|
||||
new Page("World", WorldPage, () => Count(Settings.FreezeTime, Settings.SpawnRateBoost)),
|
||||
new Page("Keys", KeysPage, () => 0),
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user