aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/dialogs.cpp2
-rw-r--r--engines/mads/game.cpp2
-rw-r--r--engines/mads/game_data.cpp2
-rw-r--r--engines/mads/mads.cpp2
-rw-r--r--engines/mads/mads.h2
-rw-r--r--engines/mads/messages.cpp2
-rw-r--r--engines/mads/module.mk2
-rw-r--r--engines/mads/msurface.cpp2
-rw-r--r--engines/mads/nebular/dialogs_nebular.cpp2
-rw-r--r--engines/mads/nebular/game_nebular.cpp2
-rw-r--r--engines/mads/scene.cpp4
-rw-r--r--engines/mads/scene.h2
-rw-r--r--engines/mads/scene_data.cpp20
-rw-r--r--engines/mads/scene_data.h16
-rw-r--r--engines/mads/screen.cpp (renamed from engines/mads/graphics.cpp)23
-rw-r--r--engines/mads/screen.h (renamed from engines/mads/graphics.h)25
-rw-r--r--engines/mads/sprites.cpp2
-rw-r--r--engines/mads/user_interface.cpp2
18 files changed, 84 insertions, 30 deletions
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp
index d159d48ace..571cca5d29 100644
--- a/engines/mads/dialogs.cpp
+++ b/engines/mads/dialogs.cpp
@@ -23,7 +23,7 @@
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "mads/mads.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/nebular/dialogs_nebular.h"
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 6a7f6fb18d..bcebc04a00 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -25,7 +25,7 @@
#include "mads/game.h"
#include "mads/game_data.h"
#include "mads/events.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/resources.h"
#include "mads/nebular/game_nebular.h"
diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp
index ba24ed9ca1..cbc8f93a4b 100644
--- a/engines/mads/game_data.cpp
+++ b/engines/mads/game_data.cpp
@@ -24,7 +24,7 @@
#include "mads/mads.h"
#include "mads/game.h"
#include "mads/nebular/game_nebular.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/resources.h"
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 6dfdf7b3b8..9cab1ad8f9 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -26,7 +26,7 @@
#include "common/events.h"
#include "engines/util.h"
#include "mads/mads.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/resources.h"
#include "mads/sound.h"
diff --git a/engines/mads/mads.h b/engines/mads/mads.h
index 2fbac32c4a..749c69a64c 100644
--- a/engines/mads/mads.h
+++ b/engines/mads/mads.h
@@ -35,7 +35,7 @@
#include "mads/events.h"
#include "mads/font.h"
#include "mads/game.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/resources.h"
#include "mads/sound.h"
diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index dcac541cf8..21463aa58a 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -23,7 +23,7 @@
#include "common/scummsys.h"
#include "mads/mads.h"
#include "mads/font.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/messages.h"
#include "mads/scene_data.h"
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 2f4982f9f8..a65519faea 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -18,7 +18,6 @@ MODULE_OBJS := \
font.o \
game.o \
game_data.o \
- graphics.o \
hotspots.o \
interface.o \
mads.o \
@@ -29,6 +28,7 @@ MODULE_OBJS := \
resources.o \
scene.o \
scene_data.o \
+ screen.o \
sequence.o \
sound.o \
sprites.o \
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index e8d391ff89..c8c66234cb 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -22,7 +22,7 @@
#include "engines/util.h"
#include "mads/compression.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/mads.h"
#include "mads/msurface.h"
#include "mads/resources.h"
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 6d2321eae2..dc74f39fe8 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -23,7 +23,7 @@
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "mads/mads.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/nebular/dialogs_nebular.h"
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 65abb40f1e..8948689622 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -24,7 +24,7 @@
#include "common/config-manager.h"
#include "mads/mads.h"
#include "mads/game.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/nebular/game_nebular.h"
#include "mads/nebular/dialogs_nebular.h"
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index ef5fd78f74..8bf0b6a527 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -438,7 +438,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) {
_dirtyAreas.merge(1, DIRTY_AREAS_SIZE);
// Copy dirty areas to the main display surface
- _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _posAdjust);
+ _dirtyAreas.copy(&_backgroundSurface, &_vm->_screen, _posAdjust);
// Handle dirty areas for foreground objects
_spriteSlots.setDirtyAreas();
@@ -463,7 +463,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) {
_vm->_sound->startQueuedCommands();
} else {
// Copy dirty areas to the screen
- _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _vm->_screen._offset);
+ _dirtyAreas.copyToScreen(_vm->_screen._offset);
}
warning("TODO: sub_115A2");
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index 79c5910d85..0b20fb077f 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -27,7 +27,7 @@
#include "common/array.h"
#include "common/rect.h"
#include "mads/assets.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/hotspots.h"
#include "mads/messages.h"
#include "mads/msurface.h"
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index 8f981ef37d..fe768934c3 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -24,7 +24,7 @@
#include "mads/scene_data.h"
#include "mads/mads.h"
#include "mads/compression.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/resources.h"
#include "mads/nebular/nebular_scenes.h"
@@ -276,7 +276,20 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) {
da1._textActive = true;
}
-void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust) {
+void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust) {
+ for (uint i = 0; i < size(); ++i) {
+ const Common::Rect &srcBounds = (*this)[i]._bounds;
+
+ Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y,
+ srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);
+
+ if ((*this)[i]._active && bounds.isValidRect()) {
+ srcSurface->copyTo(destSurface, bounds, Common::Point(bounds.left, bounds.top));
+ }
+ }
+}
+
+void DirtyAreas::copyToScreen(const Common::Point &posAdjust) {
for (uint i = 0; i < size(); ++i) {
const Common::Rect &srcBounds = (*this)[i]._bounds;
@@ -284,8 +297,7 @@ void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdj
srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);
if ((*this)[i]._active && (*this)[i]._bounds.isValidRect()) {
- src->copyTo(dest, bounds, Common::Point((*this)[i]._bounds.left,
- (*this)[i]._bounds.top));
+ _vm->_screen.copyRectToScreen(bounds);
}
}
}
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
index d0c61ae3f7..7a41bab1f8 100644
--- a/engines/mads/scene_data.h
+++ b/engines/mads/scene_data.h
@@ -151,7 +151,21 @@ public:
bool intersects(int idx1, int idx2);
void mergeAreas(int idx1, int idx2);
- void copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust);
+
+ /**
+ * Copy the data specified by the dirty rect list between surfaces
+ * @param srcSurface Source surface
+ * @param destSurface Dest surface
+ * @param posAdjust Position adjustment
+ */
+ void copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust);
+
+ /**
+ * Use the lsit of dirty areas to copy areas of the screen surface to
+ * the physical screen
+ * @param posAdjust Position adjustment */
+ void copyToScreen(const Common::Point &posAdjust);
+
void reset();
};
diff --git a/engines/mads/graphics.cpp b/engines/mads/screen.cpp
index 769b4dd2d2..20ff4f6df2 100644
--- a/engines/mads/graphics.cpp
+++ b/engines/mads/screen.cpp
@@ -23,17 +23,32 @@
#include "common/scummsys.h"
#include "mads/mads.h"
#include "mads/game.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/palette.h"
namespace MADS {
+ScreenSurface::ScreenSurface() {
+ _dataP = nullptr;
+}
+
void ScreenSurface::init() {
setSize(g_system->getWidth(), g_system->getHeight());
}
+void ScreenSurface::copyRectToScreen(const Common::Point &destPos,
+ const Common::Rect &bounds) {
+ byte *buf = getBasePtr(destPos.x, destPos.y);
+ g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top,
+ bounds.width(), bounds.height());
+}
+
+void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) {
+ copyRectToScreen(Common::Point(bounds.left, bounds.top), bounds);
+}
+
+
void ScreenSurface::updateScreen() {
- g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h);
g_system->updateScreen();
}
@@ -75,8 +90,7 @@ void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag
}
void ScreenSurface::setPointer(MSurface *s) {
- _pixels = s->getData();
- _pitch = s->w;
+ _dataP = s->getData();
}
void ScreenSurface::fadeOut() {
@@ -86,6 +100,7 @@ void ScreenSurface::fadeOut() {
void ScreenSurface::fadeIn() {
warning("TODO: Proper fade in");
_vm->_palette->setFullPalette(_vm->_palette->_mainPalette);
+ _vm->_screen.copyRectToScreen(Common::Rect(0, 0, 320, 200));
}
} // End of namespace MADS
diff --git a/engines/mads/graphics.h b/engines/mads/screen.h
index d4933ae68d..e101020fc8 100644
--- a/engines/mads/graphics.h
+++ b/engines/mads/screen.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef MADS_GRAPHICS_H
-#define MADS_GRAPHICS_H
+#ifndef MADS_SCREEN_H
+#define MADS_SCREEN_H
#include "common/scummsys.h"
#include "common/array.h"
@@ -58,13 +58,12 @@ private:
void fadeIn();
public:
Common::Point _offset;
- byte *_pixels;
- int _pitch;
+ byte *_dataP;
public:
/**
* Constructor
*/
- ScreenSurface() {}
+ ScreenSurface();
/**
* Initialise the surface
@@ -74,6 +73,20 @@ public:
void setPointer(MSurface *s);
/**
+ * Copys an area of the screen surface to a given destination position on
+ * the ScummVM physical screen buffer
+ * @param destPos Destination position
+ * @param bounds Area of screen surface to copy
+ */
+ void copyRectToScreen(const Common::Point &destPos, const Common::Rect &bounds);
+
+ /**
+ * Copys an area of the screen surface to the ScmmVM physical screen buffer
+ * @param bounds Area of screen surface to copy
+ */
+ void copyRectToScreen(const Common::Rect &bounds);
+
+ /**
* Updates the screen with the contents of the surface
*/
void updateScreen();
@@ -83,4 +96,4 @@ public:
} // End of namespace MADS
-#endif /* MADS_GRAPHICS_H */
+#endif /* MADS_SCREEN_H */
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index a7a46ce29f..6f227fa341 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -24,7 +24,7 @@
#include "engines/util.h"
#include "graphics/palette.h"
#include "mads/mads.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/sprites.h"
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 3bbf6a0b2b..ec5ca8a0b5 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "mads/mads.h"
-#include "mads/graphics.h"
+#include "mads/screen.h"
#include "mads/user_interface.h"
#include "mads/msurface.h"