mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Added initial code to display buildings from the remaster.
This commit is contained in:
+1
-1
@@ -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")
|
||||
|
||||
+31
-3
@@ -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
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
/*
|
||||
|
||||
@@ -9,6 +9,8 @@ struct Image_t {
|
||||
unsigned int image;
|
||||
int width;
|
||||
int height;
|
||||
int renderwidth;
|
||||
int renderheight;
|
||||
unsigned char* buffer;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user