Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions mc2hook/mc2hook/handlers/LevelExtentsHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "LevelExtentsHandler.h"
#include <age/vector/vector3.h>

void LevelExtentsHandler::InitRoomsHook(const Vector3& a2, const Vector3& a3, const float& a4)
{
float worldMinX = HookConfig::GetFloat("Physics", "WorldExtentMinX", -2000.0f);
float worldMaxX = HookConfig::GetFloat("Physics", "WorldExtentMaxX", 2000.0f);

float worldMinZ = HookConfig::GetFloat("Physics", "WorldExtentMinZ", -2000.0f);
float worldMaxZ = HookConfig::GetFloat("Physics", "WorldExtentMaxZ", 2000.0f);

Vector3 worldMin = Vector3(worldMinX, a2.Y, worldMinZ);
Vector3 worldMax = Vector3(worldMaxX, a3.Y, worldMaxZ);

hook::Thunk<0x587850>::Call<void>(this, &worldMin, &worldMax, &a4); // Call original
}

void LevelExtentsHandler::Install()
{
InstallCallback("Level Extents Handler", "Level Extents SetRoomConfig hook.",
&InitRoomsHook, {
cb::call(0x40B156),
cb::call(0x589239)
}
);
}
10 changes: 10 additions & 0 deletions mc2hook/mc2hook/handlers/LevelExtentsHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include <mc2hook\mc2hook.h>
#include <age/vector/vector3.h>

class LevelExtentsHandler
{
public:
void InitRoomsHook(const Vector3& a2, const Vector3& a3, const float& a4);
static void Install();
};
2 changes: 2 additions & 0 deletions mc2hook/mc2hook/handlers/handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <handlers\InputHandler.h>
#include <handlers\BorderlessHandler.h>
#include <handlers\ReflectionFidelityHandler.h>
#include <handlers/LevelExtentsHandler.h>

#include <handlers\StateResearchHook.h>

Expand Down Expand Up @@ -50,6 +51,7 @@ static void InstallMainHandlers()
InstallHandler<ChatHandler>("Chat Handler");
InstallHandler<InitHandler>("Game Init Handler");
InstallHandler<ReflectionFidelityHandler>("Reflection Fidelity Handller");
InstallHandler<LevelExtentsHandler>("Level Extents Handler");

InstallHandler<StateResearchHook>("SRH");
}
2 changes: 2 additions & 0 deletions mc2hook/mc2hook/mc2hook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<ClInclude Include="handlers\handlers.h" />
<ClInclude Include="handlers\HybridFileMethodsHandler.h" />
<ClInclude Include="handlers\InputHandler.h" />
<ClInclude Include="handlers\LevelExtentsHandler.h" />
<ClInclude Include="handlers\PathHandler.h" />
<ClInclude Include="handlers\PrinterHandler.h" />
<ClInclude Include="handlers\ReflectionFidelityHandler.h" />
Expand Down Expand Up @@ -247,6 +248,7 @@
<ClCompile Include="handlers\FontCrashFixHandler.cpp" />
<ClCompile Include="handlers\HybridFileMethodsHandler.cpp" />
<ClCompile Include="handlers\InputHandler.cpp" />
<ClCompile Include="handlers\LevelExtentsHandler.cpp" />
<ClCompile Include="handlers\PathHandler.cpp" />
<ClCompile Include="handlers\PrinterHandler.cpp" />
<ClCompile Include="handlers\ReflectionFidelityHandler.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions mc2hook/mc2hook/mc2hook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@
<ClInclude Include="handlers\ReflectionFidelityHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="handlers\LevelExtentsHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -341,5 +344,8 @@
<ClCompile Include="handlers\ReflectionFidelityHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="handlers\LevelExtentsHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>