From 332c36efa329b3a4c13cbf885f20ddf55155ef2e Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sun, 21 Jun 2020 19:53:01 -0700 Subject: [PATCH] Aircraft remaster assets now load. --- code/REDALERT/AADATA.CPP | 42 ++++++++++++++++++++++++++++++ code/REDALERT/AIRCRAFT.CPP | 53 +++++++++++++++++++++----------------- 2 files changed, 72 insertions(+), 23 deletions(-) diff --git a/code/REDALERT/AADATA.CPP b/code/REDALERT/AADATA.CPP index 473826d..b5f0d4b 100644 --- a/code/REDALERT/AADATA.CPP +++ b/code/REDALERT/AADATA.CPP @@ -48,6 +48,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "function.h" +#include "Image.h" void const * AircraftTypeClass::LRotorData = NULL; @@ -426,6 +427,47 @@ void AircraftTypeClass::One_Time(void) */ _makepath(fullname, NULL, NULL, uclass.Graphic_Name(), ".SHP"); ((void const *&)uclass.ImageData) = MFCD::Retrieve(fullname); + { + const char* imageFileName = Units_FindHDTexture(fullname, 0, 0); + + if (imageFileName) { + Image_t* image = Image_LoadImage(imageFileName, true, true); + int numUnitsAnims = Units_GetNumFramesForTile(fullname, 0); + int shapeId = 1; + + // Load the old school animation pipeline. + { + while (true) { + imageFileName = Units_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++; + } + } + + for (int d = 0; d < shapeId; d++) { + image->renderwidth[d] = image->renderwidth[d] / 5; + image->renderheight[d] = image->renderheight[d] / 5; + } + + if (numUnitsAnims > 0) + { + for (int i = 1; i < numUnitsAnims; i++) { + imageFileName = Units_FindHDTexture(fullname, 0, i); + for (int d = 0; d < MAX_MPLAYER_COLORS; d++) { + Image_Add32BitImage(imageFileName, image, d, 0, i); + } + } + } + + image->numFrames = numUnitsAnims; + ((void const*&)uclass.HDImageData) = image; + } + } } LRotorData = MFCD::Retrieve("LROTOR.SHP"); diff --git a/code/REDALERT/AIRCRAFT.CPP b/code/REDALERT/AIRCRAFT.CPP index 7722529..5e40fae 100644 --- a/code/REDALERT/AIRCRAFT.CPP +++ b/code/REDALERT/AIRCRAFT.CPP @@ -409,6 +409,7 @@ void AircraftClass::Draw_It(int x, int y, WindowNumberType window) const ** Verify the legality of the unit class. */ void const * shapefile = Get_Image_Data(); + Image_t* hdShapeFile = Get_HDImage_Data(); if (!shapefile) return; int shapenum = Shape_Number(); @@ -440,33 +441,39 @@ void AircraftClass::Draw_It(int x, int y, WindowNumberType window) const static int _jitter[] = {0,0,0,0,1,1,1,0,0,0,0,0,-1,-1,-1,0}; jitter = _jitter[::Frame % 16]; } - - // Virtual window needs to draw the body first so it's considered the primary object and the shadow is a sub-object - if (window == WINDOW_VIRTUAL) { - /* - ** Draw the root body of the unit. - */ - Techno_Draw_Object(shapefile, shapenum, x, y+jitter, window, rotation); - - /* - ** Special manual shadow draw code. - */ - if (Visual_Character() <= VISUAL_DARKEN) { - CC_Draw_Shape(this, shapefile, shapenum, x+1, y+2, window, SHAPE_PREDATOR|SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_FADING, DisplayClass::FadingShade, NULL); - } - } else { - /* - ** Special manual shadow draw code. - */ - if (Visual_Character() <= VISUAL_DARKEN) { - CC_Draw_Shape(this, shapefile, shapenum, x+1, y+2, window, SHAPE_PREDATOR|SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_FADING, DisplayClass::FadingShade, NULL); - } +// jmarshall +// // Virtual window needs to draw the body first so it's considered the primary object and the shadow is a sub-object +// if (window == WINDOW_VIRTUAL) { +// /* +// ** Draw the root body of the unit. +// */ +// Techno_Draw_Object(shapefile, shapenum, x, y+jitter, window, rotation); +// +// /* +// ** Special manual shadow draw code. +// */ +// if (Visual_Character() <= VISUAL_DARKEN) { +// CC_Draw_Shape(this, shapefile, shapenum, x+1, y+2, window, SHAPE_PREDATOR|SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_FADING, DisplayClass::FadingShade, NULL); +// } +// } else { +// /* +// ** Special manual shadow draw code. +// */ +// if (Visual_Character() <= VISUAL_DARKEN) { +// CC_Draw_Shape(this, shapefile, shapenum, x+1, y+2, window, SHAPE_PREDATOR|SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_FADING, DisplayClass::FadingShade, NULL); +// } /* ** Draw the root body of the unit. */ - Techno_Draw_Object(shapefile, shapenum, x, y+jitter, window, rotation); - } + if (hdShapeFile) { + Techno_Draw_Object_HD(hdShapeFile, shapenum, x, y + jitter, window, rotation); + } + else { + Techno_Draw_Object(shapefile, shapenum, x, y + jitter, window, rotation); + } +// } +// jmarshall end /* ** If this aircraft is equipped with rotor blades, then draw them at this time.