From ef2294a1a426a044c40ab8183eae7f6ec260e489 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 30 Apr 2020 12:39:01 +0200 Subject: [PATCH] Fix drawing of harbor textures --- CMap.cpp | 4 ++-- CSurface.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMap.cpp b/CMap.cpp index d8e667e..773cbac 100644 --- a/CMap.cpp +++ b/CMap.cpp @@ -1751,7 +1751,7 @@ void CMap::modifyHeightMakeBigHouse(int VertexX, int VertexY) || middleVertex.rsuTexture == TRIANGLE_TEXTURE_STEPPE_MEADOW2_HARBOUR || middleVertex.rsuTexture == TRIANGLE_TEXTURE_FLOWER_HARBOUR || middleVertex.rsuTexture == TRIANGLE_TEXTURE_MINING_MEADOW_HARBOUR) { - middleVertex.rsuTexture -= 0x40; + middleVertex.rsuTexture &= ~0x40; } } @@ -1848,7 +1848,7 @@ void CMap::modifyTextureMakeHarbour(int VertexX, int VertexY) || vertex.rsuTexture == TRIANGLE_TEXTURE_STEPPE_MEADOW2 || vertex.rsuTexture == TRIANGLE_TEXTURE_FLOWER || vertex.rsuTexture == TRIANGLE_TEXTURE_MINING_MEADOW) { - vertex.rsuTexture += 0x40; + vertex.rsuTexture |= 0x40; } } diff --git a/CSurface.cpp b/CSurface.cpp index 4aef71e..4a4acc4 100644 --- a/CSurface.cpp +++ b/CSurface.cpp @@ -403,6 +403,11 @@ enum class BorderPreference BorderPreference CalcBorders(const bobMAP& map, Uint8 s2Id1, Uint8 s2Id2, SDL_Rect& borderRect) { // we have to decide which border to blit, "left or right" or "top or bottom" + s2Id1 &= ~(0x40 | 0x80); + s2Id2 &= ~(0x40 | 0x80); + + assert(s2Id1 < map.s2IdToTerrain.size()); + assert(s2Id2 < map.s2IdToTerrain.size()); DescIdx idxTop = map.s2IdToTerrain[s2Id1]; DescIdx idxBottom = map.s2IdToTerrain[s2Id2];