From e5a55f777e6340c1a472efe9a2ce75b41e2a373f Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Wed, 24 Jun 2020 12:10:08 -0700 Subject: [PATCH] Removed unneeded input consume, HD remaster images now work in the placement editor. --- code/REDALERT/MAPEDIT.CPP | 2 +- code/REDALERT/MAPEDPLC.CPP | 13 ++++++++++++- code/REDALERT/NEWBLIT.CPP | 16 ++++++++++++++++ code/REDALERT/NEWBLIT.H | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/code/REDALERT/MAPEDIT.CPP b/code/REDALERT/MAPEDIT.CPP index 9752e61..7f3a478 100644 --- a/code/REDALERT/MAPEDIT.CPP +++ b/code/REDALERT/MAPEDIT.CPP @@ -1594,7 +1594,7 @@ void MapEditClass::Main_Menu(void) Show_Mouse(); if (UnknownKey==KN_ESC || g_globalKeyNumType == KN_RMOUSE) { -// jmarshall - consume the RMOUSE DOWN +// jmarshall - consume the RMOUSE DOWN so it doesn't bring up the context menu again. Buttons->Input(); // jmarshall end break; diff --git a/code/REDALERT/MAPEDPLC.CPP b/code/REDALERT/MAPEDPLC.CPP index 3a4931c..1c53cc3 100644 --- a/code/REDALERT/MAPEDPLC.CPP +++ b/code/REDALERT/MAPEDPLC.CPP @@ -454,9 +454,20 @@ int MapEditClass::Placement_Dialog(void) WindowList[WINDOW_EDITOR][WINDOWHEIGHT] = D_PICTURE_H; Change_Window((int)WINDOW_EDITOR); // Draw_Box(D_PICTURE_X, D_PICTURE_Y, D_PICTURE_W, D_PICTURE_H, BOXSTYLE_DOWN, false); - curobj->Display(WinW/2, WinH>>1, WINDOW_EDITOR, LastHouse); + //curobj->Display(WinW/2, WinH>>1, WINDOW_EDITOR, LastHouse); // curobj->Display(WinW<<2, WinH>>1, WINDOW_EDITOR, LastHouse); + Image_t* image = NULL; + if (curobj->Get_HDImage_Data()) { + image = curobj->Get_HDImage_Data(); + GL_RenderForeGroundImage(image, 30, 100, 75, 75); + } + //else { + // image = (Image_t *)curobj->Get_Image_Data(); + //} + + + /* ** Erase the grid */ diff --git a/code/REDALERT/NEWBLIT.CPP b/code/REDALERT/NEWBLIT.CPP index 6892b08..3917d16 100644 --- a/code/REDALERT/NEWBLIT.CPP +++ b/code/REDALERT/NEWBLIT.CPP @@ -34,6 +34,22 @@ 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, int shapeId) { + ImVec2 mi(x, y); + ImVec2 ma(x + width, y + height); + + if (image->numFrames > 0) { + if (image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames] == 0) + ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], mi, ma); + else + ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][((int)animFrameNum) % image->numFrames], mi, ma); + } + else { + ImGui::GetForegroundDrawList()->AddImage((ImTextureID)image->HouseImages[colorRemap].image[shapeId][0], 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); diff --git a/code/REDALERT/NEWBLIT.H b/code/REDALERT/NEWBLIT.H index 36cab3a..4e0f57c 100644 --- a/code/REDALERT/NEWBLIT.H +++ b/code/REDALERT/NEWBLIT.H @@ -3,6 +3,7 @@ struct Image_t; void GL_RenderImage(Image_t* image, int x, int y, int width, int height, int colorRemap = 0, int shapeId = 0); +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_DrawLine(int color, int x, int y, int dx, int dy);