diff options
author | Walter van Niftrik | 2017-01-20 12:00:20 +0100 |
---|---|---|
committer | Walter van Niftrik | 2017-01-25 16:03:11 +0100 |
commit | 55f3bef837363bf5e392db317cb3fce908876edb (patch) | |
tree | 59410c53afdd5438ef1faf09f13c69e32baf93db /engines/adl/graphics_v1.cpp | |
parent | 7b0c49b2a84dc7f089dfc67b9c852c87af84cc53 (diff) | |
download | scummvm-rg350-55f3bef837363bf5e392db317cb3fce908876edb.tar.gz scummvm-rg350-55f3bef837363bf5e392db317cb3fce908876edb.tar.bz2 scummvm-rg350-55f3bef837363bf5e392db317cb3fce908876edb.zip |
ADL: Merge graphics code into a single file
Diffstat (limited to 'engines/adl/graphics_v1.cpp')
-rw-r--r-- | engines/adl/graphics_v1.cpp | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/engines/adl/graphics_v1.cpp b/engines/adl/graphics_v1.cpp deleted file mode 100644 index 29c5ef47af..0000000000 --- a/engines/adl/graphics_v1.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "common/stream.h" -#include "common/rect.h" -#include "common/textconsole.h" - -#include "adl/display.h" -#include "adl/graphics.h" - -namespace Adl { - -void Graphics_v1::drawPic(Common::SeekableReadStream &pic, const Common::Point &pos) { - byte x, y; - bool bNewLine = false; - byte oldX = 0, oldY = 0; - while (1) { - x = pic.readByte(); - y = pic.readByte(); - - if (pic.err() || pic.eos()) - error("Error reading picture"); - - if (x == 0xff && y == 0xff) - return; - - if (x == 0 && y == 0) { - bNewLine = true; - continue; - } - - x += pos.x; - y += pos.y; - - if (y > 160) - y = 160; - - if (bNewLine) { - _display.putPixel(Common::Point(x, y), 0x7f); - bNewLine = false; - } else { - drawLine(Common::Point(oldX, oldY), Common::Point(x, y), 0x7f); - } - - oldX = x; - oldY = y; - } -} - -void Graphics_v1::drawCornerPixel(Common::Point &p, byte color, byte bits, byte quadrant) const { - if (bits & 4) - _display.putPixel(p, color); - - bits += quadrant; - - if (bits & 1) - p.x += (bits & 2 ? -1 : 1); - else - p.y += (bits & 2 ? 1 : -1); -} - -void Graphics_v1::drawCorners(Common::ReadStream &corners, const Common::Point &pos, byte rotation, byte scaling, byte color) const { - const byte stepping[] = { - 0xff, 0xfe, 0xfa, 0xf4, 0xec, 0xe1, 0xd4, 0xc5, - 0xb4, 0xa1, 0x8d, 0x78, 0x61, 0x49, 0x31, 0x18, - 0xff - }; - - byte quadrant = rotation >> 4; - rotation &= 0xf; - byte xStep = stepping[rotation]; - byte yStep = stepping[(rotation ^ 0xf) + 1] + 1; - - Common::Point p(pos); - - while (true) { - byte b = corners.readByte(); - - if (corners.eos() || corners.err()) - error("Error reading corners"); - - if (b == 0) - return; - - do { - byte xFrac = 0x80; - byte yFrac = 0x80; - for (uint j = 0; j < scaling; ++j) { - if (xFrac + xStep + 1 > 255) - drawCornerPixel(p, color, b, quadrant); - xFrac += xStep + 1; - if (yFrac + yStep > 255) - drawCornerPixel(p, color, b, quadrant + 1); - yFrac += yStep; - } - b >>= 3; - } while (b != 0); - } -} - -} // End of namespace Adl |