From 2c941540792f564edc6958b62c274415590698a6 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Thu, 23 Jul 2020 11:26:08 -0700 Subject: [PATCH] Removed RenderedFrameObjects and replaced with lastFrameRendered. --- code/redalert/cell.cpp | 6 ++---- code/redalert/object.h | 2 ++ code/redalert/winstub.cpp | 6 +----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/code/redalert/cell.cpp b/code/redalert/cell.cpp index b6560ae..dfbefac 100644 --- a/code/redalert/cell.cpp +++ b/code/redalert/cell.cpp @@ -84,10 +84,8 @@ */ #include "SidebarGlyphx.h" -std::vector renderedFrameObjects; - bool HasRenderedObject(const ObjectClass* technoClass) { - return std::find(renderedFrameObjects.begin(), renderedFrameObjects.end(), technoClass) != renderedFrameObjects.end(); + return technoClass->lastRenderTime == g_startFrameTime; } /*********************************************************************************************** @@ -1445,7 +1443,7 @@ void CellClass::Draw_It(int x, int y, bool objects) continue; } - renderedFrameObjects.push_back(object); + object->lastRenderTime = g_startFrameTime; int xx,yy; if (object->IsToDisplay && (!object->Is_Techno() || ((TechnoClass *)object)->Visual_Character() == VISUAL_NORMAL) && Map.Coord_To_Pixel(object->Render_Coord(), xx, yy)) { { diff --git a/code/redalert/object.h b/code/redalert/object.h index 550b945..e9cc4b3 100644 --- a/code/redalert/object.h +++ b/code/redalert/object.h @@ -55,6 +55,8 @@ class TriggerClass; class ObjectClass : public AbstractClass { public: + int lastRenderTime; + /* ** The object can be in one of two states -- placed down on the map, or not. If the ** object is placed down on the map, then this flag will be true. diff --git a/code/redalert/winstub.cpp b/code/redalert/winstub.cpp index 6a8923e..1a02980 100644 --- a/code/redalert/winstub.cpp +++ b/code/redalert/winstub.cpp @@ -81,8 +81,6 @@ SDL_GLContext game_context; int OverlappedVideoBlits = 0; float animFrameNum = 0; -extern std::vector renderedFrameObjects; - bool renderConsole = false; void (*Misc_Focus_Loss_Function)(void) = nullptr; @@ -606,9 +604,7 @@ void ImGui_NewFrame(void) { ImGui_ImplOpenGL3_NewFrame(); ImGui::NewFrame(show_oldframebuffer); - ImGui_ImplSDL2_NewFrame(game_window); - - renderedFrameObjects.clear(); + ImGui_ImplSDL2_NewFrame(game_window); } void Device_Present(void) {