diff --git a/ILU.dll b/ILU.dll new file mode 100644 index 0000000..2966069 Binary files /dev/null and b/ILU.dll differ diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4bfc44d..525bad0 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -715,4 +715,4 @@ add_executable(RedAlert ${src_win32lib} ${src_redalert} ${src_external}) set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" LINK_FLAGS "/PDB:\"RedAlert.pdb\" /SUBSYSTEM:WINDOWS" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/../" ) target_include_directories(RedAlert PRIVATE ./external/devil/;./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include) -target_link_libraries(RedAlert "opengl32.lib" "winmm.lib" "Ws2_32.lib" "${CMAKE_SOURCE_DIR}/external/devil/DevIL.lib" "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x86/SDL2.lib" "${CMAKE_SOURCE_DIR}/external/openal/out/build/x86-Release/OpenAL32.lib") +target_link_libraries(RedAlert "opengl32.lib" "winmm.lib" "Ws2_32.lib" "${CMAKE_SOURCE_DIR}/external/devil/ilu.lib" "${CMAKE_SOURCE_DIR}/external/devil/DevIL.lib" "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x86/SDL2.lib" "${CMAKE_SOURCE_DIR}/external/openal/out/build/x86-Release/OpenAL32.lib") diff --git a/code/REDALERT/BDATA.CPP b/code/REDALERT/BDATA.CPP index 2aa0319..e452ce0 100644 --- a/code/REDALERT/BDATA.CPP +++ b/code/REDALERT/BDATA.CPP @@ -3140,6 +3140,19 @@ void BuildingTypeClass::One_Time(void) */ _makepath(fullname, NULL, NULL, building.Graphic_Name(), ".SHP"); ((void const *&)building.ImageData) = MFCD::Retrieve(fullname); + { + char imageFileName[512]; + sprintf(imageFileName, "DATA/ART/TEXTURES/SRGB/RED_ALERT/STRUCTURES/%s/%s-0000.TGA", building.Graphic_Name(), building.Graphic_Name()); + ((void const*&)building.HDImageData) = Image_LoadImage(imageFileName); + + if (building.ImageData != NULL && building.HDImageData != NULL) { + int width = Get_Build_Frame_Width(building.ImageData); + int height = Get_Build_Frame_Height(building.ImageData); + + building.HDImageData->renderwidth = width; + building.HDImageData->renderheight = height; + } + } } // Try to load weap2.shp and tesla coil's lightning shapes @@ -3218,7 +3231,7 @@ void BuildingTypeClass::Display(int x, int y, WindowNumberType window, HousesTyp //CC_Draw_Shape((Image_t *)Get_HDImage_Data(), 0, x, y, window, SHAPE_CENTER | SHAPE_WIN_REL, NULL, NULL, DIR_N); x += WindowList[window][WINDOWX]; y += WindowList[window][WINDOWY]; - GL_RenderImage(hdimage, x, y, hdimage->width, hdimage->height); + GL_RenderImage(hdimage, x, y, hdimage->renderwidth, hdimage->renderheight); } else { void const* ptr = Get_Cameo_Data(); @@ -3376,8 +3389,23 @@ void BuildingTypeClass::Init(TheaterType theater) // jmarshall { char imageFileName[512]; - sprintf(imageFileName, "textures/%s.png", fullname); - ((BuildingTypeClass *)classptr)->HDImageData = Image_LoadImage(imageFileName); + + // Try load the theatre specific asset first + sprintf(imageFileName, "DATA/ART/TEXTURES/SRGB/RED_ALERT/TERRAIN/%s/%s.%s/%s.%s-0000.DDS", Theaters[theater].Name, classptr->Graphic_Name(), Theaters[theater].Suffix, classptr->Graphic_Name(), Theaters[theater].Suffix); + ((BuildingTypeClass*)classptr)->HDImageData = Image_LoadImage(imageFileName); + + if (!((BuildingTypeClass*)classptr)->HDImageData) { + sprintf(imageFileName, "DATA/ART/TEXTURES/SRGB/RED_ALERT/STRUCTURES/%s/%s-0000.TGA", classptr->Graphic_Name(), classptr->Graphic_Name()); + ((BuildingTypeClass*)classptr)->HDImageData = Image_LoadImage(imageFileName); + } + + if (classptr->ImageData != NULL && classptr->HDImageData != NULL) { + int width = Get_Build_Frame_Width(classptr->ImageData); + int height = Get_Build_Frame_Height(classptr->ImageData); + + classptr->HDImageData->renderwidth = width; + classptr->HDImageData->renderheight = height; + } } // jmarshall end /* diff --git a/code/REDALERT/CONQUER.CPP b/code/REDALERT/CONQUER.CPP index 3f5f763..f44bde6 100644 --- a/code/REDALERT/CONQUER.CPP +++ b/code/REDALERT/CONQUER.CPP @@ -3498,8 +3498,8 @@ void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType if (image != NULL && shapenum != -1) { - int width = image->width; - int height = image->height; + int width = image->renderwidth; + int height = image->renderheight; #ifdef NEVER /* diff --git a/code/REDALERT/Image.h b/code/REDALERT/Image.h index 8ca0c14..7df1f95 100644 --- a/code/REDALERT/Image.h +++ b/code/REDALERT/Image.h @@ -9,6 +9,8 @@ struct Image_t { unsigned int image; int width; int height; + int renderwidth; + int renderheight; unsigned char* buffer; }; diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index ce14c0a..7c0c618 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -45,6 +45,7 @@ #include "examples/imgui_impl_sdl.h" #include "function.h" #include "il/il.h" +#include "il/ilu.h" #include "image.h" #ifdef WINSOCK_IPX @@ -106,6 +107,10 @@ Image_t* Image_LoadImage(const char* name) { return NULL; } + if (strstr(name, ".TGA")) { + iluFlipImage(); + } + ILuint Width, Height, Bpp; Width = ilGetInteger(IL_IMAGE_WIDTH); Height = ilGetInteger(IL_IMAGE_HEIGHT); @@ -135,8 +140,8 @@ Image_t* Image_LoadImage(const char* name) { Image_t* image = new Image_t(); strcpy(image->name, name); image->image = texture; - image->width = Width; - image->height = Height; + image->renderwidth = image->width = Width; + image->renderheight = image->height = Height; image->buffer = new unsigned char[Width * Height * Bpp]; memcpy(image->buffer, Data, Width * Height * Bpp); loaded_images.push_back(image); @@ -199,8 +204,8 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi strcpy(image->name, name); image->image = texture; - image->width = Width; - image->height = Height; + image->renderwidth = image->width = Width; + image->renderheight = image->height = Height; loaded_images.push_back(image); return image; } diff --git a/code/external/devil/ILU.lib b/code/external/devil/ILU.lib new file mode 100644 index 0000000..5ea04cb Binary files /dev/null and b/code/external/devil/ILU.lib differ