aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-10-09 13:00:25 +0000
committerTravis Howell2006-10-09 13:00:25 +0000
commit82775ed89006f4913fe985c6b6069341ef11634e (patch)
tree22b97df7084aecafbf28df2ed5073de8c8558fcb /engines
parenta2fb2e47cbbdba4ed6b037f22032dd700cd9f947 (diff)
downloadscummvm-rg350-82775ed89006f4913fe985c6b6069341ef11634e.tar.gz
scummvm-rg350-82775ed89006f4913fe985c6b6069341ef11634e.tar.bz2
scummvm-rg350-82775ed89006f4913fe985c6b6069341ef11634e.zip
Use correct video window values for each game and minor cleanup
svn-id: r24253
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp24
-rw-r--r--engines/agos/agos.h3
-rw-r--r--engines/agos/icons.cpp2
-rw-r--r--engines/agos/res_ami.cpp12
-rw-r--r--engines/agos/vga.cpp146
5 files changed, 93 insertions, 94 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index a147c69a64..2f26acb01b 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -377,6 +377,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)
memset(_displayPalette, 0, sizeof(_displayPalette));
memset(_videoBuf1, 0, sizeof(_videoBuf1));
+ memset(_videoWindows, 0, sizeof(_videoWindows));
_dummyWindow = new WindowBlock;
_windowList = new WindowBlock[16];
@@ -558,6 +559,22 @@ int AGOSEngine::init() {
return 0;
}
+const static uint16 initialVideoWindows_Simon[24] = {
+ 0, 0, 20, 200,
+ 0, 0, 3, 136,
+ 17, 0, 3, 136,
+ 0, 0, 20, 200,
+ 0, 0, 20, 134
+};
+
+const static uint16 initialVideoWindows_Common[24] = {
+ 3, 0, 14, 136,
+ 0, 0, 3, 136,
+ 17, 0, 3, 136,
+ 0, 0, 20, 200,
+ 3, 3, 14, 127,
+};
+
void AGOSEngine::setupGame() {
if (getGameType() == GType_PP) {
gss = PTR(puzzlepack_settings);
@@ -695,6 +712,13 @@ void AGOSEngine::setupGame() {
_noOverWrite = 0xFFFF;
_stringIdLocalMin = 1;
+
+ for (int i = 0; i < 24; i++) {
+ if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
+ _videoWindows[i] = initialVideoWindows_Simon[i];
+ else
+ _videoWindows[i] = initialVideoWindows_Common[i];
+ }
}
AGOSEngine::~AGOSEngine() {
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 3519146224..a7288c2755 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -472,6 +472,7 @@ protected:
uint8 _displayPalette[1024];
byte _videoBuf1[3000];
+ uint16 _videoWindows[128];
VgaTimerEntry _vgaTimerList[205];
@@ -1241,7 +1242,7 @@ protected:
byte *getBackGround();
byte *getScaleBuf();
- void convertAmiga(byte *srcBuf, int32 flength);
+ void convertAmiga(byte *srcBuf, int32 fileSize);
void loadVGAFile(uint id, uint type);
void loadSimonVGAFile(uint id);
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 5bd5d3a968..f2471e26ff 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -178,7 +178,7 @@ void AGOSEngine::draw_icon_c(WindowBlock *window, uint icon, uint x, uint y) {
if (getPlatform() == Common::kPlatformAmiga) {
src = _iconFilePtr;
src += READ_BE_UINT32(&((uint32 *)src)[icon]);
- decompressIconAmiga (dst, src, 224, _dxSurfacePitch);
+ decompressIconAmiga (dst, src, 16, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index 2c32b64382..30a2e7b6c7 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.cpp
@@ -87,14 +87,14 @@ static void convertcompressedclip(uint16 height, uint16 width) {
uint16 length, i, j, k, word1, word2, word3, word4, cliplength;
byte outbyte, outbyte1, x, y;
char n;
- uncbuffer = (byte *)malloc(height * width * 2);
- uncbfrout = (byte *)malloc(height * width * 2);
+ uncbuffer = (byte *)malloc(height * width * 4);
+ uncbfrout = (byte *)malloc(height * width * 4);
length = width / 16;
length *= height;
- plane0 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane0 += 4;
- plane1 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane1 += 4;
- plane2 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane2 += 4;
- plane3 = READ_BE_UINT32(clipptr) + clipptr; clipptr += 4; plane3 += 4;
+ plane0 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane0 += 4;
+ plane1 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane1 += 4;
+ plane2 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane2 += 4;
+ plane3 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane3 += 4;
plane0 -= 4;
plane1 -= 8;
plane2 -= 12;
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index c833eb12c8..ed4a970d28 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -737,15 +737,15 @@ void vc10_skip_cols(VC10_state *vs) {
byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
w *= 8;
- byte *src_org, *dst_org;
+ byte *src_org, *dstPtr;
byte color;
int8 cur = -0x80;
uint i, w_cur = w;
- dst_org = _videoBuf1 + w;
+ dstPtr = _videoBuf1 + w;
do {
- byte *dst = dst_org;
+ byte *dst = dstPtr;
uint h_cur = h;
if (cur == -0x80)
@@ -781,14 +781,14 @@ byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
cur = *src++;
}
next_line:
- dst_org++;
+ dstPtr++;
} while (--w_cur);
- src_org = dst_org = _videoBuf1 + w;
+ src_org = dstPtr = _videoBuf1 + w;
do {
- byte *dst = dst_org;
+ byte *dst = dstPtr;
for (i = 0; i != w; ++i) {
byte b = src_org[i];
b = (b >> 4) | (b << 4);
@@ -796,66 +796,40 @@ byte *AGOSEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
}
src_org += w;
- dst_org += w;
+ dstPtr += w;
} while (--h);
return _videoBuf1;
}
byte *AGOSEngine::vc10_flip(const byte *src, uint w, uint h) {
- if (src == _vc10BasePtrOld)
- return _videoBuf1;
-
- _vc10BasePtrOld = src;
+ w *= 8;
- byte *dst_org, *src_org;
+ byte *dstPtr;
uint i;
- w *= 8;
- src_org = dst_org = _videoBuf1 + w;
+ dstPtr = _videoBuf1 + w;
do {
- byte *dst = dst_org;
+ byte *dst = dstPtr;
for (i = 0; i != w; ++i) {
- byte b = src_org[i];
+ byte b = src[i];
b = (b >> 4) | (b << 4);
*--dst = b;
}
- src_org += w;
- dst_org += w;
+ src += w;
+ dstPtr += w;
} while (--h);
return _videoBuf1;
}
-/* must not be const */
-// FIXME: In that case it is *wrong* to have it as a static
-// variable here! Rather, it should be turned into a member
-// of class AGOSEngine.
-static uint16 _video_windows[128] = {
- 0, 0, 20, 200,
- 0, 0, 3, 136,
- 17, 0, 3, 136,
- 0, 0, 20, 200,
- 0, 0, 20, 134
-};
-
-/* Elvira 1/2 & Waxworks
-static uint16 _video_windows[128] = {
- 3, 0, 14, 136,
- 0, 0, 3, 136,
- 17, 0, 3, 136,
- 0, 0, 20, 200,
- 3, 3, 14, 127,
-};
- */
-
void AGOSEngine::decodeColumn(byte *dst, const byte *src, int height) {
const uint pitch = _dxSurfacePitch;
int8 reps = (int8)0x80;
byte color;
- byte *dst_org = dst;
+ byte *dstPtr = dst;
uint h = height, w = 8;
for (;;) {
@@ -872,7 +846,7 @@ void AGOSEngine::decodeColumn(byte *dst, const byte *src, int height) {
/* reached right edge? */
if (--w == 0)
return;
- dst = ++dst_org;
+ dst = ++dstPtr;
h = height;
}
} while (--reps >= 0);
@@ -887,7 +861,7 @@ void AGOSEngine::decodeColumn(byte *dst, const byte *src, int height) {
/* reached right edge? */
if (--w == 0)
return;
- dst = ++dst_org;
+ dst = ++dstPtr;
h = height;
}
} while (++reps != 0);
@@ -899,7 +873,7 @@ void AGOSEngine::decodeRow(byte *dst, const byte *src, int width) {
const uint pitch = _dxSurfacePitch;
int8 reps = (int8)0x80;
byte color;
- byte *dst_org = dst;
+ byte *dstPtr = dst;
uint w = width, h = 8;
for (;;) {
@@ -915,8 +889,8 @@ void AGOSEngine::decodeRow(byte *dst, const byte *src, int width) {
/* reached bottom? */
if (--h == 0)
return;
- dst_org += pitch;
- dst = dst_org;
+ dstPtr += pitch;
+ dst = dstPtr;
w = width;
}
} while (--reps >= 0);
@@ -930,8 +904,8 @@ void AGOSEngine::decodeRow(byte *dst, const byte *src, int width) {
/* reached bottom? */
if (--h == 0)
return;
- dst_org += pitch;
- dst = dst_org;
+ dstPtr += pitch;
+ dst = dstPtr;
w = width;
}
} while (++reps != 0);
@@ -1056,7 +1030,7 @@ bool AGOSEngine::drawImages_clip(VC10_state *state) {
uint maxWidth, maxHeight;
int cur;
- vlut = &_video_windows[_windowNum * 4];
+ vlut = &_videoWindows[_windowNum * 4];
if (getGameType() != GType_FF && getGameType() != GType_PP) {
state->draw_width = state->width * 2;
@@ -1116,16 +1090,16 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
state->surf_pitch = _dxSurfacePitch;
uint w, h;
- byte *src, *dst, *dst_org;
+ byte *src, *dst, *dstPtr;
state->dl = state->width;
state->dh = state->height;
- dst_org = state->surf_addr;
+ dstPtr = state->surf_addr;
w = 0;
do {
src = vc10_depackColumn(state);
- dst = dst_org;
+ dst = dstPtr;
h = 0;
do {
@@ -1133,7 +1107,7 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
dst += _screenWidth;
src++;
} while (++h != state->draw_height);
- dst_org++;
+ dstPtr++;
} while (++w != state->draw_width);
if (_vgaCurSpritePriority % 10 != 9) {
@@ -1150,18 +1124,18 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
state->surf_addr += (state->x + _scrollX) + (state->y + _scrollY) * state->surf_pitch;
uint w, h;
- byte *src, *dst, *dst_org;
+ byte *src, *dst, *dstPtr;
state->dl = state->width;
state->dh = state->height;
- dst_org = state->surf_addr;
+ dstPtr = state->surf_addr;
w = 0;
do {
byte color;
src = vc10_depackColumn(state);
- dst = dst_org;
+ dst = dstPtr;
h = 0;
do {
@@ -1171,7 +1145,7 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
dst += _screenWidth;
src++;
} while (++h != state->draw_height);
- dst_org++;
+ dstPtr++;
} while (++w != state->draw_width);
if (_vgaCurSpritePriority % 10 == 9) {
@@ -1184,7 +1158,7 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
state->surf_addr += state->x + state->y * state->surf_pitch;
uint w, h;
- byte *src, *dst, *dst_org;
+ byte *src, *dst, *dstPtr;
state->dl = state->width;
state->dh = state->height;
@@ -1204,13 +1178,13 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
return;
}
- dst_org = state->surf_addr;
+ dstPtr = state->surf_addr;
w = 0;
do {
byte color;
src = vc10_depackColumn(state);
- dst = dst_org;
+ dst = dstPtr;
h = 0;
do {
@@ -1220,16 +1194,16 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
dst += _screenWidth;
src++;
} while (++h != state->draw_height);
- dst_org++;
+ dstPtr++;
} while (++w != state->draw_width);
} else {
- dst_org = state->surf_addr;
+ dstPtr = state->surf_addr;
w = 0;
do {
byte color;
src = vc10_depackColumn(state);
- dst = dst_org;
+ dst = dstPtr;
h = 0;
do {
@@ -1239,7 +1213,7 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
dst += _screenWidth;
src++;
} while (++h != state->draw_height);
- dst_org++;
+ dstPtr++;
} while (++w != state->draw_width);
}
}
@@ -1273,7 +1247,7 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
}
void AGOSEngine::drawImages(VC10_state *state) {
- const uint16 *vlut = &_video_windows[_windowNum * 4];
+ const uint16 *vlut = &_videoWindows[_windowNum * 4];
if (drawImages_clip(state) == 0)
return;
@@ -1281,24 +1255,24 @@ void AGOSEngine::drawImages(VC10_state *state) {
uint offs, offs2;
if (getGameType() == GType_ELVIRA1) {
//if (_windowNum != 2 && _windowNum != 3) {
- // offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- // offs2 = (vlut[1] - _video_windows[17] + state->y);
+ // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // offs2 = (vlut[1] - _videoWindows[17] + state->y);
//} else {
offs = (vlut[0] * 2 + state->x) * 8;
offs2 = vlut[1] + state->y;
//}
} else if (getGameType() == GType_ELVIRA2) {
//if (_windowNum == 4 || _windowNum >= 10) {
- // offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- // offs2 = (vlut[1] - _video_windows[17] + state->y);
+ // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // offs2 = (vlut[1] - _videoWindows[17] + state->y);
//} else {
offs = (vlut[0] * 2 + state->x) * 8;
offs2 = vlut[1] + state->y;
//}
} else if (getGameType() == GType_WW) {
//if (_windowNum == 4 || (_windowNum >= 10 && _windowsNum < 28)) {
- // offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- // offs2 = (vlut[1] - _video_windows[17] + state->y);
+ // offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // offs2 = (vlut[1] - _videoWindows[17] + state->y);
//} else {
offs = (vlut[0] * 2 + state->x) * 8;
offs2 = vlut[1] + state->y;
@@ -1310,12 +1284,12 @@ void AGOSEngine::drawImages(VC10_state *state) {
offs = state->x * 8;
offs2 = state->y;
} else {
- offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- offs2 = (vlut[1] - _video_windows[17] + state->y);
+ offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ offs2 = (vlut[1] - _videoWindows[17] + state->y);
}
} else {
- offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- offs2 = (vlut[1] - _video_windows[17] + state->y);
+ offs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ offs2 = (vlut[1] - _videoWindows[17] + state->y);
}
state->surf2_addr += offs + offs2 * state->surf2_pitch;
@@ -1377,7 +1351,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
uint h, i;
if (state->flags & kDFCompressed) {
- byte *dst_org = state->surf_addr;
+ byte *dstPtr = state->surf_addr;
src = state->depack_src;
/* AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE
* aaaaabbb bbcccccd ddddeeee efffffgg ggghhhhh
@@ -1386,7 +1360,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
do {
uint count = state->draw_width / 4;
- dst = dst_org;
+ dst = dstPtr;
do {
uint32 bits = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]);
byte color;
@@ -1422,7 +1396,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
dst += 8;
src += 5;
} while (--count);
- dst_org += _screenWidth;
+ dstPtr += _screenWidth;
} while (--state->draw_height);
} else {
src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
@@ -1448,7 +1422,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
if (state->flags & kDFCompressed) {
uint w, h;
- byte *src, *dst, *dst_org;
+ byte *src, *dst, *dstPtr;
state->x_skip *= 4; /* reached */
@@ -1457,16 +1431,16 @@ void AGOSEngine::drawImages(VC10_state *state) {
vc10_skip_cols(state);
- dst_org = state->surf_addr;
+ dstPtr = state->surf_addr;
if (!(state->flags & kDFNonTrans) && (state->flags & 0x40)) { /* reached */
- dst_org += vcReadVar(252);
+ dstPtr += vcReadVar(252);
}
w = 0;
do {
byte color;
src = vc10_depackColumn(state);
- dst = dst_org;
+ dst = dstPtr;
h = 0;
do {
@@ -1479,7 +1453,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
dst += _screenWidth;
src++;
} while (++h != state->draw_height);
- dst_org += 2;
+ dstPtr += 2;
} while (++w != state->draw_width);
/* vc10_helper_6 */
} else {
@@ -1915,7 +1889,7 @@ void AGOSEngine::vc25_halt_sprite() {
}
void AGOSEngine::vc26_setSubWindow() {
- uint16 *as = &_video_windows[vcReadNextWord() * 4]; // number
+ uint16 *as = &_videoWindows[vcReadNextWord() * 4]; // number
as[0] = vcReadNextWord(); // x
as[1] = vcReadNextWord(); // y
as[2] = vcReadNextWord(); // width
@@ -2018,7 +1992,7 @@ void AGOSEngine::vc35_clearWindow() {
uint16 num = vcReadNextWord();
uint16 color = vcReadNextWord();
- debug(0, "vc35_clearWindow: window %d color %d\n", num, color);
+ debug(0, "vc35_clearWindow: window %d color %d", num, color);
}
void AGOSEngine::vc36_setWindowImage() {
@@ -2154,7 +2128,7 @@ void AGOSEngine::vc45_setSpriteX() {
uint num = vcReadNextWord();
uint color = vcReadNextWord();
- debug(0, "vc45: window %d color %d\n", num, color);
+ debug(0, "vc45: window %d color %d", num, color);
} else {
VgaSprite *vsp = findCurSprite();
vsp->x = vcReadVar(vcReadNextWord());