mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-11 23:50:51 +02:00
TS/RA2 SHP shadow support.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -551,6 +551,7 @@ HouseClass * PlayerPtr;
|
||||
*/
|
||||
PaletteClass CCPalette;
|
||||
void* CCGlobalOveridePalette = NULL;
|
||||
bool CCGlobalShadowRender = false;
|
||||
int CCPaletteHouseColor = 0;
|
||||
PaletteClass GamePalette;
|
||||
//PaletteClass InGamePalette;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1431,7 +1431,7 @@ ActiveAnimNonDamagedFrames=41
|
||||
ActiveAnimDamagedStart=0
|
||||
ActiveAnimDamagedFrames=41
|
||||
|
||||
; Tesla coil
|
||||
; Pirsm Tower
|
||||
[GGPRIS]
|
||||
Primary=TeslaZap
|
||||
Strength=400
|
||||
@@ -1454,6 +1454,7 @@ IdleAnimNonDamagedStart=0
|
||||
IdleAnimNonDamagedFrames=8
|
||||
IdleAnimDamagedStart=9
|
||||
IdleAnimDamagedFrames=8
|
||||
IdleHasShadowFrames=1
|
||||
ActiveAnimNonDamagedStart=0
|
||||
ActiveAnimNonDamagedFrames=9
|
||||
ActiveAnimDamagedStart=10
|
||||
|
||||
Reference in New Issue
Block a user