From bcffbac2b5481febc351dcea5a284525d4798c55 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 12 May 2024 18:01:43 +0200 Subject: [PATCH] remove RenderObjectLayer::update. now all layers are updated, always. The original use case of the update flag was to prevent those layers that only had map Element tiles on them to update each tile, which would be very slow and most tiles never had any reason to be updated. (Those that needed to were tracked in a separate list.) Since the map Element class does no longer exist and tiles are handled much more efficiently now, it makes sense to not arbitarily disable object updates for layers that used to have only map tiles on them. Note to self: This fixes the skeleton entities properly reacting to shots now when placed on tile layers. --- Aquaria/Game.cpp | 4 ---- Aquaria/SceneEditor.cpp | 7 ------- BBGE/Core.cpp | 3 --- BBGE/Core.h | 2 -- BBGE/RenderObjectLayer.cpp | 1 - 5 files changed, 17 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 3da0209..0c530d4 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2558,8 +2558,6 @@ void Game::applyState() useWaterLevel = false; waterLevel = saveWaterLevel = 0; - dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = false; - grad = 0; maxLookDistance = 600; saveFile = 0; @@ -4754,8 +4752,6 @@ void Game::removeState() if (core->afterEffectManager) core->afterEffectManager->clear(); - dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = true; - if (saveFile) { delete saveFile; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 040baf2..38f0e17 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -2337,7 +2337,6 @@ void SceneEditor::toggle(bool on) if (on) { btnMenu->alpha = 1; - dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = true; dsq->tileRenders[bgLayer]->renderBorders = true; game->togglePause(on); @@ -2352,11 +2351,6 @@ void SceneEditor::toggle(bool on) dsq->darkLayer.toggle(false); - for (int i = LR_ELEMENTS1; i <= LR_ELEMENTS8; i++) - { - dsq->getRenderObjectLayer(i)->update = true; - } - oldGlobalScale = core->globalScale; const float cameraOffset = 1/oldGlobalScale.x - 1/zoom.x; core->cameraPos.x += cameraOffset * core->getVirtualWidth()/2; @@ -2375,7 +2369,6 @@ void SceneEditor::toggle(bool on) movingEntity = 0; - dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = false; dsq->tileRenders[bgLayer]->renderBorders = false; game->togglePause(on); diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 74f3e8c..e2af119 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -1059,9 +1059,6 @@ void Core::updateRenderObjects(float dt) RenderObjectLayer *rl = &renderObjectLayers[c]; - if (!rl->update) - continue; - for (RenderObject *r = rl->getFirst(); r; r = rl->getNext()) { r->update(dt); diff --git a/BBGE/Core.h b/BBGE/Core.h index d242641..2ce4a13 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -171,8 +171,6 @@ public: Vector followCameraMult; // calculated based on followCameraLock int followCameraLock; - bool update; - PreRenderFunc preRender; PostRenderFunc postRender; diff --git a/BBGE/RenderObjectLayer.cpp b/BBGE/RenderObjectLayer.cpp index 3cdd6a2..aa3f034 100644 --- a/BBGE/RenderObjectLayer.cpp +++ b/BBGE/RenderObjectLayer.cpp @@ -30,7 +30,6 @@ RenderObjectLayer::RenderObjectLayer() visible = true; startPass = endPass = 0; followCameraLock = FCL_NONE; - update = true; const int size = renderObjects.size(); for (int i = 0; i < size; i++)