diff --git a/code/redalert/cell.cpp b/code/redalert/cell.cpp index 23048b6..8789995 100644 --- a/code/redalert/cell.cpp +++ b/code/redalert/cell.cpp @@ -1030,6 +1030,15 @@ bool CellClass::ScreenCoordsToIsoTile(int x, int y, int &tileX, int &tileY) { return true; } +void CellClass::ConvertIsoCoordsToScreen(int& x, int& y) { + int tileX, tileY; + if (!CellClass::ScreenCoordsToIsoTile(x, y, tileX, tileY)) { + return; + } + x = tileX * CELL_PIXEL_W; + y = tileY * CELL_PIXEL_H; +} + bool CellClass::ScreenCoordsToIsoCoords(COORDINATE screenCoord, COORDINATE& isoCoord) { int x, y; Map.Coord_To_Pixel(screenCoord, x, y); diff --git a/code/redalert/cell.h b/code/redalert/cell.h index 984c2e9..1d34644 100644 --- a/code/redalert/cell.h +++ b/code/redalert/cell.h @@ -277,6 +277,7 @@ class CellClass void Decode_Pointers(void); static void ConvertCoordsToIsometric(int& x, int& y); + static void ConvertIsoCoordsToScreen(int& x, int& y); static bool ScreenCoordsToIsoTile(int x, int y, int& tileX, int& tileY); static bool ScreenCoordsToIsoCoords(COORDINATE screenCoord, COORDINATE& isoCoord); diff --git a/code/redalert/newblit.cpp b/code/redalert/newblit.cpp index 76f9f11..0adcb06 100644 --- a/code/redalert/newblit.cpp +++ b/code/redalert/newblit.cpp @@ -88,6 +88,20 @@ void GL_FillRect(int color, int x, int y, int width, int height) { } } +void GL_FillRect(int _r, int _g, int _b, int x, int y, int width, int height) { + ImVec2 mi(x, y); + ImVec2 ma(x + width, y + height); + float r = _r / 255.0f; + float g = _g / 255.0f; + float b = _b / 255.0f; + 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) { ImVec2 pos(x, y); if (color == 0 || color == 160) { // This is a hack! diff --git a/code/redalert/newblit.h b/code/redalert/newblit.h index 607c1e7..d53899a 100644 --- a/code/redalert/newblit.h +++ b/code/redalert/newblit.h @@ -6,6 +6,7 @@ void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int col void GL_RenderForeGroundImage(Image_t* image, int x, int y, int width, int height, int colorRemap = 0, int shapeId = 0); 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_FillRect(int _r, int _g, int _b, int x, int y, int width, int height); void GL_DrawLine(int color, int x, int y, int dx, int dy); void GL_ResetClipRect(void); void GL_SetClipRect(int x, int y, int width, int height); diff --git a/code/redalert/rgb.h b/code/redalert/rgb.h index a91f2d1..e2c8116 100644 --- a/code/redalert/rgb.h +++ b/code/redalert/rgb.h @@ -110,6 +110,9 @@ class RGBClass int Blue_Component(void) const {return((Blue << 2) | (Blue >> 6));}; void Set(int color) const; + unsigned char GetRawRed() { return Red; } + unsigned char GetRawGreen() { return Green; } + unsigned char GetRawBlue() { return Blue; } private: friend class PaletteClass;