mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Initial checkin of the new UI blit code(there are issues and will be fixed one by one).
This commit is contained in:
@@ -505,6 +505,7 @@ set(src_redalert
|
||||
./RedAlert/SOUNDDLG.H
|
||||
./RedAlert/SPECIAL.CPP
|
||||
./RedAlert/SPECIAL.H
|
||||
./RedAlert/NewBlit.cpp
|
||||
./RedAlert/SPRITE.CPP
|
||||
./RedAlert/STAGE.H
|
||||
./RedAlert/STARTUP.CPP
|
||||
|
||||
@@ -207,7 +207,10 @@ void Draw_Box(int x, int y, int w, int h, BoxStyleEnum up, bool filled)
|
||||
BoxStyleType const &style = ButtonColors[up];
|
||||
|
||||
if (filled) {
|
||||
LogicPage->Fill_Rect( x, y, x+w, y+h, style.Filler);
|
||||
// jmarshall
|
||||
//LogicPage->Fill_Rect( x, y, x+w, y+h, style.Filler);
|
||||
GL_FillRect(style.Filler, x, y, w, h);
|
||||
// jmarshall end
|
||||
}
|
||||
|
||||
switch (up) {
|
||||
|
||||
@@ -497,7 +497,7 @@ bool Expansion_Dialog(void)
|
||||
|
||||
Call_Back();
|
||||
|
||||
if (display) {
|
||||
{
|
||||
display = false;
|
||||
|
||||
Hide_Mouse();
|
||||
|
||||
@@ -1074,7 +1074,7 @@ extern DynamicVectorClass<ActionChoiceClass *> xxx3;
|
||||
template <>class DynamicVectorClass<EgoClass *>;
|
||||
extern DynamicVectorClass<EgoClass *> whatever;
|
||||
|
||||
void WWSDL_ProcessEvents(KeyNumType& key, int& flags);
|
||||
void WWSDL_ProcessEvents(KeyNumType& key, int& flags, bool presentBuffer = true);
|
||||
void Device_Present(void);
|
||||
|
||||
/*
|
||||
@@ -1154,5 +1154,4 @@ extern const int NUM_EDIT_MISSIONS;
|
||||
|
||||
extern void (*Imgui_Dialog_Function)(void);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -260,7 +260,7 @@ void GameControlsClass::Process(void)
|
||||
/*
|
||||
** Refresh display if needed.
|
||||
*/
|
||||
if (display) {
|
||||
{
|
||||
Hide_Mouse();
|
||||
|
||||
Map.Flag_To_Redraw(true);
|
||||
@@ -273,7 +273,7 @@ void GameControlsClass::Process(void)
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
{
|
||||
Hide_Mouse();
|
||||
|
||||
/*
|
||||
|
||||
@@ -265,7 +265,7 @@ void GameOptionsClass::Process(void)
|
||||
bool process = true;
|
||||
pressed = false;
|
||||
while (process) {
|
||||
Device_Present();
|
||||
//Device_Present();
|
||||
|
||||
/*
|
||||
** Invoke game callback.
|
||||
@@ -292,7 +292,7 @@ void GameOptionsClass::Process(void)
|
||||
/*
|
||||
** Refresh display if needed.
|
||||
*/
|
||||
if (display || RedrawOptionsMenu) {
|
||||
{
|
||||
|
||||
/*
|
||||
** Redraw the map.
|
||||
|
||||
@@ -285,13 +285,13 @@ int LoadOptionsClass::Process(void)
|
||||
/*
|
||||
** Refresh display if needed.
|
||||
*/
|
||||
if (display) {
|
||||
{
|
||||
|
||||
/*
|
||||
** Display the dialog box.
|
||||
*/
|
||||
Hide_Mouse();
|
||||
if (display) {
|
||||
{
|
||||
Dialog_Box(d_dialog_x, d_dialog_y, d_dialog_w, d_dialog_h);
|
||||
Draw_Caption(caption, d_dialog_x, d_dialog_y, d_dialog_w);
|
||||
|
||||
@@ -304,7 +304,7 @@ int LoadOptionsClass::Process(void)
|
||||
/*
|
||||
** Redraw the buttons.
|
||||
*/
|
||||
if (display) {
|
||||
{
|
||||
commands->Flag_List_To_Redraw();
|
||||
}
|
||||
Show_Mouse();
|
||||
|
||||
@@ -1032,7 +1032,7 @@ int Main_Menu(unsigned long )
|
||||
break;
|
||||
}
|
||||
|
||||
Device_Present();
|
||||
//Device_Present();
|
||||
}
|
||||
|
||||
Options.Set_Score_Volume(oldvolume, false);
|
||||
|
||||
@@ -252,8 +252,6 @@ GameType Select_MPlayer_Game (void)
|
||||
process = true;
|
||||
pressed = false;
|
||||
while (process) {
|
||||
Device_Present();
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
** If we have just received input focus again after running in the background then
|
||||
@@ -274,9 +272,9 @@ GameType Select_MPlayer_Game (void)
|
||||
//.....................................................................
|
||||
// Refresh display if needed
|
||||
//.....................................................................
|
||||
if (display) {
|
||||
{
|
||||
Hide_Mouse();
|
||||
if (display >= REDRAW_BACKGROUND) {
|
||||
{
|
||||
|
||||
//...............................................................
|
||||
// Refresh the backdrop
|
||||
@@ -294,7 +292,7 @@ GameType Select_MPlayer_Game (void)
|
||||
//..................................................................
|
||||
// Redraw buttons
|
||||
//..................................................................
|
||||
if (display >= REDRAW_BUTTONS) {
|
||||
{
|
||||
commands->Flag_List_To_Redraw();
|
||||
}
|
||||
Show_Mouse();
|
||||
|
||||
@@ -258,9 +258,6 @@ int WWMessageBox::Process(const char * msg, const char * b1txt, const char * b2t
|
||||
process = true;
|
||||
pressed = false;
|
||||
while (process) {
|
||||
|
||||
Device_Present();
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
** If we have just received input focus again after running in the background then
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// NEWBLIT.CPP
|
||||
//
|
||||
|
||||
#include <imgui.h>
|
||||
#include "FUNCTION.H"
|
||||
#include "Image.h"
|
||||
|
||||
extern byte backbuffer_palette[768];
|
||||
|
||||
void GL_RenderImage(Image_t* image, int x, int y, int width, int height) {
|
||||
ImVec2 mi(x, y);
|
||||
ImVec2 ma(x + width, y + height);
|
||||
ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->image, mi, ma);
|
||||
}
|
||||
|
||||
void GL_FillRect(int color, int x, int y, int width, int height) {
|
||||
ImVec2 mi(x, y);
|
||||
ImVec2 ma(x + width, y + 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::GetForegroundDrawList()->AddRectFilled(mi, ma, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
|
||||
}
|
||||
|
||||
void GL_DrawText(int color, int x, int y, char* text) {
|
||||
ImVec2 pos(x, y);
|
||||
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::GetForegroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text);
|
||||
}
|
||||
|
||||
void GL_DrawLine(int color, int x, int y, int dx, int dy) {
|
||||
ImVec2 pos(x, y);
|
||||
ImVec2 pos2(dx, dy);
|
||||
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::GetForegroundDrawList()->AddLine(pos, pos2, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)));
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// NewBlit.h
|
||||
//
|
||||
|
||||
struct Image_t;
|
||||
void GL_RenderImage(Image_t* image, int x, int y, int width, int height);
|
||||
void GL_DrawText(int color, int x, int y, char* text);
|
||||
void GL_FillRect(int color, int x, int y, int width, int height);
|
||||
void GL_DrawLine(int color, int x, int y, int dx, int dy);
|
||||
@@ -617,7 +617,6 @@ int Com_Scenario_Dialog(bool skirmish)
|
||||
oh_dear_its_a_label:
|
||||
|
||||
while (process) {
|
||||
Device_Present();
|
||||
#if(SHOW_MONO)
|
||||
if (!skirmish) {
|
||||
NullModem.Mono_Debug_Print(0);
|
||||
@@ -683,7 +682,7 @@ oh_dear_its_a_label:
|
||||
/*
|
||||
...................... Refresh display if needed ......................
|
||||
*/
|
||||
if (display) {
|
||||
{
|
||||
if (housebtn.IsDropped) {
|
||||
housebtn.Collapse();
|
||||
display = REDRAW_BACKGROUND;
|
||||
@@ -693,7 +692,7 @@ oh_dear_its_a_label:
|
||||
/*
|
||||
.................. Redraw backgound & dialog box ...................
|
||||
*/
|
||||
if (display >= REDRAW_BACKGROUND) {
|
||||
{
|
||||
Dialog_Box(d_dialog_x, d_dialog_y, d_dialog_w, d_dialog_h);
|
||||
|
||||
// init font variables
|
||||
@@ -728,7 +727,7 @@ oh_dear_its_a_label:
|
||||
/*..................................................................
|
||||
Draw the color boxes
|
||||
..................................................................*/
|
||||
if (display >= REDRAW_COLORS) {
|
||||
{
|
||||
for (i = 0; i < MAX_MPLAYER_COLORS; i++) {
|
||||
LogicPage->Fill_Rect(cbox_x[i] + 1, d_color_y + 1,
|
||||
cbox_x[i] + 1 + d_color_w - 2, d_color_y + 1 + d_color_h - 2,
|
||||
@@ -756,7 +755,7 @@ oh_dear_its_a_label:
|
||||
//..................................................................
|
||||
// Update game parameter labels
|
||||
//..................................................................
|
||||
if (display >= REDRAW_PARMS) {
|
||||
{
|
||||
|
||||
// LogicPage->Fill_Rect(d_count_x + d_count_w + 2, d_count_y, d_count_x + d_count_w + 35 * RESFACTOR, d_aiplayers_y + d_aiplayers_h+RESFACTOR, BLACK);
|
||||
|
||||
@@ -789,13 +788,13 @@ oh_dear_its_a_label:
|
||||
/*
|
||||
.......................... Redraw buttons ..........................
|
||||
*/
|
||||
if (display >= REDRAW_BUTTONS) {
|
||||
{
|
||||
commands->Flag_List_To_Redraw();
|
||||
commands->Draw_All();
|
||||
}
|
||||
|
||||
Show_Mouse();
|
||||
display = REDRAW_NONE;
|
||||
//display = REDRAW_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1707,7 +1707,7 @@ int BGMessageBox(char const * msg, int btn1, int btn2)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (display) {
|
||||
{
|
||||
display = false;
|
||||
|
||||
Hide_Mouse();
|
||||
|
||||
@@ -567,7 +567,7 @@ int Fetch_Difficulty(void)
|
||||
*/
|
||||
Call_Back();
|
||||
|
||||
Device_Present();
|
||||
// Device_Present();
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
|
||||
@@ -286,6 +286,7 @@ int __cdecl Buffer_Print2(GraphicViewPortClass& vp, const char* string, int x, i
|
||||
|
||||
extern "C" LONG __cdecl Buffer_Print(void* thisptr, const char* str, int x, int y, int fcolor, int bcolor)
|
||||
{
|
||||
Buffer_Print2(*(GraphicViewPortClass*)thisptr, str, x, y, fcolor, bcolor);
|
||||
//Buffer_Print2(*(GraphicViewPortClass*)thisptr, str, x, y, fcolor, bcolor);
|
||||
GL_DrawText(fcolor, x, y, (char *)str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "iconcach.h"
|
||||
#include "../NEWBLIT.H"
|
||||
|
||||
extern unsigned char* backbuffer_data_raw;
|
||||
|
||||
@@ -1109,10 +1110,12 @@ inline void GraphicViewPortClass::Draw_Stamp(void const * icondata, int icon, in
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
if (Lock()){
|
||||
Buffer_Draw_Line(this, sx, sy, dx, dy, color);
|
||||
}
|
||||
Unlock();
|
||||
//if (Lock()){
|
||||
// Buffer_Draw_Line(this, sx, sy, dx, dy, color);
|
||||
//}
|
||||
//Unlock();
|
||||
|
||||
GL_DrawLine(color, sx, sy, dx, dy);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@@ -1129,10 +1132,14 @@ inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsi
|
||||
*=========================================================================*/
|
||||
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
|
||||
{
|
||||
// jmarshall
|
||||
// Still needed for gameplay.
|
||||
if (Lock()) {
|
||||
Buffer_Fill_Rect(this, sx, sy, dx, dy, color);
|
||||
Unlock();
|
||||
}
|
||||
//GL_FillRect(color, sx, sy, dx - sx, dy - sy);
|
||||
// jmarshall end
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ void WWMouseClass::RenderMouse(void) {
|
||||
return;
|
||||
|
||||
//ImVec2 size(current_cursor->width, current_cursor->height);
|
||||
//ImGui::Image((ImTextureID)current_cursor->image, size);
|
||||
// Image((ImTextureID)current_cursor->image, size);
|
||||
int _my = mousey + (current_cursor->height * 0.25);
|
||||
int xstart = mousex - Get_Hotspot_X();
|
||||
int ystart = _my - Get_Hotspot_Y();
|
||||
|
||||
@@ -823,7 +823,7 @@ void __cdecl SetPalette(unsigned char *palette, long, unsigned long)
|
||||
}
|
||||
|
||||
|
||||
void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
||||
void WWSDL_ProcessEvents(KeyNumType& key, int& flags, bool presentBuffer) {
|
||||
static int numFramesLMouse = 0;
|
||||
extern int mousex, mousey;
|
||||
bool leftMouseProcessed = false;
|
||||
@@ -910,7 +910,9 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
||||
flags = GadgetClass::LEFTHELD;
|
||||
}
|
||||
|
||||
Device_Present();
|
||||
if (presentBuffer) {
|
||||
Device_Present();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user