[Scummvm-git-logs] scummvm master -> 61fa4b625342dacdb23e6ba27222f0ec910571d5
AndywinXp
noreply at scummvm.org
Sun Jan 8 16:42:56 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
61fa4b6253 SCUMM: v7-8: Fix FT camera bug and properly fix #1195 and #1579
Commit: 61fa4b625342dacdb23e6ba27222f0ec910571d5
https://github.com/scummvm/scummvm/commit/61fa4b625342dacdb23e6ba27222f0ec910571d5
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-01-08T17:42:50+01:00
Commit Message:
SCUMM: v7-8: Fix FT camera bug and properly fix #1195 and #1579
There was a nasty bug in the fuel tower room, when the cops arrive at the
tower and the player regains control, in which the camera would be brought up
and then down again.
While I was there, since this is the same domain, I rechecked the v7-8 camera
code from the disasm, made some corrections, and properly fixed #1195 and
#1579. Another workaround bites the dust :)
Changed paths:
engines/scumm/camera.cpp
engines/scumm/script_v6.cpp
engines/scumm/scumm.cpp
engines/scumm/string_v7.cpp
diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp
index 753db06129a..494b5ac4715 100644
--- a/engines/scumm/camera.cpp
+++ b/engines/scumm/camera.cpp
@@ -169,6 +169,7 @@ void ScummEngine::moveCamera() {
void ScummEngine::cameraMoved() {
int screenLeft;
if (_game.version >= 7) {
+ clampCameraPos(&camera._cur);
assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2));
} else {
if (camera._cur.x < (_screenWidth / 2)) {
@@ -222,23 +223,15 @@ void ScummEngine_v7::setCameraAt(int pos_x, int 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) {
- if (VAR(VAR_SCROLL_SCRIPT)) {
+ if (VAR(VAR_SCROLL_SCRIPT) && _game.version != 8) {
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
}
-
- // Even though cameraMoved() is called automatically, we may
- // need to know at once that the camera has moved, or text may
- // be printed at the wrong coordinates. See bugs #1195 and
- // #1579
- cameraMoved();
}
}
@@ -248,7 +241,6 @@ void ScummEngine_v7::setCameraFollows(Actor *a, bool setCamera) {
int ax, ay;
camera._follows = a->_number;
- VAR(VAR_CAMERA_FOLLOWED_ACTOR) = a->_number;
if (!a->isInCurrentRoom()) {
startScene(a->getRoom(), 0, 0);
@@ -345,9 +337,19 @@ void ScummEngine_v7::moveCamera() {
cameraMoved();
- if (camera._cur.x != old.x || camera._cur.y != old.y) {
+ if (_game.id != GID_FT) {
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
+ VAR(VAR_CAMERA_DEST_X) = camera._dest.x;
+ VAR(VAR_CAMERA_DEST_Y) = camera._dest.y;
+ VAR(VAR_CAMERA_FOLLOWED_ACTOR) = camera._follows;
+ }
+
+ if (camera._cur.x != old.x || camera._cur.y != old.y) {
+ if (_game.id == GID_FT) {
+ VAR(VAR_CAMERA_POS_X) = camera._cur.x;
+ VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
+ }
if (VAR(VAR_SCROLL_SCRIPT))
runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0);
@@ -355,7 +357,7 @@ void ScummEngine_v7::moveCamera() {
}
void ScummEngine_v7::panCameraTo(int x, int y) {
- VAR(VAR_CAMERA_FOLLOWED_ACTOR) = camera._follows = 0;
+ camera._follows = 0;
VAR(VAR_CAMERA_DEST_X) = camera._dest.x = x;
VAR(VAR_CAMERA_DEST_Y) = camera._dest.y = y;
}
diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp
index 910eecc7f4b..f6a89ae4f7a 100644
--- a/engines/scumm/script_v6.cpp
+++ b/engines/scumm/script_v6.cpp
@@ -1063,7 +1063,6 @@ void ScummEngine_v6::o6_setCameraAt() {
int x, y;
camera._follows = 0;
- VAR(VAR_CAMERA_FOLLOWED_ACTOR) = 0;
y = pop();
x = pop();
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index c56c9ad10e6..0287e20a73d 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2623,7 +2623,7 @@ void ScummEngine_v90he::scummLoop(int delta) {
#endif
void ScummEngine::scummLoop_updateScummVars() {
- if (_game.version >= 7) {
+ if (_game.version == 7) {
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
VAR(VAR_CAMERA_POS_Y) = camera._cur.y;
} else if (_game.platform == Common::kPlatformNES) {
diff --git a/engines/scumm/string_v7.cpp b/engines/scumm/string_v7.cpp
index 9a551b93fcf..7218651f01f 100644
--- a/engines/scumm/string_v7.cpp
+++ b/engines/scumm/string_v7.cpp
@@ -634,11 +634,11 @@ void ScummEngine_v7::CHARSET_1() {
StringTab saveStr = _string[0];
if (a && _string[0].overhead) {
int s;
- _string[0].xpos = a->getPos().x - _virtscr[kMainVirtScreen].xstart;
+ _string[0].xpos = a->getPos().x + (_screenWidth / 2) - camera._cur.x;
s = a->_scalex * a->_talkPosX / 255;
_string[0].xpos += (a->_talkPosX - s) / 2 + s;
- _string[0].ypos = a->getPos().y - a->getElevation() - _screenTop;
+ _string[0].ypos = a->getPos().y - a->getElevation() + (_screenHeight / 2) - camera._cur.y;
s = a->_scaley * a->_talkPosY / 255;
_string[0].ypos += (a->_talkPosY - s) / 2 + s;
More information about the Scummvm-git-logs
mailing list