[Scummvm-cvs-logs] SF.net SVN: scummvm: [30732] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sat Feb 2 11:18:31 CET 2008
Revision: 30732
http://scummvm.svn.sourceforge.net/scummvm/?rev=30732&view=rev
Author: peres001
Date: 2008-02-02 02:18:31 -0800 (Sat, 02 Feb 2008)
Log Message:
-----------
Allowed BackgroundInfo to display bitmaps smaller than the screen and other small tweaks to re-enable splash screens in BRA.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2008-02-02 09:48:07 UTC (rev 30731)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2008-02-02 10:18:31 UTC (rev 30732)
@@ -344,10 +344,20 @@
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 @@
//
// 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 @@
_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 @@
strcpy(token, "> .......");
strncpy(token+2, _password, strlen(_password));
tokenWidth = _font->getStringWidth(token);
-
- rv = true;
} else {
tokenWidth = _font->getStringWidth(token);
@@ -983,8 +987,6 @@
text = Common::ltrim(text);
}
- return rv;
-
}
void Gfx::freeBackground() {
@@ -993,6 +995,8 @@
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);
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2008-02-02 09:48:07 UTC (rev 30731)
+++ scummvm/trunk/engines/parallaction/graphics.h 2008-02-02 10:18:31 UTC (rev 30732)
@@ -328,9 +328,15 @@
#define LAYER_FOREGROUND 3
+/*
+ BackgroundInfo keeps information about the background bitmap that can be seen in the game.
+ These bitmaps can be of any size, smaller or larger than the visible screen, the latter
+ being the most common options.
+*/
struct BackgroundInfo {
- uint width;
- uint height;
+ int x, y; // used to display bitmaps smaller than the screen
+ int width;
+ int height;
Graphics::Surface bg;
MaskBuffer mask;
@@ -341,7 +347,7 @@
int layers[4];
PaletteFxRange ranges[6];
- BackgroundInfo() : width(0), height(0) {
+ BackgroundInfo() : x(0), y(0), width(0), height(0) {
layers[0] = layers[1] = layers[2] = layers[3] = 0;
memset(ranges, 0, sizeof(ranges));
}
@@ -362,6 +368,10 @@
bg.free();
mask.free();
path.free();
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
}
};
@@ -412,7 +422,6 @@
// background surface
BackgroundInfo _backgroundInfo;
void setBackground(uint type, const char* name, const char* mask, const char* path);
- void clearBackground();
void patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask = false);
void grabBackground(const Common::Rect& r, Graphics::Surface &dst);
void fillBackground(const Common::Rect& r, byte color);
@@ -432,6 +441,8 @@
Gfx(Parallaction* vm);
virtual ~Gfx();
+
+ void clearScreen();
void updateScreen();
public:
@@ -493,7 +504,7 @@
// low level text and patches
void setFont(Font* font);
void drawText(Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color);
- bool drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
+ void drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
};
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-02-02 09:48:07 UTC (rev 30731)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-02-02 10:18:31 UTC (rev 30732)
@@ -144,27 +144,23 @@
}
void Parallaction_br::splash(const char *name) {
-#if 0
- BackgroundInfo info;
- _gfx->clearScreen(Gfx::kBitFront);
-
- _disk->loadSlide(info, name);
- _gfx->setPalette(info.palette);
- _gfx->flatBlitCnv(&info.bg, (640 - info.width) >> 1, (400 - info.height) >> 1, Gfx::kBitFront);
+ _gfx->clearScreen();
+ _gfx->setBackground(kBackgroundSlide, name, 0, 0);
+ _gfx->_backgroundInfo.x = (_screenWidth - _gfx->_backgroundInfo.width) >> 1;
+ _gfx->_backgroundInfo.y = (_screenHeight - _gfx->_backgroundInfo.height) >> 1;
_gfx->updateScreen();
_system->delayMillis(600);
- Palette pal;
+ Palette blackPal;
+ Palette pal(_gfx->_backgroundInfo.palette);
for (uint i = 0; i < 64; i++) {
- info.palette.fadeTo(pal, 1);
- _gfx->setPalette(info.palette);
+ pal.fadeTo(blackPal, 1);
+ _gfx->setPalette(pal);
_gfx->updateScreen();
_system->delayMillis(20);
}
- info.bg.free();
-#endif
- return;
+
}
#define MENUITEMS_X 250
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-02-02 09:48:07 UTC (rev 30731)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-02-02 10:18:31 UTC (rev 30732)
@@ -248,7 +248,7 @@
uint16 v2 = 0;
if (!scumm_stricmp(background, "final")) {
- _gfx->clearBackground();
+ _gfx->clearScreen();
for (uint16 _si = 0; _si < 32; _si++) {
pal.setEntry(_si, v2, v2, v2);
v2 += 4;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list