diff --git a/POWERHD.SHP b/POWERHD.SHP deleted file mode 100644 index 83427e5..0000000 Binary files a/POWERHD.SHP and /dev/null differ diff --git a/SIDEFILLER.SHP b/SIDEFILLER.SHP deleted file mode 100644 index c1f1b90..0000000 Binary files a/SIDEFILLER.SHP and /dev/null differ diff --git a/SIDEHD.SHP b/SIDEHD.SHP deleted file mode 100644 index 00e628d..0000000 Binary files a/SIDEHD.SHP and /dev/null differ diff --git a/code/redalert/conquer.cpp b/code/redalert/conquer.cpp index 10a55c5..f14908c 100644 --- a/code/redalert/conquer.cpp +++ b/code/redalert/conquer.cpp @@ -3493,7 +3493,7 @@ void CC_Draw_Pip(const ObjectClass *object, void const * shapefile, int shapenum } // jmarshall - this is for hd textures -void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const* fadingdata, void const* ghostdata, DirType rotation) { +void CC_DrawHD_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const* fadingdata, void const* ghostdata, DirType rotation) { int predoffset; /* @@ -3537,7 +3537,7 @@ void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType #endif - + { //GraphicViewPortClass draw_window(LogicPage->Get_Graphic_Buffer(), // WindowList[window][WINDOWX] + LogicPage->Get_XPos(), @@ -3549,42 +3549,42 @@ void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType /* ** Rotation handler. */ -// jmarshall: todo HD rotation code! -// if (rotation != DIR_N) { -// -// /* -// ** Get the raw shape data without the new header and flag to use the old shape drawing -// */ -// UseOldShapeDraw = true; -// -// if (Debug_Rotate) { -//#if (0)//PG -// GraphicBufferClass src(width, height, buffer); -// width *= 2; -// height *= 2; -// memset(_xbuffer, '\0', SHAPE_BUFFER_SIZE); -// GraphicBufferClass dst(width, height, _xbuffer); -// Rotate_Bitmap(&src, &dst, rotation); -// buffer = _xbuffer; -//#endif -// } -// else { -// -// BitmapClass bm(width, height, buffer); -// width *= 2; -// height *= 2; -// memset(_xbuffer, '\0', SHAPE_BUFFER_SIZE); -// GraphicBufferClass gb(width, height, _xbuffer); -// TPoint2D pt(width / 2, height / 2); -// -// gb.Scale_Rotate(bm, pt, 0x0100, (256 - (rotation - 64))); -// buffer = _xbuffer; -// } -// } -// jmarshall end - /* - ** Special shadow drawing code (used for aircraft and bullets). - */ + // jmarshall: todo HD rotation code! + // if (rotation != DIR_N) { + // + // /* + // ** Get the raw shape data without the new header and flag to use the old shape drawing + // */ + // UseOldShapeDraw = true; + // + // if (Debug_Rotate) { + //#if (0)//PG + // GraphicBufferClass src(width, height, buffer); + // width *= 2; + // height *= 2; + // memset(_xbuffer, '\0', SHAPE_BUFFER_SIZE); + // GraphicBufferClass dst(width, height, _xbuffer); + // Rotate_Bitmap(&src, &dst, rotation); + // buffer = _xbuffer; + //#endif + // } + // else { + // + // BitmapClass bm(width, height, buffer); + // width *= 2; + // height *= 2; + // memset(_xbuffer, '\0', SHAPE_BUFFER_SIZE); + // GraphicBufferClass gb(width, height, _xbuffer); + // TPoint2D pt(width / 2, height / 2); + // + // gb.Scale_Rotate(bm, pt, 0x0100, (256 - (rotation - 64))); + // buffer = _xbuffer; + // } + // } + // jmarshall end + /* + ** Special shadow drawing code (used for aircraft and bullets). + */ if ((flags & (SHAPE_FADING | SHAPE_PREDATOR)) == (SHAPE_FADING | SHAPE_PREDATOR)) { flags = flags & ~(SHAPE_FADING | SHAPE_PREDATOR); flags = flags | SHAPE_GHOST; @@ -3599,28 +3599,32 @@ void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType Buffer_Enable_HD_Texture(true); //if (draw_window.Lock()) { - if ((flags & (SHAPE_GHOST | SHAPE_FADING)) == (SHAPE_GHOST | SHAPE_FADING)) { - Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); + if ((flags & (SHAPE_GHOST | SHAPE_FADING)) == (SHAPE_GHOST | SHAPE_FADING)) { + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, fadingdata, 1, predoffset); + } + else { + if (flags & SHAPE_FADING) { + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); } else { - if (flags & SHAPE_FADING) { - Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, fadingdata, 1, predoffset); + if (flags & SHAPE_PREDATOR) { + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, predoffset); } else { - if (flags & SHAPE_PREDATOR) { - Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, predoffset); - } - else { - Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, predoffset); - } + Buffer_Frame_To_Page(shapenum, x, y, width, height, image, window, flags | SHAPE_TRANS, ghostdata, predoffset); } } + } // draw_window.Unlock(); //} Buffer_Enable_HD_Texture(false); } } } + +void CC_Draw_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const* fadingdata, void const* ghostdata, DirType rotation) { + CC_DrawHD_Shape(image, shapenum, x, y, window, flags, fadingdata, ghostdata, rotation); +} // jmarshall end diff --git a/code/redalert/function.h b/code/redalert/function.h index dc10fba..404ec78 100644 --- a/code/redalert/function.h +++ b/code/redalert/function.h @@ -545,6 +545,7 @@ FacingType KN_To_Facing(int input); void const *Get_Radar_Icon(void const * shapefile, int shapenum, int frames, int zoomfactor); //void CC_Draw_Shape(ObjectClass *object, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata=0, void const * ghostdata=0, DirType rotation=DIR_N, long scale=0x0100); void CC_Draw_Shape(void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N); +void CC_DrawHD_Shape(Image_t* image, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const* fadingdata = 0, void const* ghostdata = 0, DirType rotation = DIR_N); // Added for draw intercept. ST - 1/17/2019 12:31PM void CC_Draw_Shape(const ObjectClass *object, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N, long virtualscale = 0x0100); diff --git a/code/redalert/newblit.cpp b/code/redalert/newblit.cpp index 0bd4f78..6d3b5b6 100644 --- a/code/redalert/newblit.cpp +++ b/code/redalert/newblit.cpp @@ -67,7 +67,12 @@ void GL_FillRect(int color, int x, int y, int width, int height) { float r = backbuffer_palette[(color * 3) + 0] / 255.0f; float g = backbuffer_palette[(color * 3) + 1] / 255.0f; float b = backbuffer_palette[(color * 3) + 2] / 255.0f; - ImGui::GetBackgroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1))); + if (forceForgegroundRender) { + ImGui::GetForegroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1))); + } + else { + ImGui::GetBackgroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1))); + } } void GL_DrawText(int color, int x, int y, char* text) { diff --git a/code/redalert/power.cpp b/code/redalert/power.cpp index c9b6a67..a7c0245 100644 --- a/code/redalert/power.cpp +++ b/code/redalert/power.cpp @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "function.h" +#include "image.h" /* @@ -50,7 +51,7 @@ void const* PowerClass::PowerShape; void const* PowerClass::PowerBarShape; -void const* PowerClass::PowerBarShapeHD; +Image_t *PowerClass::PowerBarShapeHD[SIDEBAR_POWERHD_FRAMES]; PowerClass::PowerButtonClass PowerClass::PowerButton; @@ -145,8 +146,14 @@ void PowerClass::One_Time(void) PowerShape = MFCD::Retrieve("POWER.SHP"); PowerBarShape = MFCD::Retrieve("POWERBAR.SHP"); - RawFileClass powerShapeFile("POWERHD.SHP"); - if (powerShapeFile.Is_Available()) PowerBarShapeHD = Load_Alloc_Data(powerShapeFile); + //RawFileClass powerShapeFile("POWERHD.SHP"); + //if (powerShapeFile.Is_Available()) PowerBarShapeHD = Load_Alloc_Data(powerShapeFile); + + for(int i = 0; i < SIDEBAR_POWERHD_FRAMES; i++) { + char tmp[512]; + sprintf(tmp, "ui/sidebar/POWERHD_000%d.tga", i); + PowerBarShapeHD[i] = Image_LoadImage(tmp); + } } @@ -176,6 +183,8 @@ void PowerClass::Draw_It(bool complete) RadarClass::Draw_It(complete); // jmarshall end + GL_ForceForegroundRender(true); + { BStart(BENCH_POWER); @@ -193,19 +202,19 @@ void PowerClass::Draw_It(bool complete) /* ** Hires power strip is too big to fit into a shape so it is in two parts */ - CC_Draw_Shape(PowerBarShapeHD, 0, ScreenWidth - (640 - (240 * RESFACTOR)), (88 * RESFACTOR), WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); + CC_DrawHD_Shape(PowerBarShapeHD[0], 0, ScreenWidth - (640 - (240 * RESFACTOR)), (88 * RESFACTOR), WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); int bottomOfBar = (88 + 56) * RESFACTOR; while ( bottomOfBar < ( PowerButton.Height - 56 ) ) { - CC_Draw_Shape(PowerBarShapeHD, 1, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); + CC_DrawHD_Shape(PowerBarShapeHD[1], 0, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); bottomOfBar += 56 * RESFACTOR; } // bottom - CC_Draw_Shape(PowerBarShapeHD, 2, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); + CC_DrawHD_Shape(PowerBarShapeHD[2], 0, ScreenWidth - (640 - (240 * RESFACTOR)), bottomOfBar, WINDOW_MAIN, flags | SHAPE_NORMAL | SHAPE_WIN_REL, remap); int bottom = bottomOfBar + (36 * RESFACTOR); @@ -262,6 +271,8 @@ void PowerClass::Draw_It(bool complete) } BEnd(BENCH_POWER); } + + GL_ForceForegroundRender(false); } diff --git a/code/redalert/power.h b/code/redalert/power.h index 1ec9aaa..f9fe7a3 100644 --- a/code/redalert/power.h +++ b/code/redalert/power.h @@ -37,6 +37,10 @@ #include "radar.h" +struct Image_t; + +#define SIDEBAR_POWERHD_FRAMES 3 + class PowerClass : public RadarClass { public: @@ -113,7 +117,7 @@ class PowerClass : public RadarClass */ static void const * PowerShape; static void const * PowerBarShape; - static void const * PowerBarShapeHD; + static Image_t *PowerBarShapeHD[SIDEBAR_POWERHD_FRAMES]; }; #endif diff --git a/code/redalert/sidebar.cpp b/code/redalert/sidebar.cpp index e32f644..245c113 100644 --- a/code/redalert/sidebar.cpp +++ b/code/redalert/sidebar.cpp @@ -75,6 +75,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "function.h" +#include "image.h" //#undef RESFACTOR //#define RESFACTOR 1 @@ -83,8 +84,8 @@ void* SidebarClass::SidebarShape = NULL; void* SidebarClass::SidebarMiddleShape = NULL; void* SidebarClass::SidebarBottomShape = NULL; -void* SidebarClass::SidebarShapeHD = NULL; -void* SidebarClass::SidebarFillerHD = NULL; +Image_t* SidebarClass::SidebarShapeHD[SIDEBAR_NUMSIDEHDFRAMES] = { 0 }; +Image_t* SidebarClass::SidebarFillerHD = NULL; /*************************************************************************** @@ -258,14 +259,20 @@ void SidebarClass::One_Time(void) SidebarShape = (void*)MFCD::Retrieve("SIDEBAR.SHP"); } - if (SidebarShapeHD == NULL) { - RawFileClass sideBarFile("SIDEHD.SHP"); - if (sideBarFile.Is_Available() ) SidebarShapeHD = Load_Alloc_Data(sideBarFile); + if (SidebarShapeHD[0] == NULL) { + for (int i = 0; i < SIDEBAR_NUMSIDEHDFRAMES; i++) { + char tmp[512]; + sprintf(tmp, "ui/sidebar/SIDEHD_000%d.png", i); + SidebarShapeHD[i] = Image_LoadImage(tmp); + } + //RawFileClass sideBarFile("SIDEHD.SHP"); + //if (sideBarFile.Is_Available() ) SidebarShapeHD = Load_Alloc_Data(sideBarFile); } if (SidebarFillerHD == NULL) { - RawFileClass sideBarFillerFile("SIDEFILLER.SHP"); - if (sideBarFillerFile.Is_Available()) SidebarFillerHD = Load_Alloc_Data(sideBarFillerFile); + //RawFileClass sideBarFillerFile("SIDEFILLER.SHP"); + //if (sideBarFillerFile.Is_Available()) SidebarFillerHD = Load_Alloc_Data(sideBarFillerFile); + SidebarFillerHD = Image_LoadImage("ui/sidebar/SIDEFILLER_0000.png"); } } @@ -797,7 +804,7 @@ void SidebarClass::Draw_It(bool complete) for (int i = 0; i < Column[0].MaxButtonsVisible; i++) { - CC_Draw_Shape(SidebarShapeHD, frameNr, SIDE_X * RESFACTOR, topY, WINDOW_MAIN, SHAPE_WIN_REL, 0); + CC_DrawHD_Shape(SidebarShapeHD[frameNr], 0, SIDE_X * RESFACTOR, topY, WINDOW_MAIN, SHAPE_WIN_REL, 0); topY += 24 * RESFACTOR; if (topY > ScreenHeight) break; @@ -805,7 +812,7 @@ void SidebarClass::Draw_It(bool complete) } topY += 11 * RESFACTOR; - CC_Draw_Shape(SidebarFillerHD, 0, SIDE_X * RESFACTOR, topY, WINDOW_MAIN, SHAPE_WIN_REL, 0); + CC_DrawHD_Shape(SidebarFillerHD, 0, SIDE_X * RESFACTOR, topY, WINDOW_MAIN, SHAPE_WIN_REL, 0); Repair.Draw_Me(true); Upgrade.Draw_Me(true); diff --git a/code/redalert/sidebar.h b/code/redalert/sidebar.h index 3993e67..7bf1a7b 100644 --- a/code/redalert/sidebar.h +++ b/code/redalert/sidebar.h @@ -63,6 +63,10 @@ extern int ScreenWidth; #define BUTTON_THREE_X (int)(SIDE_X + 58) // Right button X coordinate. #define BUTTON_THREE_Y (int)(SIDE_Y + 2) // Right button Y coordinate. +struct Image_t; + +#define SIDEBAR_NUMSIDEHDFRAMES 7 + class SidebarClass: public PowerClass { public: @@ -108,8 +112,8 @@ class SidebarClass: public PowerClass }; static void * SidebarShape; - static void * SidebarShapeHD; - static void * SidebarFillerHD; + static Image_t* SidebarShapeHD[SIDEBAR_NUMSIDEHDFRAMES]; + static Image_t* SidebarFillerHD; static void * SidebarMiddleShape; //Only used in Win95 version static void * SidebarBottomShape; //Only used in Win95 version diff --git a/code/redalert/winstub.cpp b/code/redalert/winstub.cpp index 35cb38e..1b3d79b 100644 --- a/code/redalert/winstub.cpp +++ b/code/redalert/winstub.cpp @@ -227,7 +227,7 @@ static bool Image_loadHDImage(Image_t *image, const char* name, int houseid, int glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, Data); } else if (Bpp == 3) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data); } else if (Bpp == 1) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_R, GL_UNSIGNED_BYTE, Data); diff --git a/ui/sidebar/POWERHD_0000.tga b/ui/sidebar/POWERHD_0000.tga new file mode 100644 index 0000000..e661f3c Binary files /dev/null and b/ui/sidebar/POWERHD_0000.tga differ diff --git a/ui/sidebar/POWERHD_0001.tga b/ui/sidebar/POWERHD_0001.tga new file mode 100644 index 0000000..f7695a2 Binary files /dev/null and b/ui/sidebar/POWERHD_0001.tga differ diff --git a/ui/sidebar/POWERHD_0002.tga b/ui/sidebar/POWERHD_0002.tga new file mode 100644 index 0000000..7490f89 Binary files /dev/null and b/ui/sidebar/POWERHD_0002.tga differ diff --git a/ui/sidebar/SIDEFILLER_0000.png b/ui/sidebar/SIDEFILLER_0000.png new file mode 100644 index 0000000..0ed6f76 Binary files /dev/null and b/ui/sidebar/SIDEFILLER_0000.png differ diff --git a/ui/sidebar/SIDEHD_0000.png b/ui/sidebar/SIDEHD_0000.png new file mode 100644 index 0000000..f1d767d Binary files /dev/null and b/ui/sidebar/SIDEHD_0000.png differ diff --git a/ui/sidebar/SIDEHD_0001.png b/ui/sidebar/SIDEHD_0001.png new file mode 100644 index 0000000..a6a64a2 Binary files /dev/null and b/ui/sidebar/SIDEHD_0001.png differ diff --git a/ui/sidebar/SIDEHD_0002.png b/ui/sidebar/SIDEHD_0002.png new file mode 100644 index 0000000..0d6a80c Binary files /dev/null and b/ui/sidebar/SIDEHD_0002.png differ diff --git a/ui/sidebar/SIDEHD_0003.png b/ui/sidebar/SIDEHD_0003.png new file mode 100644 index 0000000..3b2b16d Binary files /dev/null and b/ui/sidebar/SIDEHD_0003.png differ diff --git a/ui/sidebar/SIDEHD_0004.png b/ui/sidebar/SIDEHD_0004.png new file mode 100644 index 0000000..66284ec Binary files /dev/null and b/ui/sidebar/SIDEHD_0004.png differ diff --git a/ui/sidebar/SIDEHD_0005.png b/ui/sidebar/SIDEHD_0005.png new file mode 100644 index 0000000..88ce526 Binary files /dev/null and b/ui/sidebar/SIDEHD_0005.png differ diff --git a/ui/sidebar/SIDEHD_0006.png b/ui/sidebar/SIDEHD_0006.png new file mode 100644 index 0000000..d98d626 Binary files /dev/null and b/ui/sidebar/SIDEHD_0006.png differ