diff --git a/1.3/Assemblies/CameraPlus.dll b/1.3/Assemblies/CameraPlus.dll index fd43d35..85cb8a1 100644 Binary files a/1.3/Assemblies/CameraPlus.dll and b/1.3/Assemblies/CameraPlus.dll differ diff --git a/About/Manifest.xml b/About/Manifest.xml index 1b594bf..adf2c20 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@  net.pardeike.rimworld.mod.cameraplus - 2.2.0.0 + 2.2.1.0
  • 1.0.0
  • 1.1.0
  • diff --git a/Source/CameraDelegates.cs b/Source/CameraDelegates.cs new file mode 100644 index 0000000..54ecc58 --- /dev/null +++ b/Source/CameraDelegates.cs @@ -0,0 +1,39 @@ +using HarmonyLib; +using System; +using System.Linq.Expressions; +using System.Reflection; +using UnityEngine; +using Verse; + +namespace CameraPlus +{ + class CameraDelegates + { + public Func GetCameraColors = null; + public Func GetCameraMarkers = null; + + static MethodInfo GetMethod(Pawn pawn, string name) + { + return pawn.GetType().Assembly + .GetType("CameraPlusSupport.Methods", false)? + .GetMethod(name, AccessTools.all); + } + + public CameraDelegates(Pawn pawn) + { + var m_GetCameraColors = GetMethod(pawn, "GetCameraPlusColors"); + if (m_GetCameraColors != null) + { + var funcType = Expression.GetFuncType(new[] { typeof(Pawn), typeof(Color[]) }); + GetCameraColors = (Func)Delegate.CreateDelegate(funcType, m_GetCameraColors); + } + + var m_GetCameraTextures = GetMethod(pawn, "GetCameraPlusMarkers"); + if (m_GetCameraTextures != null) + { + var funcType = Expression.GetFuncType(new[] { typeof(Pawn), typeof(Texture2D[]) }); + GetCameraMarkers = (Func)Delegate.CreateDelegate(funcType, m_GetCameraTextures); + } + } + } +} diff --git a/Source/CameraPlus.csproj b/Source/CameraPlus.csproj index 2fb2c46..73936da 100644 --- a/Source/CameraPlus.csproj +++ b/Source/CameraPlus.csproj @@ -1,4 +1,4 @@ - + {AC5EE7A1-16EA-498D-B21A-83ACF78F0E5A} @@ -10,7 +10,7 @@ ..\1.3\Assemblies\ true false - 2.2.0.0 + 2.2.1.0 Copyright Andreas Pardeike @@ -30,9 +30,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -67,15 +67,17 @@ - echo Postprocessing -where ModBuilder 2> nul | find /i "ModBuilder.exe" -if not errorlevel 1 ( - ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll" -save "$(MSBuildProjectName)-version" - ModBuilder XMLPut -file "$(MSBuildProjectDirectory)\..\About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}" -) -if defined INSTALL_MOD ( - "%INSTALL_MOD%" "$(Configuration)" "$(MSBuildProjectDirectory)\..\" "$(MSBuildProjectName)" "1.1 1.2 1.3 About Assemblies Languages Textures" "LoadFolders.xml" -) + + echo Postprocessing + where ModBuilder 2> nul | find /i "ModBuilder.exe" + if not errorlevel 1 ( + ModBuilder AssemblyVersion -file "$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll" -save "$(MSBuildProjectName)-version" + ModBuilder XMLPut -file "$(MSBuildProjectDirectory)\..\About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}" + ) + if defined INSTALL_MOD ( + "%INSTALL_MOD%" "$(Configuration)" "$(MSBuildProjectDirectory)\..\" "$(MSBuildProjectName)" "1.1 1.2 1.3 About Assemblies Languages Textures" "LoadFolders.xml" + ) + Brrainz Andreas Pardeike @@ -84,4 +86,4 @@ if defined INSTALL_MOD ( Camera+ - \ No newline at end of file + diff --git a/Source/Extensions.cs b/Source/Extensions.cs new file mode 100644 index 0000000..9966172 --- /dev/null +++ b/Source/Extensions.cs @@ -0,0 +1,43 @@ +using System; +using UnityEngine; +using Verse; + +namespace CameraPlus +{ + static class Extensions + { + public static void Slider(this Listing_Standard list, ref int value, int min, int max, Func label) + { + float f = value; + var h = HorizontalSlider(list.GetRect(22f), ref f, min, max, label == null ? null : label(), 1f); + value = (int)f; + list.Gap(h); + } + + public static void Slider(this Listing_Standard list, ref float value, float min, float max, Func label, float roundTo = -1f) + { + var rect = list.GetRect(22f); + var h = HorizontalSlider(rect, ref value, min, max, label == null ? null : label(), roundTo); + list.Gap(h); + } + + public static float HorizontalSlider(Rect rect, ref float value, float leftValue, float rightValue, string label = null, float roundTo = -1f) + { + if (label != null) + { + var anchor = Text.Anchor; + var font = Text.Font; + Text.Font = GameFont.Tiny; + Text.Anchor = TextAnchor.UpperLeft; + Widgets.Label(rect, label); + Text.Anchor = anchor; + Text.Font = font; + rect.y += 18f; + } + value = GUI.HorizontalSlider(rect, value, leftValue, rightValue); + if (roundTo > 0f) + value = Mathf.RoundToInt(value / roundTo) * roundTo; + return 4f + label != null ? 18f : 0f; + } + } +} diff --git a/Source/Main.cs b/Source/Main.cs index 6617bc5..7b2ddf5 100644 --- a/Source/Main.cs +++ b/Source/Main.cs @@ -145,19 +145,10 @@ static bool Prefix(Pawn ___pawn) if (CameraPlusMain.skipCustomRendering) return true; - var cameraDelegate = Tools.GetCachedCameraDelegate(___pawn); - if (cameraDelegate.GetCameraColors == null) - { - if (CameraPlusMain.Settings.customNameStyle == LabelStyle.HideAnimals) - return true; - } - - if (Tools.PawnHasNoLabel(___pawn)) - return true; - - return Tools.ShouldShowBody(___pawn); + return Tools.ShouldShowDot(___pawn) == false; } + [HarmonyPriority(10000)] static void Postfix(Pawn ___pawn) { if (CameraPlusMain.Settings.hideNamesWhenZoomedOut && CameraPlusMain.Settings.customNameStyle != LabelStyle.HideAnimals) @@ -168,18 +159,19 @@ static void Postfix(Pawn ___pawn) [HarmonyPatch(typeof(PawnUIOverlay), nameof(PawnUIOverlay.DrawPawnGUIOverlay))] static class PawnUIOverlay_DrawPawnGUIOverlay_Patch { - static AnimalNameDisplayMode AnimalNameMode() - { - if (CameraPlusMain.Settings.includeNotTamedAnimals) - return AnimalNameDisplayMode.TameAll; - return Prefs.AnimalNameMode; - } - + // fake everything being humanlike so Prefs.AnimalNameMode is ignored (we handle it ourselves) public static IEnumerable Transpiler(IEnumerable instructions) { - var from = AccessTools.PropertyGetter(typeof(Prefs), nameof(Prefs.AnimalNameMode)); - var into = SymbolExtensions.GetMethodInfo(() => AnimalNameMode()); - return Transpilers.MethodReplacer(instructions, from, into); + var mHumanlike = AccessTools.PropertyGetter(typeof(RaceProperties), nameof(RaceProperties.Humanlike)); + foreach (var code in instructions) + { + yield return code; + if (code.Calls(mHumanlike)) + { + yield return new CodeInstruction(OpCodes.Pop); + yield return new CodeInstruction(OpCodes.Ldc_I4_1); + } + } } [HarmonyPriority(10000)] @@ -188,9 +180,6 @@ public static bool Prefix(Pawn ___pawn) if (CameraPlusMain.skipCustomRendering) return true; - if (CameraPlusMain.Settings.includeNotTamedAnimals == false) - return true; - if (!___pawn.Spawned || ___pawn.Map.fogGrid.IsFogged(___pawn.Position)) return true; if (___pawn.RaceProps.Humanlike) @@ -198,63 +187,23 @@ public static bool Prefix(Pawn ___pawn) if (___pawn.Name != null) return true; - return GenMapUI_DrawPawnLabel_Patch.HandlePawn(___pawn); - } - } - - [HarmonyPatch(typeof(GenMapUI), nameof(GenMapUI.DrawPawnLabel))] - [HarmonyPatch(new Type[] { typeof(Pawn), typeof(Vector2), typeof(float), typeof(float), typeof(Dictionary), typeof(GameFont), typeof(bool), typeof(bool) })] - [StaticConstructorOnStartup] - static class GenMapUI_DrawPawnLabel_Patch - { - static readonly Texture2D downedTexture = ContentFinder.Get("DownedMarker", true); - static readonly Texture2D draftedTexture = ContentFinder.Get("DraftedMarker", true); - static readonly Color downedColor = new Color(0.9f, 0f, 0f); - static readonly Color draftedColor = new Color(0f, 0.5f, 0f); - - public static bool HandlePawn(Pawn pawn) - { - Tools.ShouldShowLabel(pawn.DrawPos, true, out var showLabel, out var showDot); - if (showLabel) - return true; - if (showDot == false) - return false; - - var useMarkers = Tools.GetMarkerColors(pawn, out var innerColor, out var outerColor); + var useMarkers = Tools.GetMarkerColors(___pawn, out var innerColor, out var outerColor); if (useMarkers == false) return true; // use label - _ = Tools.GetMarkerTextures(pawn, out var innerTexture, out var outerTexture); - - var pos = pawn.DrawPos; - var v1 = (pos - new Vector3(0.75f, 0f, 0.75f)).MapToUIPosition().Rounded(); - var v2 = (pos + new Vector3(0.75f, 0f, 0.75f)).MapToUIPosition().Rounded(); - var markerRect = new Rect(v1, v2 - v1); - - // draw outer marker - GUI.color = outerColor; - GUI.DrawTexture(markerRect, outerTexture, ScaleMode.ScaleToFit, true); - - // draw inner marker - GUI.color = innerColor; - GUI.DrawTexture(markerRect, innerTexture, ScaleMode.ScaleToFit, true); - - // draw extra marker - if (pawn.Downed) + if (Tools.ShouldShowDot(___pawn)) { - GUI.color = downedColor; - GUI.DrawTexture(markerRect, downedTexture, ScaleMode.ScaleToFit, true); - } - else if (pawn.Drafted) - { - GUI.color = draftedColor; - GUI.DrawTexture(markerRect, draftedTexture, ScaleMode.ScaleToFit, true); + Tools.DrawDot(___pawn, innerColor, outerColor); + return false; } - - // skip label - return false; + return Tools.CorrectLabelRendering(___pawn); } + } + [HarmonyPatch(typeof(GenMapUI), nameof(GenMapUI.DrawPawnLabel))] + [HarmonyPatch(new Type[] { typeof(Pawn), typeof(Vector2), typeof(float), typeof(float), typeof(Dictionary), typeof(GameFont), typeof(bool), typeof(bool) })] + static class GenMapUI_DrawPawnLabel_Patch + { [HarmonyPriority(10000)] public static bool Prefix(Pawn pawn, float truncateToWidth) { @@ -262,9 +211,23 @@ public static bool Prefix(Pawn pawn, float truncateToWidth) return true; if (truncateToWidth != 9999f) - return true; // use label + return true; + + if (Tools.ShouldShowDot(pawn)) + { + var useMarkers = Tools.GetMarkerColors(pawn, out var innerColor, out var outerColor); + if (useMarkers == false) + return Tools.CorrectLabelRendering(pawn); + + Tools.DrawDot(pawn, innerColor, outerColor); + return false; + } + + // we fake "show all" so we need to skip if original could would not render labels + if (ReversePatches.PerformsDrawPawnGUIOverlay(pawn.Drawer.ui) == false) + return false; - return HandlePawn(pawn); + return Tools.ShouldShowLabel(pawn); } } @@ -290,8 +253,7 @@ public static bool Prefix(Vector2 screenPos) if (CameraPlusMain.skipCustomRendering) return true; - Tools.ShouldShowLabel(screenPos, false, out var showLabel, out _); - return showLabel; + return Tools.ShouldShowLabel(null, screenPos); } // we replace the first "GameFont.Tiny" with "GetAdaptedGameFont()" diff --git a/Source/ReversePatches.cs b/Source/ReversePatches.cs new file mode 100644 index 0000000..57014ca --- /dev/null +++ b/Source/ReversePatches.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using Verse; + +namespace CameraPlus +{ + [HarmonyPatch] + static class ReversePatches + { + // mostly copied from the logic in the beginning od PawnUIOverlay.DrawPawnGUIOverlay + // + [HarmonyReversePatch(HarmonyReversePatchType.Original)] + [HarmonyPatch(typeof(PawnUIOverlay), nameof(PawnUIOverlay.DrawPawnGUIOverlay))] + public static bool PerformsDrawPawnGUIOverlay(PawnUIOverlay me) + { + static IEnumerable Transpiler(IEnumerable instructions) + { + var mLabelDrawPosFor = SymbolExtensions.GetMethodInfo(() => GenMapUI.LabelDrawPosFor(null, 0f)); + + var list = instructions.ToList(); + var idx = list.FirstIndexOf(code => code.Calls(mLabelDrawPosFor)); + if (idx < 3 || idx >= list.Count) throw new AmbiguousMatchException("Cannot find GenMapUI.LabelDrawPosFor in PawnUIOverlay.DrawPawnGUIOverlay"); + idx -= 3; + var endLabels = list[idx].labels; + list.RemoveRange(idx, list.Count - idx); + + foreach (var code in list) + { + if (code.opcode == OpCodes.Ret) + { + var labels = code.labels; + yield return new CodeInstruction(OpCodes.Ldc_I4_0) { labels = labels }; + yield return new CodeInstruction(OpCodes.Ret); + } + else + yield return code; + } + yield return new CodeInstruction(OpCodes.Ldc_I4_1) { labels = endLabels }; + yield return new CodeInstruction(OpCodes.Ret); + } + + _ = Transpiler(default); + try { _ = me; return default; } finally { } + } + } +} diff --git a/Source/Tools.cs b/Source/Tools.cs index 81070ee..70a8f01 100644 --- a/Source/Tools.cs +++ b/Source/Tools.cs @@ -1,96 +1,103 @@ -using HarmonyLib; -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; -using System.Reflection; using UnityEngine; using Verse; namespace CameraPlus { - class CameraDelegates + public enum LabelMode { - public Func GetCameraColors = null; - public Func GetCameraMarkers = null; + hide, + show, + dot + } - static MethodInfo GetMethod(Pawn pawn, string name) - { - return pawn.GetType().Assembly - .GetType("CameraPlusSupport.Methods", false)? - .GetMethod(name, AccessTools.all); - } + [StaticConstructorOnStartup] + class Tools : CameraPlusSettings + { + static readonly Texture2D innerColonistTexture = ContentFinder.Get("InnerColonistMarker", true); + static readonly Texture2D outerColonistTexture = ContentFinder.Get("OuterColonistMarker", true); + static readonly Texture2D innerAnimalTexture = ContentFinder.Get("InnerAnimalMarker", true); + static readonly Texture2D outerAnimalTexture = ContentFinder.Get("OuterAnimalMarker", true); - public CameraDelegates(Pawn pawn) + static readonly Texture2D downedTexture = ContentFinder.Get("DownedMarker", true); + static readonly Texture2D draftedTexture = ContentFinder.Get("DraftedMarker", true); + static readonly Color downedColor = new Color(0.9f, 0f, 0f); + static readonly Color draftedColor = new Color(0f, 0.5f, 0f); + + public static bool ShouldShowDot(Pawn pawn) { - var m_GetCameraColors = GetMethod(pawn, "GetCameraPlusColors"); - if (m_GetCameraColors != null) - { - var funcType = Expression.GetFuncType(new[] { typeof(Pawn), typeof(Color[]) }); - GetCameraColors = (Func)Delegate.CreateDelegate(funcType, m_GetCameraColors); - } + if (CameraPlusMain.Settings.hideNamesWhenZoomedOut == false) + return false; - var m_GetCameraTextures = GetMethod(pawn, "GetCameraPlusMarkers"); - if (m_GetCameraTextures != null) - { - var funcType = Expression.GetFuncType(new[] { typeof(Pawn), typeof(Texture2D[]) }); - GetCameraMarkers = (Func)Delegate.CreateDelegate(funcType, m_GetCameraTextures); - } - } - } + if (CameraPlusMain.Settings.customNameStyle == LabelStyle.HideAnimals && pawn.RaceProps.Animal) + return false; - static class Extensions - { - public static void Slider(this Listing_Standard list, ref int value, int min, int max, Func label) - { - float f = value; - var h = HorizontalSlider(list.GetRect(22f), ref f, min, max, label == null ? null : label(), 1f); - value = (int)f; - list.Gap(h); + if (MouseDistanceSquared(pawn.DrawPos, true) <= 2.25f && CameraPlusMain.Settings.mouseOverShowsLabels) + return false; + + var len = UI.CurUICellSize(); + var isSmall = len <= CameraPlusMain.Settings.dotSize; + var tamedAnimal = pawn.RaceProps.Animal && pawn.Name != null; + return isSmall && (CameraPlusMain.Settings.includeNotTamedAnimals || pawn.RaceProps.Animal == false || tamedAnimal); } - public static void Slider(this Listing_Standard list, ref float value, float min, float max, Func label, float roundTo = -1f) + public static bool ShouldShowLabel(Thing thing, Vector2 screenPos = default) { - var rect = list.GetRect(22f); - var h = HorizontalSlider(rect, ref value, min, max, label == null ? null : label(), roundTo); - list.Gap(h); + if (CameraPlusMain.Settings.hideNamesWhenZoomedOut == false) + return true; + + var isPawn = thing is Pawn; + + if (MouseDistanceSquared(thing?.DrawPos ?? screenPos, isPawn) <= 2.25f && CameraPlusMain.Settings.mouseOverShowsLabels) + return true; + + var len = UI.CurUICellSize(); + + var lower = isPawn ? CameraPlusMain.Settings.hidePawnLabelBelow : CameraPlusMain.Settings.hideThingLabelBelow; + if (len <= lower) + return false; + + if (isPawn && CameraPlusMain.Settings.customNameStyle == LabelStyle.HideAnimals && (thing as Pawn).RaceProps.Animal) + return true; + + if (isPawn && len <= CameraPlusMain.Settings.dotSize) + return false; + + return true; } - public static float HorizontalSlider(Rect rect, ref float value, float leftValue, float rightValue, string label = null, float roundTo = -1f) + public static void DrawDot(Pawn pawn, Color innerColor, Color outerColor) { - if (label != null) + _ = GetMarkerTextures(pawn, out var innerTexture, out var outerTexture); + + var pos = pawn.DrawPos; + var v1 = (pos - new Vector3(0.75f, 0f, 0.75f)).MapToUIPosition().Rounded(); + var v2 = (pos + new Vector3(0.75f, 0f, 0.75f)).MapToUIPosition().Rounded(); + var markerRect = new Rect(v1, v2 - v1); + + // draw outer marker + GUI.color = outerColor; + GUI.DrawTexture(markerRect, outerTexture, ScaleMode.ScaleToFit, true); + + // draw inner marker + GUI.color = innerColor; + GUI.DrawTexture(markerRect, innerTexture, ScaleMode.ScaleToFit, true); + + // draw extra marker + if (pawn.Downed) + { + GUI.color = downedColor; + GUI.DrawTexture(markerRect, downedTexture, ScaleMode.ScaleToFit, true); + } + else if (pawn.Drafted) { - var anchor = Text.Anchor; - var font = Text.Font; - Text.Font = GameFont.Tiny; - Text.Anchor = TextAnchor.UpperLeft; - Widgets.Label(rect, label); - Text.Anchor = anchor; - Text.Font = font; - rect.y += 18f; + GUI.color = draftedColor; + GUI.DrawTexture(markerRect, draftedTexture, ScaleMode.ScaleToFit, true); } - value = GUI.HorizontalSlider(rect, value, leftValue, rightValue); - if (roundTo > 0f) - value = Mathf.RoundToInt(value / roundTo) * roundTo; - return 4f + label != null ? 18f : 0f; } - } - - public enum LabelMode - { - hide, - show, - dot - } - - [StaticConstructorOnStartup] - class Tools : CameraPlusSettings - { - static readonly Texture2D innerColonistTexture = ContentFinder.Get("InnerColonistMarker", true); - static readonly Texture2D outerColonistTexture = ContentFinder.Get("OuterColonistMarker", true); - static readonly Texture2D innerAnimalTexture = ContentFinder.Get("InnerAnimalMarker", true); - static readonly Texture2D outerAnimalTexture = ContentFinder.Get("OuterAnimalMarker", true); static readonly Dictionary cachedMainColors = new Dictionary(); public static Color? GetMainColor(Pawn pawn) @@ -142,34 +149,6 @@ class Tools : CameraPlusSettings return color; } - // shameless copy of vanilla - public static bool PawnHasNoLabel(Pawn pawn) - { - if (!pawn.Spawned || pawn.Map.fogGrid.IsFogged(pawn.Position)) - return true; - if (!pawn.RaceProps.Humanlike) - { - if (CameraPlusMain.Settings.includeNotTamedAnimals) - return false; - - var animalNameMode = Prefs.AnimalNameMode; - if (animalNameMode == AnimalNameDisplayMode.None) - return true; - if (animalNameMode != AnimalNameDisplayMode.TameAll) - { - if (animalNameMode == AnimalNameDisplayMode.TameNamed) - { - if (pawn.Name == null || pawn.Name.Numerical) - return true; - } - } - else if (pawn.Name == null) - return true; - } - - return false; - } - public static float MouseDistanceSquared(Vector3 pos, bool mapCoordinates) { var mouse = UI.MouseMapPosition(); @@ -189,43 +168,6 @@ public static float MouseDistanceSquared(Vector3 pos, bool mapCoordinates) return delta / len / len; } - public static bool ShouldShowBody(Pawn pawn) - { - if (CameraPlusMain.Settings.hideNamesWhenZoomedOut == false || MouseDistanceSquared(pawn.DrawPos, true) <= 2.25f) - return true; - - return (UI.CurUICellSize() > CameraPlusMain.Settings.dotSize); - } - - public static void ShouldShowLabel(Vector3 location, bool isPawn, out bool showLabel, out bool showDot) - { - showLabel = true; - showDot = false; - - if (CameraPlusMain.Settings.hideNamesWhenZoomedOut == false) - return; - - if (MouseDistanceSquared(location, isPawn) <= 2.25f && CameraPlusMain.Settings.mouseOverShowsLabels) - return; - - var len = UI.CurUICellSize(); - - if (isPawn && len <= CameraPlusMain.Settings.dotSize) - { - showLabel = false; - showDot = true; - return; - } - - var lower = isPawn ? CameraPlusMain.Settings.hidePawnLabelBelow : CameraPlusMain.Settings.hideThingLabelBelow; - if (len <= lower) - { - showLabel = false; - showDot = false; - return; - } - } - static readonly Dictionary cachedCameraDelegates = new Dictionary(); public static CameraDelegates GetCachedCameraDelegate(Pawn pawn) { @@ -238,6 +180,12 @@ public static CameraDelegates GetCachedCameraDelegate(Pawn pawn) return result; } + public static bool CorrectLabelRendering(Pawn pawn) + { + // we fake "show all" so we need to skip if original could would not render labels + return ReversePatches.PerformsDrawPawnGUIOverlay(pawn.Drawer.ui) == false; + } + // returning true will prefer markers over labels static readonly Color dangerousAnimalColor = new Color(0.62f, 0f, 0.05f); public static bool GetMarkerColors(Pawn pawn, out Color innerColor, out Color outerColor) @@ -257,9 +205,9 @@ public static bool GetMarkerColors(Pawn pawn, out Color innerColor, out Color ou return true; } - var isAnimal = pawn.RaceProps.Animal; - var showAnimals = CameraPlusMain.Settings.customNameStyle != LabelStyle.HideAnimals; - if (isAnimal && showAnimals == false) + var isAnimal = pawn.RaceProps.Animal && pawn.Name != null; + var hideAnimalMarkers = CameraPlusMain.Settings.customNameStyle == LabelStyle.HideAnimals; + if (isAnimal && hideAnimalMarkers) { innerColor = default; outerColor = default;