aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects
diff options
context:
space:
mode:
Diffstat (limited to 'engines/pink/objects')
-rw-r--r--engines/pink/objects/actions/action.cpp34
-rw-r--r--engines/pink/objects/actions/action.h46
-rw-r--r--engines/pink/objects/actions/action_cel.cpp34
-rw-r--r--engines/pink/objects/actions/action_cel.h41
-rw-r--r--engines/pink/objects/actions/action_hide.cpp48
-rw-r--r--engines/pink/objects/actions/action_hide.h42
-rw-r--r--engines/pink/objects/actions/action_play.cpp39
-rw-r--r--engines/pink/objects/actions/action_play.h42
-rw-r--r--engines/pink/objects/actions/action_sound.cpp72
-rw-r--r--engines/pink/objects/actions/action_sound.h54
-rw-r--r--engines/pink/objects/actions/action_still.cpp39
-rw-r--r--engines/pink/objects/actions/action_still.h41
-rw-r--r--engines/pink/objects/actions/walk_action.cpp40
-rw-r--r--engines/pink/objects/actions/walk_action.h42
-rw-r--r--engines/pink/objects/actors/actor.cpp110
-rw-r--r--engines/pink/objects/actors/actor.h68
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp63
-rw-r--r--engines/pink/objects/actors/lead_actor.h63
-rw-r--r--engines/pink/objects/condition.cpp98
-rw-r--r--engines/pink/objects/condition.h106
-rw-r--r--engines/pink/objects/handlers/handler.cpp89
-rw-r--r--engines/pink/objects/handlers/handler.h72
-rw-r--r--engines/pink/objects/handlers/handler_mgr.cpp5
-rw-r--r--engines/pink/objects/handlers/handler_mgr.h14
-rw-r--r--engines/pink/objects/handlers/handler_timer.cpp44
-rw-r--r--engines/pink/objects/handlers/handler_timer.h57
-rw-r--r--engines/pink/objects/inventory.cpp74
-rw-r--r--engines/pink/objects/inventory.h66
-rw-r--r--engines/pink/objects/module.cpp114
-rw-r--r--engines/pink/objects/module.h72
-rw-r--r--engines/pink/objects/object.cpp46
-rw-r--r--engines/pink/objects/object.h58
-rw-r--r--engines/pink/objects/pages/game_page.cpp25
-rw-r--r--engines/pink/objects/pages/game_page.h73
-rw-r--r--engines/pink/objects/pages/page.cpp151
-rw-r--r--engines/pink/objects/pages/page.h58
-rw-r--r--engines/pink/objects/sequences/sequence.cpp144
-rw-r--r--engines/pink/objects/sequences/sequence.h87
-rw-r--r--engines/pink/objects/sequences/sequence_item.cpp109
-rw-r--r--engines/pink/objects/sequences/sequence_item.h85
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp76
-rw-r--r--engines/pink/objects/sequences/sequencer.h59
-rw-r--r--engines/pink/objects/side_effect.cpp126
-rw-r--r--engines/pink/objects/side_effect.h121
-rw-r--r--engines/pink/objects/walk/walk_location.cpp29
-rw-r--r--engines/pink/objects/walk/walk_location.h42
-rw-r--r--engines/pink/objects/walk/walk_mgr.cpp20
-rw-r--r--engines/pink/objects/walk/walk_mgr.h46
48 files changed, 3084 insertions, 0 deletions
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
new file mode 100644
index 0000000000..0853e377aa
--- /dev/null
+++ b/engines/pink/objects/actions/action.cpp
@@ -0,0 +1,34 @@
+/* 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 "action.h"
+#include "engines/pink/objects/actors/actor.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void Action::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _actor = static_cast<Actor*>(archive.readObject());
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
new file mode 100644
index 0000000000..5b164a3052
--- /dev/null
+++ b/engines/pink/objects/actions/action.h
@@ -0,0 +1,46 @@
+/* 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 PINK_ACTION_H
+#define PINK_ACTION_H
+
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class Actor;
+
+class Action : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk) {};
+ virtual void end() {};
+ virtual void update() {};
+ virtual void toConsole() {};
+
+protected:
+ Actor *_actor;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
new file mode 100644
index 0000000000..f1c350473f
--- /dev/null
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -0,0 +1,34 @@
+/* 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 <common/debug.h>
+#include "action_cel.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionCEL::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName >> _z;
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
new file mode 100644
index 0000000000..8c6a61a405
--- /dev/null
+++ b/engines/pink/objects/actions/action_cel.h
@@ -0,0 +1,41 @@
+/* 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 PINK_ACTION_CEL_H
+#define PINK_ACTION_CEL_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionCEL : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+protected:
+ Common::String _fileName;
+ uint32 _z;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
new file mode 100644
index 0000000000..7df43662bc
--- /dev/null
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -0,0 +1,48 @@
+/* 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 "action_hide.h"
+#include "engines/pink/objects/actors/actor.h"
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+
+
+namespace Pink {
+
+void Pink::ActionHide::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+}
+
+void ActionHide::play(bool unk_startNow) {
+ debug("ActionHide %s is now in playing state", _name.c_str());
+ _actor->endAction();
+}
+
+void ActionHide::end() {
+ debug("ActionHide %s is ended", _name.c_str());
+}
+
+void ActionHide::toConsole() {
+ debug("\tActionHide: _name = %s", _name.c_str());
+}
+
+} //End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
new file mode 100644
index 0000000000..fa6e717ede
--- /dev/null
+++ b/engines/pink/objects/actions/action_hide.h
@@ -0,0 +1,42 @@
+/* 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 PINK_ACTION_HIDE_H
+#define PINK_ACTION_HIDE_H
+
+#include "action.h"
+
+namespace Pink {
+
+class ActionHide : public Action {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void play(bool unk_startNow);
+ virtual void end();
+};
+
+} //End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
new file mode 100644
index 0000000000..5e6b692d30
--- /dev/null
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -0,0 +1,39 @@
+/* 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 <common/debug.h>
+#include "action_play.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionPlay::deserialize(Archive &archive) {
+ ActionStill::deserialize(archive);
+ archive >> _stopFrame;
+}
+
+void ActionPlay::toConsole() {
+ debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
new file mode 100644
index 0000000000..d53b44a1d1
--- /dev/null
+++ b/engines/pink/objects/actions/action_play.h
@@ -0,0 +1,42 @@
+/* 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 PINK_ACTION_PLAY_H
+#define PINK_ACTION_PLAY_H
+
+#include "action.h"
+#include "action_still.h"
+
+namespace Pink {
+
+class ActionPlay : public ActionStill {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+private:
+ uint32 _stopFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
new file mode 100644
index 0000000000..f389f97a1a
--- /dev/null
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -0,0 +1,72 @@
+/* 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 <common/debug.h>
+#include "action_sound.h"
+#include "engines/pink/archive.h"
+#include <engines/pink/objects/actors/actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/sound.h>
+
+
+namespace Pink {
+
+ActionSound::ActionSound()
+ : _sound(nullptr), _isStopped(1)
+{}
+
+void ActionSound::deserialize(Archive &archive) {
+ Action::deserialize(archive);
+ archive >> _fileName;
+ _volume = archive.readDWORD();
+ _isLoop = (bool) archive.readDWORD();
+ _isBackground = (bool) archive.readDWORD();
+}
+
+void ActionSound::toConsole() {
+ debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
+ " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
+}
+
+void ActionSound::start(bool unk) {
+ assert(!_sound);
+ _sound = _actor->getPage()->loadSound(_fileName);
+
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
+ : Audio::Mixer::SoundType::kSpeechSoundType;
+ _sound->play(soundType, _volume, _isLoop);
+ if (_isLoop)
+ _actor->endAction();
+}
+
+void ActionSound::end() {
+ _sound->stop();
+ delete _sound;
+ _sound = nullptr;
+}
+
+void ActionSound::update() {
+ if (!_sound->isPlaying())
+ _actor->endAction();
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
new file mode 100644
index 0000000000..e4bb2f1822
--- /dev/null
+++ b/engines/pink/objects/actions/action_sound.h
@@ -0,0 +1,54 @@
+/* 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 PINK_ACTION_SOUND_H
+#define PINK_ACTION_SOUND_H
+
+#include "action.h"
+
+namespace Pink {
+
+class Sound;
+
+class ActionSound : public Action {
+public:
+ ActionSound();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void start(bool unk_startNow);
+ virtual void end();
+ virtual void update();
+
+private:
+ Sound *_sound;
+ Common::String _fileName;
+ uint32 _volume;
+ bool _isLoop;
+ bool _isBackground;
+ bool _isStopped;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
new file mode 100644
index 0000000000..3c6bf17cad
--- /dev/null
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -0,0 +1,39 @@
+/* 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 <common/debug.h>
+#include "action_still.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void ActionStill::deserialize(Archive &archive) {
+ ActionCEL::deserialize(archive);
+ archive >> _startFrame;
+}
+
+void ActionStill::toConsole() {
+ debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _startFrame);
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
new file mode 100644
index 0000000000..075371a9cc
--- /dev/null
+++ b/engines/pink/objects/actions/action_still.h
@@ -0,0 +1,41 @@
+/* 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 PINK_ACTION_STILL_H
+#define PINK_ACTION_STILL_H
+
+#include "action_cel.h"
+
+namespace Pink {
+
+class ActionStill : public ActionCEL {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+
+protected:
+ uint32 _startFrame;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
new file mode 100644
index 0000000000..39be8f4443
--- /dev/null
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -0,0 +1,40 @@
+/* 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 "walk_action.h"
+#include <engines/pink/archive.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void WalkAction::deserialize(Archive &archive) {
+ ActionCEL::deserialize(archive);
+ uint32 calcFramePositions = archive.readDWORD();
+ _toCalcFramePositions = calcFramePositions ? true : false;
+}
+
+void WalkAction::toConsole() {
+ debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
+ _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
new file mode 100644
index 0000000000..923811fe47
--- /dev/null
+++ b/engines/pink/objects/actions/walk_action.h
@@ -0,0 +1,42 @@
+/* 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 PINK_WALK_ACTION_H
+#define PINK_WALK_ACTION_H
+
+#include "action_cel.h"
+
+namespace Pink {
+
+class WalkAction : public ActionCEL {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+private:
+ bool _toCalcFramePositions;
+};
+
+}
+
+#endif
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
new file mode 100644
index 0000000000..c02cb67365
--- /dev/null
+++ b/engines/pink/objects/actors/actor.cpp
@@ -0,0 +1,110 @@
+/* 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 "actor.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "lead_actor.h"
+#include "engines/pink/objects/actions/action.h"
+
+namespace Pink {
+
+void Actor::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _page = static_cast<GamePage*>(archive.readObject());
+ archive >> _actions;
+}
+
+void Actor::toConsole() {
+ debug("Actor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+Sequencer *Actor::getSequencer() const {
+ return _page->getSequencer();
+}
+
+Action *Actor::findAction(const Common::String &name) {
+ return *Common::find_if(_actions.begin(), _actions.end(), [&name]
+ (Action* action) {
+ return name == action->getName();
+ });;
+}
+
+GamePage *Actor::getPage() const {
+ return _page;
+}
+
+void Actor::init(bool unk) {
+ if (!_action) {
+ _action = findAction({"Idle"});
+ }
+
+ if (!_action) {
+ _isActionEnd = 1;
+ }
+ else {
+ _isActionEnd = 0;
+ _action->start(unk);
+ }
+}
+
+void Actor::hide() {
+ setAction({"Hide"});
+}
+
+void Actor::endAction() {
+ _isActionEnd = 1;
+}
+
+void Actor::setAction(const Common::String &name) {
+ Action *newAction = findAction(name);
+ setAction(newAction);
+}
+
+void Actor::setAction(Action *newAction) {
+ if (_action) {
+ _isActionEnd = 1;
+ _action->end();
+ }
+ if (newAction) {
+ _isActionEnd = 0;
+ _action = newAction;
+ _action->start(0);
+ }
+}
+
+void Actor::setAction(Action *newAction, bool unk) {
+ if (unk){
+ assert(0); // want to see this
+ _isActionEnd = 1;
+ _action = newAction;
+ }
+ else setAction(newAction);
+}
+
+Action *Actor::getAction() const {
+ return _action;
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
new file mode 100644
index 0000000000..a31f5539d3
--- /dev/null
+++ b/engines/pink/objects/actors/actor.h
@@ -0,0 +1,68 @@
+/* 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 PINK_ACTOR_H
+#define PINK_ACTOR_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class GamePage;
+class Action;
+class Sequencer;
+
+class Actor : public NamedObject {
+public:
+ Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnd(1)
+ {};
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Sequencer *getSequencer() const;
+ GamePage *getPage() const;
+ Action *getAction() const;
+
+
+ virtual void init(bool unk);
+ void hide();
+ void endAction();
+
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
+
+protected:
+ GamePage *_page;
+ Action *_action;
+ Common::Array<Action*> _actions;
+ bool _isActionEnd;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
new file mode 100644
index 0000000000..2c886126cd
--- /dev/null
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -0,0 +1,63 @@
+/* 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 "lead_actor.h"
+#include <engines/pink/objects/actions/action.h>
+#include "engines/pink/objects/walk/walk_mgr.h"
+#include "engines/pink/cursor_mgr.h"
+#include "engines/pink/objects/sequences/sequencer.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/pink.h"
+
+namespace Pink {
+
+void LeadActor::deserialize(Archive &archive) {
+ Actor::deserialize(archive);
+ _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr*>(archive.readObject());
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+}
+
+void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
+ if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
+ _state = PlayingVideo;
+ _page->getGame()->setNextExecutors(nextModule, nextPage);
+ }
+}
+
+void LeadActor::init(bool unk) {
+ if (_state == unk_Loading){
+ _state = Ready;
+ }
+ _page->getModule()->getInventoryMgr()->setLeadActor(this);
+ Actor::init(unk);
+}
+
+void LeadActor::toConsole() {
+ debug("LeadActor: _name = %s", _name.c_str());
+ for (int i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
new file mode 100644
index 0000000000..762facbf1e
--- /dev/null
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -0,0 +1,63 @@
+/* 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 PINK_LEAD_ACTOR_H
+#define PINK_LEAD_ACTOR_H
+
+#include "actor.h"
+
+namespace Pink {
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+
+class LeadActor : public Actor {
+public:
+ enum State {
+ Ready = 0,
+ Moving,
+ inDialog1, //???
+ Inventory,
+ PDA,
+ inDialog2,//???
+ PlayingVideo, // ???
+ unk_Loading // ????
+ };
+
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+ virtual void init(bool unk);
+
+private:
+ State _state;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
new file mode 100644
index 0000000000..71a68d4f3a
--- /dev/null
+++ b/engines/pink/objects/condition.cpp
@@ -0,0 +1,98 @@
+/* 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 <engines/pink/archive.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
+#include "condition.h"
+
+namespace Pink {
+
+void Pink::ConditionVariable::deserialize(Archive &archive) {
+ archive >> _name >> _value;
+}
+
+bool Pink::ConditionGameVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionGameVariable::toConsole() {
+ debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool Pink::ConditionModuleVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->getModule()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionModuleVariable::toConsole() {
+ debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool Pink::ConditionNotModuleVariable::evaluate(LeadActor *leadActor) {
+ return !ConditionModuleVariable::evaluate(leadActor);
+}
+
+void ConditionNotModuleVariable::toConsole() {
+ debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool ConditionPageVariable::evaluate(LeadActor *leadActor) {
+ return leadActor->getPage()->checkValueOfVariable(_name, _value);
+}
+
+void ConditionPageVariable::toConsole() {
+ debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+bool ConditionNotPageVariable::evaluate(LeadActor *leadActor) {
+ return !ConditionPageVariable::evaluate(leadActor);
+}
+
+void ConditionNotPageVariable::toConsole() {
+ debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+void ConditionInventoryItemOwner::deserialize(Archive &archive) {
+ archive >> _item >> _owner;
+}
+
+bool ConditionInventoryItemOwner::evaluate(LeadActor *leadActor) {
+ InventoryMgr *mgr = leadActor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ return item->getCurrentOwner() == _owner;
+}
+
+void ConditionInventoryItemOwner::toConsole() {
+ debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+bool ConditionNotInventoryItemOwner::evaluate(LeadActor *leadActor) {
+ return !ConditionInventoryItemOwner::evaluate(leadActor);
+}
+
+void ConditionNotInventoryItemOwner::toConsole() {
+ debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+} // End of namespace Pink
+
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
new file mode 100644
index 0000000000..6df1920046
--- /dev/null
+++ b/engines/pink/objects/condition.h
@@ -0,0 +1,106 @@
+ /* 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 PINK_CONDITION_H
+#define PINK_CONDITION_H
+
+#include <engines/pink/objects/object.h>
+
+namespace Pink {
+
+class LeadActor;
+
+class Condition : public Object {
+public:
+ virtual void deserialize(Archive &archive) = 0;
+ virtual bool evaluate(LeadActor *leadActor) = 0;
+};
+
+class ConditionVariable : public Condition {
+public:
+
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(LeadActor *leadActor) = 0;
+
+protected:
+ Common::String _name;
+ Common::String _value;
+};
+
+class ConditionGameVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+/*
+ * It is not used in games and has evaluate method with infinity recursion
+class ConditionNotGameVariable : public ConditionGameVariable {
+ virtual bool evaluate(LeadActor *leadActor);
+};
+ */
+
+class ConditionModuleVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionNotModuleVariable : public ConditionModuleVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionPageVariable : public ConditionVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionNotPageVariable : public ConditionPageVariable {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+class ConditionInventoryItemOwner : public Condition {
+public:
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(LeadActor *leadActor);
+
+protected:
+ Common::String _item;
+ Common::String _owner;
+};
+
+class ConditionNotInventoryItemOwner : public ConditionInventoryItemOwner {
+public:
+ virtual void toConsole();
+ virtual bool evaluate(LeadActor *leadActor);
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
new file mode 100644
index 0000000000..6a53832d4a
--- /dev/null
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -0,0 +1,89 @@
+/* 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.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/side_effect.h"
+#include <engines/pink/objects/condition.h>
+#include <engines/pink/objects/sequences/sequencer.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <common/debug.h>
+
+namespace Pink {
+
+void Handler::deserialize(Archive &archive) {
+ archive >> _conditions;
+ archive >> _sideEffects;
+}
+
+bool Handler::isSuitable(LeadActor *actor) {
+ for (int i = 0; i < _conditions.size(); ++i) {
+ if (_conditions[i]->evaluate(actor)){
+ return false;
+ }
+ }
+ return true;
+}
+
+void Handler::prepareForNextHandler(LeadActor *actor) {
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->execute(actor);
+ }
+}
+
+void HandlerSequences::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+ archive >> _sequences;
+}
+
+void HandlerSequences::init(LeadActor *actor) {
+ prepareForNextHandler(actor);
+ Sequencer *sequencer = actor->getSequencer();
+ Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
+ sequencer->authorSequence(sequence, 0);
+}
+
+void HandlerStartPage::handle(Sequence *sequence) {
+ sequence->_unk = 1;
+}
+
+void HandlerStartPage::toConsole() {
+ debug("HandlerStartPage:");
+
+ debug("\tSideEffects:");
+ for (int i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (int i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
new file mode 100644
index 0000000000..4f8cc28779
--- /dev/null
+++ b/engines/pink/objects/handlers/handler.h
@@ -0,0 +1,72 @@
+/* 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 PINK_HANDLER_H
+#define PINK_HANDLER_H
+
+#include <common/array.h>
+#include <common/str-array.h>
+#include <engines/pink/objects/object.h>
+
+
+namespace Pink {
+
+class Condition;
+class SideEffect;
+class LeadActor;
+
+class Handler : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+ bool isSuitable(LeadActor *actor);
+
+protected:
+ void prepareForNextHandler(LeadActor *actor);
+
+ Common::Array<Condition*> _conditions;
+ Common::Array<SideEffect*> _sideEffects;
+};
+
+class Sequence;
+
+class HandlerSequences : public Handler {
+public:
+ virtual void deserialize(Archive &archive);
+ void init(LeadActor *actor);
+ virtual void handle(Sequence *sequence) = 0;
+
+protected:
+ Common::StringArray _sequences;
+};
+
+class HandlerStartPage : public HandlerSequences {
+public:
+ ~HandlerStartPage() {};
+
+ virtual void toConsole();
+
+ virtual void handle(Sequence *sequence);
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
new file mode 100644
index 0000000000..9c8d43c0f7
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -0,0 +1,5 @@
+//
+// Created by andrei on 3/21/18.
+//
+
+#include "handler_mgr.h"
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
new file mode 100644
index 0000000000..978f8d91b3
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -0,0 +1,14 @@
+//
+// Created by andrei on 3/21/18.
+//
+
+#ifndef SCUMMVM_HANDLER_MGR_H
+#define SCUMMVM_HANDLER_MGR_H
+
+
+class HandlerMgr {
+
+};
+
+
+#endif //SCUMMVM_HANDLER_MGR_H
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
new file mode 100644
index 0000000000..2c6161b46f
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -0,0 +1,44 @@
+/* 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_timer.h"
+
+namespace Pink {
+
+
+void HandlerTimerActions::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+}
+
+void HandlerTimerActions::handle(LeadActor *actor) {
+
+}
+
+void HandlerTimerSequences::deserialize(Archive &archive) {
+ Handler::deserialize(archive);
+}
+
+void HandlerTimerSequences::handle(LeadActor *actor) {
+
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
new file mode 100644
index 0000000000..21d9518e04
--- /dev/null
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -0,0 +1,57 @@
+/* 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 PINK_HANDLER_TIMER_H
+#define PINK_HANDLER_TIMER_H
+
+#include <common/str-array.h>
+#include "handler.h"
+
+namespace Pink {
+
+class LeadActor;
+
+// This class has difference in games
+class HandlerTimer : public Handler {
+ virtual void handle(LeadActor *actor) = 0;
+};
+
+class HandlerTimerActions : public HandlerTimer {
+ virtual void deserialize(Archive &archive);
+ virtual void handle(LeadActor *actor);
+
+private:
+ Common::StringArray _actions;
+};
+
+class HandlerTimerSequences : public HandlerTimer {
+ virtual void deserialize(Archive &archive);
+ virtual void handle(LeadActor *actor);
+
+private:
+ Common::StringArray _sequences;
+};
+
+} // End of namespace Pink
+
+
+#endif
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
new file mode 100644
index 0000000000..feed41a29b
--- /dev/null
+++ b/engines/pink/objects/inventory.cpp
@@ -0,0 +1,74 @@
+/* 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 <common/debug.h>
+#include "inventory.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+void Pink::InventoryItem::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
+}
+
+Common::String &InventoryItem::getCurrentOwner() {
+ return _currentOwner;
+}
+
+void InventoryItem::toConsole() {
+ debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner, _currentOwner);
+}
+
+InventoryMgr::~InventoryMgr() {
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
+}
+
+void InventoryMgr::deserialize(Archive &archive) {
+ archive >> _items;
+}
+
+InventoryItem *InventoryMgr::findInventoryItem(Common::String &name) {
+ return *Common::find_if(_items.begin(), _items.end(), [&name]
+ (InventoryItem *item) {
+ return name == item->getName();
+ });;
+}
+
+void InventoryMgr::setLeadActor(LeadActor *lead) {
+ _lead = lead;
+}
+
+void InventoryMgr::toConsole() {
+ debug("InventoryMgr:");
+ for (int i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
+
+
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
new file mode 100644
index 0000000000..ca1ef7fb69
--- /dev/null
+++ b/engines/pink/objects/inventory.h
@@ -0,0 +1,66 @@
+/* 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 PINK_INVENTORY_H
+#define PINK_INVENTORY_H
+
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+
+class InventoryItem : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Common::String &getCurrentOwner();
+
+private:
+ Common::String _initialOwner;
+ Common::String _currentOwner;
+};
+
+class LeadActor;
+
+class InventoryMgr : public Object {
+public:
+ virtual ~InventoryMgr();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ void setLeadActor(LeadActor *lead);
+ InventoryItem* findInventoryItem(Common::String &name);
+
+private:
+ LeadActor *_lead;
+ Common::Array<InventoryItem*> _items;
+ // other fields. haven't RE them yet
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
new file mode 100644
index 0000000000..97f78d4637
--- /dev/null
+++ b/engines/pink/objects/module.cpp
@@ -0,0 +1,114 @@
+/* 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 "module.h"
+#include "engines/pink/objects/pages/game_page.h"
+
+namespace Pink {
+
+ModuleProxy::ModuleProxy(const Common::String &name)
+ : NamedObject(name)
+{}
+
+ModuleProxy::ModuleProxy() {}
+
+Module::Module(PinkEngine *game, const Common::String &name)
+ : NamedObject(name), _game(game), _page(nullptr)
+{}
+
+void Module::load(Archive &archive){
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+
+ archive.readString(); // skip directory
+
+ _invMgr.deserialize(archive);
+ archive >> _pages;
+}
+
+void Module::init(bool isLoadingSave, const Common::String *pageName) {
+ // debugging original
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+
+ // 1 1 - haven't seen those values
+
+ //this func will be rewrited after testing
+
+ if (_page) {
+ debug("loading from save");
+ }
+ if (pageName){
+ debug("module changed");
+ }
+ assert(_pages.size() != 0);
+
+ if (pageName) {
+ uint i;
+ for (i = 0; i < _pages.size(); ++i) {
+ if(*pageName == _pages[i]->getName()) {
+ _page = _pages[i];
+ }
+ }
+ assert(i < _pages.size());
+ }
+
+ if (_page) {
+ _page->init(isLoadingSave); // module changed or from save
+ return;
+ }
+
+ if (_page != _pages[0]) {
+ if (_page) {
+ assert(0); // in original code there is call to page func but I've never seen it
+ return;
+ }
+ _page = _pages[0];
+ _page->init(isLoadingSave); // new game
+ return;
+ }
+
+ assert(0);
+}
+
+PinkEngine *Module::getGame() const {
+ return _game;
+}
+
+bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void Module::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
+InventoryMgr *Module::getInventoryMgr() {
+ return &_invMgr;
+}
+
+} // End of namespace Pink
+
+
+
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
new file mode 100644
index 0000000000..214ff2a473
--- /dev/null
+++ b/engines/pink/objects/module.h
@@ -0,0 +1,72 @@
+/* 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 PINK_MODULE_H
+#define PINK_MODULE_H
+
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/object.h"
+#include <common/debug.h>
+#include <common/hash-str.h>
+#include "engines/pink/objects/inventory.h"
+
+namespace Pink {
+
+class ModuleProxy : public NamedObject {
+public:
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
+};
+
+class PinkEngine;
+class GamePage;
+
+class Module : public NamedObject {
+public:
+ Module(PinkEngine *game, const Common::String &name);
+
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String *pageName);
+
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
+
+
+ PinkEngine *getGame() const;
+ InventoryMgr *getInventoryMgr();
+
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+
+private:
+ PinkEngine *_game;
+ GamePage *_page;
+ Common::Array<GamePage*> _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _variables;
+};
+
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
new file mode 100644
index 0000000000..eac48bdfe6
--- /dev/null
+++ b/engines/pink/objects/object.cpp
@@ -0,0 +1,46 @@
+/* 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 <common/debug.h>
+#include "object.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+Pink::NamedObject::NamedObject(const Common::String &name)
+ : _name(name)
+{}
+
+void Pink::NamedObject::deserialize(Archive &archive) {
+ _name = archive.readString();
+}
+
+const Common::String &Pink::NamedObject::getName() const {
+ return _name;
+}
+
+void NamedObject::store(Archive &archive) {
+
+}
+
+} // End of namespace Pink
+
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
new file mode 100644
index 0000000000..1f67c3dac7
--- /dev/null
+++ b/engines/pink/objects/object.h
@@ -0,0 +1,58 @@
+/* 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 PINK_OBJECT_H
+#define PINK_OBJECT_H
+
+#include <common/str.h>
+
+namespace Pink {
+
+class Archive;
+
+class Object {
+public:
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+ virtual void toConsole() {};
+};
+
+class NamedObject : public Object {
+public:
+ NamedObject(){};
+ NamedObject(const Common::String &name);
+
+ void deserialize(Archive &archive);
+ void store(Archive &archive);
+
+ const Common::String &getName() const;
+
+protected:
+ Common::String _name;
+};
+
+} // End of namespace Pink
+
+#endif \ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
new file mode 100644
index 0000000000..58d8830ddc
--- /dev/null
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -0,0 +1,25 @@
+/* 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.
+ *
+ */
+
+namespace Pink {
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
new file mode 100644
index 0000000000..f92a9662cc
--- /dev/null
+++ b/engines/pink/objects/pages/game_page.h
@@ -0,0 +1,73 @@
+/* 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 PINK_GAME_PAGE_H
+#define PINK_GAME_PAGE_H
+
+#include "page.h"
+
+namespace Pink {
+
+class CursorMgr;
+class WalkMgr;
+class Sequencer;
+class Handler;
+
+class GamePage : public Page {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void load(Archive &archive);
+
+ void loadManagers();
+
+ void init(bool isLoadingSave);
+
+ PinkEngine *getGame();
+ Sequencer *getSequencer();
+ WalkMgr *getWalkMgr();
+
+ Module *getModule() const;
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
+
+ virtual void toConsole();
+
+private:
+ int perhapsIsLoaded;
+ Module *_module;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+ Common::Array<Handler *> _handlers;
+ Common::StringMap _variables;
+
+ /*
+ int cunk_1;
+ int memfile;
+ int unk;
+ */
+};
+
+}
+
+#endif //SCUMMVM_GAME_PAGE_H
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
new file mode 100644
index 0000000000..6eb9ff2b8b
--- /dev/null
+++ b/engines/pink/objects/pages/page.cpp
@@ -0,0 +1,151 @@
+/* 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 <engines/pink/objects/walk/walk_mgr.h>
+#include <engines/pink/objects/handlers/handler.h>
+#include "game_page.h"
+#include "engines/pink/cursor_mgr.h"
+#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/objects/sequences/sequencer.h"
+
+namespace Pink {
+
+void Page::load(Archive &archive) {
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ archive >> _actors;
+}
+
+Actor *Page::findActor(Common::String &name) {
+ return *Common::find_if(_actors.begin(), _actors.end(), [&name]
+ (Actor *actor) {
+ return name == actor->getName();
+ });;
+}
+
+Sound *Page::loadSound(Common::String &fileName) {
+ return _resMgr.loadSound(fileName);
+}
+
+void Page::toConsole() {
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->toConsole();
+ }
+}
+
+
+void GamePage::deserialize(Archive &archive) {
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
+}
+
+void GamePage::load(Archive &archive) {
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
+
+ Page::load(archive);
+
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+
+ _walkMgr->deserialize(archive);
+
+ _sequencer->deserialize(archive);
+ archive >> _handlers;
+}
+
+void GamePage::init(bool isLoadingSave) {
+
+ if (!isLoadingSave){
+ //assert(perhapsIsLoaded == 0);
+ loadManagers();
+ }
+
+ toConsole();
+
+ for (int i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(0);
+ }
+
+ if (!isLoadingSave) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->isSuitable(_leadActor)){
+ HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
+ assert(handlerSequences);
+ handlerSequences->init(_leadActor);
+ break;
+ }
+ }
+
+ }
+
+}
+
+void GamePage::loadManagers() {
+ perhapsIsLoaded = true;
+ _cursorMgr = new CursorMgr(this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
+
+ _resMgr.init(_module->getGame(), this);
+
+ // memfile manipulations if from save or page changing
+
+}
+
+PinkEngine *GamePage::getGame() {
+ return _module->getGame();
+}
+
+Sequencer *GamePage::getSequencer() {
+ return _sequencer;
+}
+
+Module *GamePage::getModule() const {
+ return _module;
+}
+
+bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) {
+ assert(_variables.contains(variable));
+ return _variables[variable] == value;
+}
+
+void GamePage::setVariable(Common::String &variable, Common::String &value) {
+ _variables[variable] = value;
+}
+
+WalkMgr *GamePage::getWalkMgr() {
+ return _walkMgr;
+}
+
+void GamePage::toConsole() {
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (int i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
new file mode 100644
index 0000000000..63d45510e5
--- /dev/null
+++ b/engines/pink/objects/pages/page.h
@@ -0,0 +1,58 @@
+/* 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 PINK_PAGE_H
+#define PINK_PAGE_H
+
+#include "engines/pink/objects/object.h"
+#include "engines/pink/objects/module.h"
+#include "engines/pink/resource_mgr.h"
+
+namespace Pink {
+
+class Archive;
+class Actor;
+class LeadActor;
+
+class Page : public NamedObject {
+public:
+
+ void load(Archive &archive);
+ Actor *findActor(Common::String &name);
+ Sound* loadSound(Common::String &fileName);
+
+ virtual void toConsole();
+
+protected:
+ Common::Array<Actor*> _actors;
+ ResourceMgr _resMgr;
+ LeadActor *_leadActor;
+
+ /*
+ int unk_1;
+ CString _str;
+ */
+};
+
+} // End of namespace Pink
+
+#endif \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
new file mode 100644
index 0000000000..0af8f1a3fa
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -0,0 +1,144 @@
+/* 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 <common/debug.h>
+#include "sequence_item.h"
+#include "sequence.h"
+#include "sequencer.h"
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/objects/actors/actor.h"
+
+namespace Pink {
+
+Sequence::Sequence()
+ : _unk(0), _context(nullptr),
+ _sequencer(nullptr) {}
+
+Sequence::~Sequence() {
+ for (int i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
+}
+
+void Sequence::deserialize(Archive &archive) {
+ NamedObject::deserialize(archive);
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+ archive >> _items;
+}
+
+void Sequence::toConsole() {
+ debug("\t\tSequence %s", _name.c_str());
+ debug("\t\t\tItems:");
+ for (int i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
+}
+
+Common::Array<SequenceItem*> &Sequence::getItems() {
+ return _items;
+}
+
+void Sequence::setContext(SequenceContext *context) {
+ _context = context;
+}
+
+void Sequence::init(int unk) {
+ assert(_items.size());
+ assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
+ start(unk);
+}
+
+class Action;
+
+void Sequence::start(int unk) {
+ if (_context->_nextItemIndex > _items.size()){
+ debug("Sequence %s ended", _name);
+ //TODO destroy context
+ return;
+ }
+
+ if (!_items[_context->_nextItemIndex]->execute(_context->_unk, this, unk)){
+ //destroy context;
+ }
+
+ uint i;
+ for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
+ if (_items[i]->isLeader())
+ break;
+ _items[i]->execute(_context->_unk, this, unk);
+ }
+ _context->_nextItemIndex = i;
+
+
+ Common::Array<SequenceActorState> &states = _context->_states;
+ for (uint j = 0; j < states.size(); ++j) {
+ if (states[j]._unk != _context->_unk &&
+ !states[j]._actionName.empty()) {
+ Actor *actor;
+ Action *action;
+ actor = _sequencer->_page->findActor(states[j]._actorName);
+ assert(actor);
+ action = actor->findAction(states[j]._actionName);
+ assert(action);
+ if (actor->getAction() != action)
+ actor->setAction(action, unk);
+ }
+ }
+ _context->_unk++;
+}
+
+SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _unk(1), _actor(nullptr)
+{
+ sequence->setContext(this);
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
+ for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
+ }
+}
+
+SequenceContext::~SequenceContext() {
+
+}
+
+SequenceActorState::SequenceActorState(const Common::String &name)
+ :_actorName(name), _unk(0)
+{}
+
+const Common::String &SequenceActorState::getActor() const {
+ return _actorName;
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
new file mode 100644
index 0000000000..f2f324b8ca
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence.h
@@ -0,0 +1,87 @@
+/* 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 PINK_SEQUENCE_H
+#define PINK_SEQUENCE_H
+
+#include <engines/pink/objects/object.h>
+#include <common/array.h>
+
+namespace Pink {
+
+class Sequencer;
+class SequenceItem;
+class SequenceContext;
+
+class Sequence : public NamedObject {
+public:
+ Sequence();
+ virtual ~Sequence();
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ Common::Array<SequenceItem*> &getItems();
+
+ void setContext(SequenceContext *context);
+ void init(int unk);
+ void start(int unk);
+
+public:
+ SequenceContext *_context;
+ Sequencer *_sequencer;
+ Common::Array<SequenceItem*> _items;
+ int _unk;
+
+};
+
+class SequenceActorState {
+public:
+ SequenceActorState(const Common::String &name);
+
+ const Common::String &getActor() const;
+
+public:
+ Common::String _actorName;
+ Common::String _actionName; // ?state
+ int _unk;
+};
+
+class Actor;
+
+class SequenceContext {
+public:
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ ~SequenceContext();
+
+public:
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ int _nextItemIndex;
+ Actor *_actor;
+ Common::Array<SequenceActorState> _states;
+ int _unk;
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
new file mode 100644
index 0000000000..732424a075
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -0,0 +1,109 @@
+/* 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 "sequence_item.h"
+#include <common/debug.h>
+#include <engines/pink/objects/sequences/sequence.h>
+#include <engines/pink/objects/sequences/sequencer.h>
+#include <engines/pink/objects/actions/action.h>
+#include "engines/pink/archive.h"
+#include "engines/pink/objects/pages/game_page.h"
+#include "engines/pink/objects/actors/actor.h"
+
+namespace Pink {
+
+void SequenceItem::deserialize(Archive &archive) {
+ archive >> _actor >> _action;
+}
+
+void SequenceItem::toConsole() {
+ debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+const Common::String &SequenceItem::getActor() const {
+ return _actor;
+}
+
+const Common::String &SequenceItem::getAction() const {
+ return _action;
+}
+
+bool SequenceItem::execute(int unk, Sequence *sequence, bool unk2) {
+ Actor *actor;
+ Action *action;
+ if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
+ !(action = actor->findAction(_action))) {
+ assert(0);
+ return false;
+ }
+
+ actor->setAction(action, unk2);
+ Common::Array<SequenceActorState> &states = sequence->_context->_states;
+ for (int i = 0; i < sequence->_context->_states.size(); ++i) {
+ if (states[i]._actorName == _actor){
+ states[i]._unk = unk;
+ sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
+ break;
+ }
+ }
+
+ return true;
+}
+
+bool SequenceItem::isLeader() {
+ return false;
+}
+
+bool SequenceItemLeader::isLeader() {
+ return true;
+}
+
+void SequenceItemLeader::toConsole() {
+ debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+
+void SequenceItemLeaderAudio::deserialize(Archive &archive) {
+ SequenceItem::deserialize(archive);
+ archive.readDWORD();
+}
+
+void SequenceItemLeaderAudio::toConsole() {
+ debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+bool SequenceItemDefaultAction::execute(int unk, Sequence *sequence, bool unk2) {
+ Common::Array<SequenceActorState> &actorStates = sequence->_context->_states;
+ for (int i = 0; i < actorStates.size(); ++i) {
+ if (actorStates[i]._actorName == _actor){
+ actorStates[i]._actionName = _action;
+ break;
+ }
+ }
+ return true;
+}
+
+void SequenceItemDefaultAction::toConsole() {
+ debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
new file mode 100644
index 0000000000..70fc68d9c7
--- /dev/null
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -0,0 +1,85 @@
+/* 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 PINK_SEQUENCE_ITEM_H
+#define PINK_SEQUENCE_ITEM_H
+
+#include <engines/pink/objects/object.h>
+
+namespace Pink {
+
+class Sequence;
+
+class SequenceItem : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
+
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual bool isLeader();
+
+protected:
+ Common::String _actor;
+ Common::String _action;
+};
+
+class SequenceItemLeader : public SequenceItem {
+public:
+ virtual void toConsole();
+
+ virtual bool isLeader();
+};
+
+class SequenceItemLeaderAudio : public SequenceItemLeader {
+ virtual void deserialize(Archive &archive);
+
+public:
+ virtual void toConsole();
+
+private:
+ //uint32 _sample; // zero in data files and not used;
+};
+
+class SequenceItemDefaultAction : public SequenceItem {
+public:
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+
+ virtual void toConsole();
+};
+
+/* not used in games but is implemented in engine
+class SequenceItemSideEffects : public SequenceItemDefaultAction {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
+private
+ Common::Array<SideEffect*> _sideEffects
+};
+ */
+
+}
+
+#endif
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
new file mode 100644
index 0000000000..2bddcbd4f3
--- /dev/null
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -0,0 +1,76 @@
+/* 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 <common/debug.h>
+#include "sequencer.h"
+#include "sequence.h"
+#include "engines/pink/archive.h"
+
+namespace Pink {
+
+Sequencer::Sequencer(GamePage *page)
+ : _context(nullptr), _page(page)
+{}
+
+Sequencer::~Sequencer() {
+ for (int i = 0; i < _sequences.size(); ++i) {
+ delete _sequences[i];
+ }
+}
+
+void Sequencer::deserialize(Archive &archive) {
+ archive >> _sequences;
+ archive.readCount();// intro have 0 timers;
+ //serialize timers;
+
+}
+
+Sequence *Sequencer::findSequence(const Common::String &name) {
+ return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
+ (Sequence* sequence) {
+ return name == sequence->getName();
+ });
+}
+
+void Sequencer::authorSequence(Sequence *sequence, bool unk) {
+ if (_context){
+
+ }
+
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ //unload array of unknown objects
+ _currentSequenceName = sequence->getName();
+ sequence->start(unk);
+ }
+ else _currentSequenceName.clear();
+}
+
+void Sequencer::toConsole() {
+ debug("Sequencer:");
+ for (int i = 0; i < _sequences.size(); ++i) {
+ _sequences[i]->toConsole();
+ }
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
new file mode 100644
index 0000000000..d292346314
--- /dev/null
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -0,0 +1,59 @@
+/* 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 PINK_SEQUENCER_H
+#define PINK_SEQUENCER_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class Sequence;
+class SequenceContext;
+class GamePage;
+
+class Sequencer : public Object {
+public:
+ Sequencer(GamePage *page);
+ ~Sequencer();
+
+ virtual void toConsole();
+
+ virtual void deserialize(Archive &archive);
+ Sequence* findSequence(const Common::String &name);
+ void authorSequence(Sequence *sequence, bool unk);
+
+public:
+ SequenceContext *_context;
+ // unknown objects array
+ Common::Array<Sequence*> _sequences;
+ Common::String _currentSequenceName;
+ //timers
+ GamePage *_page;
+ int unk;
+};
+
+} // End of namespace Pink
+
+#endif \ No newline at end of file
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
new file mode 100644
index 0000000000..4b290fa054
--- /dev/null
+++ b/engines/pink/objects/side_effect.cpp
@@ -0,0 +1,126 @@
+/* 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 <common/hash-str.h>
+#include "side_effect.h"
+#include <engines/pink/archive.h>
+#include <engines/pink/objects/actors/lead_actor.h>
+#include <engines/pink/objects/pages/game_page.h>
+#include <engines/pink/pink.h>
+#include <engines/pink/objects/walk/walk_location.h>
+#include <engines/pink/objects/walk/walk_mgr.h>
+
+namespace Pink {
+
+void SideEffectExit::deserialize(Archive &archive) {
+ archive >> _nextModule >> _nextPage;
+}
+
+void SideEffectExit::execute(LeadActor *actor) {
+ actor->setNextExecutors(_nextModule, _nextPage);
+}
+
+void SideEffectExit::toConsole() {
+ debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
+}
+
+
+void SideEffectLocation::deserialize(Archive &archive) {
+ archive >> _location;
+}
+
+void SideEffectLocation::execute(LeadActor *actor) {
+ WalkMgr *mgr = actor->getPage()->getWalkMgr();
+ WalkLocation *location = mgr->findLocation(_location);
+ //TODO end this method
+}
+
+void SideEffectLocation::toConsole() {
+ debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
+}
+
+
+void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
+ archive >> _item >> _owner;
+}
+
+void SideEffectInventoryItemOwner::execute(LeadActor *actor) {
+ //TODO
+}
+
+void SideEffectInventoryItemOwner::toConsole() {
+ debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+}
+
+
+void SideEffectVariable::deserialize(Pink::Archive &archive) {
+ archive >> _name >> _value;
+}
+
+
+void SideEffectGameVariable::execute(LeadActor *actor) {
+ actor->getPage()->getGame()->setVariable(_name, _value);
+}
+
+void SideEffectGameVariable::toConsole() {
+ debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectModuleVariable::execute(LeadActor *actor) {
+ actor->getPage()->setVariable(_name, _value);
+}
+
+void SideEffectModuleVariable::toConsole() {
+ debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectPageVariable::execute(LeadActor *actor) {
+ actor->getPage()->setVariable(_name, _value);
+}
+
+void SideEffectPageVariable::toConsole() {
+ debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+}
+
+
+void SideEffectRandomPageVariable::deserialize(Archive &archive) {
+ archive >> _name >> _values;
+}
+
+void SideEffectRandomPageVariable::execute(LeadActor *actor) {
+ // TODO think how to get rand gen here
+ actor->getPage()->setVariable(_name, _values[0]); // temporary solution
+}
+
+void SideEffectRandomPageVariable::toConsole() {
+ Common::String values("{");
+ for (int i = 0; i < _values.size(); ++i) {
+ values += _values[i];
+ values += ',';
+ }
+ values += '}';
+ debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
new file mode 100644
index 0000000000..810dd469b6
--- /dev/null
+++ b/engines/pink/objects/side_effect.h
@@ -0,0 +1,121 @@
+/* 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 PINK_SIDE_EFFECT_H
+#define PINK_SIDE_EFFECT_H
+
+#include <engines/pink/objects/object.h>
+#include <common/str-array.h>
+
+namespace Pink {
+
+class LeadActor;
+
+class SideEffect : public Object {
+public:
+ virtual void deserialize(Archive &archive) = 0;
+ virtual void execute(LeadActor *actor) = 0;
+};
+
+class SideEffectExit : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+
+ virtual void toConsole();
+
+ virtual void execute(LeadActor *actor);
+
+private:
+ Common::String _nextModule;
+ Common::String _nextPage;
+};
+
+class SideEffectLocation : public SideEffect {
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor);
+
+public:
+ virtual void toConsole();
+
+private:
+ Common::String _location;
+};
+
+class SideEffectInventoryItemOwner : public SideEffect {
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor);
+
+public:
+ virtual void toConsole();
+
+private:
+ Common::String _item;
+ Common::String _owner;
+};
+
+class SideEffectVariable : public SideEffect {
+public:
+ virtual void deserialize(Archive &archive);
+ virtual void execute(LeadActor *actor) = 0;
+
+protected:
+ Common::String _name;
+ Common::String _value;
+};
+
+class SideEffectGameVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectModuleVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectPageVariable : public SideEffectVariable {
+public:
+ virtual void toConsole();
+
+ virtual void execute(LeadActor *actor);
+};
+
+class SideEffectRandomPageVariable : public SideEffect
+{
+ virtual void deserialize(Archive &archive);
+
+public:
+ virtual void toConsole();
+
+private:
+ virtual void execute(LeadActor *actor);
+
+private:
+ Common::String _name;
+ Common::StringArray _values;
+};
+
+}
+
+#endif
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
new file mode 100644
index 0000000000..e5f5ea7535
--- /dev/null
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -0,0 +1,29 @@
+/* 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 "walk_location.h"
+#include "engines/pink/archive.h"
+
+void Pink::WalkLocation::deserialize(Pink::Archive &archive) {
+ NamedObject::deserialize(archive);
+ archive >> _neighbors;
+}
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
new file mode 100644
index 0000000000..82e6436b77
--- /dev/null
+++ b/engines/pink/objects/walk/walk_location.h
@@ -0,0 +1,42 @@
+/* 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 PINK_WALK_LOCATION_H
+#define PINK_WALK_LOCATION_H
+
+#include <engines/pink/objects/object.h>
+#include <common/array.h>
+#include <common/str-array.h>
+
+
+namespace Pink {
+
+class WalkLocation : public NamedObject {
+public:
+ virtual void deserialize(Archive &archive);
+
+private:
+ Common::StringArray _neighbors;
+};
+
+} // End of namespace Pink
+
+#endif \ No newline at end of file
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
new file mode 100644
index 0000000000..1b5ceef210
--- /dev/null
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -0,0 +1,20 @@
+//
+// Created by andrei on 3/17/18.
+//
+
+#include "walk_mgr.h"
+#include "walk_location.h"
+#include "engines/pink/objects/actors/lead_actor.h"
+#include "engines/pink/archive.h"
+
+
+void Pink::WalkMgr::deserialize(Pink::Archive &archive) {
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
+ archive >> _locations;
+}
+
+Pink::WalkLocation *Pink::WalkMgr::findLocation(Common::String &name) {
+ return *Common::find_if(_locations.begin(), _locations.end(), [&name] (WalkLocation *location) {
+ return location->getName() == name;
+ });
+}
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
new file mode 100644
index 0000000000..0ae7ef6194
--- /dev/null
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -0,0 +1,46 @@
+/* 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 PINK_WALK_MGR_H
+#define PINK_WALK_MGR_H
+
+#include <common/array.h>
+#include "engines/pink/objects/object.h"
+
+namespace Pink {
+
+class WalkLocation;
+class LeadActor;
+
+class WalkMgr : public Object {
+public:
+ virtual void deserialize(Archive &archive);
+ WalkLocation *findLocation(Common::String &name);
+
+private:
+ LeadActor *_leadActor;
+ Common::Array<WalkLocation*> _locations;
+};
+
+} // End of namespace Pink
+
+#endif