aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2007-09-02 13:23:07 +0000
committerFilippos Karapetis2007-09-02 13:23:07 +0000
commitb4d77e60cfc4c8b0f49b4b06a79e85e64af10602 (patch)
tree089d66d24e58ca0f1138dc5478915e342939a362 /engines/agi
parent762aaca73bfb1d3119b6708f65340f8e644a70bc (diff)
downloadscummvm-rg350-b4d77e60cfc4c8b0f49b4b06a79e85e64af10602.tar.gz
scummvm-rg350-b4d77e60cfc4c8b0f49b4b06a79e85e64af10602.tar.bz2
scummvm-rg350-b4d77e60cfc4c8b0f49b4b06a79e85e64af10602.zip
The dimensions of the picture resources in preagi games is different for each game. Mickey's pictures are shown correctly now
svn-id: r28819
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/picture.cpp22
-rw-r--r--engines/agi/picture.h7
-rw-r--r--engines/agi/preagi_mickey.cpp2
3 files changed, 17 insertions, 14 deletions
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 9945b4f9c6..82a4d6f95a 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -84,7 +84,7 @@ static uint8 splatterStart[128] = { /* starting bit position */
void PictureMgr::putVirtPixel(int x, int y) {
uint8 *p;
- if (x < 0 || y < 0 || x >= width || y >= _HEIGHT)
+ if (x < 0 || y < 0 || x >= width || y >= height)
return;
p = &_vm->_game.sbuf16c[y * width + x];
@@ -133,8 +133,8 @@ void PictureMgr::drawLine(int x1, int y1, int x2, int y2) {
#define clip(x, y) if((x)>=(y)) (x)=(y)
clip(x1, width - 1);
clip(x2, width - 1);
- clip(y1, _HEIGHT - 1);
- clip(y2, _HEIGHT - 1);
+ clip(y1, height - 1);
+ clip(y2, height - 1);
/* Vertical line */
@@ -276,7 +276,7 @@ void PictureMgr::absoluteDrawLine() {
INLINE int PictureMgr::isOkFillHere(int x, int y) {
uint8 p;
- if (x < 0 || x >= width || y < 0 || y >= _HEIGHT)
+ if (x < 0 || x >= width || y < 0 || y >= height)
return false;
if (!scrOn && !priOn)
@@ -714,7 +714,7 @@ uint8 *PictureMgr::convertV3Pic(uint8 *src, uint32 len) {
* @param clear clear AGI screen before drawing
* @param agi256 load an AGI256 picture resource
*/
-int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width) {
+int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width, int pic_height) {
debugC(8, kDebugLevelResources, "(%d)", n);
patCode = 0;
@@ -728,21 +728,22 @@ int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width) {
foffs = 0;
width = pic_width;
+ height = pic_height;
if (clear && !agi256) // 256 color pictures should always fill the whole screen, so no clearing for them.
- memset(_vm->_game.sbuf16c, 0x4f, width * _HEIGHT); // Clear 16 color AGI screen (Priority 4, color white).
+ memset(_vm->_game.sbuf16c, 0x4f, width * height); // Clear 16 color AGI screen (Priority 4, color white).
if (!agi256) {
drawPicture(); // Draw 16 color picture.
} else {
- const uint32 maxFlen = width * _HEIGHT;
+ const uint32 maxFlen = width * height;
memcpy(_vm->_game.sbuf256c, data, MIN(flen, maxFlen)); // Draw 256 color picture.
if (flen < maxFlen) {
warning("Undersized AGI256 picture resource %d, using it anyway. Filling rest with white.", n);
memset(_vm->_game.sbuf256c + flen, 0x0f, maxFlen - flen); // Fill missing area with white.
} else if (flen > maxFlen)
- warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, width, _HEIGHT);
+ warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, width, height);
}
if (clear)
@@ -772,16 +773,17 @@ int PictureMgr::unloadPicture(int n) {
* Show AGI picture.
* This function copies a ``hidden'' AGI picture to the output device.
*/
-void PictureMgr::showPic(int x, int pic_width) {
+void PictureMgr::showPic(int x, int pic_width, int pic_height) {
int i, y;
int offset;
width = pic_width;
+ height = pic_height;
debugC(8, kDebugLevelMain, "Show picture!");
i = 0;
offset = _vm->_game.lineMinPrint * CHAR_LINES;
- for (y = 0; y < _HEIGHT; y++) {
+ for (y = 0; y < height; y++) {
_gfx->putPixelsA(x, y + offset, width, &_vm->_game.sbuf16c[i]);
i += width;
}
diff --git a/engines/agi/picture.h b/engines/agi/picture.h
index 2691be91de..799037e3cd 100644
--- a/engines/agi/picture.h
+++ b/engines/agi/picture.h
@@ -31,6 +31,7 @@
namespace Agi {
#define _DEFAULT_WIDTH 160
+#define _DEFAULT_HEIGHT 168
/**
* AGI picture resource.
@@ -74,7 +75,7 @@ private:
// TODO: this is hardcoded for V2 pictures for now
static const int pictureType = AGIPIC_V2;
- int width;
+ int width, height;
public:
PictureMgr(AgiBase *agi, GfxMgr *gfx) {
@@ -82,9 +83,9 @@ public:
_gfx = gfx;
}
- int decodePicture(int n, int clear, bool agi256 = false, int pic_width = _DEFAULT_WIDTH);
+ int decodePicture(int n, int clear, bool agi256 = false, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT);
int unloadPicture(int);
- void showPic(int x = 0, int pic_width = _DEFAULT_WIDTH);
+ void showPic(int x = 0, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT);
uint8 *convertV3Pic(uint8 *src, uint32 len);
};
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 9aca5b33d2..d34a0908d8 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -620,7 +620,7 @@ void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) {
void Mickey::drawPic(int iPic) {
_vm->preAgiLoadResource(rPICTURE, iPic);
- _vm->_picture->decodePicture(iPic, true, false, _WIDTH - 20);
+ _vm->_picture->decodePicture(iPic, true, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
_vm->_picture->showPic(10, _WIDTH - 20);
_vm->_gfx->doUpdate();
_vm->_system->updateScreen(); // TODO: this should go in the game's main loop