2003-05-29 12:55:28 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001-2003 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
2003-10-03 18:33:57 +00:00
|
|
|
#include "scumm/scumm.h"
|
|
|
|
#include "scumm/intern.h"
|
|
|
|
#include "scumm/actor.h"
|
|
|
|
#include "scumm/charset.h"
|
|
|
|
|
|
|
|
namespace Scumm {
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::setCameraAtEx(int at) {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (!(_features & GF_NEW_CAMERA)) {
|
2004-01-03 21:22:07 +00:00
|
|
|
camera._mode = kNormalCameraMode;
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._cur.x = at;
|
|
|
|
setCameraAt(at, 0);
|
|
|
|
camera._movingToActor = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::setCameraAt(int pos_x, int pos_y) {
|
2004-01-03 21:22:07 +00:00
|
|
|
if (camera._mode != kFollowActorCameraMode || abs(pos_x - camera._cur.x) > (_screenWidth / 2)) {
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._cur.x = pos_x;
|
|
|
|
}
|
|
|
|
camera._dest.x = pos_x;
|
|
|
|
|
|
|
|
if (camera._cur.x < VAR(VAR_CAMERA_MIN_X))
|
|
|
|
camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X);
|
|
|
|
|
|
|
|
if (camera._cur.x > VAR(VAR_CAMERA_MAX_X))
|
|
|
|
camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X);
|
|
|
|
|
|
|
|
if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT)) {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version <= 2)
|
2003-05-29 12:55:28 +00:00
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8;
|
|
|
|
else
|
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
|
|
|
|
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
2003-06-01 14:30:26 +00:00
|
|
|
// If the camera moved and text is visible, remove it
|
2003-10-06 23:21:22 +00:00
|
|
|
if (camera._cur.x != camera._last.x && _charset->_hasMask && _version > 3)
|
|
|
|
stopTalk();
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v7::setCameraAt(int pos_x, int pos_y) {
|
2003-10-02 17:43:02 +00:00
|
|
|
Common::Point old;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
old = camera._cur;
|
|
|
|
|
|
|
|
camera._cur.x = pos_x;
|
|
|
|
camera._cur.y = pos_y;
|
|
|
|
|
|
|
|
clampCameraPos(&camera._cur);
|
|
|
|
|
|
|
|
camera._dest = camera._cur;
|
|
|
|
VAR(VAR_CAMERA_DEST_X) = camera._dest.x;
|
|
|
|
VAR(VAR_CAMERA_DEST_Y) = camera._dest.y;
|
|
|
|
|
|
|
|
assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2));
|
|
|
|
|
|
|
|
if ((camera._cur.x != old.x || camera._cur.y != old.y)
|
|
|
|
&& VAR(VAR_SCROLL_SCRIPT)) {
|
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
|
|
|
|
VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
|
|
|
|
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::setCameraFollows(Actor *a) {
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
int t, i;
|
|
|
|
|
2004-01-03 21:22:07 +00:00
|
|
|
camera._mode = kFollowActorCameraMode;
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._follows = a->number;
|
|
|
|
|
|
|
|
if (!a->isInCurrentRoom()) {
|
|
|
|
startScene(a->getRoom(), 0, 0);
|
2004-01-03 21:22:07 +00:00
|
|
|
camera._mode = kFollowActorCameraMode;
|
2003-09-14 18:16:45 +00:00
|
|
|
camera._cur.x = a->_pos.x;
|
2003-05-29 12:55:28 +00:00
|
|
|
setCameraAt(camera._cur.x, 0);
|
|
|
|
}
|
|
|
|
|
2003-11-16 20:52:57 +00:00
|
|
|
t = a->_pos.x / 8;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
if (t - _screenStartStrip < camera._leftTrigger || t - _screenStartStrip > camera._rightTrigger)
|
2003-09-14 18:16:45 +00:00
|
|
|
setCameraAt(a->_pos.x, 0);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
for (i = 1; i < _numActors; i++) {
|
|
|
|
if (_actors[i].isInCurrentRoom())
|
|
|
|
_actors[i].needRedraw = true;
|
|
|
|
}
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v7::setCameraFollows(Actor *a) {
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
byte oldfollow = camera._follows;
|
|
|
|
int ax, ay;
|
|
|
|
|
|
|
|
camera._follows = a->number;
|
|
|
|
VAR(VAR_CAMERA_FOLLOWED_ACTOR) = a->number;
|
|
|
|
|
|
|
|
if (!a->isInCurrentRoom()) {
|
|
|
|
startScene(a->getRoom(), 0, 0);
|
|
|
|
}
|
|
|
|
|
2003-09-14 18:16:45 +00:00
|
|
|
ax = abs(a->_pos.x - camera._cur.x);
|
|
|
|
ay = abs(a->_pos.y - camera._cur.y);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
if (ax > VAR(VAR_CAMERA_THRESHOLD_X) || ay > VAR(VAR_CAMERA_THRESHOLD_Y) || ax > (_screenWidth / 2) || ay > (_screenHeight / 2)) {
|
2003-09-14 18:16:45 +00:00
|
|
|
setCameraAt(a->_pos.x, a->_pos.y);
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a->number != oldfollow)
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::clampCameraPos(Common::Point *pt) {
|
2003-05-29 12:55:28 +00:00
|
|
|
if (pt->x < VAR(VAR_CAMERA_MIN_X))
|
|
|
|
pt->x = (short) VAR(VAR_CAMERA_MIN_X);
|
|
|
|
|
|
|
|
if (pt->x > VAR(VAR_CAMERA_MAX_X))
|
|
|
|
pt->x = (short) VAR(VAR_CAMERA_MAX_X);
|
|
|
|
|
|
|
|
if (pt->y < VAR(VAR_CAMERA_MIN_Y))
|
|
|
|
pt->y = (short) VAR(VAR_CAMERA_MIN_Y);
|
|
|
|
|
|
|
|
if (pt->y > VAR(VAR_CAMERA_MAX_Y))
|
|
|
|
pt->y = (short) VAR(VAR_CAMERA_MAX_Y);
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::moveCamera() {
|
2003-05-29 23:44:24 +00:00
|
|
|
int pos = camera._cur.x;
|
|
|
|
int actorx, t;
|
|
|
|
Actor *a = NULL;
|
|
|
|
|
|
|
|
camera._cur.x &= 0xFFF8;
|
|
|
|
|
|
|
|
if (camera._cur.x < VAR(VAR_CAMERA_MIN_X)) {
|
|
|
|
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
|
|
|
|
camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X);
|
|
|
|
else
|
|
|
|
camera._cur.x += 8;
|
|
|
|
cameraMoved();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (camera._cur.x > VAR(VAR_CAMERA_MAX_X)) {
|
|
|
|
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
|
|
|
|
camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X);
|
|
|
|
else
|
|
|
|
camera._cur.x -= 8;
|
|
|
|
cameraMoved();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-01-03 21:22:07 +00:00
|
|
|
if (camera._mode == kFollowActorCameraMode) {
|
2003-05-29 23:44:24 +00:00
|
|
|
a = derefActor(camera._follows, "moveCamera");
|
|
|
|
|
2003-09-14 18:16:45 +00:00
|
|
|
actorx = a->_pos.x;
|
2003-11-16 20:52:57 +00:00
|
|
|
t = actorx / 8 - _screenStartStrip;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (t < camera._leftTrigger || t > camera._rightTrigger) {
|
|
|
|
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X)) {
|
|
|
|
if (t > 35)
|
|
|
|
camera._dest.x = actorx + 80;
|
|
|
|
if (t < 5)
|
|
|
|
camera._dest.x = actorx - 80;
|
|
|
|
} else
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._movingToActor = true;
|
|
|
|
}
|
2003-05-29 23:44:24 +00:00
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._movingToActor) {
|
|
|
|
a = derefActor(camera._follows, "moveCamera(2)");
|
2003-09-14 18:16:45 +00:00
|
|
|
camera._dest.x = a->_pos.x;
|
2003-05-29 23:44:24 +00:00
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._dest.x < VAR(VAR_CAMERA_MIN_X))
|
|
|
|
camera._dest.x = (short) VAR(VAR_CAMERA_MIN_X);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._dest.x > VAR(VAR_CAMERA_MAX_X))
|
|
|
|
camera._dest.x = (short) VAR(VAR_CAMERA_MAX_X);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X)) {
|
|
|
|
camera._cur.x = camera._dest.x;
|
|
|
|
} else {
|
|
|
|
if (camera._cur.x < camera._dest.x)
|
|
|
|
camera._cur.x += 8;
|
|
|
|
if (camera._cur.x > camera._dest.x)
|
|
|
|
camera._cur.x -= 8;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
/* a is set a bit above */
|
2003-11-16 20:52:57 +00:00
|
|
|
if (camera._movingToActor && (camera._cur.x / 8) == (a->_pos.x / 8)) {
|
2003-05-29 23:44:24 +00:00
|
|
|
camera._movingToActor = false;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
cameraMoved();
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT) && pos != camera._cur.x) {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_version <= 2)
|
2003-05-29 23:44:24 +00:00
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8;
|
|
|
|
else
|
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
|
|
|
|
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v7::moveCamera() {
|
2003-10-02 17:43:02 +00:00
|
|
|
Common::Point old = camera._cur;
|
2003-05-29 23:44:24 +00:00
|
|
|
Actor *a = NULL;
|
|
|
|
|
|
|
|
if (camera._follows) {
|
|
|
|
a = derefActor(camera._follows, "moveCamera");
|
2003-09-14 18:16:45 +00:00
|
|
|
if (abs(camera._cur.x - a->_pos.x) > VAR(VAR_CAMERA_THRESHOLD_X) ||
|
|
|
|
abs(camera._cur.y - a->_pos.y) > VAR(VAR_CAMERA_THRESHOLD_Y)) {
|
2003-05-29 23:44:24 +00:00
|
|
|
camera._movingToActor = true;
|
|
|
|
if (VAR(VAR_CAMERA_THRESHOLD_X) == 0)
|
2003-09-14 18:16:45 +00:00
|
|
|
camera._cur.x = a->_pos.x;
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR(VAR_CAMERA_THRESHOLD_Y) == 0)
|
2003-09-14 18:16:45 +00:00
|
|
|
camera._cur.y = a->_pos.y;
|
2003-05-29 23:44:24 +00:00
|
|
|
clampCameraPos(&camera._cur);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
camera._movingToActor = false;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._movingToActor) {
|
2003-09-14 18:16:45 +00:00
|
|
|
VAR(VAR_CAMERA_DEST_X) = camera._dest.x = a->_pos.x;
|
|
|
|
VAR(VAR_CAMERA_DEST_Y) = camera._dest.y = a->_pos.y;
|
2003-05-29 23:44:24 +00:00
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2));
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
clampCameraPos(&camera._dest);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.x < camera._dest.x) {
|
|
|
|
camera._cur.x += (short) VAR(VAR_CAMERA_SPEED_X);
|
|
|
|
if (camera._cur.x > camera._dest.x)
|
|
|
|
camera._cur.x = camera._dest.x;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.x > camera._dest.x) {
|
|
|
|
camera._cur.x -= (short) VAR(VAR_CAMERA_SPEED_X);
|
|
|
|
if (camera._cur.x < camera._dest.x)
|
|
|
|
camera._cur.x = camera._dest.x;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.y < camera._dest.y) {
|
|
|
|
camera._cur.y += (short) VAR(VAR_CAMERA_SPEED_Y);
|
|
|
|
if (camera._cur.y > camera._dest.y)
|
|
|
|
camera._cur.y = camera._dest.y;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.y > camera._dest.y) {
|
|
|
|
camera._cur.y -= (short) VAR(VAR_CAMERA_SPEED_Y);
|
|
|
|
if (camera._cur.y < camera._dest.y)
|
|
|
|
camera._cur.y = camera._dest.y;
|
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.x == camera._dest.x && camera._cur.y == camera._dest.y) {
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
camera._movingToActor = false;
|
|
|
|
camera._accel.x = camera._accel.y = 0;
|
|
|
|
VAR(VAR_CAMERA_SPEED_X) = VAR(VAR_CAMERA_SPEED_Y) = 0;
|
2003-05-29 12:55:28 +00:00
|
|
|
} else {
|
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
camera._accel.x += (short) VAR(VAR_CAMERA_ACCEL_X);
|
|
|
|
camera._accel.y += (short) VAR(VAR_CAMERA_ACCEL_Y);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
VAR(VAR_CAMERA_SPEED_X) += camera._accel.x / 100;
|
|
|
|
VAR(VAR_CAMERA_SPEED_Y) += camera._accel.y / 100;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR(VAR_CAMERA_SPEED_X) < 8)
|
|
|
|
VAR(VAR_CAMERA_SPEED_X) = 8;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR(VAR_CAMERA_SPEED_Y) < 8)
|
|
|
|
VAR(VAR_CAMERA_SPEED_Y) = 8;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
cameraMoved();
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (camera._cur.x != old.x || camera._cur.y != old.y) {
|
|
|
|
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
|
|
|
|
VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
|
2003-05-29 12:55:28 +00:00
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
if (VAR(VAR_SCROLL_SCRIPT))
|
2003-05-29 12:55:28 +00:00
|
|
|
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-29 23:44:24 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::cameraMoved() {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_features & GF_NEW_CAMERA) {
|
2003-05-29 12:55:28 +00:00
|
|
|
assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2));
|
|
|
|
} else {
|
|
|
|
if (camera._cur.x < (_screenWidth / 2)) {
|
|
|
|
camera._cur.x = (_screenWidth / 2);
|
|
|
|
} else if (camera._cur.x > _roomWidth - (_screenWidth / 2)) {
|
|
|
|
camera._cur.x = _roomWidth - (_screenWidth / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-30 02:01:45 +00:00
|
|
|
_screenStartStrip = camera._cur.x / 8 - gdi._numStrips / 2;
|
2003-05-29 12:55:28 +00:00
|
|
|
_screenEndStrip = _screenStartStrip + gdi._numStrips - 1;
|
|
|
|
|
|
|
|
_screenTop = camera._cur.y - (_screenHeight / 2);
|
2003-06-07 00:13:26 +00:00
|
|
|
if (_features & GF_NEW_CAMERA) {
|
2003-05-29 12:55:28 +00:00
|
|
|
_screenLeft = camera._cur.x - (_screenWidth / 2);
|
|
|
|
} else {
|
2003-11-16 20:52:57 +00:00
|
|
|
_screenLeft = _screenStartStrip * 8;
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef V7_SMOOTH_SCROLLING_HACK
|
|
|
|
virtscr[0].xstart = _screenLeft;
|
|
|
|
#else
|
2003-11-16 20:52:57 +00:00
|
|
|
virtscr[0].xstart = _screenStartStrip * 8;
|
2003-05-29 12:55:28 +00:00
|
|
|
#endif
|
2003-07-01 15:21:51 +00:00
|
|
|
|
2003-10-06 12:28:52 +00:00
|
|
|
if (_charset->_hasMask && (_version >= 4 && _gameId != GID_LOOM256)) {
|
2003-07-01 15:26:07 +00:00
|
|
|
int dx = camera._cur.x - camera._last.x;
|
|
|
|
int dy = camera._cur.y - camera._last.y;
|
|
|
|
if (dx || dy) {
|
|
|
|
gdi._mask.left -= dx;
|
|
|
|
gdi._mask.right -= dx;
|
|
|
|
gdi._mask.top -= dy;
|
|
|
|
gdi._mask.bottom -= dy;
|
|
|
|
}
|
2003-07-01 15:21:51 +00:00
|
|
|
}
|
2003-05-29 12:55:28 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::panCameraTo(int x, int y) {
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._dest.x = x;
|
2004-01-03 21:22:07 +00:00
|
|
|
camera._mode = kPanningCameraMode;
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._movingToActor = false;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine_v7::panCameraTo(int x, int y) {
|
2003-05-29 12:55:28 +00:00
|
|
|
VAR(VAR_CAMERA_FOLLOWED_ACTOR) = camera._follows = 0;
|
|
|
|
VAR(VAR_CAMERA_DEST_X) = camera._dest.x = x;
|
|
|
|
VAR(VAR_CAMERA_DEST_Y) = camera._dest.y = y;
|
|
|
|
}
|
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
void ScummEngine::actorFollowCamera(int act) {
|
2003-06-07 00:13:26 +00:00
|
|
|
if (!(_features & GF_NEW_CAMERA)) {
|
2003-05-29 12:55:28 +00:00
|
|
|
int old;
|
|
|
|
|
2003-10-15 09:40:44 +00:00
|
|
|
// Exactly why is this code needed for Monkey Island 1?
|
|
|
|
// Seems to be the real cause of lock up at title screen
|
|
|
|
// in Amiga and PC demo versions.
|
|
|
|
/*
|
|
|
|
// MI1 compatibilty
|
2003-05-29 12:55:28 +00:00
|
|
|
if (act == 0) {
|
2004-01-03 21:22:07 +00:00
|
|
|
camera._mode = kNormalCameraMode;
|
2003-05-29 12:55:28 +00:00
|
|
|
camera._follows = 0;
|
|
|
|
camera._movingToActor = false;
|
|
|
|
return;
|
|
|
|
}
|
2003-10-15 09:40:44 +00:00
|
|
|
*/
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
old = camera._follows;
|
|
|
|
setCameraFollows(derefActor(act, "actorFollowCamera"));
|
|
|
|
if (camera._follows != old)
|
2003-06-14 12:23:30 +00:00
|
|
|
runInventoryScript(0);
|
2003-05-29 12:55:28 +00:00
|
|
|
|
|
|
|
camera._movingToActor = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|