VOYEUR: Implemented the restoreMCGASaveRect method

This commit is contained in:
Paul Gilbert 2013-06-01 12:35:50 -04:00
parent 8b6d3169cc
commit 99f474a3b6
8 changed files with 69 additions and 21 deletions

View File

@ -65,7 +65,7 @@ void EventsManager::sWaitFlip() {
(_vm->_graphicsManager.*viewPort._restoreFn)(&viewPort);
_vm->_graphicsManager._clipPtr = clipPtr;
viewPort._field40[viewPort._pageIndex] = 0;
viewPort._rectListCount[viewPort._pageIndex] = 0;
viewPort._flags &= 0xFFBF;
}
}

View File

@ -614,12 +614,21 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
_pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
for (int i = 0; i < 3; ++i)
_field40[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
// Get the rect list
for (int i = 0; i < 3; ++i) {
_rectListCount[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(READ_LE_UINT32(src + 0x34 + i * 4));
_rectListPtr[i] = new Common::Array<Common::Rect>();
for (int i = 0; i < _rectListCount[0]; ++i) {
int xs = FROM_LE_16(rectList[0]);
int ys = FROM_LE_16(rectList[1]);
_rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
ys + FROM_LE_16(rectList[3])));
}
}
xs = READ_LE_UINT16(src + 0x46);
ys = READ_LE_UINT16(src + 0x48);
@ -637,6 +646,11 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
_addFn = &GraphicsManager::addRectNoSaveBack;
}
ViewPortResource::~ViewPortResource() {
for (int i = 0; i < 3; ++i)
delete _rectListPtr[i];
}
void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
PictureResource *pic = _currentPic;

View File

@ -232,10 +232,8 @@ public:
PictureResource *_activePage;
PictureResource *_pages[2];
byte *_field30;
byte *_field34;
byte *_field38;
byte *_field3C;
int16 _field40[3];
Common::Array<Common::Rect> *_rectListPtr[3];
int _rectListCount[3];
Common::Rect _clipRect;
byte *_field7A;
GraphicMethodPtr _fn1;
@ -244,7 +242,7 @@ public:
ViewPortRestorePtr _restoreFn;
public:
ViewPortResource(BoltFilesState &state, const byte *src);
virtual ~ViewPortResource() {}
virtual ~ViewPortResource();
void setupViewPort();
};

View File

@ -26,6 +26,8 @@ namespace Voyeur {
IntData::IntData() {
_field9 = false;
_flipWait = false;
_field2A = 0;
}
void IntData::audioInit() {

View File

@ -112,6 +112,8 @@ public:
class IntData {
public:
bool _field9;
bool _flipWait;
int _field2A;
byte *_colors;
Common::List<IntNode *> _intNodes;
public:

View File

@ -34,6 +34,7 @@ GraphicsManager::GraphicsManager() {
_SVGAReset = 0;
_screenOffset = 0;
_planeSelect = 0;
_sImageShift = 3;
_palFlag = false;
_MCGAMode = false;
_saveBack = false;
@ -87,18 +88,34 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
_clipPtr = clipRect;
}
viewPort->_field40[1] = -1;
viewPort->_rectListCount[1] = -1;
}
void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
// TODO
}
void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
// TODO
if (viewPort->_rectListCount[0] != -1) {
for (int i = 0; i < viewPort->_rectListCount[0]; ++i) {
addRectOptSaveRect(viewPort, 1, (*viewPort->_rectListPtr[0])[i]);
}
} else {
viewPort->_rectListCount[1] = -1;
}
restoreBack(*viewPort->_rectListPtr[1], viewPort->_rectListCount[1], viewPort->_pages[0],
viewPort->_pages[1]);
int count = viewPort->_rectListCount[0];
restoreBack(*viewPort->_rectListPtr[0], viewPort->_rectListCount[0],
viewPort->_activePage, viewPort->_currentPic);
SWAP(viewPort->_rectListPtr[0], viewPort->_rectListPtr[1]);
viewPort->_rectListCount[1] = count;
}
void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
// TODO: more
}
@ -214,7 +231,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
int ys = ofs.y + destPic->_bounds.top;
backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, &backBounds);
(this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, backBounds);
}
}
@ -276,8 +293,15 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
}
/**
* Queues the given picture for display
*/
void GraphicsManager::sDisplayPic(PictureResource *pic) {
// TODO
if (pic->_flags & 8) {
_vm->_eventsManager._intPtr._field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
}
_vm->_eventsManager._intPtr._flipWait = true;
}
void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
@ -313,4 +337,9 @@ void GraphicsManager::flipPage() {
}
}
void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
PictureResource *srcPic, PictureResource *destPic) {
//TODO
}
} // End of namespace Voyeur

View File

@ -44,7 +44,7 @@ class ViewPortResource;
typedef void (GraphicsManager::*GraphicMethodPtr)();
typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int y, Common::Rect *bounds);
typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
class GraphicsManager {
@ -64,12 +64,15 @@ public:
Common::Rect *_clipPtr;
int _screenOffset;
uint _planeSelect;
int _sImageShift;
private:
static void fadeIntFunc();
static void vDoFadeInt();
static void vDoCycleInt();
void addIntNode(IntNode *node);
void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
PictureResource *srcPic, PictureResource *destPic);
public:
GraphicsManager();
void setVm(VoyeurEngine *vm) { _vm = vm; }
@ -79,9 +82,9 @@ public:
void addFadeInt();
void setupMCGASaveRect(ViewPortResource *viewPort);
void addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds);
void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
void restoreMCGASaveRect(ViewPortResource *viewPort);
void addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds);
void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
void EMSMapPageHandle(int v1, int v2, int v3);
void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);

View File

@ -138,7 +138,7 @@ void VoyeurEngine::initInput() {
}
void VoyeurEngine::doHeadTitle() {
char dest[144];
// char dest[144];
_eventsManager.startMainClockInt();
if (_bVoy->getBoltGroup(0x10500)) {