aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Prykhodko2018-06-29 14:26:22 +0300
committerAndrei Prykhodko2018-06-29 14:43:57 +0300
commit0c1ef839b6505faac77cf8ebc5540cf4fccf9a87 (patch)
tree3d521446ba811bbae0d05b143d8fca76b11c86bd
parent34319e3ac62d7c2dab592c9b85212eb992b1233b (diff)
downloadscummvm-rg350-0c1ef839b6505faac77cf8ebc5540cf4fccf9a87.tar.gz
scummvm-rg350-0c1ef839b6505faac77cf8ebc5540cf4fccf9a87.tar.bz2
scummvm-rg350-0c1ef839b6505faac77cf8ebc5540cf4fccf9a87.zip
PINK: added more constants
-rw-r--r--engines/pink/audio_info_mgr.cpp15
-rw-r--r--engines/pink/constants.h7
-rw-r--r--engines/pink/cursor_mgr.cpp2
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp6
-rw-r--r--engines/pink/objects/module.cpp2
-rw-r--r--engines/pink/objects/pages/game_page.cpp2
-rw-r--r--engines/pink/pink.cpp4
-rw-r--r--engines/pink/sound.h4
8 files changed, 26 insertions, 16 deletions
diff --git a/engines/pink/audio_info_mgr.cpp b/engines/pink/audio_info_mgr.cpp
index 6f559fe005..06d78e5c78 100644
--- a/engines/pink/audio_info_mgr.cpp
+++ b/engines/pink/audio_info_mgr.cpp
@@ -22,6 +22,7 @@
#include "pink/audio_info_mgr.h"
#include "pink/archive.h"
+#include "pink/constants.h"
#include "pink/objects/actors/lead_actor.h"
namespace Pink {
@@ -62,27 +63,27 @@ void AudioInfoMgr::onLeftClick() {
}
void AudioInfoMgr::playAudio() {
- Actor *audioInfo = _lead->findActor("AudioInfo");
+ Actor *audioInfo = _lead->findActor(kAudioInfoActor);
assert(audioInfo);
audioInfo->setAction(_aboutWhom);
}
void AudioInfoMgr::stopAudio() {
- Actor *audioInfo = _lead->findActor("AudioInfo");
+ Actor *audioInfo = _lead->findActor(kAudioInfoActor);
assert(audioInfo);
- audioInfo->setAction("Idle");
+ audioInfo->setAction(kIdleAction);
}
void AudioInfoMgr::showPDAButton() {
- Actor *pdaButton = _lead->findActor("PDAButton");
+ Actor *pdaButton = _lead->findActor(kPdaButtonActor);
assert(pdaButton);
- pdaButton->setAction("Show");
+ pdaButton->setAction(kShowAction);
}
void AudioInfoMgr::hidePDAButton() {
- Actor *pdaButton = _lead->findActor("PDAButton");
+ Actor *pdaButton = _lead->findActor(kPdaButtonActor);
assert(pdaButton);
- pdaButton->setAction("Hide");
+ pdaButton->setAction(kHideAction);
}
} // End of namespace Pink
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index a2e5bf45f3..d7b913ae0e 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -170,6 +170,10 @@ static const char * const kInventoryItemActor = "InventoryItem";
static const char * const kInventoryRightArrowActor = "InventoryRightArrow";
static const char * const kInventoryLeftArrowActor = "InventoryLeftArrow";
+static const char * const kAudioInfoActor = "AudioInfo";
+static const char * const kPdaButtonActor = "PDAButton";
+
+static const char * const kCursorNameExit = "Exit";
static const char * const kCursorNameExitUp = "ExitUp";
static const char * const kCursorNameExitLeft = "ExitLeft";
static const char * const kCursorNameExitRight = "ExitRight";
@@ -193,6 +197,9 @@ static const char * const kBoy = "Boy";
static const char * const kSirBaldley = "SirBaldley";
static const char * const kBoyBlocked = "BoyBlocked";
+static const char * const kUndefinedValue = "UNDEFINED";
+static const char * const kTrueValue = "TRUE";
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index feb997b560..d11d3cea07 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -69,7 +69,7 @@ void CursorMgr::setCursor(const Common::String &cursorName, const Common::Point
index = kExitLeftCursor;
else if (cursorName == kCursorNameExitRight)
index = kExitRightCursor;
- else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp || cursorName == "Exit")
+ else if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp || cursorName == kCursorNameExit)
index = kExitForwardCursor;
else if (cursorName == kCursorNameExitBackWards)
index = kExitDownCursor;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index e30fcb937b..be0e91a669 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -436,7 +436,7 @@ void ParlSqPink::toConsole() {
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy && _page->checkValueOfVariable(kBoyBlocked, "UNDEFINED"))
+ if (_recipient->getName() == kBoy && _page->checkValueOfVariable(kBoyBlocked, kUndefinedValue))
return _walkMgr->findLocation(kSirBaldley);
return LeadActor::getWalkDestination();
@@ -492,8 +492,8 @@ WalkLocation *PubPink::getWalkDestination() {
}
bool PubPink::playingMiniGame() {
- return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, "UNDEFINED"));
+ return !(_page->checkValueOfVariable(kFoodPuzzle, kTrueValue) ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefinedValue));
}
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index b1f10873ae..50a256db81 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -79,7 +79,7 @@ GamePage *Module::findPage(const Common::String &pageName) const {
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefinedValue;
return _variables[variable] == value;
}
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 5b69be1dd3..1157d96f4e 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -121,7 +121,7 @@ void GamePage::loadManagers() {
bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefinedValue;
return _variables[variable] == value;
}
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 6b10285268..c023fe6fb2 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -205,7 +205,7 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
if (!_variables.contains(variable))
- return value == "UNDEFINED";
+ return value == kUndefinedValue;
return _variables[variable] == value;
}
@@ -281,7 +281,7 @@ void PinkEngine::pauseEngineIntern(bool pause) {
}
bool PinkEngine::isPeril() {
- return !strcmp(_desc.gameId, "peril");
+ return !strcmp(_desc.gameId, kPeril);
}
}
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index 74fa1b816b..fc3deba03b 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -28,6 +28,8 @@
#include "common/system.h"
+#include "pink/constants.h"
+
namespace Common {
class SafeSeekableSubReadStream;
}
@@ -46,7 +48,7 @@ public:
void pause(bool paused) { g_system->getMixer()->pauseHandle(_handle, paused); }
- uint64 getCurrentSample() { return (uint64)g_system->getMixer()->getElapsedTime(_handle).msecs() * 22050 / 1000; }
+ uint64 getCurrentSample() { return (uint64)g_system->getMixer()->getElapsedTime(_handle).msecs() * kSampleRate / 1000; }
private:
Audio::SoundHandle _handle;