From b54d8d05acb4901de0069739cf5fe75e61a09dd3 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 8 Jul 2024 03:54:00 +0200 Subject: [PATCH] correctly update VBO of GridRender(OT_BLACK) after trimGrid() This fixes blackness showing occasionally even though it was no longer there --- Aquaria/Game.cpp | 7 +++++-- Aquaria/GameEnums.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 6c2fb76..646cb1a 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -547,6 +547,9 @@ void Game::reconstructEntityGrid() updateGridRender(OT_INVISIBLEENT); } +// TODO: ideally this would be split into two functions, one that reconstructs blackness +// and is called on map load or by the editor, and another one that just reconstructs +// the dynamic parts of the grid. void Game::reconstructGrid(bool force) { if (!force && isSceneEditorActive()) return; @@ -581,8 +584,8 @@ void Game::reconstructGrid(bool force) trimGrid(); - // This does intentionally not update black. - updateGridRender(OT_MASK_NOTBLACK); + // Must update OT_BLACK after trimGrid() + updateGridRender(OT_MASK_ALL); } void Game::trimGrid() diff --git a/Aquaria/GameEnums.h b/Aquaria/GameEnums.h index c129096..fd843be 100644 --- a/Aquaria/GameEnums.h +++ b/Aquaria/GameEnums.h @@ -33,6 +33,7 @@ enum ObsType OT_USER_MASK = OT_USER1 | OT_USER2, OT_OUTOFBOUNDS = 0xff, // all bits set + OT_MASK_ALL = 0xff };