aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232014-03-11 17:59:59 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit12645cbb8cb90adb5917b554e14142bf33d0f70a (patch)
treeaebaf66b54c0746ee2c991f2bdd68e5123c4c1c8 /engines
parente0a3db43c3eed0c5bb7f94f408e5534aff1ea17a (diff)
downloadscummvm-rg350-12645cbb8cb90adb5917b554e14142bf33d0f70a.tar.gz
scummvm-rg350-12645cbb8cb90adb5917b554e14142bf33d0f70a.tar.bz2
scummvm-rg350-12645cbb8cb90adb5917b554e14142bf33d0f70a.zip
ILLUSIONS: Some work on the Camera class; start with time functions
Diffstat (limited to 'engines')
-rw-r--r--engines/illusions/camera.cpp56
-rw-r--r--engines/illusions/camera.h32
-rw-r--r--engines/illusions/graphics.h5
-rw-r--r--engines/illusions/module.mk1
-rw-r--r--engines/illusions/time.cpp33
-rw-r--r--engines/illusions/time.h34
-rw-r--r--engines/illusions/updatefunctions.cpp6
7 files changed, 160 insertions, 7 deletions
diff --git a/engines/illusions/camera.cpp b/engines/illusions/camera.cpp
index 5f8b2a0e19..76addb6aca 100644
--- a/engines/illusions/camera.cpp
+++ b/engines/illusions/camera.cpp
@@ -21,11 +21,65 @@
*/
#include "illusions/camera.h"
+#include "illusions/time.h"
namespace Illusions {
+Camera::Camera() {
+ _activeState._cameraMode = 6;
+ _activeState._paused = 0;
+ _activeState._panStartTime = getCurrentTime();
+ _activeState._panSpeed = 1;
+ _activeState._bounds._topLeft.x = 320;
+ _activeState._bounds._topLeft.y = 240;
+ _activeState._bounds._bottomRight.x = 320;
+ _activeState._bounds._bottomRight.y = 240;
+ _activeState._currPan.x = 320;
+ _activeState._currPan.y = 240;
+ _activeState._panXShl = 320 << 16;
+ _activeState._panYShl = 240 << 16;
+ _activeState._panTargetPoint.x = 320;
+ _activeState._panTargetPoint.y = 240;
+ _activeState._panToPositionPtr = 0;
+ _activeState._panNotifyId = 0;
+ _activeState._trackingLimits.x = 0;
+ _activeState._trackingLimits.y = 0;
+ _activeState._pt.x = 320;
+ _activeState._pt.y = 240;
+ _activeState._pointFlags = 0;
+}
+
+void Camera::clearStack() {
+ _stack.clear();
+}
+
+void Camera::set(Common::Point &panPoint, WidthHeight &dimensions) {
+ _activeState._cameraMode = 6;
+ _activeState._paused = 0;
+ _activeState._panStartTime = getCurrentTime();
+ _activeState._panSpeed = 1;
+ _activeState._bounds._topLeft.x = 320;
+ _activeState._bounds._topLeft.y = 240;
+ _activeState._bounds._bottomRight.x = MAX(0, dimensions._width - 640) + 320;
+ _activeState._bounds._bottomRight.y = MAX(0, dimensions._height - 480) + 240;
+ _activeState._panTargetPoint = panPoint;
+ // TODO camera_clipPanTargetPoint();
+ _activeState._currPan = _activeState._panTargetPoint;
+ _activeState._panXShl = _activeState._currPan.x << 16;
+ _activeState._panYShl = _activeState._currPan.y << 16;
+ // TODO largeObj_backgroundItem_refreshPan();
+ _activeState._panToPositionPtr = 0;
+ _activeState._panObjectId = 0;
+ _activeState._panNotifyId = 0;
+ _activeState._trackingLimits.x = 0;
+ _activeState._trackingLimits.y = 0;
+ _activeState._pointFlags = 0;
+ _activeState._pt.x = 320;
+ _activeState._pt.y = 240;
+}
+
Common::Point Camera::getCurrentPan() {
- return _currPan;
+ return _activeState._currPan;
}
} // End of namespace Illusions
diff --git a/engines/illusions/camera.h b/engines/illusions/camera.h
index d55ab8e33b..fae3c328ac 100644
--- a/engines/illusions/camera.h
+++ b/engines/illusions/camera.h
@@ -23,15 +23,45 @@
#ifndef ILLUSIONS_CAMERA_H
#define ILLUSIONS_CAMERA_H
+#include "illusions/graphics.h"
#include "common/rect.h"
+#include "common/stack.h"
namespace Illusions {
+struct CameraState {
+ int _cameraMode;
+ //field_2 dw
+ int16 _paused;
+ int16 _panSpeed;
+ int _someX, _someY;
+ Common::Point _currPan;
+ int _panXShl, _panYShl;
+ WRect _bounds;
+ uint32 _panNotifyId;
+ uint32 _time28;
+ uint32 _panStartTime;
+ uint32 _pauseStartTime;
+ uint32 _time2E;
+ Common::Point _currPan2;
+ Common::Point _panTargetPoint;
+ Common::Point _trackingLimits;
+ Common::Point _pt;
+ uint32 _panObjectId;
+ Common::Point *_panToPositionPtr;
+ uint _pointFlags;
+ //field_4A dw
+};
+
class Camera {
public:
+ Camera();
+ void clearStack();
+ void set(Common::Point &panPoint, WidthHeight &dimensions);
Common::Point getCurrentPan();
protected:
- Common::Point _currPan;
+ CameraState _activeState;
+ Common::FixedStack<CameraState, 8> _stack;
};
} // End of namespace Illusions
diff --git a/engines/illusions/graphics.h b/engines/illusions/graphics.h
index 0b16a0c91d..5a5cb02d7a 100644
--- a/engines/illusions/graphics.h
+++ b/engines/illusions/graphics.h
@@ -39,6 +39,11 @@ struct SurfInfo {
void load(Common::SeekableReadStream &stream);
};
+struct WRect {
+ Common::Point _topLeft;
+ Common::Point _bottomRight;
+};
+
void loadPoint(Common::SeekableReadStream &stream, Common::Point &pt);
} // End of namespace Illusions
diff --git a/engines/illusions/module.mk b/engines/illusions/module.mk
index 4a409e165a..504f636fb8 100644
--- a/engines/illusions/module.mk
+++ b/engines/illusions/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
resourcesystem.o \
spritedecompressqueue.o \
spritedrawqueue.o \
+ time.o \
updatefunctions.o
# This module can be built as a plugin
diff --git a/engines/illusions/time.cpp b/engines/illusions/time.cpp
new file mode 100644
index 0000000000..7873db6ba4
--- /dev/null
+++ b/engines/illusions/time.cpp
@@ -0,0 +1,33 @@
+/* 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/time.h"
+#include "common/system.h"
+
+namespace Illusions {
+
+uint32 getCurrentTime() {
+ // TODO, move to own file with other time related code
+ return g_system->getMillis();
+}
+
+} // End of namespace Illusions
diff --git a/engines/illusions/time.h b/engines/illusions/time.h
new file mode 100644
index 0000000000..3083af2e73
--- /dev/null
+++ b/engines/illusions/time.h
@@ -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.
+ *
+ */
+
+#ifndef ILLUSIONS_TIME_H
+#define ILLUSIONS_TIME_H
+
+#include "illusions/illusions.h"
+
+namespace Illusions {
+
+uint32 getCurrentTime();
+
+} // End of namespace Illusions
+
+#endif // ILLUSIONS_TIME_H
diff --git a/engines/illusions/updatefunctions.cpp b/engines/illusions/updatefunctions.cpp
index 9eb626c5ba..3a3aadf872 100644
--- a/engines/illusions/updatefunctions.cpp
+++ b/engines/illusions/updatefunctions.cpp
@@ -21,16 +21,12 @@
*/
#include "illusions/updatefunctions.h"
+#include "illusions/time.h"
#include "common/algorithm.h"
#include "common/system.h"
namespace Illusions {
-uint32 getCurrentTime() {
- // TODO, move to own file with other time related code
- return g_system->getMillis();
-}
-
// UpdateFunctions
UpdateFunctions::UpdateFunctions() {