Merge pull request #65 from Rackover/fix_device_recovery
Fix device recovery issues on CODO maps >359
This commit is contained in:
commit
c26c4b4659
@ -1655,18 +1655,48 @@ namespace Components
|
||||
image->delayLoadPixels = image359.loaded;
|
||||
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
|
||||
// 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;
|
||||
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
@ -98,6 +98,19 @@ namespace Game
|
||||
DVAR_FLAG_NONEXISTENT = 0xFFFFFFFF //no such dvar
|
||||
} dvar_flag;
|
||||
|
||||
enum ImageCategory : char
|
||||
{
|
||||
IMG_CATEGORY_UNKNOWN = 0x0,
|
||||
IMG_CATEGORY_AUTO_GENERATED = 0x1,
|
||||
IMG_CATEGORY_LIGHTMAP = 0x2,
|
||||
IMG_CATEGORY_LOAD_FROM_FILE = 0x3,
|
||||
IMG_CATEGORY_RAW = 0x4,
|
||||
IMG_CATEGORY_FIRST_UNMANAGED = 0x5,
|
||||
IMG_CATEGORY_WATER = 0x5,
|
||||
IMG_CATEGORY_RENDERTARGET = 0x6,
|
||||
IMG_CATEGORY_TEMP = 0x7,
|
||||
} ;
|
||||
|
||||
enum DvarSetSource
|
||||
{
|
||||
DVAR_SOURCE_INTERNAL = 0x0,
|
||||
|
Loading…
Reference in New Issue
Block a user