-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6f3bca
commit 8b21539
Showing
9 changed files
with
377 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28307.136 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GKFreecam", "GKFreecam\GKFreecam.csproj", "{B92BB83A-F085-42DD-993E-8648F9D9C438}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B92BB83A-F085-42DD-993E-8648F9D9C438}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B92BB83A-F085-42DD-993E-8648F9D9C438}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B92BB83A-F085-42DD-993E-8648F9D9C438}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B92BB83A-F085-42DD-993E-8648F9D9C438}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {57812EE8-33DE-48D1-B598-2C8AD4C58ADD} | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using Harmony; | ||
using GKML; | ||
using UnityEngine; | ||
using System; | ||
|
||
namespace GKFreecam.Classes | ||
{ | ||
/// <summary> | ||
/// The CamState for the freecam. | ||
/// </summary> | ||
|
||
public class CamStateFreecam : CamState | ||
{ | ||
public Vector3 mouseOrigin; | ||
public int CamState; | ||
public Vector3 mouseOrigin2; | ||
|
||
public override ECamState state => ECamState.Follow; | ||
|
||
public override void Enter(Transform _Transform, Transform _Target) | ||
{ | ||
base.Enter(_Transform, _Target); | ||
} | ||
|
||
public override ECamState Manage(float dt) | ||
{ | ||
switch (CamState) | ||
{ | ||
case 1: | ||
CSOne(); | ||
break; | ||
|
||
case 2: | ||
CSTwo(); | ||
break; | ||
|
||
case 3: | ||
CSThree(); | ||
break; | ||
} | ||
return state; | ||
} | ||
|
||
public void CSOne() | ||
{ | ||
if (Input.GetMouseButtonDown(1)) | ||
mouseOrigin2 = Input.mousePosition; | ||
|
||
if (Input.GetMouseButton(1)) | ||
{ | ||
Vector3 vector2 = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin2); | ||
Vector3 translation = new Vector3(vector2.y * 2f, -vector2.x * 2f, 0f); | ||
m_Transform.Rotate(translation, Space.World); | ||
} | ||
|
||
if (Input.GetMouseButtonDown(0)) | ||
mouseOrigin = Input.mousePosition; | ||
|
||
if (Input.GetMouseButton(0)) | ||
{ | ||
Vector3 vector3 = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin); | ||
Vector3 translation2 = new Vector3(vector3.x * 2f, vector3.y * 2f, 0f); | ||
m_Transform.Translate(translation2, Space.Self); | ||
} | ||
|
||
if (Input.GetMouseButton(2)) | ||
m_Transform.Translate(new Vector3(0f, 0f, 1f), Space.Self); | ||
} | ||
|
||
public void CSTwo() | ||
{ | ||
if (Input.GetKey(KeyCode.I)) | ||
m_Transform.Translate(new Vector3(0f, 0f, 0.5f), Space.Self); | ||
if (Input.GetKey(KeyCode.K)) | ||
m_Transform.Translate(new Vector3(0f, 0f, -0.5f), Space.Self); | ||
if (Input.GetKey(KeyCode.J)) | ||
m_Transform.Translate(new Vector3(-0.5f, 0f, 0f), Space.Self); | ||
if (Input.GetKey(KeyCode.L)) | ||
m_Transform.Translate(new Vector3(0.5f, 0f, 0f), Space.Self); | ||
if (Input.GetKey(KeyCode.RightShift)) | ||
m_Transform.Translate(new Vector3(0f, 0.5f, 0f), Space.Self); | ||
if (Input.GetKey(KeyCode.RightControl)) | ||
m_Transform.Translate(new Vector3(0f, -0.5f, 0f), Space.Self); | ||
if (Input.GetKey(KeyCode.UpArrow)) | ||
m_Transform.Rotate(0.5f, 0f, 0f); | ||
if (Input.GetKey(KeyCode.DownArrow)) | ||
m_Transform.Rotate(-0.5f, 0f, 0f); | ||
if (Input.GetKey(KeyCode.LeftArrow)) | ||
m_Transform.Rotate(0f, -0.5f, 0f); | ||
if (Input.GetKey(KeyCode.RightArrow)) | ||
m_Transform.Rotate(0f, 0.5f, 0f); | ||
} | ||
|
||
public void CSThree() | ||
{ | ||
float z; | ||
|
||
if (Input.GetKey(KeyCode.Joystick1Button5)) | ||
z = 0.5f; | ||
else if (Input.GetKey(KeyCode.Joystick1Button4)) | ||
z = -0.5f; | ||
else | ||
z = 0f; | ||
|
||
if (!Input.GetKey(KeyCode.Joystick1Button0)) | ||
m_Transform.position += new Vector3(Input.GetAxis("DPadX"), Input.GetAxis("DPadY"), z); | ||
else | ||
m_Transform.Rotate(Input.GetAxis("DPadX"), Input.GetAxis("DPadY"), z); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using Harmony; | ||
using GKML; | ||
using UnityEngine; | ||
using System; | ||
|
||
namespace GKFreecam.Classes | ||
{ | ||
/// <summary> | ||
/// Reimplementation of CameraBase. | ||
/// </summary> | ||
|
||
public class CameraBaseExtension : CameraBase | ||
{ | ||
private CamStateFreecam freecam = new CamStateFreecam(); | ||
private bool infreecam = false; | ||
private int FreecamType = 1; | ||
|
||
private Transform m_pTransform; | ||
private ECamState m_PrevState; | ||
|
||
public new void Start() | ||
{ | ||
foreach (CamState camState in GetComponents<CamState>()) | ||
{ | ||
if (CamStates[(int)camState.state] == null) | ||
{ | ||
CamStates[(int)camState.state] = camState; | ||
} | ||
} | ||
m_pTransform = transform; | ||
m_PrevState = ECamState.None; | ||
CurrentState = m_StartState; | ||
} | ||
|
||
protected CamState GetCurrentStateClassFix() | ||
{ | ||
return infreecam ? freecam : CamStates[(int)CurrentState]; | ||
} | ||
|
||
private new void FixedUpdate() | ||
{ | ||
//some bullshit that doesnt depend on the state being in the enum if we're in freecam | ||
//re: no u | ||
|
||
if (CurrentState == ECamState.None) | ||
{ | ||
return; | ||
} | ||
|
||
ECamState currentState = CurrentState; | ||
ECamState currentState2 = GetCurrentStateClassFix().Manage(Time.fixedDeltaTime); | ||
|
||
m_pTransform.position = GetCurrentStateClassFix().m_Transform.position; | ||
m_pTransform.rotation = GetCurrentStateClassFix().m_Transform.rotation; | ||
|
||
if (currentState == CurrentState) | ||
{ | ||
CurrentState = currentState2; | ||
} | ||
} | ||
|
||
public void Update() | ||
{ | ||
freecam.CamState = FreecamType; | ||
|
||
if (Input.GetKeyDown(KeyCode.LeftBracket) && !infreecam) | ||
{ | ||
freecam.Enter(transform, null); | ||
infreecam = true; | ||
} | ||
else if (Input.GetKeyDown(KeyCode.LeftBracket) && infreecam) | ||
{ | ||
FreecamType++; | ||
if (FreecamType > 3) | ||
{ | ||
FreecamType = 1; | ||
infreecam = false; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{B92BB83A-F085-42DD-993E-8648F9D9C438}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>GKFreecam</RootNamespace> | ||
<AssemblyName>GKFreecam</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Output\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>Output\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>3</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>..\..\..\..\..\..\Programs\Steam\steamapps\common\Garfield Kart\GarfieldKartNoMulti_Data\Managed\0Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>..\..\..\..\..\..\Programs\Steam\steamapps\common\Garfield Kart\GarfieldKartNoMulti_Data\Managed\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="GarfieldKartModLoaderLib"> | ||
<HintPath>..\..\..\..\..\..\Programs\Steam\steamapps\common\Garfield Kart\GarfieldKartNoMulti_Data\Managed\GarfieldKartModLoaderLib.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>..\..\..\..\..\..\Programs\Steam\steamapps\common\Garfield Kart\GarfieldKartNoMulti_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Classes\CameraBaseExtension.cs" /> | ||
<Compile Include="Classes\CamStateFreecam.cs" /> | ||
<Compile Include="ModMain.cs" /> | ||
<Compile Include="Patches.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent>if exist "$(TargetName).gkmod" del "$(TargetName).gkmod" | ||
"$(ProjectDir)\Building Tools\7z.exe" a "$(TargetName).zip" "$(TargetFileName)" | ||
"$(ProjectDir)\Building Tools\7z.exe" a "$(TargetName).zip" "$(ProjectDir)$(TargetName).modinfo" | ||
rename "$(TargetName).zip" "$(TargetName).gkmod" | ||
del "*.dll" | ||
del "*.pdb" | ||
del "*.xml"</PostBuildEvent> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Name": "GK Freecam", | ||
"Namespace": "GKFreecam", | ||
"Authors": ["nonparallel", "nonparallel", "nonparallel"], | ||
"Version": "0.1", | ||
"GKMLVersion": "0.1.1", | ||
"Description": "A freecam for GK, made by yours truly; nonparallel!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Harmony; | ||
using GKML; | ||
using UnityEngine; | ||
using System; | ||
|
||
namespace GKFreecam | ||
{ | ||
/* | ||
spent about 2 days trying to work on this | ||
made by yours truly, nonparallel. | ||
*/ | ||
|
||
public class ModMain : Mod | ||
{ | ||
public override void LoadMod() | ||
{ | ||
Console.WriteLine("nonparallel was here (yes, me. it was me all along!); GK Freecam has loaded."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Harmony; | ||
using GKML; | ||
using UnityEngine; | ||
using System; | ||
using GKFreecam.Classes; | ||
|
||
namespace GKFreecam | ||
{ | ||
/// <summary> | ||
/// Used for replacing the old CameraBase with the new reimplementation of it. | ||
/// </summary> | ||
|
||
[HarmonyPatch(typeof(RcRace))] | ||
[HarmonyPatch("Start")] | ||
public class CameraBasePatch | ||
{ | ||
static public void Postfix() | ||
{ | ||
var cameraBase = Camera.main.GetComponent<CameraBase>(); | ||
UnityEngine.Object.Destroy(cameraBase); | ||
Camera.main.gameObject.AddComponent<CameraBaseExtension>(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("GKFreecam")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("GKFreecam")] | ||
[assembly: AssemblyCopyright("Copyright © 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("b92bb83a-f085-42dd-993e-8648f9d9c438")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |