diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/events.cpp | 7 | ||||
-rw-r--r-- | engines/voyeur/events.h | 5 | ||||
-rw-r--r-- | engines/voyeur/files.cpp | 14 | ||||
-rw-r--r-- | engines/voyeur/files.h | 3 | ||||
-rw-r--r-- | engines/voyeur/game.h | 3 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 23 | ||||
-rw-r--r-- | engines/voyeur/graphics.h | 9 | ||||
-rw-r--r-- | engines/voyeur/module.mk | 1 | ||||
-rw-r--r-- | engines/voyeur/sound.cpp | 47 | ||||
-rw-r--r-- | engines/voyeur/sound.h | 47 | ||||
-rw-r--r-- | engines/voyeur/utils.cpp | 26 | ||||
-rw-r--r-- | engines/voyeur/utils.h | 24 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 176 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 2 |
14 files changed, 364 insertions, 23 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 84e993effe..47f70d39bf 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -199,6 +199,9 @@ void EventsManager::pollEvents() { case Common::EVENT_RBUTTONUP: _mouseButton = 0; return; + case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; + break; default: break; } @@ -328,4 +331,8 @@ void EventsManager::vInitColor() { addIntNode(&_cycleIntNode); } +void EventsManager::setCursorTo(int idx, int mode) { + // TODO +} + } // End of namespace Voyeur diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index 22626cd003..8689127b0d 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -57,6 +57,7 @@ private: bool _keyState[256]; int _mouseButton; Common::List<IntNode *> _intNodes; + Common::Point _mousePos; void mainVoyeurIntFunc(); private: @@ -78,7 +79,6 @@ public: int _fadeFirstCol, _fadeLastCol; int _fadeCount; int _fadeStatus; - public: EventsManager(); void setVm(VoyeurEngine *vm) { _vm = vm; } @@ -94,6 +94,9 @@ public: void startFade(CMapResource *cMap); void addIntNode(IntNode *node); void addFadeInt(); + + void setCursorTo(int idx, int mode); + Common::Point getMousePos() { return _mousePos; } }; } // End of namespace Voyeur diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index f258e53221..b2f4d4f58c 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -291,7 +291,7 @@ BoltEntry &BoltFile::getBoltEntry(uint32 id) { return entry; } -PictureResource *BoltFile::getPictureResouce(uint32 id) { +PictureResource *BoltFile::getPictureResource(uint32 id) { if ((int32)id == -1) return NULL; @@ -669,10 +669,10 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src): ys + READ_LE_UINT16(src + 18)); _field18 = READ_LE_UINT16(src + 0x18); - _currentPic = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20)); - _activePage = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x24)); - _pages[0] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28)); - _pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C)); + _currentPic = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x20)); + _activePage = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x24)); + _pages[0] = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x28)); + _pages[1] = state._curLibPtr->getPictureResource(READ_LE_UINT32(src + 0x2C)); state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30); @@ -793,6 +793,10 @@ void ViewPortResource::setupViewPort() { &GraphicsManager::restoreMCGASaveRect); } +void ViewPortResource::drawText(const Common::String &msg) { + // TODO +} + /*------------------------------------------------------------------------*/ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index e24318fce1..4d3c2039c5 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -134,7 +134,7 @@ public: void resolveFunction(uint32 id, GraphicMethodPtr *fn); BoltEntry &getBoltEntry(uint32 id); - PictureResource *getPictureResouce(uint32 id); + PictureResource *getPictureResource(uint32 id); CMapResource *getCMapResource(uint32 id); }; @@ -257,6 +257,7 @@ public: virtual ~ViewPortResource(); void setupViewPort(); + void drawText(const Common::String &msg); }; class ViewPortPalEntry { diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h index 5ad90ddf1a..e47a880422 100644 --- a/engines/voyeur/game.h +++ b/engines/voyeur/game.h @@ -38,8 +38,7 @@ public: int _type; int _data1; int _data2; - int _data3; - int _data4; + byte *_data; }; class SVoy { diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 0f077d5074..9f547c65ca 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -46,7 +46,28 @@ FontInfo::FontInfo() { _shadowColor = 0; } -GraphicsManager::GraphicsManager() { +FontInfo::FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, + byte justify, int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight, + const Common::Point &shadow, int foreColor, int backColor, int shadowColor) { + _curFont = NULL; + _picSelect = picSelect; + _picPick = picPick; + _picOnOff = picOnOff; + _fontFlags = fontFlags; + _justify = justify; + _fontSaveBack = fontSaveBack; + _pos = pos; + _justifyWidth = justifyWidth; + _justifyHeight = justifyHeight; + _shadow = shadow; + _foreColor = foreColor; + _backColor = backColor; + _shadowColor = shadowColor; +} + +GraphicsManager::GraphicsManager(): + _defaultFontInfo(3, 0xff, 0xff, 0, 0, 0, 0, Common::Point(), 1, 1, Common::Point(1, 1), 1, 0, 0), + _fontPtr(&_defaultFontInfo) { _SVGAPage = 0; _SVGAMode = 0; _SVGAReset = 0; diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h index 2e65089af6..cd1d47b6fc 100644 --- a/engines/voyeur/graphics.h +++ b/engines/voyeur/graphics.h @@ -43,6 +43,7 @@ class PictureResource; class ViewPortResource; class ViewPortListResource; class FontResource; +class CMapResource; class FontInfo { public: @@ -63,6 +64,9 @@ public: int _shadowColor; public: FontInfo(); + FontInfo(byte picFlags, byte picSelect, byte picPick, byte picOnOff, byte fontFlags, byte justify, + int fontSaveBack, const Common::Point &pos, int justifyWidth, int justifyHeight, + const Common::Point &shadow, int foreColor, int backColor, int shadowColor); }; typedef void (GraphicsManager::*GraphicMethodPtr)(); @@ -89,6 +93,9 @@ public: uint _planeSelect; int _sImageShift; Graphics::Surface _screenSurface; + CMapResource *_backColors; + FontInfo *_fontPtr; + FontInfo _defaultFontInfo; private: static void fadeIntFunc(); static void vDoCycleInt(); @@ -108,7 +115,7 @@ public: void EMSMapPageHandle(int v1, int v2, int v3); void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset); - void GraphicsManager::fillPic(DisplayResource *display, byte onOff); + void fillPic(DisplayResource *display, byte onOff = 0); void sDisplayPic(PictureResource *pic); void flipPage(); void clearPalette(); diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk index 3e9cbe436a..48f63dc2f0 100644 --- a/engines/voyeur/module.mk +++ b/engines/voyeur/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ game.o \ files.o \ graphics.o \ + sound.o \ utils.o \ voyeur.o diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp new file mode 100644 index 0000000000..628e6e27a9 --- /dev/null +++ b/engines/voyeur/sound.cpp @@ -0,0 +1,47 @@ +/* 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 "voyeur/sound.h" + +namespace Voyeur { + +SoundManager::SoundManager() { +} + +void SoundManager::playVOCMap(byte *voc, int vocSize) { + // TODO +} + +bool SoundManager::vocMapStatus() { + // TODO + return false; +} + +void SoundManager::continueVocMap() { + // TODO +} + +void SoundManager::abortVOCMap() { + // TODO +} + +} // End of namespace Voyeur diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h new file mode 100644 index 0000000000..01d5dc20b9 --- /dev/null +++ b/engines/voyeur/sound.h @@ -0,0 +1,47 @@ +/* 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 VOYEUR_SOUND_H +#define VOYEUR_SOUND_H + +#include "common/scummsys.h" +#include "common/str.h" +#include "voyeur/files.h" + +namespace Voyeur { + +class SoundManager { +private: + VoyeurEngine *_vm; +public: + SoundManager(); + void setVm(VoyeurEngine *vm) { _vm = vm; } + + void playVOCMap(byte *voc, int vocSize); + bool vocMapStatus(); + void continueVocMap(); + void abortVOCMap(); +}; + +} // End of namespace Voyeur + +#endif /* VOYEUR_SOUND_H */ diff --git a/engines/voyeur/utils.cpp b/engines/voyeur/utils.cpp index 4ddfd71f6d..a5745e67cb 100644 --- a/engines/voyeur/utils.cpp +++ b/engines/voyeur/utils.cpp @@ -21,11 +21,35 @@ */ #include "voyeur/utils.h" +#include "common/savefile.h" namespace Voyeur { -void LockClass::getSysData() { +LockTime::LockTime() { + field0 = field1 = field2 = field3 = 0; +} + +void LockClass::getSysDate() { + +} + +void LockClass::getThePassword() { + field0 = 26; + _password = "3333"; + fieldE = field16; + field12 = field1A; + fieldC = -1; + + // TODO: Original loaded 'VOYEUR.DAT' here to get most recent game's password. + // We'll want to transform this to proper savegames in ScummVM +} + +void LockClass::saveThePassword() { + //TODO +} +Common::String LockClass::getDateString() { + return Common::String(); } } // End of namespace Voyeur diff --git a/engines/voyeur/utils.h b/engines/voyeur/utils.h index 9aed6b3ef4..b9266781dc 100644 --- a/engines/voyeur/utils.h +++ b/engines/voyeur/utils.h @@ -24,12 +24,34 @@ #define VOYEUR_UTILS_H #include "common/scummsys.h" +#include "common/str.h" namespace Voyeur { +class LockTime { +public: + int field0; + int field1; + int field2; + int field3; + + LockTime(); +}; + class LockClass { public: - void getSysData(); + int field0; + Common::String _password; + int fieldC; + LockTime fieldE; + int field12; + LockTime field16; + int field1A; +public: + void getSysDate(); + void getThePassword(); + void saveThePassword(); + Common::String getDateString(); }; } // End of namespace Voyeur diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 5c3c42c46f..c2e99076af 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -22,6 +22,7 @@ #include "voyeur/voyeur.h" #include "voyeur/graphics.h" +#include "voyeur/utils.h" #include "common/scummsys.h" #include "common/config-manager.h" #include "common/debug-channels.h" @@ -97,6 +98,7 @@ void VoyeurEngine::initialiseManagers() { _eventsManager.setVm(this); _filesManager.setVm(this); _graphicsManager.setVm(this); + _soundManager.setVm(this); } void VoyeurEngine::ESP_Init() { @@ -114,8 +116,7 @@ void VoyeurEngine::globalInitBolt() { Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0); _voy._eCursorOff[0x74 / 2] = 1; _voy._eCursorOff[0x68 / 2] = 0; - _voy._eventTable[998]._data3 = 63; - _voy._eventTable[998]._data4 = 63; + _voy._eventTable[998]._data = NULL; // Original set 63h:63h _voy._evidence[19] = 0; _voy._evidence[17] = 0; _voy._evidence[18] = 9999; @@ -192,16 +193,171 @@ void VoyeurEngine::showConversionScreen() { } bool VoyeurEngine::doLock() { - int var12 = 0; - int var14 = 0; - int di = 1; - int wrongSize; - byte *buttonVoc = _filesManager.fload("button.voc"); - byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongSize); - bool result = false; + bool result = true; + bool flag = false; + int buttonVocSize, wrongVocSize; + byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize); + byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize); + LockClass lock; + PictureResource *srcPic; + byte *keyData; + int keyCount; + Common::String msg; + int key; if (_bVoy->getBoltGroup(0x10700)) { - + lock.getSysDate(); + lock.getThePassword(); + + _voy._eventTable[999]._type = lock.fieldC; + _voy._eventTable[999]._data = _bVoy->memberAddr(0x704); + + Common::String password = lock._password; + srcPic = _bVoy->getPictureResource(0x702); + + // Get the mappings of keys on the keypad + keyData = _bVoy->memberAddr(0x705); + keyCount = READ_LE_UINT16(keyData); + + _graphicsManager._backColors = _bVoy->getCMapResource(0x7010000); + _graphicsManager._backgroundPage = _bVoy->getPictureResource(0x700); + (*_graphicsManager._vPort)->setupViewPort(); + + _graphicsManager._backColors->startFade(); + (*_graphicsManager._vPort)->_flags |= 8; + + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); + while (!shouldQuit() && (_eventsManager._fadeStatus & 1)) + _eventsManager.delay(1); + + _eventsManager.setCursorTo(127, 0); + _graphicsManager.setColor(1, 0x40, 0x40, 0x40); + _graphicsManager.setColor(2, 0x60, 0x60, 0x60); + _graphicsManager.setColor(3, 0x0A, 0xA0, 0x0A); + _graphicsManager.setColor(4, 0x0E, 0xE0, 0x0E); + + _eventsManager._intPtr.field38 = 1; + _eventsManager._intPtr._hasPalette = true; + + _graphicsManager._fontPtr->_curFont = _bVoy->getBoltEntry(0x708)._fontResource; + _graphicsManager._fontPtr->_fontSaveBack = 0; + _graphicsManager._fontPtr->_fontFlags = 0; + + Common::String dateString = lock.getDateString(); + Common::String playString = Common::String::format("Last Play %s", msg.c_str()); + + bool breakFlag = false; + while (!breakFlag && !shouldQuit()) { + (*_graphicsManager._vPort)->setupViewPort(); + (*_graphicsManager._vPort)->_flags |= 8; + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); + + // Display the last play time + _graphicsManager._fontPtr->_pos = Common::Point(0, 97); + _graphicsManager._fontPtr->_justify = 1; + _graphicsManager._fontPtr->_justifyWidth = 384; + _graphicsManager._fontPtr->_justifyHeight = 97; + + (*_graphicsManager._vPort)->drawText(playString); + (*_graphicsManager._vPort)->_flags |= 8; + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); + + // Loop for getting key presses + do { + do { + // Scan through the list of key rects to check if a keypad key is highlighted + key = -1; + Common::Point mousePos = _eventsManager.getMousePos(); + + for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) { + int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1)); + int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1)); + int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1)); + int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1)); + + if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) { + key = keyIndex; + } + } + + _eventsManager.setCursorTo(127, (key == -1) ? 0 : 1); + _eventsManager._intPtr.field38 = 1; + _eventsManager._intPtr._hasPalette = true; + + // TODO: Check is the mouse cursor being manually drawn here? I so, refactor + _graphicsManager.sDrawPic(srcPic, *_graphicsManager._vPort, mousePos); + (*_graphicsManager._vPort)->_flags |= 8; + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); + + _eventsManager.delay(1); + } while (!shouldQuit() && !_voy._incriminate); + } while (!shouldQuit() && key == -1); + + _soundManager.abortVOCMap(); + _soundManager.playVOCMap(buttonVoc, buttonVocSize); + + while (_soundManager.vocMapStatus()) { + if (shouldQuit()) + break; + + _soundManager.continueVocMap(); + _eventsManager.delay(1); + } + + // Process the key + if (key < 10) { + if (playString.size() < 10) { + playString += '0' + key; + continue; + } + } else if (key == 10) { + if (!flag) { + if ((password.size() == 0 && !playString.size()) || (password == playString)) { + breakFlag = true; + result = true; + break; + } + } else { + if (playString.size() > 0) { + result = 1; + breakFlag = true; + break; + } + } + } else if (key == 11) { + if ((password.size() == 0 && !playString.size()) || (password != playString)) { + (*_graphicsManager._vPort)->setupViewPort(); + flag = true; + playString = ""; + continue; + } + } else if (key == 12) { + breakFlag = true; + result = false; + break; + } else { + continue; + } + + _soundManager.playVOCMap(wrongVoc, wrongVocSize); + } + + _graphicsManager.fillPic(*_graphicsManager._vPort); + (*_graphicsManager._vPort)->_flags |= 8; + _graphicsManager.flipPage(); + _eventsManager.sWaitFlip(); + _graphicsManager.resetPalette(); + + if (flag && result) + lock._password = msg; + lock.saveThePassword(); + + _voy._eventTable[999]._data = NULL; + _bVoy->freeBoltGroup(0x10700); } delete[] buttonVoc; diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 0b74208fa4..723875512c 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -28,6 +28,7 @@ #include "voyeur/files.h" #include "voyeur/game.h" #include "voyeur/graphics.h" +#include "voyeur/sound.h" #include "common/scummsys.h" #include "common/system.h" #include "common/error.h" @@ -88,6 +89,7 @@ public: EventsManager _eventsManager; FilesManager _filesManager; GraphicsManager _graphicsManager; + SoundManager _soundManager; public: VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc); virtual ~VoyeurEngine(); |