ADL: Clear screen with white in v2+

This fixes hires5, region 14, room 29
This commit is contained in:
Walter van Niftrik 2017-01-30 21:54:02 +01:00
parent c8cd4d2c00
commit f6214df664
8 changed files with 24 additions and 18 deletions

View File

@ -446,11 +446,6 @@ void AdlEngine::loadDroppedItemOffsets(Common::ReadStream &stream, byte count) {
}
}
void AdlEngine::clearScreen() const {
_display->setMode(DISPLAY_MODE_MIXED);
_display->clear(0x00);
}
void AdlEngine::drawPic(byte pic, Common::Point pos) const {
if (_roomData.pictures.contains(pic))
_graphics->drawPic(*_roomData.pictures[pic]->createReadStream(), pos);

View File

@ -309,7 +309,6 @@ protected:
int o1_setRoomPic(ScriptEnv &e);
// Graphics
void clearScreen() const;
void drawPic(byte pic, Common::Point pos = Common::Point()) const;
// Sound

View File

@ -255,7 +255,7 @@ void AdlEngine_v2::showRoom() {
if (_state.room != _roomOnScreen) {
loadRoom(_state.room);
clearScreen();
_graphics->clearScreen();
if (!_state.isDark)
redrawPic = true;

View File

@ -24,6 +24,7 @@
#include "adl/console.h"
#include "adl/display.h"
#include "adl/graphics.h"
#include "adl/adl.h"
namespace Adl {
@ -173,7 +174,7 @@ bool Console::Cmd_DumpScripts(int argc, const char **argv) {
}
void Console::prepareGame() {
_engine->clearScreen();
_engine->_graphics->clearScreen();
_engine->loadRoom(_engine->_state.room);
_engine->showRoom();
_engine->_display->updateTextScreen();

View File

@ -29,6 +29,11 @@
namespace Adl {
void GraphicsMan::clearScreen() const {
_display.setMode(DISPLAY_MODE_MIXED);
_display.clear(getClearColor());
}
// Draws a four-connected line
void GraphicsMan::drawLine(const Common::Point &p1, const Common::Point &p2, byte color) const {
int16 deltaX = p2.x - p1.x;
@ -209,11 +214,6 @@ static const byte fillPatterns[NUM_PATTERNS][PATTERN_LEN] = {
p.y += _offset.y; \
} while (0)
void Graphics_v2::clear() {
_display.clear(0xff);
_color = 0;
}
void Graphics_v2::drawCorners(Common::SeekableReadStream &pic, bool yFirst) {
Common::Point p;
@ -367,6 +367,10 @@ void Graphics_v2::fill(Common::SeekableReadStream &pic) {
}
void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &pos) {
// NOTE: The original engine only resets the color for overlays. As a result, room
// pictures that draw without setting a color or clearing the screen, will use the
// last color set by the previous picture. We assume this is unintentional and do
// not copy this behavior.
_color = 0;
_offset = pos;
@ -393,7 +397,8 @@ void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &
fill(pic);
break;
case 0xe5:
clear();
clearScreen();
_color = 0x00;
break;
case 0xf0:
_color = 0x00;

View File

@ -23,9 +23,10 @@
#ifndef ADL_PICTURE_H
#define ADL_PICTURE_H
#include "common/rect.h"
namespace Common {
class SeekableReadStream;
struct Point;
}
namespace Adl {
@ -36,12 +37,16 @@ class GraphicsMan {
public:
virtual ~GraphicsMan() { }
virtual void drawPic(Common::SeekableReadStream &pic, const Common::Point &pos) = 0;
void clearScreen() const;
protected:
GraphicsMan(Display &display) : _display(display) { }
void drawLine(const Common::Point &p1, const Common::Point &p2, byte color) const;
Display &_display;
private:
virtual byte getClearColor() const = 0;
};
// Used in hires1
@ -53,6 +58,7 @@ public:
private:
void drawCornerPixel(Common::Point &p, byte color, byte bits, byte quadrant) const;
byte getClearColor() const { return 0x00; }
};
// Used in hires0 and hires2-hires4
@ -66,13 +72,13 @@ protected:
void fillRow(Common::Point p, const byte pattern, const bool stopBit = false);
private:
void clear();
void drawCorners(Common::SeekableReadStream &pic, bool yFirst);
void drawRelativeLines(Common::SeekableReadStream &pic);
void drawAbsoluteLines(Common::SeekableReadStream &pic);
virtual void fillRowLeft(Common::Point p, const byte pattern, const bool stopBit);
virtual void fillAt(Common::Point p, const byte pattern);
void fill(Common::SeekableReadStream &pic);
byte getClearColor() const { return 0xff; }
byte _color;
Common::Point _offset;

View File

@ -429,7 +429,7 @@ void HiRes1Engine::loadRoom(byte roomNr) {
void HiRes1Engine::showRoom() {
_state.curPicture = getCurRoom().curPicture;
clearScreen();
_graphics->clearScreen();
loadRoom(_state.room);
if (!_state.isDark) {

View File

@ -335,7 +335,7 @@ void HiRes6Engine::showRoom() {
if (getVar(26) < 0x80 && getCurRoom().isFirstTime)
setVar(26, 0);
clearScreen();
_graphics->clearScreen();
if (!_state.isDark)
redrawPic = true;