diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 0d26fe6..15924ae 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -528,6 +528,82 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul } + // Corrected siren corona placement for emergency vehicles + // TODO: INI entry + { + // Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all + { + auto firetruckX1 = pattern( "C7 84 24 9C 05 00 00 CD CC 8C 3F" ); + auto firetruckY1 = pattern( "C7 84 24 A4 05 00 00 9A 99 D9 3F" ); + auto firetruckZ1 = pattern( "C7 84 24 A8 05 00 00 00 00 00 40" ); + + auto firetruckX2 = pattern( "C7 84 24 A8 05 00 00 CD CC 8C BF" ); + auto firetruckY2 = pattern( "C7 84 24 B0 05 00 00 9A 99 D9 3F" ); + auto firetruckZ2 = pattern( "C7 84 24 B4 05 00 00 00 00 00 40" ); + + if ( firetruckX1.count_hint(1).size() == 1 && firetruckY1.count_hint(1).size() == 1 && firetruckZ1.count_hint(1).size() == 1 && + firetruckX2.count_hint(1).size() == 1 && firetruckY2.count_hint(1).size() == 1 && firetruckZ2.count_hint(1).size() == 1 ) + { + constexpr CVector FIRETRUCK_SIREN_POS(0.95f, 3.2f, 1.4f); + + Patch( firetruckX1.get_first( 7 ), FIRETRUCK_SIREN_POS.x ); + Patch( firetruckY1.get_first( 7 ), FIRETRUCK_SIREN_POS.y ); + Patch( firetruckZ1.get_first( 7 ), FIRETRUCK_SIREN_POS.z ); + + Patch( firetruckX2.get_first( 7 ), -FIRETRUCK_SIREN_POS.x ); + Patch( firetruckY2.get_first( 7 ), FIRETRUCK_SIREN_POS.y ); + Patch( firetruckZ2.get_first( 7 ), FIRETRUCK_SIREN_POS.z ); + } + } + { + auto ambulanceX1 = pattern( "C7 84 24 84 05 00 00 CD CC 8C 3F" ); + auto ambulanceY1 = pattern( "C7 84 24 8C 05 00 00 66 66 66 3F" ); + auto ambulanceZ1 = pattern( "C7 84 24 90 05 00 00 CD CC CC 3F" ); + + auto ambulanceX2 = pattern( "C7 84 24 90 05 00 00 CD CC 8C BF" ); + auto ambulanceY2 = pattern( "C7 84 24 98 05 00 00 66 66 66 3F" ); + auto ambulanceZ2 = pattern( "C7 84 24 9C 05 00 00 CD CC CC 3F" ); + + if ( ambulanceX1.count_hint(1).size() == 1 && ambulanceY1.count_hint(1).size() == 1 && ambulanceZ1.count_hint(1).size() == 1 && + ambulanceX2.count_hint(1).size() == 1 && ambulanceY2.count_hint(1).size() == 1 && ambulanceZ2.count_hint(1).size() == 1 ) + { + constexpr CVector AMBULANCE_SIREN_POS(0.7f, 0.7f, 1.45f); + + Patch( ambulanceX1.get_first( 7 ), AMBULANCE_SIREN_POS.x ); + Patch( ambulanceY1.get_first( 7 ), AMBULANCE_SIREN_POS.y ); + Patch( ambulanceZ1.get_first( 7 ), AMBULANCE_SIREN_POS.z ); + + Patch( ambulanceX2.get_first( 7 ), -AMBULANCE_SIREN_POS.x ); + Patch( ambulanceY2.get_first( 7 ), AMBULANCE_SIREN_POS.y ); + Patch( ambulanceZ2.get_first( 7 ), AMBULANCE_SIREN_POS.z ); + } + } + { + auto enforcerX1 = pattern( "C7 84 24 6C 05 00 00 CD CC 8C 3F" ); + auto enforcerY1 = pattern( "C7 84 24 74 05 00 00 CD CC 4C 3F" ); + auto enforcerZ1 = pattern( "C7 84 24 78 05 00 00 9A 99 99 3F" ); + + auto enforcerX2 = pattern( "C7 84 24 78 05 00 00 CD CC 8C BF" ); + auto enforcerY2 = pattern( "C7 84 24 80 05 00 00 CD CC 4C 3F" ); + auto enforcerZ2 = pattern( "C7 84 24 84 05 00 00 9A 99 99 3F" ); + + if ( enforcerX1.count_hint(1).size() == 1 && enforcerY1.count_hint(1).size() == 1 && enforcerZ1.count_hint(1).size() == 1 && + enforcerX2.count_hint(1).size() == 1 && enforcerY2.count_hint(1).size() == 1 && enforcerZ2.count_hint(1).size() == 1 ) + { + constexpr CVector ENFORCER_SIREN_POS(0.6f, 1.05f, 1.4f); + + Patch( enforcerX1.get_first( 7 ), ENFORCER_SIREN_POS.x ); + Patch( enforcerY1.get_first( 7 ), ENFORCER_SIREN_POS.y ); + Patch( enforcerZ1.get_first( 7 ), ENFORCER_SIREN_POS.z ); + + Patch( enforcerX2.get_first( 7 ), -ENFORCER_SIREN_POS.x ); + Patch( enforcerY2.get_first( 7 ), ENFORCER_SIREN_POS.y ); + Patch( enforcerZ2.get_first( 7 ), ENFORCER_SIREN_POS.z ); + } + } + } + + // Corrected FBI Car secondary siren sound { using namespace SirenSwitchingFix;