aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/draw.cpp
diff options
context:
space:
mode:
authorTravis Howell2007-06-21 05:10:42 +0000
committerTravis Howell2007-06-21 05:10:42 +0000
commit64cafa0270e0e912c3efe04b660e264833a3e7f8 (patch)
tree787c5e7be5fc441095d7487bcbdd254b4e78ad89 /engines/agos/draw.cpp
parent89b2cf75e22fd76b48e9e27d70ba617d5b2468b6 (diff)
downloadscummvm-rg350-64cafa0270e0e912c3efe04b660e264833a3e7f8.tar.gz
scummvm-rg350-64cafa0270e0e912c3efe04b660e264833a3e7f8.tar.bz2
scummvm-rg350-64cafa0270e0e912c3efe04b660e264833a3e7f8.zip
Fix regressions, due to buffer changes and cleanup.
svn-id: r27578
Diffstat (limited to 'engines/agos/draw.cpp')
-rw-r--r--engines/agos/draw.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index af6597ca69..c11d864648 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -656,7 +656,7 @@ void AGOSEngine::scrollScreen() {
_scrollY += _scrollFlag;
vcWriteVar(250, _scrollY);
- memcpy(_backBuf, _backGroundBuf, _screenHeight * _scrollWidth);
+ fillBackFromBackGround(_screenHeight, _scrollWidth);
} else {
if (_scrollFlag < 0) {
memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
@@ -684,7 +684,7 @@ void AGOSEngine::scrollScreen() {
if (getGameType() == GType_SIMON2) {
memcpy(_window4BackScn, _backGroundBuf, _scrollHeight * _screenWidth);
} else {
- memcpy(_backBuf, _backGroundBuf, _scrollHeight * _screenWidth);
+ fillBackFromBackGround(_scrollHeight, _screenWidth);
}
setMoveRect(0, 0, 320, _scrollHeight);
@@ -709,17 +709,32 @@ void AGOSEngine::scrollScreen() {
}
}
-void AGOSEngine::clearSurfaces(uint num_lines) {
- Graphics::Surface *screen = _system->lockScreen();
+void AGOSEngine::clearSurfaces() {
+ _system->clearScreen();
- memset((byte *)screen->pixels, 0, num_lines * _screenWidth);
- memset(_backBuf, 0, num_lines * _screenWidth);
+ if (_backBuf) {
+ memset(_backBuf, 0, _screenHeight * _screenWidth);
+ }
+}
+
+void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) {
+ memcpy(_backBuf, _backGroundBuf, height * width);
+}
+void AGOSEngine::fillBackFromFront() {
+ Graphics::Surface *screen = _system->lockScreen();
+ memcpy(_backBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
_system->unlockScreen();
}
-void AGOSEngine::fillBackGroundFromBack(uint lines) {
- memcpy(_backGroundBuf, _backBuf, lines * _screenWidth);
+void AGOSEngine::fillBackGroundFromBack() {
+ memcpy(_backGroundBuf, _backBuf, _screenHeight * _screenWidth);
+}
+
+void AGOSEngine::fillBackGroundFromFront() {
+ Graphics::Surface *screen = _system->lockScreen();
+ memcpy(_backGroundBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
+ _system->unlockScreen();
}
void AGOSEngine::setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height) {
@@ -750,7 +765,7 @@ void AGOSEngine::displayScreen() {
memcpy((byte *)screen->pixels, getBackBuf(), _screenWidth * _screenHeight);
if (getGameId() != GID_DIMP)
- memcpy(getBackBuf(), getBackGround(), _screenWidth * _screenHeight);
+ fillBackFromBackGround(_screenHeight, _screenWidth);
} else {
if (_window4Flag == 2) {
_window4Flag = 0;