aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorFilippos Karapetis2015-10-22 02:14:41 +0300
committerFilippos Karapetis2015-10-22 02:14:41 +0300
commit9bfa51ef300cf95872ca2325b7bd0d64f85372e6 (patch)
tree4a492273ace032bb94743af615e961b81eb12bf0 /engines/mads
parent80dae7b8fcd3e20a0f18d9287a9fc44793f6c38a (diff)
downloadscummvm-rg350-9bfa51ef300cf95872ca2325b7bd0d64f85372e6.tar.gz
scummvm-rg350-9bfa51ef300cf95872ca2325b7bd0d64f85372e6.tar.bz2
scummvm-rg350-9bfa51ef300cf95872ca2325b7bd0d64f85372e6.zip
MADS: Phantom: Expand the existing camera adjustment logic for V2 games
This fixes all of the scenes that expand over the screen (e.g. 101, 104, 109 in Phantom, as well as the several scenes in the Dragonsphere intro). Also added a new debugger command, "set_camera", which sets the scene camera to specific coordinates
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/debugger.cpp14
-rw-r--r--engines/mads/debugger.h1
-rw-r--r--engines/mads/phantom/phantom_scenes1.cpp3
-rw-r--r--engines/mads/scene.cpp3
-rw-r--r--engines/mads/scene_data.cpp12
5 files changed, 30 insertions, 3 deletions
diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp
index a6a4d3edbc..740c19abad 100644
--- a/engines/mads/debugger.cpp
+++ b/engines/mads/debugger.cpp
@@ -49,6 +49,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("item", WRAP_METHOD(Debugger, Cmd_Item));
registerCmd("play_anim", WRAP_METHOD(Debugger, Cmd_PlayAnim));
registerCmd("play_text", WRAP_METHOD(Debugger, Cmd_PlayText));
+ registerCmd("set_camera", WRAP_METHOD(Debugger, Cmd_SetCamera));
}
static int strToInt(const char *s) {
@@ -391,4 +392,17 @@ bool Debugger::Cmd_PlayText(int argc, const char **argv) {
}
}
+bool Debugger::Cmd_SetCamera(int argc, const char **argv) {
+ if (argc != 3) {
+ debugPrintf("Usage: %s <x> <y>\n", argv[0]);
+ return true;
+ } else {
+ int x = strToInt(argv[1]);
+ int y = strToInt(argv[2]);
+ _vm->_game->_scene.setCamera(Common::Point(x, y));
+ _vm->_game->_scene.resetScene();
+ _vm->_game->_scene.drawElements(kTransitionNone, false);
+ return false;
+ }
+}
} // End of namespace MADS
diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h
index 70b2cadc65..f6b58ac0de 100644
--- a/engines/mads/debugger.h
+++ b/engines/mads/debugger.h
@@ -51,6 +51,7 @@ protected:
bool Cmd_Item(int argc, const char **argv);
bool Cmd_PlayAnim(int argc, const char **argv);
bool Cmd_PlayText(int argc, const char **argv);
+ bool Cmd_SetCamera(int argc, const char **argv);
public:
bool _showMousePos;
public:
diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp
index 5b8abbd4fa..0b6f4af753 100644
--- a/engines/mads/phantom/phantom_scenes1.cpp
+++ b/engines/mads/phantom/phantom_scenes1.cpp
@@ -254,8 +254,7 @@ void Scene101::step() {
}
}
- if (!_startSittingFl && (_globals[kBrieTalkStatus] != 2)) {
- warning("TODO: Add a check on view port x > 200");
+ if (_scene->_posAdjust.x > 200 && !_startSittingFl && (_globals[kBrieTalkStatus] != 2)) {
_startSittingFl = true;
_game._player.walk(Common::Point(490, 119), FACING_NORTHEAST);
_game._player._stepEnabled = false;
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index daa50aacbc..9fe601ecb3 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -153,6 +153,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
_sequences.clear();
_kernelMessages.clear();
_vm->_palette->_paletteUsage.load(&_scenePaletteUsage);
+ setCamera(Common::Point(0, 0));
int flags = SCENEFLAG_LOAD_SHADOW;
if (_vm->_dithering)
@@ -787,7 +788,7 @@ void Scene::setDynamicAnim(int id, int anim_id, int segment) {
}
void Scene::setCamera(Common::Point pos) {
- warning("TODO: Scene::setCamera");
+ _posAdjust = pos;
}
void Scene::drawToBackground(int series_id, int sprite_id, Common::Point pos, int depth, int scale) {
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index e48bcd8c6f..d4610c53d4 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -422,6 +422,18 @@ void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName,
assert(screenWidth == _width);
assert(screenHeight <= _height);
+ // Resize the background surface to hold all of the tiles
+ uint16 newWidth = bgSurface.w;
+ uint16 newHeight = bgSurface.h;
+
+ if (tileWidth < screenWidth && bgSurface.w != tileCount * tileWidth)
+ newWidth = tileCount * tileWidth;
+ if (tileHeight < screenHeight && bgSurface.h != tileCount * tileHeight)
+ newHeight = tileCount * tileHeight;
+
+ if (bgSurface.w != newWidth || bgSurface.h != newHeight)
+ bgSurface.setSize(newWidth, newHeight);
+
// --------------------------------------------------------------------------------
// Get tile data