Added first enviro prop building(restricted asset from Tiberian Sun).

This commit is contained in:
Justin Marshall
2020-07-07 13:53:42 -07:00
parent 9d3525aa71
commit 8a04d5fca9
10 changed files with 3096 additions and 19 deletions
+57 -17
View File
@@ -2458,6 +2458,37 @@ static BuildingTypeClass const ClassV37(
(short const *)ListWestwood, // OCCUPYLIST: List of active foundation squares.
(short const *)OListWestwood // OVERLAPLIST:List of overlap cell offset.
);
static BuildingTypeClass const ClassAban01(
STRUCT_ABAN01,
TXT_CIV37, // NAME: Short name of the structure.
"ABAN01", // NAME: Short name of the structure.
FACING_NONE, // Foundation direction from center of building.
XYP_COORD(0, 0), // Exit point for produced units.
REMAP_ALTERNATE, // Sidebar remap logic.
0x0000, // Vertical offset.
0x0000, // Primary weapon offset along turret centerline.
0x0000, // Primary weapon lateral offset along turret centerline.
false, // Is this building a fake (decoy?)
true, // Animation rate is regulated for constant speed?
true, // Always use the given name for the building?
false, // Is this a wall type structure?
true, // Simple (one frame) damage imagery?
false, // Is it invisible to radar?
true, // Can the player select this?
true, // Is this a legal target for attack or move?
false, // Is this an insignificant building?
false, // Theater specific graphic image?
false, // Does it have a rotating turret?
false, // Can the building be color remapped to indicate owner?
RTTI_NONE, // The object type produced at this factory.
DIR_N, // Starting idle frame to match construction.
BSIZE_42, // SIZE: Building size.
NULL, // Preferred exit cell list.
(short const*)ListWestwood, // OCCUPYLIST: List of active foundation squares.
(short const*)OListWestwood // OVERLAPLIST:List of overlap cell offset.
);
static BuildingTypeClass const ClassMission(
STRUCT_MISSION,
TXT_CIVMISS, // NAME: Short name of the structure.
@@ -3024,6 +3055,8 @@ void BuildingTypeClass::Init_Heap(void)
new BuildingTypeClass(ClassBarrel); // STRUCT_BARREL
new BuildingTypeClass(ClassBarrel3); // STRUCT_BARREL3
new BuildingTypeClass(ClassAban01);
#ifdef FIXIT_ANTS
new BuildingTypeClass(ClassQueen); // STRUCT_QUEEN
new BuildingTypeClass(ClassLarva1); // STRUCT_LARVA1
@@ -3035,18 +3068,19 @@ void BuildingTypeClass::Init_Heap(void)
#endif
}
Image_t* BuildingTypeClass::LoadHDImage(const char* fullname, int& numHDShapes) {
Image_t* BuildingTypeClass::LoadHDImage(const char* fullname, int& numHDShapes, bool remapHouse) {
const char* imageFileName = Buildings_FindHDTexture(fullname, 0, 0);
Image_t* image = NULL;
numHDShapes = -1;
if (imageFileName) {
image = Image_LoadImage(imageFileName, true, true);
image = Image_LoadImage(imageFileName, remapHouse, remapHouse);
int numBuildingAnims = Buildings_GetNumFramesForTile(fullname, 0);
int shapeId = 1;
// Load the old school animation pipeline.
if(remapHouse)
{
while (true) {
imageFileName = Buildings_FindHDTexture(fullname, shapeId, 0);
@@ -3063,9 +3097,15 @@ Image_t* BuildingTypeClass::LoadHDImage(const char* fullname, int& numHDShapes)
if (numBuildingAnims > 0)
{
for (int i = 1; i < numBuildingAnims; i++) {
imageFileName = Buildings_FindHDTexture(fullname, 0, i);
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, 0, i);
if(!remapHouse) {
imageFileName = Buildings_FindHDTexture(fullname, 0, i);
Image_Add32BitImage(imageFileName, image, -1, i, 0);
}
else {
imageFileName = Buildings_FindHDTexture(fullname, 0, i);
for (int d = 0; d < MAX_MPLAYER_COLORS; d++) {
Image_Add32BitImage(imageFileName, image, d, i, 0);
}
}
}
}
@@ -3184,18 +3224,18 @@ void BuildingTypeClass::One_Time(void)
*/
_makepath(fullname, NULL, NULL, building.Graphic_Name(), ".SHP");
((void const *&)building.ImageData) = MFCD::Retrieve(fullname);
((void const*&)building.HDImageData) = LoadHDImage(fullname, numhdimages);
((void const*&)building.HDImageData) = LoadHDImage(fullname, numhdimages, building.IsRemappable);
if (building.ImageData != NULL && building.HDImageData != NULL) {
int width = Get_Build_Frame_Width(building.ImageData);
int height = Get_Build_Frame_Height(building.ImageData);
for (int d = 0; d < numhdimages; d++)
{
building.HDImageData->renderwidth[d] = width;
building.HDImageData->renderheight[d] = height;
}
}
//if (building.ImageData != NULL && building.HDImageData != NULL) {
// int width = Get_Build_Frame_Width(building.ImageData);
// int height = Get_Build_Frame_Height(building.ImageData);
//
// for (int d = 0; d < numhdimages; d++)
// {
// building.HDImageData->renderwidth[d] = width;
// building.HDImageData->renderheight[d] = height;
// }
//}
}
int specialNumHDImages = 0;
@@ -3204,7 +3244,7 @@ void BuildingTypeClass::One_Time(void)
char fullname[_MAX_FNAME+_MAX_EXT];
_makepath(fullname, NULL, NULL, (char const *)"WEAP2",".SHP");
WarFactoryOverlay = MFCD::Retrieve(fullname);
WarFactoryHDOverlay = LoadHDImage(fullname, specialNumHDImages);
WarFactoryHDOverlay = LoadHDImage(fullname, specialNumHDImages, false);
if (WarFactoryOverlay != NULL && WarFactoryHDOverlay != NULL) {
int width = Get_Build_Frame_Width(WarFactoryOverlay);
int height = Get_Build_Frame_Height(WarFactoryOverlay);
+1
View File
@@ -1465,6 +1465,7 @@ typedef enum StructType : char {
STRUCT_V37,
STRUCT_BARREL,
STRUCT_BARREL3,
STRUCT_ABAN01,
#ifdef FIXIT_ANTS
STRUCT_QUEEN,
+1
View File
@@ -718,6 +718,7 @@ long __cdecl Buffer_Frame_To_Page(int shapeNum, int x, int y, int w, int h, Imag
*/
INT_PTR Build_Frame(void const *dataptr, unsigned short framenumber, void *buffptr);
unsigned short Get_Build_Frame_Count(void const *dataptr);
bool Get_Build_TiberianSun_Format(void const* dataptr);
unsigned short Get_Build_Frame_X(void const *dataptr);
unsigned short Get_Build_Frame_Y(void const *dataptr);
unsigned short Get_Build_Frame_Width(void const *dataptr);
+1 -1
View File
@@ -841,7 +841,7 @@ class BuildingTypeClass : public TechnoTypeClass {
void const * BuildupData;
void Init_Anim(BStateType state, int start, int count, int rate) const;
static Image_t* LoadHDImage(const char* fullname, int &numHDShapes);
static Image_t* LoadHDImage(const char* fullname, int &numHDShapes, bool remapHouse);
};
+15
View File
@@ -222,6 +222,21 @@ static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int
if (Data[(i * 4) + 2] == 0 && Data[(i * 4) + 1] == 0 && Data[(i * 4) + 0] == 117) {
Data[(i * 4) + 3] = 0;
}
if (Data[(i * 4) + 2] == 117 && Data[(i * 4) + 1] == 0 && Data[(i * 4) + 0]) {
Data[(i * 4) + 3] = 0;
}
}
}
else if (Bpp == 3) {
for (int i = 0; i < Width * Height; i++) {
byte b = Data[(i * 3) + 2];
Data[(i * 3) + 2] = Data[(i * 4) + 0];
Data[(i * 3) + 0] = b;
if (Data[(i * 3) + 2] == 0 && Data[(i * 3) + 1] == 0 && Data[(i * 3) + 0] == 117) {
Data[(i * 3) + 3] = 0;
}
}
}