diff options
author | Marisa-Chan | 2013-10-20 18:39:06 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-10-20 18:39:06 +0000 |
commit | 25834faf0738ae6c33819b196fdfb8ab5e8f1888 (patch) | |
tree | fb4c9fa0883f24d44a9c76926cf99be32c908f9e | |
parent | aefa58f5a4470b1ba2e275c62aa1a7a0cec76539 (diff) | |
download | scummvm-rg350-25834faf0738ae6c33819b196fdfb8ab5e8f1888.tar.gz scummvm-rg350-25834faf0738ae6c33819b196fdfb8ab5e8f1888.tar.bz2 scummvm-rg350-25834faf0738ae6c33819b196fdfb8ab5e8f1888.zip |
ZVISION: Style modifing by astyle.
50 files changed, 465 insertions, 377 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index fb4034fbdb..1d4ce9c604 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -103,8 +103,8 @@ bool ActionChangeLocation::execute(ZVision *engine) { ActionCrossfade::ActionCrossfade(const Common::String &line) { sscanf(line.c_str(), - "%*[^(](%u %u %u %u %u %u %u)", - &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); + "%*[^(](%u %u %u %u %u %u %u)", + &_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis); } bool ActionCrossfade::execute(ZVision *engine) { @@ -123,7 +123,7 @@ ActionDisableControl::ActionDisableControl(const Common::String &line) { bool ActionDisableControl::execute(ZVision *engine) { debug("Disabling control %u", _key); - + engine->getScriptManager()->disableControl(_key); return true; @@ -189,7 +189,7 @@ bool ActionMusic::execute(ZVision *engine) { } else { audioStream = makeRawZorkStream(_fileName, engine); } - + if (_loop) { Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES); engine->_mixer->playStream(_soundType, 0, loopingAudioStream, -1, _volume); @@ -235,8 +235,8 @@ ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) { // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), - "%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)", - &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loopCount, &_mask, &_framerate); + "%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)", + &_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loopCount, &_mask, &_framerate); _fileName = Common::String(fileName); } @@ -253,8 +253,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) { ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(const Common::String &line) { sscanf(line.c_str(), - "%*[^:]:%*[^:]:%u(%u %u %u %u %u %u %u %u)", - &_animationKey, &_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount); + "%*[^:]:%*[^:]:%u(%u %u %u %u %u %u %u %u)", + &_animationKey, &_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount); } bool ActionPlayPreloadAnimation::execute(ZVision *engine) { @@ -320,7 +320,7 @@ ActionSetPartialScreen::ActionSetPartialScreen(const Common::String &line) { bool ActionSetPartialScreen::execute(ZVision *engine) { RenderManager *renderManager = engine->getRenderManager(); - + if (_backgroundColor > 0) { renderManager->clearWorkingWindowTo555Color(_backgroundColor); } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index afa3e3a2ac..e7a4ea302f 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -319,7 +319,7 @@ public: private: enum { - DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions + DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions }; Common::String _fileName; diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/animation_control.cpp index 1143380501..66eefd7ce6 100644 --- a/engines/zvision/animation_control.cpp +++ b/engines/zvision/animation_control.cpp @@ -38,13 +38,13 @@ namespace ZVision { AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Common::String &fileName) - : Control(engine, controlKey), - _fileType(RLF), - _loopCount(1), - _currentLoop(0), - _accumulatedTime(0), - _cachedFrame(0), - _cachedFrameNeedsDeletion(false) { + : Control(engine, controlKey), + _fileType(RLF), + _loopCount(1), + _currentLoop(0), + _accumulatedTime(0), + _cachedFrame(0), + _cachedFrameNeedsDeletion(false) { if (fileName.hasSuffix(".rlf")) { _fileType = RLF; _animation.rlf = new RlfAnimation(fileName, false); diff --git a/engines/zvision/animation_control.h b/engines/zvision/animation_control.h index 2ac3691483..247fbf765d 100644 --- a/engines/zvision/animation_control.h +++ b/engines/zvision/animation_control.h @@ -50,13 +50,13 @@ public: private: enum FileType { - RLF = 1, - AVI = 2 + RLF = 1, + AVI = 2 }; private: uint32 _animationKey; - + union { RlfAnimation *rlf; Video::VideoDecoder *avi; @@ -76,10 +76,18 @@ private: public: bool process(uint32 deltaTimeInMillis); - void setAnimationKey(uint32 animationKey) { _animationKey = animationKey; } - void setLoopCount(uint loopCount) { _loopCount = loopCount; } - void setXPos(int32 x) { _x = x; } - void setYPost(int32 y) { _y = y; } + void setAnimationKey(uint32 animationKey) { + _animationKey = animationKey; + } + void setLoopCount(uint loopCount) { + _loopCount = loopCount; + } + void setXPos(int32 x) { + _x = x; + } + void setYPost(int32 y) { + _y = y; + } }; } // End of namespace ZVision diff --git a/engines/zvision/clock.cpp b/engines/zvision/clock.cpp index c8ee717a33..d78cf6e2c1 100644 --- a/engines/zvision/clock.cpp +++ b/engines/zvision/clock.cpp @@ -30,7 +30,7 @@ namespace ZVision { -Clock::Clock(OSystem *system) +Clock::Clock(OSystem *system) : _system(system), _lastTime(0), _deltaTime(0), diff --git a/engines/zvision/clock.h b/engines/zvision/clock.h index 3939ba1612..3740e07881 100644 --- a/engines/zvision/clock.h +++ b/engines/zvision/clock.h @@ -53,22 +53,26 @@ public: * * @return Delta time since the last frame (in milliseconds) */ - uint32 getDeltaTime() const { return _deltaTime; } + uint32 getDeltaTime() const { + return _deltaTime; + } /** * Get the time from the program starting to the last update() call * * @return Time from program start to last update() call (in milliseconds) */ - uint32 getLastMeasuredTime() { return _lastTime; } + uint32 getLastMeasuredTime() { + return _lastTime; + } /** * Pause the clock. Any future delta times will take this pause into account. - * Has no effect if the clock is already paused. + * Has no effect if the clock is already paused. */ void start(); /** * Un-pause the clock. - * Has no effect if the clock is already un-paused. + * Has no effect if the clock is already un-paused. */ void stop(); }; diff --git a/engines/zvision/control.h b/engines/zvision/control.h index 770c540a12..ab55763a20 100644 --- a/engines/zvision/control.h +++ b/engines/zvision/control.h @@ -42,7 +42,9 @@ public: Control(ZVision *engine, uint32 key) : _engine(engine), _key(key), _enabled(false) {} virtual ~Control() {} - uint32 getKey() { return _key; } + uint32 getKey() { + return _key; + } virtual void enable(); virtual void disable(); @@ -69,7 +71,9 @@ public: * @param backgroundImageSpacePos The position of the mouse in background image space * @return Was the cursor changed? */ - virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { return false; } + virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { + return false; + } /** * Called when a key is pressed. Default is NOP. * @@ -88,14 +92,16 @@ public: * @param deltaTimeInMillis The number of milliseconds that have passed since last frame * @return If true, the node can be deleted after process() finishes */ - virtual bool process(uint32 deltaTimeInMillis) { return false; } + virtual bool process(uint32 deltaTimeInMillis) { + return false; + } /** * Serialize a Control for save game use. This should only be used if a Control needs * to save values that would be different from initialization. AKA a TimerNode needs to * store the amount of time left on the timer. Any Controls overriding this *MUST* write * their key as the first data outputted. The default implementation is NOP. * - * NOTE: If this method is overridden, you MUST also override deserialize() + * NOTE: If this method is overridden, you MUST also override deserialize() * and needsSerialization() * * @param stream Stream to write any needed data to @@ -118,10 +124,12 @@ public: * * @return Does the Control need save game serialization? */ - virtual inline bool needsSerialization() { return false; } + virtual inline bool needsSerialization() { + return false; + } protected: - ZVision * _engine; + ZVision *_engine; uint32 _key; bool _enabled; diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursor.cpp index 9023d97e0d..5386c8ead6 100644 --- a/engines/zvision/cursor.cpp +++ b/engines/zvision/cursor.cpp @@ -30,18 +30,18 @@ namespace ZVision { -ZorkCursor::ZorkCursor() +ZorkCursor::ZorkCursor() : _width(0), _height(0), _hotspotX(0), _hotspotY(0) { } -ZorkCursor::ZorkCursor(const Common::String &fileName) - : _width(0), - _height(0), - _hotspotX(0), - _hotspotY(0) { +ZorkCursor::ZorkCursor(const Common::String &fileName) + : _width(0), + _height(0), + _hotspotX(0), + _hotspotY(0) { Common::File file; if (!file.open(fileName)) return; diff --git a/engines/zvision/cursor.h b/engines/zvision/cursor.h index 18ac28ce8b..8f119c8982 100644 --- a/engines/zvision/cursor.h +++ b/engines/zvision/cursor.h @@ -32,7 +32,7 @@ class String; namespace ZVision { -/** +/** * Utility class to parse and hold cursor data * Modeled off Graphics::Cursor */ @@ -53,12 +53,24 @@ private: public: ZorkCursor &operator=(const ZorkCursor &other); - uint16 getWidth() const { return _width; } - uint16 getHeight() const { return _height; } - uint16 getHotspotX() const { return _hotspotX; } - uint16 getHotspotY() const { return _hotspotY; } - byte getKeyColor() const { return 0; } - const byte *getSurface() const { return (const byte *)_surface.getPixels(); } + uint16 getWidth() const { + return _width; + } + uint16 getHeight() const { + return _height; + } + uint16 getHotspotX() const { + return _hotspotX; + } + uint16 getHotspotY() const { + return _hotspotY; + } + byte getKeyColor() const { + return 0; + } + const byte *getSurface() const { + return (const byte *)_surface.getPixels(); + } }; } // End of namespace ZVision diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 4c5ae5e80f..015e2b014f 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -35,19 +35,22 @@ namespace ZVision { const char *CursorManager::_cursorNames[NUM_CURSORS] = { "active", "arrow", "backward", "downarrow", "forward", "handpt", "handpu", "hdown", "hleft", - "hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" }; + "hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" + }; const char *CursorManager::_zgiCursorFileNames[NUM_CURSORS] = { "g0gbc011.zcr", "g0gac001.zcr", "g0gac021.zcr", "g0gac031.zcr", "g0gac041.zcr", "g0gac051.zcr", "g0gac061.zcr", "g0gac071.zcr", "g0gac081.zcr", - "g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" }; + "g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" + }; const char *CursorManager::_zNemCursorFileNames[NUM_CURSORS] = { "00act", "arrow", "back", "down", "forw", "handpt", "handpu", "hdown", "hleft", - "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" }; + "hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" + }; CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat) - : _engine(engine), - _pixelFormat(pixelFormat), - _cursorIsPushed(false) { + : _engine(engine), + _pixelFormat(pixelFormat), + _cursorIsPushed(false) { // WARNING: The index IDLE_CURSOR_INDEX is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly if (_engine->getGameId() == GID_NEMESIS) { Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[IDLE_CURSOR_INDEX])); diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursor_manager.h index 0a369aaf9e..0173bf810c 100644 --- a/engines/zvision/cursor_manager.h +++ b/engines/zvision/cursor_manager.h @@ -48,9 +48,9 @@ public: private: enum { - NUM_CURSORS = 18, - // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly - IDLE_CURSOR_INDEX = 11 + NUM_CURSORS = 18, + // WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly + IDLE_CURSOR_INDEX = 11 }; ZVision *_engine; @@ -77,7 +77,7 @@ public: /** * Parses a cursor name into a cursor file then creates and shows that cursor. * - * @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[] + * @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[] * @param pushed Should the cursor be pushed (true) or not pushed (false) (Another way to say it: down or up) */ void changeCursor(const Common::String &cursorName, bool pushed); diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 49664935e1..4ab0d6c85d 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -134,22 +134,22 @@ public: bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { return false; - /* - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); - */ + /* + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); + */ } /*bool ZVision::ZVision::hasFeature(EngineFeature f) const { - return - (f == kSupportsRTL) || - (f == kSupportsLoadingDuringRuntime) || - (f == kSupportsSavingDuringRuntime); + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); }*/ bool ZVisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -174,23 +174,23 @@ SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { Common::StringArray filenames; filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)*/ SaveStateList saveList; -/* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - if (slotNum >= 0 && slotNum <= 999) { - Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); - if (in) { - if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { - saveList.push_back(SaveStateDescriptor(slotNum, header.description)); - } - delete in; - } - } - }*/ + /* for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + if (ZVision::ZVision::readSaveHeader(in, false, header) == ZVision::ZVision::kRSHENoError) { + saveList.push_back(SaveStateDescriptor(slotNum, header.description)); + } + delete in; + } + } + }*/ return saveList; } @@ -210,17 +210,17 @@ void ZVisionMetaEngine::removeSaveState(const char *target, int slot) const { Common::String pattern = target; pattern += ".???"; filenames = saveFileMan->listSavefiles(pattern.c_str()); - Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - // Obtain the last 3 digits of the filename, since they correspond to the save slot - int slotNum = atoi(file->c_str() + file->size() - 3); - - // Rename every slot greater than the deleted slot, - if (slotNum > slot) { - saveFileMan->renameSavefile(file->c_str(), filename.c_str()); - filename = ZVision::ZVision::getSavegameFilename(target, ++slot); - } + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + // Rename every slot greater than the deleted slot, + if (slotNum > slot) { + saveFileMan->renameSavefile(file->c_str(), filename.c_str()); + filename = ZVision::ZVision::getSavegameFilename(target, ++slot); + } } */ } @@ -231,34 +231,34 @@ SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, in Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); if (in) { - ZVision::ZVision::SaveHeader header; - ZVision::ZVision::kReadSaveHeaderError error; + ZVision::ZVision::SaveHeader header; + ZVision::ZVision::kReadSaveHeaderError error; - error = ZVision::ZVision::readSaveHeader(in, true, header); - delete in; + error = ZVision::ZVision::readSaveHeader(in, true, header); + delete in; - if (error == ZVision::ZVision::kRSHENoError) { - SaveStateDescriptor desc(slot, header.description); + if (error == ZVision::ZVision::kRSHENoError) { + SaveStateDescriptor desc(slot, header.description); - desc.setThumbnail(header.thumbnail); + desc.setThumbnail(header.thumbnail); - if (header.version > 0) { - int day = (header.saveDate >> 24) & 0xFF; - int month = (header.saveDate >> 16) & 0xFF; - int year = header.saveDate & 0xFFFF; + if (header.version > 0) { + int day = (header.saveDate >> 24) & 0xFF; + int month = (header.saveDate >> 16) & 0xFF; + int year = header.saveDate & 0xFFFF; - desc.setSaveDate(year, month, day); + desc.setSaveDate(year, month, day); - int hour = (header.saveTime >> 16) & 0xFF; - int minutes = (header.saveTime >> 8) & 0xFF; + int hour = (header.saveTime >> 16) & 0xFF; + int minutes = (header.saveTime >> 8) & 0xFF; - desc.setSaveTime(hour, minutes); + desc.setSaveTime(hour, minutes); - desc.setPlayTime(header.playTime * 1000); - } + desc.setPlayTime(header.playTime * 1000); + } - return desc; - } + return desc; + } } */ @@ -266,7 +266,7 @@ SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, in } #if PLUGIN_ENABLED_DYNAMIC(ZVISION) - REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +REGISTER_PLUGIN_DYNAMIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); #else - REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); +REGISTER_PLUGIN_STATIC(ZVISION, PLUGIN_TYPE_ENGINE, ZVisionMetaEngine); #endif diff --git a/engines/zvision/detection.h b/engines/zvision/detection.h index 34417601e8..1f430dac1c 100644 --- a/engines/zvision/detection.h +++ b/engines/zvision/detection.h @@ -29,9 +29,9 @@ namespace ZVision { enum ZVisionGameId { - GID_NONE = 0, - GID_NEMESIS = 1, - GID_GRANDINQUISITOR = 2 + GID_NONE = 0, + GID_NEMESIS = 1, + GID_GRANDINQUISITOR = 2 }; struct ZVisionGameDescription { diff --git a/engines/zvision/input_control.cpp b/engines/zvision/input_control.cpp index a445e1aae5..5723a4e4a4 100644 --- a/engines/zvision/input_control.cpp +++ b/engines/zvision/input_control.cpp @@ -37,12 +37,12 @@ namespace ZVision { -InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key), - _nextTabstop(0), - _focused(false), - _textChanged(false), - _cursorOffset(0) { +InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) + : Control(engine, key), + _nextTabstop(0), + _focused(false), + _textChanged(false), + _cursorOffset(0) { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); diff --git a/engines/zvision/input_control.h b/engines/zvision/input_control.h index aab2c991dc..3d7db747d7 100644 --- a/engines/zvision/input_control.h +++ b/engines/zvision/input_control.h @@ -48,8 +48,12 @@ private: uint _cursorOffset; public: - void focus() { _focused = true; } - void unfocus() { _focused = false; } + void focus() { + _focused = true; + } + void unfocus() { + _focused = false; + } void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos); void onKeyDown(Common::KeyState keyState); bool process(uint32 deltaTimeInMillis); diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 79049b8fcb..b0f9417042 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -43,16 +43,16 @@ namespace ZVision { LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key), - _frameInfo(0), - _frameCount(0), - _startFrame(0), - _currentFrame(0), - _lastRenderedFrame(0), - _mouseIsCaptured(false), - _isReturning(false), - _accumulatedTime(0), - _returnRoutesCurrentFrame(0) { + : Control(engine, key), + _frameInfo(0), + _frameCount(0), + _startFrame(0), + _currentFrame(0), + _lastRenderedFrame(0), + _mouseIsCaptured(false), + _isReturning(false), + _accumulatedTime(0), + _returnRoutesCurrentFrame(0) { // Loop until we find the closing brace Common::String line = stream.readLine(); @@ -84,7 +84,7 @@ LeverControl::~LeverControl() { } else if (_fileType == RLF) { delete _animation.rlf; } - + delete[] _frameInfo; } @@ -194,7 +194,7 @@ void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common if (!_enabled) { return; } - + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _mouseIsCaptured = true; _lastMousePos = backgroundImageSpacePos; @@ -205,7 +205,7 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: if (!_enabled) { return; } - + if (_mouseIsCaptured) { _mouseIsCaptured = false; _engine->getScriptManager()->setStateValue(_key, _currentFrame); @@ -220,7 +220,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common if (!_enabled) { return false; } - + bool cursorWasChanged = false; if (_mouseIsCaptured) { @@ -276,7 +276,7 @@ bool LeverControl::process(uint32 deltaTimeInMillis) { renderFrame(_returnRoutesCurrentFrame); } } - + return false; } @@ -387,7 +387,7 @@ void LeverControl::renderFrame(uint frameNumber) { // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can frameData = (const uint16 *)_animation.rlf->getFrameData(frameNumber)->getPixels(); width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() - height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() + height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() } else if (_fileType == AVI) { _animation.avi->seekToFrame(frameNumber); const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index 8ef8f06fec..94d23c1f95 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -41,8 +41,8 @@ public: private: enum FileType { - RLF = 1, - AVI = 2 + RLF = 1, + AVI = 2 }; struct Direction { @@ -59,8 +59,8 @@ private: }; enum { - ANGLE_DELTA = 30, // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) - ANIMATION_FRAME_TIME = 30 // In millis + ANGLE_DELTA = 30, // How far off a mouse angle can be and still be considered valid. This is in both directions, so the total buffer zone is (2 * ANGLE_DELTA) + ANIMATION_FRAME_TIME = 30 // In millis }; private: diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/lzss_read_stream.cpp index bbbda6f526..b36bf5f7c0 100644 --- a/engines/zvision/lzss_read_stream.cpp +++ b/engines/zvision/lzss_read_stream.cpp @@ -28,10 +28,10 @@ namespace ZVision { LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) - : _source(source), - // It's convention to set the starting cursor position to blockSize - 16 - _windowCursor(0x0FEE), - _eosFlag(false) { + : _source(source), + // It's convention to set the starting cursor position to blockSize - 16 + _windowCursor(0x0FEE), + _eosFlag(false) { // Clear the window to null memset(_window, 0, BLOCK_SIZE); } @@ -69,9 +69,9 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) } uint16 length = (high & 0xF) + 2; - uint16 offset = low | ((high & 0xF0)<<4); + uint16 offset = low | ((high & 0xF0) << 4); - for(int j = 0; j <= length; ++j) { + for (int j = 0; j <= length; ++j) { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; destination[destinationCursor++] = temp; diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/lzss_read_stream.h index f6b1eb1a65..1f7df9d4e0 100644 --- a/engines/zvision/lzss_read_stream.h +++ b/engines/zvision/lzss_read_stream.h @@ -36,7 +36,7 @@ namespace ZVision { class LzssReadStream : public Common::ReadStream { public: /** - * A class that decompresses LZSS data and implements ReadStream for easy access + * A class that decompresses LZSS data and implements ReadStream for easy access * to the decompiled data. * * @param source The source data @@ -45,7 +45,7 @@ public: private: enum { - BLOCK_SIZE = 0x1000 + BLOCK_SIZE = 0x1000 }; private: @@ -64,7 +64,7 @@ private: * * @param numberOfBytes How many bytes to decompress. This is a count of source bytes, not destination bytes */ - uint32 decompressBytes(byte* destination, uint32 numberOfBytes); + uint32 decompressBytes(byte *destination, uint32 numberOfBytes); }; } diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/push_toggle_control.cpp index 689311ba5b..21a1c41548 100644 --- a/engines/zvision/push_toggle_control.cpp +++ b/engines/zvision/push_toggle_control.cpp @@ -35,7 +35,7 @@ namespace ZVision { PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key) { + : Control(engine, key) { // Loop until we find the closing brace Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -76,7 +76,7 @@ void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Com if (!_enabled) { return; } - + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getScriptManager()->setStateValue(_key, 1); } @@ -86,7 +86,7 @@ bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const C if (!_enabled) { return false; } - + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(_hoverCursor); return true; diff --git a/engines/zvision/puzzle.h b/engines/zvision/puzzle.h index 1e730365dc..2eea52f80b 100644 --- a/engines/zvision/puzzle.h +++ b/engines/zvision/puzzle.h @@ -42,17 +42,17 @@ struct Puzzle { /** How criteria should be decided */ enum CriteriaOperator { - EQUAL_TO, - NOT_EQUAL_TO, - GREATER_THAN, - LESS_THAN + EQUAL_TO, + NOT_EQUAL_TO, + GREATER_THAN, + LESS_THAN }; /** Criteria for a Puzzle result to be fired */ struct CriteriaEntry { /** The key of a global state */ uint32 key; - /** + /** * What we're comparing the value of the global state against * This can either be a pure value or it can be the key of another global state */ @@ -64,9 +64,9 @@ struct Puzzle { }; enum StateFlags { - ONCE_PER_INST = 0x01, - DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria - DISABLED = 0x04 + ONCE_PER_INST = 0x01, + DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria + DISABLED = 0x04 }; uint32 key; diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index cb13606b11..1406fbc828 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -38,19 +38,19 @@ namespace ZVision { RenderManager::RenderManager(OSystem *system, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat) - : _system(system), - _workingWidth(workingWindow.width()), - _workingHeight(workingWindow.height()), - _screenCenterX(_workingWidth / 2), - _screenCenterY(_workingHeight / 2), - _workingWindow(workingWindow), - _pixelFormat(pixelFormat), - _backgroundWidth(0), - _backgroundHeight(0), - _backgroundInverseVelocity(0), - _backgroundOffset(0, 0), - _accumulatedVelocityMilliseconds(0), - _renderTable(_workingWidth, _workingHeight) { + : _system(system), + _workingWidth(workingWindow.width()), + _workingHeight(workingWindow.height()), + _screenCenterX(_workingWidth / 2), + _screenCenterY(_workingHeight / 2), + _workingWindow(workingWindow), + _pixelFormat(pixelFormat), + _backgroundWidth(0), + _backgroundHeight(0), + _backgroundInverseVelocity(0), + _backgroundOffset(0, 0), + _accumulatedVelocityMilliseconds(0), + _renderTable(_workingWidth, _workingHeight) { _workingWindowBuffer.create(_workingWidth, _workingHeight, _pixelFormat); _backBuffer.create(windowWidth, windowHeight, pixelFormat); @@ -159,7 +159,7 @@ void RenderManager::clearWorkingWindowTo555Color(uint16 color) { } } -void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap) { +void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 destinationX, int16 destinationY, bool wrap) { int16 subRectX = 0; int16 subRectY = 0; @@ -184,8 +184,8 @@ void RenderManager::renderSubRectToScreen(Graphics::Surface &surface, int16 dest if (wrap) { _backgroundWidth = surface.w; _backgroundHeight = surface.h; - - if (destinationX > 0) { + + if (destinationX > 0) { // Move destinationX to 0 subRectX = surface.w - destinationX; destinationX = 0; @@ -373,7 +373,7 @@ Common::Rect RenderManager::renderTextToWorkingWindow(uint32 idNumber, const Com entry.alphaColor = 0; entry.destX = destX; entry.destY = destY; - + // Draw the text to the working window entry.data = font->drawTextToSurface(text, textColor, maxWidth, maxHeight, align, wrap); entry.width = entry.data->w; diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 111bf6276c..9fedd1d8dd 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -89,7 +89,7 @@ private: /** Center of the screen in the y direction */ const int _screenCenterY; - /** + /** * A Rectangle centered inside the actual window. All in-game coordinates * are given in this coordinate space. Also, all images are clipped to the * edges of this Rectangle @@ -106,7 +106,7 @@ private: /** The height of the current background image */ uint16 _backgroundHeight; - /** + /** * The "velocity" at which the background image is panning. We actually store the inverse of velocity (ms/pixel instead of pixels/ms) * because it allows you to accumulate whole pixels 'steps' instead of rounding pixels every frame */ @@ -135,13 +135,17 @@ public: /** * Clears the AlphaEntry list */ - void clearAlphaEntries() { _alphaDataEntries.clear(); } + void clearAlphaEntries() { + _alphaDataEntries.clear(); + } /** * Removes a specific AlphaEntry from the list * * @param idNumber The id number identifing the AlphaEntry */ - void removeAlphaEntry(uint32 idNumber) { _alphaDataEntries.erase(idNumber); } + void removeAlphaEntry(uint32 idNumber) { + _alphaDataEntries.erase(idNumber); + } /** * Copies a sub-rectangle of a buffer to the working window @@ -224,17 +228,17 @@ public: /** * Set the background position (_backgroundOffset). If the current RenderState is PANORAMA, the offset * will be in the horizontal direction. If the current RenderState is TILT, the offset will be in the - * vertical direction. + * vertical direction. * - * This method will not render anything on the screen. So if nothing else is called that renders the + * This method will not render anything on the screen. So if nothing else is called that renders the * background, the change won't be seen until next frame. * * @param offset The amount to offset the background */ void setBackgroundPosition(int offset); - + /** - * Set the background scroll velocity. Negative velocities correspond to left / up scrolling and + * Set the background scroll velocity. Negative velocities correspond to left / up scrolling and * positive velocities correspond to right / down scrolling * * @param velocity Velocity @@ -249,7 +253,7 @@ public: */ const Common::Point screenSpaceToImageSpace(const Common::Point &point); /** - * Converts a point in image coordinate space to ***PRE-WARP*** + * Converts a point in image coordinate space to ***PRE-WARP*** * working window coordinate space * * @param point Point in image coordinate space @@ -268,7 +272,9 @@ public: RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); - const Graphics::Surface *getBackBuffer() { return &_backBuffer; } + const Graphics::Surface *getBackBuffer() { + return &_backBuffer; + } /** * Creates a copy of surface and transposes the data. @@ -313,7 +319,7 @@ private: * Move the background image by an offset. If we are currently in Panorama mode, * the offset will correspond to a horizontal motion. If we are currently in Tilt mode, * the offset will correspond to a vertical motion. This function should not be called - * if we are in Flat mode. + * if we are in Flat mode. * * The RenderManager will take care of wrapping the image. * Ex: If the image has width 1400px, it is legal to offset 1500px. diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index b6a6a3d2bb..5a0bae7c22 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -32,9 +32,9 @@ namespace ZVision { RenderTable::RenderTable(uint numColumns, uint numRows) - : _numRows(numRows), - _numColumns(numColumns), - _renderState(FLAT) { + : _numRows(numRows), + _numColumns(numColumns), + _renderState(FLAT) { assert(numRows != 0 && numColumns != 0); _internalBuffer = new Common::Point[numRows * numColumns]; @@ -97,12 +97,12 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) { uint16 returnColor = (byte(rFinal + 0.5f) << Graphics::ColorMasks<555>::kRedShift) | (byte(gFinal + 0.5f) << Graphics::ColorMasks<555>::kGreenShift) | - (byte(bFinal + 0.5f) << Graphics::ColorMasks<555>::kBlueShift); + (byte(bFinal + 0.5f) << Graphics::ColorMasks<555>::kBlueShift); return returnColor; } -void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect) { +void RenderTable::mutateImage(uint16 *sourceBuffer, uint16 *destBuffer, uint32 destWidth, const Common::Rect &subRect) { uint32 destOffset = 0; for (int16 y = subRect.top; y < subRect.bottom; ++y) { @@ -115,7 +115,7 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 d // RenderTable only stores offsets from the original coordinates uint32 sourceYIndex = y + _internalBuffer[index].y; uint32 sourceXIndex = x + _internalBuffer[index].x; - + destBuffer[destOffset + normalizedX] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; } @@ -154,11 +154,11 @@ void RenderTable::generatePanoramaLookupTable() { // To get x in cylinder coordinates, we just need to calculate the arc length // We also scale it by _panoramaOptions.linearScale int32 xInCylinderCoords = int32(floor((cylinderRadius * _panoramaOptions.linearScale * alpha) + halfWidth)); - + float cosAlpha = cos(alpha); for (uint y = 0; y < _numRows; ++y) { - // To calculate y in cylinder coordinates, we can do similar triangles comparison, + // To calculate y in cylinder coordinates, we can do similar triangles comparison, // comparing the triangle from the center to the screen and from the center to the edge of the cylinder int32 yInCylinderCoords = int32(floor(halfHeight + ((float)y - halfHeight) * cosAlpha)); @@ -179,7 +179,7 @@ void RenderTable::generateTiltLookupTable() { float cylinderRadius = halfWidth / tan(fovInRadians); for (uint y = 0; y < _numRows; ++y) { - + // Add an offset of 0.01 to overcome zero tan/atan issue (horizontal line on half of screen) // Alpha represents the vertical angle between the viewer at the center of a cylinder and y float alpha = atan(((float)y - halfHeight + 0.01f) / cylinderRadius); @@ -192,7 +192,7 @@ void RenderTable::generateTiltLookupTable() { uint32 columnIndex = y * _numColumns; for (uint x = 0; x < _numColumns; ++x) { - // To calculate x in cylinder coordinates, we can do similar triangles comparison, + // To calculate x in cylinder coordinates, we can do similar triangles comparison, // comparing the triangle from the center to the screen and from the center to the edge of the cylinder int32 xInCylinderCoords = int32(floor(halfWidth + ((float)x - halfWidth) * cosAlpha)); diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index 898091193a..401e627747 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -35,9 +35,9 @@ public: public: enum RenderState { - PANORAMA, - TILT, - FLAT + PANORAMA, + TILT, + FLAT }; private: @@ -59,12 +59,14 @@ private: } _tiltOptions; public: - RenderState getRenderState() { return _renderState; } + RenderState getRenderState() { + return _renderState; + } void setRenderState(RenderState newState); const Common::Point convertWarpedCoordToFlatCoord(const Common::Point &point); - void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect); + void mutateImage(uint16 *sourceBuffer, uint16 *destBuffer, uint32 destWidth, const Common::Rect &subRect); void generateRenderTable(); void setPanoramaFoV(float fov); diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 5f1d41daae..795167e572 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -35,16 +35,16 @@ namespace ZVision { -RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) - : _stream(stream), - _lastFrameRead(0), - _frameCount(0), - _width(0), - _height(0), - _frameTime(0), - _frames(0), - _currentFrame(-1), - _frameBufferByteSize(0) { +RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream) + : _stream(stream), + _lastFrameRead(0), + _frameCount(0), + _width(0), + _height(0), + _frameTime(0), + _frames(0), + _currentFrame(-1), + _frameBufferByteSize(0) { if (!_file.open(fileName)) { warning("RLF animation file %s could not be opened", fileName.c_str()); return; @@ -255,8 +255,8 @@ void RlfAnimation::decodeMaskedRunLengthEncoding(int8 *source, int8 *dest, uint3 numberOfSamples--; } - // If numberOfSamples is >= 0, move destOffset forward ((numberOfSamples * 2) + 2) - // This function assumes the dest buffer has been memset with 0's. + // If numberOfSamples is >= 0, move destOffset forward ((numberOfSamples * 2) + 2) + // This function assumes the dest buffer has been memset with 0's. } else { if (sourceOffset + 1 >= sourceSize) { return; @@ -301,8 +301,8 @@ void RlfAnimation::decodeSimpleRunLengthEncoding(int8 *source, int8 *dest, uint3 numberOfSamples--; } - // If numberOfSamples is >= 0, copy one sample from source to the - // next (numberOfSamples + 2) dest spots + // If numberOfSamples is >= 0, copy one sample from source to the + // next (numberOfSamples + 2) dest spots } else { if (sourceOffset + 1 >= sourceSize) { return; diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index fe5b0d68b4..b0f7ee204e 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -41,8 +41,8 @@ public: private: enum EncodingType { - Masked, - Simple + Masked, + Simple }; struct Frame { @@ -68,10 +68,18 @@ private: uint32 _frameBufferByteSize; public: - uint frameCount() { return _frameCount; } - uint width() { return _width; } - uint height() { return _height; } - uint32 frameTime() { return _frameTime; } + uint frameCount() { + return _frameCount; + } + uint width() { + return _width; + } + uint height() { + return _height; + } + uint32 frameTime() { + return _frameTime; + } /** * Seeks to the frameNumber and updates the internal Surface with @@ -104,7 +112,9 @@ public: /** * @return Is the currentFrame is the last frame in the animation? */ - bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } + bool endOfAnimation() { + return _currentFrame == (int)_frameCount - 1; + } private: /** diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/save_manager.cpp index c3deadd703..528dd0f35b 100644 --- a/engines/zvision/save_manager.cpp +++ b/engines/zvision/save_manager.cpp @@ -106,7 +106,7 @@ void SaveManager::autoSave() { void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { // Create a thumbnail and save it Graphics::saveThumbnail(*file); - + // Write out the save date/time TimeDate td; g_system->getTimeAndDate(td); @@ -171,7 +171,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea warning("File is not a ZVision save file. Aborting load"); return false; } - + // Read in the version header.version = in->readByte(); diff --git a/engines/zvision/save_manager.h b/engines/zvision/save_manager.h index b4770e68b2..9de1c51900 100644 --- a/engines/zvision/save_manager.h +++ b/engines/zvision/save_manager.h @@ -54,13 +54,13 @@ private: static const uint32 SAVEGAME_ID; enum { - SAVE_VERSION = 1 + SAVE_VERSION = 1 }; public: /** * Called every room change. Saves the state of the room just before - * we switched rooms. Uses ZVision::generateAutoSaveFileName() to + * we switched rooms. Uses ZVision::generateAutoSaveFileName() to * create the save file name. */ void autoSave(); diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index e90408cf0d..5fed820103 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -44,7 +44,7 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) return; } - while(!file.eos()) { + while (!file.eos()) { Common::String line = file.readLine(); if (file.err()) { warning("Error parsing scr file: %s", fileName.c_str()); @@ -57,7 +57,7 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal) if (line.matchString("puzzle:*", true)) { Puzzle *puzzle = new Puzzle(); - sscanf(line.c_str(),"puzzle:%u",&(puzzle->key)); + sscanf(line.c_str(), "puzzle:%u", &(puzzle->key)); parsePuzzle(puzzle, file); if (isGlobal) { @@ -236,7 +236,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:ttytext*", true)) { // TODO: Implement ActionTTYText } else if (line.matchString("*:universe_music*", true)) { - // TODO: Implement ActionUniverseMusic + // TODO: Implement ActionUniverseMusic } else if (line.matchString("*:copy_file*", true)) { // Not used. Purposely left empty } else { diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 4b4f1303aa..72e67bfa7f 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -46,13 +46,13 @@ ScriptManager::ScriptManager(ZVision *engine) ScriptManager::~ScriptManager() { for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { - delete (*iter); + delete(*iter); } for (PuzzleList::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) { - delete (*iter); + delete(*iter); } for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { - delete (*iter); + delete(*iter); } } @@ -108,10 +108,10 @@ void ScriptManager::createReferenceTable() { } void ScriptManager::updateNodes(uint deltaTimeMillis) { - // If process() returns true, it means the node can be deleted + // If process() returns true, it means the node can be deleted for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end();) { if ((*iter)->process(deltaTimeMillis)) { - delete (*iter); + delete(*iter); // Remove the node iter = _activeSideFx.erase(iter); } else { @@ -121,7 +121,7 @@ void ScriptManager::updateNodes(uint deltaTimeMillis) { // If process() returns true, it means the node can be deleted for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end();) { if ((*iter)->process(deltaTimeMillis)) { - delete (*iter); + delete(*iter); // Remove the node iter = _activeControls.erase(iter); } else { @@ -137,7 +137,7 @@ void ScriptManager::checkPuzzleCriteria() { // Check if the puzzle is already finished // Also check that the puzzle isn't disabled if (getStateValue(puzzle->key) == 1 && - (puzzle->flags & Puzzle::DISABLED) == 0) { + (puzzle->flags & Puzzle::DISABLED) == 0) { continue; } @@ -341,11 +341,11 @@ void ScriptManager::changeLocation(char world, char room, char node, char view, _referenceTable.clear(); _puzzlesToCheck.clear(); for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) { - delete (*iter); + delete(*iter); } _activePuzzles.clear(); for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { - delete (*iter); + delete(*iter); } _activeControls.clear(); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index c29bc57d03..d47ee94da4 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -64,9 +64,9 @@ public: private: ZVision *_engine; - /** - * Holds the global state variable. Do NOT directly modify this. Use the accessors and - * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a + /** + * Holds the global state variable. Do NOT directly modify this. Use the accessors and + * mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a * particular state key are checked after the key is modified. */ StateMap _globalState; @@ -169,7 +169,7 @@ public: private: /** * Parses the stream into a Puzzle object - * Helper method for parseScrFile. + * Helper method for parseScrFile. * * @param puzzle The object to store what is parsed * @param stream Scr file stream @@ -178,7 +178,7 @@ private: /** * Parses the stream into a Criteria object - * Helper method for parsePuzzle. + * Helper method for parsePuzzle. * * @param criteria Pointer to the Criteria object to fill * @param stream Scr file stream @@ -188,7 +188,7 @@ private: /** * Parses the stream into a ResultAction objects - * Helper method for parsePuzzle. + * Helper method for parsePuzzle. * * @param stream Scr file stream * @param actionList The list where the results will be added diff --git a/engines/zvision/sidefx.h b/engines/zvision/sidefx.h index d495655a22..6f75ad6649 100644 --- a/engines/zvision/sidefx.h +++ b/engines/zvision/sidefx.h @@ -36,19 +36,25 @@ class ZVision; class SideFX { public: - enum SideFXType{ - SIDEFX_UNK = 0, - SIDEFX_TIMER = 1 + enum SideFXType { + SIDEFX_UNK = 0, + SIDEFX_TIMER = 1 }; SideFX() : _engine(0), _key(0), _type(SIDEFX_UNK) {} SideFX(ZVision *engine, uint32 key, SideFXType type) : _engine(engine), _key(key), _type(type) {} virtual ~SideFX() {} - uint32 getKey() { return _key; } - SideFXType getType() { return _type; } + uint32 getKey() { + return _key; + } + SideFXType getType() { + return _type; + } - virtual bool process(uint32 deltaTimeInMillis) { return false; } + virtual bool process(uint32 deltaTimeInMillis) { + return false; + } /** * Serialize a SideFX for save game use. This should only be used if a SideFX needs * to save values that would be different from initialization. AKA a TimerNode needs to @@ -78,10 +84,12 @@ public: * * @return Does the SideFX need save game serialization? */ - virtual inline bool needsSerialization() { return false; } + virtual inline bool needsSerialization() { + return false; + } protected: - ZVision * _engine; + ZVision *_engine; uint32 _key; SideFXType _type; diff --git a/engines/zvision/single_value_container.h b/engines/zvision/single_value_container.h index 45b5a89e95..33fe69d760 100644 --- a/engines/zvision/single_value_container.h +++ b/engines/zvision/single_value_container.h @@ -30,21 +30,21 @@ class String; namespace ZVision { /** - * A generic single value storage class. It is useful for storing different + * A generic single value storage class. It is useful for storing different * value types in a single List, Hashmap, etc. */ class SingleValueContainer { public: enum ValueType { - BOOL, - BYTE, - INT16, - UINT16, - INT32, - UINT32, - FLOAT, - DOUBLE, - STRING + BOOL, + BYTE, + INT16, + UINT16, + INT32, + UINT32, + FLOAT, + DOUBLE, + STRING }; // Constructors @@ -60,7 +60,7 @@ public: explicit SingleValueContainer(Common::String value); // Copy constructor - explicit SingleValueContainer(const SingleValueContainer& other); + explicit SingleValueContainer(const SingleValueContainer &other); // Destructor ~SingleValueContainer(); @@ -91,10 +91,10 @@ public: SingleValueContainer &operator=(const double &rhs); SingleValueContainer &operator=(const Common::String &rhs); - SingleValueContainer& operator=(const SingleValueContainer &rhs); + SingleValueContainer &operator=(const SingleValueContainer &rhs); /** - * Retrieve a bool from the container. If the container is not storing a + * Retrieve a bool from the container. If the container is not storing a * bool, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -102,7 +102,7 @@ public: */ bool getBoolValue(bool *returnValue) const; /** - * Retrieve a byte from the container. If the container is not storing a + * Retrieve a byte from the container. If the container is not storing a * byte, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -110,7 +110,7 @@ public: */ bool getByteValue(byte *returnValue) const; /** - * Retrieve an int16 from the container. If the container is not storing an + * Retrieve an int16 from the container. If the container is not storing an * int16, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -118,7 +118,7 @@ public: */ bool getInt16Value(int16 *returnValue) const; /** - * Retrieve a uint16 from the container. If the container is not storing a + * Retrieve a uint16 from the container. If the container is not storing a * uint16, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -126,7 +126,7 @@ public: */ bool getUInt16Value(uint16 *returnValue) const; /** - * Retrieve an int32 from the container. If the container is not storing an + * Retrieve an int32 from the container. If the container is not storing an * int32, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -134,7 +134,7 @@ public: */ bool getInt32Value(int32 *returnValue) const; /** - * Retrieve a uint32 from the container. If the container is not storing a + * Retrieve a uint32 from the container. If the container is not storing a * uint32, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -142,7 +142,7 @@ public: */ bool getUInt32Value(uint32 *returnValue) const; /** - * Retrieve a float from the container. If the container is not storing a + * Retrieve a float from the container. If the container is not storing a * float, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -150,7 +150,7 @@ public: */ bool getFloatValue(float *returnValue) const; /** - * Retrieve a double from the container. If the container is not storing a + * Retrieve a double from the container. If the container is not storing a * double, this will return false and display a warning(). * * @param returnValue Pointer to where you want the value stored @@ -158,9 +158,9 @@ public: */ bool getDoubleValue(double *returnValue) const; /** - * Retrieve a String from the container. If the container is not storing a + * Retrieve a String from the container. If the container is not storing a * string, this will return false and display a warning(). - * + * * Caution: Strings are internally stored as char[]. getStringValue uses * Common::String::operator=(char *) to do the assigment, which uses both * strlen() AND memmove(). diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/string_manager.cpp index ab42f3d3e0..f8a48682ac 100644 --- a/engines/zvision/string_manager.cpp +++ b/engines/zvision/string_manager.cpp @@ -36,7 +36,7 @@ namespace ZVision { -StringManager::StringManager(ZVision *engine) +StringManager::StringManager(ZVision *engine) : _engine(engine) { } @@ -218,7 +218,7 @@ Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { // Don't spam the user with warnings about UTF-16 support. // Just do one warning per String bool charOverflowWarning = false; - + uint16 value = stream.readUint16LE(); while (!stream.eos()) { // Check for CRLF @@ -235,7 +235,7 @@ Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) { value = '?'; } char charValue = (char)value; - + asciiString += charValue; value = stream.readUint16LE(); diff --git a/engines/zvision/string_manager.h b/engines/zvision/string_manager.h index 9cfed5261b..a6ae6d20d6 100644 --- a/engines/zvision/string_manager.h +++ b/engines/zvision/string_manager.h @@ -59,7 +59,7 @@ private: }; enum { - NUM_TEXT_LINES = 56 // Max number of lines in a .str file. We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56 + NUM_TEXT_LINES = 56 // Max number of lines in a .str file. We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56 }; private: diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/timer_node.cpp index dc7dd5b38c..c7cefd6150 100644 --- a/engines/zvision/timer_node.cpp +++ b/engines/zvision/timer_node.cpp @@ -34,18 +34,18 @@ namespace ZVision { TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) : SideFX(engine, key, SIDEFX_TIMER) { - if (_engine->getGameId() == GID_NEMESIS) - _timeLeft = timeInSeconds * 1000; - else if (_engine->getGameId() == GID_GRANDINQUISITOR) - _timeLeft = timeInSeconds * 100; - _engine->getScriptManager()->setStateValue(_key, 1); + if (_engine->getGameId() == GID_NEMESIS) + _timeLeft = timeInSeconds * 1000; + else if (_engine->getGameId() == GID_GRANDINQUISITOR) + _timeLeft = timeInSeconds * 100; + _engine->getScriptManager()->setStateValue(_key, 1); } TimerNode::~TimerNode() { - if (_timeLeft <= 0) + if (_timeLeft <= 0) _engine->getScriptManager()->setStateValue(_key, 2); else - _engine->getScriptManager()->setStateValue(_key, _timeLeft); // If timer was stopped by stop or kill + _engine->getScriptManager()->setStateValue(_key, _timeLeft); // If timer was stopped by stop or kill } bool TimerNode::process(uint32 deltaTimeInMillis) { diff --git a/engines/zvision/timer_node.h b/engines/zvision/timer_node.h index 2caf43ad3c..4a9c95d72b 100644 --- a/engines/zvision/timer_node.h +++ b/engines/zvision/timer_node.h @@ -44,7 +44,9 @@ public: bool process(uint32 deltaTimeInMillis); void serialize(Common::WriteStream *stream); void deserialize(Common::SeekableReadStream *stream); - inline bool needsSerialization() { return true; } + inline bool needsSerialization() { + return true; + } private: int32 _timeLeft; diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/truetype_font.cpp index 289b5fbbaf..dde3b2dee5 100644 --- a/engines/zvision/truetype_font.cpp +++ b/engines/zvision/truetype_font.cpp @@ -39,12 +39,12 @@ namespace ZVision { TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight) - : _engine(engine), - _fontHeight(fontHeight), - _font(0), - _lineHeight(0), - _maxCharWidth(0), - _maxCharHeight(0) { + : _engine(engine), + _fontHeight(fontHeight), + _font(0), + _lineHeight(0), + _maxCharWidth(0), + _maxCharHeight(0) { } TruetypeFont::~TruetypeFont(void) { diff --git a/engines/zvision/truetype_font.h b/engines/zvision/truetype_font.h index 33f016cffd..762657a5fb 100644 --- a/engines/zvision/truetype_font.h +++ b/engines/zvision/truetype_font.h @@ -60,10 +60,10 @@ public: * * @param filename The file name of the .ttf file to load */ - bool loadFile(const Common::String &filename); + bool loadFile(const Common::String &filename); /** - * Renders the supplied text to a Surface using 0x0 as the - * background color. + * Renders the supplied text to a Surface using 0x0 as the + * background color. * * @param text The to render * @param textColor The color to render the text with diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index d973cb2f4c..1d96b33021 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -39,7 +39,7 @@ void writeFileContentsToFile(const Common::String &sourceFile, const Common::Str return; } - byte* buffer = new byte[f.size()]; + byte *buffer = new byte[f.size()]; f.read(buffer, f.size()); Common::DumpFile dumpFile; @@ -63,10 +63,10 @@ void trimCommentsAndWhiteSpace(Common::String *string) { } void tryToDumpLine(const Common::String &key, - Common::String &line, - Common::HashMap<Common::String, byte> *count, - Common::HashMap<Common::String, bool> *fileAlreadyUsed, - Common::DumpFile &output) { + Common::String &line, + Common::HashMap<Common::String, byte> *count, + Common::HashMap<Common::String, bool> *fileAlreadyUsed, + Common::DumpFile &output) { const byte numberOfExamplesPerType = 8; if ((*count)[key] < numberOfExamplesPerType && !(*fileAlreadyUsed)[key]) { @@ -203,7 +203,7 @@ void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Com return; Audio::AudioStream *audioStream = makeRawZorkStream(inputFile, engine); - + Common::DumpFile output; output.open(outputFile); diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index fb571f3fe8..8da88cf28c 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -72,8 +72,8 @@ void removeDuplicateEntries(Common::Array<T> &container) { uint newLength = 1; uint j; - for(uint i = 1; i < container.size(); i++) { - for(j = 0; j < newLength; j++) { + for (uint i = 1; i < container.size(); i++) { + for (j = 0; j < newLength; j++) { if (container[i] == container[j]) { break; } @@ -93,7 +93,7 @@ void removeDuplicateEntries(Common::Array<T> &container) { } /** - * Gets the name of the file (including extension). Forward or back slashes + * Gets the name of the file (including extension). Forward or back slashes * are interpreted as directory changes * * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index cd11618e67..6b7299ea84 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -66,7 +66,7 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight, const byte color2 = *srcPtr++; for (uint i = 0; i < scaleAmount; ++i) { - uint index = i *2; + uint index = i * 2; dst[index] = color; dst[index + 1] = color2; diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/zfs_archive.cpp index 24cff27fc4..3f5ff5a0d4 100644 --- a/engines/zvision/zfs_archive.cpp +++ b/engines/zvision/zfs_archive.cpp @@ -52,7 +52,7 @@ ZfsArchive::ZfsArchive(const Common::String &fileName, Common::SeekableReadStrea ZfsArchive::~ZfsArchive() { debug(1, "ZfsArchive Destructor Called"); ZfsEntryHeaderMap::iterator it = _entryHeaders.begin(); - for ( ; it != _entryHeaders.end(); ++it) { + for (; it != _entryHeaders.end(); ++it) { delete it->_value; } } @@ -79,7 +79,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { // Read in each entry header for (uint32 i = 0; i < _header.filesPerBlock; ++i) { ZfsEntryHeader entryHeader; - + entryHeader.name = readEntryName(stream); entryHeader.offset = stream->readUint32LE(); entryHeader.id = stream->readUint32LE(); @@ -138,7 +138,7 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common:: zfsArchive.seek(entryHeader->offset); // This *HAS* to be malloc (not new[]) because MemoryReadStream uses free() to free the memory - byte* buffer = (byte *)malloc(entryHeader->size); + byte *buffer = (byte *)malloc(entryHeader->size); zfsArchive.read(buffer, entryHeader->size); // Decrypt the data in place if (_header.xorKey != 0) diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/zfs_archive.h index d7b45e4b47..fc4be5aa1b 100644 --- a/engines/zvision/zfs_archive.h +++ b/engines/zvision/zfs_archive.h @@ -53,7 +53,7 @@ struct ZfsEntryHeader { uint32 unknown; }; -typedef Common::HashMap<Common::String, ZfsEntryHeader*, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ZfsEntryHeaderMap; +typedef Common::HashMap<Common::String, ZfsEntryHeader *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ZfsEntryHeaderMap; class ZfsArchive : public Common::Archive { public: diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/zork_avi_decoder.h index dc3e3327ed..7ddecce694 100644 --- a/engines/zvision/zork_avi_decoder.h +++ b/engines/zvision/zork_avi_decoder.h @@ -66,5 +66,5 @@ private: }; } // End of namespace ZVision - + #endif diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 029600b758..ce83add1df 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -191,9 +191,9 @@ bool RawZorkStream::rewind() { } Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - bool stereo, - DisposeAfterUse::Flag disposeAfterUse) { + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse) { if (stereo) assert(stream->size() % 2 == 0); @@ -201,9 +201,9 @@ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stre } Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - bool stereo, - DisposeAfterUse::Flag disposeAfterUse) { + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse) { return makeRawZorkStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, stereo, DisposeAfterUse::YES); } @@ -221,14 +221,13 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6])) soundParams = RawZorkStream::_zNemSoundParamLookupTable[i]; } - } - else if (engine->getGameId() == GID_GRANDINQUISITOR) { + } else if (engine->getGameId() == GID_GRANDINQUISITOR) { for (int i = 0; i < 6; ++i) { if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7])) soundParams = RawZorkStream::_zgiSoundParamLookupTable[i]; } } - + if (soundParams.packed) { return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); } else { diff --git a/engines/zvision/zork_raw.h b/engines/zvision/zork_raw.h index 1f261ae139..29b555912d 100644 --- a/engines/zvision/zork_raw.h +++ b/engines/zvision/zork_raw.h @@ -106,11 +106,19 @@ private: public: int readBuffer(int16 *buffer, const int numSamples); - bool isStereo() const { return true; } - bool endOfData() const { return _endOfData; } + bool isStereo() const { + return true; + } + bool endOfData() const { + return _endOfData; + } - int getRate() const { return _rate; } - Audio::Timestamp getLength() const { return _playtime; } + int getRate() const { + return _rate; + } + Audio::Timestamp getLength() const { + return _playtime; + } bool rewind(); }; @@ -125,9 +133,9 @@ public: * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, - int rate, - bool stereo, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); /** * Creates an audio stream, which plays from the given stream. @@ -138,9 +146,9 @@ Audio::RewindableAudioStream *makeRawZorkStream(const byte *buffer, uint32 size, * @return The new SeekableAudioStream (or 0 on failure). */ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stream, - int rate, - bool stereo, - DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); + int rate, + bool stereo, + DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES); Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 940e01ae20..8be85d39d4 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -47,28 +47,28 @@ namespace ZVision { - + ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) - : Engine(syst), - _gameDescription(gameDesc), - _workingWindow_ZGI((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), - _workingWindow_ZNM((WINDOW_WIDTH - ZNM_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZNM_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZNM_WORKING_WINDOW_WIDTH) / 2) + ZNM_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZNM_WORKING_WINDOW_HEIGHT) / 2) + ZNM_WORKING_WINDOW_HEIGHT), - _workingWindow(gameDesc->gameId == GID_NEMESIS ? _workingWindow_ZNM : _workingWindow_ZGI), - _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ - _desiredFrameTime(33), /* ~30 fps */ - _clock(_system), - _scriptManager(nullptr), - _renderManager(nullptr), - _saveManager(nullptr), - _stringManager(nullptr), - _cursorManager(nullptr) { - + : Engine(syst), + _gameDescription(gameDesc), + _workingWindow_ZGI((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), + _workingWindow_ZNM((WINDOW_WIDTH - ZNM_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZNM_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZNM_WORKING_WINDOW_WIDTH) / 2) + ZNM_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZNM_WORKING_WINDOW_HEIGHT) / 2) + ZNM_WORKING_WINDOW_HEIGHT), + _workingWindow(gameDesc->gameId == GID_NEMESIS ? _workingWindow_ZNM : _workingWindow_ZGI), + _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ + _desiredFrameTime(33), /* ~30 fps */ + _clock(_system), + _scriptManager(nullptr), + _renderManager(nullptr), + _saveManager(nullptr), + _stringManager(nullptr), + _cursorManager(nullptr) { + debug(1, "ZVision::ZVision"); } ZVision::~ZVision() { debug(1, "ZVision::~ZVision"); - + // Dispose of resources delete _console; delete _cursorManager; @@ -77,15 +77,15 @@ ZVision::~ZVision() { delete _renderManager; delete _scriptManager; delete _rnd; - + // Remove all of our debug levels DebugMan.clearAllDebugChannels(); } void ZVision::initialize() { const Common::FSNode gameDataDir(ConfMan.get("path")); - // TODO: There are 10 file clashes when we flatten the directories. - // From a quick look, the files are exactly the same, so it shouldn't matter. + // TODO: There are 10 file clashes when we flatten the directories. + // From a quick look, the files are exactly the same, so it shouldn't matter. // But I'm noting it here just in-case it does become a problem. SearchMan.addSubDirectoryMatching(gameDataDir, "data1", 0, 4, true); SearchMan.addSubDirectoryMatching(gameDataDir, "data2", 0, 4, true); @@ -143,7 +143,7 @@ Common::Error ZVision::run() { processEvents(); - // Call _renderManager->update() first so the background renders + // Call _renderManager->update() first so the background renders // before anything that puzzles/controls will render _renderManager->update(deltaTime); _scriptManager->update(deltaTime); diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 89aa60fe73..10711b1605 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -51,7 +51,7 @@ class CursorManager; class StringManager; class SaveManager; class RlfAnimation; - + class ZVision : public Engine { public: ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc); @@ -68,19 +68,19 @@ public: private: enum { - WINDOW_WIDTH = 640, - WINDOW_HEIGHT = 480, + WINDOW_WIDTH = 640, + WINDOW_HEIGHT = 480, - //Zork nemesis working window sizes - ZNM_WORKING_WINDOW_WIDTH = 512, - ZNM_WORKING_WINDOW_HEIGHT = 320, + //Zork nemesis working window sizes + ZNM_WORKING_WINDOW_WIDTH = 512, + ZNM_WORKING_WINDOW_HEIGHT = 320, - //ZGI(and default) working window sizes - WORKING_WINDOW_WIDTH = 640, - WORKING_WINDOW_HEIGHT = 344, + //ZGI(and default) working window sizes + WORKING_WINDOW_WIDTH = 640, + WORKING_WINDOW_HEIGHT = 344, - ROTATION_SCREEN_EDGE_OFFSET = 60, - MAX_ROTATION_SPEED = 400 // Pixels per second + ROTATION_SCREEN_EDGE_OFFSET = 60, + MAX_ROTATION_SPEED = 400 // Pixels per second }; Console *_console; @@ -112,13 +112,27 @@ public: Common::Error run(); void pauseEngineIntern(bool pause); - ScriptManager *getScriptManager() const { return _scriptManager; } - RenderManager *getRenderManager() const { return _renderManager; } - CursorManager *getCursorManager() const { return _cursorManager; } - SaveManager *getSaveManager() const { return _saveManager; } - StringManager *getStringManager() const { return _stringManager; } - Common::RandomSource *getRandomSource() const { return _rnd; } - ZVisionGameId getGameId() const { return _gameDescription->gameId; } + ScriptManager *getScriptManager() const { + return _scriptManager; + } + RenderManager *getRenderManager() const { + return _renderManager; + } + CursorManager *getCursorManager() const { + return _cursorManager; + } + SaveManager *getSaveManager() const { + return _saveManager; + } + StringManager *getStringManager() const { + return _stringManager; + } + Common::RandomSource *getRandomSource() const { + return _rnd; + } + ZVisionGameId getGameId() const { + return _gameDescription->gameId; + } /** * Play a video until it is finished. This is a blocking call. It will call @@ -149,5 +163,5 @@ private: }; } // End of namespace ZVision - + #endif |