CGameArea: PostConstructArea fixes for lights

This commit is contained in:
Luke Street 2022-08-09 02:48:29 -04:00
parent 0f0e91a021
commit ff64acad67
1 changed files with 16 additions and 9 deletions

View File

@ -917,9 +917,10 @@ void CGameArea::PostConstructArea() {
/* Lights section */ /* Lights section */
if (header.version > 6) { if (header.version > 6) {
CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned);
u32 magic = r.ReadLong();
if (magic == 0xBABEDEAD) {
u32 aCount = r.ReadLong(); u32 aCount = r.ReadLong();
if (aCount == 0xBABEDEAD) {
aCount = r.ReadLong();
}
x12c_postConstructed->x60_lightsA.reserve(aCount); x12c_postConstructed->x60_lightsA.reserve(aCount);
x12c_postConstructed->x70_gfxLightsA.reserve(aCount); x12c_postConstructed->x70_gfxLightsA.reserve(aCount);
for (u32 i = 0; i < aCount; ++i) { for (u32 i = 0; i < aCount; ++i) {
@ -927,6 +928,7 @@ void CGameArea::PostConstructArea() {
x12c_postConstructed->x70_gfxLightsA.push_back(x12c_postConstructed->x60_lightsA.back().GetAsCGraphicsLight()); x12c_postConstructed->x70_gfxLightsA.push_back(x12c_postConstructed->x60_lightsA.back().GetAsCGraphicsLight());
} }
if (aCount == 0xBABEDEAD) {
u32 bCount = r.ReadLong(); u32 bCount = r.ReadLong();
x12c_postConstructed->x80_lightsB.reserve(bCount); x12c_postConstructed->x80_lightsB.reserve(bCount);
x12c_postConstructed->x90_gfxLightsB.reserve(bCount); x12c_postConstructed->x90_gfxLightsB.reserve(bCount);
@ -936,6 +938,11 @@ void CGameArea::PostConstructArea() {
} }
} }
if (x12c_postConstructed->x80_lightsB.empty()) {
x12c_postConstructed->x80_lightsB = x12c_postConstructed->x60_lightsA;
x12c_postConstructed->x90_gfxLightsB = x12c_postConstructed->x70_gfxLightsA;
}
++secIt; ++secIt;
} }