Compare commits

...

5 commits

Author SHA1 Message Date
Tomasak
acf0957110
Merge dc545a9b40 into 6a524dcf46 2024-10-29 16:57:30 -04:00
Silent
6a524dcf46
VC: When excluding extras from envmap fixes, also set the envmap coefficient to 0.0
Fixes #40
2024-10-29 21:56:38 +01:00
Tomasak
dc545a9b40 Update SilentPatchVC.ini 2024-10-25 18:31:44 +02:00
Tomasak
98c9c151b2 Update SilentPatchVC.ini 2024-10-25 18:29:10 +02:00
Tomasak
a4c403e049 two more bfc objects
it never ends
2024-10-25 18:20:23 +02:00
2 changed files with 25 additions and 0 deletions

View file

@ -56,17 +56,30 @@ carsontrack
car_fucko03
chairsntable
chairsntableml
ci_alights1_01
ci_astudlights
ci_backlot1
ci_backlot2
ci_backlot3
ci_backlotprops1
ci_backlotprops2
ci_backlotprops3
ci_blights1_01
ci_camera1_01
ci_flatprop01
ci_flatprop02
ci_fountain
ci_industrial1
ci_lander
ci_lights1_01
ci_manintstuff
ci_mansion1
ci_offices
ci_redhead1_01
ci_setshad1
ci_tankship
ci_watertank
ci_windmach
cl_curtains
cl_tbl_chait_tmp
cl_tbl_chait_tmpb

View file

@ -884,6 +884,9 @@ namespace RemoveDriverStatusFix
// ============= Apply the environment mapping on extra components =============
namespace EnvMapsOnExtras
{
static RpMaterial* (*RpMatFXMaterialSetEnvMapCoefficient)(RpMaterial* material, RwReal coef);
static int (*RpMatFXMaterialGetEffects)(const RpMaterial* material);
static void RemoveSpecularityFromAtomic(RpAtomic* atomic)
{
RpGeometry* geometry = RpAtomicGetGeometry(atomic);
@ -907,6 +910,10 @@ namespace EnvMapsOnExtras
if (bRemoveSpecularity)
{
if (RpMatFXMaterialGetEffects(material) == 2) // rpMATFXEFFECTENVMAP
{
RpMatFXMaterialSetEnvMapCoefficient(material, 0.0f);
}
RpMaterialGetSurfaceProperties(material)->specular = 0.0f;
}
return material;
@ -2495,10 +2502,15 @@ void Patch_VC_Common()
using namespace EnvMapsOnExtras;
auto forAllAtomics = pattern("50 E8 ? ? ? ? 66 8B 4B 44").get_one();
auto setEnvMapCoefficient = reinterpret_cast<decltype(RpMatFXMaterialSetEnvMapCoefficient)>(get_pattern("8B 44 24 14 81 E2 FF 00 00 00 8D 14 52 8D 0C D6 89 41 08", -0x48));
auto getEffects = reinterpret_cast<decltype(RpMatFXMaterialGetEffects)>(get_pattern("8B 04 01 85 C0 75 01", -0xA));
// push eax -> push ebx
Patch<uint8_t>(forAllAtomics.get<void>(), 0x53);
InterceptCall(forAllAtomics.get<void>(1), orgRpClumpForAllAtomics, RpClumpForAllAtomics_ExtraComps);
RpMatFXMaterialSetEnvMapCoefficient = setEnvMapCoefficient;
RpMatFXMaterialGetEffects = getEffects;
}
TXN_CATCH();