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,20 +1655,7 @@ namespace Components
image->delayLoadPixels = image359.loaded;
image->name = image359.name;
// 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
switch (image->category)
{
case 9:
image->category = Game::ImageCategory::IMG_CATEGORY_AUTO_GENERATED;
break;
case 10:
image->category = Game::ImageCategory::IMG_CATEGORY_LIGHTMAP;
break;
case 11:
image->category = Game::ImageCategory::IMG_CATEGORY_LOAD_FROM_FILE;
break;
}
FixImageCategory(image);
// Used for later stuff
(&image->delayLoadPixels)[1] = image359.pad3[1];
@ -1676,12 +1663,40 @@ namespace Components
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
// We have to translate them. 9 is for Reflection probes, 11 is for Compass, 10 is for Lightmap
switch (image->category)
{
case 9:
image->category = Game::ImageCategory::IMG_CATEGORY_AUTO_GENERATED;
break;
case 10:
image->category = Game::ImageCategory::IMG_CATEGORY_LIGHTMAP;
break;
case 11:
image->category = Game::ImageCategory::IMG_CATEGORY_LOAD_FROM_FILE;
break;
}
if (image->category > 7 || image->category < 0) {
#ifdef DEBUG
if (IsDebuggerPresent()) __debugbreak();
#endif
}
}
bool Zones::LoadXAsset(bool atStreamStart, char* buffer, int size)
{
int count = 0;

View File

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