Added render offset for the Construction yard, width/height for buildings is now based on width/height of the first frame of the image.

This commit is contained in:
Justin Marshall
2020-08-05 14:59:30 -07:00
parent a150ec5e29
commit 4b8246506f
4 changed files with 10 additions and 30 deletions
+3 -24
View File
@@ -3810,18 +3810,7 @@ short const * BuildingTypeClass::Overlap_List(void) const
*=============================================================================================*/
int BuildingTypeClass::Width(void) const
{
static int width[BSIZE_COUNT] = {
1,
2,
1,
2,
2,
3,
3,
4,
5
};
return(width[Size]);
return (Get_Build_Frame_Width(Get_Image_Data(), 0) / ICON_PIXEL_W) + 1;
}
@@ -3841,18 +3830,7 @@ int BuildingTypeClass::Width(void) const
*=============================================================================================*/
int BuildingTypeClass::Height(bool bib) const
{
static int height[BSIZE_COUNT] = {
1,
1,
2,
2,
3,
2,
3,
2,
5
};
return(height[Size] + ((bib && IsBibbed) ? 1 : 0));
return (Get_Build_Frame_Height(Get_Image_Data(), 0) / ICON_PIXEL_H) + 1;
}
@@ -4077,6 +4055,7 @@ bool BuildingTypeClass::Read_INI(CCINIClass & ini)
ActiveAnimAnimShape = MFCD::Retrieve(ConstructAnimName);
}
RenderOffsetY = ini.Get_Int(Name(), "RenderOffsetY", 0);
IdleAnimIgnorePowerState = ini.Get_Int(Name(), "IdleAnimIgnorePowerState", 0);
IdleHasShadowFrames = ini.Get_Int(Name(), "IdleHasShadowFrames", 0);
IdleAnimNonDamagedStart = ini.Get_Int(Name(), "IdleAnimNonDamagedStart", -1);
+3 -1
View File
@@ -463,6 +463,8 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
*/
void const * shapefile = Get_Image_Data();
if (shapefile == NULL) return;
y = y + Class->RenderOffsetY;
/*
** Actually draw the building shape.
@@ -609,7 +611,7 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
}
}
TechnoClass::Draw_It(x, y, window);
TechnoClass::Draw_It(x, y - Class->RenderOffsetY, window);
/*
** If this is a factory that we're spying on, show what it's producing
+2 -4
View File
@@ -832,11 +832,9 @@ class BuildingTypeClass : public TechnoTypeClass {
int ActiveAnimNonDamagedStart;
int ActiveAnimNonDamagedFrames;
int ActiveAnimDamagedStart;
int ActiveAnimDamagedFrames;
int ActiveAnimDamagedFrames;
int RenderOffsetY;
private:
int tileW;
int tileH;
/*
** This is a pointer to a list of offsets (from the upper left corner) that
** are used to indicate the building's "footprint". This footprint is used