using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Foothold")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+5fe04c5c868db18fd33511c1bf3cf87945fe41a5")]
[assembly: AssemblyProduct("Foothold?")]
[assembly: AssemblyTitle("Foothold")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Foothold
{
[BepInPlugin("Foothold", "Foothold?", "1.5.0")]
public class Plugin : BaseUnityPlugin
{
internal enum StandableColor
{
White,
Green
}
internal enum NonStandableColor
{
Red,
Magenta
}
internal enum Mode
{
Toggle,
FadeAway,
Trigger,
Continuous
}
private class PositionKey
{
private static readonly Queue<PositionKey> pool;
private static int poolSize;
public static int totalAllocations;
public static int totalInUse;
private bool isInUse = false;
public Vector3 position;
public bool standable;
public Matrix4x4 matrix;
public bool ballVisible = false;
public (int, int) ballMatrixIndex = (-1, -1);
public static int PoolCount => pool.Count;
static PositionKey()
{
pool = new Queue<PositionKey>();
poolSize = 40000;
totalAllocations = 0;
totalInUse = 0;
for (int i = 0; i < poolSize; i++)
{
pool.Enqueue(new PositionKey());
totalAllocations++;
}
}
private PositionKey()
{
}
public static PositionKey GetNew(float x, float y, float z, bool standable, GameObject ballObject = null)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if (pool.Count <= 0)
{
for (int i = 0; i < poolSize / 5; i++)
{
pool.Enqueue(new PositionKey());
totalAllocations++;
}
}
PositionKey positionKey = pool.Dequeue();
positionKey.position = new Vector3(x, y, z);
positionKey.matrix = Matrix4x4.TRS(positionKey.position, Quaternion.identity, scale);
positionKey.standable = standable;
positionKey.ballVisible = false;
positionKey.isInUse = true;
totalInUse++;
return positionKey;
}
public static PositionKey GetNew(Vector3 position, bool standable, GameObject ballObject = null)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
if (pool.Count <= 0)
{
for (int i = 0; i < poolSize / 5; i++)
{
pool.Enqueue(new PositionKey());
totalAllocations++;
}
}
PositionKey positionKey = pool.Dequeue();
positionKey.position = position;
positionKey.matrix = Matrix4x4.TRS(positionKey.position, Quaternion.identity, scale);
positionKey.standable = standable;
positionKey.ballVisible = false;
positionKey.isInUse = true;
totalInUse++;
return positionKey;
}
public void ReturnToPool()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (isInUse)
{
ReturnBallToPool(this);
position = Vector3.zero;
standable = false;
ballVisible = false;
isInUse = false;
pool.Enqueue(this);
totalInUse--;
}
}
}
private class PositionYList
{
private static readonly Queue<PositionYList> pool;
private static int poolSize;
public static int totalAllocations;
public static int totalInUse;
public readonly Dictionary<int, PositionKey> list = new Dictionary<int, PositionKey>();
private bool isInUse = false;
public float rayTop = 0f;
public float rayBottom = 0f;
public static int PoolCount => pool.Count;
static PositionYList()
{
pool = new Queue<PositionYList>();
poolSize = 10000;
totalAllocations = 0;
totalInUse = 0;
for (int i = 0; i < poolSize; i++)
{
pool.Enqueue(new PositionYList());
totalAllocations++;
}
}
private PositionYList()
{
}
public static PositionYList GetNew()
{
if (pool.Count <= 0)
{
for (int i = 0; i < poolSize / 5; i++)
{
pool.Enqueue(new PositionYList());
totalAllocations++;
}
}
PositionYList positionYList = pool.Dequeue();
positionYList.list.Clear();
positionYList.isInUse = true;
totalInUse++;
return positionYList;
}
public void ReturnToPool()
{
if (!isInUse)
{
return;
}
totalInUse--;
isInUse = false;
foreach (PositionKey value in list.Values)
{
value?.ReturnToPool();
}
list.Clear();
pool.Enqueue(this);
}
}
public struct FastFrustum
{
public Vector3 camPos;
public Vector3 forward;
public Vector3 right;
public Vector3 up;
public float near;
public float far;
public float tanHalfVertFov;
public float tanHalfHorFov;
private float XPrepZ;
private float XZPrepZ;
private float XPrepX;
private float XZPrepX;
private float XPrepY;
private float XZPrepY;
public FastFrustum(Camera cam, float farClipPlaneOverride = -1f)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
XPrepZ = 0f;
XZPrepZ = 0f;
XPrepX = 0f;
XZPrepX = 0f;
XPrepY = 0f;
XZPrepY = 0f;
Transform transform = ((Component)cam).transform;
camPos = transform.position;
forward = transform.forward;
right = transform.right;
up = transform.up;
near = cam.nearClipPlane;
far = cam.farClipPlane;
if (farClipPlaneOverride > 0f)
{
far = farClipPlaneOverride;
}
float num = 0.5f * cam.fieldOfView * (MathF.PI / 180f);
tanHalfVertFov = Mathf.Tan(num);
tanHalfHorFov = tanHalfVertFov * cam.aspect;
}
public void PrepX(float x)
{
x -= camPos.x;
XPrepZ = x * forward.x;
XPrepX = x * right.x;
XPrepY = x * up.x;
}
public void PrepXZ(float z)
{
z -= camPos.z;
XZPrepZ = XPrepZ + z * forward.z;
XZPrepX = XPrepX + z * right.z;
XZPrepY = XPrepY + z * up.z;
}
public bool PreppedYContains(float pointY)
{
pointY -= camPos.y;
float num = XZPrepZ + pointY * forward.y;
if (num < near || num > far)
{
return false;
}
float num2 = XZPrepX + pointY * right.y;
float num3 = num * tanHalfHorFov;
if (Mathf.Abs(num2) > num3)
{
return false;
}
float num4 = XZPrepY + pointY * up.y;
float num5 = num * tanHalfVertFov;
if (Mathf.Abs(num4) > num5)
{
return false;
}
return true;
}
public bool Contains(Vector3 point)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = point - camPos;
float num = Vector3.Dot(val, forward);
if (num < near || num > far)
{
return false;
}
float num2 = Vector3.Dot(val, right);
float num3 = num * tanHalfHorFov;
if (Mathf.Abs(num2) > num3)
{
return false;
}
float num4 = Vector3.Dot(val, up);
float num5 = num * tanHalfVertFov;
if (Mathf.Abs(num4) > num5)
{
return false;
}
return true;
}
public (int, int, int, int) GetFrequencyQuantizedXZFrustumBounds(float freq)
{
(float, float, float, float) xZFrustumBounds = GetXZFrustumBounds();
float item = xZFrustumBounds.Item1;
float item2 = xZFrustumBounds.Item2;
float item3 = xZFrustumBounds.Item3;
float item4 = xZFrustumBounds.Item4;
int item5 = (int)Mathf.Round(Mathf.Round(item / freq) * freq * 10f);
int item6 = (int)Mathf.Round(Mathf.Round(item2 / freq) * freq * 10f);
int item7 = (int)Mathf.Round(Mathf.Round(item3 / freq) * freq * 10f);
int item8 = (int)Mathf.Round(Mathf.Round(item4 / freq) * freq * 10f);
return (item5, item6, item7, item8);
}
public (float, float, float, float) GetXZFrustumBounds()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
float num = near * tanHalfVertFov;
float num2 = near * tanHalfHorFov;
float num3 = far * tanHalfVertFov;
float num4 = far * tanHalfHorFov;
Vector3 val = camPos + forward * near;
Vector3 val2 = camPos + forward * far;
Vector3 p2 = val + up * num - right * num2;
Vector3 p3 = val + up * num + right * num2;
Vector3 p4 = val - up * num - right * num2;
Vector3 p5 = val - up * num + right * num2;
Vector3 p6 = val2 + up * num3 - right * num4;
Vector3 p7 = val2 + up * num3 + right * num4;
Vector3 p8 = val2 - up * num3 - right * num4;
Vector3 p9 = val2 - up * num3 + right * num4;
float minX = float.PositiveInfinity;
float maxX = float.NegativeInfinity;
float minZ = float.PositiveInfinity;
float maxZ = float.NegativeInfinity;
Encapsulate(p2);
Encapsulate(p3);
Encapsulate(p4);
Encapsulate(p5);
Encapsulate(p6);
Encapsulate(p7);
Encapsulate(p8);
Encapsulate(p9);
return (minX, maxX, minZ, maxZ);
void Encapsulate(Vector3 p)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if (p.x < minX)
{
minX = p.x;
}
if (p.x > maxX)
{
maxX = p.x;
}
if (p.z < minZ)
{
minZ = p.z;
}
if (p.z > maxZ)
{
maxZ = p.z;
}
}
}
}
private struct SafeXZ
{
public int x;
public float y;
public int z;
}
[CompilerGenerated]
private sealed class <>c__DisplayClass64_0
{
public Vector3 cameraPosition;
internal int <SortWithYield>b__0(Vector3 a, Vector3 b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = a - cameraPosition;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
val = b - cameraPosition;
float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude;
return sqrMagnitude.CompareTo(sqrMagnitude2);
}
}
[CompilerGenerated]
private sealed class <RenderChangedVisualizationCoroutine>d__62 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
private int <prevMinX>5__1;
private int <prevMaxX>5__2;
private int <prevMinZ>5__3;
private int <prevMaxZ>5__4;
private Rect <oldArea>5__5;
private Rect <oldCacheKeepArea>5__6;
private Rect <oldRecheckArea>5__7;
private int <minX>5__8;
private int <maxX>5__9;
private int <minZ>5__10;
private int <maxZ>5__11;
private Rect <newArea>5__12;
private Rect <newCacheKeepArea>5__13;
private Rect <recheckArea>5__14;
private List<Rect> <newAreas>5__15;
private List<Rect> <expiredCacheKeepAreas>5__16;
private List<Rect> <expiredRecheckAreas>5__17;
private PositionYList <pCache>5__18;
private List<Rect>.Enumerator <>s__19;
private Rect <area>5__20;
private int <axMax>5__21;
private int <ayMax>5__22;
private int <x>5__23;
private int <z>5__24;
private Exception <e>5__25;
private Exception <e>5__26;
private List<Rect>.Enumerator <>s__27;
private Rect <area>5__28;
private int <axMax>5__29;
private int <ayMax>5__30;
private int <x>5__31;
private int <z>5__32;
private Exception <e>5__33;
private List<Rect>.Enumerator <>s__34;
private Rect <area>5__35;
private int <axMax>5__36;
private int <ayMax>5__37;
private int <x>5__38;
private int <z>5__39;
private Exception <e>5__40;
private Rect <area>5__41;
private int <axMax>5__42;
private int <ayMax>5__43;
private int <x>5__44;
private int <z>5__45;
private Exception <e>5__46;
private Exception <e>5__47;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RenderChangedVisualizationCoroutine>d__62(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
switch (<>1__state)
{
case -3:
case 1:
case 2:
try
{
}
finally
{
<>m__Finally1();
}
break;
case -4:
case 3:
try
{
}
finally
{
<>m__Finally2();
}
break;
case -5:
case 4:
try
{
}
finally
{
<>m__Finally3();
}
break;
}
<newAreas>5__15 = null;
<expiredCacheKeepAreas>5__16 = null;
<expiredRecheckAreas>5__17 = null;
<pCache>5__18 = null;
<>s__19 = default(List<Rect>.Enumerator);
<e>5__25 = null;
<e>5__26 = null;
<>s__27 = default(List<Rect>.Enumerator);
<e>5__33 = null;
<>s__34 = default(List<Rect>.Enumerator);
<e>5__40 = null;
<e>5__46 = null;
<e>5__47 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0757: Unknown result type (might be due to invalid IL or missing references)
//IL_075c: Unknown result type (might be due to invalid IL or missing references)
//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
try
{
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
additionalDebugInfo = "";
lastScanTime = Time.time;
totalCalls = 0;
(int, int, int, int) frequencyQuantizedXZFrustumBounds = cameraFrustum.GetFrequencyQuantizedXZFrustumBounds(freq);
<prevMinX>5__1 = frequencyQuantizedXZFrustumBounds.Item1;
<prevMaxX>5__2 = frequencyQuantizedXZFrustumBounds.Item2;
<prevMinZ>5__3 = frequencyQuantizedXZFrustumBounds.Item3;
<prevMaxZ>5__4 = frequencyQuantizedXZFrustumBounds.Item4;
<oldArea>5__5 = Rect.MinMaxRect((float)(nearestGridToCamera.x - safeRange), (float)(nearestGridToCamera.z - safeRange), (float)(nearestGridToCamera.x + safeRange), (float)(nearestGridToCamera.z + safeRange));
<oldCacheKeepArea>5__6 = Rect.MinMaxRect((float)(nearestGridToCamera.x - safeRange * 2), (float)(nearestGridToCamera.z - safeRange * 2), (float)(nearestGridToCamera.x + safeRange * 2), (float)(nearestGridToCamera.z + safeRange * 2));
<oldRecheckArea>5__7 = Rect.MinMaxRect((float)<prevMinX>5__1, (float)<prevMinZ>5__3, (float)<prevMaxX>5__2, (float)<prevMaxZ>5__4);
nearestGridToCamera.x = (int)Mathf.Round(Mathf.Round(focalReferencePoint.x / freq) * freq * 10f);
nearestGridToCamera.y = focalReferencePoint.y;
nearestGridToCamera.z = (int)Mathf.Round(Mathf.Round(focalReferencePoint.z / freq) * freq * 10f);
cameraFrustum = new FastFrustum(mainCamera, range);
frequencyQuantizedXZFrustumBounds = cameraFrustum.GetFrequencyQuantizedXZFrustumBounds(freq);
<minX>5__8 = frequencyQuantizedXZFrustumBounds.Item1;
<maxX>5__9 = frequencyQuantizedXZFrustumBounds.Item2;
<minZ>5__10 = frequencyQuantizedXZFrustumBounds.Item3;
<maxZ>5__11 = frequencyQuantizedXZFrustumBounds.Item4;
<newArea>5__12 = Rect.MinMaxRect((float)(nearestGridToCamera.x - safeRange), (float)(nearestGridToCamera.z - safeRange), (float)(nearestGridToCamera.x + safeRange), (float)(nearestGridToCamera.z + safeRange));
<newCacheKeepArea>5__13 = Rect.MinMaxRect((float)(nearestGridToCamera.x - safeRange * 2), (float)(nearestGridToCamera.z - safeRange * 2), (float)(nearestGridToCamera.x + safeRange * 2), (float)(nearestGridToCamera.z + safeRange * 2));
<recheckArea>5__14 = Rect.MinMaxRect((float)<minX>5__8, (float)<minZ>5__10, (float)<maxX>5__9, (float)<maxZ>5__11);
<newAreas>5__15 = SubtractRect(<newArea>5__12, <oldArea>5__5);
<expiredCacheKeepAreas>5__16 = SubtractRect(<oldCacheKeepArea>5__6, <newCacheKeepArea>5__13);
<expiredRecheckAreas>5__17 = SubtractRect(<oldRecheckArea>5__7, <recheckArea>5__14);
<pCache>5__18 = null;
<>s__19 = <newAreas>5__15.GetEnumerator();
<>1__state = -3;
goto IL_0583;
}
case 1:
<>1__state = -3;
goto IL_04b0;
case 2:
<>1__state = -3;
goto IL_0528;
case 3:
<>1__state = -4;
goto IL_06b3;
case 4:
<>1__state = -5;
goto IL_083e;
case 5:
<>1__state = -1;
goto IL_09e3;
case 6:
{
<>1__state = -1;
goto IL_0a57;
}
IL_0583:
if (<>s__19.MoveNext())
{
<area>5__20 = <>s__19.Current;
<axMax>5__21 = (int)Mathf.Round(((Rect)(ref <area>5__20)).xMax);
<ayMax>5__22 = (int)Mathf.Round(((Rect)(ref <area>5__20)).yMax);
<x>5__23 = (int)Mathf.Round(((Rect)(ref <area>5__20)).xMin);
goto IL_0568;
}
<>m__Finally1();
<>s__19 = default(List<Rect>.Enumerator);
<>s__27 = <expiredCacheKeepAreas>5__16.GetEnumerator();
<>1__state = -4;
goto IL_070e;
IL_04b0:
try
{
<>4__this.PlaceBallsInVerticalRay(<pCache>5__18, nearestGridToCamera.y, onlyInFrustum: true);
}
catch (Exception ex)
{
<e>5__26 = ex;
Logger.LogError((object)<e>5__26);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 2;
return true;
}
goto IL_0528;
IL_070e:
if (<>s__27.MoveNext())
{
<area>5__28 = <>s__27.Current;
<axMax>5__29 = (int)Mathf.Round(((Rect)(ref <area>5__28)).xMax);
<ayMax>5__30 = (int)Mathf.Round(((Rect)(ref <area>5__28)).yMax);
<x>5__31 = (int)Mathf.Round(((Rect)(ref <area>5__28)).xMin);
goto IL_06f3;
}
<>m__Finally2();
<>s__27 = default(List<Rect>.Enumerator);
<>s__34 = <expiredRecheckAreas>5__17.GetEnumerator();
<>1__state = -5;
goto IL_0899;
IL_053b:
if (<z>5__24 <= <ayMax>5__22)
{
cameraFrustum.PrepXZ((float)<z>5__24 / 10f);
try
{
<pCache>5__18 = <>4__this.CheckCacheMiss(<x>5__23, nearestGridToCamera.y, <z>5__24);
}
catch (Exception ex)
{
<e>5__25 = ex;
Logger.LogError((object)<e>5__25);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_04b0;
}
<x>5__23 += safeFreq;
goto IL_0568;
IL_0899:
if (<>s__34.MoveNext())
{
<area>5__35 = <>s__34.Current;
<axMax>5__36 = (int)Mathf.Round(((Rect)(ref <area>5__35)).xMax);
<ayMax>5__37 = (int)Mathf.Round(((Rect)(ref <area>5__35)).yMax);
<x>5__38 = (int)Mathf.Round(((Rect)(ref <area>5__35)).xMin);
goto IL_087e;
}
<>m__Finally3();
<>s__34 = default(List<Rect>.Enumerator);
<area>5__41 = <recheckArea>5__14;
<axMax>5__42 = (int)Mathf.Round(((Rect)(ref <area>5__41)).xMax);
<ayMax>5__43 = (int)Mathf.Round(((Rect)(ref <area>5__41)).yMax);
<x>5__44 = (int)Mathf.Round(((Rect)(ref <area>5__41)).xMin);
goto IL_0a97;
IL_0a97:
if (<x>5__44 <= <axMax>5__42)
{
cameraFrustum.PrepX((float)<x>5__44 / 10f);
<z>5__45 = (int)Mathf.Round(((Rect)(ref <area>5__41)).yMin);
goto IL_0a6a;
}
isVisualizationRunning = false;
return false;
IL_06b3:
<z>5__32 += safeFreq;
goto IL_06c6;
IL_087e:
if (<x>5__38 <= <axMax>5__36)
{
<z>5__39 = (int)Mathf.Round(((Rect)(ref <area>5__35)).yMin);
goto IL_0851;
}
goto IL_0899;
IL_0a6a:
if (<z>5__45 <= <ayMax>5__43)
{
try
{
cameraFrustum.PrepXZ((float)<z>5__45 / 10f);
<pCache>5__18 = <>4__this.CheckCacheMiss(<x>5__44, nearestGridToCamera.y, <z>5__45);
}
catch (Exception ex)
{
<e>5__46 = ex;
Logger.LogError((object)<e>5__46);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 5;
return true;
}
goto IL_09e3;
}
<x>5__44 += safeFreq;
goto IL_0a97;
IL_083e:
<z>5__39 += safeFreq;
goto IL_0851;
IL_0851:
if (<z>5__39 <= <ayMax>5__37)
{
try
{
<>4__this.RemoveBallsInVerticalRay(<x>5__38, <z>5__39, expireCache: false);
}
catch (Exception ex)
{
<e>5__40 = ex;
Logger.LogError((object)<e>5__40);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 4;
return true;
}
goto IL_083e;
}
<x>5__38 += safeFreq;
goto IL_087e;
IL_06f3:
if (<x>5__31 <= <axMax>5__29)
{
<z>5__32 = (int)Mathf.Round(((Rect)(ref <area>5__28)).yMin);
goto IL_06c6;
}
goto IL_070e;
IL_0568:
if (<x>5__23 <= <axMax>5__21)
{
cameraFrustum.PrepX((float)<x>5__23 / 10f);
<z>5__24 = (int)Mathf.Round(((Rect)(ref <area>5__20)).yMin);
goto IL_053b;
}
goto IL_0583;
IL_09e3:
try
{
<>4__this.PlaceBallsInVerticalRay(<pCache>5__18, nearestGridToCamera.y, onlyInFrustum: true);
}
catch (Exception ex)
{
<e>5__47 = ex;
Logger.LogError((object)<e>5__47);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 6;
return true;
}
goto IL_0a57;
IL_06c6:
if (<z>5__32 <= <ayMax>5__30)
{
try
{
<>4__this.RemoveBallsInVerticalRay(<x>5__31, <z>5__32);
}
catch (Exception ex)
{
<e>5__33 = ex;
Logger.LogError((object)<e>5__33);
}
if (totalCalls >= maximumRaysPerFrame)
{
totalCalls = 0;
<>2__current = null;
<>1__state = 3;
return true;
}
goto IL_06b3;
}
<x>5__31 += safeFreq;
goto IL_06f3;
IL_0528:
<z>5__24 += safeFreq;
goto IL_053b;
IL_0a57:
<z>5__45 += safeFreq;
goto IL_0a6a;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__19).Dispose();
}
private void <>m__Finally2()
{
<>1__state = -1;
((IDisposable)<>s__27).Dispose();
}
private void <>m__Finally3()
{
<>1__state = -1;
((IDisposable)<>s__34).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <RenderVisualizationCoroutine>d__61 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
private int <totalCalls>5__1;
private int <x>5__2;
private int <z>5__3;
private Exception <e>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RenderVisualizationCoroutine>d__61(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<e>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
goto IL_01b6;
}
<>1__state = -1;
additionalDebugInfo = "";
<>4__this.ReturnAllBallsToPool();
lastScanTime = Time.time;
<totalCalls>5__1 = 0;
nearestGridToCamera.x = (int)Mathf.Round(Mathf.Round(focalReferencePoint.x / freq) * freq * 10f);
nearestGridToCamera.y = focalReferencePoint.y;
nearestGridToCamera.z = (int)Mathf.Round(Mathf.Round(focalReferencePoint.z / freq) * freq * 10f);
cameraFrustum = new FastFrustum(mainCamera, range);
<x>5__2 = -safeRange;
goto IL_01f3;
IL_01f3:
if (<x>5__2 <= safeRange)
{
cameraFrustum.PrepX((float)<x>5__2 / 10f);
<z>5__3 = -safeRange;
goto IL_01c9;
}
isVisualizationRunning = false;
return false;
IL_01c9:
if (<z>5__3 <= safeRange)
{
cameraFrustum.PrepXZ((float)<z>5__3 / 10f);
try
{
<>4__this.CheckAndPlaceBallsInVerticalRay(nearestGridToCamera.x + <x>5__2, nearestGridToCamera.y, nearestGridToCamera.z + <z>5__3, onlyInFrustum: false);
}
catch (Exception ex)
{
<e>5__4 = ex;
Logger.LogError((object)<e>5__4);
}
if (<totalCalls>5__1 >= maximumRaysPerFrame)
{
<totalCalls>5__1 = 0;
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_01b6;
}
<x>5__2 += safeFreq;
goto IL_01f3;
IL_01b6:
<z>5__3 += safeFreq;
goto IL_01c9;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SortWithYield>d__64 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public List<Vector3> list;
public Vector3 cameraPosition;
public int chunkSize;
public Plugin <>4__this;
private <>c__DisplayClass64_0 <>8__1;
private int <n>5__2;
private int <totalIterations>5__3;
private Comparison<Vector3> <compare>5__4;
private int <i>5__5;
private int <end>5__6;
private List<Vector3> <chunk>5__7;
private int <j>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SortWithYield>d__64(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<compare>5__4 = null;
<chunk>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
goto IL_013f;
}
<>1__state = -1;
<>8__1 = new <>c__DisplayClass64_0();
<>8__1.cameraPosition = cameraPosition;
<n>5__2 = list.Count;
<totalIterations>5__3 = 0;
<compare>5__4 = delegate(Vector3 a, Vector3 b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = a - <>8__1.cameraPosition;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
val = b - <>8__1.cameraPosition;
float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude;
return sqrMagnitude.CompareTo(sqrMagnitude2);
};
<i>5__5 = 0;
goto IL_0185;
IL_0185:
if (<i>5__5 < <n>5__2)
{
<end>5__6 = Mathf.Min(<i>5__5 + chunkSize, <n>5__2);
<chunk>5__7 = list.GetRange(<i>5__5, <end>5__6 - <i>5__5);
<chunk>5__7.Sort(<compare>5__4);
<j>5__8 = 0;
goto IL_0150;
}
return false;
IL_0150:
if (<j>5__8 < <chunk>5__7.Count)
{
list[<i>5__5 + <j>5__8] = <chunk>5__7[<j>5__8];
<totalIterations>5__3++;
if (<totalIterations>5__3 % maximumRaysPerFrame == 0)
{
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_013f;
}
<chunk>5__7 = null;
<i>5__5 += chunkSize;
goto IL_0185;
IL_013f:
<j>5__8++;
goto IL_0150;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static ManualLogSource Logger;
internal static Scene currentScene;
internal static Camera mainCamera;
internal static Vector3 focalReferencePoint;
internal static FastFrustum cameraFrustum;
internal static bool activated = false;
private static Vector3 scale = new Vector3(0.2f, 0.2f, 0.2f);
private static List<Matrix4x4[]> standableMatrices = new List<Matrix4x4[]>();
private static List<PositionKey[]> linkedStandableMatrices = new List<PositionKey[]>();
private static List<Matrix4x4[]> nonStandableMatrices = new List<Matrix4x4[]>();
private static List<PositionKey[]> linkedNonStandableMatrices = new List<PositionKey[]>();
private static (int, int) nextFreeStandableMatrixIndex = (0, 0);
private static (int, int) nextFreeNonStandableMatrixIndex = (0, 0);
private static int cullingLayer = 0;
private static RenderParams standableRP;
private static RenderParams nonStandableRP;
internal static Material standableMaterial;
internal static Material nonStandableMaterial;
internal static float alpha = 1f;
internal static bool continuousPaused = false;
private static readonly Dictionary<(int, int), PositionYList> positionCache = new Dictionary<(int, int), PositionYList>();
private static readonly RaycastHit[] _terrainHitBuffer = (RaycastHit[])(object)new RaycastHit[1000];
private static Mesh ballMesh;
private static float lastScanTime = 0f;
private static float lastAlphaChangeTime = 0f;
private ConfigEntry<KeyCode> configActivationKey;
private ConfigEntry<bool> configDebugMode;
private ConfigEntry<Mode> configMode;
private ConfigEntry<StandableColor> configStandableBallColor;
private ConfigEntry<NonStandableColor> configNonStandableBallColor;
private ConfigEntry<float> configScalePercent;
private ConfigEntry<float> configRange;
private ConfigEntry<float> configXZFreq;
private ConfigEntry<int> configMaximumPointsPerFrame;
private static SafeXZ nearestGridToCamera;
private static float freq;
private static int safeFreq;
private static float range;
private static int safeRange;
private static int maximumRaysPerFrame;
private Color LastStandableColor = Color.white;
private Color LastNonStandableColor = Color.red;
private static float scalePercent = 1f;
private static bool isVisualizationRunning = false;
private static string additionalDebugInfo = "";
private Color standable;
private Color NonStandable;
private static int totalCalls = 0;
private static int highestCount = 0;
private static int highestBallCount = 0;
private void Awake()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Expected O, but got Unknown
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Expected O, but got Unknown
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Expected O, but got Unknown
//IL_032b: Expected O, but got Unknown
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0432: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
configStandableBallColor = ((BaseUnityPlugin)this).Config.Bind<StandableColor>("Appearance", "Standable ground Color", StandableColor.White, "Change the ball color of standable ground.");
configNonStandableBallColor = ((BaseUnityPlugin)this).Config.Bind<NonStandableColor>("Appearance", "Non-standable ground Color", NonStandableColor.Red, "Change the ball color of non-standable ground.");
configScalePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "Scale Percent", 100f, new ConfigDescription("How large the standing point indicators are.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 200f), Array.Empty<object>()));
configRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Detection Range", 10f, new ConfigDescription("How far from the camera the balls are placed. Increasing will affect performance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 50f), Array.Empty<object>()));
configXZFreq = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Horizontal grid spacing", 0.5f, new ConfigDescription("How far apart the balls are placed horizontally. Reducing will affect performance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>()));
configMaximumPointsPerFrame = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Maximum points per frame", 100, new ConfigDescription("The maximum number of points to place per frame. Higher values reduce fps but make the visualization appear faster.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 20000), Array.Empty<object>()));
configActivationKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Activation Key", (KeyCode)102, (ConfigDescription)null);
configMode = ((BaseUnityPlugin)this).Config.Bind<Mode>("General", "Activation Mode", Mode.Continuous, "Toggle: Press once to activate; press again to hide the indicator.\r\nFade Away: Activates every time the button is pressed. The indicator will fade away after 3 seconds. Credit to VicVoss on GitHub for the idea.\r\nTrigger: Activates every time the button is pressed. The indicator will remain visible.\r\nContinuous: Always active. The indicator will remain visible, and updates as you move. Implemented by cjmanca on GitHub.");
configDebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Debug Mode", false, "Show debug information");
string text = Path.Combine(Paths.PluginPath, "Tzebruh-Foothold/Assets/Foothold");
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)"Failed to load AssetBundle");
return;
}
Material val2 = val.LoadAsset<Material>("Foothold");
if ((Object)(object)val2 == (Object)null)
{
Logger.LogError((object)"Failed to load instanced material from bundle");
return;
}
Logger.LogInfo((object)("Loaded instanced material: " + ((Object)val2).name));
ballMesh = Resources.GetBuiltinResource<Mesh>("Sphere.fbx");
Logger.LogInfo((object)$"mesh = {ballMesh}");
Material val3 = new Material(val2);
val3.SetFloat("_Surface", 1f);
val3.SetFloat("_Blend", 0f);
val3.SetInt("_IgnoreProjector", 1);
val3.SetInt("_ReceiveShadows", 0);
val3.SetInt("_ZWrite", 0);
val3.SetInt("_SrcBlend", 5);
val3.SetInt("_DstBlend", 10);
val3.DisableKeyword("_ALPHATEST_ON");
val3.EnableKeyword("_ALPHABLEND_ON");
val3.DisableKeyword("_ALPHAPREMULTIPLY_ON");
val3.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
val3.renderQueue = 3000;
val3.color = Color.white;
val3.SetColor("_BaseColor", val3.color);
val3.enableInstancing = true;
standableMaterial = val3;
Material val4 = new Material(val2);
val3 = val4;
val3 = val4;
val3.SetFloat("_Surface", 1f);
val3.SetFloat("_Blend", 0f);
val3.SetInt("_IgnoreProjector", 1);
val3.SetInt("_ReceiveShadows", 0);
val3.SetInt("_ZWrite", 0);
val3.SetInt("_SrcBlend", 5);
val3.SetInt("_DstBlend", 10);
val3.DisableKeyword("_ALPHATEST_ON");
val3.EnableKeyword("_ALPHABLEND_ON");
val3.DisableKeyword("_ALPHAPREMULTIPLY_ON");
val3.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
val3.renderQueue = 3000;
val3.color = Color.magenta;
val3.SetColor("_BaseColor", val3.color);
val3.enableInstancing = true;
nonStandableMaterial = val3;
RenderParams val5 = default(RenderParams);
((RenderParams)(ref val5))..ctor(standableMaterial);
((RenderParams)(ref val5)).layer = cullingLayer;
standableRP = val5;
((RenderParams)(ref val5))..ctor(nonStandableMaterial);
((RenderParams)(ref val5)).layer = cullingLayer;
nonStandableRP = val5;
SceneManager.sceneLoaded += OnSceneLoaded;
configStandableBallColor.SettingChanged += Color_SettingChanged;
configNonStandableBallColor.SettingChanged += Color_SettingChanged;
configMode.SettingChanged += ConfigMode_SettingChanged;
configRange.SettingChanged += Color_SettingChanged;
configXZFreq.SettingChanged += Color_SettingChanged;
configMaximumPointsPerFrame.SettingChanged += Color_SettingChanged;
configScalePercent.SettingChanged += Color_SettingChanged;
standableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedStandableMatrices.Add(new PositionKey[500]);
nonStandableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedNonStandableMatrices.Add(new PositionKey[500]);
Logger.LogInfo((object)"Loaded Foothold? version 1.5.0");
}
private void ConfigMode_SettingChanged(object sender, EventArgs e)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if (configMode.Value != Mode.FadeAway)
{
Color color = standableMaterial.GetColor("_BaseColor");
color.a = alpha;
standableMaterial.SetColor("_BaseColor", color);
((RenderParams)(ref standableRP)).material = standableMaterial;
color = nonStandableMaterial.GetColor("_BaseColor");
color.a = alpha;
nonStandableMaterial.SetColor("_BaseColor", color);
((RenderParams)(ref nonStandableRP)).material = nonStandableMaterial;
}
}
private void Color_SettingChanged(object sender, EventArgs e)
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
if (((Scene)(ref currentScene)).name.StartsWith("Level_") || ((Scene)(ref currentScene)).name.StartsWith("Airport"))
{
Logger.LogInfo((object)"Color_SettingChanged called");
ReturnAllBallsToPool();
freq = configXZFreq.Value;
safeFreq = (int)Mathf.Round(freq * 10f);
range = Mathf.Round(configRange.Value / freq) * freq;
safeRange = (int)Mathf.Round(range * 10f);
maximumRaysPerFrame = configMaximumPointsPerFrame.Value;
scalePercent = configScalePercent.Value / 100f;
scale = Vector3.one / 10f * scalePercent;
if (configStandableBallColor.Value == StandableColor.Green)
{
standable = Color.green;
}
else
{
standable = Color.white;
}
if (configNonStandableBallColor.Value == NonStandableColor.Magenta)
{
NonStandable = Color.magenta;
}
else
{
NonStandable = Color.red;
}
if (LastStandableColor != standable || LastNonStandableColor != NonStandable)
{
ReturnAllBallsToPool();
nearestGridToCamera.x = 0;
nearestGridToCamera.y = 0f;
nearestGridToCamera.z = 0;
}
if (LastStandableColor != standable)
{
standableMaterial.color = standable;
standableMaterial.SetColor("_BaseColor", standable);
((RenderParams)(ref standableRP)).material = standableMaterial;
LastStandableColor = standable;
}
if (LastNonStandableColor != NonStandable)
{
nonStandableMaterial.color = NonStandable;
nonStandableMaterial.SetColor("_BaseColor", NonStandable);
((RenderParams)(ref nonStandableRP)).material = nonStandableMaterial;
LastNonStandableColor = NonStandable;
}
}
}
private void OnGUI()
{
if (!configDebugMode.Value)
{
return;
}
int num = 0;
int num2 = 0;
num2 = nextFreeStandableMatrixIndex.Item1 * 500 + nextFreeStandableMatrixIndex.Item2;
num2 += nextFreeNonStandableMatrixIndex.Item1 * 500 + nextFreeNonStandableMatrixIndex.Item2;
foreach (PositionYList value in positionCache.Values)
{
num += value.list.Count;
}
if (num > highestCount)
{
highestCount = num;
}
if (num2 > highestBallCount)
{
highestBallCount = num2;
}
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("", Array.Empty<GUILayoutOption>());
GUILayout.Label("Camera Position: " + ((Vector3)(ref focalReferencePoint)).ToString("F2"), Array.Empty<GUILayoutOption>());
GUILayout.Label("balls: " + num2, Array.Empty<GUILayoutOption>());
GUILayout.Label("highestBallCount: " + highestBallCount, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (x/z count): " + positionCache.Count, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (total y count): " + num, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (highest total y count): " + highestCount, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (allocations): " + PositionKey.totalAllocations, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (totalInUse): " + PositionKey.totalInUse, Array.Empty<GUILayoutOption>());
GUILayout.Label("positionCache (leaks): " + (PositionKey.totalAllocations - (PositionKey.PoolCount + num)), Array.Empty<GUILayoutOption>());
GUILayout.Label("alpha: " + alpha, Array.Empty<GUILayoutOption>());
GUILayout.Label("isVisualizationRunning: " + isVisualizationRunning, Array.Empty<GUILayoutOption>());
GUILayout.Label("additionalDebugInfo: " + additionalDebugInfo, Array.Empty<GUILayoutOption>());
}
private void OnDestroy()
{
foreach (KeyValuePair<(int, int), PositionYList> item in positionCache.ToList())
{
RemoveBallsInVerticalRay(item.Key.Item1, item.Key.Item2);
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode _)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
currentScene = scene;
ReturnAllBallsToPool();
positionCache.Clear();
standableMatrices.Clear();
linkedStandableMatrices.Clear();
nonStandableMatrices.Clear();
linkedNonStandableMatrices.Clear();
standableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedStandableMatrices.Add(new PositionKey[500]);
nonStandableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedNonStandableMatrices.Add(new PositionKey[500]);
freq = configXZFreq.Value;
safeFreq = (int)Mathf.Round(freq * 10f);
range = Mathf.Round(configRange.Value / freq) * freq;
safeRange = (int)Mathf.Round(range * 10f);
maximumRaysPerFrame = configMaximumPointsPerFrame.Value;
scalePercent = configScalePercent.Value / 100f;
scale = Vector3.one / 10f * scalePercent;
nearestGridToCamera.x = 0;
nearestGridToCamera.y = 0f;
nearestGridToCamera.z = 0;
if (((Scene)(ref currentScene)).name.StartsWith("Level_") || ((Scene)(ref currentScene)).name.StartsWith("Airport"))
{
if (configStandableBallColor.Value == StandableColor.Green)
{
standable = Color.green;
}
else
{
standable = Color.white;
}
if (configNonStandableBallColor.Value == NonStandableColor.Magenta)
{
NonStandable = Color.magenta;
}
else
{
NonStandable = Color.red;
}
LastStandableColor = standable;
LastNonStandableColor = NonStandable;
standableMaterial.color = standable;
standableMaterial.SetColor("_BaseColor", standable);
((RenderParams)(ref standableRP)).material = standableMaterial;
nonStandableMaterial.color = NonStandable;
nonStandableMaterial.SetColor("_BaseColor", NonStandable);
((RenderParams)(ref nonStandableRP)).material = nonStandableMaterial;
}
}
private void Update()
{
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
if (!((Scene)(ref currentScene)).name.StartsWith("Level_") && !((Scene)(ref currentScene)).name.StartsWith("Airport"))
{
return;
}
if ((Object)(object)mainCamera == (Object)null)
{
MainCamera obj = Object.FindFirstObjectByType<MainCamera>();
mainCamera = ((obj != null) ? ((Component)obj).GetComponent<Camera>() : null);
}
else
{
if ((Object)(object)Camera.main == (Object)null)
{
return;
}
((RenderParams)(ref standableRP)).camera = Camera.main;
((RenderParams)(ref nonStandableRP)).camera = mainCamera;
if (!isVisualizationRunning)
{
Character specCharacter = MainCameraMovement.specCharacter;
if (MainCameraMovement.IsSpectating && (Object)(object)specCharacter != (Object)null)
{
focalReferencePoint = ((Component)specCharacter.refs.ragdoll.partDict[(BodypartType)4]).transform.position;
}
else
{
focalReferencePoint = ((Component)Character.localCharacter.refs.ragdoll.partDict[(BodypartType)4]).transform.position;
}
}
if (configMode.Value == Mode.Continuous && !isVisualizationRunning && !continuousPaused)
{
isVisualizationRunning = true;
((MonoBehaviour)this).StartCoroutine(RenderChangedVisualizationCoroutine());
}
CheckHotkeys();
if (configMode.Value == Mode.FadeAway)
{
SetBallAlphas();
}
try
{
for (int i = 0; i < standableMatrices.Count; i++)
{
if (standableMatrices[i] != null && standableMatrices[i].Length != 0)
{
if (i > nextFreeStandableMatrixIndex.Item1 || (i == nextFreeStandableMatrixIndex.Item1 && nextFreeStandableMatrixIndex.Item2 == 0))
{
break;
}
Graphics.RenderMeshInstanced<Matrix4x4>(ref standableRP, ballMesh, 0, standableMatrices[i], -1, 0);
}
}
for (int j = 0; j < nonStandableMatrices.Count; j++)
{
if (nonStandableMatrices[j] != null && nonStandableMatrices[j].Length != 0)
{
if (j > nextFreeNonStandableMatrixIndex.Item1 || (j == nextFreeNonStandableMatrixIndex.Item1 && nextFreeNonStandableMatrixIndex.Item2 == 0))
{
break;
}
Graphics.RenderMeshInstanced<Matrix4x4>(ref nonStandableRP, ballMesh, 0, nonStandableMatrices[j], -1, 0);
}
}
}
catch (Exception ex)
{
Logger.LogError((object)ex);
}
}
}
private void CheckHotkeys()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if (!Input.GetKeyDown(configActivationKey.Value) || isVisualizationRunning)
{
return;
}
if (configMode.Value == Mode.Continuous)
{
continuousPaused = !continuousPaused;
if (GlobalEvents.OnGemActivated != null)
{
GlobalEvents.OnGemActivated(!continuousPaused);
}
return;
}
if (configMode.Value == Mode.Trigger)
{
isVisualizationRunning = true;
((MonoBehaviour)this).StartCoroutine(RenderVisualizationCoroutine());
return;
}
if (configMode.Value == Mode.Toggle)
{
activated = !activated;
}
if (activated || configMode.Value == Mode.FadeAway)
{
isVisualizationRunning = true;
((MonoBehaviour)this).StartCoroutine(RenderVisualizationCoroutine());
}
else
{
ReturnAllBallsToPool();
}
}
private void ReturnAllBallsToPool()
{
foreach (KeyValuePair<(int, int), PositionYList> item in positionCache.ToList())
{
RemoveBallsInVerticalRay(item.Key.Item1, item.Key.Item2);
}
}
private static void ReturnBallToPool(PositionKey ball)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
if (!ball.ballVisible || ball.ballMatrixIndex.Item1 < 0 || ball.ballMatrixIndex.Item2 < 0)
{
ball.ballVisible = false;
ball.ballMatrixIndex.Item1 = -1;
ball.ballMatrixIndex.Item2 = -1;
return;
}
Matrix4x4 zero = Matrix4x4.zero;
PositionKey positionKey = null;
if (ball.standable)
{
nextFreeStandableMatrixIndex.Item2--;
if (nextFreeStandableMatrixIndex.Item2 < 0)
{
nextFreeStandableMatrixIndex.Item1--;
nextFreeStandableMatrixIndex.Item2 = 499;
}
if (nextFreeStandableMatrixIndex.Item1 >= 0 && nextFreeStandableMatrixIndex.Item2 >= 0)
{
zero = standableMatrices[nextFreeStandableMatrixIndex.Item1][nextFreeStandableMatrixIndex.Item2];
positionKey = linkedStandableMatrices[nextFreeStandableMatrixIndex.Item1][nextFreeStandableMatrixIndex.Item2];
standableMatrices[ball.ballMatrixIndex.Item1][ball.ballMatrixIndex.Item2] = zero;
linkedStandableMatrices[ball.ballMatrixIndex.Item1][ball.ballMatrixIndex.Item2] = positionKey;
positionKey.ballMatrixIndex = (ball.ballMatrixIndex.Item1, ball.ballMatrixIndex.Item2);
}
if (nextFreeStandableMatrixIndex.Item1 < 0)
{
nextFreeStandableMatrixIndex.Item1 = 0;
nextFreeStandableMatrixIndex.Item2 = 0;
standableMatrices[nextFreeStandableMatrixIndex.Item1][nextFreeStandableMatrixIndex.Item2] = Matrix4x4.zero;
}
}
else
{
nextFreeNonStandableMatrixIndex.Item2--;
if (nextFreeNonStandableMatrixIndex.Item2 < 0)
{
nextFreeNonStandableMatrixIndex.Item1--;
nextFreeNonStandableMatrixIndex.Item2 = 499;
}
if (nextFreeNonStandableMatrixIndex.Item1 >= 0 && nextFreeNonStandableMatrixIndex.Item2 >= 0)
{
zero = nonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2];
positionKey = linkedNonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2];
nonStandableMatrices[ball.ballMatrixIndex.Item1][ball.ballMatrixIndex.Item2] = zero;
linkedNonStandableMatrices[ball.ballMatrixIndex.Item1][ball.ballMatrixIndex.Item2] = positionKey;
positionKey.ballMatrixIndex = (ball.ballMatrixIndex.Item1, ball.ballMatrixIndex.Item2);
nonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2] = Matrix4x4.zero;
}
if (nextFreeNonStandableMatrixIndex.Item1 < 0)
{
nextFreeNonStandableMatrixIndex.Item1 = 0;
nextFreeNonStandableMatrixIndex.Item2 = 0;
nonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2] = Matrix4x4.zero;
}
}
ball.ballVisible = false;
ball.ballMatrixIndex.Item1 = -1;
ball.ballMatrixIndex.Item2 = -1;
totalCalls++;
}
private void PlaceBall(PositionKey positionKey)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if (positionKey.ballVisible)
{
return;
}
Matrix4x4 val = (positionKey.matrix = Matrix4x4.TRS(positionKey.position, Quaternion.identity, scale));
positionKey.ballVisible = true;
if (positionKey.standable)
{
standableMatrices[nextFreeStandableMatrixIndex.Item1][nextFreeStandableMatrixIndex.Item2] = val;
linkedStandableMatrices[nextFreeStandableMatrixIndex.Item1][nextFreeStandableMatrixIndex.Item2] = positionKey;
positionKey.ballMatrixIndex = (nextFreeStandableMatrixIndex.Item1, nextFreeStandableMatrixIndex.Item2);
nextFreeStandableMatrixIndex.Item2++;
if (nextFreeStandableMatrixIndex.Item2 >= 500)
{
nextFreeStandableMatrixIndex.Item1++;
nextFreeStandableMatrixIndex.Item2 = 0;
if (standableMatrices.Count <= nextFreeStandableMatrixIndex.Item1)
{
standableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedStandableMatrices.Add(new PositionKey[500]);
}
}
}
else
{
nonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2] = val;
linkedNonStandableMatrices[nextFreeNonStandableMatrixIndex.Item1][nextFreeNonStandableMatrixIndex.Item2] = positionKey;
positionKey.ballMatrixIndex = (nextFreeNonStandableMatrixIndex.Item1, nextFreeNonStandableMatrixIndex.Item2);
nextFreeNonStandableMatrixIndex.Item2++;
if (nextFreeNonStandableMatrixIndex.Item2 >= 500)
{
nextFreeNonStandableMatrixIndex.Item1++;
nextFreeNonStandableMatrixIndex.Item2 = 0;
if (nonStandableMatrices.Count <= nextFreeNonStandableMatrixIndex.Item1)
{
nonStandableMatrices.Add((Matrix4x4[])(object)new Matrix4x4[500]);
linkedNonStandableMatrices.Add(new PositionKey[500]);
}
}
}
totalCalls++;
}
[IteratorStateMachine(typeof(<RenderVisualizationCoroutine>d__61))]
private IEnumerator RenderVisualizationCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RenderVisualizationCoroutine>d__61(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<RenderChangedVisualizationCoroutine>d__62))]
private IEnumerator RenderChangedVisualizationCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RenderChangedVisualizationCoroutine>d__62(0)
{
<>4__this = this
};
}
public static List<Rect> SubtractRect(Rect original, Rect cut)
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
List<Rect> list = new List<Rect>();
float num = Mathf.Max(((Rect)(ref original)).xMin, ((Rect)(ref cut)).xMin);
float num2 = Mathf.Min(((Rect)(ref original)).xMax, ((Rect)(ref cut)).xMax);
float num3 = Mathf.Max(((Rect)(ref original)).yMin, ((Rect)(ref cut)).yMin);
float num4 = Mathf.Min(((Rect)(ref original)).yMax, ((Rect)(ref cut)).yMax);
if (num2 <= num || num4 <= num3)
{
list.Add(original);
return list;
}
Rect val = Rect.MinMaxRect(num, num3, num2, num4);
if (((Rect)(ref val)).yMin > ((Rect)(ref original)).yMin)
{
Rect item = default(Rect);
((Rect)(ref item))..ctor(((Rect)(ref original)).xMin, ((Rect)(ref original)).yMin, ((Rect)(ref original)).width, ((Rect)(ref val)).yMin - ((Rect)(ref original)).yMin);
list.Add(item);
}
if (((Rect)(ref val)).yMax < ((Rect)(ref original)).yMax)
{
Rect item2 = default(Rect);
((Rect)(ref item2))..ctor(((Rect)(ref original)).xMin, ((Rect)(ref val)).yMax, ((Rect)(ref original)).width, ((Rect)(ref original)).yMax - ((Rect)(ref val)).yMax);
list.Add(item2);
}
if (((Rect)(ref val)).xMin > ((Rect)(ref original)).xMin)
{
Rect item3 = default(Rect);
((Rect)(ref item3))..ctor(((Rect)(ref original)).xMin, ((Rect)(ref val)).yMin, ((Rect)(ref val)).xMin - ((Rect)(ref original)).xMin, ((Rect)(ref val)).height);
list.Add(item3);
}
if (((Rect)(ref val)).xMax < ((Rect)(ref original)).xMax)
{
Rect item4 = default(Rect);
((Rect)(ref item4))..ctor(((Rect)(ref val)).xMax, ((Rect)(ref val)).yMin, ((Rect)(ref original)).xMax - ((Rect)(ref val)).xMax, ((Rect)(ref val)).height);
list.Add(item4);
}
return list;
}
[IteratorStateMachine(typeof(<SortWithYield>d__64))]
private IEnumerator SortWithYield(List<Vector3> list, Vector3 cameraPosition, int chunkSize)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SortWithYield>d__64(0)
{
<>4__this = this,
list = list,
cameraPosition = cameraPosition,
chunkSize = chunkSize
};
}
private void CheckAndPlaceBallsInVerticalRay(int x, float y, int z, bool onlyInFrustum)
{
PositionYList yDict = CheckCacheMiss(x, y, z);
PlaceBallsInVerticalRay(yDict, y, onlyInFrustum);
}
private void PlaceBallsInVerticalRay(int x, float y, int z, bool onlyInFrustum)
{
if (positionCache.TryGetValue((x, z), out var value))
{
PlaceBallsInVerticalRay(value, y, onlyInFrustum);
}
}
private void PlaceBallsInVerticalRay(PositionYList yDict, float y, bool onlyInFrustum)
{
foreach (PositionKey value in yDict.list.Values)
{
if (value != null)
{
bool flag;
if (onlyInFrustum)
{
flag = cameraFrustum.PreppedYContains(value.position.y);
}
else
{
float num = Mathf.Abs(y - value.position.y);
flag = num <= range;
}
if (!value.ballVisible && flag)
{
PlaceBall(value);
}
else if (value.ballVisible && !flag)
{
ReturnBallToPool(value);
}
}
}
}
private void RemoveBallsInVerticalRay(int xIndex, int zIndex, bool expireCache = true)
{
if (!positionCache.TryGetValue((xIndex, zIndex), out var value))
{
return;
}
if (expireCache)
{
positionCache.Remove((xIndex, zIndex));
value.ReturnToPool();
return;
}
foreach (PositionKey value2 in value.list.Values)
{
if (value2 != null)
{
ReturnBallToPool(value2);
}
}
}
private PositionYList CheckCacheMiss(int x, float y, int z)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
PositionYList value = null;
if (!positionCache.TryGetValue((x, z), out value) || value == null || value.rayTop < y + range || value.rayBottom > y - range)
{
if (value != null)
{
positionCache.Remove((x, z));
value.ReturnToPool();
}
value = PositionYList.GetNew();
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor((float)x / 10f, y + range * 1.5f, (float)z / 10f);
int num = Physics.RaycastNonAlloc(val, Vector3.down, _terrainHitBuffer, range * 3f, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)1)), (QueryTriggerInteraction)0);
totalCalls++;
value.rayTop = val.y;
value.rayBottom = val.y - range * 3f;
for (int i = 0; i < num; i++)
{
RaycastHit val2 = _terrainHitBuffer[i];
if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).transform) || ((RaycastHit)(ref val2)).point.y < 0.5f)
{
continue;
}
CollisionModifier component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<CollisionModifier>();
if (!Object.op_Implicit((Object)(object)component) || component.standable)
{
float num2 = Vector3.Angle(Vector3.up, ((RaycastHit)(ref val2)).normal);
if (!(num2 < 30f) && !value.list.ContainsKey((int)Mathf.Round(((RaycastHit)(ref val2)).point.y * 10f)))
{
PositionKey @new = PositionKey.GetNew(((RaycastHit)(ref val2)).point.x, ((RaycastHit)(ref val2)).point.y, ((RaycastHit)(ref val2)).point.z, num2 < 50f);
value.list.Add((int)Mathf.Round(((RaycastHit)(ref val2)).point.y * 10f), @new);
}
}
}
positionCache[(x, z)] = value;
}
return value;
}
private void SetBallAlphas()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
if (configMode.Value == Mode.FadeAway && !((double)(Time.time - lastAlphaChangeTime) < 0.05))
{
lastAlphaChangeTime = Time.time;
alpha = Mathf.Lerp(1f, 0f, Mathf.Clamp01((Time.time - (lastScanTime + 3f)) / 3f));
Color color = standableMaterial.GetColor("_BaseColor");
color.a = alpha;
standableMaterial.SetColor("_BaseColor", color);
((RenderParams)(ref standableRP)).material = standableMaterial;
color = nonStandableMaterial.GetColor("_BaseColor");
color.a = alpha;
nonStandableMaterial.SetColor("_BaseColor", color);
((RenderParams)(ref nonStandableRP)).material = nonStandableMaterial;
if (alpha <= 0f)
{
ReturnAllBallsToPool();
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Foothold";
public const string PLUGIN_NAME = "Foothold?";
public const string PLUGIN_VERSION = "1.5.0";
}
}