aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/graphics.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-02-02 10:18:31 +0000
committerNicola Mettifogo2008-02-02 10:18:31 +0000
commit5306701eab63b4b308225951d8f286ecf93ab1c0 (patch)
tree17c46015c9581fbd93d1c6cd075a2da4469d315c /engines/parallaction/graphics.cpp
parent015ad5e4696243a96be383fce5c04350a71cb91f (diff)
downloadscummvm-rg350-5306701eab63b4b308225951d8f286ecf93ab1c0.tar.gz
scummvm-rg350-5306701eab63b4b308225951d8f286ecf93ab1c0.tar.bz2
scummvm-rg350-5306701eab63b4b308225951d8f286ecf93ab1c0.zip
Allowed BackgroundInfo to display bitmaps smaller than the screen and other small tweaks to re-enable splash screens in BRA.
svn-id: r30732
Diffstat (limited to 'engines/parallaction/graphics.cpp')
-rw-r--r--engines/parallaction/graphics.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 7b000c911f..8c00c165ef 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -344,10 +344,20 @@ void Gfx::drawBalloons() {
g_system->unlockScreen();
}
+void Gfx::clearScreen() {
+ g_system->clearScreen();
+}
+
void Gfx::updateScreen() {
- g_system->copyRectToScreen((const byte*)_backgroundInfo.bg.pixels, _backgroundInfo.bg.pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight);
+ // background may not cover the whole screen, so adjust bulk update size
+ uint w = MIN(_vm->_screenWidth, _backgroundInfo.width);
+ uint h = MIN(_vm->_screenHeight, _backgroundInfo.height);
+ // TODO: add displacement to source to handle scrolling in BRA
+ g_system->copyRectToScreen((const byte*)_backgroundInfo.bg.pixels, _backgroundInfo.bg.pitch, _backgroundInfo.x, _backgroundInfo.y, w, h);
+
+ // TODO: transform objects coordinates to be drawn with scrolling
Graphics::Surface *surf = g_system->lockScreen();
drawGfxObjects(*surf);
@@ -382,9 +392,6 @@ void Gfx::updateScreen() {
//
// graphic primitives
//
-void Gfx::clearBackground() {
- memset(_backgroundInfo.bg.pixels, 0, _vm->_screenSize);
-}
void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
@@ -925,10 +932,9 @@ void Gfx::drawText(Graphics::Surface* surf, uint16 x, uint16 y, const char *text
_font->drawString(dst, surf->w, text);
}
-bool Gfx::drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth) {
+void Gfx::drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth) {
uint16 lines = 0;
- bool rv = false;
uint16 linewidth = 0;
uint16 rx = 10;
@@ -954,8 +960,6 @@ bool Gfx::drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16
strcpy(token, "> .......");
strncpy(token+2, _password, strlen(_password));
tokenWidth = _font->getStringWidth(token);
-
- rv = true;
} else {
tokenWidth = _font->getStringWidth(token);
@@ -983,8 +987,6 @@ bool Gfx::drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16
text = Common::ltrim(text);
}
- return rv;
-
}
void Gfx::freeBackground() {
@@ -993,6 +995,8 @@ void Gfx::freeBackground() {
void Gfx::setBackground(uint type, const char* name, const char* mask, const char* path) {
+ freeBackground();
+
if (type == kBackgroundLocation) {
_disk->loadScenery(_backgroundInfo, name, mask, path);
setPalette(_backgroundInfo.palette);