aboutsummaryrefslogtreecommitdiff
path: root/engines/adl/hires1.cpp
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-03 19:17:49 +0100
committerWalter van Niftrik2016-03-09 10:03:13 +0100
commitd5cc42f1c233a45abb879818af503ec7b91c6f34 (patch)
tree42d0c47862aad4c2b919ae4d81b3b2cbaef06dc8 /engines/adl/hires1.cpp
parentb30fb417acb29dee415a784f15f63772a010b4d3 (diff)
downloadscummvm-rg350-d5cc42f1c233a45abb879818af503ec7b91c6f34.tar.gz
scummvm-rg350-d5cc42f1c233a45abb879818af503ec7b91c6f34.tar.bz2
scummvm-rg350-d5cc42f1c233a45abb879818af503ec7b91c6f34.zip
ADL: Make frame buffer linear
Diffstat (limited to 'engines/adl/hires1.cpp')
-rw-r--r--engines/adl/hires1.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 54351911fc..04df01ecd4 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -216,10 +216,10 @@ void HiRes1Engine::drawPic(Common::ReadStream &stream, Common::Point pos) {
y = 160;
if (bNewLine) {
- _display->drawPixel(x, y, 0x7f);
+ _display->putPixel(Common::Point(x, y), 0x7f);
bNewLine = false;
} else {
- _display->drawLine(Common::Point(oldX, oldY), Common::Point(x, y), 0x7f);
+ drawLine(Common::Point(oldX, oldY), Common::Point(x, y), 0x7f);
}
oldX = x;
@@ -455,6 +455,42 @@ uint HiRes1Engine::getEngineMessage(EngineMessage msg) {
}
}
+void HiRes1Engine::drawLine(Common::Point p1, Common::Point p2, byte color) {
+ int16 deltaX = p2.x - p1.x;
+ byte dir = deltaX >> 8;
+
+ if (deltaX < 0)
+ deltaX = -deltaX;
+
+ int16 err = deltaX;
+
+ int16 deltaY = p2.y - p1.y - 1;
+ dir >>= 1;
+ if (deltaY >= 0) {
+ deltaY = -deltaY - 2;
+ dir |= 0x80;
+ }
+
+ int16 steps = deltaY - deltaX;
+
+ err += deltaY + 1;
+
+ while (1) {
+ _display->putPixel(p1, color);
+
+ if (++steps == 0)
+ return;
+
+ if (err < 0) {
+ p1.y += (dir & 0x80 ? 1 : -1);
+ err += deltaX;
+ } else {
+ p1.x += (dir & 0x40 ? -1 : 1);
+ err += deltaY + 1;
+ }
+ }
+}
+
AdlEngine *HiRes1Engine__create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes1Engine(syst, gd);
}