aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'engines/pink/objects/handlers')
-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
6 files changed, 281 insertions, 0 deletions
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