TS/RA2 SHP shadow support.

This commit is contained in:
Justin Marshall
2020-08-03 08:36:06 -07:00
parent 19b9cb16f8
commit 65ebb17489
9 changed files with 48 additions and 4 deletions
+1
View File
@@ -4084,6 +4084,7 @@ bool BuildingTypeClass::Read_INI(CCINIClass & ini)
ActiveAnimAnimShape = MFCD::Retrieve(ConstructAnimName);
}
IdleHasShadowFrames = ini.Get_Int(Name(), "IdleHasShadowFrames", 0);
IdleAnimNonDamagedStart = ini.Get_Int(Name(), "IdleAnimNonDamagedStart", -1);
IdleAnimNonDamagedFrames = ini.Get_Int(Name(), "IdleAnimNonDamagedFrames", -1);
IdleAnimDamagedStart = ini.Get_Int(Name(), "IdleAnimDamagedStart", -1);
+24
View File
@@ -528,6 +528,30 @@ void BuildingClass::Draw_It(int x, int y, WindowNumberType window) const
CCGlobalOveridePalette = NULL;
// jmarshall end
// jmarshall - shadows are going to need to be done differently, but for now this will work.
if (Get_Build_TS_Shape(shapefile))
{
CCGlobalShadowRender = true;
{
int shadowFrameOffset = Get_Build_Frame_Count(shapefile) / 2;
Techno_Draw_Object(shapefile, shadowFrameOffset + Shape_Number(), x, y, window);
}
if (Class->IdleHasShadowFrames && Class->IdleAnimShape != NULL) {
int shapeNum = animFrameNum;
int maxframes = Get_Build_Frame_Count(Class->IdleAnimShape);
if (Class->IdleAnimNonDamagedFrames != -1) {
maxframes = Class->IdleAnimNonDamagedFrames;
}
shapeNum = shapeNum % maxframes;
int shadowFrameOffset = Get_Build_Frame_Count(Class->IdleAnimShape) / 2;
Techno_Draw_Object(Class->IdleAnimShape, shadowFrameOffset + shapeNum, x, y, window);
}
CCGlobalShadowRender = false;
}
// jmarshall end
IsTheaterShape = false;
/*
+1
View File
@@ -322,6 +322,7 @@ extern int ScenarioInit;
extern HouseClass * PlayerPtr;
extern PaletteClass CCPalette;
extern void* CCGlobalOveridePalette;
extern bool CCGlobalShadowRender;
extern int CCPaletteHouseColor;
extern HSVClass HSVColors[8];
extern PaletteClass BlackPalette;
+1
View File
@@ -551,6 +551,7 @@ HouseClass * PlayerPtr;
*/
PaletteClass CCPalette;
void* CCGlobalOveridePalette = NULL;
bool CCGlobalShadowRender = false;
int CCPaletteHouseColor = 0;
PaletteClass GamePalette;
//PaletteClass InGamePalette;
+2 -2
View File
@@ -36,8 +36,8 @@ static void GL_EnableBlendCallback(const ImDrawList* parent_list, const ImDrawCm
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
}
else {
glBlendEquation(GL_MULT);
glBlendFunc(GL_DST_COLOR, GL_ZERO);
//glBlendEquation(GL_MULT);
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
}
}
+9
View File
@@ -427,6 +427,11 @@ long Buffer_Frame_To_Page(int shapeNum, int x, int y, int width, int height, str
//
// return 0;
//}
if(CCGlobalShadowRender) {
GL_EnableBlend(GL_BLEND_MULT);
}
xstart = xstart + WindowList[Window][WINDOWX];// + LogicPage->Get_XPos();
ystart = ystart + WindowList[Window][WINDOWY];// + LogicPage->Get_YPos();
//GL_SetClipRect(WindowList[Window][WINDOWX], WindowList[Window][WINDOWY], WindowList[Window][WINDOWWIDTH], WindowList[Window][WINDOWWIDTH]);
@@ -435,6 +440,10 @@ long Buffer_Frame_To_Page(int shapeNum, int x, int y, int width, int height, str
else
GL_RenderImage(shape_image, xstart, ystart, width, height, 0);
if (CCGlobalShadowRender) {
GL_EnableBlend(GL_BLEND_NONE);
}
// Here we just use the function that will blit the entire frame
// using the appropriate effects.
//if (blit_height > 0 && blit_width > 0) {
+1
View File
@@ -821,6 +821,7 @@ class BuildingTypeClass : public TechnoTypeClass {
const void* CustomTheatrePalette[3];
const void* IdleAnimShape;
const void* ActiveAnimAnimShape;
int IdleHasShadowFrames;
int IdleAnimNonDamagedStart;
int IdleAnimNonDamagedFrames;
int IdleAnimDamagedStart;
+7 -1
View File
@@ -510,7 +510,13 @@ Image_t* Image_CreateImageFrom8Bit(const char* name, int Width, int Height, unsi
unsigned char b = 0;
unsigned char a = 0;
if (CCGlobalOveridePalette && remap) {
if (CCGlobalShadowRender && c != 0) {
r = 120;
g = 120;
b = 120;
a = 120;
}
else if (CCGlobalOveridePalette && remap) {
r = ccpalete[(c * 3) + 0] << 2;
g = ccpalete[(c * 3) + 1] << 2;
b = ccpalete[(c * 3) + 2] << 2;