Enable directional lights on flying car components

Fixes detached car parts rendering as near black

Fixes #16
This commit is contained in:
Silent 2024-03-05 23:34:46 +01:00
parent a4d83ac9ce
commit c6c9fe6013
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1

View file

@ -2500,6 +2500,18 @@ namespace ShootingStarsFix
}
// ============= Enable directional lights on flying car components =============
namespace LitFlyingComponents
{
static void (*orgWorldAdd)(CEntity*);
static void WorldAdd_SetLightObjectFlag(CEntity* entity)
{
entity->bLightObject = true;
orgWorldAdd(entity);
}
}
// ============= LS-RP Mode stuff =============
namespace LSRPMode
{
@ -5274,6 +5286,14 @@ void Patch_SA_10(HINSTANCE hInstance)
InterceptCall(0x714610, orgRwIm3DTransform, RwIm3DTransform_UnsetTexture);
}
// Enable directional lights on flying car components
{
using namespace LitFlyingComponents;
InterceptCall(0x6A8BBE, orgWorldAdd, WorldAdd_SetLightObjectFlag);
}
#if FULL_PRECISION_D3D
// Test - full precision D3D device
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
@ -6998,6 +7018,16 @@ void Patch_SA_NewBinaries_Common(HINSTANCE hInstance)
InterceptCall(rwIm3dTransform, orgRwIm3DTransform, RwIm3DTransform_UnsetTexture);
}
// Enable directional lights on flying car components
{
using namespace LitFlyingComponents;
auto worldAdd = get_pattern("53 E8 ? ? ? ? 8B 4D F4 83 C4 04 5F 5E 8B C3", 1);
InterceptCall(worldAdd, orgWorldAdd, WorldAdd_SetLightObjectFlag);
}
}