Merge pull request #23 from jmarshall23/master

Switched new sidebar graphics to HD graphics pipeline.
This commit is contained in:
jmarshall23
2020-07-04 09:49:45 -07:00
committed by GitHub
22 changed files with 104 additions and 68 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+52 -48
View File
@@ -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
+1
View File
@@ -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);
+6 -1
View File
@@ -80,7 +80,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) {
+17 -6
View File
@@ -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);
}
+5 -1
View File
@@ -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
+16 -9
View File
@@ -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);
+6 -2
View File
@@ -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
+1 -1
View File
@@ -233,7 +233,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);
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB