diff --git a/code/redalert/building.cpp b/code/redalert/building.cpp index c9601e1..db76cfe 100644 --- a/code/redalert/building.cpp +++ b/code/redalert/building.cpp @@ -489,7 +489,7 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const 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) { + if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL){ animShapeNum = 0; } @@ -503,15 +503,18 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const // jmarshall end // jmarshall idle/construction animation - if (Class->IdleAnimShape != NULL) { - int shapeNum = animFrameNum; - int maxframes = Get_Build_Frame_Count(Class->IdleAnimShape); - if (Class->IdleAnimNonDamagedFrames != -1) { - maxframes = Class->IdleAnimNonDamagedFrames; - } + // Only play the idle animation if we have power! + if (!Class->IsPowered || (Class->IsPowered && House->Power_Fraction() >= 1)) { + if (Class->IdleAnimShape != NULL) { + int shapeNum = animFrameNum; + int maxframes = Get_Build_Frame_Count(Class->IdleAnimShape); + if (Class->IdleAnimNonDamagedFrames != -1) { + maxframes = Class->IdleAnimNonDamagedFrames; + } - shapeNum = shapeNum % maxframes; - Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window); + shapeNum = shapeNum % maxframes; + Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window); + } } if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL) { diff --git a/code/redalert/winstub.cpp b/code/redalert/winstub.cpp index cb8bcfa..c742c01 100644 --- a/code/redalert/winstub.cpp +++ b/code/redalert/winstub.cpp @@ -508,19 +508,29 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi unsigned char r = 0; unsigned char g = 0; unsigned char b = 0; - unsigned char a = 0; + unsigned char a = 255; - if (CCGlobalShadowRender && c != 0) { - r = 120; - g = 120; - b = 120; - a = 120; + // If C is zero then its 0% alpha. + if (c == 0) { + buffer[(i * 4) + 0] = 0; + buffer[(i * 4) + 1] = 0; + buffer[(i * 4) + 2] = 0; + buffer[(i * 4) + 3] = 0; + continue; + } + + if (CCGlobalShadowRender) { + buffer[(i * 4) + 0] = 120; + buffer[(i * 4) + 1] = 120; + buffer[(i * 4) + 2] = 120; + buffer[(i * 4) + 3] = 120; + + continue; } else if (CCGlobalOveridePalette && remap) { r = ccpalete[(c * 3) + 0] << 2; g = ccpalete[(c * 3) + 1] << 2; b = ccpalete[(c * 3) + 2] << 2; - a = 0; // Assume we are loading TS palettes. if (c >= 0x10 && c <= 0x1f) { @@ -531,7 +541,6 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi r = remap.GetRawRed() << 2; g = remap.GetRawGreen() << 2; b = remap.GetRawBlue() << 2; - a = 0; } } else if (remap) { @@ -539,28 +548,29 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi r = ccpalete[(c * 3) + 0] << 2; g = ccpalete[(c * 3) + 1] << 2; b = ccpalete[(c * 3) + 2] << 2; - a = 0; + + // Red Alert 1 shadow support. + if ((r == 84 && g == 252 && b == 84) || (r == 0 && g == 168 && b == 0)) { + r = 0; + g = 0; + b = 0; + a = 128; + } } else { r = ccpalete[(c * 3) + 0] << 2; g = ccpalete[(c * 3) + 1] << 2; b = ccpalete[(c * 3) + 2] << 2; - a = 0; - } - - - if ((r == 84 && g == 252 && b == 84) || (r == 0 && g == 168 && b == 0)) { - r = 0; - g = 0; - b = 0; - a = 128; + // Red Alert 1 shadow support. + if ((r == 84 && g == 252 && b == 84) || (r == 0 && g == 168 && b == 0)) { + r = 0; + g = 0; + b = 0; + a = 128; + } } - else if (c != 0) { - a = 255; - } - buffer[(i * 4) + 0] = r; buffer[(i * 4) + 1] = g; diff --git a/rules.ini b/rules.ini index 78f0035..9e7c874 100644 --- a/rules.ini +++ b/rules.ini @@ -1341,20 +1341,35 @@ Crewed=yes ; Tesla coil [TSLA] -Prerequisite=weap +;Prerequisite=weap Primary=TeslaZap Strength=400 Armor=heavy TechLevel=7 Sight=8 Owner=soviet -Cost=1500 +;Cost=1500 +Cost=2 Points=80 Power=-150 Ammo=3 Powered=true Sensors=yes Crewed=yes +Image=ngtsla +IdleAnim=ngtsla_a.SHP +ActiveAnim=ngtsla_b.SHP +Snow=eapal1sno.pal +Temperate=eapal1tem.pa +IdleAnimNonDamagedStart=0 +IdleAnimNonDamagedFrames=9 +IdleAnimDamagedStart=10 +IdleAnimDamagedFrames=9 +IdleHasShadowFrames=1 +ActiveAnimNonDamagedStart=0 +ActiveAnimNonDamagedFrames=9 +ActiveAnimDamagedStart=10 +ActiveAnimDamagedFrames=9 ; gun turret [GUN]