diff --git a/code/REDALERT/SCORE.CPP b/code/REDALERT/SCORE.CPP index 3d212bb..fae61e3 100644 --- a/code/REDALERT/SCORE.CPP +++ b/code/REDALERT/SCORE.CPP @@ -413,6 +413,7 @@ void ScoreClass::Presentation(void) #endif BlackPalette.Set(); + Show_OldFrameBuffer(false); void const * country4 = MFCD::Retrieve("COUNTRY4.AUD"); void const * sfx4 = MFCD::Retrieve("SFX4.AUD"); @@ -866,6 +867,8 @@ Keyboard->Clear(); #endif //FIXIT #endif + + Show_OldFrameBuffer(true); } diff --git a/code/REDALERT/WIN32LIB/GBUFFER.H b/code/REDALERT/WIN32LIB/GBUFFER.H index a95db68..3f8b3c1 100644 --- a/code/REDALERT/WIN32LIB/GBUFFER.H +++ b/code/REDALERT/WIN32LIB/GBUFFER.H @@ -1294,5 +1294,6 @@ inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClas return ( return_code ); } +void Show_OldFrameBuffer(bool show); #endif diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index 8e1192f..70b71be 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -80,6 +80,14 @@ void (*Misc_Focus_Restore_Function)(void) = nullptr; void (*Imgui_Dialog_Function)(void) = nullptr; +bool show_oldframebuffer = true; +void Show_OldFrameBuffer(bool show) { + show_oldframebuffer = show; + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + memset(backbuffer_data, 0, ScreenWidth * ScreenHeight * 4); +} + std::vector loaded_images; Image_t* Image_LoadImage(const char* name) { @@ -166,8 +174,8 @@ void Set_DD_Palette(void* palette, bool raShift) void ImGui_NewFrame(void) { ImGuiIO& io = ImGui::GetIO(); - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); + //glClearColor(0, 0, 0, 1); + //glClear(GL_COLOR_BUFFER_BIT); io.DisplaySize = ImVec2(ScreenWidth, ScreenHeight); ImGui_ImplOpenGL3_NewFrame(); @@ -176,27 +184,26 @@ void ImGui_NewFrame(void) { ImGui_ImplSDL2_NewFrame(game_window); } -void Device_Present(void) { - - - // Rasterize the palette. - for (int i = 0; i < ScreenWidth * ScreenHeight; i++) { - backbuffer_data[(i * 4) + 0] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 0]; - backbuffer_data[(i * 4) + 1] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 1]; - backbuffer_data[(i * 4) + 2] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 2]; - backbuffer_data[(i * 4) + 3] = 255; - } - glBindTexture(GL_TEXTURE_2D, backbuffer_texture); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ScreenWidth, ScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, backbuffer_data); - +void Device_Present(void) { // Use imgui to render the screenbuffer. - { + if(show_oldframebuffer) + { + // Rasterize the palette. + for (int i = 0; i < ScreenWidth * ScreenHeight; i++) { + backbuffer_data[(i * 4) + 0] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 0]; + backbuffer_data[(i * 4) + 1] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 1]; + backbuffer_data[(i * 4) + 2] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 2]; + backbuffer_data[(i * 4) + 3] = 255; + } + glBindTexture(GL_TEXTURE_2D, backbuffer_texture); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ScreenWidth, ScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, backbuffer_data); + bool ScreenActive; ImGuiStyle& style = ImGui::GetStyle(); style.FramePadding = ImVec2(0, 0); ImGui::SetNextWindowSize(ImVec2(ScreenWidth, ScreenHeight)); ImGui::SetNextWindowPos(ImVec2(0, 0)); - ImGui::Begin("RenderWindow", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar); + ImGui::Begin("RenderWindow", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMouseInputs); ImVec2 desktopSize(ScreenWidth, ScreenHeight); ImGui::Image((ImTextureID)backbuffer_texture, desktopSize); ImGui::End(); diff --git a/ui/alibackh.png b/ui/alibackh.png new file mode 100644 index 0000000..d3eae40 Binary files /dev/null and b/ui/alibackh.png differ diff --git a/ui/sovbackh.png b/ui/sovbackh.png new file mode 100644 index 0000000..f81263b Binary files /dev/null and b/ui/sovbackh.png differ