Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThielHater committed Feb 28, 2023
1 parent bf74390 commit b77846c
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 1 deletion.
77 changes: 77 additions & 0 deletions LightgunDragoon.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{15AE6EE0-2B25-442C-8A2B-5CCA9FF877B4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LightgunDragoon</RootNamespace>
<AssemblyName>LightgunDragoon</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>UnityLibs\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>UnityLibs\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BepInEx">
<HintPath>UnityLibs\BepInEx.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>UnityLibs\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>UnityLibs\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>UnityLibs\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin.cs" />
<Compile Include="mPD_Input.cs" />
<Compile Include="mPD_PauseMenuController.cs" />
<Compile Include="mPD_PlayerMovement.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
29 changes: 29 additions & 0 deletions Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Reflection;
using BepInEx;
using HarmonyLib;

namespace LightgunDragoon
{
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Plugin : BaseUnityPlugin
{
public const String pluginGuid = "1635ef5b-221a-468a-a155-856c3050d53a";
public const String pluginName = "LightgunDragoon";
public const String pluginVersion = "1.0.0.0";

public void Awake()
{
Logger.LogMessage("Plugin loaded");
Harmony harmony = new Harmony(pluginGuid);
harmony.PatchAll();
}

private void HarmonyPatch(Harmony hHarmony, Type OriginalClass, String OriginalMethod, Type ReplacementClass, String ReplacementMethod)
{
MethodInfo original = AccessTools.Method(OriginalClass, OriginalMethod);
MethodInfo patch = AccessTools.Method(ReplacementClass, ReplacementMethod);
hHarmony.Patch(original, new HarmonyMethod(patch));
}
}
}
14 changes: 14 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("LightgunDragoon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LightgunDragoon")]
[assembly: AssemblyCopyright("ThielHater © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1635ef5b-221a-468a-a155-856c3050d53a")]
[assembly: AssemblyVersion("1.0.0.0")]
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# LightgunDragoon
Harmony and BepInEx based plugin for Panzer Dragoon Remake to add lightgun support
Panzer Dragoon Remake was not meant to be played with a lightgun and even with this plugin, the gameplay will differ from a classic lightgun title.

The crosshair is moved by the relative movement of the lightgun on the screen, it is not positioned absolutely. I tried to match the movements as much as possible, but an exact match was not possible due to the different control concepts. This is like emulating a joystick with a lightgun.

There is an outer border that takes up ten percent of the screen. If you hold the lightgun in that area, flight maneuvers are executed to change the position of the dragon rider and dodge attacks.

The inner area of the screen is meant for taking a semi-stable flight position, aiming and firing.

Just try it out, move the lightgun slowly across the screen and see how the game reacts. After a short while you should get the hang of it.

You need a lightgun with two additional, assignable buttons. Assign Q and E to turn around while flying.

How to use:
- Download the release zip
- Extract it into the main folder of the game
- Run the game
- Make sure that input mode is set to classic and sensitivity to 1.0
Binary file added UnityLibs/0Harmony.dll
Binary file not shown.
Binary file added UnityLibs/BepInEx.dll
Binary file not shown.
6 changes: 6 additions & 0 deletions UnityLibs/List_of_dll_to_copy_here.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copy these files from [Panzer Dragoon Remake directory]\Panzer Dragoon Remake_Data\Managed to build the project:

Assembly-CSharp.dll
UnityEngine.dll
UnityEngine.CoreModule.dll
UnityEngine.InputLegacyModule.dll
63 changes: 63 additions & 0 deletions mPD_Input.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using HarmonyLib;
using UnityEngine;

namespace LightgunDragoon
{
class mPD_Input
{
[HarmonyPatch(typeof(PD_Input), "GetAxis")]
class GetAxis
{
static float _lastX = 0f;
static float _lastY = 0f;

static void Postfix(object[] __args, ref float __result)
{
AxisType _axisType = (AxisType)__args[0];

if (PD_SaveLoad.GameSave.PlayerMovementMode == MechanicMode.classic)
{
switch (_axisType)
{
case AxisType.pointerMovementHorizontal:
{
var x = Input.mousePosition.x;
if (x > Screen.width * 0.95f)
__result = 1.0f;
else if (x > Screen.width * 0.90f)
__result = 0.8f;
else if (x < Screen.width * 0.05f)
__result = -1.0f;
else if (x < Screen.width * 0.10f)
__result = -0.8f;
else if (x > _lastX)
__result = 0.6f;
else if (x < _lastX)
__result = -0.6f;
else
__result = 0f;
_lastX = x;
break;
}
case AxisType.pointerMovementVertical:
{
var y = Input.mousePosition.y;
if (y > Screen.height * 0.9f)
__result = 1.0f;
else if (y < Screen.height * 0.1f)
__result = -1.0f;
else if (y > _lastY)
__result = 0.6f;
else if (y < _lastY)
__result = -0.6f;
else
__result = 0f;
_lastY = y;
break;
}
}
}
}
}
}
}
18 changes: 18 additions & 0 deletions mPD_PauseMenuController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using HarmonyLib;
using UnityEngine;

namespace LightgunDragoon
{
class mPD_PauseMenuController
{
[HarmonyPatch(typeof(PD_PauseMenuController), "ResumeGame")]
class ResumeGame
{
static void Postfix()
{
Cursor.lockState = CursorLockMode.None;
PD_GameManager.Instance.CursorLocked = false;
}
}
}
}
18 changes: 18 additions & 0 deletions mPD_PlayerMovement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using HarmonyLib;
using UnityEngine;

namespace LightgunDragoon
{
class mPD_PlayerMovement
{
[HarmonyPatch(typeof(PD_PlayerMovement), "Start")]
class Start
{
static void Postfix()
{
Cursor.lockState = CursorLockMode.None;
PD_GameManager.Instance.CursorLocked = false;
}
}
}
}

0 comments on commit b77846c

Please sign in to comment.