Reverse experimental AKOS codec 5 rewrite.

This rewrite causes touching the ladder at the Fuel Tower to crash
ScummVM again (in Full Throttle)

svn-id: r5091
This commit is contained in:
James Brown 2002-10-06 06:36:22 +00:00
parent 9612002d78
commit 79b95b6732
2 changed files with 80 additions and 116 deletions

View file

@ -860,136 +860,60 @@ void AkosRenderer::codec1_ignorePakCols(int num)
void AkosRenderer::codec5()
{
VirtScreen *vs;
BompDrawData bdd;
int left, right, top, bottom;
int moveX;
int moveY;
int left;
int var_20;
int max_width;
byte *src, *dest;
int src_x, src_y;
uint dst_x, dst_y;
int right;
int top;
int bottom;
bool masking;
byte maskbit;
const byte *mask = NULL;
// I don't know if this is complete. It used to simply call drawBomp()
// to draw an unscaled image, but I don't know if that was because it
// will never have to scale, or if it's because until quite recently
// drawBomp() didn't know how to scale images.
//
// What I do know is that drawBomp() doesn't care about masking and
// shadows, and these are both needed for Full Throttle.
vs = &_vm->virtscr[0];
//setBlastObjectMode(shadow_mode); // not implemented yet
moveX = move_x_cur;
moveY = move_y_cur;
if (!mirror) {
left = (x - move_x_cur - width) + 1;
left = (x - moveX - width) + 1;
} else {
left = x + move_x_cur - 1;
left = x + moveX - 1;
}
right = left + width;
top = y + move_y_cur;
bottom = top + height + 1;
var_20 = 0;
max_width = outwidth;
right = left + width - 1;
top = y + moveY;
bottom = top + height;
if (left < 0)
left = 0;
if (left > (int) outwidth)
left -= left - outwidth;
if (left > max_width)
left -= left - max_width;
if (top < draw_top)
draw_top = top;
if (bottom > draw_bottom)
draw_bottom = bottom;
// Yazoo: this is not correct, but fix a lots of bugs for the momment
_vm->updateDirtyRect(0, left, right, top, bottom, 1 << dirty_id);
draw_top = 0;
draw_bottom = vs->height;
masking = false;
if (clipping) {
masking = _vm->isMaskActiveAt(left, top, right, bottom,
_vm->getResourceAddress(rtBuffer, 9) +
_vm->gdi._imgBufOffs[clipping] +
_vm->_screenStartStrip) != 0;
}
_vm->updateDirtyRect(0, left, right + 1, top, bottom + 1, 1 << dirty_id);
v1.mask_ptr = NULL;
bdd.dataptr = srcptr;
bdd.out = outptr;
bdd.outheight = outheight;
bdd.outwidth = outwidth;
bdd.scale_x = 0xFF;
bdd.scale_y = 0xFF;
bdd.srcheight = height;
bdd.srcwidth = width;
bdd.x = left + 1;
bdd.y = top;
if (masking || charsetmask || shadow_mode) {
v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) +
top * 40 + _vm->_screenStartStrip;
v1.imgbufoffs = _vm->gdi._imgBufOffs[clipping];
if (!charsetmask && masking) {
v1.mask_ptr += v1.imgbufoffs;
v1.imgbufoffs = 0;
}
}
src = srcptr;
dest = outptr + top * outwidth + left + 1;
for (src_y = 0, dst_y = top; src_y < height; src_y++) {
byte code, color;
uint len, num, i;
byte *d = dest;
if (dst_y < 0 || dst_y >= outheight) {
src += READ_LE_UINT16(src) + 2;
mask += 40;
continue;
}
len = width;
src_x = 0;
dst_x = left + 1;
src += 2;
while (src_x <width) {
code = *src++;
num = (code >> 1) + 1;
if (num > len)
num = len;
len -= num;
if (code & 1) {
color = *src++;
for (i = 0; i < num; i++) {
if (dst_x >= 0 && dst_x < outwidth) {
if (color != 255) {
if (v1.mask_ptr)
mask = v1.mask_ptr + (dst_x >> 3);
maskbit = revBitMask[dst_x & 7];
if (shadow_mode && color == 13)
color = shadow_table[*d];
if (!mask || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))
*d = color;
}
}
d++;
dst_x++;
src_x++;
}
} else {
for (i = 0; i < num; i++) {
color = src[i];
if (dst_x >= 0 && dst_x < outwidth) {
if (color != 255) {
if (v1.mask_ptr)
mask = v1.mask_ptr + (dst_x >> 3);
maskbit = revBitMask[dst_x & 7];
if (shadow_mode && color == 13)
color = shadow_table[*d];
if (!mask || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))
*d = color;
}
}
d++;
dst_x++;
src_x++;
}
src += num;
}
}
dest += outwidth;
dst_y++;
}
_vm->drawBomp(&bdd, 0, bdd.dataptr, 0, 0);
}
void AkosRenderer::codec16()

View file

@ -2736,11 +2736,51 @@ void Scumm::o6_miscOps()
speed = 71;
else
speed = 1000 / _insaneFlag;
if (args[1] == 1) printf("startSmush one is true\n");
if (args[2] == 1) printf("startSmush two is true\n");
debug(1, "INSANE Arg: %d", args[1]);
ScummRenderer * sr = new ScummRenderer(this, speed);
SmushPlayer * sp = new SmushPlayer(sr);
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
// INSANE mode 0: SMUSH movie playback
if (args[1] == 0) {
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
} else if (_gameId == GID_FT) {
// Full Throttle INSANE modes
switch (args[1]) {
case 0:
sp->play("minedriv.san", getGameDataPath());
break;
case 1:
sp->play("tovista2.san", getGameDataPath());
break;
case 2:
sp->play("tovista1.san", getGameDataPath());
break;
case 3:
sp->play("minefite.san", getGameDataPath());
break;
case 4:
sp->play("rottopen.san", getGameDataPath());
break;
case 5:
case 6:
case 7:
case 8:
warning("FT_INSANE mode %d: Stub", args[1]);
break;
case 9:
sp->play("credits.san", getGameDataPath());
default:
// Other INSANE modes
warning("Unknown FT_INSANE mode for %d", args[1]);
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
}
} else {
// Other INSANE modes
warning("Unknown insane mode for %d", args[1]);
sp->play((char*)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
}
delete sp;
delete sr;
}