Removed blit code from gbuffer class. Fixed cmakelists for linux.

This commit is contained in:
Justin Marshall
2020-06-25 14:35:47 -07:00
parent 6bfdd6e0ce
commit c7e4870048
13 changed files with 125 additions and 214 deletions
+15 -2
View File
@@ -720,11 +720,24 @@ set(src_external
)
if (MSVC)
add_definitions(-D RA_AF -DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DWINDOWS_IGNORE_PACKING_MISMATCH -DTRUE_FALSE_DEFINED -DWIN32 -DWINDOWS -DENGLISH -D_USRDLL -DREDALERT_EXPORTS)
add_compile_options(/permissive+ /Zc:forScope- /Zp1)
endif(MSVC)
if (UNIX)
add_definitions(-D RA_AF -DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DTRUE_FALSE_DEFINED -DENGLISH -D_USRDLL -DREDALERT_EXPORTS)
endif(UNIX)
add_executable(RedAlert ${src_io} ${src_win32lib} ${src_redalert} ${src_external})
if (MSVC)
set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" LINK_FLAGS "/PDB:\"RedAlert.pdb\" /SUBSYSTEM:WINDOWS" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/../" )
target_include_directories(RedAlert PRIVATE ./external/xml/;./external/devil/;./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include)
target_link_libraries(RedAlert "opengl32.lib" "winmm.lib" "Ws2_32.lib" "${CMAKE_SOURCE_DIR}/external/devil/ilu.lib" "${CMAKE_SOURCE_DIR}/external/devil/DevIL.lib" "${CMAKE_SOURCE_DIR}/external/sdl2/lib/x64/SDL2.lib" "${CMAKE_SOURCE_DIR}/external/openal/out/build/x64-Release/OpenAL32.lib")
endif(MSVC)
if (UNIX)
set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/.." )
endif(UNIX)
target_include_directories(RedAlert PRIVATE ./external/xml/;./external/devil/;./external/;./redalert/win32lib;./external/lua/;./external/imgui;./external/dxsdk/Include;./external/ffmpeg-win32/include;./external/sdl2/include;./win32lib;./external/openal/include)
+21 -20
View File
@@ -1968,26 +1968,27 @@ ObjectClass * DisplayClass::Cell_Object(CELL cell, int x, int y) const
** If hid page is in video memory then blit from the seen page to avoid blitting
** an overlapped region.
*/
if (HidPage.Get_IsDirectDraw()) {
Hide_Mouse();
SeenBuff.Blit(HidPage,
((oldx < 0) ? -oldx : 0) +TacPixelX,
((oldy < 0) ? -oldy : 0) +TacPixelY,
((oldx < 0) ? 0 : oldx) +TacPixelX,
((oldy < 0) ? 0 : oldy) +TacPixelY,
oldw,
oldh);
Show_Mouse();
} else {
HidPage.Blit(HidPage,
((oldx < 0) ? -oldx : 0) +TacPixelX,
((oldy < 0) ? -oldy : 0) +TacPixelY,
((oldx < 0) ? 0 : oldx) +TacPixelX,
((oldy < 0) ? 0 : oldy) +TacPixelY,
oldw,
oldh);
}
// jmarshall - removed
// if (HidPage.Get_IsDirectDraw()) {
// Hide_Mouse();
// SeenBuff.Blit(HidPage,
// ((oldx < 0) ? -oldx : 0) +TacPixelX,
// ((oldy < 0) ? -oldy : 0) +TacPixelY,
// ((oldx < 0) ? 0 : oldx) +TacPixelX,
// ((oldy < 0) ? 0 : oldy) +TacPixelY,
// oldw,
// oldh);
// Show_Mouse();
// } else {
// HidPage.Blit(HidPage,
// ((oldx < 0) ? -oldx : 0) +TacPixelX,
// ((oldy < 0) ? -oldy : 0) +TacPixelY,
// ((oldx < 0) ? 0 : oldx) +TacPixelX,
// ((oldy < 0) ? 0 : oldy) +TacPixelY,
// oldw,
// oldh);
// }
// jmarshall - removed
} else {
forced = true;
}
+14 -9
View File
@@ -343,9 +343,11 @@ void Slide_Show(int slide, int frame)
/*
** Blit in a quarter of the new frame to the background page.
*/
SlideBuffers[slide]->Blit (*BackgroundPage, 0, (frame-1) * CHUNK_HEIGHT,
0, (frame-1) * CHUNK_HEIGHT,
SeenBuff.Get_Width(), CHUNK_HEIGHT, false);
// jmarshall - removed
// SlideBuffers[slide]->Blit (*BackgroundPage, 0, (frame-1) * CHUNK_HEIGHT,
// 0, (frame-1) * CHUNK_HEIGHT,
// SeenBuff.Get_Width(), CHUNK_HEIGHT, false);
// jmarshall - removed
return;
}
@@ -353,9 +355,11 @@ void Slide_Show(int slide, int frame)
/*
** Blit in a quarter of the new frame to the hid page.
*/
BackgroundPage->Blit (HidPage, 0, (frame-5) * CHUNK_HEIGHT,
0, (frame-5) * CHUNK_HEIGHT,
SeenBuff.Get_Width(), CHUNK_HEIGHT, false);
// jmarshall - removed
//BackgroundPage->Blit (HidPage, 0, (frame-5) * CHUNK_HEIGHT,
// 0, (frame-5) * CHUNK_HEIGHT,
// SeenBuff.Get_Width(), CHUNK_HEIGHT, false);
// jmarshall - removed
return;
}
@@ -734,7 +738,7 @@ void Show_Who_Was_Responsible (void)
BackgroundPage = new GraphicBufferClass;
BackgroundPage->Init (SeenBuff.Get_Width(), SeenBuff.Get_Height(), NULL , 0 , (GBC_Enum)0);
SeenBuff.Blit(*BackgroundPage);
//SeenBuff.Blit(*BackgroundPage);
/*
** Go away nasty keyboard.
@@ -831,8 +835,9 @@ void Show_Who_Was_Responsible (void)
** Blit all but the top and bottom of the hid page. This is beacuse the text print doesn't
** clip vertically and looks ugly when it suddenly appears and disappears.
*/
HidPage.Blit(SeenBuff, 0, 8 * RESFACTOR, 0, 8*RESFACTOR, SeenBuff.Get_Width(), SeenBuff.Get_Height() - 16* RESFACTOR, false);
// jmarshall - removed
//HidPage.Blit(SeenBuff, 0, 8 * RESFACTOR, 0, 8*RESFACTOR, SeenBuff.Get_Width(), SeenBuff.Get_Height() - 16* RESFACTOR, false);
// jmarshall - removed
/*
** If user hits escape then break.
+11 -17
View File
@@ -164,13 +164,10 @@ extern bool Is_Mission_Counterstrike (char *file_name);
static void Load_Prolog_Page(void)
{
Hide_Mouse();
#ifdef WIN32
Load_Title_Screen("PROLOG.PCX", &HidPage, (unsigned char*)CCPalette.Get_Data());
HidPage.Blit(SeenPage);
#else
Load_Picture("PROLOG.CPS", HidPage, HidPage, CCPalette, BM_DEFAULT);
HidPage.Blit(SeenPage);
#endif
// jmarshall - removed
// HidPage.Blit(SeenPage);
// jmarshall - removed
CCPalette.Set();
Show_Mouse();
}
@@ -669,8 +666,10 @@ bool Select_Game(bool fade)
*/
Load_Title_Page();
GamePalette = CCPalette;
// jmarshall - removed
// HidPage.Blit(SeenPage);
// jmarshall - removed
HidPage.Blit(SeenPage);
// if (fade) {
// WhitePalette.Set();
// CCPalette.Set(FADE_PALETTE_SLOW, Call_Back);
@@ -2516,17 +2515,12 @@ void Init_Random(void)
*=============================================================================================*/
void Load_Title_Page(bool visible)
{
#ifdef WIN32
Load_Title_Screen("TITLE.PCX", &HidPage, (unsigned char*)CCPalette.Get_Data());
if (visible) {
HidPage.Blit(SeenPage);
}
#else
Load_Picture("TITLE.CPS", HidPage, HidPage, CCPalette, BM_DEFAULT);
if (visible) {
HidPage.Blit(SeenPage);
}
#endif
// jmarshall - removed
//if (visible) {
// HidPage.Blit(SeenPage);
//}
// jmarshall - removed
}
+2 -2
View File
@@ -457,7 +457,7 @@ int Do_Menu(char const ** strings, bool )
Keyboard->Clear();
Hide_Mouse();
HidPage.Blit(SeenPage);
// HidPage.Blit(SeenPage);
//WindowList[WINDOW_MAIN][2] = SeenBuff.Get_Width();//BG
Change_Window((int)WINDOW_MAIN);
Map.Flag_To_Redraw(true);
@@ -658,7 +658,7 @@ int Main_Menu(unsigned long )
** Copy the menu to the visible page.
*/
Hide_Mouse();
HidPage.Blit(SeenPage);
// HidPage.Blit(SeenPage);
Show_Mouse();
Set_Logic_Page(SeenBuff);
+1 -1
View File
@@ -197,7 +197,7 @@ GameType Select_MPlayer_Game (void)
*/
if (AllSurfaces.SurfacesRestored) {
AllSurfaces.SurfacesRestored=FALSE;
seen_buff_save.Blit(VisiblePage);
// seen_buff_save.Blit(VisiblePage);
display = REDRAW_ALL;
}
#endif
+1 -1
View File
@@ -274,7 +274,7 @@ int WWMessageBox::Process(const char * msg, const char * b1txt, const char * b2t
*/
if (AllSurfaces.SurfacesRestored) {
AllSurfaces.SurfacesRestored = false;
seen_buff_save.Blit(VisiblePage);
// seen_buff_save.Blit(VisiblePage);
display = true;
}
#endif
+27 -23
View File
@@ -576,7 +576,7 @@ void RadarClass::Draw_It(bool forced)
if (oldpage == &SeenBuff) {
Hide_Mouse();
LogicPage->Blit(SeenBuff, RadX, RadY, RadX, RadY, RadWidth, RadHeight);
// LogicPage->Blit(SeenBuff, RadX, RadY, RadX, RadY, RadWidth, RadHeight); // jmarshall - removed
Show_Mouse();
}
@@ -2010,13 +2010,15 @@ void RadarClass::Set_Radar_Position(CELL cell)
** Overlapped blits are OK or we dont have a video memory hid page so blits are
** always done in software by the library anyway.
*/
HidPage.Blit(HidPage,
(((radx < 0) ? -radx : 0) * ZoomFactor) + RadX + RadOffX + BaseX,
(((rady < 0) ? -rady : 0) * ZoomFactor) + RadY + RadOffY + BaseY,
(((radx < 0) ? 0 : radx) * ZoomFactor) + RadX+ RadOffX + BaseX,
(((rady < 0) ? 0 : rady) * ZoomFactor) + RadY + RadOffY + BaseY,
radw * ZoomFactor,
radh * ZoomFactor);
// jmarshall - removed
// HidPage.Blit(HidPage,
// (((radx < 0) ? -radx : 0) * ZoomFactor) + RadX + RadOffX + BaseX,
// (((rady < 0) ? -rady : 0) * ZoomFactor) + RadY + RadOffY + BaseY,
// (((radx < 0) ? 0 : radx) * ZoomFactor) + RadX+ RadOffX + BaseX,
// (((rady < 0) ? 0 : rady) * ZoomFactor) + RadY + RadOffY + BaseY,
// radw * ZoomFactor,
// radh * ZoomFactor);
// jmarshall - removed
} else {
/*
@@ -2030,21 +2032,23 @@ void RadarClass::Set_Radar_Position(CELL cell)
/*
** Do the blit in 2 stages.
*/
HidPage.Blit(temp_surface,
(((radx < 0) ? -radx : 0) * ZoomFactor) + RadX + RadOffX + BaseX,
(((rady < 0) ? -rady : 0) * ZoomFactor) + RadY + RadOffY + BaseY,
0,
0,
RadarWidth,
RadarHeight);
temp_surface.Blit(HidPage,
0,
0,
(((radx < 0) ? 0 : radx) * ZoomFactor) + RadX+ RadOffX + BaseX,
(((rady < 0) ? 0 : rady) * ZoomFactor) + RadY + RadOffY + BaseY,
radw * ZoomFactor,
radh * ZoomFactor);
// jmarshall - removed
//HidPage.Blit(temp_surface,
// (((radx < 0) ? -radx : 0) * ZoomFactor) + RadX + RadOffX + BaseX,
// (((rady < 0) ? -rady : 0) * ZoomFactor) + RadY + RadOffY + BaseY,
// 0,
// 0,
// RadarWidth,
// RadarHeight);
//
//temp_surface.Blit(HidPage,
// 0,
// 0,
// (((radx < 0) ? 0 : radx) * ZoomFactor) + RadX+ RadOffX + BaseX,
// (((rady < 0) ? 0 : rady) * ZoomFactor) + RadY + RadOffY + BaseY,
// radw * ZoomFactor,
// radh * ZoomFactor);
// jmarshall - removed
}
/*
+3 -3
View File
@@ -1643,7 +1643,7 @@ int BGMessageBox(char const * msg, int btn1, int btn2)
}
Load_Uncompress(CCFileClass(filename), HidPage, HidPage, temp);
#endif
HidPage.Blit(SeenPage);
// HidPage.Blit(SeenPage);
#ifdef WIN32
//VisiblePage.Blit(seen_buff_save);
@@ -1673,7 +1673,7 @@ int BGMessageBox(char const * msg, int btn1, int btn2)
if (AllSurfaces.SurfacesRestored) {
AllSurfaces.SurfacesRestored = false;
Hide_Mouse();
seen_buff_save.Blit(VisiblePage);
// seen_buff_save.Blit(VisiblePage);
display = true;
Show_Mouse();
}
@@ -1723,7 +1723,7 @@ int BGMessageBox(char const * msg, int btn1, int btn2)
if (AllSurfaces.SurfacesRestored) {
AllSurfaces.SurfacesRestored = false;
Hide_Mouse();
seen_buff_save.Blit(VisiblePage);
// seen_buff_save.Blit(VisiblePage);
display = true;
Show_Mouse();
}
+1 -1
View File
@@ -1747,7 +1747,7 @@ void Animate_Score_Objs()
*/
if (AllSurfaces.SurfacesRestored) {
AllSurfaces.SurfacesRestored=FALSE;
PseudoSeenBuff->Blit(SeenPage);
//PseudoSeenBuff->Blit(SeenPage);
}
#endif
for (int i = 0; i < MAXSCOREOBJS; i++) {
+1 -1
View File
@@ -1065,7 +1065,7 @@ void ChronalVortexClass::Render (void)
** Blit our freshly draw cells and vortex into their correct position on the hidpage
*/
if (dest_width > 0 && dest_height > 0) {
RenderBuffer->Blit (target, source_x, source_y, dest_x, dest_y, dest_width, dest_height, false);
// RenderBuffer->Blit (target, source_x, source_y, dest_x, dest_y, dest_width, dest_height, false);
}
}
+3 -109
View File
@@ -288,15 +288,7 @@ class GraphicViewPortClass {
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
long To_Buffer(BufferClass *buff);
HRESULT Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
HRESULT Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
HRESULT Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
HRESULT BlitLegacy(GraphicViewPortClass& dest, BOOL trans = FALSE);
HRESULT Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
HRESULT Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
HRESULT Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
void BlitLegacy(GraphicViewPortClass& dest, BOOL trans = FALSE);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
@@ -760,66 +752,6 @@ inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
return ( return_code );
}
/***************************************************************************
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
{
HRESULT return_code=0;
if (Lock()) {
if (dest.Lock()) {
return_code = (Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel
, dx_pixel, dy_pixel
, pixel_width, pixel_height, trans));
}
dest.Unlock();
}
Unlock();
return ( return_code );
}
/***************************************************************************
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
{
HRESULT return_code=0;
if (Lock()) {
if (dest.Lock()) {
return_code = (Linear_Blit_To_Linear(this, &dest, 0, 0
, dx, dy
, Width, Height, trans));
}
dest.Unlock();
}
Unlock();
return (return_code);
}
/***************************************************************************
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
@@ -833,15 +765,12 @@ inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, i
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline HRESULT GraphicViewPortClass::BlitLegacy(GraphicViewPortClass& dest, BOOL trans)
inline void GraphicViewPortClass::BlitLegacy(GraphicViewPortClass& dest, BOOL trans)
{
HRESULT return_code = 0;
if (Lock()) {
if (dest.Lock()) {
return_code = (Linear_Blit_To_Linear_Pal(this, &dest, 0, 0
(Linear_Blit_To_Linear_Pal(this, &dest, 0, 0
, 0, 0
, Width, Height, trans));
@@ -849,41 +778,6 @@ inline HRESULT GraphicViewPortClass::BlitLegacy(GraphicViewPortClass& dest, BOOL
dest.Unlock();
}
Unlock();
return (return_code);
}
/***************************************************************************
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline HRESULT GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
{
HRESULT return_code = 0;
if (Lock()) {
if (dest.Lock()) {
return_code = (Linear_Blit_To_Linear(this, &dest, 0, 0
, 0, 0
, Width, Height, trans));
}
dest.Unlock();
}
Unlock();
return (return_code);
}
+25 -25
View File
@@ -702,31 +702,31 @@ void Window_Print(char const string[], ...)
*=========================================================================*/
PRIVATE void Scroll_Window(void)
{
int y; // Top pixel row of bottom line of window.
/*
** Possibly prompt for more text.
*/
if (ScrollCounter >= WindowLines-1 && MoreOn) {
ScrollCounter = 0;
if (Window_More_Ptr) {
//BG if (LogicPage == SEENPAGE) Window_Show_Mouse();
Window_More_Ptr(TXT_MoreText, MoreSpace, MoreFColor, MoreBColor);
//BG if (LogicPage == SEENPAGE) Window_Hide_Mouse(Window);
}
}
/*
** Scroll the window up one line.
*/
y = ((WinH / (FontHeight+FontYSpacing)) - 1) * (FontHeight+FontYSpacing);
LogicPage->Blit(*LogicPage,WinX<<3, WinY + (FontHeight+FontYSpacing), WinX<<3, WinY, WinW<<3, WinH - (FontHeight+FontYSpacing) );
LogicPage->Fill_Rect(WinX<<3,
WinY + y,
((WinX+WinW)<<3) - 1,
WinY + WinH - 1,
(unsigned char)WinB);
// int y; // Top pixel row of bottom line of window.
//
// /*
// ** Possibly prompt for more text.
// */
// if (ScrollCounter >= WindowLines-1 && MoreOn) {
// ScrollCounter = 0;
//
// if (Window_More_Ptr) {
////BG if (LogicPage == SEENPAGE) Window_Show_Mouse();
// Window_More_Ptr(TXT_MoreText, MoreSpace, MoreFColor, MoreBColor);
////BG if (LogicPage == SEENPAGE) Window_Hide_Mouse(Window);
// }
// }
//
// /*
// ** Scroll the window up one line.
// */
// y = ((WinH / (FontHeight+FontYSpacing)) - 1) * (FontHeight+FontYSpacing);
// LogicPage->Blit(*LogicPage,WinX<<3, WinY + (FontHeight+FontYSpacing), WinX<<3, WinY, WinW<<3, WinH - (FontHeight+FontYSpacing) );
// LogicPage->Fill_Rect(WinX<<3,
// WinY + y,
// ((WinX+WinW)<<3) - 1,
// WinY + WinH - 1,
// (unsigned char)WinB);
}