diff --git a/code/REDALERT/BDATA.CPP b/code/REDALERT/BDATA.CPP index ea87ba2..7a4df0c 100644 --- a/code/REDALERT/BDATA.CPP +++ b/code/REDALERT/BDATA.CPP @@ -3146,6 +3146,22 @@ void BuildingTypeClass::One_Time(void) if (imageFileName) { Image_t *image = Image_LoadImage(imageFileName, true, true); int numBuildingAnims = Buildings_GetNumFramesForTile(fullname, 0); + int shapeId = 1; + + // Load the old school animation pipeline. + { + while (true) { + imageFileName = Buildings_FindHDTexture(fullname, shapeId, 0); + if (imageFileName == NULL) + break; + + for (int d = 0; d < MAX_MPLAYER_COLORS; d++) { + Image_Add32BitImage(imageFileName, image, d, shapeId, 0); + } + shapeId++; + } + } + if (numBuildingAnims > 0) { for (int i = 1; i < numBuildingAnims; i++) { @@ -3406,7 +3422,23 @@ void BuildingTypeClass::Init(TheaterType theater) // Try load the theatre specific asset first if (imageFileName) { - ((BuildingTypeClass*)classptr)->HDImageData = Image_LoadImage(imageFileName, true, true); + Image_t *image = ((BuildingTypeClass*)classptr)->HDImageData = Image_LoadImage(imageFileName, true, true); + + // Load the old school animation pipeline. + int shapeId = 1; + { + while (true) { + imageFileName = Buildings_FindHDTexture(fullname, shapeId, 0); + if (imageFileName == NULL) + break; + + for (int d = 0; d < MAX_MPLAYER_COLORS; d++) { + Image_Add32BitImage(imageFileName, image, d, shapeId, 0); + } + shapeId++; + } + } + int numBuildingAnims = Buildings_GetNumFramesForTile(fullname, 0); if (numBuildingAnims > 0) diff --git a/code/REDALERT/BDATAXML.CPP b/code/REDALERT/BDATAXML.CPP index c030932..d027f61 100644 --- a/code/REDALERT/BDATAXML.CPP +++ b/code/REDALERT/BDATAXML.CPP @@ -30,6 +30,9 @@ const char* Buildings_FindHDTexture(const char* shapeFileName, int shapeNum, int for (int i = 0; i < buildingsXmlRules.tiles.size(); i++) { if (buildingsXmlRules.tiles[i].hash == hash && buildingsXmlRules.tiles[i].shape == shapeNum) { static char hdTexturePath[2048]; + if (buildingsXmlRules.tiles[i].frames.size() == 0) + return NULL; + sprintf(hdTexturePath, "DATA/ART/TEXTURES/SRGB/RED_ALERT/STRUCTURES/%s", buildingsXmlRules.tiles[i].frames[frameNum].c_str()); return &hdTexturePath[0]; } diff --git a/code/REDALERT/CONQUER.CPP b/code/REDALERT/CONQUER.CPP index dd76f5c..7d2ca71 100644 --- a/code/REDALERT/CONQUER.CPP +++ b/code/REDALERT/CONQUER.CPP @@ -3585,18 +3585,18 @@ void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType Buffer_Enable_HD_Texture(true); //if (draw_window.Lock()) { if ((flags & (SHAPE_GHOST | SHAPE_FADING)) == (SHAPE_GHOST | SHAPE_FADING)) { - Buffer_Frame_To_Page(x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); } else { if (flags & SHAPE_FADING) { - Buffer_Frame_To_Page(x, y, width, height, image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); } else { if (flags & SHAPE_PREDATOR) { - Buffer_Frame_To_Page(x, y, width, height, image, window, flags | SHAPE_TRANS, predoffset); + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, predoffset); } else { - Buffer_Frame_To_Page(x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, predoffset); + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, predoffset); } } } @@ -3786,15 +3786,15 @@ void CC_Draw_Shape(void const * shapefile, int shapenum, int x, int y, WindowNum { if ((flags & (SHAPE_GHOST|SHAPE_FADING)) == (SHAPE_GHOST|SHAPE_FADING)) { - Buffer_Frame_To_Page(x, y, width, height, shape_image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); + Buffer_Frame_To_Page(-1, x, y, width, height, shape_image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); } else { if (flags & SHAPE_FADING) { - Buffer_Frame_To_Page(x, y, width, height, shape_image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); + Buffer_Frame_To_Page(-1, x, y, width, height, shape_image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); } else { if (flags & SHAPE_PREDATOR) { - Buffer_Frame_To_Page(x, y, width, height, shape_image, window, flags | SHAPE_TRANS, predoffset); + Buffer_Frame_To_Page(-1, x, y, width, height, shape_image, window, flags | SHAPE_TRANS, predoffset); } else { - Buffer_Frame_To_Page(x, y, width, height, shape_image, window, flags | SHAPE_TRANS, ghostdata, predoffset); + Buffer_Frame_To_Page(-1, x, y, width, height, shape_image, window, flags | SHAPE_TRANS, ghostdata, predoffset); } } } diff --git a/code/REDALERT/FUNCTION.H b/code/REDALERT/FUNCTION.H index adb300a..394f889 100644 --- a/code/REDALERT/FUNCTION.H +++ b/code/REDALERT/FUNCTION.H @@ -709,7 +709,7 @@ void Buffer_Enable_HD_Texture(bool hdTextureEnabled); /* ** KEYFBUFF.ASM */ -long __cdecl Buffer_Frame_To_Page(int x, int y, int w, int h, Image_t* image, unsigned int Window, int flags, ...); +long __cdecl Buffer_Frame_To_Page(int shapeNum, int x, int y, int w, int h, Image_t* image, unsigned int Window, int flags, ...); /* ** KEYFRAME.CPP diff --git a/code/REDALERT/Shape.cpp b/code/REDALERT/Shape.cpp index 7fa8e26..e516583 100644 --- a/code/REDALERT/Shape.cpp +++ b/code/REDALERT/Shape.cpp @@ -1396,7 +1396,7 @@ static void Single_Line_Flagger( } } -long Buffer_Frame_To_Page(int x, int y, int width, int height, struct Image_t * shape_image, unsigned int Window, int flags, ...) +long Buffer_Frame_To_Page(int shapeNum, int x, int y, int width, int height, struct Image_t * shape_image, unsigned int Window, int flags, ...) { BOOL use_old_drawer = false; int fade_count = 0; @@ -1547,7 +1547,7 @@ long Buffer_Frame_To_Page(int x, int y, int width, int height, struct Image_t * ystart = ystart + WindowList[Window][WINDOWY];// + LogicPage->Get_YPos(); //GL_SetClipRect(WindowList[Window][WINDOWX], WindowList[Window][WINDOWY], WindowList[Window][WINDOWWIDTH], WindowList[Window][WINDOWWIDTH]); if(renderHDTexture) - GL_RenderImage(shape_image, xstart, ystart, width, height, (int)fade_table); + GL_RenderImage(shape_image, xstart, ystart, width, height, (int)fade_table, shapeNum); else GL_RenderImage(shape_image, xstart, ystart, width, height, 0);