VOYEUR: Changed engine to use Graphics::ManagedSurface

This commit is contained in:
Paul Gilbert 2016-03-10 21:53:14 -05:00
parent 077250acfb
commit c05a09d337
13 changed files with 457 additions and 447 deletions

View File

@ -470,7 +470,7 @@ void RL2Decoder::play(VoyeurEngine *vm, int resourceOffset,
if (hasDirtyPalette()) {
const byte *palette = getPalette();
vm->_graphicsManager->setPalette128(palette, paletteStart, paletteCount);
vm->_screen->setPalette128(palette, paletteStart, paletteCount);
}
if (needsUpdate()) {
@ -482,15 +482,14 @@ void RL2Decoder::play(VoyeurEngine *vm, int resourceOffset,
Common::Point pt(READ_LE_UINT16(imgPos + 4 * picCtr) - 32,
READ_LE_UINT16(imgPos + 4 * picCtr + 2) - 20);
vm->_graphicsManager->sDrawPic(newPic, &videoFrame, pt);
vm->_screen->sDrawPic(newPic, &videoFrame, pt);
++picCtr;
}
}
// Decode the next frame and display
const Graphics::Surface *frame = decodeNextFrame();
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
(byte *)vm->_graphicsManager->_screenSurface.getPixels());
vm->_screen->blitFrom(*frame);
}
vm->_eventsManager->getMouseInfo();

View File

@ -240,10 +240,10 @@ void SVoy::reviewAnEvidEvent(int eventIndex) {
int frameOff = e._computerOff;
if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
_vm->_graphicsManager->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
_vm->_graphicsManager->_vPort->setupViewPort(_vm->_graphicsManager->_backgroundPage);
_vm->_graphicsManager->_backColors->startFade();
_vm->_screen->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_screen->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
_vm->_screen->_vPort->setupViewPort(_vm->_screen->_backgroundPage);
_vm->_screen->_backColors->startFade();
_vm->doEvidDisplay(frameOff, e._dead);
_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
@ -262,10 +262,10 @@ void SVoy::reviewComputerEvent(int eventIndex) {
_computerTextId = e._computerOn;
if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
_vm->_graphicsManager->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
_vm->_graphicsManager->_vPort->setupViewPort(_vm->_graphicsManager->_backgroundPage);
_vm->_graphicsManager->_backColors->startFade();
_vm->_screen->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_screen->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
_vm->_screen->_vPort->setupViewPort(_vm->_screen->_backgroundPage);
_vm->_screen->_backColors->startFade();
_vm->flipPageAndWaitForFade();
_vm->getComputerBrush();

View File

@ -21,7 +21,7 @@
*/
#include "voyeur/debugger.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/voyeur.h"
#include "voyeur/staticres.h"

View File

@ -111,18 +111,18 @@ void EventsManager::mainVoyeurIntFunc() {
}
void EventsManager::sWaitFlip() {
Common::Array<ViewPortResource *> &viewPorts = _vm->_graphicsManager->_viewPortListPtr->_entries;
Common::Array<ViewPortResource *> &viewPorts = _vm->_screen->_viewPortListPtr->_entries;
for (uint idx = 0; idx < viewPorts.size(); ++idx) {
ViewPortResource &viewPort = *viewPorts[idx];
if (_vm->_graphicsManager->_saveBack && (viewPort._flags & DISPFLAG_40)) {
Common::Rect *clipPtr = _vm->_graphicsManager->_clipPtr;
_vm->_graphicsManager->_clipPtr = &viewPort._clipRect;
if (_vm->_screen->_saveBack && (viewPort._flags & DISPFLAG_40)) {
Common::Rect *clipPtr = _vm->_screen->_clipPtr;
_vm->_screen->_clipPtr = &viewPort._clipRect;
if (viewPort._restoreFn)
(_vm->_graphicsManager->*viewPort._restoreFn)(&viewPort);
(_vm->_screen->*viewPort._restoreFn)(&viewPort);
_vm->_graphicsManager->_clipPtr = clipPtr;
_vm->_screen->_clipPtr = clipPtr;
viewPort._rectListCount[viewPort._pageIndex] = 0;
viewPort._rectListPtr[viewPort._pageIndex]->clear();
viewPort._flags &= ~DISPFLAG_40;
@ -158,9 +158,7 @@ void EventsManager::checkForNextFrameCounter() {
showMousePosition();
// Display the frame
g_system->copyRectToScreen((byte *)_vm->_graphicsManager->_screenSurface.getPixels(),
SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_system->updateScreen();
_vm->_screen->update();
// Signal the ScummVM debugger
_vm->_debugger->onFrame();
@ -178,10 +176,8 @@ void EventsManager::showMousePosition() {
mousePos += Common::String::format(" - (%d,%d)", pt.x, pt.y);
}
_vm->_graphicsManager->_screenSurface.fillRect(
Common::Rect(0, 0, 110, font.getFontHeight()), 0);
font.drawString(&_vm->_graphicsManager->_screenSurface, mousePos,
0, 0, 110, 63);
_vm->_screen->fillRect(Common::Rect(0, 0, 110, font.getFontHeight()), 0);
font.drawString(_vm->_screen, mousePos, 0, 0, 110, 63);
}
void EventsManager::voyeurTimer() {
@ -299,11 +295,11 @@ void EventsManager::startFade(CMapResource *cMap) {
if (cMap->_steps > 0) {
_fadeStatus = cMap->_fadeStatus | 1;
byte *vgaP = &_vm->_graphicsManager->_VGAColors[_fadeFirstCol * 3];
byte *vgaP = &_vm->_screen->_VGAColors[_fadeFirstCol * 3];
int mapIndex = 0;
for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
ViewPortPalEntry &palEntry = _vm->_graphicsManager->_viewPortListPtr->_palette[idx];
ViewPortPalEntry &palEntry = _vm->_screen->_viewPortListPtr->_palette[idx];
palEntry._rEntry = vgaP[0] << 8;
int rDiff = (cMap->_entries[mapIndex * 3] << 8) - palEntry._rEntry;
palEntry._rChange = rDiff / cMap->_steps;
@ -325,7 +321,7 @@ void EventsManager::startFade(CMapResource *cMap) {
_intPtr._skipFading = true;
_fadeIntNode._flags &= ~1;
} else {
byte *vgaP = &_vm->_graphicsManager->_VGAColors[_fadeFirstCol * 3];
byte *vgaP = &_vm->_screen->_VGAColors[_fadeFirstCol * 3];
int mapIndex = 0;
for (int idx = _fadeFirstCol; idx <= _fadeLastCol; ++idx, vgaP += 3) {
@ -371,8 +367,8 @@ void EventsManager::vDoFadeInt() {
}
for (int i = _fadeFirstCol; i <= _fadeLastCol; ++i) {
ViewPortPalEntry &palEntry = _vm->_graphicsManager->_viewPortListPtr->_palette[i];
byte *vgaP = &_vm->_graphicsManager->_VGAColors[palEntry._palIndex * 3];
ViewPortPalEntry &palEntry = _vm->_screen->_viewPortListPtr->_palette[i];
byte *vgaP = &_vm->_screen->_VGAColors[palEntry._palIndex * 3];
palEntry._rEntry += palEntry._rChange;
palEntry._gEntry += palEntry._gChange;
@ -395,7 +391,7 @@ void EventsManager::vDoCycleInt() {
for (int idx = 3; idx >= 0; --idx) {
if (_cyclePtr->_type[idx] && --_cycleTime[idx] <= 0) {
byte *pSrc = _cycleNext[idx];
byte *pPal = _vm->_graphicsManager->_VGAColors;
byte *pPal = _vm->_screen->_VGAColors;
if (_cyclePtr->_type[idx] != 1) {
// New palette data being specified - loop to set entries
@ -521,7 +517,7 @@ void EventsManager::setCursor(PictureResource *pic) {
cursor._bounds = pic->_bounds;
cursor._flags = DISPFLAG_CURSOR;
_vm->_graphicsManager->sDrawPic(pic, &cursor, Common::Point());
_vm->_screen->sDrawPic(pic, &cursor, Common::Point());
}
void EventsManager::setCursor(byte *cursorData, int width, int height, int keyColor) {
@ -531,16 +527,16 @@ void EventsManager::setCursor(byte *cursorData, int width, int height, int keyCo
void EventsManager::setCursorColor(int idx, int mode) {
switch (mode) {
case 0:
_vm->_graphicsManager->setColor(idx, 90, 90, 232);
_vm->_screen->setColor(idx, 90, 90, 232);
break;
case 1:
_vm->_graphicsManager->setColor(idx, 232, 90, 90);
_vm->_screen->setColor(idx, 232, 90, 90);
break;
case 2:
_vm->_graphicsManager->setColor(idx, 90, 232, 90);
_vm->_screen->setColor(idx, 90, 232, 90);
break;
case 3:
_vm->_graphicsManager->setColor(idx, 90, 232, 232);
_vm->_screen->setColor(idx, 90, 232, 232);
break;
default:
break;
@ -564,12 +560,12 @@ void EventsManager::getMouseInfo() {
if (_cursorBlinked) {
_cursorBlinked = false;
_vm->_graphicsManager->setOneColor(128, 220, 20, 20);
_vm->_graphicsManager->setColor(128, 220, 20, 20);
_vm->_screen->setOneColor(128, 220, 20, 20);
_vm->_screen->setColor(128, 220, 20, 20);
} else {
_cursorBlinked = true;
_vm->_graphicsManager->setOneColor(128, 220, 220, 220);
_vm->_graphicsManager->setColor(128, 220, 220, 220);
_vm->_screen->setOneColor(128, 220, 220, 220);
_vm->_screen->setColor(128, 220, 220, 220);
}
}
}
@ -585,11 +581,11 @@ void EventsManager::getMouseInfo() {
void EventsManager::startCursorBlink() {
if (_vm->_voy->_eventFlags & EVTFLAG_RECORDING) {
_vm->_graphicsManager->setOneColor(128, 55, 5, 5);
_vm->_graphicsManager->setColor(128, 220, 20, 20);
_vm->_screen->setOneColor(128, 55, 5, 5);
_vm->_screen->setColor(128, 220, 20, 20);
_intPtr._hasPalette = true;
_vm->_graphicsManager->drawDot();
_vm->_screen->drawDot();
//copySection();
}
}

View File

@ -21,7 +21,7 @@
*/
#include "voyeur/files.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/voyeur.h"
#include "voyeur/staticres.h"
@ -359,7 +359,7 @@ void BoltFile::resolveIt(uint32 id, byte **p) {
}
}
void BoltFile::resolveFunction(uint32 id, GraphicMethodPtr *fn) {
void BoltFile::resolveFunction(uint32 id, ScreenMethodPtr *fn) {
if ((int32)id == -1)
*fn = NULL;
else
@ -485,8 +485,8 @@ void BVoyBoltFile::initViewPortList() {
_state._curMemberPtr->_viewPortListResource = res = new ViewPortListResource(
_state, _state._curMemberPtr->_data);
_state._vm->_graphicsManager->_viewPortListPtr = res;
_state._vm->_graphicsManager->_vPort = res->_entries[0];
_state._vm->_screen->_viewPortListPtr = res;
_state._vm->_screen->_vPort = res->_entries[0];
}
void BVoyBoltFile::initFontInfo() {
@ -752,24 +752,24 @@ DisplayResource::DisplayResource(VoyeurEngine *vm) {
void DisplayResource::sFillBox(int width, int height) {
assert(_vm);
bool saveBack = _vm->_graphicsManager->_saveBack;
_vm->_graphicsManager->_saveBack = false;
bool saveBack = _vm->_screen->_saveBack;
_vm->_screen->_saveBack = false;
PictureResource pr;
pr._flags = DISPFLAG_1;
pr._select = 0xff;
pr._pick = 0;
pr._onOff = _vm->_graphicsManager->_drawPtr->_penColor;
pr._onOff = _vm->_screen->_drawPtr->_penColor;
pr._bounds = Common::Rect(0, 0, width, height);
_vm->_graphicsManager->sDrawPic(&pr, this, _vm->_graphicsManager->_drawPtr->_pos);
_vm->_graphicsManager->_saveBack = saveBack;
_vm->_screen->sDrawPic(&pr, this, _vm->_screen->_drawPtr->_pos);
_vm->_screen->_saveBack = saveBack;
}
bool DisplayResource::clipRect(Common::Rect &rect) {
Common::Rect clippingRect;
if (_vm->_graphicsManager->_clipPtr) {
clippingRect = *_vm->_graphicsManager->_clipPtr;
if (_vm->_screen->_clipPtr) {
clippingRect = *_vm->_screen->_clipPtr;
} else if (_flags & DISPFLAG_VIEWPORT) {
clippingRect = ((ViewPortResource *)this)->_clipRect;
} else {
@ -804,18 +804,18 @@ bool DisplayResource::clipRect(Common::Rect &rect) {
}
int DisplayResource::drawText(const Common::String &msg) {
GraphicsManager &gfxManager = *_vm->_graphicsManager;
assert(gfxManager._fontPtr);
assert(gfxManager._fontPtr->_curFont);
FontInfoResource &fontInfo = *gfxManager._fontPtr;
PictureResource &fontChar = *_vm->_graphicsManager->_fontChar;
Screen &screen = *_vm->_screen;
assert(screen._fontPtr);
assert(screen._fontPtr->_curFont);
FontInfoResource &fontInfo = *screen._fontPtr;
PictureResource &fontChar = *_vm->_screen->_fontChar;
FontResource &fontData = *fontInfo._curFont;
int xShadows[9] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };
int yShadows[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
Common::Rect *clipPtr = gfxManager._clipPtr;
Common::Rect *clipPtr = screen._clipPtr;
if (!(fontInfo._picFlags & DISPFLAG_1))
gfxManager._clipPtr = NULL;
screen._clipPtr = NULL;
int minChar = fontData._minChar;
int padding = fontData._padding;
@ -834,7 +834,7 @@ int DisplayResource::drawText(const Common::String &msg) {
(ViewPortResource *)this;
if ((fontInfo._fontFlags & DISPFLAG_1) || fontInfo._justify ||
(gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT))) {
(screen._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT))) {
msgWidth = viewPort->textWidth(msg);
yp = pos.y;
xp = pos.x;
@ -898,18 +898,18 @@ int DisplayResource::drawText(const Common::String &msg) {
}
}
if (gfxManager._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT)) {
if (screen._saveBack && fontInfo._fontSaveBack && (_flags & DISPFLAG_VIEWPORT)) {
viewPort->addSaveRect(viewPort->_pageIndex, viewPort->_fontRect);
}
if (fontInfo._fontFlags & DISPFLAG_1) {
gfxManager._drawPtr->_pos = Common::Point(viewPort->_fontRect.left, viewPort->_fontRect.top);
gfxManager._drawPtr->_penColor = fontInfo._backColor;
screen._drawPtr->_pos = Common::Point(viewPort->_fontRect.left, viewPort->_fontRect.top);
screen._drawPtr->_penColor = fontInfo._backColor;
sFillBox(viewPort->_fontRect.width(), viewPort->_fontRect.height());
}
bool saveBack = gfxManager._saveBack;
gfxManager._saveBack = false;
bool saveBack = screen._saveBack;
screen._saveBack = false;
int count = 0;
if (fontInfo._fontFlags & DISPFLAG_4)
@ -970,7 +970,7 @@ int DisplayResource::drawText(const Common::String &msg) {
uint16 offset = READ_LE_UINT16(fontData._charOffsets + charValue * 2);
fontChar._imgData = fontData._charImages + offset * 2;
gfxManager.sDrawPic(&fontChar, this, Common::Point(xp, yp));
screen.sDrawPic(&fontChar, this, Common::Point(xp, yp));
fontChar._imgData = NULL;
xp += charWidth + padding;
@ -982,8 +982,8 @@ int DisplayResource::drawText(const Common::String &msg) {
if (fontInfo._justify == ALIGN_LEFT)
fontInfo._pos.x = xp;
gfxManager._saveBack = saveBack;
gfxManager._clipPtr = clipPtr;
screen._saveBack = saveBack;
screen._clipPtr = clipPtr;
return msgWidth;
}
@ -993,7 +993,7 @@ int DisplayResource::textWidth(const Common::String &msg) {
return 0;
const char *msgP = msg.c_str();
FontResource &fontData = *_vm->_graphicsManager->_fontPtr->_curFont;
FontResource &fontData = *_vm->_screen->_fontPtr->_curFont;
int minChar = fontData._minChar;
int maxChar = fontData._maxChar;
int padding = fontData._padding;
@ -1085,9 +1085,9 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
mode = 226;
}
if (mode != state._vm->_graphicsManager->_SVGAMode) {
state._vm->_graphicsManager->_SVGAMode = mode;
state._vm->_graphicsManager->clearPalette();
if (mode != state._vm->_screen->_SVGAMode) {
state._vm->_screen->_SVGAMode = mode;
state._vm->_screen->clearPalette();
}
int screenOffset = READ_LE_UINT32(&src[18]) & 0xffff;
@ -1096,13 +1096,14 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
if (_flags & PICFLAG_CLEAR_SCREEN) {
// Clear screen picture. That's right. This game actually has a picture
// resource flag to clear the screen! Bizarre.
Graphics::Surface &s = state._vm->_graphicsManager->_screenSurface;
s.fillRect(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
state._vm->_screen->clear();
} else {
// Direct screen loading picture. In this case, the raw data of the resource
// is directly decompressed into the screen surface. Again, bizarre.
byte *pDest = (byte *)state._vm->_graphicsManager->_screenSurface.getPixels();
Screen &screen = *state._vm->_screen;
byte *pDest = (byte *)screen.getPixels();
state.decompress(pDest, SCREEN_WIDTH * SCREEN_HEIGHT, state._curMemberPtr->_mode);
screen.markAllDirty();
}
} else {
if (_flags & PICFLAG_CLEAR_SCREEN00) {
@ -1249,13 +1250,13 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
ys + READ_LE_UINT16(src + 0x4C));
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x7A), &dummy);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), (GraphicMethodPtr *)&_fn1);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x82), (GraphicMethodPtr *)&_setupFn);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x86), (GraphicMethodPtr *)&_addFn);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x8A), (GraphicMethodPtr *)&_restoreFn);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x7E), (ScreenMethodPtr *)&_fn1);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x82), (ScreenMethodPtr *)&_setupFn);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x86), (ScreenMethodPtr *)&_addFn);
state._curLibPtr->resolveFunction(READ_LE_UINT32(src + 0x8A), (ScreenMethodPtr *)&_restoreFn);
if (!_restoreFn && _addFn)
_addFn = &GraphicsManager::addRectNoSaveBack;
_addFn = &Screen::addRectNoSaveBack;
}
ViewPortResource::~ViewPortResource() {
@ -1327,19 +1328,19 @@ void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clippi
_restoreFn = restoreFn;
if (setupFn)
(_state._vm->_graphicsManager->*setupFn)(this);
(_state._vm->_screen->*setupFn)(this);
}
void ViewPortResource::setupViewPort() {
setupViewPort(_state._vm->_graphicsManager->_backgroundPage, NULL,
&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
&GraphicsManager::restoreMCGASaveRect);
setupViewPort(_state._vm->_screen->_backgroundPage, NULL,
&Screen::setupMCGASaveRect, &Screen::addRectOptSaveRect,
&Screen::restoreMCGASaveRect);
}
void ViewPortResource::setupViewPort(PictureResource *pic, Common::Rect *clippingRect) {
setupViewPort(pic, clippingRect,
&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
&GraphicsManager::restoreMCGASaveRect);
&Screen::setupMCGASaveRect, &Screen::addRectOptSaveRect,
&Screen::restoreMCGASaveRect);
}
void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
@ -1347,7 +1348,7 @@ void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
if (clipRect(rect)) {
if (_addFn) {
(_state._vm->_graphicsManager->*_addFn)(this, pageIndex, rect);
(_state._vm->_screen->*_addFn)(this, pageIndex, rect);
} else if (_rectListCount[pageIndex] != -1) {
_rectListPtr[pageIndex]->push_back(rect);
}
@ -1355,26 +1356,26 @@ void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) {
}
void ViewPortResource::fillPic(byte onOff) {
_state._vm->_graphicsManager->fillPic(this, onOff);
_state._vm->_screen->fillPic(this, onOff);
}
void ViewPortResource::drawIfaceTime() {
// Hour display
_state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_screen->drawANumber(_state._vm->_screen->_vPort,
(_state._vm->_gameHour / 10) == 0 ? 10 : _state._vm->_gameHour / 10,
Common::Point(161, 25));
_state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_screen->drawANumber(_state._vm->_screen->_vPort,
_state._vm->_gameHour % 10, Common::Point(172, 25));
// Minute display
_state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_screen->drawANumber(_state._vm->_screen->_vPort,
_state._vm->_gameMinute / 10, Common::Point(190, 25));
_state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_screen->drawANumber(_state._vm->_screen->_vPort,
_state._vm->_gameMinute % 10, Common::Point(201, 25));
// AM/PM indicator
PictureResource *pic = _state._vm->_bVoy->boltEntry(_state._vm->_voy->_isAM ? 272 : 273)._picResource;
_state._vm->_graphicsManager->sDrawPic(pic, _state._vm->_graphicsManager->_vPort,
_state._vm->_screen->sDrawPic(pic, _state._vm->_screen->_vPort,
Common::Point(215, 27));
}
@ -1382,9 +1383,9 @@ void ViewPortResource::drawPicPerm(PictureResource *pic, const Common::Point &pt
Common::Rect bounds = pic->_bounds;
bounds.translate(pt.x, pt.y);
bool saveBack = _state._vm->_graphicsManager->_saveBack;
_state._vm->_graphicsManager->_saveBack = false;
_state._vm->_graphicsManager->sDrawPic(pic, this, pt);
bool saveBack = _state._vm->_screen->_saveBack;
_state._vm->_screen->_saveBack = false;
_state._vm->_screen->sDrawPic(pic, this, pt);
clipRect(bounds);
for (int pageIndex = 0; pageIndex < _pageCount; ++pageIndex) {
@ -1393,7 +1394,7 @@ void ViewPortResource::drawPicPerm(PictureResource *pic, const Common::Point &pt
}
}
_state._vm->_graphicsManager->_saveBack = saveBack;
_state._vm->_screen->_saveBack = saveBack;
}
/*------------------------------------------------------------------------*/
@ -1526,7 +1527,7 @@ CMapResource::CMapResource(BoltFilesState &state, const byte *src): _vm(state._v
_entries = new byte[count * 3];
Common::copy(src + 6, src + 6 + 3 * count, _entries);
int palIndex = state._vm->_graphicsManager->_viewPortListPtr->_palIndex;
int palIndex = state._vm->_screen->_viewPortListPtr->_palIndex;
if (_end > palIndex)
_end = palIndex;
if (_start > palIndex)

View File

@ -27,7 +27,7 @@
#include "common/file.h"
#include "common/rect.h"
#include "common/str.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
namespace Voyeur {
@ -112,7 +112,7 @@ public:
byte *memberAddr(uint32 id);
byte *memberAddrOffset(uint32 id);
void resolveIt(uint32 id, byte **p);
void resolveFunction(uint32 id, GraphicMethodPtr *fn);
void resolveFunction(uint32 id, ScreenMethodPtr *fn);
BoltEntry &boltEntry(uint16 id);
BoltEntry &getBoltEntryFromLong(uint32 id);
@ -340,7 +340,7 @@ public:
int _rectListCount[3];
Common::Rect _clipRect;
GraphicMethodPtr _fn1;
ScreenMethodPtr _fn1;
ViewPortSetupPtr _setupFn;
ViewPortAddPtr _addFn;
ViewPortRestorePtr _restoreFn;

View File

@ -21,7 +21,7 @@
*/
#include "voyeur/files.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/voyeur.h"
#include "voyeur/staticres.h"
@ -461,7 +461,7 @@ void ThreadResource::parsePlayCommands() {
pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource;
pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2 + 1)._cMapResource;
_vm->_graphicsManager->_vPort->setupViewPort(pic);
_vm->_screen->_vPort->setupViewPort(pic);
pal->startFade();
_vm->flipPageAndWaitForFade();
@ -980,10 +980,10 @@ int ThreadResource::doApt() {
_vm->_soundManager->startVOCPlay(_vm->_soundManager->getVOCFileName(_vm->_currentVocId));
_vm->_currentVocId = 151;
_vm->_graphicsManager->setColor(129, 82, 82, 82);
_vm->_graphicsManager->setColor(130, 112, 112, 112);
_vm->_graphicsManager->setColor(131, 215, 215, 215);
_vm->_graphicsManager->setColor(132, 235, 235, 235);
_vm->_screen->setColor(129, 82, 82, 82);
_vm->_screen->setColor(130, 112, 112, 112);
_vm->_screen->setColor(131, 215, 215, 215);
_vm->_screen->setColor(132, 235, 235, 235);
_vm->_eventsManager->_intPtr._hasPalette = true;
@ -1044,7 +1044,7 @@ int ThreadResource::doApt() {
// Draw the text description for the highlighted hotspot
pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId +
hotspotId + 6)._picResource;
_vm->_graphicsManager->sDrawPic(pic, _vm->_graphicsManager->_vPort,
_vm->_screen->sDrawPic(pic, _vm->_screen->_vPort,
Common::Point(106, 200));
}
@ -1112,10 +1112,10 @@ void ThreadResource::doRoom() {
if (!vm._bVoy->getBoltGroup(vm._playStampGroupId))
return;
vm._graphicsManager->_backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource;
vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource;
vm._graphicsManager->_vPort->setupViewPort(vm._graphicsManager->_backgroundPage);
vm._graphicsManager->_backColors->startFade();
vm._screen->_backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource;
vm._screen->_backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource;
vm._screen->_vPort->setupViewPort(vm._screen->_backgroundPage);
vm._screen->_backColors->startFade();
voy._fadingStep1 = 2;
voy._fadingStep2 = 0;
@ -1144,7 +1144,7 @@ void ThreadResource::doRoom() {
bool breakFlag = false;
while (!vm.shouldQuit() && !breakFlag) {
_vm->_voyeurArea = AREA_ROOM;
vm._graphicsManager->setColor(128, 0, 255, 0);
vm._screen->setColor(128, 0, 255, 0);
vm._eventsManager->_intPtr._hasPalette = true;
do {
@ -1186,7 +1186,7 @@ void ThreadResource::doRoom() {
}
vm._eventsManager->_intPtr._hasPalette = true;
vm._graphicsManager->flipPage();
vm._screen->flipPage();
vm._eventsManager->sWaitFlip();
} while (!vm.shouldQuit() && !vm._eventsManager->_mouseClicked);
@ -1234,13 +1234,13 @@ void ThreadResource::doRoom() {
// WORKAROUND: Skipped code from the original, that freed the group,
// reloaded it, and reloaded the cursors
vm._graphicsManager->_backColors = vm._bVoy->boltEntry(
vm._screen->_backColors = vm._bVoy->boltEntry(
vm._playStampGroupId + 1)._cMapResource;
vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry(
vm._screen->_backgroundPage = vm._bVoy->boltEntry(
vm._playStampGroupId)._picResource;
vm._graphicsManager->_vPort->setupViewPort();
vm._graphicsManager->_backColors->startFade();
vm._screen->_vPort->setupViewPort();
vm._screen->_backColors->startFade();
_vm->flipPageAndWait();
while (!vm.shouldQuit() && (vm._eventsManager->_fadeStatus & 1))
@ -1265,7 +1265,7 @@ void ThreadResource::doRoom() {
_vm->flipPageAndWait();
vm._graphicsManager->fadeUpICF1();
vm._screen->fadeUpICF1();
voy._eventFlags &= EVTFLAG_RECORDING;
vm._eventsManager->showCursor();
}
@ -1350,7 +1350,7 @@ int ThreadResource::doInterface() {
_vm->_soundManager->startVOCPlay(fname);
_vm->_eventsManager->getMouseInfo();
_vm->_graphicsManager->setColor(240, 220, 220, 220);
_vm->_screen->setColor(240, 220, 220, 220);
_vm->_eventsManager->_intPtr._hasPalette = true;
_vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
@ -1424,20 +1424,20 @@ int ThreadResource::doInterface() {
// Regularly update the time display
if (_vm->_voy->_RTANum & 2) {
_vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_screen->drawANumber(_vm->_screen->_vPort,
_vm->_gameMinute / 10, Common::Point(190, 25));
_vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_screen->drawANumber(_vm->_screen->_vPort,
_vm->_gameMinute % 10, Common::Point(201, 25));
if (_vm->_voy->_RTANum & 4) {
int v = _vm->_gameHour / 10;
_vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_screen->drawANumber(_vm->_screen->_vPort,
v == 0 ? 10 : v, Common::Point(161, 25));
_vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_screen->drawANumber(_vm->_screen->_vPort,
_vm->_gameHour % 10, Common::Point(172, 25));
pic = _vm->_bVoy->boltEntry(_vm->_voy->_isAM ? 272 : 273)._picResource;
_vm->_graphicsManager->sDrawPic(pic, _vm->_graphicsManager->_vPort,
_vm->_screen->sDrawPic(pic, _vm->_screen->_vPort,
Common::Point(215, 27));
}
}
@ -1605,16 +1605,16 @@ void ThreadResource::loadTheApt() {
_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
_vm->_voy->_aptLoadMode = -1;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_screen->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_playStampGroupId + 5)._picResource;
_vm->_graphicsManager->_vPort->setupViewPort(
_vm->_graphicsManager->_backgroundPage);
_vm->_screen->_vPort->setupViewPort(
_vm->_screen->_backgroundPage);
} else {
_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_screen->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_playStampGroupId + 5)._picResource;
_vm->_graphicsManager->_vPort->setupViewPort(
_vm->_graphicsManager->_backgroundPage);
_vm->_screen->_vPort->setupViewPort(
_vm->_screen->_backgroundPage);
}
CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 4)._cMapResource;
@ -1624,10 +1624,10 @@ void ThreadResource::loadTheApt() {
}
void ThreadResource::freeTheApt() {
_vm->_graphicsManager->fadeDownICF1(5);
_vm->_screen->fadeDownICF1(5);
_vm->flipPageAndWaitForFade();
_vm->_graphicsManager->fadeUpICF1();
_vm->_screen->fadeUpICF1();
if (_vm->_currentVocId != -1) {
_vm->_soundManager->stopVOCPlay();
@ -1635,17 +1635,17 @@ void ThreadResource::freeTheApt() {
}
if (_vm->_voy->_aptLoadMode == -1) {
_vm->_graphicsManager->fadeDownICF(6);
_vm->_screen->fadeDownICF(6);
} else {
doAptAnim(2);
}
if (_vm->_voy->_aptLoadMode == 140) {
_vm->_graphicsManager->screenReset();
_vm->_graphicsManager->resetPalette();
_vm->_screen->screenReset();
_vm->_screen->resetPalette();
}
_vm->_graphicsManager->_vPort->setupViewPort(nullptr);
_vm->_screen->_vPort->setupViewPort(nullptr);
_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
_vm->_playStampGroupId = -1;
_vm->_voy->_viewBounds = nullptr;
@ -1705,7 +1705,7 @@ void ThreadResource::doAptAnim(int mode) {
for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) {
PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource;
_vm->_graphicsManager->_vPort->setupViewPort(pic);
_vm->_screen->_vPort->setupViewPort(pic);
pal->startFade();
_vm->flipPageAndWait();

View File

@ -8,7 +8,7 @@ MODULE_OBJS := \
events.o \
files.o \
files_threads.o \
graphics.o \
screen.o \
sound.o \
staticres.o \
voyeur.o \

View File

@ -20,7 +20,7 @@
*
*/
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/voyeur.h"
#include "voyeur/staticres.h"
#include "engines/util.h"
@ -38,7 +38,8 @@ DrawInfo::DrawInfo(int penColor, const Common::Point &pos) {
/*------------------------------------------------------------------------*/
GraphicsManager::GraphicsManager(VoyeurEngine *vm) : _defaultDrawInfo(1, Common::Point()), _drawPtr(&_defaultDrawInfo), _vm(vm) {
Screen::Screen(VoyeurEngine *vm) : Graphics::Screen(), _vm(vm), _drawPtr(&_defaultDrawInfo),
_defaultDrawInfo(1, Common::Point()) {
_SVGAMode = 0;
_planeSelect = 0;
_saveBack = true;
@ -52,18 +53,17 @@ GraphicsManager::GraphicsManager(VoyeurEngine *vm) : _defaultDrawInfo(1, Common:
_backColors = nullptr;
}
void GraphicsManager::sInitGraphics() {
void Screen::sInitGraphics() {
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false);
_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
create(SCREEN_WIDTH, SCREEN_HEIGHT);
clearPalette();
}
GraphicsManager::~GraphicsManager() {
_screenSurface.free();
Screen::~Screen() {
delete _fontChar;
}
void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
void Screen::setupMCGASaveRect(ViewPortResource *viewPort) {
if (viewPort->_activePage) {
viewPort->_activePage->_flags |= DISPFLAG_1;
Common::Rect *clipRect = _clipPtr;
@ -77,7 +77,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
viewPort->_rectListCount[1] = -1;
}
void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
void Screen::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
if (viewPort->_rectListCount[idx] == -1)
return;
@ -86,7 +86,7 @@ void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, co
++viewPort->_rectListCount[idx];
}
void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
void Screen::restoreMCGASaveRect(ViewPortResource *viewPort) {
if (viewPort->_rectListCount[0] != -1) {
for (int i = 0; i < viewPort->_rectListCount[0]; ++i) {
addRectOptSaveRect(viewPort, 1, (*viewPort->_rectListPtr[0])[i]);
@ -106,11 +106,11 @@ void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
viewPort->_rectListCount[1] = count;
}
void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
void Screen::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
// Stubbed/dummy method in the original.
}
void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
void Screen::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
const Common::Point &initialOffset) {
int width1, width2;
int widthDiff, widthDiff2;
@ -128,7 +128,8 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
int runLength;
byte *srcImgData, *destImgData;
byte *srcP, *destP;
const byte *srcP;
byte *destP;
byte byteVal, byteVal2;
PictureResource *srcPic;
@ -292,7 +293,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
// loc_2566F
if (srcFlags & DISPFLAG_2) {
// loc_256FA
srcP = (byte *)_screenSurface.getPixels() + srcOffset;
srcP = (const byte *)getPixels() + srcOffset;
for (int yp = 0; yp < height1; ++yp) {
for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
@ -325,13 +326,16 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
} else {
// loc_25829
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
Common::copy(srcP, srcP + width2, destP);
srcP += width2 + widthDiff;
destP += width2 + widthDiff2;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
}
} else {
@ -341,13 +345,16 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
error("TODO: sDrawPic variation");
} else {
// loc_2606D
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
Common::copy(srcP, srcP + width2, destP);
destP += width2 + widthDiff2;
srcP += width2 + widthDiff;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
}
} else {
@ -530,11 +537,14 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
// loc_27477
if (destFlags & DISPFLAG_8) {
// loc_27481
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
Common::fill(destP, destP + width2, onOff);
destP += width2 + widthDiff2;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
} else {
// loc_2753C
destP = destImgData + screenOffset;
@ -561,7 +571,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
if (srcFlags & PICFLAG_100) {
if (isClipped) {
// loc_266E3
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
tmpWidth = (tmpWidth < 0) ? -tmpWidth : 0;
int xMax = tmpWidth + width2;
tmpHeight = (tmpHeight < 0) ? -tmpHeight : 0;
@ -592,9 +602,12 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
if (yp >= tmpHeight)
destP += widthDiff2;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
} else {
// loc_26815
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
for (int xi = 0; xi < width2; ++xi, ++destP) {
@ -618,10 +631,13 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
destP += widthDiff2;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
} else {
// Direct screen write
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
@ -631,6 +647,9 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
destP += widthDiff2;
srcP += widthDiff;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
} else if (srcFlags & PICFLAG_100) {
srcP = srcImgData;
@ -663,7 +682,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
} else {
// loc_26BD5
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
byteVal2 = 0;
@ -684,10 +703,13 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
destP += widthDiff2;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
} else {
// loc_26C9A
destP = (byte *)_screenSurface.getPixels() + screenOffset;
destP = (byte *)getPixels() + screenOffset;
for (int yp = 0; yp < height1; ++yp) {
for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) {
@ -696,6 +718,9 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
destP += widthDiff2;
srcP += widthDiff;
}
addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
} else {
// loc_26D2F
@ -850,12 +875,12 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
}
void GraphicsManager::drawANumber(DisplayResource *display, int num, const Common::Point &pt) {
void Screen::drawANumber(DisplayResource *display, int num, const Common::Point &pt) {
PictureResource *pic = _vm->_bVoy->boltEntry(num + 261)._picResource;
sDrawPic(pic, display, pt);
}
void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
void Screen::fillPic(DisplayResource *display, byte onOff) {
PictureResource *pic;
if (display->_flags & DISPFLAG_VIEWPORT) {
pic = ((ViewPortResource *)display)->_currentPic;
@ -876,11 +901,11 @@ void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
/**
* Queues the given picture for display
*/
void GraphicsManager::sDisplayPic(PictureResource *pic) {
void Screen::sDisplayPic(PictureResource *pic) {
_vm->_eventsManager->_intPtr._flipWait = true;
}
void GraphicsManager::flipPage() {
void Screen::flipPage() {
Common::Array<ViewPortResource *> &viewPorts = _viewPortListPtr->_entries;
bool flipFlag = false;
@ -907,7 +932,7 @@ void GraphicsManager::flipPage() {
}
}
void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
void Screen::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
PictureResource *srcPic, PictureResource *destPic) {
// WORKAROUND: Since _backgroundPage can point to a resource freed at the end of display methods,
// I'm now explicitly resetting it to null in screenReset(), so at this point it can be null
@ -929,33 +954,26 @@ void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rec
_saveBack = saveBack;
}
void GraphicsManager::clearPalette() {
byte palette[768];
Common::fill(&palette[0], &palette[768], 0);
g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
}
void GraphicsManager::setPalette(const byte *palette, int start, int count) {
g_system->getPaletteManager()->setPalette(palette, start, count);
void Screen::setPalette(const byte *palette, int start, int count) {
Graphics::Screen::setPalette(palette, start, count);
_vm->_eventsManager->_gameData._hasPalette = false;
}
void GraphicsManager::setPalette128(const byte *palette, int start, int count) {
void Screen::setPalette128(const byte *palette, int start, int count) {
byte rgb[3];
g_system->getPaletteManager()->grabPalette(&rgb[0], 128, 1);
g_system->getPaletteManager()->setPalette(palette, start, count);
g_system->getPaletteManager()->setPalette(&rgb[0], 128, 1);
getPalette(&rgb[0], 128, 1);
Graphics::Screen::setPalette(palette, start, count);
Graphics::Screen::setPalette(&rgb[0], 128, 1);
}
void GraphicsManager::resetPalette() {
void Screen::resetPalette() {
for (int i = 0; i < 256; ++i)
setColor(i, 0, 0, 0);
_vm->_eventsManager->_intPtr._hasPalette = true;
}
void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
void Screen::setColor(int idx, byte r, byte g, byte b) {
byte *vgaP = &_VGAColors[idx * 3];
vgaP[0] = r;
vgaP[1] = g;
@ -965,7 +983,7 @@ void GraphicsManager::setColor(int idx, byte r, byte g, byte b) {
_vm->_eventsManager->_intPtr._palEndIndex = MAX(_vm->_eventsManager->_intPtr._palEndIndex, idx);
}
void GraphicsManager::setOneColor(int idx, byte r, byte g, byte b) {
void Screen::setOneColor(int idx, byte r, byte g, byte b) {
byte palEntry[3];
palEntry[0] = r;
palEntry[1] = g;
@ -973,7 +991,7 @@ void GraphicsManager::setOneColor(int idx, byte r, byte g, byte b) {
g_system->getPaletteManager()->setPalette(&palEntry[0], idx, 1);
}
void GraphicsManager::setColors(int start, int count, const byte *pal) {
void Screen::setColors(int start, int count, const byte *pal) {
for (int i = 0; i < count; ++i) {
if ((i + start) != 128) {
const byte *rgb = pal + i * 3;
@ -984,7 +1002,7 @@ void GraphicsManager::setColors(int start, int count, const byte *pal) {
_vm->_eventsManager->_intPtr._hasPalette = true;
}
void GraphicsManager::screenReset() {
void Screen::screenReset() {
resetPalette();
_backgroundPage = NULL;
@ -994,7 +1012,7 @@ void GraphicsManager::screenReset() {
_vm->flipPageAndWait();
}
void GraphicsManager::fadeDownICF1(int steps) {
void Screen::fadeDownICF1(int steps) {
if (steps > 0) {
int stepAmount = _vm->_voy->_fadingAmount2 / steps;
@ -1007,7 +1025,7 @@ void GraphicsManager::fadeDownICF1(int steps) {
_vm->_voy->_fadingAmount2 = 0;
}
void GraphicsManager::fadeUpICF1(int steps) {
void Screen::fadeUpICF1(int steps) {
if (steps > 0) {
int stepAmount = (63 - _vm->_voy->_fadingAmount2) / steps;
@ -1020,7 +1038,7 @@ void GraphicsManager::fadeUpICF1(int steps) {
_vm->_voy->_fadingAmount2 = 63;
}
void GraphicsManager::fadeDownICF(int steps) {
void Screen::fadeDownICF(int steps) {
if (steps > 0) {
_vm->_eventsManager->hideCursor();
int stepAmount1 = _vm->_voy->_fadingAmount1 / steps;
@ -1037,14 +1055,19 @@ void GraphicsManager::fadeDownICF(int steps) {
_vm->_voy->_fadingAmount2 = 0;
}
void GraphicsManager::drawDot() {
for (int y = 0; y < 9; ++y) {
byte *pDest = (byte *)_screenSurface.getPixels() + DOT_LINE_START[y] + DOT_LINE_OFFSET[y];
Common::fill(pDest, pDest + DOT_LINE_LENGTH[y], 0x80);
void Screen::drawDot() {
for (int idx = 0; idx < 9; ++idx) {
uint offset = DOT_LINE_START[idx] + DOT_LINE_OFFSET[idx];
int xp = offset % SCREEN_WIDTH;
int yp = offset / SCREEN_WIDTH;
byte *pDest = (byte *)getPixels() + offset;
Common::fill(pDest, pDest + DOT_LINE_LENGTH[idx], 0x80);
addDirtyRect(Common::Rect(xp, yp, xp + DOT_LINE_LENGTH[idx], yp + 1));
}
}
void GraphicsManager::synchronize(Common::Serializer &s) {
void Screen::synchronize(Common::Serializer &s) {
s.syncBytes(&_VGAColors[0], PALETTE_SIZE);
}

View File

@ -27,17 +27,15 @@
#include "common/array.h"
#include "common/rect.h"
#include "common/serializer.h"
#include "graphics/surface.h"
#include "graphics/screen.h"
namespace Voyeur {
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
#define PALETTE_COUNT 256
#define PALETTE_SIZE (256 * 3)
class VoyeurEngine;
class GraphicsManager;
class Screen;
class DisplayResource;
class PictureResource;
class ViewPortResource;
@ -54,12 +52,12 @@ public:
DrawInfo(int penColor, const Common::Point &pos);
};
typedef void (GraphicsManager::*GraphicMethodPtr)();
typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
typedef void (Screen::*ScreenMethodPtr)();
typedef void (Screen::*ViewPortSetupPtr)(ViewPortResource *);
typedef void (Screen::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
typedef void (Screen::*ViewPortRestorePtr)(ViewPortResource *);
class GraphicsManager {
class Screen: public Graphics::Screen {
public:
byte _VGAColors[PALETTE_SIZE];
PictureResource *_backgroundPage;
@ -69,7 +67,6 @@ public:
bool _saveBack;
Common::Rect *_clipPtr;
uint _planeSelect;
Graphics::Surface _screenSurface;
CMapResource *_backColors;
FontInfoResource *_fontPtr;
PictureResource *_fontChar;
@ -81,8 +78,8 @@ private:
void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
PictureResource *srcPic, PictureResource *destPic);
public:
GraphicsManager(VoyeurEngine *vm);
~GraphicsManager();
Screen(VoyeurEngine *vm);
virtual ~Screen();
void sInitGraphics();
@ -96,7 +93,6 @@ public:
void sDisplayPic(PictureResource *pic);
void drawANumber(DisplayResource *display, int num, const Common::Point &pt);
void flipPage();
void clearPalette();
void setPalette(const byte *palette, int start, int count);
void setPalette128(const byte *palette, int start, int count);
void resetPalette();

View File

@ -22,7 +22,7 @@
#include "voyeur/voyeur.h"
#include "voyeur/animation.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/staticres.h"
#include "common/scummsys.h"
#include "common/config-manager.h"
@ -40,7 +40,7 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
_debugger = nullptr;
_eventsManager = nullptr;
_filesManager = nullptr;
_graphicsManager = nullptr;
_screen = nullptr;
_soundManager = nullptr;
_voy = nullptr;
_bVoy = NULL;
@ -65,13 +65,6 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
_debugger = new Debugger(this);
_eventsManager = new EventsManager(this);
_filesManager = new FilesManager(this);
_graphicsManager = new GraphicsManager(this);
_soundManager = new SoundManager(_mixer);
_voy = new SVoy(this);
_stampLibPtr = nullptr;
_controlGroupPtr = nullptr;
_stampData = nullptr;
@ -88,7 +81,7 @@ VoyeurEngine::~VoyeurEngine() {
delete _bVoy;
delete _voy;
delete _soundManager;
delete _graphicsManager;
delete _screen;
delete _filesManager;
delete _eventsManager;
delete _debugger;
@ -126,15 +119,22 @@ void VoyeurEngine::ESP_Init() {
}
void VoyeurEngine::globalInitBolt() {
_debugger = new Debugger(this);
_eventsManager = new EventsManager(this);
_filesManager = new FilesManager(this);
_screen = new Screen(this);
_soundManager = new SoundManager(_mixer);
_voy = new SVoy(this);
initBolt();
_filesManager->openBoltLib("bvoy.blt", _bVoy);
_bVoy->getBoltGroup(0x000);
_bVoy->getBoltGroup(0x100);
_graphicsManager->_fontPtr = &_defaultFontInfo;
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
assert(_graphicsManager->_fontPtr->_curFont);
_screen->_fontPtr = &_defaultFontInfo;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
assert(_screen->_fontPtr->_curFont);
// Setup default flags
_voy->_viewBounds = nullptr;
@ -144,13 +144,13 @@ void VoyeurEngine::globalInitBolt() {
void VoyeurEngine::initBolt() {
vInitInterrupts();
_graphicsManager->sInitGraphics();
_screen->sInitGraphics();
_eventsManager->vInitColor();
initInput();
}
void VoyeurEngine::vInitInterrupts() {
_eventsManager->_intPtr._palette = &_graphicsManager->_VGAColors[0];
_eventsManager->_intPtr._palette = &_screen->_VGAColors[0];
}
void VoyeurEngine::initInput() {
@ -213,8 +213,8 @@ bool VoyeurEngine::doHeadTitle() {
}
void VoyeurEngine::showConversionScreen() {
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x502)._picResource;
_graphicsManager->_vPort->setupViewPort();
_screen->_backgroundPage = _bVoy->boltEntry(0x502)._picResource;
_screen->_vPort->setupViewPort();
flipPageAndWait();
// Immediate palette load to show the initial screen
@ -237,7 +237,7 @@ void VoyeurEngine::showConversionScreen() {
flipPageAndWaitForFade();
_graphicsManager->screenReset();
_screen->screenReset();
}
bool VoyeurEngine::doLock() {
@ -249,28 +249,28 @@ bool VoyeurEngine::doLock() {
if (_bVoy->getBoltGroup(0x700)) {
Common::String password = "3333";
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x700);
_graphicsManager->_backColors = _bVoy->getCMapResource(0x701);
_screen->_backgroundPage = _bVoy->getPictureResource(0x700);
_screen->_backColors = _bVoy->getCMapResource(0x701);
PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
_voy->_viewBounds = _bVoy->boltEntry(0x704)._rectResource;
Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(0x705)._rectResource->_entries;
assert(cursorPic);
_graphicsManager->_vPort->setupViewPort();
_screen->_vPort->setupViewPort();
_graphicsManager->_backColors->startFade();
_graphicsManager->_vPort->_parent->_flags |= DISPFLAG_8;
_graphicsManager->flipPage();
_screen->_backColors->startFade();
_screen->_vPort->_parent->_flags |= DISPFLAG_8;
_screen->flipPage();
_eventsManager->sWaitFlip();
while (!shouldQuit() && (_eventsManager->_fadeStatus & 1))
_eventsManager->delay(1);
_eventsManager->setCursorColor(127, 0);
_graphicsManager->setColor(1, 64, 64, 64);
_graphicsManager->setColor(2, 96, 96, 96);
_graphicsManager->setColor(3, 160, 160, 160);
_graphicsManager->setColor(4, 224, 224, 224);
_screen->setColor(1, 64, 64, 64);
_screen->setColor(2, 96, 96, 96);
_screen->setColor(3, 160, 160, 160);
_screen->setColor(4, 224, 224, 224);
// Set up the cursor
_eventsManager->setCursor(cursorPic);
@ -278,9 +278,9 @@ bool VoyeurEngine::doLock() {
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
_graphicsManager->_fontPtr->_fontSaveBack = 0;
_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
_screen->_fontPtr->_fontSaveBack = 0;
_screen->_fontPtr->_fontFlags = DISPFLAG_NONE;
Common::String dateString = "ScummVM";
Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
@ -288,16 +288,16 @@ bool VoyeurEngine::doLock() {
bool firstLoop = true;
bool breakFlag = false;
while (!breakFlag && !shouldQuit()) {
_graphicsManager->_vPort->setupViewPort();
_screen->_vPort->setupViewPort();
flipPageAndWait();
// Display the last play time
_graphicsManager->_fontPtr->_pos = Common::Point(0, 97);
_graphicsManager->_fontPtr->_justify = ALIGN_CENTER;
_graphicsManager->_fontPtr->_justifyWidth = 384;
_graphicsManager->_fontPtr->_justifyHeight = 97;
_screen->_fontPtr->_pos = Common::Point(0, 97);
_screen->_fontPtr->_justify = ALIGN_CENTER;
_screen->_fontPtr->_justifyWidth = 384;
_screen->_fontPtr->_justifyHeight = 97;
_graphicsManager->_vPort->drawText(displayString);
_screen->_vPort->drawText(displayString);
flipPageAndWait();
if (firstLoop) {
@ -356,7 +356,7 @@ bool VoyeurEngine::doLock() {
} else if (key == 11) {
// New code
if ((password.empty() && displayString.empty()) || (password != displayString)) {
_graphicsManager->_vPort->setupViewPort();
_screen->_vPort->setupViewPort();
password = displayString;
displayString = "";
continue;
@ -373,9 +373,9 @@ bool VoyeurEngine::doLock() {
_soundManager->playVOCMap(wrongVoc, wrongVocSize);
}
_graphicsManager->fillPic(_graphicsManager->_vPort, 0);
_screen->fillPic(_screen->_vPort, 0);
flipPageAndWait();
_graphicsManager->resetPalette();
_screen->resetPalette();
_voy->_viewBounds = nullptr;
_bVoy->freeBoltGroup(0x700);
@ -393,9 +393,9 @@ void VoyeurEngine::showTitleScreen() {
if (!_bVoy->getBoltGroup(0x500))
return;
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x500);
_screen->_backgroundPage = _bVoy->getPictureResource(0x500);
_graphicsManager->_vPort->setupViewPort();
_screen->_vPort->setupViewPort();
flipPageAndWait();
// Immediate palette load to show the initial screen
@ -422,18 +422,18 @@ void VoyeurEngine::showTitleScreen() {
return;
}
_graphicsManager->screenReset();
_screen->screenReset();
_eventsManager->delayClick(200);
// Voyeur title
playRL2Video("a1100100.rl2");
_graphicsManager->screenReset();
_screen->screenReset();
_bVoy->freeBoltGroup(0x500);
}
void VoyeurEngine::doOpening() {
_graphicsManager->screenReset();
_screen->screenReset();
if (!_bVoy->getBoltGroup(0x200))
return;
@ -459,10 +459,10 @@ void VoyeurEngine::doOpening() {
_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
for (int i = 0; i < 256; ++i)
_graphicsManager->setColor(i, 8, 8, 8);
_screen->setColor(i, 8, 8, 8);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_vPort->setupViewPort();
_screen->_vPort->setupViewPort();
flipPageAndWait();
RL2Decoder decoder;
@ -472,14 +472,12 @@ void VoyeurEngine::doOpening() {
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
_graphicsManager->setPalette(palette, 0, 256);
_screen->setPalette(palette, 0, 256);
}
if (decoder.needsUpdate()) {
const Graphics::Surface *frame = decoder.decodeNextFrame();
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
(byte *)_graphicsManager->_screenSurface.getPixels());
_screen->blitFrom(*frame);
if (decoder.getCurFrame() >= (int32)READ_LE_UINT32(frameTable + frameIndex * 4)) {
if (creditShow) {
@ -499,7 +497,7 @@ void VoyeurEngine::doOpening() {
}
if (textPic) {
_graphicsManager->sDrawPic(textPic, _graphicsManager->_vPort, textPos);
_screen->sDrawPic(textPic, _screen->_vPort, textPos);
}
flipPageAndWait();
@ -527,14 +525,12 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
_graphicsManager->setPalette(palette, 0, 256);
_screen->setPalette(palette, 0, 256);
}
if (decoder.needsUpdate()) {
const Graphics::Surface *frame = decoder.decodeNextFrame();
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
(byte *)_graphicsManager->_screenSurface.getPixels());
_screen->blitFrom(*frame);
}
_eventsManager->getMouseInfo();
@ -573,17 +569,16 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
(decoder.getCurFrame() < endFrame)) {
if (decoder.needsUpdate()) {
const Graphics::Surface *frame = decoder.decodeNextFrame();
_screen->blitFrom(*frame);
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
(byte *)_graphicsManager->_screenSurface.getPixels());
if (_voy->_eventFlags & EVTFLAG_RECORDING)
_graphicsManager->drawDot();
_screen->drawDot();
}
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
_graphicsManager->setPalette(palette, 0, decoder.getPaletteCount());
_graphicsManager->setOneColor(128, 220, 20, 20);
_screen->setPalette(palette, 0, decoder.getPaletteCount());
_screen->setOneColor(128, 220, 20, 20);
}
_eventsManager->getMouseInfo();
@ -591,13 +586,13 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
}
// RL2 finished
_graphicsManager->screenReset();
_screen->screenReset();
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
if (_voy->_eventFlags & EVTFLAG_8) {
assert(pic);
byte *imgData = _graphicsManager->_vPort->_currentPic->_imgData;
_graphicsManager->_vPort->_currentPic->_imgData = pic->_imgData;
byte *imgData = _screen->_vPort->_currentPic->_imgData;
_screen->_vPort->_currentPic->_imgData = pic->_imgData;
pic->_imgData = imgData;
_voy->_eventFlags &= ~EVTFLAG_8;
}
@ -608,13 +603,13 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
void VoyeurEngine::playAudio(int audioId) {
_bVoy->getBoltGroup(0x7F00);
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x7F00 +
_screen->_backgroundPage = _bVoy->boltEntry(0x7F00 +
BLIND_TABLE[audioId] * 2)._picResource;
_graphicsManager->_backColors = _bVoy->boltEntry(0x7F01 +
_screen->_backColors = _bVoy->boltEntry(0x7F01 +
BLIND_TABLE[audioId] * 2)._cMapResource;
_graphicsManager->_vPort->setupViewPort();
_graphicsManager->_backColors->startFade();
_screen->_vPort->setupViewPort();
_screen->_backColors->startFade();
flipPageAndWaitForFade();
_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
@ -633,26 +628,26 @@ void VoyeurEngine::playAudio(int audioId) {
_soundManager->stopVOCPlay();
_bVoy->freeBoltGroup(0x7F00);
_graphicsManager->_vPort->setupViewPort(NULL);
_screen->_vPort->setupViewPort(NULL);
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
_voy->_playStampMode = 129;
}
void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
_graphicsManager->setColor(128, 16, 16, 16);
_graphicsManager->setColor(224, 220, 220, 220);
_screen->setColor(128, 16, 16, 16);
_screen->setColor(224, 220, 220, 220);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->_vPort->fillPic(0x80);
_graphicsManager->flipPage();
_screen->_vPort->setupViewPort(NULL);
_screen->_vPort->fillPic(0x80);
_screen->flipPage();
_eventsManager->sWaitFlip();
flipPageAndWait();
_graphicsManager->_vPort->fillPic(0x80);
_screen->_vPort->fillPic(0x80);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
FontInfoResource &fi = *_screen->_fontPtr;
fi._curFont = _bVoy->boltEntry(257)._fontResource;
fi._foreColor = 224;
fi._fontSaveBack = 0;
@ -661,7 +656,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
fi._justifyWidth = 384;
fi._justifyHeight = 120;
_graphicsManager->_vPort->drawText(time);
_screen->_vPort->drawText(time);
if (!location.empty()) {
fi._pos = Common::Point(0, 138);
@ -669,7 +664,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
fi._justifyWidth = 384;
fi._justifyHeight = 140;
_graphicsManager->_vPort->drawText(location);
_screen->_vPort->drawText(location);
}
flipPageAndWait();
@ -680,8 +675,8 @@ void VoyeurEngine::saveLastInplay() {
}
void VoyeurEngine::flipPageAndWait() {
_graphicsManager->_vPort->_flags |= DISPFLAG_8;
_graphicsManager->flipPage();
_screen->_vPort->_flags |= DISPFLAG_8;
_screen->flipPage();
_eventsManager->sWaitFlip();
}
@ -702,7 +697,7 @@ void VoyeurEngine::showEndingNews() {
PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource;
CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
_graphicsManager->_vPort->setupViewPort(pic);
_screen->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
@ -717,7 +712,7 @@ void VoyeurEngine::showEndingNews() {
pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource;
}
_graphicsManager->_vPort->setupViewPort(pic);
_screen->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
@ -852,7 +847,7 @@ void VoyeurEngine::synchronize(Common::Serializer &s) {
// Sub-systems
_voy->synchronize(s);
_graphicsManager->synchronize(s);
_screen->synchronize(s);
_mainThread->synchronize(s);
_controlPtr->_state->synchronize(s);
}
@ -906,8 +901,8 @@ void VoyeurSavegameHeader::write(Common::OutSaveFile *f, VoyeurEngine *vm, const
// Create a thumbnail and save it
Graphics::Surface *thumb = new Graphics::Surface();
::createThumbnail(thumb, (byte *)vm->_graphicsManager->_screenSurface.getPixels(),
SCREEN_WIDTH, SCREEN_HEIGHT, vm->_graphicsManager->_VGAColors);
::createThumbnail(thumb, (const byte *)vm->_screen->getPixels(),
SCREEN_WIDTH, SCREEN_HEIGHT, vm->_screen->_VGAColors);
Graphics::saveThumbnail(*f, *thumb);
thumb->free();
delete thumb;

View File

@ -27,7 +27,7 @@
#include "voyeur/data.h"
#include "voyeur/events.h"
#include "voyeur/files.h"
#include "voyeur/graphics.h"
#include "voyeur/screen.h"
#include "voyeur/sound.h"
#include "common/scummsys.h"
#include "common/system.h"
@ -164,7 +164,7 @@ public:
Debugger *_debugger;
EventsManager *_eventsManager;
FilesManager *_filesManager;
GraphicsManager *_graphicsManager;
Screen *_screen;
SoundManager *_soundManager;
SVoy *_voy;

View File

@ -149,8 +149,8 @@ void VoyeurEngine::playStamp() {
case 130: {
// user selected to send the tape
if (_bVoy->getBoltGroup(_playStampGroupId)) {
_graphicsManager->_backgroundPage = _bVoy->boltEntry(_playStampGroupId)._picResource;
_graphicsManager->_backColors = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
_screen->_backgroundPage = _bVoy->boltEntry(_playStampGroupId)._picResource;
_screen->_backColors = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
buttonId = getChooseButton();
if (_eventsManager->_rightClick)
@ -158,7 +158,7 @@ void VoyeurEngine::playStamp() {
buttonId = 4;
_bVoy->freeBoltGroup(_playStampGroupId);
_graphicsManager->screenReset();
_screen->screenReset();
_playStampGroupId = -1;
flag = true;
@ -232,8 +232,8 @@ void VoyeurEngine::closeStamp() {
}
void VoyeurEngine::doTailTitle() {
_graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->screenReset();
_screen->_vPort->setupViewPort(NULL);
_screen->screenReset();
if (_bVoy->getBoltGroup(0x600)) {
RL2Decoder decoder;
@ -245,12 +245,12 @@ void VoyeurEngine::doTailTitle() {
doClosingCredits();
if (!shouldQuit() && !_eventsManager->_mouseClicked) {
_graphicsManager->screenReset();
_screen->screenReset();
PictureResource *pic = _bVoy->boltEntry(0x602)._picResource;
CMapResource *pal = _bVoy->boltEntry(0x603)._cMapResource;
_graphicsManager->_vPort->setupViewPort(pic);
_screen->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
_eventsManager->delayClick(300);
@ -258,7 +258,7 @@ void VoyeurEngine::doTailTitle() {
pic = _bVoy->boltEntry(0x604)._picResource;
pal = _bVoy->boltEntry(0x605)._cMapResource;
_graphicsManager->_vPort->setupViewPort(pic);
_screen->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
_eventsManager->delayClick(120);
@ -283,26 +283,26 @@ void VoyeurEngine::doClosingCredits() {
const char *msg = (const char *)_bVoy->memberAddr(0x404);
const byte *creditList = (const byte *)_bVoy->memberAddr(0x405);
_graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->setColor(1, 180, 180, 180);
_graphicsManager->setColor(2, 200, 200, 200);
_screen->_vPort->setupViewPort(NULL);
_screen->setColor(1, 180, 180, 180);
_screen->setColor(2, 200, 200, 200);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x402)._fontResource;
_graphicsManager->_fontPtr->_foreColor = 2;
_graphicsManager->_fontPtr->_backColor = 2;
_graphicsManager->_fontPtr->_fontSaveBack = false;
_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x402)._fontResource;
_screen->_fontPtr->_foreColor = 2;
_screen->_fontPtr->_backColor = 2;
_screen->_fontPtr->_fontSaveBack = false;
_screen->_fontPtr->_fontFlags = DISPFLAG_NONE;
_soundManager->startVOCPlay(152);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
FontInfoResource &fi = *_screen->_fontPtr;
for (int idx = 0; idx < 78; ++idx) {
const byte *entry = creditList + idx * 6;
int flags = READ_LE_UINT16(entry + 4);
if (flags & 0x10)
_graphicsManager->_vPort->fillPic(0);
_screen->_vPort->fillPic(0);
if (flags & 1) {
fi._foreColor = 1;
@ -312,7 +312,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@ -324,7 +324,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@ -336,7 +336,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(38, READ_LE_UINT16(entry));
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
fi._foreColor = 2;
@ -345,7 +345,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(198, READ_LE_UINT16(entry));
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@ -357,7 +357,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
fi._foreColor = 2;
@ -367,7 +367,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry) + 13);
_graphicsManager->_vPort->drawText(msg);
_screen->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@ -381,19 +381,19 @@ void VoyeurEngine::doClosingCredits() {
}
_soundManager->stopVOCPlay();
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
_bVoy->freeBoltGroup(0x400);
}
void VoyeurEngine::doPiracy() {
_graphicsManager->screenReset();
_graphicsManager->setColor(1, 0, 0, 0);
_graphicsManager->setColor(2, 255, 255, 255);
_screen->screenReset();
_screen->setColor(1, 0, 0, 0);
_screen->setColor(2, 255, 255, 255);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->_vPort->fillPic(1);
_screen->_vPort->setupViewPort(NULL);
_screen->_vPort->fillPic(1);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
FontInfoResource &fi = *_screen->_fontPtr;
fi._curFont = _bVoy->boltEntry(0x101)._fontResource;
fi._foreColor = 2;
fi._backColor = 2;
@ -406,7 +406,7 @@ void VoyeurEngine::doPiracy() {
// Loop through the piracy message array to draw each line
for (int idx = 0, yp = 33; idx < 10; ++idx) {
fi._pos = Common::Point(0, yp);
_graphicsManager->_vPort->drawText(PIRACY_MESSAGE[idx]);
_screen->_vPort->drawText(PIRACY_MESSAGE[idx]);
yp += fi._curFont->_fontHeight + 4;
}
@ -439,27 +439,27 @@ void VoyeurEngine::reviewTape() {
_voy->_viewBounds = _bVoy->boltEntry(0x907)._rectResource;
Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(0x906)._rectResource->_entries;
_graphicsManager->_backColors = _bVoy->boltEntry(0x902)._cMapResource;
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x901)._picResource;
_graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->startFade();
_screen->_backColors = _bVoy->boltEntry(0x902)._cMapResource;
_screen->_backgroundPage = _bVoy->boltEntry(0x901)._picResource;
_screen->_vPort->setupViewPort(_screen->_backgroundPage);
_screen->_backColors->startFade();
flipPageAndWaitForFade();
_graphicsManager->setColor(1, 32, 32, 32);
_graphicsManager->setColor(2, 96, 96, 96);
_graphicsManager->setColor(3, 160, 160, 160);
_graphicsManager->setColor(4, 224, 224, 224);
_graphicsManager->setColor(9, 24, 64, 24);
_graphicsManager->setColor(10, 64, 132, 64);
_graphicsManager->setColor(11, 100, 192, 100);
_graphicsManager->setColor(12, 120, 248, 120);
_screen->setColor(1, 32, 32, 32);
_screen->setColor(2, 96, 96, 96);
_screen->setColor(3, 160, 160, 160);
_screen->setColor(4, 224, 224, 224);
_screen->setColor(9, 24, 64, 24);
_screen->setColor(10, 64, 132, 64);
_screen->setColor(11, 100, 192, 100);
_screen->setColor(12, 120, 248, 120);
_eventsManager->setCursorColor(128, 1);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
_graphicsManager->_fontPtr->_fontSaveBack = false;
_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
_screen->_fontPtr->_fontSaveBack = false;
_screen->_fontPtr->_fontFlags = DISPFLAG_NONE;
_eventsManager->getMouseInfo();
if (newX == -1) {
@ -481,37 +481,37 @@ void VoyeurEngine::reviewTape() {
needRedraw = false;
flipPageAndWait();
_graphicsManager->_drawPtr->_penColor = 0;
_graphicsManager->_drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
_graphicsManager->_backgroundPage->sFillBox(tempRect.width(), tempRect.height());
_screen->_drawPtr->_penColor = 0;
_screen->_drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
_screen->_backgroundPage->sFillBox(tempRect.width(), tempRect.height());
int yp = 45;
int eventNum = eventStart;
for (int lineNum = 0; lineNum < 8 && eventNum < _voy->_eventCount; ++lineNum, ++eventNum) {
_graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
_graphicsManager->_fontPtr->_picSelect = 0xff;
_graphicsManager->_fontPtr->_picPick = 7;
_graphicsManager->_fontPtr->_picOnOff = (lineNum == eventLine) ? 8 : 0;
_graphicsManager->_fontPtr->_pos = Common::Point(68, yp);
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 0;
_graphicsManager->_fontPtr->_justifyHeight = 0;
_screen->_fontPtr->_picFlags = DISPFLAG_NONE;
_screen->_fontPtr->_picSelect = 0xff;
_screen->_fontPtr->_picPick = 7;
_screen->_fontPtr->_picOnOff = (lineNum == eventLine) ? 8 : 0;
_screen->_fontPtr->_pos = Common::Point(68, yp);
_screen->_fontPtr->_justify = ALIGN_LEFT;
_screen->_fontPtr->_justifyWidth = 0;
_screen->_fontPtr->_justifyHeight = 0;
Common::String msg = _eventsManager->getEvidString(eventNum);
_graphicsManager->_backgroundPage->drawText(msg);
_screen->_backgroundPage->drawText(msg);
yp += 15;
}
_graphicsManager->_vPort->addSaveRect(
_graphicsManager->_vPort->_lastPage, tempRect);
_screen->_vPort->addSaveRect(
_screen->_vPort->_lastPage, tempRect);
flipPageAndWait();
_graphicsManager->_vPort->addSaveRect(
_graphicsManager->_vPort->_lastPage, tempRect);
_screen->_vPort->addSaveRect(
_screen->_vPort->_lastPage, tempRect);
}
_graphicsManager->sDrawPic(cursor, _graphicsManager->_vPort,
_screen->sDrawPic(cursor, _screen->_vPort,
_eventsManager->getMousePos());
flipPageAndWait();
@ -543,34 +543,34 @@ void VoyeurEngine::reviewTape() {
flipPageAndWait();
_graphicsManager->_drawPtr->_penColor = 0;
_graphicsManager->_drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
_graphicsManager->_backgroundPage->sFillBox(tempRect.width(), tempRect.height());
_screen->_drawPtr->_penColor = 0;
_screen->_drawPtr->_pos = Common::Point(tempRect.left, tempRect.top);
_screen->_backgroundPage->sFillBox(tempRect.width(), tempRect.height());
int yp = 45;
int eventNum = eventStart;
for (int idx = 0; idx < 8 && eventNum < _voy->_eventCount; ++idx, ++eventNum) {
_graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
_graphicsManager->_fontPtr->_picSelect = 0xff;
_graphicsManager->_fontPtr->_picPick = 7;
_graphicsManager->_fontPtr->_picOnOff = (idx == eventLine) ? 8 : 0;
_graphicsManager->_fontPtr->_pos = Common::Point(68, yp);
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 0;
_graphicsManager->_fontPtr->_justifyHeight = 0;
_screen->_fontPtr->_picFlags = DISPFLAG_NONE;
_screen->_fontPtr->_picSelect = 0xff;
_screen->_fontPtr->_picPick = 7;
_screen->_fontPtr->_picOnOff = (idx == eventLine) ? 8 : 0;
_screen->_fontPtr->_pos = Common::Point(68, yp);
_screen->_fontPtr->_justify = ALIGN_LEFT;
_screen->_fontPtr->_justifyWidth = 0;
_screen->_fontPtr->_justifyHeight = 0;
Common::String msg = _eventsManager->getEvidString(eventNum);
_graphicsManager->_backgroundPage->drawText(msg);
_screen->_backgroundPage->drawText(msg);
yp += 15;
}
_graphicsManager->_vPort->addSaveRect(
_graphicsManager->_vPort->_lastPage, tempRect);
_screen->_vPort->addSaveRect(
_screen->_vPort->_lastPage, tempRect);
flipPageAndWait();
_graphicsManager->_vPort->addSaveRect(
_graphicsManager->_vPort->_lastPage, tempRect);
_screen->_vPort->addSaveRect(
_screen->_vPort->_lastPage, tempRect);
flipPageAndWait();
_eventsManager->getMouseInfo();
@ -650,7 +650,7 @@ void VoyeurEngine::reviewTape() {
newY = _eventsManager->getMousePos().y;
_voy->_fadingType = 0;
_voy->_viewBounds = nullptr;
_graphicsManager->_vPort->setupViewPort(NULL);
_screen->_vPort->setupViewPort(NULL);
if (_currentVocId != -1) {
_voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime;
@ -673,13 +673,13 @@ void VoyeurEngine::reviewTape() {
_voy->_vocSecondsOffset = e._computerOn;
_bVoy->getBoltGroup(0x7F00);
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x7F00 +
_screen->_backgroundPage = _bVoy->boltEntry(0x7F00 +
BLIND_TABLE[_audioVideoId])._picResource;
_graphicsManager->_backColors = _bVoy->boltEntry(0x7F01 +
_screen->_backColors = _bVoy->boltEntry(0x7F01 +
BLIND_TABLE[_audioVideoId])._cMapResource;
_graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->startFade();
_screen->_vPort->setupViewPort(_screen->_backgroundPage);
_screen->_backColors->startFade();
flipPageAndWaitForFade();
_eventsManager->_intPtr._flashStep = 1;
@ -725,16 +725,16 @@ void VoyeurEngine::reviewTape() {
}
}
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
_graphicsManager->_vPort->fillPic(0);
_screen->_vPort->fillPic(0);
flipPageAndWait();
_bVoy->freeBoltGroup(0x900);
}
void VoyeurEngine::doGossip() {
_graphicsManager->resetPalette();
_graphicsManager->screenReset();
_screen->resetPalette();
_screen->screenReset();
if (!_bVoy->getBoltGroup(0x300))
return;
@ -752,7 +752,7 @@ void VoyeurEngine::doGossip() {
// Transfer initial background to video decoder
PictureResource videoFrame(decoder.getRL2VideoTrack()->getBackSurface());
bgPic->_bounds.moveTo(0, 0);
_graphicsManager->sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
_screen->sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
byte *frameNumsP = _bVoy->memberAddr(0x309);
byte *posP = _bVoy->boltEntry(0x30A)._data;
@ -762,8 +762,8 @@ void VoyeurEngine::doGossip() {
decoder.close();
// Reset the palette and clear the screen
_graphicsManager->resetPalette();
_graphicsManager->screenReset();
_screen->resetPalette();
_screen->screenReset();
// Play interview video
RL2Decoder decoder2;
@ -775,7 +775,7 @@ void VoyeurEngine::doGossip() {
decoder2.close();
_bVoy->freeBoltGroup(0x300);
_graphicsManager->screenReset();
_screen->screenReset();
}
void VoyeurEngine::doTapePlaying() {
@ -783,14 +783,14 @@ void VoyeurEngine::doTapePlaying() {
return;
_eventsManager->getMouseInfo();
_graphicsManager->_backColors = _bVoy->boltEntry(0xA01)._cMapResource;
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0xA00)._picResource;
_screen->_backColors = _bVoy->boltEntry(0xA01)._cMapResource;
_screen->_backgroundPage = _bVoy->boltEntry(0xA00)._picResource;
PictureResource *pic = _bVoy->boltEntry(0xA02)._picResource;
VInitCycleResource *cycle = _bVoy->boltEntry(0xA05)._vInitCycleResource;
_graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(57, 30));
_graphicsManager->_backColors->startFade();
_screen->_vPort->setupViewPort(_screen->_backgroundPage);
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(57, 30));
_screen->_backColors->startFade();
flipPageAndWaitForFade();
cycle->vStartCycle();
@ -932,9 +932,9 @@ int VoyeurEngine::getChooseButton() {
+ 6)._rectResource->_entries;
int selectedIndex = -1;
_graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->_steps = 0;
_graphicsManager->_backColors->startFade();
_screen->_vPort->setupViewPort(_screen->_backgroundPage);
_screen->_backColors->_steps = 0;
_screen->_backColors->startFade();
flipPageAndWait();
_voy->_viewBounds = _bVoy->boltEntry(_playStampGroupId + 7)._rectResource;
@ -955,7 +955,7 @@ int VoyeurEngine::getChooseButton() {
selectedIndex = idx;
if (selectedIndex != prevIndex) {
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;
_graphicsManager->sDrawPic(btnPic, _graphicsManager->_vPort,
_screen->sDrawPic(btnPic, _screen->_vPort,
Common::Point(106, 200));
cursorPic = _bVoy->boltEntry(_playStampGroupId + 4)._picResource;
@ -967,11 +967,11 @@ int VoyeurEngine::getChooseButton() {
if (selectedIndex == -1) {
cursorPic = _bVoy->boltEntry(_playStampGroupId + 2)._picResource;
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 12)._picResource;
_graphicsManager->sDrawPic(btnPic, _graphicsManager->_vPort,
_screen->sDrawPic(btnPic, _screen->_vPort,
Common::Point(106, 200));
}
_graphicsManager->sDrawPic(cursorPic, _graphicsManager->_vPort,
_screen->sDrawPic(cursorPic, _screen->_vPort,
Common::Point(pt.x + 13, pt.y - 12));
flipPageAndWait();
@ -982,9 +982,9 @@ int VoyeurEngine::getChooseButton() {
}
void VoyeurEngine::makeViewFinder() {
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x103)._picResource;
_graphicsManager->sDrawPic(_graphicsManager->_backgroundPage,
_graphicsManager->_vPort, Common::Point(0, 0));
_screen->_backgroundPage = _bVoy->boltEntry(0x103)._picResource;
_screen->sDrawPic(_screen->_backgroundPage,
_screen->_vPort, Common::Point(0, 0));
CMapResource *pal = _bVoy->boltEntry(0x104)._cMapResource;
int palOffset = 0;
@ -1016,22 +1016,22 @@ void VoyeurEngine::makeViewFinder() {
break;
}
_graphicsManager->_vPort->drawIfaceTime();
_screen->_vPort->drawIfaceTime();
doTimeBar();
pal->startFade();
flipPageAndWaitForFade();
_graphicsManager->setColor(241, 105, 105, 105);
_graphicsManager->setColor(242, 105, 105, 105);
_graphicsManager->setColor(243, 105, 105, 105);
_graphicsManager->setColor(palOffset + 241, 219, 235, 235);
_screen->setColor(241, 105, 105, 105);
_screen->setColor(242, 105, 105, 105);
_screen->setColor(243, 105, 105, 105);
_screen->setColor(palOffset + 241, 219, 235, 235);
_eventsManager->_intPtr._hasPalette = true;
}
void VoyeurEngine::makeViewFinderP() {
_graphicsManager->screenReset();
_screen->screenReset();
}
void VoyeurEngine::initIFace() {
@ -1077,7 +1077,7 @@ void VoyeurEngine::initIFace() {
void VoyeurEngine::doScroll(const Common::Point &pt) {
Common::Rect clipRect(72, 47, 72 + 240, 47 + 148);
_graphicsManager->_vPort->setupViewPort(NULL, &clipRect);
_screen->_vPort->setupViewPort(NULL, &clipRect);
int base = 0;
switch (_voy->_transitionId) {
@ -1101,18 +1101,18 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
if (base) {
PictureResource *pic = _bVoy->boltEntry(base + 3)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
pic = _bVoy->boltEntry(base + 4)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));
pic = _bVoy->boltEntry(base + 5)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 16));
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 16));
pic = _bVoy->boltEntry(base + 6)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 76));
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 76));
pic = _bVoy->boltEntry(base + 7)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
}
_graphicsManager->_vPort->setupViewPort(NULL);
_screen->_vPort->setupViewPort(NULL);
}
void VoyeurEngine::checkTransition() {
@ -1124,7 +1124,7 @@ void VoyeurEngine::checkTransition() {
// Only proceed if a valid day string was returned
if (!day.empty()) {
_graphicsManager->fadeDownICF(6);
_screen->fadeDownICF(6);
// Get the time of day string
time = getTimeOfDay();
@ -1163,7 +1163,7 @@ Common::String VoyeurEngine::getTimeOfDay() {
}
int VoyeurEngine::doComputerText(int maxLen) {
FontInfoResource &font = *_graphicsManager->_fontPtr;
FontInfoResource &font = *_screen->_fontPtr;
int totalChars = 0;
font._curFont = _bVoy->boltEntry(0x4910)._fontResource;
@ -1180,7 +1180,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
font._justifyWidth = 384;
font._justifyHeight = 100;
font._pos = Common::Point(128, 100);
_graphicsManager->_vPort->drawText(END_OF_MESSAGE);
_screen->_vPort->drawText(END_OF_MESSAGE);
} else if (_voy->_RTVNum < _voy->_computerTimeMin && maxLen == 9999) {
if (_currentVocId != -1)
_soundManager->startVOCPlay(_currentVocId);
@ -1188,7 +1188,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
font._justifyWidth = 384;
font._justifyHeight = 100;
font._pos = Common::Point(120, 100);
_graphicsManager->_vPort->drawText(START_OF_MESSAGE);
_screen->_vPort->drawText(START_OF_MESSAGE);
} else {
char *msg = (char *)_bVoy->memberAddr(0x4900 + _voy->_computerTextId);
font._pos = Common::Point(96, 60);
@ -1206,14 +1206,14 @@ int VoyeurEngine::doComputerText(int maxLen) {
if (c == '\0') {
if (showEnd) {
_eventsManager->delay(90);
_graphicsManager->_drawPtr->_pos = Common::Point(96, 54);
_graphicsManager->_drawPtr->_penColor = 254;
_graphicsManager->_vPort->sFillBox(196, 124);
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 384;
_graphicsManager->_fontPtr->_justifyHeight = 100;
_graphicsManager->_fontPtr->_pos = Common::Point(128, 100);
_graphicsManager->_vPort->drawText(END_OF_MESSAGE);
_screen->_drawPtr->_pos = Common::Point(96, 54);
_screen->_drawPtr->_penColor = 254;
_screen->_vPort->sFillBox(196, 124);
_screen->_fontPtr->_justify = ALIGN_LEFT;
_screen->_fontPtr->_justifyWidth = 384;
_screen->_fontPtr->_justifyHeight = 100;
_screen->_fontPtr->_pos = Common::Point(128, 100);
_screen->_vPort->drawText(END_OF_MESSAGE);
}
break;
}
@ -1223,20 +1223,20 @@ int VoyeurEngine::doComputerText(int maxLen) {
yp += 10;
} else {
_eventsManager->delay(90);
_graphicsManager->_drawPtr->_pos = Common::Point(96, 54);
_graphicsManager->_drawPtr->_penColor = 255;
_graphicsManager->_vPort->sFillBox(196, 124);
_screen->_drawPtr->_pos = Common::Point(96, 54);
_screen->_drawPtr->_penColor = 255;
_screen->_vPort->sFillBox(196, 124);
yp = 60;
}
_graphicsManager->_fontPtr->_pos = Common::Point(96, yp);
_screen->_fontPtr->_pos = Common::Point(96, yp);
} else if (c == '_') {
showEnd = false;
} else {
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 0;
_graphicsManager->_fontPtr->_justifyHeight = 0;
_graphicsManager->_vPort->drawText(Common::String(c));
_screen->_fontPtr->_justify = ALIGN_LEFT;
_screen->_fontPtr->_justifyWidth = 0;
_screen->_fontPtr->_justifyHeight = 0;
_screen->_vPort->drawText(Common::String(c));
_eventsManager->delay(4);
}
@ -1251,7 +1251,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
flipPageAndWait();
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
_screen->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
return totalChars;
}
@ -1263,7 +1263,7 @@ void VoyeurEngine::getComputerBrush() {
int xp = (384 - pic->_bounds.width()) / 2;
int yp = (240 - pic->_bounds.height()) / 2 - 4;
_graphicsManager->_vPort->drawPicPerm(pic, Common::Point(xp, yp));
_screen->_vPort->drawPicPerm(pic, Common::Point(xp, yp));
CMapResource *pal = _bVoy->boltEntry(0x490F)._cMapResource;
pal->startFade();
@ -1280,17 +1280,17 @@ void VoyeurEngine::doTimeBar() {
int height = ((_voy->_RTVLimit - _voy->_RTVNum) * 59) / _voy->_RTVLimit;
int fullHeight = MAX(151 - height, 93);
_graphicsManager->_drawPtr->_penColor = 134;
_graphicsManager->_drawPtr->_pos = Common::Point(39, 92);
_screen->_drawPtr->_penColor = 134;
_screen->_drawPtr->_pos = Common::Point(39, 92);
_graphicsManager->_vPort->sFillBox(6, fullHeight - 92);
_screen->_vPort->sFillBox(6, fullHeight - 92);
if (height > 0) {
_graphicsManager->setColor(215, 238, 238, 238);
_screen->setColor(215, 238, 238, 238);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_drawPtr->_penColor = 215;
_graphicsManager->_drawPtr->_pos = Common::Point(39, fullHeight);
_graphicsManager->_vPort->sFillBox(6, height);
_screen->_drawPtr->_penColor = 215;
_screen->_drawPtr->_pos = Common::Point(39, fullHeight);
_screen->_vPort->sFillBox(6, height);
}
}
}
@ -1303,9 +1303,9 @@ void VoyeurEngine::flashTimeBar() {
_flashTimeVal = _eventsManager->_intPtr._flashTimer;
if (_flashTimeFlag)
_graphicsManager->setColor(240, 220, 20, 20);
_screen->setColor(240, 220, 20, 20);
else
_graphicsManager->setColor(240, 220, 220, 220);
_screen->setColor(240, 220, 220, 220);
_eventsManager->_intPtr._hasPalette = true;
_flashTimeFlag = !_flashTimeFlag;
@ -1343,7 +1343,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
_bVoy->getBoltGroup(_voy->_boltGroupId2);
PictureResource *pic = _bVoy->boltEntry(_voy->_boltGroupId2 + evidId * 2)._picResource;
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(
_screen->sDrawPic(pic, _screen->_vPort, Common::Point(
(384 - pic->_bounds.width()) / 2, (240 - pic->_bounds.height()) / 2));
_bVoy->freeBoltMember(_voy->_boltGroupId2 + evidId * 2);
@ -1394,7 +1394,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
continue;
pic = _voy->_evPicPtrs[arrIndex];
_graphicsManager->sDrawPic(pic, _graphicsManager->_vPort,
_screen->sDrawPic(pic, _screen->_vPort,
Common::Point((384 - pic->_bounds.width()) / 2,
(240 - pic->_bounds.height()) / 2));
_voy->_evCmPtrs[arrIndex]->startFade();