SHERLOCK: Changed engine to use Graphics::ManagedSurface

This commit is contained in:
Paul Gilbert 2016-03-10 21:51:47 -05:00
parent b4e3d4abc1
commit 3da3dda187
44 changed files with 912 additions and 1119 deletions

View file

@ -23,6 +23,8 @@
#include "sherlock/animation.h" #include "sherlock/animation.h"
#include "sherlock/sherlock.h" #include "sherlock/sherlock.h"
#include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/3do/scalpel_3do_screen.h"
#include "common/algorithm.h" #include "common/algorithm.h"
namespace Sherlock { namespace Sherlock {
@ -89,7 +91,7 @@ bool Animation::play(const Common::String &filename, bool intro, int minDelay, i
// Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame, // Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame,
// since we don't want the offsets in the image file to be used, just the explicit position we specify // since we don't want the offsets in the image file to be used, just the explicit position we specify
screen.transBlitFrom(images[imageFrame]._frame, pt); screen.SHtransBlitFrom(images[imageFrame]._frame, pt);
} else { } else {
// At this point, either the sprites for the frame has been complete, or there weren't any sprites // At this point, either the sprites for the frame has been complete, or there weren't any sprites
// at all to draw for the frame // at all to draw for the frame
@ -201,7 +203,7 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay
// Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame, // Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame,
// since we don't want the offsets in the image file to be used, just the explicit position we specify // since we don't want the offsets in the image file to be used, just the explicit position we specify
screen._backBuffer1.transBlitFrom(images[imageFrame]._frame, pt); screen._backBuffer1.SHtransBlitFrom(images[imageFrame]._frame, pt);
if (!fadeActive) if (!fadeActive)
screen.slamArea(pt.x, pt.y, images[imageFrame]._frame.w, images[imageFrame]._frame.h); screen.slamArea(pt.x, pt.y, images[imageFrame]._frame.w, images[imageFrame]._frame.h);
} else { } else {

View file

@ -143,7 +143,7 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
// Form a single surface containing both frames // Form a single surface containing both frames
Surface s(r.width(), r.height()); Surface s(r.width(), r.height());
s.fill(TRANSPARENCY); s.clear(TRANSPARENCY);
// Draw the passed image // Draw the passed image
Common::Point drawPos; Common::Point drawPos;
@ -151,11 +151,11 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
drawPos.x = -cursorPt.x; drawPos.x = -cursorPt.x;
if (cursorPt.y < 0) if (cursorPt.y < 0)
drawPos.y = -cursorPt.y; drawPos.y = -cursorPt.y;
s.blitFrom(surface, Common::Point(drawPos.x, drawPos.y)); s.SHblitFrom(surface, Common::Point(drawPos.x, drawPos.y));
// Draw the cursor image // Draw the cursor image
drawPos = Common::Point(MAX(cursorPt.x, (int16)0), MAX(cursorPt.y, (int16)0)); drawPos = Common::Point(MAX(cursorPt.x, (int16)0), MAX(cursorPt.y, (int16)0));
s.transBlitFrom(cursorImg, Common::Point(drawPos.x, drawPos.y)); s.SHtransBlitFrom(cursorImg, Common::Point(drawPos.x, drawPos.y));
// Set up hotspot position for cursor, adjusting for cursor image's position within the surface // Set up hotspot position for cursor, adjusting for cursor image's position within the surface
Common::Point hotspot; Common::Point hotspot;
@ -163,7 +163,7 @@ void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const
hotspot = Common::Point(8, 8); hotspot = Common::Point(8, 8);
hotspot += drawPos; hotspot += drawPos;
// Set the cursor // Set the cursor
setCursor(s.getRawSurface(), hotspot.x, hotspot.y); setCursor(s, hotspot.x, hotspot.y);
} }
void Events::animateCursorIfNeeded() { void Events::animateCursorIfNeeded() {

View file

@ -43,7 +43,7 @@ void Fonts::setVm(SherlockEngine *vm) {
_charCount = 0; _charCount = 0;
} }
void Fonts::free() { void Fonts::freeFont() {
delete _font; delete _font;
} }
@ -213,7 +213,7 @@ void Fonts::writeString(Surface *surface, const Common::String &str,
if (curChar < _charCount) { if (curChar < _charCount) {
ImageFrame &frame = (*_font)[curChar]; ImageFrame &frame = (*_font)[curChar];
surface->transBlitFrom(frame, Common::Point(charPos.x, charPos.y + _yOffsets[curChar]), false, overrideColor); surface->SHtransBlitFrom(frame, Common::Point(charPos.x, charPos.y + _yOffsets[curChar]), false, overrideColor);
charPos.x += frame._frame.w + 1; charPos.x += frame._frame.w + 1;
} else { } else {
warning("Invalid character encountered - %d", (int)curChar); warning("Invalid character encountered - %d", (int)curChar);

View file

@ -57,7 +57,7 @@ public:
/** /**
* Frees the font manager * Frees the font manager
*/ */
static void free(); static void freeFont();
/** /**
* Set the font to use for writing text on the screen * Set the font to use for writing text on the screen

View file

@ -45,6 +45,11 @@ struct ImageFrame {
byte _rleMarker; byte _rleMarker;
Graphics::Surface _frame; Graphics::Surface _frame;
/**
* Converts an ImageFrame record to a surface for convenience in passing to drawing methods
*/
operator const Graphics::Surface &() { return _frame; }
/** /**
* Decompress a single frame for the sprite * Decompress a single frame for the sprite
*/ */

View file

@ -3,6 +3,7 @@ MODULE := engines/sherlock
MODULE_OBJS = \ MODULE_OBJS = \
scalpel/scalpel.o \ scalpel/scalpel.o \
scalpel/3do/movie_decoder.o \ scalpel/3do/movie_decoder.o \
scalpel/3do/scalpel_3do_screen.o \
scalpel/drivers/adlib.o \ scalpel/drivers/adlib.o \
scalpel/drivers/mt32.o \ scalpel/drivers/mt32.o \
scalpel/tsage/logo.o \ scalpel/tsage/logo.o \
@ -30,6 +31,7 @@ MODULE_OBJS = \
tattoo/tattoo_people.o \ tattoo/tattoo_people.o \
tattoo/tattoo_resources.o \ tattoo/tattoo_resources.o \
tattoo/tattoo_scene.o \ tattoo/tattoo_scene.o \
tattoo/tattoo_screen.o \
tattoo/tattoo_talk.o \ tattoo/tattoo_talk.o \
tattoo/tattoo_user_interface.o \ tattoo/tattoo_user_interface.o \
tattoo/widget_base.o \ tattoo/widget_base.o \

View file

@ -365,8 +365,8 @@ bool BaseObject::checkEndOfSequence() {
if (seq == 99) { if (seq == 99) {
--_frameNumber; --_frameNumber;
screen._backBuffer1.transBlitFrom(*_imageFrame, _position); screen._backBuffer1.SHtransBlitFrom(*_imageFrame, _position);
screen._backBuffer2.transBlitFrom(*_imageFrame, _position); screen._backBuffer2.SHtransBlitFrom(*_imageFrame, _position);
_type = INVALID; _type = INVALID;
} else if (IS_ROSE_TATTOO && _talkSeq && seq == 0) { } else if (IS_ROSE_TATTOO && _talkSeq && seq == 0) {
setObjTalkSequence(_talkSeq); setObjTalkSequence(_talkSeq);

View file

@ -0,0 +1,286 @@
/* 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 "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/scalpel.h"
#include "sherlock/scalpel/3do/scalpel_3do_screen.h"
namespace Sherlock {
namespace Scalpel {
Scalpel3DOScreen::Scalpel3DOScreen(SherlockEngine *vm): ScalpelScreen(vm) {
}
void Scalpel3DOScreen::SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
if (!_vm->_isScreenDoubled) {
ScalpelScreen::SHblitFrom(src, pt, srcBounds);
return;
}
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (!srcRect.isValidRect() || !clip(srcRect, destRect))
return;
// Add dirty area remapped to the 640x200 surface
addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2));
// Transfer the area, doubling each pixel
for (int yp = 0; yp < srcRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2);
for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
}
}
void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
error("TODO: Refactor");
#if 0
if (!_vm->_isScreenDoubled) {
ScalpelScreen::transBlitFromUnscaled(src, pt, flipped, overrideColor);
return;
}
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x * 2, destPt.y * 2, (destPt.x + drawRect.width()) * 2,
(destPt.y + drawRect.height()) * 2));
assert(src.format.bytesPerPixel == 2 && _surface.format.bytesPerPixel == 2);
for (int yp = 0; yp < drawRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destPt.x * 2, (destPt.y + yp) * 2);
for (int xp = 0; xp < drawRect.width(); ++xp, destP += 2) {
// RGB 0, 0, 0 -> transparent on 3DO
if (*srcP) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
#endif
}
void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) {
if (_vm->_isScreenDoubled)
ScalpelScreen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color);
else
ScalpelScreen::fillRect(r, color);
}
void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
Events &events = *_vm->_events;
uint16 *currentScreenBasePtr = (uint16 *)getPixels();
uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
uint16 currentScreenPixel = 0;
uint16 targetScreenPixel = 0;
uint16 currentScreenPixelRed = 0;
uint16 currentScreenPixelGreen = 0;
uint16 currentScreenPixelBlue = 0;
uint16 targetScreenPixelRed = 0;
uint16 targetScreenPixelGreen = 0;
uint16 targetScreenPixelBlue = 0;
uint16 screenWidth = SHERLOCK_SCREEN_WIDTH;
uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT;
uint16 screenX = 0;
uint16 screenY = 0;
uint16 pixelsChanged = 0;
clearDirtyRects();
do {
pixelsChanged = 0;
uint16 *currentScreenPtr = currentScreenBasePtr;
uint16 *targetScreenPtr = targetScreenBasePtr;
for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *currentScreenPtr;
targetScreenPixel = *targetScreenPtr;
if (currentScreenPixel != targetScreenPixel) {
// pixel doesn't match, adjust accordingly
currentScreenPixelRed = currentScreenPixel & 0xF800;
currentScreenPixelGreen = currentScreenPixel & 0x07E0;
currentScreenPixelBlue = currentScreenPixel & 0x001F;
targetScreenPixelRed = targetScreenPixel & 0xF800;
targetScreenPixelGreen = targetScreenPixel & 0x07E0;
targetScreenPixelBlue = targetScreenPixel & 0x001F;
if (currentScreenPixelRed != targetScreenPixelRed) {
if (currentScreenPixelRed < targetScreenPixelRed) {
currentScreenPixelRed += 0x0800;
} else {
currentScreenPixelRed -= 0x0800;
}
}
if (currentScreenPixelGreen != targetScreenPixelGreen) {
// Adjust +2/-2 because we are running RGB555 at RGB565
if (currentScreenPixelGreen < targetScreenPixelGreen) {
currentScreenPixelGreen += 0x0040;
} else {
currentScreenPixelGreen -= 0x0040;
}
}
if (currentScreenPixelBlue != targetScreenPixelBlue) {
if (currentScreenPixelBlue < targetScreenPixelBlue) {
currentScreenPixelBlue += 0x0001;
} else {
currentScreenPixelBlue -= 0x0001;
}
}
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
if (_vm->_isScreenDoubled) {
*(currentScreenPtr + 1) = v;
*(currentScreenPtr + 640) = v;
*(currentScreenPtr + 640 + 1) = v;
}
pixelsChanged++;
}
currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
if (_vm->_isScreenDoubled)
currentScreenPtr += 640;
}
// Too much considered dirty at the moment
if (_vm->_isScreenDoubled)
addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
else
addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
events.pollEvents();
events.delay(10 * speed);
} while ((pixelsChanged) && (!_vm->shouldQuit()));
}
void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) {
uint16 *currentScreenPtr = (uint16 *)getPixels();
uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels();
uint16 currentScreenPixel = 0;
uint16 screenWidth = SHERLOCK_SCREEN_WIDTH;
uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT;
uint16 screenX = 0;
uint16 screenY = 0;
uint16 currentScreenPixelRed = 0;
uint16 currentScreenPixelGreen = 0;
uint16 currentScreenPixelBlue = 0;
uint16 limitPixelRed = limitColor & 0xF800;
uint16 limitPixelGreen = limitColor & 0x07E0;
uint16 limitPixelBlue = limitColor & 0x001F;
for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *targetScreenPtr;
currentScreenPixelRed = currentScreenPixel & 0xF800;
currentScreenPixelGreen = currentScreenPixel & 0x07E0;
currentScreenPixelBlue = currentScreenPixel & 0x001F;
if (currentScreenPixelRed < limitPixelRed)
currentScreenPixelRed = limitPixelRed;
if (currentScreenPixelGreen < limitPixelGreen)
currentScreenPixelGreen = limitPixelGreen;
if (currentScreenPixelBlue < limitPixelBlue)
currentScreenPixelBlue = limitPixelBlue;
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
if (_vm->_isScreenDoubled) {
*(currentScreenPtr + 1) = v;
*(currentScreenPtr + 640) = v;
*(currentScreenPtr + 640 + 1) = v;
}
currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
if (_vm->_isScreenDoubled)
currentScreenPtr += 640;
}
// Too much considered dirty at the moment
if (_vm->_isScreenDoubled)
addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
else
addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
}
uint16 Scalpel3DOScreen::width() const {
return _vm->_isScreenDoubled ? this->w / 2 : this->w;
}
uint16 Scalpel3DOScreen::height() const {
return _vm->_isScreenDoubled ? this->h / 2 : this->h;
}
void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
addDirtyRect(destRect);
copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
} // End of namespace Scalpel
} // End of namespace Sherlock

View file

@ -0,0 +1,76 @@
/* 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.
*
*/
#ifndef SHERLOCK_SCALPEL_3DO_SCREEN_H
#define SHERLOCK_SCALPEL_3DO_SCREEN_H
#include "sherlock/scalpel/scalpel_screen.h"
namespace Sherlock {
class SherlockEngine;
namespace Scalpel {
class Scalpel3DOScreen : public ScalpelScreen {
protected:
/**
* Draws a sub-section of a surface at a given position within this surface
* Overriden for the 3DO to automatically double the size of everything to the underlying 640x400 surface
*/
virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds);
/**
* Draws a surface at a given position within this surface with transparency
*/
virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped,
int overrideColor);
public:
Scalpel3DOScreen(SherlockEngine *vm);
virtual ~Scalpel3DOScreen() {}
/**
* Draws a sub-section of a surface at a given position within this surface
*/
void rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt);
/**
* Fade backbuffer 1 into screen (3DO RGB!)
*/
void fadeIntoScreen3DO(int speed);
void blitFrom3DOcolorLimit(uint16 color);
/**
* Fill a given area of the surface with a given color
*/
virtual void fillRect(const Common::Rect &r, uint color);
virtual uint16 width() const;
virtual uint16 height() const;
};
} // End of namespace Scalpel
} // End of namespace Sherlock
#endif

View file

@ -29,6 +29,7 @@
#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel_people.h"
#include "sherlock/scalpel/scalpel_scene.h" #include "sherlock/scalpel/scalpel_scene.h"
#include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/3do/scalpel_3do_screen.h"
#include "sherlock/scalpel/tsage/logo.h" #include "sherlock/scalpel/tsage/logo.h"
#include "sherlock/sherlock.h" #include "sherlock/sherlock.h"
#include "sherlock/music.h" #include "sherlock/music.h"
@ -371,8 +372,8 @@ bool ScalpelEngine::showCityCutscene() {
if (finished) { if (finished) {
ImageFile titleImages_LondonNovember("title2.vgs", true); ImageFile titleImages_LondonNovember("title2.vgs", true);
_screen->_backBuffer1.blitFrom(*_screen); _screen->_backBuffer1.SHblitFrom(*_screen);
_screen->_backBuffer2.blitFrom(*_screen); _screen->_backBuffer2.SHblitFrom(*_screen);
Common::Point londonPosition; Common::Point londonPosition;
@ -386,19 +387,19 @@ bool ScalpelEngine::showCityCutscene() {
} }
// London, England // London, England
_screen->_backBuffer1.transBlitFrom(titleImages_LondonNovember[0], londonPosition); _screen->_backBuffer1.SHtransBlitFrom(titleImages_LondonNovember[0], londonPosition);
_screen->randomTransition(); _screen->randomTransition();
finished = _events->delay(1000, true); finished = _events->delay(1000, true);
// November, 1888 // November, 1888
if (finished) { if (finished) {
_screen->_backBuffer1.transBlitFrom(titleImages_LondonNovember[1], Common::Point(100, 100)); _screen->_backBuffer1.SHtransBlitFrom(titleImages_LondonNovember[1], Common::Point(100, 100));
_screen->randomTransition(); _screen->randomTransition();
finished = _events->delay(5000, true); finished = _events->delay(5000, true);
} }
// Transition out the title // Transition out the title
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2); _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2);
_screen->randomTransition(); _screen->randomTransition();
} }
@ -407,8 +408,8 @@ bool ScalpelEngine::showCityCutscene() {
if (finished) { if (finished) {
ImageFile titleImages_SherlockHolmesTitle("title.vgs", true); ImageFile titleImages_SherlockHolmesTitle("title.vgs", true);
_screen->_backBuffer1.blitFrom(*_screen); _screen->_backBuffer1.SHblitFrom(*_screen);
_screen->_backBuffer2.blitFrom(*_screen); _screen->_backBuffer2.SHblitFrom(*_screen);
Common::Point lostFilesPosition; Common::Point lostFilesPosition;
Common::Point sherlockHolmesPosition; Common::Point sherlockHolmesPosition;
@ -427,17 +428,17 @@ bool ScalpelEngine::showCityCutscene() {
} }
// The Lost Files of // The Lost Files of
_screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[0], lostFilesPosition); _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[0], lostFilesPosition);
// Sherlock Holmes // Sherlock Holmes
_screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[1], sherlockHolmesPosition); _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[1], sherlockHolmesPosition);
// copyright // copyright
_screen->_backBuffer1.transBlitFrom(titleImages_SherlockHolmesTitle[2], copyrightPosition); _screen->_backBuffer1.SHtransBlitFrom(titleImages_SherlockHolmesTitle[2], copyrightPosition);
_screen->verticalTransition(); _screen->verticalTransition();
finished = _events->delay(4000, true); finished = _events->delay(4000, true);
if (finished) { if (finished) {
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2); _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2);
_screen->randomTransition(); _screen->randomTransition();
finished = _events->delay(2000); finished = _events->delay(2000);
} }
@ -461,7 +462,7 @@ bool ScalpelEngine::showCityCutscene() {
// English, width 175, height 38 // English, width 175, height 38
alleyPosition = Common::Point(72, 51); alleyPosition = Common::Point(72, 51);
} }
_screen->transBlitFrom(titleImages_SherlockHolmesTitle[3], alleyPosition); _screen->SHtransBlitFrom(titleImages_SherlockHolmesTitle[3], alleyPosition);
_screen->fadeIn(palette, 3); _screen->fadeIn(palette, 3);
// Wait until the track got looped and the first few notes were played // Wait until the track got looped and the first few notes were played
@ -537,7 +538,7 @@ bool ScalpelEngine::showAlleyCutscene() {
earlyTheFollowingMorningPosition = Common::Point(35, 52); earlyTheFollowingMorningPosition = Common::Point(35, 52);
} }
_screen->transBlitFrom(titleImages_EarlyTheFollowingMorning[0], earlyTheFollowingMorningPosition); _screen->SHtransBlitFrom(titleImages_EarlyTheFollowingMorning[0], earlyTheFollowingMorningPosition);
// fast fade-in // fast fade-in
_screen->fadeIn(palette, 1); _screen->fadeIn(palette, 1);
@ -641,23 +642,23 @@ bool ScalpelEngine::scrollCredits() {
delete stream; delete stream;
// Save a copy of the screen background for use in drawing each credit frame // Save a copy of the screen background for use in drawing each credit frame
_screen->_backBuffer1.blitFrom(*_screen); _screen->_backBuffer1.SHblitFrom(*_screen);
// Loop for showing the credits // Loop for showing the credits
for(int idx = 0; idx < 600 && !_events->kbHit() && !shouldQuit(); ++idx) { for(int idx = 0; idx < 600 && !_events->kbHit() && !shouldQuit(); ++idx) {
// Copy the entire screen background before writing text // Copy the entire screen background before writing text
_screen->blitFrom(_screen->_backBuffer1); _screen->SHblitFrom(_screen->_backBuffer1);
// Write the text appropriate for the next frame // Write the text appropriate for the next frame
if (idx < 400) if (idx < 400)
_screen->transBlitFrom(creditsImages[0], Common::Point(10, 200 - idx), false, 0); _screen->SHtransBlitFrom(creditsImages[0], Common::Point(10, 200 - idx), false, 0);
if (idx > 200) if (idx > 200)
_screen->transBlitFrom(creditsImages[1], Common::Point(10, 400 - idx), false, 0); _screen->SHtransBlitFrom(creditsImages[1], Common::Point(10, 400 - idx), false, 0);
// Don't show credit text on the top and bottom ten rows of the screen // Don't show credit text on the top and bottom ten rows of the screen
_screen->blitFrom(_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, _screen->w(), 10)); _screen->SHblitFrom(_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, _screen->width(), 10));
_screen->blitFrom(_screen->_backBuffer1, Common::Point(0, _screen->h() - 10), _screen->SHblitFrom(_screen->_backBuffer1, Common::Point(0, _screen->height() - 10),
Common::Rect(0, _screen->h() - 10, _screen->w(), _screen->h())); Common::Rect(0, _screen->height() - 10, _screen->width(), _screen->height()));
_events->delay(100); _events->delay(100);
} }
@ -670,7 +671,7 @@ bool ScalpelEngine::show3DOSplash() {
// 3DO EA Splash screen // 3DO EA Splash screen
ImageFile3DO titleImage_3DOSplash("3DOSplash.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_3DOSplash("3DOSplash.cel", kImageFile3DOType_Cel);
_screen->transBlitFrom(titleImage_3DOSplash[0]._frame, Common::Point(0, -20)); _screen->SHtransBlitFrom(titleImage_3DOSplash[0]._frame, Common::Point(0, -20));
bool finished = _events->delay(3000, true); bool finished = _events->delay(3000, true);
if (finished) { if (finished) {
@ -706,7 +707,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
_sound->playAiff("prologue/sounds/rain.aiff", 15, true); _sound->playAiff("prologue/sounds/rain.aiff", 15, true);
// Fade screen to grey // Fade screen to grey
screen._backBuffer1.fill(0xCE59); // RGB565: 25, 50, 25 (grey) screen._backBuffer1.clear(0xCE59); // RGB565: 25, 50, 25 (grey)
screen.fadeIntoScreen3DO(2); screen.fadeIntoScreen3DO(2);
} }
@ -715,16 +716,16 @@ bool ScalpelEngine::showCityCutscene3DO() {
} }
if (finished) { if (finished) {
screen._backBuffer1.fill(0); // fill backbuffer with black to avoid issues during fade from white screen._backBuffer1.clear(0); // fill backbuffer with black to avoid issues during fade from white
finished = _animation->play3DO("26open1", true, 1, true, 2); finished = _animation->play3DO("26open1", true, 1, true, 2);
} }
if (finished) { if (finished) {
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
// "London, England" // "London, England"
ImageFile3DO titleImage_London("title2a.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_London("title2a.cel", kImageFile3DOType_Cel);
screen._backBuffer1.transBlitFrom(titleImage_London[0]._frame, Common::Point(30, 50)); screen._backBuffer1.SHtransBlitFrom(titleImage_London[0]._frame, Common::Point(30, 50));
screen.fadeIntoScreen3DO(1); screen.fadeIntoScreen3DO(1);
finished = _events->delay(1500, true); finished = _events->delay(1500, true);
@ -732,7 +733,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
if (finished) { if (finished) {
// "November, 1888" // "November, 1888"
ImageFile3DO titleImage_November("title2b.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_November("title2b.cel", kImageFile3DOType_Cel);
screen._backBuffer1.transBlitFrom(titleImage_November[0]._frame, Common::Point(100, 100)); screen._backBuffer1.SHtransBlitFrom(titleImage_November[0]._frame, Common::Point(100, 100));
screen.fadeIntoScreen3DO(1); screen.fadeIntoScreen3DO(1);
finished = _music->waitUntilMSec(14700, 0, 0, 5000); finished = _music->waitUntilMSec(14700, 0, 0, 5000);
@ -740,8 +741,8 @@ bool ScalpelEngine::showCityCutscene3DO() {
if (finished) { if (finished) {
// Restore screen // Restore screen
_screen->_backBuffer1.blitFrom(screen._backBuffer2); _screen->_backBuffer1.SHblitFrom(screen._backBuffer2);
_screen->blitFrom(screen._backBuffer1); _screen->SHblitFrom(screen._backBuffer1);
} }
} }
@ -751,7 +752,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
if (finished) { if (finished) {
// "Sherlock Holmes" (title) // "Sherlock Holmes" (title)
ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel", kImageFile3DOType_Cel);
screen._backBuffer1.transBlitFrom(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); screen._backBuffer1.SHtransBlitFrom(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5));
// Blend in // Blend in
screen.fadeIntoScreen3DO(2); screen.fadeIntoScreen3DO(2);
@ -761,7 +762,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
if (finished) { if (finished) {
ImageFile3DO titleImage_Copyright("title1c.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_Copyright("title1c.cel", kImageFile3DOType_Cel);
screen.transBlitFrom(titleImage_Copyright[0]._frame, Common::Point(20, 190)); screen.SHtransBlitFrom(titleImage_Copyright[0]._frame, Common::Point(20, 190));
finished = _events->delay(3500, true); finished = _events->delay(3500, true);
} }
} }
@ -780,7 +781,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
if (finished) { if (finished) {
// "In the alley behind the Regency Theatre..." // "In the alley behind the Regency Theatre..."
ImageFile3DO titleImage_InTheAlley("title1d.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_InTheAlley("title1d.cel", kImageFile3DOType_Cel);
screen._backBuffer1.transBlitFrom(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); screen._backBuffer1.SHtransBlitFrom(titleImage_InTheAlley[0]._frame, Common::Point(72, 51));
// Fade in // Fade in
screen.fadeIntoScreen3DO(4); screen.fadeIntoScreen3DO(4);
@ -819,7 +820,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
ImageFile3DO titleImage_ScreamingVictim("scream.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_ScreamingVictim("scream.cel", kImageFile3DOType_Cel);
screen.clear(); screen.clear();
screen.transBlitFrom(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0)); screen.SHtransBlitFrom(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0));
// Play "scream.aiff" // Play "scream.aiff"
if (_sound->_voices) if (_sound->_voices)
@ -848,7 +849,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
if (finished) { if (finished) {
// "Early the following morning on Baker Street..." // "Early the following morning on Baker Street..."
ImageFile3DO titleImage_EarlyTheFollowingMorning("title3.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_EarlyTheFollowingMorning("title3.cel", kImageFile3DOType_Cel);
screen._backBuffer1.transBlitFrom(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); screen._backBuffer1.SHtransBlitFrom(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51));
// Fade in // Fade in
screen.fadeIntoScreen3DO(4); screen.fadeIntoScreen3DO(4);
@ -908,7 +909,7 @@ bool ScalpelEngine::showOfficeCutscene3DO() {
ImageFile3DO titleImage_CoffeeNote("note.cel", kImageFile3DOType_Cel); ImageFile3DO titleImage_CoffeeNote("note.cel", kImageFile3DOType_Cel);
_screen->clear(); _screen->clear();
_screen->transBlitFrom(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0)); _screen->SHtransBlitFrom(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0));
if (_sound->_voices) { if (_sound->_voices) {
finished = _sound->playSound("prologue/sounds/note.aiff", WAIT_KBD_OR_FINISH); finished = _sound->playSound("prologue/sounds/note.aiff", WAIT_KBD_OR_FINISH);
@ -937,7 +938,7 @@ bool ScalpelEngine::showOfficeCutscene3DO() {
// TODO: Brighten the image, possibly by doing a partial fade // TODO: Brighten the image, possibly by doing a partial fade
// to white. // to white.
_screen->_backBuffer2.blitFrom(_screen->_backBuffer1); _screen->_backBuffer2.SHblitFrom(_screen->_backBuffer1);
for (int nr = 1; finished && nr <= 4; nr++) { for (int nr = 1; finished && nr <= 4; nr++) {
char filename[15]; char filename[15];
@ -945,8 +946,8 @@ bool ScalpelEngine::showOfficeCutscene3DO() {
ImageFile3DO *creditsImage = new ImageFile3DO(filename, kImageFile3DOType_Cel); ImageFile3DO *creditsImage = new ImageFile3DO(filename, kImageFile3DOType_Cel);
ImageFrame *creditsFrame = &(*creditsImage)[0]; ImageFrame *creditsFrame = &(*creditsImage)[0];
for (int i = 0; finished && i < 200 + creditsFrame->_height; i++) { for (int i = 0; finished && i < 200 + creditsFrame->_height; i++) {
_screen->blitFrom(_screen->_backBuffer2); _screen->SHblitFrom(_screen->_backBuffer2);
_screen->transBlitFrom(creditsFrame->_frame, Common::Point((320 - creditsFrame->_width) / 2, 200 - i)); _screen->SHtransBlitFrom(creditsFrame->_frame, Common::Point((320 - creditsFrame->_width) / 2, 200 - i));
if (!_events->delay(70, true)) if (!_events->delay(70, true))
finished = false; finished = false;
} }
@ -998,7 +999,7 @@ void ScalpelEngine::showLBV(const Common::String &filename) {
delete stream; delete stream;
_screen->setPalette(images._palette); _screen->setPalette(images._palette);
_screen->_backBuffer1.blitFrom(images[0]); _screen->_backBuffer1.SHblitFrom(images[0]);
_screen->verticalTransition(); _screen->verticalTransition();
} }
@ -1156,7 +1157,7 @@ void ScalpelEngine::eraseBrumwellMirror() {
// If player is in range of the mirror, then restore background from the secondary back buffer // If player is in range of the mirror, then restore background from the secondary back buffer
if (Common::Rect(70, 100, 200, 200).contains(pt)) { if (Common::Rect(70, 100, 200, 200).contains(pt)) {
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(137, 18), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(137, 18),
Common::Rect(137, 18, 184, 74)); Common::Rect(137, 18, 184, 74));
} }
} }
@ -1218,20 +1219,20 @@ void ScalpelEngine::doBrumwellMirror() {
bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT
|| people[HOLMES]._sequenceNumber == WALK_UPRIGHT || people[HOLMES]._sequenceNumber == STOP_UPRIGHT || people[HOLMES]._sequenceNumber == WALK_UPRIGHT || people[HOLMES]._sequenceNumber == STOP_UPRIGHT
|| people[HOLMES]._sequenceNumber == WALK_DOWNLEFT || people[HOLMES]._sequenceNumber == STOP_DOWNLEFT; || people[HOLMES]._sequenceNumber == WALK_DOWNLEFT || people[HOLMES]._sequenceNumber == STOP_DOWNLEFT;
_screen->_backBuffer1.transBlitFrom(imageFrame, pt + Common::Point(38, -imageFrame._frame.h - 25), flipped); _screen->_backBuffer1.SHtransBlitFrom(imageFrame, pt + Common::Point(38, -imageFrame._frame.h - 25), flipped);
// Redraw the mirror borders to prevent the drawn image of Holmes from appearing outside of the mirror // Redraw the mirror borders to prevent the drawn image of Holmes from appearing outside of the mirror
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(114, 18), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(114, 18),
Common::Rect(114, 18, 137, 114)); Common::Rect(114, 18, 137, 114));
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(137, 70), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(137, 70),
Common::Rect(137, 70, 142, 114)); Common::Rect(137, 70, 142, 114));
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(142, 71), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(142, 71),
Common::Rect(142, 71, 159, 114)); Common::Rect(142, 71, 159, 114));
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(159, 72), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(159, 72),
Common::Rect(159, 72, 170, 116)); Common::Rect(159, 72, 170, 116));
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(170, 73), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(170, 73),
Common::Rect(170, 73, 184, 114)); Common::Rect(170, 73, 184, 114));
_screen->_backBuffer1.blitFrom(_screen->_backBuffer2, Common::Point(184, 18), _screen->_backBuffer1.SHblitFrom(_screen->_backBuffer2, Common::Point(184, 18),
Common::Rect(184, 18, 212, 114)); Common::Rect(184, 18, 212, 114));
} }
} }
@ -1272,7 +1273,7 @@ void ScalpelEngine::showScummVMRestoreDialog() {
bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::Point &pos, bool isPortrait) { bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::Point &pos, bool isPortrait) {
Scalpel3DOScreen &screen = *(Scalpel3DOScreen *)_screen; Scalpel3DOScreen &screen = *(Scalpel3DOScreen *)_screen;
Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder(); Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder();
Graphics::Surface tempSurface; Graphics::ManagedSurface tempSurface;
Common::Point framePos(pos.x, pos.y); Common::Point framePos(pos.x, pos.y);
ImageFile3DO *frameImageFile = nullptr; ImageFile3DO *frameImageFile = nullptr;
@ -1307,7 +1308,7 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P
// If we're to show the movie at half-size, we'll need a temporary intermediate surface // If we're to show the movie at half-size, we'll need a temporary intermediate surface
if (halfSize) if (halfSize)
tempSurface.create(width / 2, height / 2, _screen->getPixelFormat()); tempSurface.create(width / 2, height / 2);
while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) { if (videoDecoder->needsUpdate()) {
@ -1371,19 +1372,19 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P
} }
// Point the drawing frame to the temporary surface // Point the drawing frame to the temporary surface
frame = &tempSurface; frame = &tempSurface.rawSurface();
} }
if (isPortrait && !frameShown) { if (isPortrait && !frameShown) {
// Draw the frame (not the frame of the video, but a frame around the video) itself // Draw the frame (not the frame of the video, but a frame around the video) itself
_screen->transBlitFrom(frameImage->_frame, framePos); _screen->SHtransBlitFrom(frameImage->_frame, framePos);
frameShown = true; frameShown = true;
} }
if (isPortrait && !halfSize) { if (isPortrait && !halfSize) {
screen.rawBlitFrom(*frame, Common::Point(pos.x * 2, pos.y * 2)); screen.rawBlitFrom(*frame, Common::Point(pos.x * 2, pos.y * 2));
} else { } else {
_screen->blitFrom(*frame, pos); _screen->SHblitFrom(*frame, pos);
} }
_screen->update(); _screen->update();
@ -1413,9 +1414,9 @@ bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::P
} }
// Restore scene // Restore scene
screen._backBuffer1.blitFrom(screen._backBuffer2); screen._backBuffer1.SHblitFrom(screen._backBuffer2);
_scene->updateBackground(); _scene->updateBackground();
screen.slamArea(0, 0, screen.w(), CONTROLS_Y); screen.slamArea(0, 0, screen.width(), CONTROLS_Y);
return !skipVideo; return !skipVideo;
} }

View file

@ -102,7 +102,7 @@ void Darts::playDarts() {
score -= lastDart; score -= lastDart;
_roundScore += lastDart; _roundScore += lastDart;
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1),
Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.print(Common::Point(DART_INFO_X, DART_INFO_Y), DART_COL_FORE, "Dart # %d", idx + 1); screen.print(Common::Point(DART_INFO_X, DART_INFO_Y), DART_COL_FORE, "Dart # %d", idx + 1);
screen.print(Common::Point(DART_INFO_X, DART_INFO_Y + 10), DART_COL_FORE, "Scored %d points", lastDart); screen.print(Common::Point(DART_INFO_X, DART_INFO_Y + 10), DART_COL_FORE, "Scored %d points", lastDart);
@ -154,7 +154,7 @@ void Darts::playDarts() {
events.wait(20); events.wait(20);
} }
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1),
Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
} }
@ -166,8 +166,8 @@ void Darts::playDarts() {
done |= _vm->shouldQuit(); done |= _vm->shouldQuit();
if (!done) { if (!done) {
screen._backBuffer2.blitFrom((*_dartImages)[0], Common::Point(0, 0)); screen._backBuffer2.SHblitFrom((*_dartImages)[0], Common::Point(0, 0));
screen._backBuffer1.blitFrom(screen._backBuffer2); screen._backBuffer1.SHblitFrom(screen._backBuffer2);
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
} }
} while (!done); } while (!done);
@ -185,7 +185,7 @@ void Darts::loadDarts() {
_dartImages = new ImageFile("darts.vgs"); _dartImages = new ImageFile("darts.vgs");
screen.setPalette(_dartImages->_palette); screen.setPalette(_dartImages->_palette);
screen._backBuffer1.blitFrom((*_dartImages)[0], Common::Point(0, 0)); screen._backBuffer1.SHblitFrom((*_dartImages)[0], Common::Point(0, 0));
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
} }
@ -245,7 +245,7 @@ void Darts::showNames(int playerNum) {
screen.slamArea(STATUS_INFO_X + 50, STATUS_INFO_Y + 10, 81, 12); screen.slamArea(STATUS_INFO_X + 50, STATUS_INFO_Y + 10, 81, 12);
// Make a copy of the back buffer to the secondary one // Make a copy of the back buffer to the secondary one
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
} }
void Darts::showStatus(int playerNum) { void Darts::showStatus(int playerNum) {
@ -253,7 +253,7 @@ void Darts::showStatus(int playerNum) {
byte color; byte color;
// Copy scoring screen from secondary back buffer. This will erase any previously displayed status/score info // Copy scoring screen from secondary back buffer. This will erase any previously displayed status/score info
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10),
Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, SHERLOCK_SCREEN_WIDTH, STATUS_INFO_Y + 48)); Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, SHERLOCK_SCREEN_WIDTH, STATUS_INFO_Y + 48));
color = (playerNum == 0) ? PLAYER_COLOR : DART_COL_FORE; color = (playerNum == 0) ? PLAYER_COLOR : DART_COL_FORE;
@ -292,7 +292,7 @@ int Darts::throwDart(int dartNum, int computer) {
if (_vm->shouldQuit()) if (_vm->shouldQuit())
return 0; return 0;
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_INFO_X, DART_INFO_Y - 1),
Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.slamRect(Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamRect(Common::Rect(DART_INFO_X, DART_INFO_Y - 1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
@ -309,9 +309,9 @@ int Darts::throwDart(int dartNum, int computer) {
// Copy the bars to the secondary back buffer so that they remain fixed at their selected values // Copy the bars to the secondary back buffer so that they remain fixed at their selected values
// whilst the dart is being animated at being thrown at the board // whilst the dart is being animated at being thrown at the board
screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(DARTBARHX - 1, DARTHORIZY - 1), screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DARTBARHX - 1, DARTHORIZY - 1),
Common::Rect(DARTBARHX - 1, DARTHORIZY - 1, DARTBARHX + DARTBARSIZE + 3, DARTHORIZY + 10)); Common::Rect(DARTBARHX - 1, DARTHORIZY - 1, DARTBARHX + DARTBARSIZE + 3, DARTHORIZY + 10));
screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1), screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1),
Common::Rect(DARTBARVX - 1, DARTHEIGHTY - 1, DARTBARVX + 11, DARTHEIGHTY + DARTBARSIZE + 3)); Common::Rect(DARTBARVX - 1, DARTHEIGHTY - 1, DARTBARVX + 11, DARTHEIGHTY + DARTBARSIZE + 3));
// Convert height and width to relative range of -50 to 50, where 0,0 is the exact centre of the board // Convert height and width to relative range of -50 to 50, where 0,0 is the exact centre of the board
@ -344,7 +344,7 @@ void Darts::drawDartThrow(const Common::Point &pt) {
// Draw the dart // Draw the dart
Common::Point drawPos(pos.x - frame._width / 2, pos.y - frame._height); Common::Point drawPos(pos.x - frame._width / 2, pos.y - frame._height);
screen._backBuffer1.transBlitFrom(frame, drawPos); screen._backBuffer1.SHtransBlitFrom(frame, drawPos);
screen.slamArea(drawPos.x, drawPos.y, frame._width, frame._height); screen.slamArea(drawPos.x, drawPos.y, frame._width, frame._height);
// Handle erasing old dart frame area // Handle erasing old dart frame area
@ -352,14 +352,14 @@ void Darts::drawDartThrow(const Common::Point &pt) {
screen.slamRect(oldDrawBounds); screen.slamRect(oldDrawBounds);
oldDrawBounds = Common::Rect(drawPos.x, drawPos.y, drawPos.x + frame._width, drawPos.y + frame._height); oldDrawBounds = Common::Rect(drawPos.x, drawPos.y, drawPos.x + frame._width, drawPos.y + frame._height);
screen._backBuffer1.blitFrom(screen._backBuffer2, drawPos, oldDrawBounds); screen._backBuffer1.SHblitFrom(screen._backBuffer2, drawPos, oldDrawBounds);
events.wait(2); events.wait(2);
} }
// Draw dart in final "stuck to board" form // Draw dart in final "stuck to board" form
screen._backBuffer1.transBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); screen._backBuffer1.SHtransBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top));
screen._backBuffer2.transBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top)); screen._backBuffer2.SHtransBlitFrom((*_dartImages)[22], Common::Point(oldDrawBounds.left, oldDrawBounds.top));
screen.slamRect(oldDrawBounds); screen.slamRect(oldDrawBounds);
} }
@ -368,8 +368,8 @@ void Darts::erasePowerBars() {
screen._backBuffer1.fillRect(Common::Rect(DARTBARHX, DARTHORIZY, DARTBARHX + DARTBARSIZE, DARTHORIZY + 10), BLACK); screen._backBuffer1.fillRect(Common::Rect(DARTBARHX, DARTHORIZY, DARTBARHX + DARTBARSIZE, DARTHORIZY + 10), BLACK);
screen._backBuffer1.fillRect(Common::Rect(DARTBARVX, DARTHEIGHTY, DARTBARVX + 10, DARTHEIGHTY + DARTBARSIZE), BLACK); screen._backBuffer1.fillRect(Common::Rect(DARTBARVX, DARTHEIGHTY, DARTBARVX + 10, DARTHEIGHTY + DARTBARSIZE), BLACK);
screen._backBuffer1.transBlitFrom((*_dartImages)[2], Common::Point(DARTBARHX - 1, DARTHORIZY - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartImages)[2], Common::Point(DARTBARHX - 1, DARTHORIZY - 1));
screen._backBuffer1.transBlitFrom((*_dartImages)[3], Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartImages)[3], Common::Point(DARTBARVX - 1, DARTHEIGHTY - 1));
screen.slamArea(DARTBARHX - 1, DARTHORIZY - 1, DARTBARSIZE + 3, 11); screen.slamArea(DARTBARHX - 1, DARTHORIZY - 1, DARTBARSIZE + 3, 11);
screen.slamArea(DARTBARVX - 1, DARTHEIGHTY - 1, 11, DARTBARSIZE + 3); screen.slamArea(DARTBARVX - 1, DARTHEIGHTY - 1, 11, DARTBARSIZE + 3);
} }
@ -398,11 +398,11 @@ int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, bool i
if (isVertical) { if (isVertical) {
screen._backBuffer1.hLine(pt.x, pt.y + DARTBARSIZE - 1 - idx, pt.x + 8, color); screen._backBuffer1.hLine(pt.x, pt.y + DARTBARSIZE - 1 - idx, pt.x + 8, color);
screen._backBuffer1.transBlitFrom((*_dartImages)[3], Common::Point(pt.x - 1, pt.y - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartImages)[3], Common::Point(pt.x - 1, pt.y - 1));
screen.slamArea(pt.x, pt.y + DARTBARSIZE - 1 - idx, 8, 2); screen.slamArea(pt.x, pt.y + DARTBARSIZE - 1 - idx, 8, 2);
} else { } else {
screen._backBuffer1.vLine(pt.x + idx, pt.y, pt.y + 8, color); screen._backBuffer1.vLine(pt.x + idx, pt.y, pt.y + 8, color);
screen._backBuffer1.transBlitFrom((*_dartImages)[2], Common::Point(pt.x - 1, pt.y - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartImages)[2], Common::Point(pt.x - 1, pt.y - 1));
screen.slamArea(pt.x + idx, pt.y, 1, 8); screen.slamArea(pt.x + idx, pt.y, 1, 8);
} }

View file

@ -201,7 +201,7 @@ void ScalpelInventory::highlight(int index, byte color) {
ImageFrame &frame = (*_invShapes[slot])[0]; ImageFrame &frame = (*_invShapes[slot])[0];
bb.fillRect(Common::Rect(8 + slot * 52, 165, (slot + 1) * 52, 194), color); bb.fillRect(Common::Rect(8 + slot * 52, 165, (slot + 1) * 52, 194), color);
bb.transBlitFrom(frame, Common::Point(6 + slot * 52 + ((47 - frame._width) / 2), bb.SHtransBlitFrom(frame, Common::Point(6 + slot * 52 + ((47 - frame._width) / 2),
163 + ((33 - frame._height) / 2))); 163 + ((33 - frame._height) / 2)));
screen.slamArea(8 + slot * 52, 165, 44, 30); screen.slamArea(8 + slot * 52, 165, 44, 30);
} }
@ -217,12 +217,12 @@ void ScalpelInventory::refreshInv() {
ui._infoFlag = true; ui._infoFlag = true;
ui.clearInfo(); ui.clearInfo();
screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(0, CONTROLS_Y), screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(0, CONTROLS_Y),
Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
ui.examine(); ui.examine();
if (!talk._talkToAbort) { if (!talk._talkToAbort) {
screen._backBuffer2.blitFrom((*ui._controlPanel)[0], Common::Point(0, CONTROLS_Y)); screen._backBuffer2.SHblitFrom((*ui._controlPanel)[0], Common::Point(0, CONTROLS_Y));
loadInv(); loadInv();
} }
} }
@ -264,7 +264,7 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) {
// Draw the item image // Draw the item image
ImageFrame &frame = (*_invShapes[itemNum])[0]; ImageFrame &frame = (*_invShapes[itemNum])[0];
bb.transBlitFrom(frame, Common::Point(6 + itemNum * 52 + ((47 - frame._width) / 2), bb.SHtransBlitFrom(frame, Common::Point(6 + itemNum * 52 + ((47 - frame._width) / 2),
163 + ((33 - frame._height) / 2))); 163 + ((33 - frame._height) / 2)));
} }

View file

@ -167,13 +167,13 @@ int ScalpelMap::show() {
setupSprites(); setupSprites();
if (!IS_3DO) { if (!IS_3DO) {
screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y));
} else { } else {
screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y));
screen.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); screen.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y));
} }
_drawMap = true; _drawMap = true;
@ -238,12 +238,12 @@ int ScalpelMap::show() {
changed = false; changed = false;
if (!IS_3DO) { if (!IS_3DO) {
screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[1], Common::Point(-_bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[2], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, -_bigPos.y));
screen._backBuffer1.blitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[3], Common::Point(SHERLOCK_SCREEN_WIDTH - _bigPos.x, SHERLOCK_SCREEN_HEIGHT - _bigPos.y));
} else { } else {
screen._backBuffer1.blitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y)); screen._backBuffer1.SHblitFrom((*bigMap)[0], Common::Point(-_bigPos.x, -_bigPos.y));
} }
showPlaces(); showPlaces();
@ -359,7 +359,6 @@ void ScalpelMap::freeSprites() {
delete _mapCursors; delete _mapCursors;
delete _shapes; delete _shapes;
delete _iconShapes; delete _iconShapes;
_iconSave.free();
} }
void ScalpelMap::showPlaces() { void ScalpelMap::showPlaces() {
@ -376,7 +375,7 @@ void ScalpelMap::showPlaces() {
if (pt.x >= _bigPos.x && (pt.x - _bigPos.x) < SHERLOCK_SCREEN_WIDTH if (pt.x >= _bigPos.x && (pt.x - _bigPos.x) < SHERLOCK_SCREEN_WIDTH
&& pt.y >= _bigPos.y && (pt.y - _bigPos.y) < SHERLOCK_SCREEN_HEIGHT) { && pt.y >= _bigPos.y && (pt.y - _bigPos.y) < SHERLOCK_SCREEN_HEIGHT) {
if (_vm->readFlags(idx)) { if (_vm->readFlags(idx)) {
screen._backBuffer1.transBlitFrom((*_iconShapes)[pt._translate], screen._backBuffer1.SHtransBlitFrom((*_iconShapes)[pt._translate],
Common::Point(pt.x - _bigPos.x - 6, pt.y - _bigPos.y - 12)); Common::Point(pt.x - _bigPos.x - 6, pt.y - _bigPos.y - 12));
} }
} }
@ -388,13 +387,13 @@ void ScalpelMap::showPlaces() {
} }
void ScalpelMap::saveTopLine() { void ScalpelMap::saveTopLine() {
_topLine.blitFrom(_vm->_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, 12)); _topLine.SHblitFrom(_vm->_screen->_backBuffer1, Common::Point(0, 0), Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, 12));
} }
void ScalpelMap::eraseTopLine() { void ScalpelMap::eraseTopLine() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
screen._backBuffer1.blitFrom(_topLine, Common::Point(0, 0)); screen._backBuffer1.SHblitFrom(_topLine, Common::Point(0, 0));
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.h()); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.height());
} }
void ScalpelMap::showPlaceName(int idx, bool highlighted) { void ScalpelMap::showPlaceName(int idx, bool highlighted) {
@ -409,7 +408,7 @@ void ScalpelMap::showPlaceName(int idx, bool highlighted) {
bool flipped = people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT bool flipped = people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT
|| people[HOLMES]._sequenceNumber == MAP_UPLEFT; || people[HOLMES]._sequenceNumber == MAP_UPLEFT;
screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, _lDrawnPos, flipped); screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, _lDrawnPos, flipped);
} }
if (highlighted) { if (highlighted) {
@ -451,9 +450,9 @@ void ScalpelMap::updateMap(bool flushScreen) {
saveIcon(people[HOLMES]._imageFrame, hPos); saveIcon(people[HOLMES]._imageFrame, hPos);
if (people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT if (people[HOLMES]._sequenceNumber == MAP_DOWNLEFT || people[HOLMES]._sequenceNumber == MAP_LEFT
|| people[HOLMES]._sequenceNumber == MAP_UPLEFT) || people[HOLMES]._sequenceNumber == MAP_UPLEFT)
screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, hPos, true); screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, hPos, true);
else else
screen._backBuffer1.transBlitFrom(*people[HOLMES]._imageFrame, hPos, false); screen._backBuffer1.SHtransBlitFrom(*people[HOLMES]._imageFrame, hPos, false);
if (flushScreen) { if (flushScreen) {
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
@ -553,8 +552,8 @@ void ScalpelMap::saveIcon(ImageFrame *src, const Common::Point &pt) {
return; return;
} }
assert(size.x <= _iconSave.w() && size.y <= _iconSave.h()); assert(size.x <= _iconSave.width() && size.y <= _iconSave.height());
_iconSave.blitFrom(screen._backBuffer1, Common::Point(0, 0), _iconSave.SHblitFrom(screen._backBuffer1, Common::Point(0, 0),
Common::Rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y)); Common::Rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y));
_savedPos = pos; _savedPos = pos;
_savedSize = size; _savedSize = size;
@ -565,7 +564,7 @@ void ScalpelMap::restoreIcon() {
if (_savedPos.x >= 0 && _savedPos.y >= 0 && _savedPos.x <= SHERLOCK_SCREEN_WIDTH if (_savedPos.x >= 0 && _savedPos.y >= 0 && _savedPos.x <= SHERLOCK_SCREEN_WIDTH
&& _savedPos.y < SHERLOCK_SCREEN_HEIGHT) && _savedPos.y < SHERLOCK_SCREEN_HEIGHT)
screen._backBuffer1.blitFrom(_iconSave, _savedPos, Common::Rect(0, 0, _savedSize.x, _savedSize.y)); screen._backBuffer1.SHblitFrom(_iconSave, _savedPos, Common::Rect(0, 0, _savedSize.x, _savedSize.y));
} }
void ScalpelMap::highlightIcon(const Common::Point &pt) { void ScalpelMap::highlightIcon(const Common::Point &pt) {

View file

@ -71,26 +71,26 @@ void ScalpelScene::drawAllShapes() {
// Draw all active shapes which are behind the person // Draw all active shapes which are behind the person
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND) if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND)
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
} }
// Draw all canimations which are behind the person // Draw all canimations which are behind the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == BEHIND) if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == BEHIND)
screen._backBuffer->transBlitFrom(*_canimShapes[idx]->_imageFrame, screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame,
_canimShapes[idx]->_position, _canimShapes[idx]->_flags & OBJ_FLIPPED); _canimShapes[idx]->_position, _canimShapes[idx]->_flags & OBJ_FLIPPED);
} }
// Draw all active shapes which are normal and behind the person // Draw all active shapes which are normal and behind the person
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND) if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND)
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
} }
// Draw all canimations which are normal and behind the person // Draw all canimations which are normal and behind the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == NORMAL_BEHIND) if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == NORMAL_BEHIND)
screen._backBuffer->transBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
_canimShapes[idx]->_flags & OBJ_FLIPPED); _canimShapes[idx]->_flags & OBJ_FLIPPED);
} }
@ -103,7 +103,7 @@ void ScalpelScene::drawAllShapes() {
p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT || p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT ||
p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT); p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT);
screen._backBuffer->transBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER, screen._backBuffer->SHtransBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER,
p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped); p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped);
} }
} }
@ -112,7 +112,7 @@ void ScalpelScene::drawAllShapes() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
_bgShapes[idx]._misc == NORMAL_FORWARD) _bgShapes[idx]._misc == NORMAL_FORWARD)
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
_bgShapes[idx]._flags & OBJ_FLIPPED); _bgShapes[idx]._flags & OBJ_FLIPPED);
} }
@ -120,7 +120,7 @@ void ScalpelScene::drawAllShapes() {
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) && if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) &&
_canimShapes[idx]->_misc == NORMAL_FORWARD) _canimShapes[idx]->_misc == NORMAL_FORWARD)
screen._backBuffer->transBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
_canimShapes[idx]->_flags & OBJ_FLIPPED); _canimShapes[idx]->_flags & OBJ_FLIPPED);
} }
@ -132,7 +132,7 @@ void ScalpelScene::drawAllShapes() {
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
_bgShapes[idx]._misc == FORWARD) _bgShapes[idx]._misc == FORWARD)
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
_bgShapes[idx]._flags & OBJ_FLIPPED); _bgShapes[idx]._flags & OBJ_FLIPPED);
} }
@ -140,7 +140,7 @@ void ScalpelScene::drawAllShapes() {
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) && if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) &&
_canimShapes[idx]->_misc == FORWARD) _canimShapes[idx]->_misc == FORWARD)
screen._backBuffer->transBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position, screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
_canimShapes[idx]->_flags & OBJ_FLIPPED); _canimShapes[idx]->_flags & OBJ_FLIPPED);
} }
@ -242,7 +242,7 @@ void ScalpelScene::doBgAnim() {
if (people[HOLMES]._type == CHARACTER) if (people[HOLMES]._type == CHARACTER)
screen.restoreBackground(bounds); screen.restoreBackground(bounds);
else if (people[HOLMES]._type == REMOVE) else if (people[HOLMES]._type == REMOVE)
screen._backBuffer->blitFrom(screen._backBuffer2, pt, bounds); screen._backBuffer->SHblitFrom(screen._backBuffer2, pt, bounds);
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
@ -261,7 +261,7 @@ void ScalpelScene::doBgAnim() {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if (o._type == NO_SHAPE && ((o._flags & OBJ_BEHIND) == 0)) { if (o._type == NO_SHAPE && ((o._flags & OBJ_BEHIND) == 0)) {
// Restore screen area // Restore screen area
screen._backBuffer->blitFrom(screen._backBuffer2, o._position, screen._backBuffer->SHblitFrom(screen._backBuffer2, o._position,
Common::Rect(o._position.x, o._position.y, Common::Rect(o._position.x, o._position.y,
o._position.x + o._noShapeSize.x, o._position.y + o._noShapeSize.y)); o._position.x + o._noShapeSize.x, o._position.y + o._noShapeSize.y));
@ -309,14 +309,14 @@ void ScalpelScene::doBgAnim() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND)
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
// Draw all canimations which are behind the person // Draw all canimations which are behind the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
Object &o = *_canimShapes[idx]; Object &o = *_canimShapes[idx];
if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) { if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) {
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
} }
@ -324,14 +324,14 @@ void ScalpelScene::doBgAnim() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND)
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
// Draw all canimations which are NORMAL and behind the person // Draw all canimations which are NORMAL and behind the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
Object &o = *_canimShapes[idx]; Object &o = *_canimShapes[idx];
if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) { if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) {
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
} }
@ -344,7 +344,7 @@ void ScalpelScene::doBgAnim() {
bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT || bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT ||
people[HOLMES]._sequenceNumber == WALK_UPLEFT || people[HOLMES]._sequenceNumber == STOP_UPLEFT || people[HOLMES]._sequenceNumber == WALK_UPLEFT || people[HOLMES]._sequenceNumber == STOP_UPLEFT ||
people[HOLMES]._sequenceNumber == WALK_DOWNRIGHT || people[HOLMES]._sequenceNumber == STOP_DOWNRIGHT; people[HOLMES]._sequenceNumber == WALK_DOWNRIGHT || people[HOLMES]._sequenceNumber == STOP_DOWNRIGHT;
screen._backBuffer->transBlitFrom(*people[HOLMES]._imageFrame, screen._backBuffer->SHtransBlitFrom(*people[HOLMES]._imageFrame,
Common::Point(tempX, people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->_frame.h), flipped); Common::Point(tempX, people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->_frame.h), flipped);
} }
@ -352,14 +352,14 @@ void ScalpelScene::doBgAnim() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD)
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
// Draw all static and active canimations that are NORMAL and are in front of the person // Draw all static and active canimations that are NORMAL and are in front of the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
Object &o = *_canimShapes[idx]; Object &o = *_canimShapes[idx];
if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) { if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) {
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
} }
@ -367,19 +367,19 @@ void ScalpelScene::doBgAnim() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD)
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
// Draw any active portrait // Draw any active portrait
if (people._portraitLoaded && people._portrait._type == ACTIVE_BG_SHAPE) if (people._portraitLoaded && people._portrait._type == ACTIVE_BG_SHAPE)
screen._backBuffer->transBlitFrom(*people._portrait._imageFrame, screen._backBuffer->SHtransBlitFrom(*people._portrait._imageFrame,
people._portrait._position, people._portrait._flags & OBJ_FLIPPED); people._portrait._position, people._portrait._flags & OBJ_FLIPPED);
// Draw all static and active canimations that are in front of the person // Draw all static and active canimations that are in front of the person
for (uint idx = 0; idx < _canimShapes.size(); ++idx) { for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
Object &o = *_canimShapes[idx]; Object &o = *_canimShapes[idx];
if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) { if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) {
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
} }
@ -387,7 +387,7 @@ void ScalpelScene::doBgAnim() {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx]; Object &o = _bgShapes[idx];
if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0) if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0)
screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
} }
// Bring the newly built picture to the screen // Bring the newly built picture to the screen

View file

@ -28,6 +28,8 @@ namespace Sherlock {
namespace Scalpel { namespace Scalpel {
ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) { ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) {
_backBuffer1.create(320, 200);
_backBuffer2.create(320, 200);
} }
void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX, void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
@ -123,255 +125,6 @@ void ScalpelScreen::makeField(const Common::Rect &r) {
_backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP); _backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
} }
/*----------------------------------------------------------------*/
void Scalpel3DOScreen::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
if (!_vm->_isScreenDoubled) {
ScalpelScreen::blitFrom(src, pt, srcBounds);
return;
}
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (!srcRect.isValidRect() || !clip(srcRect, destRect))
return;
// Add dirty area remapped to the 640x200 surface
addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2));
// Transfer the area, doubling each pixel
for (int yp = 0; yp < srcRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2);
for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
}
}
void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
if (!_vm->_isScreenDoubled) {
ScalpelScreen::transBlitFromUnscaled(src, pt, flipped, overrideColor);
return;
}
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x * 2, destPt.y * 2, (destPt.x + drawRect.width()) * 2,
(destPt.y + drawRect.height()) * 2));
assert(src.format.bytesPerPixel == 2 && _surface.format.bytesPerPixel == 2);
for (int yp = 0; yp < drawRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destPt.x * 2, (destPt.y + yp) * 2);
for (int xp = 0; xp < drawRect.width(); ++xp, destP += 2) {
// RGB 0, 0, 0 -> transparent on 3DO
if (*srcP) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
}
void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) {
if (_vm->_isScreenDoubled)
ScalpelScreen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color);
else
ScalpelScreen::fillRect(r, color);
}
void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
Events &events = *_vm->_events;
uint16 *currentScreenBasePtr = (uint16 *)getPixels();
uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
uint16 currentScreenPixel = 0;
uint16 targetScreenPixel = 0;
uint16 currentScreenPixelRed = 0;
uint16 currentScreenPixelGreen = 0;
uint16 currentScreenPixelBlue = 0;
uint16 targetScreenPixelRed = 0;
uint16 targetScreenPixelGreen = 0;
uint16 targetScreenPixelBlue = 0;
uint16 screenWidth = SHERLOCK_SCREEN_WIDTH;
uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT;
uint16 screenX = 0;
uint16 screenY = 0;
uint16 pixelsChanged = 0;
clearDirtyRects();
do {
pixelsChanged = 0;
uint16 *currentScreenPtr = currentScreenBasePtr;
uint16 *targetScreenPtr = targetScreenBasePtr;
for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *currentScreenPtr;
targetScreenPixel = *targetScreenPtr;
if (currentScreenPixel != targetScreenPixel) {
// pixel doesn't match, adjust accordingly
currentScreenPixelRed = currentScreenPixel & 0xF800;
currentScreenPixelGreen = currentScreenPixel & 0x07E0;
currentScreenPixelBlue = currentScreenPixel & 0x001F;
targetScreenPixelRed = targetScreenPixel & 0xF800;
targetScreenPixelGreen = targetScreenPixel & 0x07E0;
targetScreenPixelBlue = targetScreenPixel & 0x001F;
if (currentScreenPixelRed != targetScreenPixelRed) {
if (currentScreenPixelRed < targetScreenPixelRed) {
currentScreenPixelRed += 0x0800;
} else {
currentScreenPixelRed -= 0x0800;
}
}
if (currentScreenPixelGreen != targetScreenPixelGreen) {
// Adjust +2/-2 because we are running RGB555 at RGB565
if (currentScreenPixelGreen < targetScreenPixelGreen) {
currentScreenPixelGreen += 0x0040;
} else {
currentScreenPixelGreen -= 0x0040;
}
}
if (currentScreenPixelBlue != targetScreenPixelBlue) {
if (currentScreenPixelBlue < targetScreenPixelBlue) {
currentScreenPixelBlue += 0x0001;
} else {
currentScreenPixelBlue -= 0x0001;
}
}
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
if (_vm->_isScreenDoubled) {
*(currentScreenPtr + 1) = v;
*(currentScreenPtr + 640) = v;
*(currentScreenPtr + 640 + 1) = v;
}
pixelsChanged++;
}
currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
if (_vm->_isScreenDoubled)
currentScreenPtr += 640;
}
// Too much considered dirty at the moment
if (_vm->_isScreenDoubled)
addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
else
addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
events.pollEvents();
events.delay(10 * speed);
} while ((pixelsChanged) && (!_vm->shouldQuit()));
}
void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) {
uint16 *currentScreenPtr = (uint16 *)getPixels();
uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels();
uint16 currentScreenPixel = 0;
uint16 screenWidth = SHERLOCK_SCREEN_WIDTH;
uint16 screenHeight = SHERLOCK_SCREEN_HEIGHT;
uint16 screenX = 0;
uint16 screenY = 0;
uint16 currentScreenPixelRed = 0;
uint16 currentScreenPixelGreen = 0;
uint16 currentScreenPixelBlue = 0;
uint16 limitPixelRed = limitColor & 0xF800;
uint16 limitPixelGreen = limitColor & 0x07E0;
uint16 limitPixelBlue = limitColor & 0x001F;
for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *targetScreenPtr;
currentScreenPixelRed = currentScreenPixel & 0xF800;
currentScreenPixelGreen = currentScreenPixel & 0x07E0;
currentScreenPixelBlue = currentScreenPixel & 0x001F;
if (currentScreenPixelRed < limitPixelRed)
currentScreenPixelRed = limitPixelRed;
if (currentScreenPixelGreen < limitPixelGreen)
currentScreenPixelGreen = limitPixelGreen;
if (currentScreenPixelBlue < limitPixelBlue)
currentScreenPixelBlue = limitPixelBlue;
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
if (_vm->_isScreenDoubled) {
*(currentScreenPtr + 1) = v;
*(currentScreenPtr + 640) = v;
*(currentScreenPtr + 640 + 1) = v;
}
currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
if (_vm->_isScreenDoubled)
currentScreenPtr += 640;
}
// Too much considered dirty at the moment
if (_vm->_isScreenDoubled)
addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
else
addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
}
uint16 Scalpel3DOScreen::w() const {
return _vm->_isScreenDoubled ? _surface.w / 2 : _surface.w;
}
uint16 Scalpel3DOScreen::h() const {
return _vm->_isScreenDoubled ? _surface.h / 2 : _surface.h;
}
void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
addDirtyRect(destRect);
_surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
} // End of namespace Scalpel } // End of namespace Scalpel
} // End of namespace Sherlock } // End of namespace Sherlock

View file

@ -61,44 +61,6 @@ public:
void makeField(const Common::Rect &r); void makeField(const Common::Rect &r);
}; };
class Scalpel3DOScreen : public ScalpelScreen {
protected:
/**
* Draws a sub-section of a surface at a given position within this surface
* Overriden for the 3DO to automatically double the size of everything to the underlying 640x400 surface
*/
virtual void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds);
/**
* Draws a surface at a given position within this surface with transparency
*/
virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped,
int overrideColor);
public:
Scalpel3DOScreen(SherlockEngine *vm) : ScalpelScreen(vm) {}
virtual ~Scalpel3DOScreen() {}
/**
* Draws a sub-section of a surface at a given position within this surface
*/
void rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt);
/**
* Fade backbuffer 1 into screen (3DO RGB!)
*/
void fadeIntoScreen3DO(int speed);
void blitFrom3DOcolorLimit(uint16 color);
/**
* Fill a given area of the surface with a given color
*/
virtual void fillRect(const Common::Rect &r, uint color);
virtual uint16 w() const;
virtual uint16 h() const;
};
} // End of namespace Scalpel } // End of namespace Scalpel
} // End of namespace Sherlock } // End of namespace Sherlock

View file

@ -148,23 +148,24 @@ void ScalpelUserInterface::reset() {
void ScalpelUserInterface::drawInterface(int bufferNum) { void ScalpelUserInterface::drawInterface(int bufferNum) {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
const ImageFrame &src = (*_controlPanel)[0]; const Graphics::Surface &src = (*_controlPanel)[0]._frame;
int16 x = (!IS_3DO) ? 0 : UI_OFFSET_3DO; int16 x = (!IS_3DO) ? 0 : UI_OFFSET_3DO;
if (bufferNum & 1) { if (bufferNum & 1) {
if (IS_3DO) if (IS_3DO)
screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y, screen._backBuffer1.fillRect(Common::Rect(0, CONTROLS_Y,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK); SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK);
screen._backBuffer1.transBlitFrom(src, Common::Point(x, CONTROLS_Y)); screen._backBuffer1.SHtransBlitFrom(src, Common::Point(x, CONTROLS_Y));
} }
if (bufferNum & 2) { if (bufferNum & 2) {
if (IS_3DO) if (IS_3DO)
screen._backBuffer2.fillRect(Common::Rect(0, CONTROLS_Y, screen._backBuffer2.fillRect(Common::Rect(0, CONTROLS_Y,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK); SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT), BLACK);
screen._backBuffer2.transBlitFrom(src, Common::Point(x, CONTROLS_Y)); screen._backBuffer2.SHtransBlitFrom(src, Common::Point(x, CONTROLS_Y));
} }
if (bufferNum == 3) if (bufferNum == 3)
screen._backBuffer2.fillRect(0, INFO_LINE, SHERLOCK_SCREEN_WIDTH, INFO_LINE + 10, INFO_BLACK); screen._backBuffer2.SHfillRect(Common::Rect(0, INFO_LINE,
SHERLOCK_SCREEN_WIDTH, INFO_LINE + 10), INFO_BLACK);
} }
void ScalpelUserInterface::handleInput() { void ScalpelUserInterface::handleInput() {
@ -426,7 +427,7 @@ void ScalpelUserInterface::depressButton(int num) {
offsetButton3DO(pt, num); offsetButton3DO(pt, num);
ImageFrame &frame = (*_controls)[num]; ImageFrame &frame = (*_controls)[num];
screen._backBuffer1.transBlitFrom(frame, pt); screen._backBuffer1.SHtransBlitFrom(frame, pt);
screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height);
} }
@ -442,7 +443,7 @@ void ScalpelUserInterface::restoreButton(int num) {
events.setCursor(ARROW); events.setCursor(ARROW);
// Restore the UI on the back buffer // Restore the UI on the back buffer
screen._backBuffer1.blitFrom(screen._backBuffer2, pt, screen._backBuffer1.SHblitFrom(screen._backBuffer2, pt,
Common::Rect(pt.x, pt.y, pt.x + 90, pt.y + 19)); Common::Rect(pt.x, pt.y, pt.x + 90, pt.y + 19));
screen.slamArea(pt.x, pt.y, pt.x + frame.w, pt.y + frame.h); screen.slamArea(pt.x, pt.y, pt.x + frame.w, pt.y + frame.h);
@ -489,7 +490,7 @@ void ScalpelUserInterface::toggleButton(uint16 num) {
ImageFrame &frame = (*_controls)[num]; ImageFrame &frame = (*_controls)[num];
Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]); Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]);
offsetButton3DO(pt, num); offsetButton3DO(pt, num);
screen._backBuffer1.transBlitFrom(frame, pt); screen._backBuffer1.SHtransBlitFrom(frame, pt);
screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height);
} }
} else { } else {
@ -1272,7 +1273,7 @@ void ScalpelUserInterface::doLookControl() {
// Need to close the window and depress the Look button // Need to close the window and depress the Look button
Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]);
offsetButton3DO(pt, 0); offsetButton3DO(pt, 0);
screen._backBuffer2.blitFrom((*_controls)[0], pt); screen._backBuffer2.SHblitFrom((*_controls)[0], pt);
banishWindow(true); banishWindow(true);
_windowBounds.top = CONTROLS_Y1; _windowBounds.top = CONTROLS_Y1;
@ -1296,14 +1297,14 @@ void ScalpelUserInterface::doLookControl() {
// Looking at an inventory object // Looking at an inventory object
// Backup the user interface // Backup the user interface
Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y1); Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - CONTROLS_Y1);
tempSurface.blitFrom(screen._backBuffer2, Common::Point(0, 0), tempSurface.SHblitFrom(screen._backBuffer2, Common::Point(0, 0),
Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
inv.drawInventory(INVENTORY_DONT_DISPLAY); inv.drawInventory(INVENTORY_DONT_DISPLAY);
banishWindow(true); banishWindow(true);
// Restore the ui // Restore the ui
screen._backBuffer2.blitFrom(tempSurface, Common::Point(0, CONTROLS_Y1)); screen._backBuffer2.SHblitFrom(tempSurface, Common::Point(0, CONTROLS_Y1));
_windowBounds.top = CONTROLS_Y1; _windowBounds.top = CONTROLS_Y1;
_key = _oldKey = _hotkeyLook; _key = _oldKey = _hotkeyLook;
@ -1887,7 +1888,7 @@ void ScalpelUserInterface::journalControl() {
// Reset the palette // Reset the palette
screen.setPalette(screen._cMap); screen.setPalette(screen._cMap);
screen._backBuffer1.blitFrom(screen._backBuffer2); screen._backBuffer1.SHblitFrom(screen._backBuffer2);
scene.updateBackground(); scene.updateBackground();
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
} }
@ -1921,9 +1922,9 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]);
offsetButton3DO(pt, 0); offsetButton3DO(pt, 0);
tempSurface.blitFrom(screen._backBuffer2, Common::Point(0, 0), tempSurface.SHblitFrom(screen._backBuffer2, Common::Point(0, 0),
Common::Rect(pt.x, pt.y, pt.x + tempSurface.w(), pt.y + tempSurface.h())); Common::Rect(pt.x, pt.y, pt.x + tempSurface.width(), pt.y + tempSurface.height()));
screen._backBuffer2.transBlitFrom((*_controls)[0], pt); screen._backBuffer2.SHtransBlitFrom((*_controls)[0], pt);
banishWindow(1); banishWindow(1);
events.setCursor(MAGNIFY); events.setCursor(MAGNIFY);
@ -1933,7 +1934,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
_menuMode = LOOK_MODE; _menuMode = LOOK_MODE;
events.clearEvents(); events.clearEvents();
screen._backBuffer2.blitFrom(tempSurface, pt); screen._backBuffer2.SHblitFrom(tempSurface, pt);
} else { } else {
events.setCursor(ARROW); events.setCursor(ARROW);
banishWindow(true); banishWindow(true);
@ -2071,9 +2072,9 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp)
if (slideUp) { if (slideUp) {
// Gradually slide up the display of the window // Gradually slide up the display of the window
for (int idx = 1; idx <= bgSurface.h(); idx += 2) { for (int idx = 1; idx <= bgSurface.height(); idx += 2) {
screen._backBuffer->blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx), screen._backBuffer->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx),
Common::Rect(0, 0, bgSurface.w(), idx)); Common::Rect(0, 0, bgSurface.width(), idx));
screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx, screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
@ -2081,21 +2082,21 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp)
} }
} else { } else {
// Gradually slide down the display of the window // Gradually slide down the display of the window
for (int idx = 1; idx <= bgSurface.h(); idx += 2) { for (int idx = 1; idx <= bgSurface.height(); idx += 2) {
screen._backBuffer->blitFrom(bgSurface, screen._backBuffer->SHblitFrom(bgSurface,
Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()),
Common::Rect(0, bgSurface.h() - idx, bgSurface.w(), bgSurface.h())); Common::Rect(0, bgSurface.height() - idx, bgSurface.width(), bgSurface.height()));
screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(),
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.h() + idx)); SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.height() + idx));
events.delay(10); events.delay(10);
} }
} }
// Final display of the entire window // Final display of the entire window
screen._backBuffer->blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), screen._backBuffer->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()),
Common::Rect(0, 0, bgSurface.w(), bgSurface.h())); Common::Rect(0, 0, bgSurface.width(), bgSurface.height()));
screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), bgSurface.w(), bgSurface.h()); screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(), bgSurface.width(), bgSurface.height());
_windowOpen = true; _windowOpen = true;
} }
@ -2106,10 +2107,10 @@ void ScalpelUserInterface::summonWindow(bool slideUp, int height) {
// Extract the window that's been drawn on the back buffer // Extract the window that's been drawn on the back buffer
Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - height); Surface tempSurface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - height);
Common::Rect r(0, height, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); Common::Rect r(0, height, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
tempSurface.blitFrom(screen._backBuffer1, Common::Point(0, 0), r); tempSurface.SHblitFrom(screen._backBuffer1, Common::Point(0, 0), r);
// Remove drawn window with original user interface // Remove drawn window with original user interface
screen._backBuffer1.blitFrom(screen._backBuffer2, screen._backBuffer1.SHblitFrom(screen._backBuffer2,
Common::Point(0, height), r); Common::Point(0, height), r);
// Display the window gradually on-screen // Display the window gradually on-screen
@ -2133,7 +2134,7 @@ void ScalpelUserInterface::banishWindow(bool slideUp) {
Common::copy_backward(pSrc, pSrcEnd, pDest); Common::copy_backward(pSrc, pSrcEnd, pDest);
// Restore lines from the ui in the secondary back buffer // Restore lines from the ui in the secondary back buffer
screen._backBuffer1.blitFrom(screen._backBuffer2, screen._backBuffer1.SHblitFrom(screen._backBuffer2,
Common::Point(0, CONTROLS_Y), Common::Point(0, CONTROLS_Y),
Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + idx)); Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + idx));
@ -2143,14 +2144,14 @@ void ScalpelUserInterface::banishWindow(bool slideUp) {
} }
// Restore final two old lines // Restore final two old lines
screen._backBuffer1.blitFrom(screen._backBuffer2, screen._backBuffer1.SHblitFrom(screen._backBuffer2,
Common::Point(0, SHERLOCK_SCREEN_HEIGHT - 2), Common::Point(0, SHERLOCK_SCREEN_HEIGHT - 2),
Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 2, Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - 2,
SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - 2, SHERLOCK_SCREEN_WIDTH, 2); screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - 2, SHERLOCK_SCREEN_WIDTH, 2);
} else { } else {
// Restore old area to completely erase window // Restore old area to completely erase window
screen._backBuffer1.blitFrom(screen._backBuffer2, screen._backBuffer1.SHblitFrom(screen._backBuffer2,
Common::Point(0, CONTROLS_Y), Common::Point(0, CONTROLS_Y),
Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH,
@ -2170,7 +2171,7 @@ void ScalpelUserInterface::banishWindow(bool slideUp) {
} }
// Show entire final area // Show entire final area
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(0, CONTROLS_Y1),
Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen.slamRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
} }

View file

@ -217,7 +217,7 @@ void Object::erase() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
if (_visage.isLoaded() && !_oldBounds.isEmpty()) if (_visage.isLoaded() && !_oldBounds.isEmpty())
screen.blitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds); screen.SHblitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds);
} }
void Object::update() { void Object::update() {
@ -246,9 +246,9 @@ void Object::update() {
_visage.getFrame(s, _frame); _visage.getFrame(s, _frame);
// Display the frame // Display the frame
_oldBounds = Common::Rect(_position.x, _position.y, _position.x + s.w(), _position.y + s.h()); _oldBounds = Common::Rect(_position.x, _position.y, _position.x + s.width(), _position.y + s.height());
_oldBounds.translate(-s._centroid.x, -s._centroid.y); _oldBounds.translate(-s._centroid.x, -s._centroid.y);
screen.transBlitFrom(s, Common::Point(_oldBounds.left, _oldBounds.top)); screen.SHtransBlitFrom(s, Common::Point(_oldBounds.left, _oldBounds.top));
} }
} }
@ -652,7 +652,7 @@ void Logo::loadBackground() {
screen.setPalette(palette); screen.setPalette(palette);
// Copy the surface to the screen // Copy the surface to the screen
screen.blitFrom(screen._backBuffer1); screen.SHblitFrom(screen._backBuffer1);
} }
void Logo::fade(const byte palette[PALETTE_SIZE], int step) { void Logo::fade(const byte palette[PALETTE_SIZE], int step) {

View file

@ -27,6 +27,7 @@
#include "sherlock/scalpel/scalpel_people.h" #include "sherlock/scalpel/scalpel_people.h"
#include "sherlock/scalpel/scalpel_scene.h" #include "sherlock/scalpel/scalpel_scene.h"
#include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/3do/scalpel_3do_screen.h"
#include "sherlock/tattoo/tattoo.h" #include "sherlock/tattoo/tattoo.h"
#include "sherlock/tattoo/tattoo_scene.h" #include "sherlock/tattoo/tattoo_scene.h"
#include "sherlock/tattoo/tattoo_user_interface.h" #include "sherlock/tattoo/tattoo_user_interface.h"
@ -356,7 +357,7 @@ bool Scene::loadScene(const Common::String &filename) {
if (IS_ROSE_TATTOO) { if (IS_ROSE_TATTOO) {
// Resize the screen if necessary // Resize the screen if necessary
int fullWidth = SHERLOCK_SCREEN_WIDTH + bgHeader._scrollSize; int fullWidth = SHERLOCK_SCREEN_WIDTH + bgHeader._scrollSize;
if (screen._backBuffer1.w() != fullWidth) { if (screen._backBuffer1.width() != fullWidth) {
screen._backBuffer1.create(fullWidth, SHERLOCK_SCREEN_HEIGHT); screen._backBuffer1.create(fullWidth, SHERLOCK_SCREEN_HEIGHT);
screen._backBuffer2.create(fullWidth, SHERLOCK_SCREEN_HEIGHT); screen._backBuffer2.create(fullWidth, SHERLOCK_SCREEN_HEIGHT);
} }
@ -649,7 +650,7 @@ bool Scene::loadScene(const Common::String &filename) {
} }
// Backup the image and set the palette // Backup the image and set the palette
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
screen.setPalette(screen._cMap); screen.setPalette(screen._cMap);
delete rrmStream; delete rrmStream;
@ -996,12 +997,12 @@ bool Scene::loadScene(const Common::String &filename) {
#if 0 #if 0
// code to show the background // code to show the background
screen.blitFrom(screen._backBuffer1); screen.SHblitFrom(screen._backBuffer1);
_vm->_events->wait(10000); _vm->_events->wait(10000);
#endif #endif
// Backup the image // Backup the image
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
} }
// Handle drawing any on-screen interface // Handle drawing any on-screen interface
@ -1236,7 +1237,7 @@ void Scene::transitionToScene() {
// If the scene is capable of scrolling, set the current scroll so that whoever has control // If the scene is capable of scrolling, set the current scroll so that whoever has control
// of the scroll code is in the middle of the screen // of the scroll code is in the middle of the screen
if (screen._backBuffer1.w() > SHERLOCK_SCREEN_WIDTH) if (screen._backBuffer1.width() > SHERLOCK_SCREEN_WIDTH)
people[people._walkControl].centerScreenOnPerson(); people[people._walkControl].centerScreenOnPerson();
for (uint objIdx = 0; objIdx < _bgShapes.size(); ++objIdx) { for (uint objIdx = 0; objIdx < _bgShapes.size(); ++objIdx) {

View file

@ -23,6 +23,8 @@
#include "sherlock/screen.h" #include "sherlock/screen.h"
#include "sherlock/sherlock.h" #include "sherlock/sherlock.h"
#include "sherlock/scalpel/scalpel_screen.h" #include "sherlock/scalpel/scalpel_screen.h"
#include "sherlock/scalpel/3do/scalpel_3do_screen.h"
#include "sherlock/tattoo/tattoo_screen.h"
#include "common/system.h" #include "common/system.h"
#include "common/util.h" #include "common/util.h"
#include "graphics/palette.h" #include "graphics/palette.h"
@ -31,17 +33,14 @@ namespace Sherlock {
Screen *Screen::init(SherlockEngine *vm) { Screen *Screen::init(SherlockEngine *vm) {
if (vm->getGameID() == GType_RoseTattoo) if (vm->getGameID() == GType_RoseTattoo)
return new Screen(vm); return new Tattoo::TattooScreen(vm);
else if (vm->getPlatform() == Common::kPlatform3DO) else if (vm->getPlatform() == Common::kPlatform3DO)
return new Scalpel::Scalpel3DOScreen(vm); return new Scalpel::Scalpel3DOScreen(vm);
else else
return new Scalpel::ScalpelScreen(vm); return new Scalpel::ScalpelScreen(vm);
} }
Screen::Screen(SherlockEngine *vm) : Surface(g_system->getWidth(), g_system->getHeight()), _vm(vm), Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm), _backBuffer(&_backBuffer1) {
_backBuffer1(vm->getGameID() == GType_RoseTattoo ? 640 : 320, vm->getGameID() == GType_RoseTattoo ? 480 : 200),
_backBuffer2(vm->getGameID() == GType_RoseTattoo ? 640 : 320, vm->getGameID() == GType_RoseTattoo ? 480 : 200),
_backBuffer(&_backBuffer1) {
_transitionSeed = 1; _transitionSeed = 1;
_fadeStyle = false; _fadeStyle = false;
Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0); Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0);
@ -58,37 +57,7 @@ Screen::Screen(SherlockEngine *vm) : Surface(g_system->getWidth(), g_system->get
} }
Screen::~Screen() { Screen::~Screen() {
Fonts::free(); Fonts::freeFont();
}
void Screen::update() {
// Merge the dirty rects
mergeDirtyRects();
// Loop through copying dirty areas to the physical screen
Common::List<Common::Rect>::iterator i;
for (i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) {
const Common::Rect &r = *i;
const byte *srcP = (const byte *)getBasePtr(r.left, r.top);
g_system->copyRectToScreen(srcP, _surface.pitch, r.left, r.top,
r.width(), r.height());
}
// Signal the physical screen to update
g_system->updateScreen();
_dirtyRects.clear();
}
void Screen::makeAllDirty() {
addDirtyRect(Common::Rect(0, 0, this->w(), this->h()));
}
void Screen::getPalette(byte palette[PALETTE_SIZE]) {
g_system->getPaletteManager()->grabPalette(palette, 0, PALETTE_COUNT);
}
void Screen::setPalette(const byte palette[PALETTE_SIZE]) {
g_system->getPaletteManager()->setPalette(palette, 0, PALETTE_COUNT);
} }
int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) { int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) {
@ -124,7 +93,7 @@ void Screen::fadeToBlack(int speed) {
} }
setPalette(tempPalette); setPalette(tempPalette);
fillRect(Common::Rect(0, 0, _surface.w, _surface.h), 0); fillRect(Common::Rect(0, 0, this->w, this->h), 0);
} }
void Screen::fadeIn(const byte palette[PALETTE_SIZE], int speed) { void Screen::fadeIn(const byte palette[PALETTE_SIZE], int speed) {
@ -136,59 +105,23 @@ void Screen::fadeIn(const byte palette[PALETTE_SIZE], int speed) {
setPalette(palette); setPalette(palette);
} }
void Screen::addDirtyRect(const Common::Rect &r) {
_dirtyRects.push_back(r);
assert(r.width() > 0 && r.height() > 0);
}
void Screen::mergeDirtyRects() {
Common::List<Common::Rect>::iterator rOuter, rInner;
// Process the dirty rect list to find any rects to merge
for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) {
rInner = rOuter;
while (++rInner != _dirtyRects.end()) {
if ((*rOuter).intersects(*rInner)) {
// these two rectangles overlap or
// are next to each other - merge them
unionRectangle(*rOuter, *rOuter, *rInner);
// remove the inner rect from the list
_dirtyRects.erase(rInner);
// move back to beginning of list
rInner = rOuter;
}
}
}
}
bool Screen::unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2) {
destRect = src1;
destRect.extend(src2);
return !destRect.isEmpty();
}
void Screen::randomTransition() { void Screen::randomTransition() {
Events &events = *_vm->_events; Events &events = *_vm->_events;
const int TRANSITION_MULTIPLIER = 0x15a4e35; const int TRANSITION_MULTIPLIER = 0x15a4e35;
_dirtyRects.clear(); clearDirtyRects();
assert(IS_SERRATED_SCALPEL); assert(IS_SERRATED_SCALPEL);
for (int idx = 0; idx <= 65535 && !_vm->shouldQuit(); ++idx) { for (int idx = 0; idx <= 65535 && !_vm->shouldQuit(); ++idx) {
_transitionSeed = _transitionSeed * TRANSITION_MULTIPLIER + 1; _transitionSeed = _transitionSeed * TRANSITION_MULTIPLIER + 1;
int offset = _transitionSeed & 0xFFFF; int offset = _transitionSeed & 0xFFFF;
if (offset < (this->w() * this->h())) if (offset < (this->width() * this->height()))
*((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset); *((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset);
if (idx != 0 && (idx % 300) == 0) { if (idx != 0 && (idx % 300) == 0) {
// Ensure there's a full screen dirty rect for the next frame update // Ensure there's a full screen dirty rect for the next frame update
if (_dirtyRects.empty()) if (!isDirty())
addDirtyRect(Common::Rect(0, 0, _surface.w, _surface.h)); addDirtyRect(Common::Rect(0, 0, this->w, this->h));
events.pollEvents(); events.pollEvents();
events.delay(1); events.delay(1);
@ -196,7 +129,7 @@ void Screen::randomTransition() {
} }
// Make sure everything has been transferred // Make sure everything has been transferred
blitFrom(*_backBuffer); SHblitFrom(*_backBuffer);
} }
void Screen::verticalTransition() { void Screen::verticalTransition() {
@ -205,13 +138,13 @@ void Screen::verticalTransition() {
byte table[640]; byte table[640];
Common::fill(&table[0], &table[640], 0); Common::fill(&table[0], &table[640], 0);
for (int yp = 0; yp < this->h(); ++yp) { for (int yp = 0; yp < this->height(); ++yp) {
for (int xp = 0; xp < this->w(); ++xp) { for (int xp = 0; xp < this->width(); ++xp) {
int temp = (table[xp] >= (this->h() - 3)) ? this->h() - table[xp] : int temp = (table[xp] >= (this->height() - 3)) ? this->height() - table[xp] :
_vm->getRandomNumber(3) + 1; _vm->getRandomNumber(3) + 1;
if (temp) { if (temp) {
blitFrom(_backBuffer1, Common::Point(xp, table[xp]), SHblitFrom(_backBuffer1, Common::Point(xp, table[xp]),
Common::Rect(xp, table[xp], xp + 1, table[xp] + temp)); Common::Rect(xp, table[xp], xp + 1, table[xp] + temp));
table[xp] += temp; table[xp] += temp;
} }
@ -223,7 +156,7 @@ void Screen::verticalTransition() {
void Screen::restoreBackground(const Common::Rect &r) { void Screen::restoreBackground(const Common::Rect &r) {
if (r.width() > 0 && r.height() > 0) if (r.width() > 0 && r.height() > 0)
_backBuffer->blitFrom(_backBuffer2, Common::Point(r.left, r.top), r); _backBuffer->SHblitFrom(_backBuffer2, Common::Point(r.left, r.top), r);
} }
void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) { void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) {
@ -254,11 +187,10 @@ void Screen::slamRect(const Common::Rect &r) {
} }
if (srcRect.isValidRect()) if (srcRect.isValidRect())
blitFrom(*_backBuffer, Common::Point(destRect.left, destRect.top), srcRect); SHblitFrom(*_backBuffer, Common::Point(destRect.left, destRect.top), srcRect);
} }
} }
void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp, void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
int16 *width, int16 *height) { int16 *width, int16 *height) {
Common::Point imgPos = pt + frame->_offset; Common::Point imgPos = pt + frame->_offset;
@ -335,7 +267,7 @@ void Screen::blockMove(const Common::Rect &r) {
} }
void Screen::blockMove() { void Screen::blockMove() {
blockMove(Common::Rect(0, 0, w(), h())); blockMove(Common::Rect(0, 0, width(), height()));
} }
void Screen::print(const Common::Point &pt, uint color, const char *formatStr, ...) { void Screen::print(const Common::Point &pt, uint color, const char *formatStr, ...) {
@ -351,13 +283,13 @@ void Screen::print(const Common::Point &pt, uint color, const char *formatStr, .
pos.y--; // Font is always drawing one line higher pos.y--; // Font is always drawing one line higher
if (!pos.x) if (!pos.x)
// Center text horizontally // Center text horizontally
pos.x = (this->w() - width) / 2; pos.x = (this->width() - width) / 2;
Common::Rect textBounds(pos.x, pos.y, pos.x + width, pos.y + _fontHeight); Common::Rect textBounds(pos.x, pos.y, pos.x + width, pos.y + _fontHeight);
if (textBounds.right > this->w()) if (textBounds.right > this->width())
textBounds.moveTo(this->w() - width, textBounds.top); textBounds.moveTo(this->width() - width, textBounds.top);
if (textBounds.bottom > this->h()) if (textBounds.bottom > this->height())
textBounds.moveTo(textBounds.left, this->h() - _fontHeight); textBounds.moveTo(textBounds.left, this->height() - _fontHeight);
// Write out the string at the given position // Write out the string at the given position
writeString(str, Common::Point(textBounds.left, textBounds.top), color); writeString(str, Common::Point(textBounds.left, textBounds.top), color);
@ -387,7 +319,8 @@ void Screen::vgaBar(const Common::Rect &r, int color) {
} }
void Screen::setDisplayBounds(const Common::Rect &r) { void Screen::setDisplayBounds(const Common::Rect &r) {
_sceneSurface.setPixels(_backBuffer1.getBasePtr(r.left, r.top), r.width(), r.height(), _backBuffer1.getPixelFormat()); _sceneSurface.setPixels((byte *)_backBuffer1.getBasePtr(r.left, r.top),
r.width(), r.height(), _backBuffer1.format);
_backBuffer = &_sceneSurface; _backBuffer = &_sceneSurface;
} }
@ -397,8 +330,8 @@ void Screen::resetDisplayBounds() {
} }
Common::Rect Screen::getDisplayBounds() { Common::Rect Screen::getDisplayBounds() {
return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.w(), _sceneSurface.h()) : return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.width(), _sceneSurface.height()) :
Common::Rect(0, 0, this->w(), this->h()); Common::Rect(0, 0, this->width(), this->height());
} }
void Screen::synchronize(Serializer &s) { void Screen::synchronize(Serializer &s) {

View file

@ -25,52 +25,30 @@
#include "common/list.h" #include "common/list.h"
#include "common/rect.h" #include "common/rect.h"
#include "graphics/screen.h"
#include "sherlock/image_file.h"
#include "sherlock/surface.h" #include "sherlock/surface.h"
#include "sherlock/resources.h" #include "sherlock/resources.h"
#include "sherlock/saveload.h" #include "sherlock/saveload.h"
namespace Sherlock { namespace Sherlock {
#define PALETTE_SIZE 768
#define PALETTE_COUNT 256
#define VGA_COLOR_TRANS(x) ((x) * 255 / 63) #define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
#define BG_GREYSCALE_RANGE_END 229 #define BG_GREYSCALE_RANGE_END 229
#define BLACK 0 #define BLACK 0
class SherlockEngine; class SherlockEngine;
class Screen : public Surface { class Screen : virtual public Graphics::Screen, virtual public Surface {
private: private:
Common::List<Common::Rect> _dirtyRects;
uint32 _transitionSeed; uint32 _transitionSeed;
Surface _sceneSurface; Surface _sceneSurface;
// Rose Tattoo fields // Rose Tattoo fields
int _fadeBytesRead, _fadeBytesToRead; int _fadeBytesRead, _fadeBytesToRead;
int _oldFadePercent; int _oldFadePercent;
private:
/**
* Merges together overlapping dirty areas of the screen
*/
void mergeDirtyRects();
/**
* Returns the union of two dirty area rectangles
*/
bool unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2);
protected: protected:
SherlockEngine *_vm; SherlockEngine *_vm;
/**
* Clear the current dirty rects list
*/
void clearDirtyRects() { _dirtyRects.clear(); }
/**
* Adds a rectangle to the list of modified areas of the screen during the
* current frame
*/
virtual void addDirtyRect(const Common::Rect &r);
public: public:
Surface _backBuffer1, _backBuffer2; Surface _backBuffer1, _backBuffer2;
Surface *_backBuffer; Surface *_backBuffer;
@ -85,26 +63,6 @@ public:
Screen(SherlockEngine *vm); Screen(SherlockEngine *vm);
virtual ~Screen(); virtual ~Screen();
/**
* Handles updating any dirty areas of the screen Surface object to the physical screen
*/
void update();
/**
* Makes the whole screen dirty
*/
void makeAllDirty();
/**
* Return the currently active palette
*/
void getPalette(byte palette[PALETTE_SIZE]);
/**
* Set the palette
*/
void setPalette(const byte palette[PALETTE_SIZE]);
/** /**
* Fades from the currently active palette to the passed palette * Fades from the currently active palette to the passed palette
*/ */

View file

@ -63,9 +63,9 @@ enum GameType {
GType_RoseTattoo = 1 GType_RoseTattoo = 1
}; };
#define SHERLOCK_SCREEN_WIDTH _vm->_screen->w() #define SHERLOCK_SCREEN_WIDTH _vm->_screen->width()
#define SHERLOCK_SCREEN_HEIGHT _vm->_screen->h() #define SHERLOCK_SCREEN_HEIGHT _vm->_screen->height()
#define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.w() #define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.width()
#define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480) #define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480)
#define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101) #define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101)
#define MAX_BGSHAPES (IS_SERRATED_SCALPEL ? 64 : 150) #define MAX_BGSHAPES (IS_SERRATED_SCALPEL ? 64 : 150)

View file

@ -21,245 +21,24 @@
*/ */
#include "sherlock/surface.h" #include "sherlock/surface.h"
#include "sherlock/sherlock.h" #include "sherlock/fonts.h"
#include "sherlock/resources.h"
#include "common/system.h"
#include "graphics/palette.h"
namespace Sherlock { namespace Sherlock {
Surface::Surface(uint16 width, uint16 height) : Fonts(), _freePixels(true) { Surface::Surface() : Graphics::ManagedSurface(), Fonts() {
}
Surface::Surface(int width, int height) : Graphics::ManagedSurface(width, height),
Fonts() {
create(width, height); create(width, height);
} }
Surface::Surface() : Fonts(), _freePixels(false) { void Surface::setPixels(byte *pixelsPtr, int sizeX, int sizeY, const Graphics::PixelFormat &pixFormat) {
} Graphics::ManagedSurface::setPixels(pixelsPtr);
this->format = pixFormat;
Surface::~Surface() { this->w = sizeX;
if (_freePixels) this->h = sizeY;
_surface.free(); this->pitch = sizeX * pixFormat.bytesPerPixel;
}
void Surface::create(uint16 width, uint16 height) {
if (_freePixels)
_surface.free();
if (_vm->getPlatform() == Common::kPlatform3DO) {
_surface.create(width, height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
} else {
_surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
}
_freePixels = true;
}
Graphics::PixelFormat Surface::getPixelFormat() {
return _surface.format;
}
void Surface::blitFrom(const Surface &src) {
blitFrom(src, Common::Point(0, 0));
}
void Surface::blitFrom(const ImageFrame &src) {
blitFrom(src._frame, Common::Point(0, 0));
}
void Surface::blitFrom(const Graphics::Surface &src) {
blitFrom(src, Common::Point(0, 0));
}
void Surface::blitFrom(const Surface &src, const Common::Point &pt) {
blitFrom(src, pt, Common::Rect(0, 0, src._surface.w, src._surface.h));
}
void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt) {
blitFrom(src._frame, pt, Common::Rect(0, 0, src._frame.w, src._frame.h));
}
void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) {
blitFrom(src, pt, Common::Rect(0, 0, src.w, src.h));
}
void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (srcRect.isValidRect() && clip(srcRect, destRect)) {
// Surface is at least partially or completely on-screen
addDirtyRect(destRect);
_surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
}
void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt, const Common::Rect &srcBounds) {
blitFrom(src._frame, pt, srcBounds);
}
void Surface::blitFrom(const Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
blitFrom(src._surface, pt, srcBounds);
}
void Surface::transBlitFrom(const ImageFrame &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
Common::Point drawPt(pt.x + src.sDrawXOffset(scaleVal), pt.y + src.sDrawYOffset(scaleVal));
transBlitFrom(src._frame, drawPt, flipped, overrideColor, scaleVal);
}
void Surface::transBlitFrom(const Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
const Graphics::Surface &s = src._surface;
transBlitFrom(s, pt, flipped, overrideColor, scaleVal);
}
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
if (scaleVal == SCALE_THRESHOLD) {
transBlitFromUnscaled(src, pt, flipped, overrideColor);
return;
}
int destWidth = src.w * SCALE_THRESHOLD / scaleVal;
int destHeight = src.h * SCALE_THRESHOLD / scaleVal;
// Loop through drawing output lines
for (int destY = pt.y, scaleYCtr = 0; destY < (pt.y + destHeight); ++destY, scaleYCtr += scaleVal) {
if (destY < 0 || destY >= this->h())
continue;
const byte *srcLine = (const byte *)src.getBasePtr(0, scaleYCtr / SCALE_THRESHOLD);
byte *destLine = (byte *)getBasePtr(pt.x, destY);
// Loop through drawing individual rows
for (int xCtr = 0, scaleXCtr = 0; xCtr < destWidth; ++xCtr, scaleXCtr += scaleVal) {
int destX = pt.x + xCtr;
if (destX < 0 || destX >= this->w())
continue;
byte srcVal = srcLine[flipped ? src.w - scaleXCtr / SCALE_THRESHOLD - 1 : scaleXCtr / SCALE_THRESHOLD];
if (srcVal != TRANSPARENCY)
destLine[xCtr] = srcVal;
}
}
// Mark the affected area
addDirtyRect(Common::Rect(pt.x, pt.y, pt.x + destWidth, pt.y + destHeight));
}
void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, drawRect.top,
src.w - drawRect.left, drawRect.bottom);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
destPt.y + drawRect.height()));
switch (src.format.bytesPerPixel) {
case 1:
// 8-bit palettized: Draw loop
assert(_surface.format.bytesPerPixel == 1); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const byte *srcP = (const byte *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP != TRANSPARENCY)
*destP = overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
case 2:
// 3DO 15-bit RGB565: Draw loop
assert(_surface.format.bytesPerPixel == 2); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP) // RGB 0, 0, 0 -> transparent on 3DO
*destP = *srcP; // overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
default:
error("Surface: unsupported bytesperpixel");
break;
}
}
void Surface::fillRect(int x1, int y1, int x2, int y2, uint color) {
fillRect(Common::Rect(x1, y1, x2, y2), color);
}
void Surface::fillRect(const Common::Rect &r, uint color) {
_surface.fillRect(r, color);
addDirtyRect(r);
}
void Surface::fill(uint color) {
fillRect(Common::Rect(_surface.w, _surface.h), color);
}
bool Surface::clip(Common::Rect &srcBounds, Common::Rect &destBounds) {
if (destBounds.left >= w() || destBounds.top >= h() ||
destBounds.right <= 0 || destBounds.bottom <= 0)
return false;
// Clip the bounds if necessary to fit on-screen
if (destBounds.right > w()) {
srcBounds.right -= destBounds.right - w();
destBounds.right = w();
}
if (destBounds.bottom > h()) {
srcBounds.bottom -= destBounds.bottom - h();
destBounds.bottom = h();
}
if (destBounds.top < 0) {
srcBounds.top += -destBounds.top;
destBounds.top = 0;
}
if (destBounds.left < 0) {
srcBounds.left += -destBounds.left;
destBounds.left = 0;
}
return true;
}
void Surface::clear() {
fillRect(Common::Rect(0, 0, w(), h()), 0);
}
void Surface::free() {
if (_freePixels) {
_surface.free();
_freePixels = false;
}
}
void Surface::setPixels(byte *pixels, int width, int height, Graphics::PixelFormat pixelFormat) {
_surface.format = pixelFormat;
_surface.w = width;
_surface.h = height;
_surface.pitch = width * pixelFormat.bytesPerPixel;
_surface.setPixels(pixels);
} }
void Surface::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) { void Surface::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) {
@ -278,4 +57,21 @@ void Surface::writeFancyString(const Common::String &str, const Common::Point &p
writeString(str, Common::Point(pt.x + 1, pt.y + 1), overrideColor2); writeString(str, Common::Point(pt.x + 1, pt.y + 1), overrideColor2);
} }
void Surface::SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
Common::Point drawPt(pt.x + src.sDrawXOffset(scaleVal), pt.y + src.sDrawYOffset(scaleVal));
SHtransBlitFrom(src._frame, drawPt, flipped, overrideColor, scaleVal);
}
void Surface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w * SCALE_THRESHOLD / scaleVal,
pt.y + src.h * SCALE_THRESHOLD / scaleVal);
Graphics::ManagedSurface::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
flipped, overrideColor);
}
} // End of namespace Sherlock } // End of namespace Sherlock

View file

@ -20,165 +20,101 @@
* *
*/ */
#ifndef SHERLOCK_GRAPHICS_H #ifndef SHERLOCK_SURFACE_H
#define SHERLOCK_GRAPHICS_H #define SHERLOCK_SURFACE_H
#include "common/rect.h" #include "common/rect.h"
#include "common/platform.h" #include "common/platform.h"
#include "graphics/surface.h" #include "graphics/managed_surface.h"
#include "sherlock/fonts.h" #include "sherlock/fonts.h"
#include "sherlock/image_file.h"
namespace Sherlock { namespace Sherlock {
#define SCALE_THRESHOLD 0x100 #define SCALE_THRESHOLD 0x100
#define TRANSPARENCY 255 #define TRANSPARENCY 255
struct ImageFrame; /**
* Implements a descendent surface that combines both a managed surface and the font
class Surface: public Fonts { * drawing code. It also introduces a series of drawing method stubs that the 3DO
private: * Serrated Scalpel screen overrides to implement sprite doubling
bool _freePixels; */
class Surface: virtual public Graphics::ManagedSurface, public Fonts {
/**
* Copy a surface into this one
*/
void blitFrom(const Graphics::Surface &src);
protected:
Graphics::Surface _surface;
/**
* Clips the given source bounds so the passed destBounds will be entirely on-screen
*/
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds);
/**
* Base method stub for signalling dirty rect areas
*/
virtual void addDirtyRect(const Common::Rect &r) {}
/**
* Draws a sub-section of a surface at a given position within this surface
*/
virtual void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds);
/**
* Draws a surface at a given position within this surface with transparency
*/
virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped,
int overrideColor);
public: public:
Surface(uint16 width, uint16 height); /**
* Constructor
*/
Surface(); Surface();
virtual ~Surface();
/**
* Constructor
*/
Surface(int width, int height);
/** /**
* Sets up an internal surface with the specified dimensions that will be automatically freed * Set the surface details
* when the surface object is destroyed
*/ */
void create(uint16 width, uint16 height); void setPixels(byte *pixelsPtr, int sizeX, int sizeY, const Graphics::PixelFormat &pixFormat);
Graphics::PixelFormat getPixelFormat();
/** /**
* Copy a surface into this one * Draws a surface on this surface
*/ */
void blitFrom(const Surface &src); virtual void SHblitFrom(const Graphics::Surface &src) {
Graphics::ManagedSurface::blitFrom(src);
/** }
* Copy an image frame into this surface
*/
void blitFrom(const ImageFrame &src);
/** /**
* Draws a surface at a given position within this surface * Draws a surface at a given position within this surface
*/ */
void blitFrom(const Surface &src, const Common::Point &pt); virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos) {
Graphics::ManagedSurface::blitFrom(src, destPos);
/** }
* Copy an image frame onto this surface at a given position
*/
void blitFrom(const ImageFrame &src, const Common::Point &pt);
/** /**
* Draws a sub-section of a surface at a given position within this surface * Draws a sub-section of a surface at a given position within this surface
*/ */
void blitFrom(const Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos, const Common::Rect &srcBounds) {
Graphics::ManagedSurface::blitFrom(src, srcBounds, destPos);
/** }
* Copy a sub-area of a source image frame into this surface at a given position
*/
void blitFrom(const ImageFrame &src, const Common::Point &pt, const Common::Rect &srcBounds);
/**
* Draws a surface at a given position within this surface
*/
void blitFrom(const Graphics::Surface &src, const Common::Point &pt);
/** /**
* Draws an image frame at a given position within this surface with transparency * Draws an image frame at a given position within this surface with transparency
*/ */
void transBlitFrom(const ImageFrame &src, const Common::Point &pt, void SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
bool flipped = false, int overrideColor = 0, int scaleVal = 256); bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
/**
* Draws a surface at a given position within this surface with transparency
*/
void transBlitFrom(const Surface &src, const Common::Point &pt,
bool flipped = false, int overrideColor = 0, int scaleVal = 256);
/** /**
* Draws a surface at a given position within this surface with transparency * Draws an image frame at a given position within this surface with transparency
*/ */
void transBlitFrom(const Graphics::Surface &src, const Common::Point &pt, void SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped = false, int overrideColor = 0, int scaleVal = 256); bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
/** /**
* Fill a given area of the surface with a given color * Fill a given area of the surface with a given color
*/ */
void fillRect(int x1, int y1, int x2, int y2, uint color); virtual void SHfillRect(const Common::Rect &r, uint color) {
Graphics::ManagedSurface::fillRect(r, color);
}
/**
* Return the width of the surface
*/
virtual uint16 width() const { return this->w; }
/** /**
* Fill a given area of the surface with a given color * Return the height of the surface
*/ */
virtual void fillRect(const Common::Rect &r, uint color); virtual uint16 height() const { return this->h; }
void fill(uint color);
/**
* Clear the surface
*/
void clear();
/**
* Free the underlying surface
*/
void free();
/**
* Returns true if the surface is empty
*/
bool empty() const { return _surface.getPixels() == nullptr; }
/**
* Set the pixels for the surface to an existing data block
*/
void setPixels(byte *pixels, int width, int height, Graphics::PixelFormat format);
/** /**
* Draws the given string into the back buffer using the images stored in _font * Draws the given string into the back buffer using the images stored in _font
*/ */
virtual void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor); void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor);
/**
* Draws a fancy version of the given string at the given position
*/
void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2); void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2);
inline virtual uint16 w() const { return _surface.w; }
inline virtual uint16 h() const { return _surface.h; }
inline const byte *getPixels() const { return (const byte *)_surface.getPixels(); }
inline byte *getPixels() { return (byte *)_surface.getPixels(); }
inline byte *getBasePtr(int x, int y) { return (byte *)_surface.getBasePtr(x, y); }
inline const byte *getBasePtr(int x, int y) const { return (const byte *)_surface.getBasePtr(x, y); }
inline Graphics::Surface &getRawSurface() { return _surface; }
inline void hLine(int x, int y, int x2, uint color) { _surface.hLine(x, y, x2, color); }
inline void vLine(int x, int y, int y2, uint color) { _surface.vLine(x, y, y2, color); }
}; };
} // End of namespace Sherlock } // End of namespace Sherlock

View file

@ -163,7 +163,7 @@ void Darts::playDarts(GameType gameType) {
// Show scores // Show scores
showStatus(playerNum); showStatus(playerNum);
screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(_dartInfo.left, _dartInfo.top - 1), screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(_dartInfo.left, _dartInfo.top - 1),
Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1)); Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1));
screen.print(Common::Point(_dartInfo.left, _dartInfo.top), 0, FIXED(DartsCurrentDart), idx + 1); screen.print(Common::Point(_dartInfo.left, _dartInfo.top), 0, FIXED(DartsCurrentDart), idx + 1);
@ -267,10 +267,11 @@ void Darts::playDarts(GameType gameType) {
} else { } else {
events.wait(40); events.wait(40);
} }
// Clears the status part of the board // Clears the status part of the board
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_dartInfo.left, _dartInfo.top - 1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(_dartInfo.left, _dartInfo.top - 1),
Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1)); Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1));
screen.blitFrom(screen._backBuffer1); screen.SHblitFrom(screen._backBuffer1);
} }
playerNum ^= 1; playerNum ^= 1;
@ -278,9 +279,9 @@ void Darts::playDarts(GameType gameType) {
++_roundNum; ++_roundNum;
if (!done) { if (!done) {
screen._backBuffer2.blitFrom((*_dartBoard)[0], Common::Point(0, 0)); screen._backBuffer2.SHblitFrom((*_dartBoard)[0], Common::Point(0, 0));
screen._backBuffer1.blitFrom(screen._backBuffer2); screen._backBuffer1.SHblitFrom(screen._backBuffer2);
screen.blitFrom(screen._backBuffer2); screen.SHblitFrom(screen._backBuffer2);
} }
} }
@ -367,9 +368,9 @@ void Darts::loadDarts() {
delete stream; delete stream;
// Load the initial background // Load the initial background
screen._backBuffer1.blitFrom((*_dartBoard)[0], Common::Point(0, 0)); screen._backBuffer1.SHblitFrom((*_dartBoard)[0], Common::Point(0, 0));
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
screen.blitFrom(screen._backBuffer1); screen.SHblitFrom(screen._backBuffer1);
} }
void Darts::closeDarts() { void Darts::closeDarts() {
@ -399,14 +400,14 @@ void Darts::showNames(int playerNum) {
screen.fillRect(Common::Rect(STATUS2_INFO_X, STATUS_INFO_Y + _spacing + 1, screen.fillRect(Common::Rect(STATUS2_INFO_X, STATUS_INFO_Y + _spacing + 1,
STATUS2_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color); STATUS2_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color);
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
} }
void Darts::showStatus(int playerNum) { void Darts::showStatus(int playerNum) {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
const char *const CRICKET_SCORE_NAME[7] = { "20", "19", "18", "17", "16", "15", FIXED(DartsBull) }; const char *const CRICKET_SCORE_NAME[7] = { "20", "19", "18", "17", "16", "15", FIXED(DartsBull) };
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10),
Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH, Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH,
STATUS_INFO_Y + STATUS_INFO_HEIGHT - 10)); STATUS_INFO_Y + STATUS_INFO_HEIGHT - 10));
screen.print(Common::Point(STATUS_INFO_X + 30, STATUS_INFO_Y + _spacing + 4), 0, "%d", _score1); screen.print(Common::Point(STATUS_INFO_X + 30, STATUS_INFO_Y + _spacing + 4), 0, "%d", _score1);
@ -447,7 +448,7 @@ void Darts::showStatus(int playerNum) {
} }
} }
screen.blitFrom(screen._backBuffer1, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10), screen.SHblitFrom(screen._backBuffer1, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10),
Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH, Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH,
STATUS_INFO_Y + STATUS_INFO_HEIGHT - 10)); STATUS_INFO_Y + STATUS_INFO_HEIGHT - 10));
} }
@ -457,7 +458,7 @@ void Darts::erasePowerBars() {
// Erase the old power bars and replace them with empty ones // Erase the old power bars and replace them with empty ones
screen._backBuffer1.fillRect(Common::Rect(DART_BAR_VX, DART_HEIGHT_Y, DART_BAR_VX + 9, DART_HEIGHT_Y + DART_BAR_SIZE), 0); screen._backBuffer1.fillRect(Common::Rect(DART_BAR_VX, DART_HEIGHT_Y, DART_BAR_VX + 9, DART_HEIGHT_Y + DART_BAR_SIZE), 0);
screen._backBuffer1.transBlitFrom((*_dartGraphics)[0], Common::Point(DART_BAR_VX - 1, DART_HEIGHT_Y - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartGraphics)[0], Common::Point(DART_BAR_VX - 1, DART_HEIGHT_Y - 1));
screen.slamArea(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, 10, DART_BAR_SIZE + 2); screen.slamArea(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, 10, DART_BAR_SIZE + 2);
} }
@ -497,7 +498,7 @@ int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, int or
} }
screen._backBuffer1.hLine(pt.x, pt.y + DART_BAR_SIZE- 1 - idx, pt.x + 8, color); screen._backBuffer1.hLine(pt.x, pt.y + DART_BAR_SIZE- 1 - idx, pt.x + 8, color);
screen._backBuffer1.transBlitFrom((*_dartGraphics)[0], Common::Point(pt.x - 1, pt.y - 1)); screen._backBuffer1.SHtransBlitFrom((*_dartGraphics)[0], Common::Point(pt.x - 1, pt.y - 1));
screen.slamArea(pt.x, pt.y + DART_BAR_SIZE - 1 - idx, 8, 2); screen.slamArea(pt.x, pt.y + DART_BAR_SIZE - 1 - idx, 8, 2);
if (!(idx % 8)) if (!(idx % 8))
@ -544,7 +545,7 @@ int Darts::drawHand(int goToPower, int computer) {
break; break;
} }
screen._backBuffer1.transBlitFrom((*hands)[0], pt); screen._backBuffer1.SHtransBlitFrom((*hands)[0], pt);
screen.slamArea(pt.x - 1, pt.y, _handSize.x + 1, _handSize.y); screen.slamArea(pt.x - 1, pt.y, _handSize.x + 1, _handSize.y);
screen.restoreBackground(Common::Rect(pt.x, pt.y, pt.x + _handSize.x, pt.y + _handSize.y)); screen.restoreBackground(Common::Rect(pt.x, pt.y, pt.x + _handSize.x, pt.y + _handSize.y));
@ -631,7 +632,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
_handSize.y = hands[idx]._offset.y + hands[idx]._height; _handSize.y = hands[idx]._offset.y + hands[idx]._height;
int handCy = SHERLOCK_SCREEN_HEIGHT - _handSize.y; int handCy = SHERLOCK_SCREEN_HEIGHT - _handSize.y;
screen._backBuffer1.transBlitFrom(hands[idx], Common::Point(_handX, handCy)); screen._backBuffer1.SHtransBlitFrom(hands[idx], Common::Point(_handX, handCy));
screen.slamArea(_handX, handCy, _handSize.x + 1, _handSize.y); screen.slamArea(_handX, handCy, _handSize.x + 1, _handSize.y);
screen.slamArea(handOCx, handOCy, handOldxSize, handOldySize); screen.slamArea(handOCx, handOCy, handOldxSize, handOldySize);
screen.restoreBackground(Common::Rect(_handX, handCy, _handX + _handSize.x, handCy + _handSize.y)); screen.restoreBackground(Common::Rect(_handX, handCy, _handX + _handSize.x, handCy + _handSize.y));
@ -653,7 +654,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height; ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height;
// Draw dart // Draw dart
screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], drawPos); screen._backBuffer1.SHtransBlitFrom((*_dartGraphics)[dartNum], drawPos);
if (drawPos.x < 0) { if (drawPos.x < 0) {
xSize += drawPos.x; xSize += drawPos.x;
@ -675,7 +676,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
// Flush the erased dart area // Flush the erased dart area
screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize); screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize));
oldDrawPos.x = drawPos.x; oldDrawPos.x = drawPos.x;
@ -696,7 +697,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
if (oldDrawPos.x != -1) if (oldDrawPos.x != -1)
screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize); screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize));
cx = dartPos.x; cx = dartPos.x;
@ -722,7 +723,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
ocx = drawPos.x = cx - (*_dartGraphics)[dartNum]._width / 2; ocx = drawPos.x = cx - (*_dartGraphics)[dartNum]._width / 2;
ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height; ocy = drawPos.y = cy - (*_dartGraphics)[dartNum]._height;
screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], Common::Point(drawPos.x, drawPos.y)); screen._backBuffer1.SHtransBlitFrom((*_dartGraphics)[dartNum], Common::Point(drawPos.x, drawPos.y));
if (drawPos.x < 0) { if (drawPos.x < 0) {
xSize += drawPos.x; xSize += drawPos.x;
@ -744,7 +745,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize); screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
if (idx != 23) if (idx != 23)
screen._backBuffer1.blitFrom(screen._backBuffer2, drawPos, screen._backBuffer1.SHblitFrom(screen._backBuffer2, drawPos,
Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); // erase dart Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); // erase dart
events.wait(1); events.wait(1);
@ -761,8 +762,8 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
ySize = (*_dartGraphics)[dartNum]._height; ySize = (*_dartGraphics)[dartNum]._height;
// Draw final dart on the board // Draw final dart on the board
screen._backBuffer1.transBlitFrom((*_dartGraphics)[dartNum], Common::Point(ocx, ocy)); screen._backBuffer1.SHtransBlitFrom((*_dartGraphics)[dartNum], Common::Point(ocx, ocy));
screen._backBuffer2.transBlitFrom((*_dartGraphics)[dartNum], Common::Point(ocx, ocy)); screen._backBuffer2.SHtransBlitFrom((*_dartGraphics)[dartNum], Common::Point(ocx, ocy));
screen.slamArea(ocx, ocy, xSize, ySize); screen.slamArea(ocx, ocy, xSize, ySize);
} }
@ -955,9 +956,9 @@ int Darts::throwDart(int dartNum, int computer) {
} }
drawDartsLeft(dartNum + 1, computer); drawDartsLeft(dartNum + 1, computer);
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_dartInfo.left, _dartInfo.top - 1), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(_dartInfo.left, _dartInfo.top - 1),
Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1)); Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1));
screen.blitFrom(screen._backBuffer1, Common::Point(_dartInfo.left, _dartInfo.top - 1), screen.SHblitFrom(screen._backBuffer1, Common::Point(_dartInfo.left, _dartInfo.top - 1),
Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1)); Common::Rect(_dartInfo.left, _dartInfo.top - 1, _dartInfo.right, _dartInfo.bottom - 1));
if (computer) { if (computer) {
@ -979,7 +980,7 @@ int Darts::throwDart(int dartNum, int computer) {
height = 101 - height; height = 101 - height;
// Copy power bars to the secondary back buffer // Copy power bars to the secondary back buffer
screen._backBuffer2.blitFrom(screen._backBuffer1, Common::Point(DART_BAR_VX - 1, DART_HEIGHT_Y - 1), screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DART_BAR_VX - 1, DART_HEIGHT_Y - 1),
Common::Rect(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, DART_BAR_VX - 1 + 10, Common::Rect(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, DART_BAR_VX - 1 + 10,
DART_HEIGHT_Y - 1 + DART_BAR_SIZE + 2)); DART_HEIGHT_Y - 1 + DART_BAR_SIZE + 2));
@ -1023,14 +1024,14 @@ void Darts::drawDartsLeft(int dartNum, int computer) {
const int DART_X2[3] = { 393, 441, 502 }; const int DART_X2[3] = { 393, 441, 502 };
const int DART_Y2[3] = { 373, 373, 373 }; const int DART_Y2[3] = { 373, 373, 373 };
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(DART_X1[0], DART_Y1[0]), screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(DART_X1[0], DART_Y1[0]),
Common::Rect(DART_X1[0], DART_Y1[0], SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); Common::Rect(DART_X1[0], DART_Y1[0], SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
for (int idx = 2; idx >= dartNum - 1; --idx) { for (int idx = 2; idx >= dartNum - 1; --idx) {
if (computer) if (computer)
screen._backBuffer1.transBlitFrom((*_dartsLeft)[idx + 3], Common::Point(DART_X2[idx], DART_Y2[idx])); screen._backBuffer1.SHtransBlitFrom((*_dartsLeft)[idx + 3], Common::Point(DART_X2[idx], DART_Y2[idx]));
else else
screen._backBuffer1.transBlitFrom((*_dartsLeft)[idx], Common::Point(DART_X1[idx], DART_Y1[idx])); screen._backBuffer1.SHtransBlitFrom((*_dartsLeft)[idx], Common::Point(DART_X1[idx], DART_Y1[idx]));
} }
screen.slamArea(DART_X1[0], DART_Y1[0], SHERLOCK_SCREEN_WIDTH - DART_X1[0], SHERLOCK_SCREEN_HEIGHT - DART_Y1[0]); screen.slamArea(DART_X1[0], DART_Y1[0], SHERLOCK_SCREEN_WIDTH - DART_X1[0], SHERLOCK_SCREEN_HEIGHT - DART_Y1[0]);

View file

@ -65,7 +65,7 @@ void TattooJournal::show() {
delete stream; delete stream;
// Set screen to black, and set background // Set screen to black, and set background
screen._backBuffer1.blitFrom((*_journalImages)[0], Common::Point(0, 0)); screen._backBuffer1.SHblitFrom((*_journalImages)[0], Common::Point(0, 0));
screen.empty(); screen.empty();
screen.setPalette(palette); screen.setPalette(palette);
@ -461,7 +461,7 @@ void TattooJournal::loadLocations() {
void TattooJournal::drawFrame() { void TattooJournal::drawFrame() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
screen._backBuffer1.blitFrom((*_journalImages)[0], Common::Point(0, 0)); screen._backBuffer1.SHblitFrom((*_journalImages)[0], Common::Point(0, 0));
drawControls(0); drawControls(0);
} }
@ -486,10 +486,10 @@ void TattooJournal::drawControls(int mode) {
screen._backBuffer1.fillRect(inner, MENU_BACKGROUND); screen._backBuffer1.fillRect(inner, MENU_BACKGROUND);
// Draw the four corners of the info box // Draw the four corners of the info box
screen._backBuffer1.transBlitFrom(images[0], Common::Point(r.left, r.top)); screen._backBuffer1.SHtransBlitFrom(images[0], Common::Point(r.left, r.top));
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.top)); screen._backBuffer1.SHtransBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.top));
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.left, r.bottom - images[1]._height)); screen._backBuffer1.SHtransBlitFrom(images[1], Common::Point(r.left, r.bottom - images[1]._height));
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.bottom - images[1]._height)); screen._backBuffer1.SHtransBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.bottom - images[1]._height));
// Draw the top of the info box // Draw the top of the info box
screen._backBuffer1.hLine(r.left + images[0]._width, r.top, r.right - images[0]._height, INFO_TOP); screen._backBuffer1.hLine(r.left + images[0]._width, r.top, r.right - images[0]._height, INFO_TOP);
@ -513,8 +513,8 @@ void TattooJournal::drawControls(int mode) {
// Draw the sides of the separator bar above the scroll bar // Draw the sides of the separator bar above the scroll bar
int yp = r.top + screen.fontHeight() + 7; int yp = r.top + screen.fontHeight() + 7;
screen._backBuffer1.transBlitFrom(images[4], Common::Point(r.left, yp - 1)); screen._backBuffer1.SHtransBlitFrom(images[4], Common::Point(r.left, yp - 1));
screen._backBuffer1.transBlitFrom(images[5], Common::Point(r.right - images[5]._width, yp - 1)); screen._backBuffer1.SHtransBlitFrom(images[5], Common::Point(r.right - images[5]._width, yp - 1));
// Draw the bar above the scroll bar // Draw the bar above the scroll bar
screen._backBuffer1.hLine(r.left + images[4]._width, yp, r.right - images[5]._width, INFO_TOP); screen._backBuffer1.hLine(r.left + images[4]._width, yp, r.right - images[5]._width, INFO_TOP);
@ -525,8 +525,8 @@ void TattooJournal::drawControls(int mode) {
// Draw the Bars separating the Journal Commands // Draw the Bars separating the Journal Commands
int xp = r.right / 3; int xp = r.right / 3;
for (int idx = 0; idx < 2; ++idx) { for (int idx = 0; idx < 2; ++idx) {
screen._backBuffer1.transBlitFrom(images[6], Common::Point(xp - 2, r.top + 1)); screen._backBuffer1.SHtransBlitFrom(images[6], Common::Point(xp - 2, r.top + 1));
screen._backBuffer1.transBlitFrom(images[7], Common::Point(xp - 2, yp - 1)); screen._backBuffer1.SHtransBlitFrom(images[7], Common::Point(xp - 2, yp - 1));
screen._backBuffer1.hLine(xp - 1, r.top + 4, yp - 2, INFO_TOP); screen._backBuffer1.hLine(xp - 1, r.top + 4, yp - 2, INFO_TOP);
screen._backBuffer1.hLine(xp, r.top + 4, yp - 2, INFO_MIDDLE); screen._backBuffer1.hLine(xp, r.top + 4, yp - 2, INFO_MIDDLE);
@ -779,7 +779,7 @@ int TattooJournal::getFindName(bool printError) {
// Backup the area under the text entry // Backup the area under the text entry
Surface bgSurface(r.width() - 6, screen.fontHeight()); Surface bgSurface(r.width() - 6, screen.fontHeight());
bgSurface.blitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(r.left + 3, cursorY, bgSurface.SHblitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(r.left + 3, cursorY,
r.right - 3, cursorY + screen.fontHeight())); r.right - 3, cursorY + screen.fontHeight()));
if (printError) { if (printError) {
@ -810,7 +810,7 @@ int TattooJournal::getFindName(bool printError) {
events.clearEvents(); events.clearEvents();
// Restore the text background // Restore the text background
screen._backBuffer1.blitFrom(bgSurface, Common::Point(r.left, cursorY)); screen._backBuffer1.SHblitFrom(bgSurface, Common::Point(r.left, cursorY));
// If there was a name already entered, copy it to name and display it // If there was a name already entered, copy it to name and display it
if (!_find.empty()) { if (!_find.empty()) {
@ -846,7 +846,7 @@ int TattooJournal::getFindName(bool printError) {
} }
else { else {
// Erase cursor by restoring background and writing current text // Erase cursor by restoring background and writing current text
screen._backBuffer1.blitFrom(bgSurface, Common::Point(r.left + 3, cursorY)); screen._backBuffer1.SHblitFrom(bgSurface, Common::Point(r.left + 3, cursorY));
screen.gPrint(Common::Point(r.left + screen.widestChar() + 3, cursorY), COMMAND_HIGHLIGHTED, "%s", name.c_str()); screen.gPrint(Common::Point(r.left + screen.widestChar() + 3, cursorY), COMMAND_HIGHLIGHTED, "%s", name.c_str());
screen.slamArea(r.left + 3, cursorY, r.width() - 3, screen.fontHeight()); screen.slamArea(r.left + 3, cursorY, r.width() - 3, screen.fontHeight());
} }
@ -912,7 +912,7 @@ int TattooJournal::getFindName(bool printError) {
} }
// Redraw the text // Redraw the text
screen._backBuffer1.blitFrom(bgSurface, Common::Point(r.left + 3, cursorY)); screen._backBuffer1.SHblitFrom(bgSurface, Common::Point(r.left + 3, cursorY));
screen.gPrint(Common::Point(r.left + screen.widestChar() + 3, cursorY), COMMAND_HIGHLIGHTED, screen.gPrint(Common::Point(r.left + screen.widestChar() + 3, cursorY), COMMAND_HIGHLIGHTED,
"%s", name.c_str()); "%s", name.c_str());
screen.slamArea(r.left + 3, cursorY, r.right - 3, screen.fontHeight()); screen.slamArea(r.left + 3, cursorY, r.right - 3, screen.fontHeight());

View file

@ -105,7 +105,7 @@ int TattooMap::show() {
// Load the map image and draw it to the back buffer // Load the map image and draw it to the back buffer
ImageFile *map = new ImageFile("map.vgs"); ImageFile *map = new ImageFile("map.vgs");
screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2); screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2);
screen._backBuffer1.blitFrom((*map)[0], Common::Point(0, 0)); screen._backBuffer1.SHblitFrom((*map)[0], Common::Point(0, 0));
delete map; delete map;
screen.clear(); screen.clear();
@ -114,7 +114,7 @@ int TattooMap::show() {
// Copy the map drawn in the back buffer to the secondary back buffer // Copy the map drawn in the back buffer to the secondary back buffer
screen._backBuffer2.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2); screen._backBuffer2.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2);
screen._backBuffer2.blitFrom(screen._backBuffer1); screen._backBuffer2.SHblitFrom(screen._backBuffer1);
// Display the built map to the screen // Display the built map to the screen
screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
@ -148,12 +148,12 @@ int TattooMap::show() {
if (_targetScroll.x < 0) if (_targetScroll.x < 0)
_targetScroll.x = 0; _targetScroll.x = 0;
if ((_targetScroll.x + SHERLOCK_SCREEN_WIDTH) > screen._backBuffer1.w()) if ((_targetScroll.x + SHERLOCK_SCREEN_WIDTH) > screen._backBuffer1.width())
_targetScroll.x = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH; _targetScroll.x = screen._backBuffer1.width() - SHERLOCK_SCREEN_WIDTH;
if (_targetScroll.y < 0) if (_targetScroll.y < 0)
_targetScroll.y = 0; _targetScroll.y = 0;
if ((_targetScroll.y + SHERLOCK_SCREEN_HEIGHT) > screen._backBuffer1.h()) if ((_targetScroll.y + SHERLOCK_SCREEN_HEIGHT) > screen._backBuffer1.height())
_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT; _targetScroll.y = screen._backBuffer1.height() - SHERLOCK_SCREEN_HEIGHT;
// Check the keyboard // Check the keyboard
if (events.kbHit()) { if (events.kbHit()) {
@ -166,8 +166,8 @@ int TattooMap::show() {
break; break;
case Common::KEYCODE_END: case Common::KEYCODE_END:
_targetScroll.x = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH; _targetScroll.x = screen._backBuffer1.width() - SHERLOCK_SCREEN_WIDTH;
_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT; _targetScroll.y = screen._backBuffer1.height() - SHERLOCK_SCREEN_HEIGHT;
break; break;
case Common::KEYCODE_PAGEUP: case Common::KEYCODE_PAGEUP:
@ -178,8 +178,8 @@ int TattooMap::show() {
case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_PAGEDOWN:
_targetScroll.y += SHERLOCK_SCREEN_HEIGHT; _targetScroll.y += SHERLOCK_SCREEN_HEIGHT;
if (_targetScroll.y > (screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT)) if (_targetScroll.y > (screen._backBuffer1.height() - SHERLOCK_SCREEN_HEIGHT))
_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT; _targetScroll.y = screen._backBuffer1.height() - SHERLOCK_SCREEN_HEIGHT;
break; break;
case Common::KEYCODE_SPACE: case Common::KEYCODE_SPACE:
@ -304,7 +304,7 @@ void TattooMap::drawMapIcons() {
if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) { if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) {
MapEntry &mapEntry = _data[idx]; MapEntry &mapEntry = _data[idx];
ImageFrame &img = (*_iconImages)[mapEntry._iconNum]; ImageFrame &img = (*_iconImages)[mapEntry._iconNum];
screen._backBuffer1.transBlitFrom(img._frame, Common::Point(mapEntry.x - img._width / 2, screen._backBuffer1.SHtransBlitFrom(img._frame, Common::Point(mapEntry.x - img._width / 2,
mapEntry.y - img._height / 2)); mapEntry.y - img._height / 2));
} }
} }
@ -355,10 +355,10 @@ void TattooMap::restoreArea(const Common::Rect &bounds) {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::Rect r = bounds; Common::Rect r = bounds;
r.clip(Common::Rect(0, 0, screen._backBuffer1.w(), screen._backBuffer1.h())); r.clip(Common::Rect(0, 0, screen._backBuffer1.width(), screen._backBuffer1.height()));
if (!r.isEmpty()) if (!r.isEmpty())
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(r.left, r.top), r); screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(r.left, r.top), r);
} }
void TattooMap::showCloseUp(int closeUpNum) { void TattooMap::showCloseUp(int closeUpNum) {
@ -407,7 +407,7 @@ void TattooMap::showCloseUp(int closeUpNum) {
screen._currentScroll.y + closeUp.y / 100 - picSize.y / 2); screen._currentScroll.y + closeUp.y / 100 - picSize.y / 2);
restoreArea(oldBounds); restoreArea(oldBounds);
screen._backBuffer1.transBlitFrom(pic[0], pt, false, 0, scaleVal); screen._backBuffer1.SHtransBlitFrom(pic[0], pt, false, 0, scaleVal);
screen.slamRect(oldBounds); screen.slamRect(oldBounds);
screen.slamArea(pt.x, pt.y, picSize.x, picSize.y); screen.slamArea(pt.x, pt.y, picSize.x, picSize.y);
@ -426,7 +426,7 @@ void TattooMap::showCloseUp(int closeUpNum) {
screen._currentScroll.y + SHERLOCK_SCREEN_HEIGHT / 2 - pic[0]._height / 2 + pic[0]._height); screen._currentScroll.y + SHERLOCK_SCREEN_HEIGHT / 2 - pic[0]._height / 2 + pic[0]._height);
restoreArea(oldBounds); restoreArea(oldBounds);
screen._backBuffer1.transBlitFrom(pic[0], Common::Point(r.left, r.top)); screen._backBuffer1.SHtransBlitFrom(pic[0], Common::Point(r.left, r.top));
screen.slamRect(oldBounds); screen.slamRect(oldBounds);
screen.slamRect(r); screen.slamRect(r);

View file

@ -1042,7 +1042,7 @@ void TattooPerson::walkHolmesToNPC() {
holmes._walkDest.x = MAX(_position.x / FIXED_INT_MULTIPLIER - imgFrame.sDrawXSize(scaleVal), 0); holmes._walkDest.x = MAX(_position.x / FIXED_INT_MULTIPLIER - imgFrame.sDrawXSize(scaleVal), 0);
} else { } else {
holmes._walkDest.x = MIN(_position.x / FIXED_INT_MULTIPLIER + imgFrame.sDrawXSize(scaleVal) * 2, holmes._walkDest.x = MIN(_position.x / FIXED_INT_MULTIPLIER + imgFrame.sDrawXSize(scaleVal) * 2,
screen._backBuffer1.w() - 1); screen._backBuffer1.width() - 1);
} }
// See where Holmes is with respect to the NPC (y coords) // See where Holmes is with respect to the NPC (y coords)
@ -1168,7 +1168,7 @@ void TattooPerson::centerScreenOnPerson() {
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
ui._targetScroll.x = CLIP(_position.x / FIXED_INT_MULTIPLIER - SHERLOCK_SCREEN_WIDTH / 2, ui._targetScroll.x = CLIP(_position.x / FIXED_INT_MULTIPLIER - SHERLOCK_SCREEN_WIDTH / 2,
0, screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH); 0, screen._backBuffer1.width() - SHERLOCK_SCREEN_WIDTH);
screen._currentScroll = ui._targetScroll; screen._currentScroll = ui._targetScroll;
// Reset the default look position to the center of the screen // Reset the default look position to the center of the screen
@ -1478,7 +1478,7 @@ const Common::Point TattooPeople::restrictToZone(int zoneId, const Common::Point
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::Rect &r = scene._zones[zoneId]; Common::Rect &r = scene._zones[zoneId];
if (destPos.x < 0 || destPos.x > screen._backBuffer1.w()) if (destPos.x < 0 || destPos.x > screen._backBuffer1.width())
return destPos; return destPos;
else if (destPos.y < r.top && r.left < destPos.x && destPos.x < r.right) else if (destPos.y < r.top && r.left < destPos.x && destPos.x < r.right)
return Common::Point(destPos.x, r.top); return Common::Point(destPos.x, r.top);

View file

@ -141,15 +141,15 @@ void TattooScene::drawAllShapes() {
if (obj._type == ACTIVE_BG_SHAPE && obj._misc == BEHIND) { if (obj._type == ACTIVE_BG_SHAPE && obj._misc == BEHIND) {
if (obj._quickDraw && obj._scaleVal == SCALE_THRESHOLD) if (obj._quickDraw && obj._scaleVal == SCALE_THRESHOLD)
screen._backBuffer1.blitFrom(*obj._imageFrame, obj._position); screen._backBuffer1.SHblitFrom(*obj._imageFrame, obj._position);
else else
screen._backBuffer1.transBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal); screen._backBuffer1.SHtransBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal);
} }
} }
// Draw the animation if it is behind the person // Draw the animation if it is behind the person
if (_activeCAnim.active() && _activeCAnim._zPlacement == BEHIND) if (_activeCAnim.active() && _activeCAnim._zPlacement == BEHIND)
screen._backBuffer1.transBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position, screen._backBuffer1.SHtransBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position,
(_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal); (_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
screen.resetDisplayBounds(); screen.resetDisplayBounds();
@ -194,13 +194,13 @@ void TattooScene::drawAllShapes() {
if (se._shape) { if (se._shape) {
// it's a bg shape // it's a bg shape
if (se._shape->_quickDraw && se._shape->_scaleVal == SCALE_THRESHOLD) if (se._shape->_quickDraw && se._shape->_scaleVal == SCALE_THRESHOLD)
screen._backBuffer1.blitFrom(*se._shape->_imageFrame, se._shape->_position); screen._backBuffer1.SHblitFrom(*se._shape->_imageFrame, se._shape->_position);
else else
screen._backBuffer1.transBlitFrom(*se._shape->_imageFrame, se._shape->_position, screen._backBuffer1.SHtransBlitFrom(*se._shape->_imageFrame, se._shape->_position,
se._shape->_flags & OBJ_FLIPPED, 0, se._shape->_scaleVal); se._shape->_flags & OBJ_FLIPPED, 0, se._shape->_scaleVal);
} else if (se._isAnimation) { } else if (se._isAnimation) {
// It's an active animation // It's an active animation
screen._backBuffer1.transBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position, screen._backBuffer1.SHtransBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position,
(_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal); (_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
} else { } else {
// Drawing person // Drawing person
@ -212,7 +212,7 @@ void TattooScene::drawAllShapes() {
if (p._tempScaleVal == SCALE_THRESHOLD) { if (p._tempScaleVal == SCALE_THRESHOLD) {
p._tempX += adjust.x; p._tempX += adjust.x;
screen._backBuffer1.transBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER screen._backBuffer1.SHtransBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER
- p.frameHeight() - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal); - p.frameHeight() - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal);
} else { } else {
if (adjust.x) { if (adjust.x) {
@ -242,7 +242,7 @@ void TattooScene::drawAllShapes() {
++adjust.y; ++adjust.y;
} }
screen._backBuffer1.transBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER screen._backBuffer1.SHtransBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER
- p._imageFrame->sDrawYSize(p._tempScaleVal) - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal); - p._imageFrame->sDrawYSize(p._tempScaleVal) - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal);
} }
} }
@ -255,15 +255,15 @@ void TattooScene::drawAllShapes() {
if (obj._type == ACTIVE_BG_SHAPE && obj._misc == FORWARD) { if (obj._type == ACTIVE_BG_SHAPE && obj._misc == FORWARD) {
if (obj._quickDraw && obj._scaleVal == SCALE_THRESHOLD) if (obj._quickDraw && obj._scaleVal == SCALE_THRESHOLD)
screen._backBuffer1.blitFrom(*obj._imageFrame, obj._position); screen._backBuffer1.SHblitFrom(*obj._imageFrame, obj._position);
else else
screen._backBuffer1.transBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal); screen._backBuffer1.SHtransBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal);
} }
} }
// Draw the canimation if it is set as FORWARD // Draw the canimation if it is set as FORWARD
if (_activeCAnim.active() && _activeCAnim._zPlacement == FORWARD) if (_activeCAnim.active() && _activeCAnim._zPlacement == FORWARD)
screen._backBuffer1.transBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position, (_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal); screen._backBuffer1.SHtransBlitFrom(_activeCAnim._imageFrame, _activeCAnim._position, (_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
// Draw all NO_SHAPE shapes which have their flag bits clear // Draw all NO_SHAPE shapes which have their flag bits clear
for (uint idx = 0; idx < _bgShapes.size(); ++idx) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) {

View file

@ -0,0 +1,37 @@
/* 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 "sherlock/tattoo/tattoo_screen.h"
#include "sherlock/tattoo/tattoo.h"
namespace Sherlock {
namespace Tattoo {
TattooScreen::TattooScreen(SherlockEngine *vm) : Screen(vm) {
_backBuffer1.create(640, 480);
_backBuffer2.create(640, 480);
}
} // End of namespace Tattoo
} // End of namespace Sherlock

View file

@ -0,0 +1,44 @@
/* 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.
*
*/
#ifndef SHERLOCK_TATTOO_SCREEN_H
#define SHERLOCK_TATTOO_SCREEN_H
#include "sherlock/screen.h"
namespace Sherlock {
class SherlockEngine;
namespace Tattoo {
class TattooScreen : public Screen {
public:
TattooScreen(SherlockEngine *vm);
virtual ~TattooScreen() {}
};
} // End of namespace Tattoo
} // End of namespace Sherlock
#endif

View file

@ -72,7 +72,7 @@ TattooUserInterface::~TattooUserInterface() {
void TattooUserInterface::initScrollVars() { void TattooUserInterface::initScrollVars() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
_scrollSize = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH; _scrollSize = screen._backBuffer1.width() - SHERLOCK_SCREEN_WIDTH;
_targetScroll = Common::Point(0, 0); _targetScroll = Common::Point(0, 0);
screen._currentScroll = Common::Point(0, 0); screen._currentScroll = Common::Point(0, 0);
} }
@ -233,7 +233,7 @@ void TattooUserInterface::doJournal() {
Common::copy(&lookupTable1[0], &lookupTable1[PALETTE_COUNT], &_lookupTable1[0]); Common::copy(&lookupTable1[0], &lookupTable1[PALETTE_COUNT], &_lookupTable1[0]);
// Restore the scene // Restore the scene
screen._backBuffer1.blitFrom(screen._backBuffer2); screen._backBuffer1.SHblitFrom(screen._backBuffer2);
scene.updateBackground(); scene.updateBackground();
screen.slamArea(screen._currentScroll.x, screen._currentScroll.y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); screen.slamArea(screen._currentScroll.x, screen._currentScroll.y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
} }
@ -727,7 +727,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
if (_mask != nullptr) { if (_mask != nullptr) {
// Since a mask is active, restore the screen from the secondary back buffer prior to applying the mask // Since a mask is active, restore the screen from the secondary back buffer prior to applying the mask
screen._backBuffer1.blitFrom(screen._backBuffer2, screen._currentScroll, Common::Rect(screen._currentScroll.x, 0, screen._backBuffer1.SHblitFrom(screen._backBuffer2, screen._currentScroll, Common::Rect(screen._currentScroll.x, 0,
screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
switch (scene._currentScene) { switch (scene._currentScene) {
@ -757,7 +757,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
case 53: case 53:
if (++_maskCounter == 2) { if (++_maskCounter == 2) {
_maskCounter = 0; _maskCounter = 0;
if (++_maskOffset.x == screen._backBuffer1.w()) if (++_maskOffset.x == screen._backBuffer1.width())
_maskOffset.x = 0; _maskOffset.x = 0;
} }
break; break;
@ -779,7 +779,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
if ((obj._type == ACTIVE_BG_SHAPE && (obj._maxFrames > 1 || obj._delta.x != 0 || obj._delta.y != 0)) || if ((obj._type == ACTIVE_BG_SHAPE && (obj._maxFrames > 1 || obj._delta.x != 0 || obj._delta.y != 0)) ||
obj._type == HIDE_SHAPE || obj._type == REMOVE) obj._type == HIDE_SHAPE || obj._type == REMOVE)
screen._backBuffer1.blitFrom(screen._backBuffer2, obj._oldPosition, screen._backBuffer1.SHblitFrom(screen._backBuffer2, obj._oldPosition,
Common::Rect(obj._oldPosition.x, obj._oldPosition.y, obj._oldPosition.x + obj._oldSize.x, Common::Rect(obj._oldPosition.x, obj._oldPosition.y, obj._oldPosition.x + obj._oldSize.x,
obj._oldPosition.y + obj._oldSize.y)); obj._oldPosition.y + obj._oldSize.y));
} }
@ -793,7 +793,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
Object &obj = scene._bgShapes[idx]; Object &obj = scene._bgShapes[idx];
if (obj._type == NO_SHAPE && (obj._flags & 1) == 0) { if (obj._type == NO_SHAPE && (obj._flags & 1) == 0) {
screen._backBuffer1.blitFrom(screen._backBuffer2, obj._position, obj.getNoShapeBounds()); screen._backBuffer1.SHblitFrom(screen._backBuffer2, obj._position, obj.getNoShapeBounds());
obj._oldPosition = obj._position; obj._oldPosition = obj._position;
obj._oldSize = obj._noShapeSize; obj._oldSize = obj._noShapeSize;
@ -870,7 +870,7 @@ void TattooUserInterface::maskArea(Common::SeekableReadStream &mask, const Commo
int pixel, len, xp, yp; int pixel, len, xp, yp;
for (yp = 0; yp < ySize; ++yp) { for (yp = 0; yp < ySize; ++yp) {
byte *ptr = bb1.getBasePtr(pt.x, pt.y + yp); byte *ptr = (byte *)bb1.getBasePtr(pt.x, pt.y + yp);
for (xp = 0; xp < xSize;) { for (xp = 0; xp < xSize;) {
// The mask data consists of pairs of pixel/lengths, where all non-zero pixels means that the // The mask data consists of pairs of pixel/lengths, where all non-zero pixels means that the
@ -893,7 +893,7 @@ void TattooUserInterface::makeBGArea(const Common::Rect &r) {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
for (int yp = r.top; yp < r.bottom; ++yp) { for (int yp = r.top; yp < r.bottom; ++yp) {
byte *ptr = screen._backBuffer1.getBasePtr(r.left, yp); byte *ptr = (byte *)screen._backBuffer1.getBasePtr(r.left, yp);
for (int xp = r.left; xp < r.right; ++xp, ++ptr) for (int xp = r.left; xp < r.right; ++xp, ++ptr)
*ptr = _lookupTable[*ptr]; *ptr = _lookupTable[*ptr];

View file

@ -88,7 +88,7 @@ void WidgetBase::erase() {
if (_oldBounds.width() > 0) { if (_oldBounds.width() > 0) {
// Restore the affected area from the secondary back buffer into the first one, and then copy to screen // Restore the affected area from the secondary back buffer into the first one, and then copy to screen
screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds); screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds);
screen.slamRect(_oldBounds); screen.slamRect(_oldBounds);
// Reset the old bounds so it won't be erased again // Reset the old bounds so it won't be erased again
@ -111,7 +111,7 @@ void WidgetBase::draw() {
drawBackground(); drawBackground();
// Draw the widget onto the back buffer and then slam it to the screen // Draw the widget onto the back buffer and then slam it to the screen
screen._backBuffer1.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top)); screen._backBuffer1.SHtransBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top));
screen.slamRect(_bounds); screen.slamRect(_bounds);
// Store a copy of the drawn area for later erasing // Store a copy of the drawn area for later erasing
@ -183,8 +183,8 @@ void WidgetBase::restrictToScreen() {
_bounds.moveTo(_bounds.left, 0); _bounds.moveTo(_bounds.left, 0);
if (_bounds.right > (screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH)) if (_bounds.right > (screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH))
_bounds.moveTo(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH - _bounds.width(), _bounds.top); _bounds.moveTo(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH - _bounds.width(), _bounds.top);
if (_bounds.bottom > screen._backBuffer1.h()) if (_bounds.bottom > screen._backBuffer1.height())
_bounds.moveTo(_bounds.left, screen._backBuffer1.h() - _bounds.height()); _bounds.moveTo(_bounds.left, screen._backBuffer1.height() - _bounds.height());
} }
void WidgetBase::makeInfoArea(Surface &s) { void WidgetBase::makeInfoArea(Surface &s) {
@ -192,30 +192,30 @@ void WidgetBase::makeInfoArea(Surface &s) {
ImageFile &images = *ui._interfaceImages; ImageFile &images = *ui._interfaceImages;
// Draw the four corners of the Info Box // Draw the four corners of the Info Box
s.transBlitFrom(images[0], Common::Point(0, 0)); s.SHtransBlitFrom(images[0], Common::Point(0, 0));
s.transBlitFrom(images[1], Common::Point(s.w() - images[1]._width, 0)); s.SHtransBlitFrom(images[1], Common::Point(s.width() - images[1]._width, 0));
s.transBlitFrom(images[2], Common::Point(0, s.h() - images[2]._height)); s.SHtransBlitFrom(images[2], Common::Point(0, s.height() - images[2]._height));
s.transBlitFrom(images[3], Common::Point(s.w() - images[3]._width, s.h())); s.SHtransBlitFrom(images[3], Common::Point(s.width() - images[3]._width, s.height()));
// Draw the top of the Info Box // Draw the top of the Info Box
s.hLine(images[0]._width, 0, s.w() - images[1]._width, INFO_TOP); s.hLine(images[0]._width, 0, s.width() - images[1]._width, INFO_TOP);
s.hLine(images[0]._width, 1, s.w() - images[1]._width, INFO_MIDDLE); s.hLine(images[0]._width, 1, s.width() - images[1]._width, INFO_MIDDLE);
s.hLine(images[0]._width, 2, s.w() - images[1]._width, INFO_BOTTOM); s.hLine(images[0]._width, 2, s.width() - images[1]._width, INFO_BOTTOM);
// Draw the bottom of the Info Box // Draw the bottom of the Info Box
s.hLine(images[0]._width, s.h()- 3, s.w() - images[1]._width, INFO_TOP); s.hLine(images[0]._width, s.height()- 3, s.width() - images[1]._width, INFO_TOP);
s.hLine(images[0]._width, s.h()- 2, s.w() - images[1]._width, INFO_MIDDLE); s.hLine(images[0]._width, s.height()- 2, s.width() - images[1]._width, INFO_MIDDLE);
s.hLine(images[0]._width, s.h()- 1, s.w() - images[1]._width, INFO_BOTTOM); s.hLine(images[0]._width, s.height()- 1, s.width() - images[1]._width, INFO_BOTTOM);
// Draw the left Side of the Info Box // Draw the left Side of the Info Box
s.vLine(0, images[0]._height, s.h()- images[2]._height, INFO_TOP); s.vLine(0, images[0]._height, s.height()- images[2]._height, INFO_TOP);
s.vLine(1, images[0]._height, s.h()- images[2]._height, INFO_MIDDLE); s.vLine(1, images[0]._height, s.height()- images[2]._height, INFO_MIDDLE);
s.vLine(2, images[0]._height, s.h()- images[2]._height, INFO_BOTTOM); s.vLine(2, images[0]._height, s.height()- images[2]._height, INFO_BOTTOM);
// Draw the right Side of the Info Box // Draw the right Side of the Info Box
s.vLine(s.w() - 3, images[0]._height, s.h()- images[2]._height, INFO_TOP); s.vLine(s.width() - 3, images[0]._height, s.height()- images[2]._height, INFO_TOP);
s.vLine(s.w() - 2, images[0]._height, s.h()- images[2]._height, INFO_MIDDLE); s.vLine(s.width() - 2, images[0]._height, s.height()- images[2]._height, INFO_MIDDLE);
s.vLine(s.w() - 1, images[0]._height, s.h()- images[2]._height, INFO_BOTTOM); s.vLine(s.width() - 1, images[0]._height, s.height()- images[2]._height, INFO_BOTTOM);
} }
void WidgetBase::makeInfoArea() { void WidgetBase::makeInfoArea() {

View file

@ -37,7 +37,7 @@ void WidgetCredits::initCredits() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::SeekableReadStream *stream = res.load("credits.txt"); Common::SeekableReadStream *stream = res.load("credits.txt");
int spacing = screen.fontHeight() * 2; int spacing = screen.fontHeight() * 2;
int yp = screen.h(); int yp = screen.height();
_creditsActive = true; _creditsActive = true;
_creditLines.clear(); _creditLines.clear();
@ -60,7 +60,7 @@ void WidgetCredits::initCredits() {
} else { } else {
int width = screen.stringWidth(line) + 2; int width = screen.stringWidth(line) + 2;
_creditLines.push_back(CreditLine(line, Common::Point((screen.w() - width) / 2 + 1, yp), width)); _creditLines.push_back(CreditLine(line, Common::Point((screen.width() - width) / 2 + 1, yp), width));
yp += spacing; yp += spacing;
} }
} }
@ -120,10 +120,10 @@ void WidgetCredits::close() {
void WidgetCredits::drawCredits() { void WidgetCredits::drawCredits() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::Rect screenRect(0, 0, screen.w(), screen.h()); Common::Rect screenRect(0, 0, screen.width(), screen.height());
Surface &bb1 = screen._backBuffer1; Surface &bb1 = screen._backBuffer1;
for (uint idx = 0; idx < _creditLines.size() && _creditLines[idx]._position.y < screen.h(); ++idx) { for (uint idx = 0; idx < _creditLines.size() && _creditLines[idx]._position.y < screen.height(); ++idx) {
if (screenRect.contains(_creditLines[idx]._position)) { if (screenRect.contains(_creditLines[idx]._position)) {
if (!_creditLines[idx]._line2.empty()) { if (!_creditLines[idx]._line2.empty()) {
int x1 = _creditLines[idx]._position.x; int x1 = _creditLines[idx]._position.x;
@ -176,7 +176,7 @@ void WidgetCredits::drawCredits() {
void WidgetCredits::blitCredits() { void WidgetCredits::blitCredits() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::Rect screenRect(0, -_creditSpeed, screen.w(), screen.h() + _creditSpeed); Common::Rect screenRect(0, -_creditSpeed, screen.width(), screen.height() + _creditSpeed);
for (uint idx = 0; idx < _creditLines.size(); ++idx) { for (uint idx = 0; idx < _creditLines.size(); ++idx) {
if (screenRect.contains(_creditLines[idx]._position)) { if (screenRect.contains(_creditLines[idx]._position)) {
@ -190,7 +190,7 @@ void WidgetCredits::blitCredits() {
void WidgetCredits::eraseCredits() { void WidgetCredits::eraseCredits() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
Common::Rect screenRect(0, -_creditSpeed, screen.w(), screen.h() + _creditSpeed); Common::Rect screenRect(0, -_creditSpeed, screen.width(), screen.height() + _creditSpeed);
for (uint idx = 0; idx < _creditLines.size(); ++idx) { for (uint idx = 0; idx < _creditLines.size(); ++idx) {
if (screenRect.contains(_creditLines[idx]._position)) { if (screenRect.contains(_creditLines[idx]._position)) {

View file

@ -107,36 +107,36 @@ void WidgetFiles::render(FilesRenderMode mode) {
byte color; byte color;
if (mode == RENDER_ALL) { if (mode == RENDER_ALL) {
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
makeInfoArea(); makeInfoArea();
switch (_fileMode) { switch (_fileMode) {
case SAVEMODE_LOAD: case SAVEMODE_LOAD:
_surface.writeString(FIXED(LoadGame), _surface.writeString(FIXED(LoadGame),
Common::Point((_surface.w() - _surface.stringWidth(FIXED(LoadGame))) / 2, 5), INFO_TOP); Common::Point((_surface.width() - _surface.stringWidth(FIXED(LoadGame))) / 2, 5), INFO_TOP);
break; break;
case SAVEMODE_SAVE: case SAVEMODE_SAVE:
_surface.writeString(FIXED(SaveGame), _surface.writeString(FIXED(SaveGame),
Common::Point((_surface.w() - _surface.stringWidth(FIXED(SaveGame))) / 2, 5), INFO_TOP); Common::Point((_surface.width() - _surface.stringWidth(FIXED(SaveGame))) / 2, 5), INFO_TOP);
break; break;
default: default:
break; break;
} }
_surface.hLine(3, _surface.fontHeight() + 7, _surface.w() - 4, INFO_TOP); _surface.hLine(3, _surface.fontHeight() + 7, _surface.width() - 4, INFO_TOP);
_surface.hLine(3, _surface.fontHeight() + 8, _surface.w() - 4, INFO_MIDDLE); _surface.hLine(3, _surface.fontHeight() + 8, _surface.width() - 4, INFO_MIDDLE);
_surface.hLine(3, _surface.fontHeight() + 9, _surface.w() - 4, INFO_BOTTOM); _surface.hLine(3, _surface.fontHeight() + 9, _surface.width() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 6)); _surface.SHtransBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 6));
_surface.transBlitFrom(images[5], Common::Point(_surface.w() - images[5]._width, _surface.fontHeight() + 6)); _surface.SHtransBlitFrom(images[5], Common::Point(_surface.width() - images[5]._width, _surface.fontHeight() + 6));
int xp = _surface.w() - BUTTON_SIZE - 6; int xp = _surface.width() - BUTTON_SIZE - 6;
_surface.vLine(xp, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_TOP); _surface.vLine(xp, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_TOP);
_surface.vLine(xp + 1, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_MIDDLE); _surface.vLine(xp + 1, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_MIDDLE);
_surface.vLine(xp + 2, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_BOTTOM); _surface.vLine(xp + 2, _surface.fontHeight() + 10, _bounds.height() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[6], Common::Point(xp - 1, _surface.fontHeight() + 8)); _surface.SHtransBlitFrom(images[6], Common::Point(xp - 1, _surface.fontHeight() + 8));
_surface.transBlitFrom(images[7], Common::Point(xp - 1, _bounds.height() - 4)); _surface.SHtransBlitFrom(images[7], Common::Point(xp - 1, _bounds.height() - 4));
} }
int xp = _surface.stringWidth("00.") + _surface.widestChar() + 5; int xp = _surface.stringWidth("00.") + _surface.widestChar() + 5;
@ -149,7 +149,7 @@ void WidgetFiles::render(FilesRenderMode mode) {
color = INFO_TOP; color = INFO_TOP;
if (mode == RENDER_NAMES_AND_SCROLLBAR) if (mode == RENDER_NAMES_AND_SCROLLBAR)
_surface.fillRect(Common::Rect(4, yp, _surface.w() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY); _surface.fillRect(Common::Rect(4, yp, _surface.width() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY);
Common::String numStr = Common::String::format("%d.", idx + 1); Common::String numStr = Common::String::format("%d.", idx + 1);
_surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color); _surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color);
@ -324,7 +324,7 @@ bool WidgetFiles::getFilename() {
filename.setChar(' ', index); filename.setChar(' ', index);
} }
_surface.fillRect(Common::Rect(pt.x, pt.y, _surface.w() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY); _surface.fillRect(Common::Rect(pt.x, pt.y, _surface.width() - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
_surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED); _surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
} else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0) } else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0)
@ -387,7 +387,7 @@ bool WidgetFiles::getFilename() {
} }
if ((keyState.ascii >= ' ') && (keyState.ascii <= 'z') && (index < 50)) { if ((keyState.ascii >= ' ') && (keyState.ascii <= 'z') && (index < 50)) {
if (pt.x + _surface.charWidth(keyState.ascii) < _surface.w() - BUTTON_SIZE - 20) { if (pt.x + _surface.charWidth(keyState.ascii) < _surface.w - BUTTON_SIZE - 20) {
if (insert) if (insert)
filename.insertChar(keyState.ascii, index); filename.insertChar(keyState.ascii, index);
else else

View file

@ -103,7 +103,7 @@ void WidgetFoolscap::show() {
// Set up the window background // Set up the window background
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.blitFrom(paperFrame, Common::Point(0, 0)); _surface.SHblitFrom(paperFrame, Common::Point(0, 0));
// If they have already solved the puzzle, put the answer on the graphic // If they have already solved the puzzle, put the answer on the graphic
if (_vm->readFlags(299)) { if (_vm->readFlags(299)) {
@ -265,7 +265,7 @@ void WidgetFoolscap::handleKeyboardEvents() {
void WidgetFoolscap::restoreChar() { void WidgetFoolscap::restoreChar() {
Screen &screen = *_vm->_screen; Screen &screen = *_vm->_screen;
ImageFrame &bgFrame = (*_images)[0]; ImageFrame &bgFrame = (*_images)[0];
_surface.blitFrom(bgFrame, _cursorPos, Common::Rect(_cursorPos.x, _cursorPos.y, _surface.SHblitFrom(bgFrame, _cursorPos, Common::Rect(_cursorPos.x, _cursorPos.y,
_cursorPos.x + screen.widestChar(), _cursorPos.y + screen.fontHeight())); _cursorPos.x + screen.widestChar(), _cursorPos.y + screen.fontHeight()));
} }

View file

@ -94,7 +94,7 @@ void WidgetInventoryTooltip::setText(const Common::String &str) {
// Allocate a fresh surface for the new string // Allocate a fresh surface for the new string
_bounds = Common::Rect(width, height); _bounds = Common::Rect(width, height);
_surface.create(width, height); _surface.create(width, height);
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
if (line2.empty()) { if (line2.empty()) {
_surface.writeFancyString(str, Common::Point(0, 0), BLACK, INFO_TOP); _surface.writeFancyString(str, Common::Point(0, 0), BLACK, INFO_TOP);
@ -338,7 +338,7 @@ void WidgetInventoryVerbs::load() {
// Create the surface // Create the surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
makeInfoArea(); makeInfoArea();
// Draw the Verb commands and the lines separating them // Draw the Verb commands and the lines separating them
@ -352,8 +352,8 @@ void WidgetInventoryVerbs::load() {
_surface.vLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.right - 4, INFO_MIDDLE); _surface.vLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.right - 4, INFO_MIDDLE);
_surface.vLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.right - 4, INFO_BOTTOM); _surface.vLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.right - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1))); _surface.SHtransBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1)));
_surface.transBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, _surface.SHtransBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width,
(_surface.fontHeight() + 7) * (idx + 1) - 1)); (_surface.fontHeight() + 7) * (idx + 1) - 1));
} }
} }
@ -515,7 +515,7 @@ void WidgetInventory::load(int mode) {
// Redraw the inventory menu on the widget surface // Redraw the inventory menu on the widget surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
// Draw the window background and then the inventory on top of it // Draw the window background and then the inventory on top of it
makeInfoArea(_surface); makeInfoArea(_surface);
@ -531,7 +531,7 @@ void WidgetInventory::drawBars() {
_surface.hLine(3, INVENTORY_YSIZE + 3, _bounds.width() - 4, INFO_TOP); _surface.hLine(3, INVENTORY_YSIZE + 3, _bounds.width() - 4, INFO_TOP);
_surface.hLine(3, INVENTORY_YSIZE + 4, _bounds.width() - 4, INFO_MIDDLE); _surface.hLine(3, INVENTORY_YSIZE + 4, _bounds.width() - 4, INFO_MIDDLE);
_surface.hLine(3, INVENTORY_YSIZE + 5, _bounds.width() - 4, INFO_BOTTOM); _surface.hLine(3, INVENTORY_YSIZE + 5, _bounds.width() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[4], Common::Point(0, INVENTORY_YSIZE + 2)); _surface.SHtransBlitFrom(images[4], Common::Point(0, INVENTORY_YSIZE + 2));
for (int idx = 1; idx <= NUM_INVENTORY_SHOWN / 2; ++idx) { for (int idx = 1; idx <= NUM_INVENTORY_SHOWN / 2; ++idx) {
x = idx * (INVENTORY_XSIZE + 3); x = idx * (INVENTORY_XSIZE + 3);
@ -540,10 +540,10 @@ void WidgetInventory::drawBars() {
_surface.vLine(x + 1, 3, _bounds.height() - 4, INFO_MIDDLE); _surface.vLine(x + 1, 3, _bounds.height() - 4, INFO_MIDDLE);
_surface.vLine(x + 2, 3, _bounds.height() - 4, INFO_BOTTOM); _surface.vLine(x + 2, 3, _bounds.height() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[6], Common::Point(x - 1, 1)); _surface.SHtransBlitFrom(images[6], Common::Point(x - 1, 1));
_surface.transBlitFrom(images[7], Common::Point(x - 1, _bounds.height() - 4)); _surface.SHtransBlitFrom(images[7], Common::Point(x - 1, _bounds.height() - 4));
_surface.transBlitFrom(images[6], Common::Point(x - 1, INVENTORY_YSIZE + 5)); _surface.SHtransBlitFrom(images[6], Common::Point(x - 1, INVENTORY_YSIZE + 5));
_surface.transBlitFrom(images[7], Common::Point(x - 1, INVENTORY_YSIZE + 2)); _surface.SHtransBlitFrom(images[7], Common::Point(x - 1, INVENTORY_YSIZE + 2));
} }
_surface.hLine(x + 2, INVENTORY_YSIZE + 2, INVENTORY_YSIZE + 8, INFO_BOTTOM); _surface.hLine(x + 2, INVENTORY_YSIZE + 2, INVENTORY_YSIZE + 8, INFO_BOTTOM);
@ -566,7 +566,7 @@ void WidgetInventory::drawInventory() {
// Draw the item // Draw the item
if (itemId < inv._holdings) { if (itemId < inv._holdings) {
ImageFrame &img = (*inv._invShapes[idx])[0]; ImageFrame &img = (*inv._invShapes[idx])[0];
_surface.transBlitFrom(img, Common::Point(pt.x + (INVENTORY_XSIZE - img._width) / 2, _surface.SHtransBlitFrom(img, Common::Point(pt.x + (INVENTORY_XSIZE - img._width) / 2,
pt.y + (INVENTORY_YSIZE - img._height) / 2)); pt.y + (INVENTORY_YSIZE - img._height) / 2));
} }
} }

View file

@ -257,17 +257,17 @@ void WidgetOptions::render(OptionRenderMode mode) {
// Setup the dialog // Setup the dialog
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
makeInfoArea(); makeInfoArea();
// Draw the lines separating options in the dialog // Draw the lines separating options in the dialog
int yp = _surface.fontHeight() + 7; int yp = _surface.fontHeight() + 7;
for (int idx = 0; idx < 7; ++idx) { for (int idx = 0; idx < 7; ++idx) {
_surface.transBlitFrom(images[4], Common::Point(0, yp - 1)); _surface.SHtransBlitFrom(images[4], Common::Point(0, yp - 1));
_surface.transBlitFrom(images[5], Common::Point(_surface.w() - images[5]._width, yp - 1)); _surface.SHtransBlitFrom(images[5], Common::Point(_surface.width() - images[5]._width, yp - 1));
_surface.hLine(3, yp, _surface.w() - 4, INFO_TOP); _surface.hLine(3, yp, _surface.width() - 4, INFO_TOP);
_surface.hLine(3, yp + 1, _surface.w() - 4, INFO_MIDDLE); _surface.hLine(3, yp + 1, _surface.width() - 4, INFO_MIDDLE);
_surface.hLine(3, yp + 2, _surface.w() - 4, INFO_BOTTOM); _surface.hLine(3, yp + 2, _surface.width() - 4, INFO_BOTTOM);
yp += _surface.fontHeight() + 7; yp += _surface.fontHeight() + 7;
if (idx == 1) if (idx == 1)
@ -281,7 +281,7 @@ void WidgetOptions::render(OptionRenderMode mode) {
for (int idx = 0, yp = 5; idx < 11; ++idx, yp += _surface.fontHeight() + 7) { for (int idx = 0, yp = 5; idx < 11; ++idx, yp += _surface.fontHeight() + 7) {
if (mode == OP_ALL || idx == _selector || idx == _oldSelector) { if (mode == OP_ALL || idx == _selector || idx == _oldSelector) {
if (mode == OP_NAMES) if (mode == OP_NAMES)
_surface.fillRect(Common::Rect(4, yp, _surface.w() - 5, yp + _surface.fontHeight() - 1), TRANSPARENCY); _surface.fillRect(Common::Rect(4, yp, _surface.width() - 5, yp + _surface.fontHeight() - 1), TRANSPARENCY);
byte color = (idx == _selector) ? COMMAND_HIGHLIGHTED : INFO_TOP; byte color = (idx == _selector) ? COMMAND_HIGHLIGHTED : INFO_TOP;
Common::String str; Common::String str;
@ -302,11 +302,11 @@ void WidgetOptions::render(OptionRenderMode mode) {
int num = (_surface.fontHeight() + 4) & 0xfe; int num = (_surface.fontHeight() + 4) & 0xfe;
int sliderY = yp + num / 2 - 8; int sliderY = yp + num / 2 - 8;
_surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5, _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY); sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2,
_surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE); _surface.width() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE);
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6)); drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.width() - _surface.widestChar(), sliderY + 6));
_surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2, _surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2,
_midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE); _midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
@ -315,7 +315,7 @@ void WidgetOptions::render(OptionRenderMode mode) {
if (_midiSliderX - 4 > _surface.widestChar()) if (_midiSliderX - 4 > _surface.widestChar())
_surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM); _surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM);
if (_midiSliderX + 4 < _surface.w() - _surface.widestChar()) if (_midiSliderX + 4 < _surface.width() - _surface.widestChar())
_surface.fillRect(Common::Rect(_midiSliderX + 4, sliderY, _midiSliderX + 4, sliderY + 4), INFO_BOTTOM); _surface.fillRect(Common::Rect(_midiSliderX + 4, sliderY, _midiSliderX + 4, sliderY + 4), INFO_BOTTOM);
break; break;
} }
@ -332,18 +332,18 @@ void WidgetOptions::render(OptionRenderMode mode) {
int num = (_surface.fontHeight() + 4) & 0xfe; int num = (_surface.fontHeight() + 4) & 0xfe;
int sliderY = yp + num / 2 - 8; int sliderY = yp + num / 2 - 8;
_surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.w() - 5, _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY); sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
_surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1, _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.width() - _surface.widestChar() - 1,
sliderY + 3), INFO_MIDDLE); sliderY + 3), INFO_MIDDLE);
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6)); drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.width() - _surface.widestChar(), sliderY + 6));
_surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1, _surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1,
sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE); sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4, drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4,
sliderY - (num - 6) / 2 + num)); sliderY - (num - 6) / 2 + num));
if (_digiSliderX - 4 > _surface.widestChar()) if (_digiSliderX - 4 > _surface.widestChar())
_surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM); _surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM);
if (_digiSliderX + 4 < _surface.w() - _surface.widestChar()) if (_digiSliderX + 4 < _surface.width() - _surface.widestChar())
_surface.fillRect(Common::Rect(_digiSliderX + 4, sliderY, _digiSliderX + 4, sliderY + 4), INFO_BOTTOM); _surface.fillRect(Common::Rect(_digiSliderX + 4, sliderY, _digiSliderX + 4, sliderY + 4), INFO_BOTTOM);
break; break;
} }
@ -375,7 +375,7 @@ void WidgetOptions::render(OptionRenderMode mode) {
// Unless we're doing one of the Slider Controls, print the text for the line // Unless we're doing one of the Slider Controls, print the text for the line
if (idx != 3 && idx != 6) { if (idx != 3 && idx != 6) {
int xp = (_surface.w() - _surface.stringWidth(str)) / 2; int xp = (_surface.width() - _surface.stringWidth(str)) / 2;
_surface.writeString(str, Common::Point(xp, yp), color); _surface.writeString(str, Common::Point(xp, yp), color);
} }
} }

View file

@ -47,7 +47,7 @@ void WidgetPassword::show() {
// Create the surface // Create the surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
makeInfoArea(); makeInfoArea();
// Draw the header area // Draw the header area
@ -55,8 +55,8 @@ void WidgetPassword::show() {
_surface.hLine(3, _surface.fontHeight() + 7, _bounds.width() - 4, INFO_TOP); _surface.hLine(3, _surface.fontHeight() + 7, _bounds.width() - 4, INFO_TOP);
_surface.hLine(3, _surface.fontHeight() + 8, _bounds.width() - 4, INFO_MIDDLE); _surface.hLine(3, _surface.fontHeight() + 8, _bounds.width() - 4, INFO_MIDDLE);
_surface.hLine(3, _surface.fontHeight() + 9, _bounds.width() - 4, INFO_BOTTOM); _surface.hLine(3, _surface.fontHeight() + 9, _bounds.width() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 7 - 1)); _surface.SHtransBlitFrom(images[4], Common::Point(0, _surface.fontHeight() + 7 - 1));
_surface.transBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, _surface.fontHeight() + 7 - 1)); _surface.SHtransBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, _surface.fontHeight() + 7 - 1));
// Set the password entry data // Set the password entry data
_cursorPos = Common::Point(_surface.widestChar(), _surface.fontHeight() + 12); _cursorPos = Common::Point(_surface.widestChar(), _surface.fontHeight() + 12);

View file

@ -48,22 +48,22 @@ void WidgetQuit::show() {
// Create the surface // Create the surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
makeInfoArea(); makeInfoArea();
// Draw the message text // Draw the message text
_surface.writeString(FIXED(AreYouSureYou), Common::Point((_surface.w() - _surface.stringWidth(FIXED(AreYouSureYou))) / 2, 5), INFO_TOP); _surface.writeString(FIXED(AreYouSureYou), Common::Point((_surface.width() - _surface.stringWidth(FIXED(AreYouSureYou))) / 2, 5), INFO_TOP);
_surface.writeString(FIXED(WishToQuit), Common::Point((_surface.w() - _surface.stringWidth(FIXED(WishToQuit))) / 2, _surface.writeString(FIXED(WishToQuit), Common::Point((_surface.width() - _surface.stringWidth(FIXED(WishToQuit))) / 2,
_surface.fontHeight() + 9), INFO_TOP); _surface.fontHeight() + 9), INFO_TOP);
// Draw the horizontal bars seperating the commands and the message // Draw the horizontal bars seperating the commands and the message
int yp = (_surface.fontHeight() + 4) * 2 + 3; int yp = (_surface.fontHeight() + 4) * 2 + 3;
for (int idx = 0; idx < 2; ++idx) { for (int idx = 0; idx < 2; ++idx) {
_surface.transBlitFrom(images[4], Common::Point(0, yp - 1)); _surface.SHtransBlitFrom(images[4], Common::Point(0, yp - 1));
_surface.transBlitFrom(images[5], Common::Point(_surface.w() - images[5]._width, yp - 1)); _surface.SHtransBlitFrom(images[5], Common::Point(_surface.width() - images[5]._width, yp - 1));
_surface.hLine(3, yp, _surface.w() - 4, INFO_TOP); _surface.hLine(3, yp, _surface.width() - 4, INFO_TOP);
_surface.hLine(3, yp + 1, _surface.w() - 4, INFO_MIDDLE); _surface.hLine(3, yp + 1, _surface.width() - 4, INFO_MIDDLE);
_surface.hLine(3, yp + 2, _surface.w() - 4, INFO_BOTTOM); _surface.hLine(3, yp + 2, _surface.width() - 4, INFO_BOTTOM);
const char *btn = (idx == 0) ? YES : NO; const char *btn = (idx == 0) ? YES : NO;
_surface.writeString(btn, Common::Point((_bounds.width() - _surface.stringWidth(btn)) / 2, yp + 5), INFO_TOP); _surface.writeString(btn, Common::Point((_bounds.width() - _surface.stringWidth(btn)) / 2, yp + 5), INFO_TOP);
@ -129,11 +129,11 @@ void WidgetQuit::handleEvents() {
if (_select != _oldSelect) { if (_select != _oldSelect) {
byte color = (_select == 1) ? COMMAND_HIGHLIGHTED : INFO_TOP; byte color = (_select == 1) ? COMMAND_HIGHLIGHTED : INFO_TOP;
int yp = (_surface.fontHeight() + 4) * 2 + 8; int yp = (_surface.fontHeight() + 4) * 2 + 8;
_surface.writeString(FIXED(Yes), Common::Point((_surface.w() - _surface.stringWidth(FIXED(Yes))) / 2, yp), color); _surface.writeString(FIXED(Yes), Common::Point((_surface.width() - _surface.stringWidth(FIXED(Yes))) / 2, yp), color);
color = (_select == 0) ? COMMAND_HIGHLIGHTED : INFO_TOP; color = (_select == 0) ? COMMAND_HIGHLIGHTED : INFO_TOP;
yp += (_surface.fontHeight() + 7); yp += (_surface.fontHeight() + 7);
_surface.writeString(FIXED(No), Common::Point((_surface.w() - _surface.stringWidth(FIXED(No))) / 2, yp), color); _surface.writeString(FIXED(No), Common::Point((_surface.width() - _surface.stringWidth(FIXED(No))) / 2, yp), color);
} }
_oldSelect = _select; _oldSelect = _select;

View file

@ -100,7 +100,7 @@ void WidgetTalk::load() {
// Set up the surface // Set up the surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
// Form the background for the new window // Form the background for the new window
makeInfoArea(); makeInfoArea();
@ -389,7 +389,7 @@ void WidgetTalk::render(Highlight highlightMode) {
if (highlightMode == HL_NO_HIGHLIGHTING || _statementLines[idx]._num == _selector || if (highlightMode == HL_NO_HIGHLIGHTING || _statementLines[idx]._num == _selector ||
_statementLines[idx]._num == _oldSelector) { _statementLines[idx]._num == _oldSelector) {
// Erase the line contents // Erase the line contents
_surface.fillRect(Common::Rect(3, yp, _surface.w() - BUTTON_SIZE - 3, yp + _surface.fontHeight()), TRANSPARENCY); _surface.fillRect(Common::Rect(3, yp, _surface.width() - BUTTON_SIZE - 3, yp + _surface.fontHeight()), TRANSPARENCY);
// Different coloring based on whether the option has been previously chosen or not // Different coloring based on whether the option has been previously chosen or not
byte color = (!talk._talkHistory[talk._converseNum][_statementLines[idx]._num]) ? byte color = (!talk._talkHistory[talk._converseNum][_statementLines[idx]._num]) ?

View file

@ -166,7 +166,7 @@ void WidgetText::render(const Common::String &str) {
// Allocate a surface for the window // Allocate a surface for the window
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
// Form the background for the new window // Form the background for the new window
makeInfoArea(); makeInfoArea();
@ -195,7 +195,7 @@ void WidgetMessage::load(const Common::String &str, int time) {
// Allocate a surface for the window // Allocate a surface for the window
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
// Form the background for the new window and write the line of text // Form the background for the new window and write the line of text
makeInfoArea(); makeInfoArea();

View file

@ -47,7 +47,7 @@ void WidgetTooltipBase::draw() {
// Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer, // Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer,
// since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer // since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer
screen.transBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x, screen.SHtransBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x,
_bounds.top - screen._currentScroll.y)); _bounds.top - screen._currentScroll.y));
// Store a copy of the drawn area for later erasing // Store a copy of the drawn area for later erasing
@ -126,7 +126,7 @@ void WidgetTooltip::setText(const Common::String &str) {
// Reallocate the text surface with the new size // Reallocate the text surface with the new size
_surface.create(width, height); _surface.create(width, height);
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
if (line2.empty()) { if (line2.empty()) {
// Only a single line // Only a single line

View file

@ -127,7 +127,7 @@ void WidgetVerbs::render() {
// Create the drawing surface // Create the drawing surface
_surface.create(_bounds.width(), _bounds.height()); _surface.create(_bounds.width(), _bounds.height());
_surface.fill(TRANSPARENCY); _surface.clear(TRANSPARENCY);
// Draw basic background // Draw basic background
makeInfoArea(); makeInfoArea();
@ -142,8 +142,8 @@ void WidgetVerbs::render() {
_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.width() - 4, INFO_MIDDLE); _surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 1, _bounds.width() - 4, INFO_MIDDLE);
_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.width() - 4, INFO_BOTTOM); _surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.width() - 4, INFO_BOTTOM);
_surface.transBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1) - 1)); _surface.SHtransBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1) - 1));
_surface.transBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width, _surface.SHtransBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width,
(_surface.fontHeight() + 7) * (idx + 1) - 1)); (_surface.fontHeight() + 7) * (idx + 1) - 1));
} }
} }