[Scummvm-cvs-logs] SF.net SVN: scummvm: [27171] scummvm/branches/branch-0-10-0/engines/agos
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Thu Jun 7 17:44:12 CEST 2007
Revision: 27171
http://scummvm.svn.sourceforge.net/scummvm/?rev=27171&view=rev
Author: Kirben
Date: 2007-06-07 08:44:11 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
Fix inventory arrows in Elvira 1.
Modified Paths:
--------------
scummvm/branches/branch-0-10-0/engines/agos/agos.h
scummvm/branches/branch-0-10-0/engines/agos/icons.cpp
scummvm/branches/branch-0-10-0/engines/agos/window.cpp
Modified: scummvm/branches/branch-0-10-0/engines/agos/agos.h
===================================================================
--- scummvm/branches/branch-0-10-0/engines/agos/agos.h 2007-06-07 15:42:59 UTC (rev 27170)
+++ scummvm/branches/branch-0-10-0/engines/agos/agos.h 2007-06-07 15:44:11 UTC (rev 27171)
@@ -780,7 +780,8 @@
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 @@
void sendWindow(uint a);
+ virtual void colorWindow(WindowBlock *window);
+ void colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, uint16 h);
+
void restoreWindow(WindowBlock *window);
- void colorWindow(WindowBlock *window);
-
void restoreBlock(uint h, uint w, uint y, uint x);
byte *getFrontBuf();
@@ -1366,7 +1368,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
Modified: scummvm/branches/branch-0-10-0/engines/agos/icons.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/agos/icons.cpp 2007-06-07 15:42:59 UTC (rev 27170)
+++ scummvm/branches/branch-0-10-0/engines/agos/icons.cpp 2007-06-07 15:44:11 UTC (rev 27171)
@@ -114,7 +114,7 @@
// 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 @@
}
/* Plot arrows and add their boxes */
- addArrows(window);
+ addArrows(window, num);
window->iconPtr->upArrow = _scrollUpHitArea;
window->iconPtr->downArrow = _scrollDownHitArea;
}
@@ -506,7 +506,7 @@
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 @@
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 @@
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 @@
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 @@
_lockWord &= ~0x8;
}
-void AGOSEngine_Waxworks::addArrows(WindowBlock *window) {
+void AGOSEngine_Waxworks::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -752,7 +752,7 @@
setWindowImageEx(6, 103);
}
-void AGOSEngine_Elvira2::addArrows(WindowBlock *window) {
+void AGOSEngine_Elvira2::addArrows(WindowBlock *window, uint8 num) {
HitArea *ha;
ha = findEmptyHitArea();
@@ -784,9 +784,18 @@
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 @@
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 @@
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, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0a, 0x0d,
+ 0x03, 0x0d, 0x0a, 0x0b, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0a, 0x0d, 0x03,
+ 0x04, 0x03, 0x0d, 0x0a, 0x0b, 0x0a, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0x0b, 0x0a, 0x0d, 0x03, 0x04,
+ 0x0f, 0x04, 0x03, 0x0d, 0x0a, 0x0b, 0x0a, 0x00,
+ 0x00, 0x0a, 0x0b, 0x0a, 0x0d, 0x0d, 0x0d, 0x03,
+ 0x04, 0x03, 0x0d, 0x0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00,
+ 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 @@
} 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);
+ }
}
}
Modified: scummvm/branches/branch-0-10-0/engines/agos/window.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/agos/window.cpp 2007-06-07 15:42:59 UTC (rev 27170)
+++ scummvm/branches/branch-0-10-0/engines/agos/window.cpp 2007-06-07 15:44:11 UTC (rev 27171)
@@ -108,54 +108,67 @@
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;
+ dst += _screenWidth;
+ }
- 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;
- }
+ _lockWord &= ~0x8000;
+}
- dst -= _dxSurfacePitch;
- h += 2;
+void AGOSEngine::colorWindow(WindowBlock *window) {
+ uint16 x, y, h, w;
- _paletteFlag = 1;
+ 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;
}
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