Skip to content

Commit

Permalink
Project2DFX v3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Dec 27, 2015
1 parent 05e4410 commit eb5cce9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 26 deletions.
6 changes: 3 additions & 3 deletions VCLodLights/SearchlightsVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
Expand Down
54 changes: 32 additions & 22 deletions VCLodLights/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -464,7 +447,6 @@ DWORD ipljmpAddress1 = 0x48AD9C;
DWORD ipljmpAddress2 = 0x48AF57;
DWORD _EAX;
CEntityVC* EntityVC;

void __declspec(naked) CLODLightManager::VC::IPLDataHook1()
{
_asm
Expand All @@ -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);
Expand All @@ -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
{
Expand All @@ -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("");
Expand Down Expand Up @@ -579,7 +589,7 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)

injector::WriteMemory(0x691538, 0x4DDDDD, true); //CFileLoader::LoadMapZones((char const *))

injector::WriteMemory<unsigned char>(0x4C7946, 0xEB, true); //Lods in the interiors
injector::MakeJMP(0x4C7957, SetupBigBuildingVisibilityHook, true); //Lods in the interiors
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion includes/General.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eb5cce9

Please sign in to comment.