diff options
author | Paul Gilbert | 2015-03-19 23:31:28 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-03-19 23:31:28 -0400 |
commit | 77a4227aa4915a860accdd761fb9695d390641dd (patch) | |
tree | fa1d9cbb7fe84bc1b851bdbb662c82c9255dab67 /engines | |
parent | a02461fcb15da3b2e7e91d9cfb1bca559a1d277b (diff) | |
download | scummvm-rg350-77a4227aa4915a860accdd761fb9695d390641dd.tar.gz scummvm-rg350-77a4227aa4915a860accdd761fb9695d390641dd.tar.bz2 scummvm-rg350-77a4227aa4915a860accdd761fb9695d390641dd.zip |
SHERLOCK: Added loading of scene objects
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/module.mk | 2 | ||||
-rw-r--r-- | engines/sherlock/objects.cpp | 155 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 166 | ||||
-rw-r--r-- | engines/sherlock/people.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/people.h | 2 | ||||
-rw-r--r-- | engines/sherlock/resources.cpp | 7 | ||||
-rw-r--r-- | engines/sherlock/resources.h | 2 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 127 | ||||
-rw-r--r-- | engines/sherlock/scene.h | 35 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 11 | ||||
-rw-r--r-- | engines/sherlock/sprites.cpp | 27 | ||||
-rw-r--r-- | engines/sherlock/sprites.h | 83 |
12 files changed, 503 insertions, 116 deletions
diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk index 865b422ef9..dc88ab3f5f 100644 --- a/engines/sherlock/module.mk +++ b/engines/sherlock/module.mk @@ -12,13 +12,13 @@ MODULE_OBJS = \ events.o \ graphics.o \ journal.o \ + objects.o \ people.o \ resources.o \ scene.o \ screen.o \ sherlock.o \ sound.o \ - sprites.o \ talk.o # This module can be built as a plugin diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp new file mode 100644 index 0000000000..2386c00686 --- /dev/null +++ b/engines/sherlock/objects.cpp @@ -0,0 +1,155 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "sherlock/objects.h" + +namespace Sherlock { + +/** + * Reset the data for the sprite + */ +void Sprite::clear() { + _name = ""; + _description = ""; + _examine.clear(); + _pickUp = ""; + _sequences = nullptr; + _images = nullptr; + _imageFrame = nullptr; + _walkCount = 0; + _allow = 0; + _frameNumber = _sequenceNumber = 0; + _position.x = _position.y = 0; + _movement.x = _movement.y = 0; + _oldPosition.x = _oldPosition.y = 0; + _oldSize.x = _oldSize.y = 0; + _goto.x = _goto.y = 0; + _type = INVALID; + _pickUp.clear(); + _noShapeSize.x = _noShapeSize.y = 0; + _status = 0; + _misc = 0; + _numFrames = 0; +} + +/*----------------------------------------------------------------*/ + +void ActionType::synchronize(Common::SeekableReadStream &s) { + char buffer[12]; + + _cAnimNum = s.readByte(); + _cAnimSpeed = s.readByte(); + + for (int idx = 0; idx < 4; ++idx) { + s.read(buffer, 12); + _names[idx] = Common::String(buffer); + } +} + +/*----------------------------------------------------------------*/ + +void UseType::synchronize(Common::SeekableReadStream &s) { + char buffer[12]; + + _cAnimNum = s.readByte(); + _cAnimSpeed = s.readByte(); + + for (int idx = 0; idx < 4; ++idx) { + s.read(buffer, 12); + _names[idx] = Common::String(buffer); + } + + _useFlag = s.readUint16LE(); + _dFlag[0] = s.readUint16LE(); + _lFlag[0] = s.readUint16LE(); + _lFlag[1] = s.readUint16LE(); + + s.read(buffer, 12); + _target = Common::String(buffer); +} + +/*----------------------------------------------------------------*/ + +void Object::synchronize(Common::SeekableReadStream &s) { + char buffer[50]; + + s.read(buffer, 12); + _name = Common::String(buffer); + s.read(buffer, 41); + _description = Common::String(buffer); + + _examine.clear(); + _sequences = nullptr; + _images = nullptr; + _imageFrame = nullptr; + s.seek(16, SEEK_CUR); + + _walkCount = s.readByte(); + _allow = s.readByte(); + _frameNumber = s.readSint16LE(); + _sequenceNumber = s.readSint16LE(); + _position.x = s.readSint16LE(); + _position.y = s.readSint16LE(); + _movement.x = s.readSint16LE(); + _movement.y = s.readSint16LE(); + _type = (SpriteType)s.readUint16LE(); + _oldPosition.x = s.readSint16LE(); + _oldPosition.y = s.readSint16LE(); + _oldSize.x = s.readUint16LE(); + _oldSize.y = s.readUint16LE(); + _goto.x = s.readSint16LE(); + _goto.y = s.readSint16LE(); + + _pickup = s.readByte(); + _defaultCommand = s.readByte(); + _lookFlag = s.readUint16LE(); + _pickupFlag = s.readUint16LE(); + _requiredFlag = s.readUint16LE(); + _noShapeSize.x = s.readUint16LE(); + _noShapeSize.y = s.readUint16LE(); + _status = s.readUint16LE(); + _misc = s.readByte(); + _maxFrames = s.readUint16LE(); + _flags = s.readByte(); + _aOpen.synchronize(s); + _aType = s.readByte(); + _lookFrames = s.readByte(); + _seqcounter = s.readByte(); + _lookPosition.x = s.readUint16LE(); + _lookPosition.y = s.readByte(); + _lookFacing = s.readByte(); + _lookcAnim = s.readByte(); + _aClose.synchronize(s); + _seqStack = s.readByte(); + _seqTo = s.readByte(); + _descOfs = s.readUint16LE(); + _seqcounter2 = s.readByte(); + _seqSize = s.readUint16LE(); + s.skip(1); + _aMove.synchronize(s); + s.skip(8); + + for (int idx = 0; idx < 4; ++idx) + _use[idx].synchronize(s); +} + +} // End of namespace Sherlock diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h new file mode 100644 index 0000000000..f730240479 --- /dev/null +++ b/engines/sherlock/objects.h @@ -0,0 +1,166 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SHERLOCK_OBJECTS_H +#define SHERLOCK_OBJECTS_H + +#include "common/scummsys.h" +#include "common/rect.h" +#include "common/str-array.h" +#include "common/str.h" +#include "sherlock/resources.h" + +namespace Sherlock { + +class SherlockEngine; + +enum ObjectAllow { + ALLOW_MOVEMENT = 1, ALLOW_OPEN = 2, ALLOW_CLOSE = 4 +}; + +enum SpriteType { + INVALID = 0, + CHARACTER = 1, + CURSOR = 2, + STATIC_BG_SHAPE = 3, // Background shape that doesn't animate + ACTIVE_BG_SHAPE = 4, // Background shape that animates + REMOVE = 5, // Object should be removed next frame + NO_SHAPE = 6, // Background object with no shape + HIDDEN = 7, // Hidden backgruond object + HIDE_SHAPE = 8 // Object needs to be hidden +}; + +#define MAX_HOLMES_SEQUENCE 16 +#define MAX_FRAME 30 + +struct Sprite { + Common::String _name; // Name + Common::String _description; // Description + Common::StringArray _examine; // Examine in-depth description + Common::String _pickUp; // Message for if you can't pick up object + + const uint8 (*_sequences)[MAX_HOLMES_SEQUENCE][MAX_FRAME]; // Holds animation sequences + ImageFile *_images; // Sprite images + ImageFrame *_imageFrame; // Pointer to shape in the images + int _walkCount; // Character walk counter + int _allow; // Allowed menu commands - ObjectAllow + int _frameNumber; // Frame number in rame sequence to draw + int _sequenceNumber; // Sequence being used + Common::Point _position; // Current position + Common::Point _movement; // Momvement amount + Common::Point _oldPosition; // Old position + Common::Point _oldSize; // Image's old size + Common::Point _goto; // Walk destination + SpriteType _type; // Type of object + int _pickup; + Common::Point _noShapeSize; // Size of a NO_SHAPE + int _status; // Status: open/closed, moved/not moved + int8 _misc; // Miscellaneous use + int _numFrames; // How many frames the object has + + Sprite() { clear(); } + void clear(); +}; + +struct ActionType { + char _cAnimNum; + char _cAnimSpeed; // if high bit set, play in reverse + Common::String _names[4]; + + void synchronize(Common::SeekableReadStream &s); +}; + +struct UseType { + int _cAnimNum; + int _cAnimSpeed; // if high bit set, play in reverse + Common::String _names[4]; + int _useFlag; // Which flag USE will set (if any) + int _dFlag[1]; + int _lFlag[2]; + Common::String _target; + + void synchronize(Common::SeekableReadStream &s); +}; + +struct Object { + Common::String _name; // Name + Common::String _description; // Description + Common::StringArray _examine; // Examine in-depth description + uint8 (*_sequences)[MAX_HOLMES_SEQUENCE][MAX_FRAME]; // Holds animation sequences + ImageFile *_images; // Sprite images + ImageFrame *_imageFrame; // Pointer to shape in the images + int _walkCount; // Character walk counter + int _allow; // Allowed menu commands - ObjectAllow + int _frameNumber; // Frame number in rame sequence to draw + int _sequenceNumber; // Sequence being used + SpriteType _type; // Object type + Common::Point _position; // Current position + Common::Point _movement; // Momvement amount + Common::Point _oldPosition; // Old position + Common::Point _oldSize; // Image's old size + Common::Point _goto; // Walk destination + + int _pickup; + int _defaultCommand; // Default right-click command + int _lookFlag; // Which flag LOOK will set (if any) + int _pickupFlag; // Which flag PICKUP will set (if any) + int _requiredFlag; // Object will be hidden if not set + Common::Point _noShapeSize; // Size of a NO_SHAPE + int _status; // Status (open/closed, moved/not) + int8 _misc; // Misc field -- use varies with type + int _maxFrames; // Number of frames + int _flags; // Tells if object can be walked behind + ActionType _aOpen; // Holds data for moving object + int _aType; // Tells if this is an object, person, talk, etc. + int _lookFrames; // How many frames to play of the look anim before pausing + int _seqcounter; // How many times this sequence has been executed + Common::Point _lookPosition; // Where to walk when examining object + int _lookFacing; // Direction to face when examining object + int _lookcAnim; + ActionType _aClose; + int _seqStack; // Allows gosubs to return to calling frame + int _seqTo; // Allows 1-5, 8-3 type sequences encoded in 2 bytes + uint _descOfs; // Tells where description starts in DescText + int _seqcounter2; // Counter of calling frame sequence + uint _seqSize; // Tells where description starts + ActionType _aMove; + UseType _use[4]; + + void synchronize(Common::SeekableReadStream &s); +}; + +struct CAnim { + Common::String _name; // Name + int _sequences[MAX_FRAME]; // Animation sequences + Common::Point _position; // Position + int _size; // Size of uncompressed animation + SpriteType _type; + int _flags; // Tells if can be walked behind + Common::Point _goto; // coords holmes should walk to before starting canim + int _sequenceNumber; + Common::Point _teleportPos; // Location Holmes shoul teleport to after + int _teleportS; // playing canim +}; + +} // End of namespace Sherlock + +#endif diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index 53ccaf5baf..cdb498e5e6 100644 --- a/engines/sherlock/people.cpp +++ b/engines/sherlock/people.cpp @@ -56,7 +56,7 @@ void People::reset() { p._position = Common::Point(10000, 11000); p._sequenceNumber = STOP_DOWNRIGHT; p._sequences = &CHARACTER_SEQUENCES; - p._spriteFrame = nullptr; + p._imageFrame = nullptr; p._frameNumber = 1; p._movement = Common::Point(0, 0); p._oldPosition = Common::Point(0, 0); diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h index 4ca7f51444..3f639a6d44 100644 --- a/engines/sherlock/people.h +++ b/engines/sherlock/people.h @@ -24,7 +24,7 @@ #define SHERLOCK_PEOPLE_H #include "common/scummsys.h" -#include "sherlock/sprites.h" +#include "sherlock/objects.h" namespace Sherlock { diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index cdea7bd296..66feca6bd5 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -194,6 +194,13 @@ Common::SeekableReadStream *Resources::load(const Common::String &filename, cons return stream; } +/** + * Returns true if the given file exists on disk or in the cache + */ +bool Resources::exists(const Common::String &filename) const { + Common::File f; + return f.exists(filename) || _cache.isCached(filename); +} /** * Reads in the index from a library file, and caches it's index for later use diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h index ad9867c523..2f9222c1fd 100644 --- a/engines/sherlock/resources.h +++ b/engines/sherlock/resources.h @@ -82,6 +82,8 @@ public: Common::SeekableReadStream *load(const Common::String &filename, const Common::String &libraryFile); + bool exists(const Common::String &filename) const; + int resourceIndex() const; }; diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 84ef44d7e1..267b02b43c 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -21,9 +21,37 @@ */ #include "sherlock/scene.h" +#include "sherlock/sherlock.h" +#include "sherlock/decompress.h" namespace Sherlock { +void BgFileHeader::synchronize(Common::SeekableReadStream &s) { + _numStructs = s.readUint16LE(); + _numImages = s.readUint16LE(); + _numcAnimations = s.readUint16LE(); + _descSize = s.readUint16LE(); + _seqSize = s.readUint16LE(); + _fill = s.readUint16LE(); +} + +/*----------------------------------------------------------------*/ + +void BgfileheaderInfo::synchronize(Common::SeekableReadStream &s) { + _fSize = s.readUint32LE(); + _maxFrames = s.readByte(); + + char buffer[9]; + s.read(buffer, 9); + _filename = Common::String(buffer); +} + +int _fSize; // How long images are +int _maxFrames; // How many unique frames in object +Common::String _filename; // Filename of object + +/*----------------------------------------------------------------*/ + Scene::Scene(SherlockEngine *vm): _vm(vm) { for (int idx = 0; idx < SCENES_COUNT; ++idx) Common::fill(&_stats[idx][0], &_stats[idx][9], false); @@ -32,6 +60,11 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) { _numExits = 0; _windowOpen = _infoFlag = false; _menuMode = _keyboardInput = 0; + _walkedInScene = false; + _ongoingCans = 0; + _version = 0; + _lzwMode = false; + _invGraphicItems = 0; _controls = nullptr; // new ImageFile("menu.all"); } @@ -48,9 +81,101 @@ void Scene::selectScene() { _oldKey = _help = _oldHelp = 0; _oldTemp = _temp = 0; - // Set up player + // Load the scene + Common::String sceneFile = Common::String::format("res%02d", _goToRoom); + Common::String roomName = Common::String::format("res%02d.rrm", _goToRoom); + _goToRoom = -1; + + loadScene(sceneFile); +} + +/** + * Loads the data associated for a given scene. The .BGD file's format is: + * BGHEADER: Holds an index for the rest of the file + * STRUCTS: The objects for the scene + * IMAGES: The graphic information for the structures + * + * The _misc field of the structures contains the number of the graphic image + * that it should point to after loading; _misc is then set to 0. + */ +void Scene::loadScene(const Common::String &filename) { + bool flag; + + _walkedInScene = false; + _ongoingCans = 0; + + // Reset the list of walkable areas + _roomBounds.clear(); + _roomBounds.push_back(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); + + _descText.clear(); + _comments = ""; + _bgShapes.clear(); + _cAnim.clear(); + _sequenceBuffer.clear(); + + // + // Load background shapes from <filename>.rrm + // + + Common::String rrmFile = filename + ".rrm"; + flag = _vm->_res->exists(rrmFile); + if (flag) { + Common::SeekableReadStream *rrmStream = _vm->_res->load(rrmFile); + + rrmStream->seek(39); + _version = rrmStream->readByte(); + _lzwMode = _version == 10; + + // Go to header and read it in + rrmStream->seek(rrmStream->readUint32LE()); + BgFileHeader bgHeader; + bgHeader.synchronize(*rrmStream); + + _cAnim.resize(bgHeader._numcAnimations); + _invGraphicItems = bgHeader._numImages + 1; + + // Read in the shapes header info + Common::Array<BgfileheaderInfo> bgInfo; + bgInfo.resize(bgHeader._numStructs); + + for (uint idx = 0; idx < bgInfo.size(); ++idx) + bgInfo[idx].synchronize(*rrmStream); + + // Initialize the cAnim + for (uint idx = 0; idx < _cAnim.size(); ++idx) { + _cAnim[idx]._position.x = -1; + _cAnim[idx]._goto.x = -1; + _cAnim[idx]._teleportPos.x = -1; + } + + // Read information + Common::SeekableReadStream *infoStream = !_lzwMode ? rrmStream : + decompressLZ(*rrmStream, bgHeader._numImages * 569 + + bgHeader._descSize + bgHeader._seqSize); + + _bgShapes.resize(bgHeader._numStructs); + for (uint idx = 0; idx < _bgShapes.size(); ++idx) + _bgShapes[idx].synchronize(*infoStream); + + if (bgHeader._descSize) { + _descText.resize(bgHeader._descSize); + infoStream->read(&_descText[0], bgHeader._descSize); + } + + if (bgHeader._seqSize) { + _sequenceBuffer.resize(bgHeader._seqSize); + infoStream->read(&_sequenceBuffer[0], bgHeader._seqSize); + } + + if (_lzwMode) + delete infoStream; + // Load shapes + // TODO + delete rrmStream; + } } } // End of namespace Sherlock diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index f92dfccfad..e216c2bd9d 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -24,6 +24,9 @@ #define SHERLOCK_SCENE_H #include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "sherlock/objects.h" #include "sherlock/resources.h" namespace Sherlock { @@ -32,11 +35,32 @@ namespace Sherlock { class SherlockEngine; +struct BgFileHeader { + int _numStructs; + int _numImages; + int _numcAnimations; + int _descSize; + int _seqSize; + int _fill; + + void synchronize(Common::SeekableReadStream &s); +}; + +struct BgfileheaderInfo { + int _fSize; // How long images are + int _maxFrames; // How many unique frames in object + Common::String _filename; // Filename of object + + void synchronize(Common::SeekableReadStream &s); +}; + class Scene { private: SherlockEngine *_vm; void loadScene(); + + void loadScene(const Common::String &filename); public: bool _stats[SCENES_COUNT][9]; bool _savedStats[SCENES_COUNT][9]; @@ -50,6 +74,17 @@ public: int _menuMode, _keyboardInput; int _oldKey, _help, _oldHelp; int _oldTemp, _temp; + bool _walkedInScene; + int _ongoingCans; + int _version; + bool _lzwMode; + int _invGraphicItems; + Common::String _comments; + Common::Array<char> _descText; + Common::Array<Common::Rect> _roomBounds; + Common::Array<Object> _bgShapes; + Common::Array<CAnim> _cAnim; + Common::Array<byte> _sequenceBuffer; public: Scene(SherlockEngine *vm); ~Scene(); diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index a292ee675c..a963d0bfe5 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -34,6 +34,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _debugger = nullptr; _events = nullptr; _journal = nullptr; + _people = nullptr; _res = nullptr; _scene = nullptr; _screen = nullptr; @@ -49,6 +50,7 @@ SherlockEngine::~SherlockEngine() { delete _debugger; delete _events; delete _journal; + delete _people; delete _res; delete _scene; delete _screen; @@ -80,6 +82,7 @@ void SherlockEngine::initialize() { _debugger = new Debugger(this); _events = new EventsManager(this); _journal = new Journal(); + _people = new People(this); _scene = new Scene(this); _screen = new Screen(this); _sound = new Sound(this); @@ -92,12 +95,16 @@ Common::Error SherlockEngine::run() { showOpening(); while (!shouldQuit()) { - // Prepare for scene, and handle any game-specific scenes + // Prepare for scene, and handle any game-specific scenes. This allows + // for game specific cutscenes or mini-games that aren't standard scenes startScene(); if (shouldQuit()) break; - // Initialize the scene + // Reset the active characters to initially just Sherlock + _people->reset(); + + // Initialize and load the scene. _scene->selectScene(); // TODO: Implement game and remove this dummy loop diff --git a/engines/sherlock/sprites.cpp b/engines/sherlock/sprites.cpp deleted file mode 100644 index 6e33219309..0000000000 --- a/engines/sherlock/sprites.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "sherlock/sprites.h" - -namespace Sherlock { - -} // End of namespace Sherlock diff --git a/engines/sherlock/sprites.h b/engines/sherlock/sprites.h deleted file mode 100644 index 631693d815..0000000000 --- a/engines/sherlock/sprites.h +++ /dev/null @@ -1,83 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef SHERLOCK_SPRITES_H -#define SHERLOCK_SPRITES_H - -#include "common/scummsys.h" -#include "common/rect.h" -#include "common/str-array.h" -#include "common/str.h" -#include "sherlock/resources.h" - -namespace Sherlock { - -class SherlockEngine; - -enum ObjectAllow { - ALLOW_MOVEMENT = 1, ALLOW_OPEN = 2, ALLOW_CLOSE = 4 -}; - -enum SpriteType { - INVALID = 0, - CHARACTER = 1, - CURSOR = 2, - STATIC_BG_SHAPE = 3, // Background shape that doesn't animate - ACTIVE_BG_SHAPE = 4, // Background shape that animates - REMOVE = 5, // Object should be removed next frame - NO_SHAPE = 6, // Background object with no shape - HIDDEN = 7, // Hidden backgruond object - HIDE_SHAPE = 8 // Object needs to be hidden -}; - -#define MAX_HOLMES_SEQUENCE 16 -#define MAX_FRAME 30 - -struct Sprite { - Common::String _name; // Name - Common::String _description; // Description - Common::StringArray _examine; // Examine in-depth description - Common::String _pickUp; // Message for if you can't pick up object - - const uint8 (*_sequences)[MAX_HOLMES_SEQUENCE][MAX_FRAME]; // Holds animation sequences - Sprite *_sprites; // Sprite shapes - ImageFrame *_spriteFrame; // Pointer to shape in the sprite - int _walkCount; // Character walk counter - int _allow; // Allowed menu commands - ObjectAllow - int _frameNumber; // Frame number in rame sequence to draw - int _sequenceNumber; // Sequence being used - Common::Point _position; // Current position - Common::Point _movement; // Momvement amount - Common::Point _oldPosition; // Old position - Common::Point _oldSize; // Image's old size - Common::Point _goto; // Walk destination - SpriteType _type; // Type of object - int _pickup; - Common::Point _noShapeSize; // Size of a NO_SHAPE - int _status; // Status: open/closed, moved/not moved - byte _misc; // Miscellaneous use - int _numFrames; // How many frames the object has -}; - -} // End of namespace Sherlock - -#endif |