aboutsummaryrefslogtreecommitdiff
path: root/engines/pink
diff options
context:
space:
mode:
authorAndrei Prykhodko2018-06-29 17:03:35 +0300
committerAndrei Prykhodko2018-06-29 17:46:55 +0300
commit5378db3dc0caa00a965e0bd456622f604ed37128 (patch)
treeafcaa1f9eab74d421b1bdffa63b3dd92fa125ce6 /engines/pink
parent012eedd4c7cab43b6678abdfe7fde9ffa9e01fb1 (diff)
downloadscummvm-rg350-5378db3dc0caa00a965e0bd456622f604ed37128.tar.gz
scummvm-rg350-5378db3dc0caa00a965e0bd456622f604ed37128.tar.bz2
scummvm-rg350-5378db3dc0caa00a965e0bd456622f604ed37128.zip
PINK: added deserialization of Peril PDA Commands
Diffstat (limited to 'engines/pink')
-rw-r--r--engines/pink/objects/actors/pda_button_actor.cpp20
-rw-r--r--engines/pink/objects/actors/pda_button_actor.h20
-rw-r--r--engines/pink/pda_mgr.cpp4
-rw-r--r--engines/pink/pink.h4
4 files changed, 36 insertions, 12 deletions
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 972dc28afe..a3c6eea29c 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -36,8 +36,22 @@ void PDAButtonActor::deserialize(Archive &archive) {
_opaque = (bool)archive.readDWORD();
int type = archive.readDWORD();
- assert(type != 0);
- _command.type = (Command::CommandType) type;
+ assert(type != 0 && type != Command::kIncrementFrame && type != Command::kDecrementFrame);
+ if (_page->getGame()->isPeril()) {
+ _command.type = (Command::CommandType) type;
+ } else {
+ switch (type) {
+ case 1:
+ _command.type = Command::kGoToPage;
+ break;
+ case 2:
+ _command.type = Command::kClose;
+ break;
+ default:
+ _command.type = Command::kNull;
+ break;
+ }
+ }
_command.arg = archive.readString();
}
@@ -53,7 +67,7 @@ void PDAButtonActor::onLeftClickMessage() {
}
void PDAButtonActor::onMouseOver(const Common::Point point, CursorMgr *mgr) {
- if (_command.type == Command::Unk || !isActive())
+ if (_command.type == Command::kNull || !isActive())
mgr->setCursor(kPDADefaultCursor, point, Common::String());
else
mgr->setCursor(kPDAClickableFirstFrameCursor, point, Common::String());
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index c10f2ef5ab..d2c8b24d81 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -28,11 +28,21 @@
namespace Pink {
struct Command {
- // commands in peril are different
- /*enum PerilCommandType {Null, GoToPage, GoToPreviousPage, GoToDomain, GoToHelp,
- NavigateToDomain, IncrementCountry, DecrementCountry, IncrementDomain,
- DecrementDomain, Close, IncrementFrame, DecrementFrame};*/
- enum CommandType {Null = 0, GoToPage = 1, Close = 2, Unk = 3};
+ enum CommandType {
+ kGoToPage = 1,
+ kGoToPreviousPage,
+ kGoToDomain,
+ kGoToHelp, // won't be supported
+ kNavigateToDomain,
+ kIncrementCountry,
+ kDecrementCountry,
+ kIncrementDomain,
+ kDecrementDomain,
+ kClose,
+ kIncrementFrame, // not used
+ kDecrementFrame, // not used
+ kNull
+ };
CommandType type;
Common::String arg;
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp
index 1623b5573c..01ca5a2091 100644
--- a/engines/pink/pda_mgr.cpp
+++ b/engines/pink/pda_mgr.cpp
@@ -40,10 +40,10 @@ void PDAMgr::saveState(Archive &archive) {
void PDAMgr::execute(const Command &command) {
switch (command.type) {
- case Command::GoToPage:
+ case Command::kGoToPage:
goToPage(command.arg);
break;
- case Command::Close:
+ case Command::kClose:
close();
break;
default:
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index e5dc40713f..11d9bcb0fc 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -102,6 +102,8 @@ public:
void changeScene();
+ bool isPeril();
+
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
@@ -124,8 +126,6 @@ private:
void addModule(const Common::String &moduleName);
void removeModule();
- bool isPeril();
-
private:
Console *_console;
Common::RandomSource _rnd;