diff --git a/code/redalert/bdata.cpp b/code/redalert/bdata.cpp index b2d3db1..72e7a8c 100644 --- a/code/redalert/bdata.cpp +++ b/code/redalert/bdata.cpp @@ -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; diff --git a/code/redalert/building.cpp b/code/redalert/building.cpp index 03648ba..caf877c 100644 --- a/code/redalert/building.cpp +++ b/code/redalert/building.cpp @@ -474,21 +474,36 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const CCGlobalOveridePalette = (void *)Class->CustomTheatrePalette[LastTheater]; } - if (hdimage != NULL) { - Techno_Draw_Object_HD(hdimage, Shape_Number(), x, y, window); - } - else { - Techno_Draw_Object(shapefile, Shape_Number(), x, y, window); + { + 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, animShapeNum, x, y, window); + } + else { + 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 diff --git a/code/redalert/type.h b/code/redalert/type.h index 66dbe1e..bd44842 100644 --- a/code/redalert/type.h +++ b/code/redalert/type.h @@ -820,6 +820,7 @@ class BuildingTypeClass : public TechnoTypeClass { const void* CustomTheatrePalette[3]; const void* IdleAnimShape; + const void* ActiveAnimAnimShape; private: /* diff --git a/rules.ini b/rules.ini index fbfd54a..427752d 100644 --- a/rules.ini +++ b/rules.ini @@ -1421,6 +1421,7 @@ Crewed=yes Snow=eapal1sno.pal Temperate=eapal1tem.pal IdleAnim=EACNST_A.SHP +ActiveAnim=EACNST_WORKING.SHP ; refinery [PROC]