mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
All building animations now work.
This commit is contained in:
+33
-1
@@ -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)
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user