diff --git a/VCLodLights/SearchlightsVC.h b/VCLodLights/SearchlightsVC.h index d958428..4e2ed2d 100644 --- a/VCLodLights/SearchlightsVC.h +++ b/VCLodLights/SearchlightsVC.h @@ -182,8 +182,8 @@ void CLODLightManager::VC::RenderHeliSearchLights() { if (HeliInst->unk > 0.0f) { - RwV3D StartPoint; - RwV3D EndPoint; + RwV3D StartPoint = { 0.0f,0.0f,0.0f }; + RwV3D EndPoint = { 0.0f,0.0f,0.0f }; StartPoint.x = HeliInst->pos.x; EndPoint.x = HeliInst->shadowPos.x; @@ -235,7 +235,7 @@ void CLODLightManager::VC::RenderSearchLights() ObjectInst = (CEntityVC *)(nOffset + (*pObjectPool)->objects); if (ObjectInst) { - int IsObjectDamaged = ((ObjectInst->field_53 & 1) == 1 || !((ObjectInst->field_52 >> 2) & 1)); + int IsObjectDamaged = ((ObjectInst->field_53 & 1) == 1 || (ObjectInst->m_bRenderDamaged)); if (!IsObjectDamaged) { auto itEnd = pFileContent->upper_bound(PackKey(ObjectInst->m_nModelIndex, 0xFFFF)); diff --git a/VCLodLights/dllmain.cpp b/VCLodLights/dllmain.cpp index 1995133..4b2cfb3 100644 --- a/VCLodLights/dllmain.cpp +++ b/VCLodLights/dllmain.cpp @@ -426,23 +426,6 @@ void __declspec(naked) CLODLightManager::VC::GenericIDEHook() strncpy(tempptr + 5, Flags2, 15); } } - if (bPreloadLODs) - { - if (IDEmodelID == 2600 || IDEmodelID == 2544 || IDEmodelID == 2634 || IDEmodelID == 2545) - { - if (IDEDrawDistance == 3000 || IDEDrawDistance == 1000) - { - sprintf(sIDEDrawDistance, "%d", IDEDrawDistance); - tempptr = strstr(buffer + 10, sIDEDrawDistance); - - strncpy(Flags2, tempptr + 5, 15); - - strncpy(tempptr, "0 ", 5); - strncpy(tempptr + 6, Flags2, 15); - //MessageBox(0, buffer, "0", 0); - } - } - } } else { @@ -464,7 +447,6 @@ DWORD ipljmpAddress1 = 0x48AD9C; DWORD ipljmpAddress2 = 0x48AF57; DWORD _EAX; CEntityVC* EntityVC; - void __declspec(naked) CLODLightManager::VC::IPLDataHook1() { _asm @@ -474,7 +456,7 @@ void __declspec(naked) CLODLightManager::VC::IPLDataHook1() call eax mov eax, _EAX push ebx - mov EntityVC, ebx + mov EntityVC, ebx } VecEntities.push_back(*EntityVC); @@ -486,9 +468,15 @@ void __declspec(naked) CLODLightManager::VC::IPLDataHook2() _asm { push esi - mov EntityVC, esi + mov EntityVC, esi + } + if (bPreloadLODs) + { + if (EntityVC->m_nModelIndex == 2600 || EntityVC->m_nModelIndex == 2544 || EntityVC->m_nModelIndex == 2634 || EntityVC->m_nModelIndex == 2545) + { + EntityVC->m_bIsVisible = 0; + } } - VecEntities.push_back(*EntityVC); _asm { @@ -500,6 +488,28 @@ void __declspec(naked) CLODLightManager::VC::IPLDataHook2() } } +void __declspec(naked) SetupBigBuildingVisibilityHook() +{ + _asm + { + mov eax, dword ptr ds: [0x978810] + test eax, eax + jz label2 + label1: + mov eax, 0x4C7961 + jmp eax + label2: + xor eax, eax + add esp, 20h + pop ebp + pop edi + pop esi + pop ebx + retn + } +} + + void CLODLightManager::VC::Init() { CIniReader iniReader(""); @@ -579,7 +589,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/) injector::WriteMemory(0x691538, 0x4DDDDD, true); //CFileLoader::LoadMapZones((char const *)) - injector::WriteMemory(0x4C7946, 0xEB, true); //Lods in the interiors + injector::MakeJMP(0x4C7957, SetupBigBuildingVisibilityHook, true); //Lods in the interiors } } } diff --git a/includes/General.h b/includes/General.h index 49309e6..c5967e3 100644 --- a/includes/General.h +++ b/includes/General.h @@ -807,7 +807,17 @@ struct CEntityVC // sizeof = 0x64 DWORD rwObject; BYTE flags; BYTE type; - BYTE field_52; + + //unsigned char m_nFlags2; + unsigned char b2_1 : 1; + unsigned char m_bExplosionProof : 1; + unsigned char m_bIsVisible : 1; + unsigned char b2_8 : 1; + unsigned char b2_10 : 1; + unsigned char m_bFlashing : 1; + unsigned char m_bIsBIGBuilding : 1; + unsigned char m_bRenderDamaged : 1; + BYTE field_53; BYTE field_54; BYTE field_55;