Added initial code to display buildings from the remaster.

This commit is contained in:
Justin Marshall
2020-06-18 21:31:52 -07:00
parent ddebcd6033
commit f36a4ddf2f
7 changed files with 45 additions and 10 deletions
+31 -3
View File
@@ -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
/*