diff options
author | whiterandrek | 2018-04-27 12:55:39 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 888f5b668fb4d06e38b0dc581b24ab37f5a1852e (patch) | |
tree | 1c7658fcb49330383e3b1390ee097312db7216f3 /engines/pink | |
parent | ec96a3b1e7c888fa4b3a2957854942d7fed3e766 (diff) | |
download | scummvm-rg350-888f5b668fb4d06e38b0dc581b24ab37f5a1852e.tar.gz scummvm-rg350-888f5b668fb4d06e38b0dc581b24ab37f5a1852e.tar.bz2 scummvm-rg350-888f5b668fb4d06e38b0dc581b24ab37f5a1852e.zip |
PINK: added more constants
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/constants.h | 28 | ||||
-rw-r--r-- | engines/pink/cursor_mgr.cpp | 9 | ||||
-rw-r--r-- | engines/pink/cursor_mgr.h | 1 | ||||
-rw-r--r-- | engines/pink/objects/actors/actor.cpp | 4 | ||||
-rw-r--r-- | engines/pink/objects/handlers/handler_mgr.cpp | 24 | ||||
-rw-r--r-- | engines/pink/objects/inventory.cpp | 27 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.cpp | 2 | ||||
-rw-r--r-- | engines/pink/sound.cpp | 3 |
8 files changed, 74 insertions, 24 deletions
diff --git a/engines/pink/constants.h b/engines/pink/constants.h index 6d2b02a9a2..2f5239f3f2 100644 --- a/engines/pink/constants.h +++ b/engines/pink/constants.h @@ -138,6 +138,15 @@ enum { kBroMinorVersion = 0, }; +enum { + kTimersUpdateTime = 0x64, + kCursorsUpdateTime = 0xC8 +}; + +enum { + kSampleRate = 22050 +}; + static const char *kPinkGame = "PinkGame"; static const char *kPokus = "pokus"; @@ -145,6 +154,25 @@ static const char *kPeril = "peril"; static const char *kUndefined = "UNDEFINED"; + +static const char *kCloseAction = "Close"; +static const char *kIdleAction = "Idle"; +static const char *kOpenAction = "Open"; +static const char *kPlayAction = "Play"; +static const char *kShowAction = "Show"; +static const char *kHideAction = "Hide"; + +static const char *kInventoryWindowActor = "InventoryWindow"; +static const char *kInventoryItemActor = "InventoryItem"; +static const char *kInventoryRightArrowActor = "InventoryWindow"; +static const char *kInventoryLeftArrowActor = "InventoryWindow"; + +static const char *kCursorNameExitUp = "ExitUp"; +static const char *kCursorNameExitLeft = "ExitLeft"; +static const char *kCursorNameExitRight = "ExitRight"; +static const char *kCursorNameExitForward = "ExitForward"; + + } // End of namespace Pink #endif diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp index a07f577996..872b5b2ad3 100644 --- a/engines/pink/cursor_mgr.cpp +++ b/engines/pink/cursor_mgr.cpp @@ -53,7 +53,7 @@ void CursorMgr::update() { return; uint newTime = _game->getTotalPlayTime(); - if (newTime - _time > 0xC8){ + if (newTime - _time > kCursorsUpdateTime){ _time = newTime; _isSecondFrame = !_isSecondFrame; _game->setCursor(_firstFrameIndex + _isSecondFrame); @@ -62,15 +62,16 @@ void CursorMgr::update() { void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) { uint index; - if (cursorName == "ExitLeft") { + if (cursorName == kCursorNameExitLeft) { index = kExitLeftCursor; } - else if (cursorName == "ExitRight"){ + else if (cursorName == kCursorNameExitRight){ index = kExitRightCursor; } - else if (cursorName == "ExitForward" || cursorName == "ExitUp") + else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp) index = kExitForwardCursor; else assert(0); + setCursor(index, point); } diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h index 2b7d37d51c..b02837b4d6 100644 --- a/engines/pink/cursor_mgr.h +++ b/engines/pink/cursor_mgr.h @@ -50,6 +50,7 @@ private: uint _time; uint _firstFrameIndex; + bool _isPlayingAnimation; bool _isSecondFrame; }; diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp index a7717d3b70..b2cfdb6112 100644 --- a/engines/pink/objects/actors/actor.cpp +++ b/engines/pink/objects/actors/actor.cpp @@ -62,7 +62,7 @@ GamePage *Actor::getPage() const { void Actor::init(bool unk) { if (!_action) { - _action = findAction({"Idle"}); + _action = findAction(kIdleAction); } if (!_action) { @@ -75,7 +75,7 @@ void Actor::init(bool unk) { } void Actor::hide() { - setAction({"Hide"}); + setAction(kHideAction); } void Actor::endAction() { diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp index a8a884699e..477d1f6e7c 100644 --- a/engines/pink/objects/handlers/handler_mgr.cpp +++ b/engines/pink/objects/handlers/handler_mgr.cpp @@ -1,6 +1,24 @@ -// -// Created by andrei on 3/21/18. -// +/* 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 "handler_mgr.h" #include "handler.h" diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp index 1b5ac2b378..8183f9dbe4 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/objects/inventory.cpp @@ -113,13 +113,13 @@ bool InventoryMgr::start(bool playOpening) { return false; } - _window = _lead->getPage()->findActor("InventoryWindow"); - _itemActor = _lead->getPage()->findActor("InventoryItem"); - _rightArrow = _lead->getPage()->findActor("InventoryRightArrow"); - _leftArrow = _lead->getPage()->findActor("InventoryLeftArrow"); + _window = _lead->getPage()->findActor(kInventoryWindowActor); + _itemActor = _lead->getPage()->findActor(kInventoryItemActor); + _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor); + _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor); if (playOpening){ - _window->setAction("Open"); + _window->setAction(kOpenAction); _state = kOpening; } @@ -130,16 +130,17 @@ void InventoryMgr::update() { if (_state == kOpening && !_window->isPlaying()){ _state = kReady; _itemActor->setAction(_item->getName()); - _window->setAction("Show"); - _leftArrow->setAction("Show"); - _rightArrow->setAction("Show"); + _window->setAction(kShowAction); + _leftArrow->setAction(kShowAction); + _rightArrow->setAction(kShowAction); } else if (_state == kClosing && !_window->isPlaying()){ - _window->setAction("Idle"); + _window->setAction(kIdleAction); _lead->onInventoryClosed(_isClickedOnItem); _state = kIdle; + _window = nullptr; _itemActor = nullptr; _isClickedOnItem = false; @@ -164,10 +165,10 @@ void InventoryMgr::onClick(Common::Point point) { void InventoryMgr::close() { _state = kClosing; - _window->setAction("Close"); - _itemActor->setAction("Idle"); - _leftArrow->setAction("Idle"); - _rightArrow->setAction("Idle"); + _window->setAction(kCloseAction); + _itemActor->setAction(kIdleAction); + _leftArrow->setAction(kIdleAction); + _rightArrow->setAction(kIdleAction); } void InventoryMgr::showNextItem(bool direction) { diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp index f996dc1b1e..e0a1f5fea0 100644 --- a/engines/pink/objects/sequences/sequencer.cpp +++ b/engines/pink/objects/sequences/sequencer.cpp @@ -104,7 +104,7 @@ void Sequencer::skipToLastSubSequence() { void Sequencer::updateTimers() { uint time = _page->getGame()->getTotalPlayTime(); - if (time - _time <= 0x64) { + if (time - _time <= kTimersUpdateTime) { return; } diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp index a4a47bebf2..7077d16fd8 100644 --- a/engines/pink/sound.cpp +++ b/engines/pink/sound.cpp @@ -25,6 +25,7 @@ #include <audio/decoders/adpcm.h> #include <common/substream.h> #include "sound.h" +#include "constants.h" namespace Pink { @@ -76,7 +77,7 @@ void Sound::setBalance(int8 balance) { } uint32 Sound::getCurrentSample() { - return _mixer->getSoundElapsedTime(_handle) * 22050 / 1000; + return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000; } } // End of namespace Pink
\ No newline at end of file |