Skip to content

Commit

Permalink
New patch v11; bugfix for higher zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Nefaro committed Mar 9, 2022
1 parent 44c685b commit e57e53f
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 17 deletions.
9 changes: 5 additions & 4 deletions Gnoll Mods/HigherZoom/HigherZoom/ModMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ public class ModMain : IGnollMod

public string Description { get { return "Provides 2 more levels for zooming out."; } }

public string BuiltWithLoaderVersion { get { return "G1.10"; } }
public string BuiltWithLoaderVersion { get { return "G1.11"; } }

public int RequireMinPatchVersion { get { return 10; } }
public int RequireMinPatchVersion { get { return 11; } }

public void OnLoad(HookManager hookManager)
{
hookManager.BeforeInGameHudInit += HookManager_BeforeInGameHudInit;
hookManager.AfterGameLoaded += HookManager_AfterGameLoaded;
}
private void HookManager_BeforeInGameHudInit()
private void HookManager_AfterGameLoaded()
{
// Reset the camera
GnomanEmpire.Instance.Camera.float_1 = new float[]
{
0.25f,
Expand Down
18 changes: 17 additions & 1 deletion GnollModLoader/GnollModLoader/GlobalPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void PerformPatching()
{
Logger.Log("-- Applying patches ...");
this.ApplyPatch_GnomanEmpire_PlayGame();
this.ApplyPatch_GnomanEmpire_LoadGame();
this.ApplyPatch_GameSettings_ApplyDisplayChanges();
Logger.Log("-- Applying patches ... DONE");
}
Expand All @@ -30,7 +31,14 @@ private void ApplyPatch_GnomanEmpire_PlayGame()
{
var playGame = typeof(GnomanEmpire).GetMethod(nameof(GnomanEmpire.PlayGame));
var prefixPatch = typeof(Patch_GnomanEmpire_PlayGame).GetMethod(nameof(Patch_GnomanEmpire_PlayGame.Prefix));
this.ApplyPatchImpl(playGame, prefixPatch:prefixPatch);
this.ApplyPatchImpl(playGame, prefixPatch: prefixPatch);
}

private void ApplyPatch_GnomanEmpire_LoadGame()
{
var loadGame = typeof(GnomanEmpire).GetMethod(nameof(GnomanEmpire.LoadGame));
var postfixPatch = typeof(Patch_GnomanEmpire_LoadGame).GetMethod(nameof(Patch_GnomanEmpire_LoadGame.Postfix));
this.ApplyPatchImpl(loadGame, postfixPatch: postfixPatch);
}

private void ApplyPatch_GameSettings_ApplyDisplayChanges()
Expand Down Expand Up @@ -79,4 +87,12 @@ public static void Prefix()
}
}

internal class Patch_GnomanEmpire_LoadGame
{
public static void Postfix()
{
HookManager.HookLoadSaveGame_after();
}
}

}
2 changes: 1 addition & 1 deletion GnollModLoader/GnollModLoader/GnollMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class GnollMain
private const string MAJOR_VERSION = "G1";

// for easier validation
public const uint PATCH_VERSION = 10;
public const uint PATCH_VERSION = 11;

public const string NAME = "Gnoll Mod Loader";
public const string APP_URL = "https://github.com/Nefaro/gnoll";
Expand Down
17 changes: 13 additions & 4 deletions GnollModLoader/GnollModLoader/HookManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public class HookManager
public delegate void BeforeEntitySpawnHandler(Game.GameEntity entity);
// Called after main menu init, before "Exit" button is attached
public delegate void MainMenuGuiInitHandler(Game.GUI.MainMenuWindow window, Game.GUI.Controls.Manager manager);
// Calld after new game has configured but before any generation has happened
// Called after new game has configured but before any generation has happened
public delegate void BeforeStartNewGameHandler(CreateWorldOptions worldOptions);
// Calld after new game has configured and after mod defs have been read in, but before any generation
// Called after new game has configured and after mod defs have been read in, but before any generation
public delegate void BeforeStartNewGameAfterReadDefsHandler(CreateWorldOptions worldOptions);
// Called after a savegame has been loaded
public delegate void AfterGameLoadedHandler();

private List<IGnollMod> _listOfMods;

Expand Down Expand Up @@ -151,14 +153,20 @@ public static void HookOnStartNewGame_afterReadDefs(CreateWorldOptions worldOpti

public static void HookInGameHUDInit_before()
{
Logger.Log("-- Hook Before Ingame HUD Init");

if (instance.BeforeInGameHudInit != null)
{
instance.BeforeInGameHudInit();
}
}

public static void HookLoadSaveGame_after()
{
if (instance.AfterGameLoaded != null)
{
instance.AfterGameLoaded();
}
}

public event ExportMenuListInitHandler ExportMenuListInit;
public event InGameHUDInitHandler InGameHUDInit;
public event BeforeInGameHUDInitHandler BeforeInGameHudInit;
Expand All @@ -170,6 +178,7 @@ public static void HookInGameHUDInit_before()
public event MainMenuGuiInitHandler MainMenuGuiInit;
public event BeforeStartNewGameHandler BeforeStartNewGame;
public event BeforeStartNewGameAfterReadDefsHandler BeforeStartNewGameAfterReadDefs;
public event AfterGameLoadedHandler AfterGameLoaded;

private static HookManager instance;
}
Expand Down
2 changes: 1 addition & 1 deletion Installer/InstallerGUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class Form1 : Form
private List<InstallerCore.Action> _uninstallModLoaderDependencies = new List<InstallerCore.Action>();

private static readonly Logger _log = InstallerCore.Logger.GetLogger;
private static readonly string _appName = $"Gnoll Installer (v1.10.0)";
private static readonly string _appName = $"Gnoll Installer (v1.11.0)";
private readonly GamePatchDatabase _gameDb;

public Form1()
Expand Down
4 changes: 2 additions & 2 deletions Installer/InstallerGUI/InstallerGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<SuiteName>Gnoll</SuiteName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<DisallowUrlActivation>true</DisallowUrlActivation>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.10.0.%2a</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.11.0.%2a</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
Expand Down
Binary file added patch/Gnoll1.11_016e6239.xdelta
Binary file not shown.
Binary file added patch/Gnoll1.11_c9f6d4b9.xdelta
Binary file not shown.
20 changes: 16 additions & 4 deletions patch/patchinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
"version": 10,
"versionString":"G1.10",
"filename": "Gnoll1.10_016e6239.xdelta"
}],
"latestVersion":"G1.10"
},
{
"version": 11,
"versionString":"G1.11",
"filename": "Gnoll1.11_016e6239.xdelta"
}
],
"latestVersion":"G1.11"
},
{
"name": "v1.0 (Steam 2019)",
Expand All @@ -39,7 +45,13 @@
"version": 10,
"versionString":"G1.10",
"filename": "Gnoll1.10_c9f6d4b9.xdelta"
}],
"latestVersion":"G1.10"
},
{
"version": 11,
"versionString":"G1.11",
"filename": "Gnoll1.11_c9f6d4b9.xdelta"
}
],
"latestVersion":"G1.11"
}
]

0 comments on commit e57e53f

Please sign in to comment.