summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cRender.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/cRender.cpp b/cRender.cpp
index 41908e1..1b3b08d 100644
--- a/cRender.cpp
+++ b/cRender.cpp
@@ -114,6 +114,18 @@ int cRender::drawLine(char _c, sPos _pos1, sPos _pos2, bool _overrideCollision,
for (int i = 0; i <= abs(dX); i++)
{
drawPoint(_c, sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5)}, _overrideCollision, _color); //+0.5 for rounding error
+
+ if(abs(fGradient) > 1)
+ {
+ int dy = (int)(((i + 1) * fGradient + _pos1.y + 0.5) - (i * fGradient + _pos1.y + 0.5));
+ if(abs(dy) > 0)
+ {
+ drawLine(_c,
+ sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5)},
+ sPos{i + _pos1.x, (int)(i * fGradient + _pos1.y + 0.5) + dy},
+ _overrideCollision, _color);
+ }
+ }
}
}