From 0c462c115265e741d4e4865c2cf127f0236ca63a Mon Sep 17 00:00:00 2001 From: Rackover Xiaochad Date: Sat, 6 Feb 2021 21:25:55 +0100 Subject: [PATCH] Fix device recovery issues on CODO maps >359 --- src/Components/Modules/Zones.cpp | 15 +++++++++++++++ src/Game/Structs.hpp | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index f47850ee..0db4cb9e 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -1655,6 +1655,21 @@ 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; + } + // Used for later stuff (&image->delayLoadPixels)[1] = image359.pad3[1]; } diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 6636d28d..28e82bfe 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -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,