Added RA2 tesla coil graphics, cleaned up Image_CreateImageFrom8Bit.

This commit is contained in:
Justin Marshall
2020-08-04 13:45:53 -07:00
parent 5481bd1e7d
commit 1d79c5ddd8
3 changed files with 61 additions and 33 deletions
+12 -9
View File
@@ -489,7 +489,7 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
int animShapeNum = Shape_Number(); int animShapeNum = Shape_Number();
// If we have a seperate activation animation, play that instead of cycling through the frames here. // 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; animShapeNum = 0;
} }
@@ -503,15 +503,18 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
// jmarshall end // jmarshall end
// jmarshall idle/construction animation // jmarshall idle/construction animation
if (Class->IdleAnimShape != NULL) { // Only play the idle animation if we have power!
int shapeNum = animFrameNum; if (!Class->IsPowered || (Class->IsPowered && House->Power_Fraction() >= 1)) {
int maxframes = Get_Build_Frame_Count(Class->IdleAnimShape); if (Class->IdleAnimShape != NULL) {
if (Class->IdleAnimNonDamagedFrames != -1) { int shapeNum = animFrameNum;
maxframes = Class->IdleAnimNonDamagedFrames; int maxframes = Get_Build_Frame_Count(Class->IdleAnimShape);
} if (Class->IdleAnimNonDamagedFrames != -1) {
maxframes = Class->IdleAnimNonDamagedFrames;
}
shapeNum = shapeNum % maxframes; shapeNum = shapeNum % maxframes;
Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window); Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window);
}
} }
if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL) { if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL) {
+32 -22
View File
@@ -508,19 +508,29 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi
unsigned char r = 0; unsigned char r = 0;
unsigned char g = 0; unsigned char g = 0;
unsigned char b = 0; unsigned char b = 0;
unsigned char a = 0; unsigned char a = 255;
if (CCGlobalShadowRender && c != 0) { // If C is zero then its 0% alpha.
r = 120; if (c == 0) {
g = 120; buffer[(i * 4) + 0] = 0;
b = 120; buffer[(i * 4) + 1] = 0;
a = 120; 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) { else if (CCGlobalOveridePalette && remap) {
r = ccpalete[(c * 3) + 0] << 2; r = ccpalete[(c * 3) + 0] << 2;
g = ccpalete[(c * 3) + 1] << 2; g = ccpalete[(c * 3) + 1] << 2;
b = ccpalete[(c * 3) + 2] << 2; b = ccpalete[(c * 3) + 2] << 2;
a = 0;
// Assume we are loading TS palettes. // Assume we are loading TS palettes.
if (c >= 0x10 && c <= 0x1f) { 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; r = remap.GetRawRed() << 2;
g = remap.GetRawGreen() << 2; g = remap.GetRawGreen() << 2;
b = remap.GetRawBlue() << 2; b = remap.GetRawBlue() << 2;
a = 0;
} }
} }
else if (remap) { 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; r = ccpalete[(c * 3) + 0] << 2;
g = ccpalete[(c * 3) + 1] << 2; g = ccpalete[(c * 3) + 1] << 2;
b = ccpalete[(c * 3) + 2] << 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 else
{ {
r = ccpalete[(c * 3) + 0] << 2; r = ccpalete[(c * 3) + 0] << 2;
g = ccpalete[(c * 3) + 1] << 2; g = ccpalete[(c * 3) + 1] << 2;
b = ccpalete[(c * 3) + 2] << 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)) {
if ((r == 84 && g == 252 && b == 84) || (r == 0 && g == 168 && b == 0)) { r = 0;
r = 0; g = 0;
g = 0; b = 0;
b = 0; a = 128;
a = 128; }
} }
else if (c != 0) {
a = 255;
}
buffer[(i * 4) + 0] = r; buffer[(i * 4) + 0] = r;
buffer[(i * 4) + 1] = g; buffer[(i * 4) + 1] = g;
+17 -2
View File
@@ -1341,20 +1341,35 @@ Crewed=yes
; Tesla coil ; Tesla coil
[TSLA] [TSLA]
Prerequisite=weap ;Prerequisite=weap
Primary=TeslaZap Primary=TeslaZap
Strength=400 Strength=400
Armor=heavy Armor=heavy
TechLevel=7 TechLevel=7
Sight=8 Sight=8
Owner=soviet Owner=soviet
Cost=1500 ;Cost=1500
Cost=2
Points=80 Points=80
Power=-150 Power=-150
Ammo=3 Ammo=3
Powered=true Powered=true
Sensors=yes Sensors=yes
Crewed=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 turret
[GUN] [GUN]