diff --git a/code/redalert/cell.cpp b/code/redalert/cell.cpp index b5232df..5b4e244 100644 --- a/code/redalert/cell.cpp +++ b/code/redalert/cell.cpp @@ -1084,6 +1084,15 @@ void CellClass::Draw_It(int x, int y, bool objects) int i; char waypt[3]; #endif + int cellx = Cell_X(cell); + int celly = Cell_Y(cell); + if (cellx < Map.MapCellX || celly < Map.MapCellY) { + GL_SetColor(0.35, 0.35, 0.35); + } + + if (cellx >= Map.MapCellX + Map.MapCellWidth || celly >= Map.MapCellY + Map.MapCellHeight) { + GL_SetColor(0.35, 0.35, 0.35); + } CellCount++; @@ -1425,7 +1434,7 @@ void CellClass::Draw_It(int x, int y, bool objects) BEnd(BENCH_OBJECTS); } #endif - + GL_SetColor(1, 1, 1); } diff --git a/code/redalert/newblit.cpp b/code/redalert/newblit.cpp index 53e61b0..92654ad 100644 --- a/code/redalert/newblit.cpp +++ b/code/redalert/newblit.cpp @@ -9,11 +9,16 @@ extern byte backbuffer_palette[768]; extern uint8_t g_ColorXlat[16]; bool forceForgegroundRender = false; +int32_t g_currentColor; void GL_ForceForegroundRender(bool force) { forceForgegroundRender = force; } +void GL_SetColor(float r, float g, float b) { + g_currentColor = ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)); +} + void GL_SetClipRect(int x, int y, int width, int height) { ImVec2 mi(x, y); ImVec2 ma(x + width, y + height); @@ -43,12 +48,12 @@ void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int col if (image->numFrames > 0) { if(image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames] == 0) - ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma); + ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma, ImVec2(0, 0), ImVec2(1, 1), g_currentColor); else - ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames], mi, ma); + ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames], mi, ma, ImVec2(0, 0), ImVec2(1, 1), g_currentColor); } else { - ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma); + ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma, ImVec2(0, 0), ImVec2(1, 1), g_currentColor); } } diff --git a/code/redalert/newblit.h b/code/redalert/newblit.h index 9989725..607c1e7 100644 --- a/code/redalert/newblit.h +++ b/code/redalert/newblit.h @@ -10,4 +10,5 @@ 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); void GL_ForceForegroundRender(bool force); -void GL_DrawForegroundText(int color, int x, int y, char* text); \ No newline at end of file +void GL_DrawForegroundText(int color, int x, int y, char* text); +void GL_SetColor(float r, float g, float b); \ No newline at end of file diff --git a/code/redalert/tileset.cpp b/code/redalert/tileset.cpp index c778f1c..7abc85e 100644 --- a/code/redalert/tileset.cpp +++ b/code/redalert/tileset.cpp @@ -181,6 +181,9 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void Image_t* iconImage = (Image_t*)icondata; IsoTile* isoTile = iconImage->isoTileInfo; + if (isoTile == NULL) + return; + if (icon > isoTile->NumTiles()) icon = isoTile->NumTiles() - 1; IsoTileImageHeader* isoStampImage = isoTile->GetTileInfo(icon); diff --git a/code/redalert/winstub.cpp b/code/redalert/winstub.cpp index 0c02f7d..c41cde8 100644 --- a/code/redalert/winstub.cpp +++ b/code/redalert/winstub.cpp @@ -785,6 +785,8 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h ilInit(); + GL_SetColor(1, 1, 1); + texCache.Init(); SDL_Init(SDL_INIT_VIDEO);