private void RenderPoleMesh(ushort vehicleID, ref Vehicle vehicleData, Vector3 position, Quaternion rotation, Vector3 swayPosition, bool underground, bool overground, VehicleManager vehicleManager, VehicleInfo.MeshInfo meshInfo, MaterialPropertyBlock materialBlock) { VehicleInfoBase subInfo = meshInfo.m_subInfo; bool flag = Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor; if ((flag && !BuildingDecoration.IsSubMeshRendered(subInfo)) || (meshInfo.m_vehicleFlagsRequired & (Vehicle.Flags.TakingOff | Vehicle.Flags.Landing)) == 0 || !(subInfo != null)) { return; } Matrix4x4 matrix = CalculatePoleMatrix(vehicleID, ref vehicleData, position, rotation, swayPosition, meshInfo, subInfo, flag); vehicleManager.m_drawCallData.m_defaultCalls++; if (underground) { if (subInfo.m_undergroundMaterial == null && subInfo.m_material != null) { VehicleProperties properties = vehicleManager.m_properties; if (properties != null) { subInfo.m_undergroundMaterial = new Material(properties.m_undergroundShader); subInfo.m_undergroundMaterial.CopyPropertiesFromMaterial(subInfo.m_material); } } Graphics.DrawMesh(subInfo.m_mesh, matrix, subInfo.m_undergroundMaterial, vehicleManager.m_undergroundLayer, null, 0, materialBlock); } if (overground) { Graphics.DrawMesh(subInfo.m_mesh, matrix, subInfo.m_material, m_info.m_prefabDataLayer, null, 0, materialBlock); } }
private Matrix4x4 CalculatePoleMatrix(ushort vehicleID, ref Vehicle vehicleData, Vector3 position, Quaternion rotation, Vector3 swayPosition, VehicleInfo.MeshInfo meshInfo, VehicleInfoBase subInfo, bool assetEditor) { Vehicle.Flags flags = meshInfo.m_vehicleFlagsRequired & (Vehicle.Flags.TakingOff | Vehicle.Flags.Landing); VehicleInfo.VehicleType wireType = GetWireType(vehicleData.m_flags, flags); float poleLength = m_poleLength; Quaternion rhs = Quaternion.Euler(swayPosition.z * 57.29578f, 0f, swayPosition.x * -57.29578f); Vector3 a = (flags != Vehicle.Flags.TakingOff) ? Vector3.left : Vector3.right; Vector3 vector = position + rotation * rhs * (a * m_offsetX + Vector3.back * m_offsetZ + Vector3.up * m_offsetY); Vector3 poleEnd = position + rotation * rhs * (a * m_offsetX + Vector3.back * (m_offsetZ + poleLength) + Vector3.up * m_offsetY); Vector3 wireAttachmentPosition; if (!assetEditor) { TrolleybusReversePatch.FindWireConnection(vehicleID, ref vehicleData, wireType, poleLength, vector, poleEnd, out wireAttachmentPosition); } else { wireAttachmentPosition = position + rotation * rhs * (a * m_offsetX + Vector3.back * (m_offsetZ + poleLength) + Vector3.up * 4.55f); } Matrix4x4 result = default(Matrix4x4); result.SetTRS(vector, Quaternion.LookRotation(vector - wireAttachmentPosition, Vector3.up), Vector3.one); return(result); }
// Run before the original method. Skip the original one if the vehicle is a cable car public static bool Prefix(RenderManager.CameraInfo cameraInfo, VehicleInfo info, Vector3 position, ref Quaternion rotation, Vector3 swayPosition, Vector4 lightState, Vector4 tyrePosition, Vector3 velocity, float acceleration, Color color, Vehicle.Flags flags, int variationMask, InstanceID id, bool underground, bool overground) { // if the vehicle is not a cable car, skip and use the original method if ((int)info.m_vehicleType != 0x1000) { return(true); } // limit rotation along the x and z axes for all meshes except submesh1 // submesh1 would rotate in the original way(along with the cable) Quaternion originalRotation = rotation; rotation.x = 0.0f; rotation.z = 0.0f; // change how cable cars sway // so they don't move up and down on the cables as if they're ships moving in sea waves swayPosition.y = 0.0f; if ((cameraInfo.m_layerMask & (1 << info.m_prefabDataLayer)) == 0) { // return false to skip the original method return(false); } Vector3 scale = Vector3.one; if ((flags & Vehicle.Flags.Inverted) != 0) { scale = new Vector3(-1f, 1f, -1f); Vector4 vector = lightState; lightState.x = vector.y; lightState.y = vector.x; lightState.z = vector.w; lightState.w = vector.z; } info.m_vehicleAI.RenderExtraStuff(id.Vehicle, ref Singleton <VehicleManager> .instance.m_vehicles.m_buffer[id.Vehicle], cameraInfo, id, position, rotation, tyrePosition, lightState, scale, swayPosition, underground, overground); if (cameraInfo.CheckRenderDistance(position, info.m_lodRenderDistance)) { VehicleManager instance = Singleton <VehicleManager> .instance; Matrix4x4 bodyMatrix = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref rotation, ref scale, ref swayPosition); Matrix4x4 originalBodyMatrix = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref originalRotation, ref scale, ref swayPosition); Matrix4x4 value = info.m_vehicleAI.CalculateTyreMatrix(flags, ref position, ref rotation, ref scale, ref bodyMatrix); if (Singleton <InfoManager> .instance.CurrentMode == InfoManager.InfoMode.None) { RenderGroup.MeshData effectMeshData = info.m_vehicleAI.GetEffectMeshData(); EffectInfo.SpawnArea area = new EffectInfo.SpawnArea(bodyMatrix, effectMeshData, info.m_generatedInfo.m_tyres, info.m_lightPositions); if (info.m_effects != null) { for (int i = 0; i < info.m_effects.Length; i++) { VehicleInfo.Effect effect = info.m_effects[i]; if (((effect.m_vehicleFlagsRequired | effect.m_vehicleFlagsForbidden) & flags) == effect.m_vehicleFlagsRequired && effect.m_parkedFlagsRequired == VehicleParked.Flags.None) { effect.m_effect.RenderEffect(id, area, velocity, acceleration, 1f, -1f, Singleton <SimulationManager> .instance.m_simulationTimeDelta, cameraInfo); } } } } if ((flags & Vehicle.Flags.Inverted) != 0) { tyrePosition.x = 0f - tyrePosition.x; tyrePosition.y = 0f - tyrePosition.y; } MaterialPropertyBlock materialBlock = instance.m_materialBlock; materialBlock.Clear(); materialBlock.SetMatrix(instance.ID_TyreMatrix, value); materialBlock.SetVector(instance.ID_TyrePosition, tyrePosition); materialBlock.SetVector(instance.ID_LightState, lightState); bool flag = Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor; if (!flag) { materialBlock.SetColor(instance.ID_Color, color); } bool flag2 = true; if (flag) { flag2 = BuildingDecoration.IsMainMeshRendered(); } if (info.m_subMeshes != null) { for (int j = 0; j < info.m_subMeshes.Length; j++) { VehicleInfo.MeshInfo meshInfo = info.m_subMeshes[j]; VehicleInfoBase subInfo = meshInfo.m_subInfo; if ((!flag && ((meshInfo.m_vehicleFlagsRequired | meshInfo.m_vehicleFlagsForbidden) & flags) == meshInfo.m_vehicleFlagsRequired && (meshInfo.m_variationMask & variationMask) == 0 && meshInfo.m_parkedFlagsRequired == VehicleParked.Flags.None) || (flag && BuildingDecoration.IsSubMeshRendered(subInfo))) { if (!(subInfo != null)) { continue; } instance.m_drawCallData.m_defaultCalls++; if (underground) { if (subInfo.m_undergroundMaterial == null && subInfo.m_material != null) { VehicleProperties properties = instance.m_properties; if (properties != null) { subInfo.m_undergroundMaterial = new Material(properties.m_undergroundShader); subInfo.m_undergroundMaterial.CopyPropertiesFromMaterial(subInfo.m_material); } } subInfo.m_undergroundMaterial.SetVectorArray(instance.ID_TyreLocation, subInfo.m_generatedInfo.m_tyres); if (j == 1) { Graphics.DrawMesh(subInfo.m_mesh, originalBodyMatrix, subInfo.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock); } else { Graphics.DrawMesh(subInfo.m_mesh, bodyMatrix, subInfo.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock); } } if (overground) { subInfo.m_material.SetVectorArray(instance.ID_TyreLocation, subInfo.m_generatedInfo.m_tyres); if (j == 1) { Graphics.DrawMesh(subInfo.m_mesh, originalBodyMatrix, subInfo.m_material, info.m_prefabDataLayer, null, 0, materialBlock); } else { Graphics.DrawMesh(subInfo.m_mesh, bodyMatrix, subInfo.m_material, info.m_prefabDataLayer, null, 0, materialBlock); } } } else if (subInfo == null) { flag2 = false; } } } if (!flag2) { // return false to skip the original method return(false); } instance.m_drawCallData.m_defaultCalls++; if (underground) { if (info.m_undergroundMaterial == null && info.m_material != null) { VehicleProperties properties2 = instance.m_properties; if (properties2 != null) { info.m_undergroundMaterial = new Material(properties2.m_undergroundShader); info.m_undergroundMaterial.CopyPropertiesFromMaterial(info.m_material); } } info.m_undergroundMaterial.SetVectorArray(instance.ID_TyreLocation, info.m_generatedInfo.m_tyres); Graphics.DrawMesh(info.m_mesh, bodyMatrix, info.m_undergroundMaterial, instance.m_undergroundLayer, null, 0, materialBlock); } if (overground) { info.m_material.SetVectorArray(instance.ID_TyreLocation, info.m_generatedInfo.m_tyres); Graphics.DrawMesh(info.m_mesh, bodyMatrix, info.m_material, info.m_prefabDataLayer, null, 0, materialBlock); } // return false to skip the original method return(false); } Matrix4x4 bodyMatrix2 = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref rotation, ref scale, ref swayPosition); Matrix4x4 originalBodyMatrix2 = info.m_vehicleAI.CalculateBodyMatrix(flags, ref position, ref originalRotation, ref scale, ref swayPosition); if (Singleton <ToolManager> .instance.m_properties.m_mode == ItemClass.Availability.AssetEditor) { Matrix4x4 value2 = info.m_vehicleAI.CalculateTyreMatrix(flags, ref position, ref rotation, ref scale, ref bodyMatrix2); VehicleManager instance2 = Singleton <VehicleManager> .instance; MaterialPropertyBlock materialBlock2 = instance2.m_materialBlock; materialBlock2.Clear(); materialBlock2.SetMatrix(instance2.ID_TyreMatrix, value2); materialBlock2.SetVector(instance2.ID_TyrePosition, tyrePosition); materialBlock2.SetVector(instance2.ID_LightState, lightState); Mesh mesh = null; Material material = null; if (info.m_lodObject != null) { MeshFilter component = info.m_lodObject.GetComponent <MeshFilter>(); if (component != null) { mesh = component.sharedMesh; } Renderer component2 = info.m_lodObject.GetComponent <Renderer>(); if (component2 != null) { material = component2.sharedMaterial; } } if (mesh != null && material != null) { materialBlock2.SetVectorArray(instance2.ID_TyreLocation, info.m_generatedInfo.m_tyres); Graphics.DrawMesh(mesh, bodyMatrix2, material, info.m_prefabDataLayer, null, 0, materialBlock2); } } else if (Singleton <InfoManager> .instance.CurrentMode == InfoManager.InfoMode.None) { RenderGroup.MeshData effectMeshData2 = info.m_vehicleAI.GetEffectMeshData(); EffectInfo.SpawnArea area2 = new EffectInfo.SpawnArea(bodyMatrix2, effectMeshData2, info.m_generatedInfo.m_tyres, info.m_lightPositions); if (info.m_effects != null) { for (int k = 0; k < info.m_effects.Length; k++) { VehicleInfo.Effect effect2 = info.m_effects[k]; if (((effect2.m_vehicleFlagsRequired | effect2.m_vehicleFlagsForbidden) & flags) == effect2.m_vehicleFlagsRequired && effect2.m_parkedFlagsRequired == VehicleParked.Flags.None) { effect2.m_effect.RenderEffect(id, area2, velocity, acceleration, 1f, -1f, Singleton <SimulationManager> .instance.m_simulationTimeDelta, cameraInfo); } } } } bool flag3 = true; if (info.m_subMeshes != null) { for (int l = 0; l < info.m_subMeshes.Length; l++) { VehicleInfo.MeshInfo meshInfo2 = info.m_subMeshes[l]; VehicleInfoBase subInfo2 = meshInfo2.m_subInfo; if (((meshInfo2.m_vehicleFlagsRequired | meshInfo2.m_vehicleFlagsForbidden) & flags) == meshInfo2.m_vehicleFlagsRequired && (meshInfo2.m_variationMask & variationMask) == 0 && meshInfo2.m_parkedFlagsRequired == VehicleParked.Flags.None) { if (!(subInfo2 != null)) { continue; } if (underground) { if (l == 1) { subInfo2.m_undergroundLodTransforms[subInfo2.m_undergroundLodCount] = originalBodyMatrix2; } else { subInfo2.m_undergroundLodTransforms[subInfo2.m_undergroundLodCount] = bodyMatrix2; } subInfo2.m_undergroundLodLightStates[subInfo2.m_undergroundLodCount] = lightState; subInfo2.m_undergroundLodColors[subInfo2.m_undergroundLodCount] = color.linear; subInfo2.m_undergroundLodMin = Vector3.Min(subInfo2.m_undergroundLodMin, position); subInfo2.m_undergroundLodMax = Vector3.Max(subInfo2.m_undergroundLodMax, position); if (++subInfo2.m_undergroundLodCount == subInfo2.m_undergroundLodTransforms.Length) { Vehicle.RenderUndergroundLod(cameraInfo, subInfo2); } } if (overground) { if (l == 1) { subInfo2.m_lodTransforms[subInfo2.m_lodCount] = originalBodyMatrix2; } else { subInfo2.m_lodTransforms[subInfo2.m_lodCount] = bodyMatrix2; } subInfo2.m_lodLightStates[subInfo2.m_lodCount] = lightState; subInfo2.m_lodColors[subInfo2.m_lodCount] = color.linear; subInfo2.m_lodMin = Vector3.Min(subInfo2.m_lodMin, position); subInfo2.m_lodMax = Vector3.Max(subInfo2.m_lodMax, position); if (++subInfo2.m_lodCount == subInfo2.m_lodTransforms.Length) { Vehicle.RenderLod(cameraInfo, subInfo2); } } } else if (subInfo2 == null) { flag3 = false; } } } if (!flag3) { return(false); } if (underground) { info.m_undergroundLodTransforms[info.m_undergroundLodCount] = bodyMatrix2; info.m_undergroundLodLightStates[info.m_undergroundLodCount] = lightState; info.m_undergroundLodColors[info.m_undergroundLodCount] = color.linear; info.m_undergroundLodMin = Vector3.Min(info.m_undergroundLodMin, position); info.m_undergroundLodMax = Vector3.Max(info.m_undergroundLodMax, position); if (++info.m_undergroundLodCount == info.m_undergroundLodTransforms.Length) { Vehicle.RenderUndergroundLod(cameraInfo, info); } } if (overground) { info.m_lodTransforms[info.m_lodCount] = bodyMatrix2; info.m_lodLightStates[info.m_lodCount] = lightState; info.m_lodColors[info.m_lodCount] = color.linear; info.m_lodMin = Vector3.Min(info.m_lodMin, position); info.m_lodMax = Vector3.Max(info.m_lodMax, position); if (++info.m_lodCount == info.m_lodTransforms.Length) { Vehicle.RenderLod(cameraInfo, info); } } // return false to skip the original method return(false); }
public static bool EndRenderingImplPrefix(VehicleManager __instance, RenderManager.CameraInfo cameraInfo, ulong[] ___m_renderBuffer, ulong[] ___m_renderBuffer2) { float levelOfDetailFactor = RenderManager.LevelOfDetailFactor; float near = cameraInfo.m_near; float d = Mathf.Min(levelOfDetailFactor * 5000f, Mathf.Min(levelOfDetailFactor * 2000f + cameraInfo.m_height * 0.6f, cameraInfo.m_far)); Vector3 lhs = cameraInfo.m_position + cameraInfo.m_directionA * near; Vector3 rhs = cameraInfo.m_position + cameraInfo.m_directionB * near; Vector3 lhs2 = cameraInfo.m_position + cameraInfo.m_directionC * near; Vector3 rhs2 = cameraInfo.m_position + cameraInfo.m_directionD * near; Vector3 lhs3 = cameraInfo.m_position + cameraInfo.m_directionA * d; Vector3 rhs3 = cameraInfo.m_position + cameraInfo.m_directionB * d; Vector3 lhs4 = cameraInfo.m_position + cameraInfo.m_directionC * d; Vector3 rhs4 = cameraInfo.m_position + cameraInfo.m_directionD * d; Vector3 vector = Vector3.Min(Vector3.Min(Vector3.Min(lhs, rhs), Vector3.Min(lhs2, rhs2)), Vector3.Min(Vector3.Min(lhs3, rhs3), Vector3.Min(lhs4, rhs4))); Vector3 vector2 = Vector3.Max(Vector3.Max(Vector3.Max(lhs, rhs), Vector3.Max(lhs2, rhs2)), Vector3.Max(Vector3.Max(lhs3, rhs3), Vector3.Max(lhs4, rhs4))); int num = Mathf.Max((int)((vector.x - 10f) / 32f + 270f), 0); int num2 = Mathf.Max((int)((vector.z - 10f) / 32f + 270f), 0); int num3 = Mathf.Min((int)((vector2.x + 10f) / 32f + 270f), 539); int num4 = Mathf.Min((int)((vector2.z + 10f) / 32f + 270f), 539); for (int i = num2; i <= num4; i++) { for (int j = num; j <= num3; j++) { ushort num5 = __instance.m_vehicleGrid[i * 540 + j]; if (num5 != 0) { ___m_renderBuffer[num5 >> 6] |= (ulong)(1L << (int)num5); } } } float near2 = cameraInfo.m_near; float d2 = Mathf.Min(2000f, cameraInfo.m_far); Vector3 lhs5 = cameraInfo.m_position + cameraInfo.m_directionA * near2; Vector3 rhs5 = cameraInfo.m_position + cameraInfo.m_directionB * near2; Vector3 lhs6 = cameraInfo.m_position + cameraInfo.m_directionC * near2; Vector3 rhs6 = cameraInfo.m_position + cameraInfo.m_directionD * near2; Vector3 lhs7 = cameraInfo.m_position + cameraInfo.m_directionA * d2; Vector3 rhs7 = cameraInfo.m_position + cameraInfo.m_directionB * d2; Vector3 lhs8 = cameraInfo.m_position + cameraInfo.m_directionC * d2; Vector3 rhs8 = cameraInfo.m_position + cameraInfo.m_directionD * d2; Vector3 vector3 = Vector3.Min(Vector3.Min(Vector3.Min(lhs5, rhs5), Vector3.Min(lhs6, rhs6)), Vector3.Min(Vector3.Min(lhs7, rhs7), Vector3.Min(lhs8, rhs8))); Vector3 vector4 = Vector3.Max(Vector3.Max(Vector3.Max(lhs5, rhs5), Vector3.Max(lhs6, rhs6)), Vector3.Max(Vector3.Max(lhs7, rhs7), Vector3.Max(lhs8, rhs8))); int num6 = Mathf.Max((int)((vector3.x - 10f) / 32f + 270f), 0); int num7 = Mathf.Max((int)((vector3.z - 10f) / 32f + 270f), 0); int num8 = Mathf.Min((int)((vector4.x + 10f) / 32f + 270f), 539); int num9 = Mathf.Min((int)((vector4.z + 10f) / 32f + 270f), 539); for (int k = num7; k <= num9; k++) { for (int l = num6; l <= num8; l++) { ushort num10 = __instance.m_parkedGrid[k * 540 + l]; if (num10 != 0) { ___m_renderBuffer2[num10 >> 6] |= (ulong)(1L << (int)num10); } } } float near3 = cameraInfo.m_near; float num11 = Mathf.Min(10000f, cameraInfo.m_far); Vector3 lhs9 = cameraInfo.m_position + cameraInfo.m_directionA * near3; Vector3 rhs9 = cameraInfo.m_position + cameraInfo.m_directionB * near3; Vector3 lhs10 = cameraInfo.m_position + cameraInfo.m_directionC * near3; Vector3 rhs10 = cameraInfo.m_position + cameraInfo.m_directionD * near3; Vector3 lhs11 = cameraInfo.m_position + cameraInfo.m_directionA * num11; Vector3 rhs11 = cameraInfo.m_position + cameraInfo.m_directionB * num11; Vector3 lhs12 = cameraInfo.m_position + cameraInfo.m_directionC * num11; Vector3 rhs12 = cameraInfo.m_position + cameraInfo.m_directionD * num11; Vector3 vector5 = Vector3.Min(Vector3.Min(Vector3.Min(lhs9, rhs9), Vector3.Min(lhs10, rhs10)), Vector3.Min(Vector3.Min(lhs11, rhs11), Vector3.Min(lhs12, rhs12))); Vector3 vector6 = Vector3.Max(Vector3.Max(Vector3.Max(lhs9, rhs9), Vector3.Max(lhs10, rhs10)), Vector3.Max(Vector3.Max(lhs11, rhs11), Vector3.Max(lhs12, rhs12))); if (cameraInfo.m_shadowOffset.x < 0f) { vector6.x = Mathf.Min(cameraInfo.m_position.x + num11, vector6.x - cameraInfo.m_shadowOffset.x); } else { vector5.x = Mathf.Max(cameraInfo.m_position.x - num11, vector5.x - cameraInfo.m_shadowOffset.x); } if (cameraInfo.m_shadowOffset.z < 0f) { vector6.z = Mathf.Min(cameraInfo.m_position.z + num11, vector6.z - cameraInfo.m_shadowOffset.z); } else { vector5.z = Mathf.Max(cameraInfo.m_position.z - num11, vector5.z - cameraInfo.m_shadowOffset.z); } int num12 = Mathf.Max((int)((vector5.x - 50f) / 320f + 27f), 0); int num13 = Mathf.Max((int)((vector5.z - 50f) / 320f + 27f), 0); int num14 = Mathf.Min((int)((vector6.x + 50f) / 320f + 27f), 53); int num15 = Mathf.Min((int)((vector6.z + 50f) / 320f + 27f), 53); for (int m = num13; m <= num15; m++) { for (int n = num12; n <= num14; n++) { ushort num16 = __instance.m_vehicleGrid2[m * 54 + n]; if (num16 != 0) { ___m_renderBuffer[num16 >> 6] |= (ulong)(1L << (int)num16); } } } int num17 = ___m_renderBuffer.Length; for (int num18 = 0; num18 < num17; num18++) { ulong num19 = ___m_renderBuffer[num18]; if (num19 == 0) { continue; } for (int num20 = 0; num20 < 64; num20++) { ulong num21 = (ulong)(1L << num20); if ((num19 & num21) == 0) { continue; } ushort num22 = (ushort)((num18 << 6) | num20); if (!__instance.m_vehicles.m_buffer[num22].RenderInstance(cameraInfo, num22)) { num19 &= ~num21; } ushort nextGridVehicle = __instance.m_vehicles.m_buffer[num22].m_nextGridVehicle; int num23 = 0; while (nextGridVehicle != 0) { int num24 = nextGridVehicle >> 6; num21 = (ulong)(1L << (int)nextGridVehicle); if (num24 == num18) { if ((num19 & num21) != 0) { break; } num19 |= num21; } else { ulong num25 = ___m_renderBuffer[num24]; if ((num25 & num21) != 0) { break; } ___m_renderBuffer[num24] = (num25 | num21); } if (nextGridVehicle > num22) { break; } nextGridVehicle = __instance.m_vehicles.m_buffer[nextGridVehicle].m_nextGridVehicle; if (++num23 > 16384) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } ___m_renderBuffer[num18] = num19; } var action = new Action(() => { int num26 = ___m_renderBuffer2.Length; for (int num27 = 0; num27 < num26; num27++) { ulong num28 = ___m_renderBuffer2[num27]; if (num28 == 0) { continue; } for (int num29 = 0; num29 < 64; num29++) { ulong num30 = (ulong)(1L << num29); if ((num28 & num30) == 0) { continue; } ushort num31 = (ushort)((num27 << 6) | num29); if (!__instance.m_parkedVehicles.m_buffer[num31].RenderInstance(cameraInfo, num31)) { num28 &= ~num30; } ushort nextGridParked = __instance.m_parkedVehicles.m_buffer[num31].m_nextGridParked; int num32 = 0; while (nextGridParked != 0) { int num33 = nextGridParked >> 6; num30 = (ulong)(1L << (int)nextGridParked); if (num33 == num27) { if ((num28 & num30) != 0) { break; } num28 |= num30; } else { ulong num34 = ___m_renderBuffer2[num33]; if ((num34 & num30) != 0) { break; } ___m_renderBuffer2[num33] = (num34 | num30); } if (nextGridParked > num31) { break; } nextGridParked = __instance.m_parkedVehicles.m_buffer[nextGridParked].m_nextGridParked; if (++num32 > 32768) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } ___m_renderBuffer2[num27] = num28; } int num35 = PrefabCollection <VehicleInfo> .PrefabCount(); for (int num36 = 0; num36 < num35; num36++) { VehicleInfo prefab = PrefabCollection <VehicleInfo> .GetPrefab((uint)num36); if ((object)prefab == null) { continue; } if (prefab.m_lodCount != 0) { Vehicle.RenderLod(cameraInfo, prefab); } if (prefab.m_undergroundLodCount != 0) { Vehicle.RenderUndergroundLod(cameraInfo, prefab); } if (prefab.m_subMeshes == null) { continue; } for (int num37 = 0; num37 < prefab.m_subMeshes.Length; num37++) { VehicleInfoBase subInfo = prefab.m_subMeshes[num37].m_subInfo; if (subInfo != null) { if (subInfo.m_lodCount != 0) { Vehicle.RenderLod(cameraInfo, subInfo); } if (subInfo.m_undergroundLodCount != 0) { Vehicle.RenderUndergroundLod(cameraInfo, subInfo); } } } } }); #if UseTask Patcher.Dispatcher.Add(action); #else action.Invoke(); #endif return(false); }