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
+4 -1
View File
@@ -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,6 +503,8 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
// jmarshall end
// jmarshall idle/construction animation
// 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);
@@ -513,6 +515,7 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
shapeNum = shapeNum % maxframes;
Techno_Draw_Object(Class->IdleAnimShape, shapeNum, x, y, window);
}
}
if ((BState == BSTATE_ACTIVE || IsCharging) && Class->ActiveAnimAnimShape != NULL) {
int shapeNum = Shape_Number();
+31 -21
View File
@@ -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;
}
else
{
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 if (c != 0) {
a = 255;
}
else
{
r = ccpalete[(c * 3) + 0] << 2;
g = ccpalete[(c * 3) + 1] << 2;
b = ccpalete[(c * 3) + 2] << 2;
// 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;
}
}
buffer[(i * 4) + 0] = r;
buffer[(i * 4) + 1] = g;
+17 -2
View File
@@ -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]