Fix 332+ maps aswell as 359+

This commit is contained in:
Rackover Xiaochad 2021-02-07 11:54:15 +01:00
parent 0c462c1152
commit 49a2fc8b70
2 changed files with 30 additions and 14 deletions

View File

@ -1655,6 +1655,24 @@ namespace Components
image->delayLoadPixels = image359.loaded; image->delayLoadPixels = image359.loaded;
image->name = image359.name; image->name = image359.name;
FixImageCategory(image);
// Used for later stuff
(&image->delayLoadPixels)[1] = image359.pad3[1];
}
else
{
std::memcpy(buffer + 28, buffer + (size - 4), 4);
Game::GfxImage* image = reinterpret_cast<Game::GfxImage*>(buffer);
FixImageCategory(image);
}
}
return result;
}
void Zones::FixImageCategory(Game::GfxImage* image) {
// CODO makes use of additional enumerator values (9, 10, 11) that don't exist in IW4 // CODO makes use of additional enumerator values (9, 10, 11) that don't exist in IW4
// We have to translate them. 9 is for Reflection probes, 11 is for Compass, 10 is for Lightmap // We have to translate them. 9 is for Reflection probes, 11 is for Compass, 10 is for Lightmap
switch (image->category) switch (image->category)
@ -1670,16 +1688,13 @@ namespace Components
break; break;
} }
// Used for later stuff
(&image->delayLoadPixels)[1] = image359.pad3[1];
}
else
{
std::memcpy(buffer + 28, buffer + (size - 4), 4);
}
}
return result; if (image->category > 7 || image->category < 0) {
#ifdef DEBUG
if (IsDebuggerPresent()) __debugbreak();
#endif
}
} }
bool Zones::LoadXAsset(bool atStreamStart, char* buffer, int size) bool Zones::LoadXAsset(bool atStreamStart, char* buffer, int size)

View File

@ -100,5 +100,6 @@ namespace Components
static void LoadMaterialAsset(Game::Material** asset); static void LoadMaterialAsset(Game::Material** asset);
static void LoadTracerDef(bool atStreamStart, Game::TracerDef* tracer, int size); static void LoadTracerDef(bool atStreamStart, Game::TracerDef* tracer, int size);
static void LoadTracerDefFxEffect(); static void LoadTracerDefFxEffect();
static void FixImageCategory(Game::GfxImage* image);
}; };
} }