aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2007-06-07 15:42:59 +0000
committerTravis Howell2007-06-07 15:42:59 +0000
commitbb476586b751a0f6546b1988e37005a7259a1253 (patch)
tree282f4b8813b0622d58f013c4b66f9730e736c8a2 /engines
parenta6db69102b34b3319c3815301e30ac8a282f31fc (diff)
downloadscummvm-rg350-bb476586b751a0f6546b1988e37005a7259a1253.tar.gz
scummvm-rg350-bb476586b751a0f6546b1988e37005a7259a1253.tar.bz2
scummvm-rg350-bb476586b751a0f6546b1988e37005a7259a1253.zip
Fix inventory arrows in Elvira 1.
svn-id: r27170
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h20
-rw-r--r--engines/agos/icons.cpp106
-rw-r--r--engines/agos/window.cpp83
3 files changed, 157 insertions, 52 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 5d4a300285..3f2fcd6c06 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -780,7 +780,8 @@ protected:
virtual void handleMouseMoved();
virtual void drawMousePointer();
- virtual void addArrows(WindowBlock *window);
+ void drawArrow(uint16 x, uint16 y, int8 dir);
+ virtual void addArrows(WindowBlock *window, uint8 num);
void removeArrows(WindowBlock *window, uint num);
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
@@ -1118,9 +1119,10 @@ protected:
void sendWindow(uint a);
- void restoreWindow(WindowBlock *window);
- void colorWindow(WindowBlock *window);
+ virtual void colorWindow(WindowBlock *window);
+ void colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
+ void restoreWindow(WindowBlock *window);
void restoreBlock(uint h, uint w, uint y, uint x);
byte *getFrontBuf();
@@ -1366,7 +1368,7 @@ protected:
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
- virtual void addArrows(WindowBlock *window);
+ virtual void addArrows(WindowBlock *window, uint8 num);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void moveDirn(Item *i, uint x);
@@ -1422,7 +1424,7 @@ protected:
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
- virtual void addArrows(WindowBlock *window);
+ virtual void addArrows(WindowBlock *window, uint8 num);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual bool loadTablesIntoMem(uint subr_id);
@@ -1476,7 +1478,7 @@ protected:
virtual void handleMouseMoved();
- virtual void addArrows(WindowBlock *window);
+ virtual void addArrows(WindowBlock *window, uint8 num);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void playSpeech(uint speech_id, uint vga_sprite_id);
@@ -1524,7 +1526,7 @@ protected:
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
- virtual void addArrows(WindowBlock *window);
+ virtual void addArrows(WindowBlock *window, uint8 num);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void playSpeech(uint speech_id, uint vga_sprite_id);
@@ -1597,7 +1599,7 @@ protected:
void swapCharacterLogo();
virtual void timer_proc1();
- virtual void addArrows(WindowBlock *window);
+ virtual void addArrows(WindowBlock *window, uint8 num);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void resetVerbs();
@@ -1611,6 +1613,8 @@ protected:
virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
+ virtual void colorWindow(WindowBlock *window);
+
virtual void doOutput(const byte *src, uint len);
virtual void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 88b6f6c07b..64703c29a1 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -114,7 +114,7 @@ static void decompressIconPlanar(byte *dst, byte *src, uint width, uint height,
// Translate planar data to chunky (very slow method)
for (y = 0; y < height * 2; y++) {
- for (x = 0; x < 24; x++) {
+ for (x = 0; x < width; x++) {
byte pixel =
(srcPtr[((height * 0 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
| (srcPtr[((height * 2 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
@@ -404,7 +404,7 @@ l1:; itemRef = derefItem(itemRef->next);
}
/* Plot arrows and add their boxes */
- addArrows(window);
+ addArrows(window, num);
window->iconPtr->upArrow = _scrollUpHitArea;
window->iconPtr->downArrow = _scrollDownHitArea;
}
@@ -506,7 +506,7 @@ void AGOSEngine::drawIconArray(uint num, Item *itemRef, int line, int classMask)
if (showArrows != 0 || window->iconPtr->line != 0) {
/* Plot arrows and add their boxes */
- addArrows(window);
+ addArrows(window, num);
window->iconPtr->upArrow = _scrollUpHitArea;
window->iconPtr->downArrow = _scrollDownHitArea;
}
@@ -614,7 +614,7 @@ uint AGOSEngine::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y,
return ha - _hitAreas;
}
-void AGOSEngine_Feeble::addArrows(WindowBlock *window) {
+void AGOSEngine_Feeble::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -644,7 +644,7 @@ void AGOSEngine_Feeble::addArrows(WindowBlock *window) {
ha->verb = 1;
}
-void AGOSEngine_Simon2::addArrows(WindowBlock *window) {
+void AGOSEngine_Simon2::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -674,7 +674,7 @@ void AGOSEngine_Simon2::addArrows(WindowBlock *window) {
ha->verb = 1;
}
-void AGOSEngine_Simon1::addArrows(WindowBlock *window) {
+void AGOSEngine_Simon1::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -720,7 +720,7 @@ void AGOSEngine_Simon1::addArrows(WindowBlock *window) {
_lockWord &= ~0x8;
}
-void AGOSEngine_Waxworks::addArrows(WindowBlock *window) {
+void AGOSEngine_Waxworks::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -752,7 +752,7 @@ void AGOSEngine_Waxworks::addArrows(WindowBlock *window) {
setWindowImageEx(6, 103);
}
-void AGOSEngine_Elvira2::addArrows(WindowBlock *window) {
+void AGOSEngine_Elvira2::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -784,8 +784,17 @@ void AGOSEngine_Elvira2::addArrows(WindowBlock *window) {
setWindowImageEx(6, 106);
}
-void AGOSEngine::addArrows(WindowBlock *window) {
+void AGOSEngine::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
+ uint16 x, y;
+
+ x = 30;
+ y = 151;
+ if (num != 2) {
+ y = window->height * 4 + window->y - 19;
+ x = window->width + window->x;
+ }
+ drawArrow(x, y, 16);
ha = findEmptyHitArea();
_scrollUpHitArea = ha - _hitAreas;
@@ -800,6 +809,14 @@ void AGOSEngine::addArrows(WindowBlock *window) {
ha->window = window;
ha->verb = 1;
+ x = 30;
+ y = 170;
+ if (num != 2) {
+ y = window->height * 4;
+ x = window->width + window->x;
+ }
+ drawArrow(x, y, -16);
+
ha = findEmptyHitArea();
_scrollDownHitArea = ha - _hitAreas;
@@ -814,6 +831,69 @@ void AGOSEngine::addArrows(WindowBlock *window) {
ha->verb = 1;
}
+static const byte _arrowImage[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+ 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b,
+ 0x0a, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0a,
+ 0x0d, 0x0a, 0x0b, 0x0a, 0x00, 0x00, 0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 0x0e, 0x0c, 0x0b, 0x0b, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x0a, 0x0a,
+ 0x0e, 0x0a, 0x0a, 0x0e, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+};
+
+void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) {
+ const byte *src;
+ uint8 w, h;
+
+ if (dir < 0) {
+ src = _arrowImage + 288;
+ } else {
+ src = _arrowImage;
+ }
+
+ byte *dst = getFrontBuf() + y * _screenWidth + x * 8;
+
+ for (h = 0; h < 19; h++) {
+ for (w = 0; w < 16; w++) {
+ dst[w] = src[w] + 16;
+ }
+
+ src += dir;
+ dst+= _screenWidth;
+ }
+}
+
void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
if (getGameType() == GType_SIMON1) {
restoreBlock(200, 320, 146, 304);
@@ -823,6 +903,14 @@ void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
} else if (getGameType() == GType_ELVIRA2) {
setBitFlag(21, false);
setWindowImageEx(6, 106);
+ } else if (getGameType() == GType_ELVIRA1) {
+ if (num != 2) {
+ uint y = window->height * 4 + window->y - 19;
+ uint x = window->width + window->x;
+ restoreBlock(y + 38, x + 16, y, x);
+ } else {
+ colorBlock(window, 240, 151, 16, 38);
+ }
}
}
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index 2af0fd43f2..2587002803 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -108,54 +108,67 @@ void AGOSEngine::clearWindow(WindowBlock *window) {
window->scrollY = 0;
}
-void AGOSEngine::colorWindow(WindowBlock *window) {
+void AGOSEngine_Feeble::colorWindow(WindowBlock *window) {
byte *dst;
- int16 h, w;
+ uint16 h, w;
_lockWord |= 0x8000;
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x;
+ dst = getFrontBuf() + _dxSurfacePitch * window->y + window->x;
- for (h = 0; h < window->height; h++) {
- for (w = 0; w < window->width; w++) {
- if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
- dst[w] = window->fill_color;
- }
- dst += _screenWidth;
+ for (h = 0; h < window->height; h++) {
+ for (w = 0; w < window->width; w++) {
+ if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
+ dst[w] = window->fill_color;
}
- } else {
- dst = getFrontBuf() + _dxSurfacePitch * (window->y) + window->x * 8;
- h = window->height * 8;
- w = window->width * 8;
-
- if (getGameType() == GType_ELVIRA2 && window->y == 146) {
- if (window->fill_color == 1) {
- _displayPalette[33 * 4 + 0] = 48 * 4;
- _displayPalette[33 * 4 + 1] = 40 * 4;
- _displayPalette[33 * 4 + 2] = 32 * 4;
- } else {
- _displayPalette[33 * 4 + 0] = 56 * 4;
- _displayPalette[33 * 4 + 1] = 56 * 4;
- _displayPalette[33 * 4 + 2] = 40 * 4;
- }
+ dst += _screenWidth;
+ }
- dst -= _dxSurfacePitch;
- h += 2;
+ _lockWord &= ~0x8000;
+}
- _paletteFlag = 1;
+void AGOSEngine::colorWindow(WindowBlock *window) {
+ uint16 x, y, h, w;
+
+ x = window->x * 8;
+ y = window->y;
+ h = window->height * 8;
+ w = window->width * 8;
+
+ if (getGameType() == GType_ELVIRA2 && window->y == 146) {
+ if (window->fill_color == 1) {
+ _displayPalette[33 * 4 + 0] = 48 * 4;
+ _displayPalette[33 * 4 + 1] = 40 * 4;
+ _displayPalette[33 * 4 + 2] = 32 * 4;
+ } else {
+ _displayPalette[33 * 4 + 0] = 56 * 4;
+ _displayPalette[33 * 4 + 1] = 56 * 4;
+ _displayPalette[33 * 4 + 2] = 40 * 4;
}
- uint8 color = window->fill_color;
- if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
- color += dst[0] & 0xF0;
+ y--;
+ h += 2;
- do {
- memset(dst, color, w);
- dst += _dxSurfacePitch;
- } while (--h);
+ _paletteFlag = 1;
}
+ colorBlock(window, x, y, w, h);
+}
+
+void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h) {
+ _lockWord |= 0x8000;
+
+ byte *dst = getFrontBuf() + y * _screenWidth + x;
+
+ uint8 color = window->fill_color;
+ if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
+ color += dst[0] & 0xF0;
+
+ do {
+ memset(dst, color, w);
+ dst += _screenWidth;
+ } while (--h);
+
_lockWord &= ~0x8000;
}