Skip to content

Commit

Permalink
Revert "DrawFloor: Remove a redundant check"
Browse files Browse the repository at this point in the history
This reverts commit a75f77b.

Revert the commit while we investigate the issue
  • Loading branch information
glebm committed Sep 6, 2024
1 parent 88cddb0 commit 77020db
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions Source/engine/render/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,6 @@ void DrawCell(const Surface &out, Point tilePosition, Point targetBufferPosition
*/
void DrawFloorTile(const Surface &out, Point tilePosition, Point targetBufferPosition)
{
const uint16_t levelPieceId = dPiece[tilePosition.x][tilePosition.y];

// Floor tiles always come in pairs. If the left triangle (mt[0]) exists, so does the right one.
assert(DPieceMicros[levelPieceId].mt[0].hasValue() == DPieceMicros[levelPieceId].mt[1].hasValue());
if (!DPieceMicros[levelPieceId].mt[0].hasValue()) return;

const int lightTableIndex = dLight[tilePosition.x][tilePosition.y];

const uint8_t *tbl = LightTables[lightTableIndex].data();
Expand All @@ -590,10 +584,21 @@ void DrawFloorTile(const Surface &out, Point tilePosition, Point targetBufferPos
tbl = GetPauseTRN();
#endif

RenderTileFrame(out, targetBufferPosition, TileType::LeftTriangle,
GetDunFrame(DPieceMicros[levelPieceId].mt[0].frame()), DunFrameTriangleHeight, MaskType::Solid, tbl);
RenderTileFrame(out, targetBufferPosition + RightFrameDisplacement, TileType::RightTriangle,
GetDunFrame(DPieceMicros[levelPieceId].mt[1].frame()), DunFrameTriangleHeight, MaskType::Solid, tbl);
const uint16_t levelPieceId = dPiece[tilePosition.x][tilePosition.y];
{
const LevelCelBlock levelCelBlock { DPieceMicros[levelPieceId].mt[0] };
if (levelCelBlock.hasValue()) {
RenderTileFrame(out, targetBufferPosition, TileType::LeftTriangle,
GetDunFrame(levelCelBlock.frame()), DunFrameTriangleHeight, MaskType::Solid, tbl);
}
}
{
const LevelCelBlock levelCelBlock { DPieceMicros[levelPieceId].mt[1] };
if (levelCelBlock.hasValue()) {
RenderTileFrame(out, targetBufferPosition + RightFrameDisplacement, TileType::RightTriangle,
GetDunFrame(levelCelBlock.frame()), DunFrameTriangleHeight, MaskType::Solid, tbl);
}
}
}

/**
Expand Down Expand Up @@ -840,8 +845,9 @@ void DrawFloor(const Surface &out, Point tilePosition, Point targetBufferPositio
world_draw_black_tile(out, targetBufferPosition.x, targetBufferPosition.y);
continue;
}
if (!IsFloor(tilePosition)) continue;
DrawFloorTile(out, tilePosition, targetBufferPosition);
if (IsFloor(tilePosition)) {
DrawFloorTile(out, tilePosition, targetBufferPosition);
}
}
// Return to start of row
tilePosition += Displacement(Direction::West) * columns;
Expand Down

0 comments on commit 77020db

Please sign in to comment.