mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
III: Fix SetupBigBuilding for cranes, bright windows and others
This commit is contained in:
parent
c803927c80
commit
b46e91918c
5 changed files with 52 additions and 0 deletions
8
SilentPatchIII/ModelInfoIII.cpp
Normal file
8
SilentPatchIII/ModelInfoIII.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "StdAfx.h"
|
||||
#include "ModelInfoIII.h"
|
||||
|
||||
void CSimpleModelInfo::SetNearDistanceForLOD_SilentPatch()
|
||||
{
|
||||
// 100.0f for real LOD's, 0.0f otherwise
|
||||
m_lodDistances[2] = _strnicmp( m_name, "lod", 3 ) == 0 ? 100.0f : 0.0f;
|
||||
}
|
18
SilentPatchIII/ModelInfoIII.h
Normal file
18
SilentPatchIII/ModelInfoIII.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class CSimpleModelInfo
|
||||
{
|
||||
private:
|
||||
void* __vmt;
|
||||
char m_name[24];
|
||||
uint8_t __pad[32];
|
||||
float m_lodDistances[3];
|
||||
uint8_t __pad2[4];
|
||||
|
||||
public:
|
||||
void SetNearDistanceForLOD_SilentPatch();
|
||||
};
|
||||
|
||||
static_assert(sizeof(CSimpleModelInfo) == 0x4C, "Wrong size: CSimpleModelInfo");
|
|
@ -6,6 +6,7 @@
|
|||
#include "Common.h"
|
||||
#include "Common_ddraw.h"
|
||||
#include "VehicleIII.h"
|
||||
#include "ModelInfoIII.h"
|
||||
|
||||
#include <memory>
|
||||
#include <Shlwapi.h>
|
||||
|
@ -611,6 +612,23 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul
|
|||
InjectHook( match.get<void>(), UsesSirenSwitching_FbiCar );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Corrected CSimpleModelInfo::SetupBigBuilding minimum draw distance for big buildings without a matching model
|
||||
// Fixes cranes in Portland and bright windows in the city
|
||||
// By aap
|
||||
{
|
||||
auto setupMinDist = pattern( "C7 43 44 00 00 C8 42" ).count_hint(1);
|
||||
if ( setupMinDist.size() == 1 ) // In case of another mod or second instance of SP changing it
|
||||
{
|
||||
auto match = setupMinDist.get_one();
|
||||
|
||||
// mov ecx, ebx
|
||||
// call CSimpleModelInfo::SetNearDistanceForLOD
|
||||
Patch( match.get<void>(), { 0x89, 0xD9 } );
|
||||
InjectHook( match.get<void>( 2 ), &CSimpleModelInfo::SetNearDistanceForLOD_SilentPatch, PATCH_CALL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InjectDelayedPatches_III_Common()
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ModelInfoIII.cpp" />
|
||||
<ClCompile Include="SilentPatchIII.cpp" />
|
||||
<ClCompile Include="StdAfxIII.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
@ -56,6 +57,7 @@
|
|||
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.GTA.h" />
|
||||
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.h" />
|
||||
<ClInclude Include="..\SilentPatch\Utils\Patterns.h" />
|
||||
<ClInclude Include="ModelInfoIII.h" />
|
||||
<ClInclude Include="VehicleIII.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
<ClCompile Include="..\SilentPatch\RWGTA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ModelInfoIII.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SilentPatch\Timer.h">
|
||||
|
@ -83,6 +86,9 @@
|
|||
<ClInclude Include="..\SilentPatch\Maths.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ModelInfoIII.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||
|
|
Loading…
Reference in a new issue