Tesla attack now works with active shp's.

This commit is contained in:
Justin Marshall
2020-08-04 07:30:32 -07:00
parent 978a1f6a05
commit 6ee6c84777
2 changed files with 21 additions and 3 deletions
+19 -3
View File
@@ -463,7 +463,7 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
*/
void const * shapefile = Get_Image_Data();
if (shapefile == NULL) return;
/*
** Actually draw the building shape.
*/
@@ -514,8 +514,14 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window);
}
if (BState == BSTATE_ACTIVE && Class->ActiveAnimAnimShape != NULL) {
if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL) {
int shapeNum = Shape_Number();
// If we are charging play the charging anims.
if (IsCharging) {
shapeNum = customAnimFrames;
((BuildingClass * )this)->customAnimFrames += 0.5;
}
int maxframes = Get_Build_Frame_Count(Class->ActiveAnimAnimShape);
if (Class->ActiveAnimNonDamagedFrames != -1) {
maxframes = Class->ActiveAnimNonDamagedFrames;
@@ -5775,7 +5781,16 @@ void BuildingClass::Charging_AI(void)
if (Class->PrimaryWeapon != NULL && Class->PrimaryWeapon->IsElectric && BState != BSTATE_CONSTRUCTION) {
if (Target_Legal(TarCom) && House->Power_Fraction() >= 1) {
if (!IsCharged) {
if (IsCharging) {
if (Class->ActiveAnimAnimShape && IsCharging) {
Mark(MARK_CHANGE);
if (customAnimFrames >= Class->ActiveAnimNonDamagedFrames) {
IsCharged = true;
IsCharging = false;
customAnimFrames = 0;
Set_Rate(0);
}
}
else if (IsCharging) {
// if (stagechange) {
Mark(MARK_CHANGE);
if (Fetch_Stage() >= 9) {
@@ -5787,6 +5802,7 @@ void BuildingClass::Charging_AI(void)
} else if (!Arm) {
IsCharged = false;
IsCharging = true;
customAnimFrames = 0;
Set_Stage(0);
Set_Rate(3);
Sound_Effect(VOC_TESLA_POWER_UP, Coord);
+2
View File
@@ -353,6 +353,8 @@ class BuildingClass : public TechnoClass
private:
void Drop_Debris(TARGET source = TARGET_NONE);
float customAnimFrames;
/*
** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
*/