Added support for separate active animation SHP.

This commit is contained in:
Justin Marshall
2020-08-01 13:17:17 -07:00
parent 857f0b7f60
commit 3763e9e2ed
4 changed files with 29 additions and 6 deletions
+6
View File
@@ -2947,6 +2947,7 @@ BuildingTypeClass::BuildingTypeClass(
memset(CustomTheatrePalette, 0, sizeof(CustomTheatrePalette));
IdleAnimShape = NULL;
ActiveAnimAnimShape = NULL;
Anims[BSTATE_CONSTRUCTION].Start = 0;
Anims[BSTATE_CONSTRUCTION].Count = 1;
@@ -4005,6 +4006,7 @@ bool BuildingTypeClass::Read_INI(CCINIClass & ini)
{
char customPalName[512];
char idleAnimName[512];
char ConstructAnimName[512];
if (TechnoTypeClass::Read_INI(ini)) {
Speed = ini.Get_Bool(Name(), "WaterBound", (Speed == SPEED_FLOAT)) ? SPEED_FLOAT : SPEED_NONE;
@@ -4028,6 +4030,10 @@ bool BuildingTypeClass::Read_INI(CCINIClass & ini)
IdleAnimShape = MFCD::Retrieve(idleAnimName);
}
if (ini.Get_String(Name(), "ActiveAnim", "", &ConstructAnimName[0], sizeof(ConstructAnimName)) > 0) {
ActiveAnimAnimShape = MFCD::Retrieve(ConstructAnimName);
}
if (Power < 0) {
Drain = -Power;
Power = 0;
+18 -3
View File
@@ -474,21 +474,36 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
CCGlobalOveridePalette = (void *)Class->CustomTheatrePalette[LastTheater];
}
{
int animShapeNum = Shape_Number();
// If we have a seperate activation animation, play that instead of cycling through the frames here.
if (BState == BSTATE_ACTIVE && Class->ActiveAnimAnimShape != NULL) {
animShapeNum = 0;
}
if (hdimage != NULL) {
Techno_Draw_Object_HD(hdimage, Shape_Number(), x, y, window);
Techno_Draw_Object_HD(hdimage, animShapeNum, x, y, window);
}
else {
Techno_Draw_Object(shapefile, Shape_Number(), x, y, window);
Techno_Draw_Object(shapefile, animShapeNum, x, y, window);
}
}
// jmarshall end
// jmarshall idle animation
// jmarshall idle/construction animation
if (Class->IdleAnimShape != NULL) {
int shapeNum = animFrameNum;
shapeNum = shapeNum % Get_Build_Frame_Count(Class->IdleAnimShape);
Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window);
}
if (BState == BSTATE_ACTIVE && Class->ActiveAnimAnimShape != NULL) {
int shapeNum = Shape_Number();
shapeNum = shapeNum % Get_Build_Frame_Count(Class->ActiveAnimAnimShape);
Techno_Draw_Object(Class->ActiveAnimAnimShape, shapeNum, x, y, window);
}
CCGlobalOveridePalette = NULL;
// jmarshall end
+1
View File
@@ -820,6 +820,7 @@ class BuildingTypeClass : public TechnoTypeClass {
const void* CustomTheatrePalette[3];
const void* IdleAnimShape;
const void* ActiveAnimAnimShape;
private:
/*
+1
View File
@@ -1421,6 +1421,7 @@ Crewed=yes
Snow=eapal1sno.pal
Temperate=eapal1tem.pal
IdleAnim=EACNST_A.SHP
ActiveAnim=EACNST_WORKING.SHP
; refinery
[PROC]