SA: Disallow moving cam up/down with mouse when looking back/left/right in vehicle (1.0 only for now)

This commit is contained in:
Silent 2019-12-26 23:18:01 +01:00
parent 51aec1955f
commit 1d007aed68
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1

View file

@ -1669,6 +1669,21 @@ namespace MoonphasesFix
} }
} }
// ============= Disallow moving cam up/down with mouse when looking back/left/right in vehicle =============
namespace FollowCarMouseCamFix
{
static uint32_t& camLookDirection = **AddressByVersion<uint32_t**>( 0x525526 + 2, 0, 0 );
static void* (*orgGetPad)(int);
static bool* orgUseMouse3rdPerson;
static bool useMouseAndLooksForwards;
static void* getPadAndSetFlag( int padNum )
{
useMouseAndLooksForwards = *orgUseMouse3rdPerson && camLookDirection == 3;
return orgGetPad( padNum );
}
};
// ============= LS-RP Mode stuff ============= // ============= LS-RP Mode stuff =============
namespace LSRPMode namespace LSRPMode
@ -4238,6 +4253,18 @@ void Patch_SA_10()
Patch<uint32_t>( 0x4C8010 + 4, 6 ); Patch<uint32_t>( 0x4C8010 + 4, 6 );
// Disallow moving cam up/down with mouse when looking back/left/right in vehicle
{
using namespace FollowCarMouseCamFix;
orgUseMouse3rdPerson = *(bool**)(0x525615 + 1);
Patch( 0x525615 + 1, &useMouseAndLooksForwards );
ReadCall( 0x5245E4, orgGetPad );
InjectHook( 0x5245E4, getPadAndSetFlag );
}
#if FULL_PRECISION_D3D #if FULL_PRECISION_D3D
// Test - full precision D3D device // Test - full precision D3D device
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE ); Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );