diff options
-rw-r--r-- | engines/sherlock/animation.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/events.cpp | 35 | ||||
-rw-r--r-- | engines/sherlock/events.h | 12 | ||||
-rw-r--r-- | engines/sherlock/objects.cpp | 195 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 4 | ||||
-rw-r--r-- | engines/sherlock/resources.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/resources.h | 2 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 80 | ||||
-rw-r--r-- | engines/sherlock/scene.h | 29 | ||||
-rw-r--r-- | engines/sherlock/screen.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 4 | ||||
-rw-r--r-- | engines/sherlock/sound.cpp | 3 | ||||
-rw-r--r-- | engines/sherlock/sound.h | 3 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 9 | ||||
-rw-r--r-- | engines/sherlock/talk.h | 10 |
17 files changed, 355 insertions, 53 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp index a7f91e91cd..9d32746de4 100644 --- a/engines/sherlock/animation.cpp +++ b/engines/sherlock/animation.cpp @@ -66,7 +66,7 @@ Animation::Animation(SherlockEngine *vm): _vm(vm) { bool Animation::playPrologue(const Common::String &filename, int minDelay, int fade, bool setPalette, int speed) { - EventsManager &events = *_vm->_events; + Events &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; int soundNumber = 0; @@ -123,7 +123,7 @@ bool Animation::playPrologue(const Common::String &filename, int minDelay, int f pt.x = stream->readUint16LE(); pt.y = stream->readUint16LE(); } else { - pt = images[imageFrame]._position; + pt = images[imageFrame]._offset; } // Draw the sprite diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index 69e89e7157..1a09f0600e 100644 --- a/engines/sherlock/events.cpp +++ b/engines/sherlock/events.cpp @@ -30,7 +30,7 @@ namespace Sherlock { -EventsManager::EventsManager(SherlockEngine *vm) { +Events::Events(SherlockEngine *vm) { _vm = vm; _cursorImages = nullptr; _cursorId = INVALID_CURSOR; @@ -40,14 +40,14 @@ EventsManager::EventsManager(SherlockEngine *vm) { _mouseButtons = 0; } -EventsManager::~EventsManager() { +Events::~Events() { delete _cursorImages; } /** * Load a set of cursors from the specified file */ -void EventsManager::loadCursors(const Common::String &filename) { +void Events::loadCursors(const Common::String &filename) { hideCursor(); delete _cursorImages; @@ -57,7 +57,7 @@ void EventsManager::loadCursors(const Common::String &filename) { /** * Set the cursor to show */ -void EventsManager::changeCursor(CursorId cursorId) { +void Events::setCursor(CursorId cursorId) { if (cursorId == _cursorId) return; @@ -73,28 +73,35 @@ void EventsManager::changeCursor(CursorId cursorId) { /** * Show the mouse cursor */ -void EventsManager::showCursor() { +void Events::showCursor() { CursorMan.showMouse(true); } /** * Hide the mouse cursor */ -void EventsManager::hideCursor() { +void Events::hideCursor() { CursorMan.showMouse(false); } /** + * Returns the cursor + */ +CursorId Events::getCursor() const { + return _cursorId; +} + +/** * Returns true if the mouse cursor is visible */ -bool EventsManager::isCursorVisible() { +bool Events::isCursorVisible() const { return CursorMan.isVisible(); } /** * Check for any pending events */ -void EventsManager::pollEvents() { +void Events::pollEvents() { checkForNextFrameCounter(); Common::Event event; @@ -138,7 +145,7 @@ void EventsManager::pollEvents() { * Poll for events and introduce a small delay, to allow the system to * yield to other running programs */ -void EventsManager::pollEventsAndWait() { +void Events::pollEventsAndWait() { pollEvents(); g_system->delayMillis(10); } @@ -146,7 +153,7 @@ void EventsManager::pollEventsAndWait() { /** * Check whether it's time to display the next screen frame */ -bool EventsManager::checkForNextFrameCounter() { +bool Events::checkForNextFrameCounter() { // Check for next game frame uint32 milli = g_system->getMillis(); if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { @@ -171,7 +178,7 @@ bool EventsManager::checkForNextFrameCounter() { /** * Clear any current keypress or mouse click */ -void EventsManager::clearEvents() { +void Events::clearEvents() { _pendingKeys.clear(); _mouseClicked = false; } @@ -179,12 +186,12 @@ void EventsManager::clearEvents() { /** * Delay for a given number of game frames, where each frame is 1/60th of a second */ -void EventsManager::wait(int numFrames) { +void Events::wait(int numFrames) { uint32 totalMilli = numFrames * 1000 / GAME_FRAME_RATE; delay(totalMilli); } -bool EventsManager::delay(uint32 time, bool interruptable) { +bool Events::delay(uint32 time, bool interruptable) { // Different handling for really short versus extended times if (time < 10) { // For really short periods, simply delay by the desired amount @@ -216,7 +223,7 @@ bool EventsManager::delay(uint32 time, bool interruptable) { /** * Wait for the next frame */ -void EventsManager::waitForNextFrame() { +void Events::waitForNextFrame() { _mouseClicked = false; _mouseButtons = 0; diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h index 8965489e27..e939b5768f 100644 --- a/engines/sherlock/events.h +++ b/engines/sherlock/events.h @@ -37,7 +37,7 @@ enum CursorId { ARROW = 0, MAGNIFY = 1, WAIT = 2, INVALID_CURSOR = -1 }; class SherlockEngine; -class EventsManager { +class Events { private: SherlockEngine *_vm; uint32 _frameCounter; @@ -52,18 +52,20 @@ public: bool _mouseClicked; Common::Stack<Common::KeyState> _pendingKeys; public: - EventsManager(SherlockEngine *vm); - ~EventsManager(); + Events(SherlockEngine *vm); + ~Events(); void loadCursors(const Common::String &filename); - void changeCursor(CursorId cursorId); + void setCursor(CursorId cursorId); void showCursor(); void hideCursor(); - bool isCursorVisible(); + CursorId getCursor() const; + + bool isCursorVisible() const; void pollEvents(); diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index ece96457db..5a93ce6869 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -33,6 +33,10 @@ namespace Sherlock { #define LEFT_LIMIT 0 #define RIGHT_LIMIT SHERLOCK_SCREEN_WIDTH +// Distance to walk around WALK_AROUND boxes +#define CLEAR_DIST_X 5 +#define CLEAR_DIST_Y 0 + SherlockEngine *Sprite::_vm; /** @@ -77,11 +81,12 @@ void Sprite::setImageFrame() { void Sprite::adjustSprite() { People &people = *_vm->_people; Scene &scene = *_vm->_scene; + Talk &talk = *_vm->_talk; if (_type == INVALID || (_type == CHARACTER && _vm->_animating)) return; - if (!_vm->_talkCounter && _type == CHARACTER && _walkCount) { + if (!talk._talkCounter && _type == CHARACTER && _walkCount) { // Handle active movement for the sprite _position += _delta; --_walkCount; @@ -163,6 +168,190 @@ void Sprite::adjustSprite() { } } +/** + * Checks the sprite's position to see if it's collided with any special objects + */ +void Sprite::checkSprite() { + Events &events = *_vm->_events; + People &people = *_vm->_people; + Scene &scene = *_vm->_scene; + Screen &screen = *_vm->_screen; + Talk &talk = *_vm->_talk; + Common::Point pt; + Common::Rect objBounds; + Common::Point spritePt(_position.x / 100, _position.y / 100); + + if (!talk._talkCounter && _type == CHARACTER) { + pt = _walkCount ? _position + _delta : _position; + pt.x /= 100; + pt.y /= 100; + + for (uint idx = 0; idx < scene._bgShapes.size() && !talk._talkToAbort; ++idx) { + Object &obj = scene._bgShapes[idx]; + + if (obj._aType > PERSON && _type != INVALID && _type != HIDDEN) { + if (_type == NO_SHAPE) { + objBounds = Common::Rect(_position.x, _position.y, + _position.x + _noShapeSize.x, _position.y + _noShapeSize.y); + } else { + int xp = _position.x + _imageFrame->_offset.x; + int yp = _position.y + _imageFrame->_offset.y; + objBounds = Common::Rect(xp, yp, + xp + _imageFrame->_frame.w, yp + _imageFrame->_frame.h); + } + } + + if (objBounds.contains(pt)) { + if (objBounds.contains(spritePt)) { + // Current point is already inside the the bounds, so impact occurred + // on a previous call. So simply do nothing until we're clear of the box + switch (obj._aType) { + case TALK_MOVE: + if (_walkCount) { + // Holmes is moving + obj._type = HIDDEN; + obj.setFlagsAndToggles(); + talk.talkTo(obj._use[0]._target); + } + break; + + case PAL_CHANGE: + case PAL_CHANGE2: + if (_walkCount) { + int palStart = atoi(obj._use[0]._names[0].c_str()) * 3; + int palLength = atoi(obj._use[0]._names[1].c_str()) * 3; + int templ = atoi(obj._use[0]._names[2].c_str()) * 3; + if (templ == 0) + templ = 100; + + // Ensure only valid palette change data found + if (palLength > 0) { + // Figure out how far into the shape Holmes is so that we + // can figure out what percentage of the original palette + // to set the current palette to + int palPercent = (pt.x - objBounds.left) * 100 / objBounds.width(); + palPercent = palPercent * templ / 100; + if (obj._aType == PAL_CHANGE) + // Invert percentage + palPercent = 100 - palPercent; + + for (int idx = palStart; idx < (palStart + palLength); ++idx) + screen._sMap[idx] = screen._cMap[idx] * palPercent / 100; + + events.pollEvents(); + screen.setPalette(screen._sMap); + } + } + break; + + case TALK: + case TALK_EVERY: + _type = HIDDEN; + obj.setFlagsAndToggles(); + talk.talkTo(obj._use[0]._target); + break; + + default: + break; + } + } else { + // New impact just occurred + switch (obj._aType) { + case BLANK_ZONE: + // A blank zone masks out all other remaining zones underneath it. + // If this zone is hit, exit the outer loop so we do not check anymore + return; + + case SOLID: + case TALK: + // Stop walking + if (obj._aType == TALK) { + obj.setFlagsAndToggles(); + talk.talkTo(obj._use[0]._target); + } else { + people.gotoStand(*this); + } + break; + + case TALK_EVERY: + if (obj._aType == TALK_EVERY) { + obj._type = HIDDEN; + obj.setFlagsAndToggles(); + talk.talkTo(obj._use[0]._target); + } else { + people.gotoStand(*this); + } + break; + + case FLAG_SET: + obj.setFlagsAndToggles(); + obj._type = HIDDEN; + break; + + case WALK_AROUND: + if (objBounds.contains(people._walkTo.top())) { + // Reached zone + people.gotoStand(*this); + } else { + // Destination not within box, walk to best corner + Common::Point walkPos; + + if (spritePt.x >= objBounds.left && spritePt.x < objBounds.right) { + // Impact occurred due to vertical movement. Determine whether to + // travel to the left or right side + if (_delta.x > 0) + // Go to right side + walkPos.x = objBounds.right + CLEAR_DIST_X; + else if (_delta.x < 0) + // Go to left side + walkPos.x = objBounds.left - CLEAR_DIST_X; + else { + // Going straight up or down. So choose best side + if (spritePt.x >= (objBounds.left + objBounds.width() / 2)) + walkPos.x = objBounds.right + CLEAR_DIST_X; + else + walkPos.x = objBounds.left - CLEAR_DIST_X; + } + + walkPos.y = (_delta.y >= 0) ? objBounds.top - CLEAR_DIST_Y : + objBounds.bottom + CLEAR_DIST_Y; + } else { + // Impact occurred due to horizontal movement + if (_delta.y > 0) + // Go to bottom of box + walkPos.y = objBounds.bottom + CLEAR_DIST_Y; + else if (_delta.y < 0) + // Go to top of box + walkPos.y = objBounds.top - CLEAR_DIST_Y; + else { + // Going straight horizontal, so choose best side + if (spritePt.y >= (objBounds.top + objBounds.height() / 2)) + walkPos.y = objBounds.bottom + CLEAR_DIST_Y; + else + walkPos.y = objBounds.top - CLEAR_DIST_Y; + } + + walkPos.x = (_delta.x >= 0) ? objBounds.left - CLEAR_DIST_X : + objBounds.right + CLEAR_DIST_X; + } + + walkPos.x += people[AL]._imageFrame->_frame.w / 2; + people._walkDest = walkPos; + people._walkTo.push(walkPos); + people.setWalking(); + } + break; + + case DELTA: + _position.x += 200; + break; + } + } + } + } + } +} + /*----------------------------------------------------------------*/ void ActionType::synchronize(Common::SeekableReadStream &s) { @@ -463,6 +652,10 @@ int Object::checkNameForCodes(const Common::String &name, Common::StringArray *m return 0; } +void Object::setFlagsAndToggles() { + // TODO +} + /*----------------------------------------------------------------*/ void CAnim::synchronize(Common::SeekableReadStream &s) { diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index d7442f928f..d099718d5b 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -115,6 +115,8 @@ public: void setImageFrame(); void adjustSprite(); + + void checkSprite(); }; struct ActionType { @@ -200,6 +202,8 @@ public: void checkObject(Object &o); int checkNameForCodes(const Common::String &name, Common::StringArray *messages); + + void setFlagsAndToggles(); }; struct CAnim { diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 9e25a8dd6e..4b087b59b5 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -298,10 +298,10 @@ void ImageFile::load(Common::SeekableReadStream &stream, bool skipPalette) { frame._width = stream.readUint16LE() + 1; frame._height = stream.readUint16LE() + 1; frame._flags = stream.readByte(); - frame._position.x = stream.readUint16LE(); - frame._position.y = stream.readByte(); + frame._offset.x = stream.readUint16LE(); + frame._offset.y = stream.readByte(); - frame._rleEncoded = !skipPalette && (frame._position.x == 1); + frame._rleEncoded = !skipPalette && (frame._offset.x == 1); if (frame._flags & 0xFF) { // Nibble packed frame data diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h index 1d8c601e77..ab2eb82a1e 100644 --- a/engines/sherlock/resources.h +++ b/engines/sherlock/resources.h @@ -93,7 +93,7 @@ struct ImageFrame { uint16 _width, _height; int _flags; bool _rleEncoded; - Common::Point _position; + Common::Point _offset; byte _rleMarker; Graphics::Surface _frame; diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index b8c7661966..bb9c6c0bc2 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -325,7 +325,7 @@ void ScalpelEngine::startScene() { } _events->loadCursors("rmouse.vgs"); - _events->changeCursor(ARROW); + _events->setCursor(ARROW); if (_scene->_goToRoom == 99) { // Chess Board diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 8158dfc705..13315b065b 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -90,7 +90,7 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) { _changes = false; _charPoint = _oldCharPoint = 0; _windowOpen = _infoFlag = false; - _menuMode = _keyboardInput = 0; + _keyboardInput = 0; _walkedInScene = false; _ongoingCans = 0; _version = 0; @@ -99,6 +99,9 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) { _hsavedPos = Common::Point(-1, -1); _hsavedFs = -1; _cAnimFramePause = 0; + _menuMode = STD_MODE; + _invMode = INVMODE_0; + _restoreFlag = false; _controlPanel = new ImageFile("controls.vgs"); _controls = nullptr; // new ImageFile("menu.all"); @@ -119,7 +122,8 @@ void Scene::clear() { void Scene::selectScene() { // Reset fields _windowOpen = _infoFlag = false; - _menuMode = _keyboardInput = 0; + _menuMode = STD_MODE; + _keyboardInput = 0; _oldKey = _help = _oldHelp = 0; _oldTemp = _temp = 0; @@ -142,7 +146,7 @@ void Scene::selectScene() { * that it should point to after loading; _misc is then set to 0. */ bool Scene::loadScene(const Common::String &filename) { - EventsManager &events = *_vm->_events; + Events &events = *_vm->_events; People &people = *_vm->_people; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; @@ -512,12 +516,14 @@ void Scene::checkInventory() { * in the scene */ void Scene::transitionToScene() { - const int FS_TRANS[8] = { - STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN, - STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT - }; People &people = *_vm->_people; Screen &screen = *_vm->_screen; + Talk &talk = *_vm->_talk; + + const int FS_TRANS[8] = { + STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN, + STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT + }; if (_hsavedPos.x < 1) { // No exit information from last scene-check entrance info @@ -563,7 +569,7 @@ void Scene::transitionToScene() { Common::Point bottomRight; if (obj._type != NO_SHAPE) { - topLeft += obj._imageFrame->_position; + topLeft += obj._imageFrame->_offset; bottomRight.x = topLeft.x + obj._imageFrame->_frame.w; bottomRight.y = topLeft.y + obj._imageFrame->_frame.h; } else { @@ -583,7 +589,7 @@ void Scene::transitionToScene() { _vm->setFlags(obj._use[useNum]._useFlag); } - if (!_vm->_talkToAbort) { + if (!talk._talkToAbort) { for (int nameIdx = 0; nameIdx < 4; ++nameIdx) { toggleObject(obj._use[useNum]._names[nameIdx]); } @@ -787,9 +793,10 @@ void Scene::checkBgShapes(ImageFrame *frame, const Common::Point &pt) { * A negative playRate can also be specified to play the animation in reverse */ int Scene::startCAnim(int cAnimNum, int playRate) { - EventsManager &events = *_vm->_events; + Events &events = *_vm->_events; People &people = *_vm->_people; Resources &res = *_vm->_res; + Talk &talk = *_vm->_talk; Common::Point tpPos, walkPos; int tpDir, walkDir; int tFrames; @@ -818,7 +825,7 @@ int Scene::startCAnim(int cAnimNum, int playRate) { tpDir = cAnim._teleportDir; } - events.changeCursor(WAIT); + events.setCursor(WAIT); _canimShapes.push_back(Object()); Object &cObj = _canimShapes[_canimShapes.size() - 1]; @@ -828,7 +835,7 @@ int Scene::startCAnim(int cAnimNum, int playRate) { people.walkToCoords(walkPos, walkDir); } - if (_vm->_talkToAbort) + if (talk._talkToAbort) return 1; // Copy the canimation into the bgShapes type canimation structure so it can be played @@ -968,7 +975,7 @@ int Scene::startCAnim(int cAnimNum, int playRate) { // Set canim to REMOVE type and free memory cObj.checkObject(_bgShapes[0]); - if (gotoCode > 0 && !_vm->_talkToAbort) { + if (gotoCode > 0 && !talk._talkToAbort) { _goToRoom = gotoCode; if (_goToRoom < 97 && _vm->_map[_goToRoom].x) { @@ -978,7 +985,7 @@ int Scene::startCAnim(int cAnimNum, int playRate) { people.loadWalk(); - if (tpPos.x != -1 && !_vm->_talkToAbort) { + if (tpPos.x != -1 && !talk._talkToAbort) { // Teleport to ending coordinates people[AL]._position = tpPos; people[AL]._sequenceNumber = tpDir; @@ -997,6 +1004,51 @@ void Scene::printObjDesc(const Common::String &str, bool firstTime) { * Animate all objects and people. */ void Scene::doBgAnim() { + Events &events = *_vm->_events; + People &people = *_vm->_people; + Screen &screen = *_vm->_screen; + Sound &sound = *_vm->_sound; + Talk &talk = *_vm->_talk; + Surface surface = screen._backBuffer.getSubArea(Common::Rect(0, 0, + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT)); + int cursorId = events.getCursor(); + Common::Point mousePos = events.mousePos(); + + talk._talkToAbort = false; + + // Animate the mouse cursor + if (cursorId >= WAIT) { + if (++cursorId > (WAIT + 2)) + cursorId = WAIT; + + events.setCursor((CursorId)cursorId); + } + + // Check for setting magnifying glass cursor + if (_menuMode == INV_MODE || _menuMode == USE_MODE || _menuMode == GIVE_MODE) { + if (_invMode == INVMODE_1) { + // Only show Magnifying glass cursor if it's not on the inventory command line + if (mousePos.y < CONTROLS_Y || mousePos.y >(CONTROLS_Y1 + 13)) + events.setCursor(MAGNIFY); + else + events.setCursor(ARROW); + } else { + events.setCursor(ARROW); + } + } + + if (sound._diskSoundPlaying && !*sound._soundIsOn) { + // Loaded sound just finished playing + // TODO: This is horrible.. refactor into the Sound class + delete[] sound._digiBuf; + sound._diskSoundPlaying = false; + } + + if (_restoreFlag) { + if (people[AL]._type == CHARACTER) + people[AL].checkSprite(); + } + // TODO } diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index 06ca2f4c0d..f48d45c34e 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -37,6 +37,30 @@ namespace Sherlock { #define CONTROLS_Y 138 #define CONTROLS_Y1 151 +enum MenuMode { + STD_MODE = 0, + LOOK_MODE = 1, + MOVE_MODE = 2, + TALK_MODE = 3, + PICKUP_MODE = 4, + OPEN_MODE = 5, + CLOSE_MODE = 6, + INV_MODE = 7, + USE_MODE = 8, + GIVE_MODE = 9, + JOURNAL_MODE = 10, + FILES_MODE = 11, + SETUP_MODE = 12 +}; + +enum InvMode { + INVMODE_0 = 0, + INVMODE_1 = 1, + INVMODE_2 = 2, + INVMODE_3 = 3, + INVMODE_255 = 255 +}; + class SherlockEngine; struct BgFileHeader { @@ -90,6 +114,8 @@ private: Common::String _rrmName; int _cAnimFramePause; Common::String _cAnimStr; + MenuMode _menuMode; + InvMode _invMode; bool loadScene(const Common::String &filename); @@ -120,7 +146,7 @@ public: ImageFile *_controls; ImageFile *_controlPanel; bool _windowOpen, _infoFlag; - int _menuMode, _keyboardInput; + int _keyboardInput; int _oldKey, _help, _oldHelp; int _oldTemp, _temp; bool _walkedInScene; @@ -143,6 +169,7 @@ public: Common::Point _hsavedPos; int _hsavedFs; Common::Array<Object> _canimShapes; + bool _restoreFlag; public: Scene(SherlockEngine *vm); ~Scene(); diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index b322b96d6b..e6c11b8cf4 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -181,7 +181,7 @@ bool Screen::unionRectangle(Common::Rect &destRect, const Common::Rect &src1, co * Do a random pixel transition in from _backBuffer surface to the screen */ void Screen::randomTransition() { - EventsManager &events = *_vm->_events; + Events &events = *_vm->_events; const int TRANSITION_MULTIPLIER = 0x15a4e35; _dirtyRects.clear(); @@ -210,7 +210,7 @@ void Screen::randomTransition() { * Transition to the surface from _backBuffer using a vertical transition */ void Screen::verticalTransition() { - EventsManager &events = *_vm->_events; + Events &events = *_vm->_events; byte table[SHERLOCK_SCREEN_WIDTH]; Common::fill(&table[0], &table[SHERLOCK_SCREEN_WIDTH], 0); diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index 756be22846..637660e001 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -43,11 +43,9 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _talk = nullptr; _useEpilogue2 = false; _justLoaded = false; - _talkToAbort = false; _onChessboard = false; _slowChess = false; _animating = false; - _talkCounter = 0; } SherlockEngine::~SherlockEngine() { @@ -75,14 +73,14 @@ void SherlockEngine::initialize() { _res = new Resources(); _animation = new Animation(this); _debugger = new Debugger(this); - _events = new EventsManager(this); + _events = new Events(this); _inventory = new Inventory(); _journal = new Journal(); _people = new People(this); _scene = new Scene(this); _screen = new Screen(this); _sound = new Sound(this); - _talk = new Talk(); + _talk = new Talk(this); } Common::Error SherlockEngine::run() { diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 7ce28cfdd7..1c95b10ff3 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -78,7 +78,7 @@ public: const SherlockGameDescription *_gameDescription; Animation *_animation; Debugger *_debugger; - EventsManager *_events; + Events *_events; Inventory *_inventory; Journal *_journal; People *_people; @@ -96,11 +96,9 @@ public: int _oldCharPoint; // Old scene Common::Point _over; // Old map position Common::Array<Common::Point> _map; // Map locations for each scene - bool _talkToAbort; bool _onChessboard; bool _slowChess; bool _animating; - int _talkCounter; public: SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc); virtual ~SherlockEngine(); diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 0917f83e89..e8e433fa84 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -31,6 +31,9 @@ Sound::Sound(SherlockEngine *vm): _vm(vm) { _playingEpilogue = false; _music = false; _digitized = false; + _diskSoundPlaying = false; + _soundIsOn = nullptr; + _digiBuf = nullptr; } void Sound::loadSound(const Common::String &name, int priority) { diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h index b6e645a28f..3f32f2724a 100644 --- a/engines/sherlock/sound.h +++ b/engines/sherlock/sound.h @@ -44,6 +44,9 @@ public: bool _playingEpilogue; bool _music; bool _digitized; + bool _diskSoundPlaying; + byte *_soundIsOn; + byte *_digiBuf; public: Sound(SherlockEngine *vm); diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index 3122aff95f..414f3b90a6 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -21,10 +21,17 @@ */ #include "sherlock/talk.h" +#include "sherlock/sherlock.h" namespace Sherlock { -Talk::Talk() { +Talk::Talk(SherlockEngine *vm): _vm(vm) { + _talkCounter = 0; + _talkToAbort = false; +} + +void Talk::talkTo(const Common::String &name) { + // TODO } } // End of namespace Sherlock diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index 6ffbcdd8d4..55a4c0fd69 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -37,11 +37,19 @@ public: int &operator[](int idx) { return _data[idx]; } }; +class SherlockEngine; + class Talk { +private: + SherlockEngine *_vm; public: Common::Array<TalkHistoryEntry> _history; + bool _talkToAbort; + int _talkCounter; public: - Talk(); + Talk(SherlockEngine *vm); + + void talkTo(const Common::String &name); }; } // End of namespace Sherlock |