aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/cursor.cpp
diff options
context:
space:
mode:
authorjohndoe1232014-03-20 14:16:48 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit43cd806f17377d5244e575b863519f013e5f033c (patch)
tree089f4367800ac59a51d23cbaeea9958e554b6a23 /engines/illusions/cursor.cpp
parentf47575ca906682bab942d19a36cc33ea7465a4b2 (diff)
downloadscummvm-rg350-43cd806f17377d5244e575b863519f013e5f033c.tar.gz
scummvm-rg350-43cd806f17377d5244e575b863519f013e5f033c.tar.bz2
scummvm-rg350-43cd806f17377d5244e575b863519f013e5f033c.zip
ILLUSIONS: Add more script opcodes
Diffstat (limited to 'engines/illusions/cursor.cpp')
-rw-r--r--engines/illusions/cursor.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/engines/illusions/cursor.cpp b/engines/illusions/cursor.cpp
new file mode 100644
index 0000000000..36ab97a633
--- /dev/null
+++ b/engines/illusions/cursor.cpp
@@ -0,0 +1,93 @@
+/* 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 "illusions/illusions.h"
+#include "illusions/actor.h"
+#include "illusions/cursor.h"
+#include "illusions/input.h"
+
+namespace Illusions {
+
+Cursor::Cursor(IllusionsEngine *vm)
+ : _vm(vm) {
+ _status = 1;
+ _control = 0;
+ _x = 320;
+ _y = 240;
+ _cursorNum = 1;
+ _field_10 = 0;
+ _sequenceId = 0;
+}
+
+void Cursor::place(Control *control, uint32 sequenceId) {
+ _status = 2;
+ _control = control;
+ _cursorNum = 1;
+ _field_10 = 0;
+ _sequenceId = sequenceId;
+ _visibleCtr = 0;
+ _control->_flags |= 8;
+ setActorIndex(_cursorNum, 1, 0);
+ _vm->_input->setCursorPosition(_control->_actor->_position);
+}
+
+void Cursor::setActorIndex(int a2, int a3, int a4) {
+ _control->_actor->_actorIndex = 1;// TODO?!? *((_BYTE *)&stru_42C040[30].y + 2 * ((always0 != 0) + 2 * a2) + a3 + 1);
+}
+
+void Cursor::setControl(Control *control) {
+ _control = control;
+}
+
+void Cursor::show() {
+ ++_visibleCtr;
+ if (_visibleCtr > 0) {
+ _control->_flags |= 1;
+ _control->_actor->_flags |= 1;
+ if (_control->_actor->_frameIndex) {
+ _control->_actor->_flags |= 0x2000;
+ _control->_actor->_flags |= 0x4000;
+ }
+ _vm->_input->discardButtons(0xFFFF);
+ }
+}
+
+void Cursor::hide() {
+ --_visibleCtr;
+ if (_visibleCtr < 0) {
+ _control->_flags &= ~1;
+ _control->_actor->_flags &= ~1;
+ }
+}
+
+void Cursor::cursorControlRoutine(Control *control, uint32 deltaTime) {
+ _control->_actor->_seqCodeValue1 = 100 * deltaTime;
+ if (_control->_actor->_flags & 1) {
+ if (_status == 2) {
+ // Unused nullsub_1(control);
+ } else if (_status == 3) {
+ // TODO _vm->_shellMgr->handleMouse(_control);
+ }
+ }
+}
+
+} // End of namespace Illusions