Skip to content

Commit

Permalink
add new config to draw covered things
Browse files Browse the repository at this point in the history
There are projects where this system doesn't work very well, so if your project is one of those, just set it to true to fix the tiles that aren't being drawn.
  • Loading branch information
mehah committed Aug 30, 2024
1 parent abe1129 commit 9db7759
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions data/setup.otml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ game
diagonal-walk-speed: 3

render
draw-covered-things: true
invisible-ticks-per-frame: 75
item-ticks-per-frame: 75
effect-ticks-per-frame: 75
Expand Down
4 changes: 3 additions & 1 deletion src/client/gameconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ void GameConfig::loadPlayerNode(const OTMLNodePtr& mainNode) {

void GameConfig::loadRenderNode(const OTMLNodePtr& mainNode) {
for (const auto& node : mainNode->children()) {
if (node->tag() == "invisible-ticks-per-frame")
if (node->tag() == "draw-covered-things")
m_drawCoveredThings = node->value<bool>();
else if (node->tag() == "invisible-ticks-per-frame")
m_invisibleTicksPerFrame = node->value<int>();
else if (node->tag() == "item-ticks-per-frame")
m_itemTicksPerFrame = node->value<int>();
Expand Down
2 changes: 2 additions & 0 deletions src/client/gameconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class GameConfig
uint16_t getShieldBlinkTicks() { return m_shieldBlinkTicks; }
uint16_t getVolatileSquareDuration() const { return m_volatileSquareDuration; }

bool isDrawingCoveredThings() const { return m_drawCoveredThings; }
uint16_t getInvisibleTicksPerFrame() const { return m_invisibleTicksPerFrame; }
uint16_t getItemTicksPerFrame() const { return m_itemTicksPerFrame; }
uint16_t getEffectTicksPerFrame() const { return m_effectTicksPerFrame; }
Expand Down Expand Up @@ -117,6 +118,7 @@ class GameConfig
double m_playerDiagonalWalkSpeed{ 3 };

// Render
bool m_drawCoveredThings{ false };
uint16_t m_invisibleTicksPerFrame{ 500 };
uint16_t m_itemTicksPerFrame{ 500 };
uint16_t m_effectTicksPerFrame{ 75 };
Expand Down
4 changes: 2 additions & 2 deletions src/client/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void MapView::updateVisibleTiles()
m_lastCameraPosition = m_posInfo.camera;
destroyHighlightTile();

const bool fadeFinished = getFadeLevel(m_cachedFirstVisibleFloor) == 1.f;
const bool checkIsCovered = !g_gameConfig.isDrawingCoveredThings() && getFadeLevel(m_cachedFirstVisibleFloor) == 1.f;

// cache visible tiles in draw order
// draw from last floor (the lower) to first floor (the higher)
Expand All @@ -361,7 +361,7 @@ void MapView::updateVisibleTiles()

bool addTile = true;

if (fadeFinished) {
if (checkIsCovered) {
// skip tiles that are completely behind another tile
if (tile->isCompletelyCovered(m_cachedFirstVisibleFloor, m_resetCoveredCache)) {
if (m_floorViewMode != ALWAYS_WITH_TRANSPARENCY || (tilePos.z < m_posInfo.camera.z && tile->isCovered(m_cachedFirstVisibleFloor))) {
Expand Down

0 comments on commit 9db7759

Please sign in to comment.