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();
// 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) {
+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 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;