aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-10-22 12:18:17 +0000
committerMax Horn2002-10-22 12:18:17 +0000
commit93c8e145a87ae7b98c9815144048c3b3c8eee733 (patch)
tree992c4071c2ce7a27bcf57f76b833c3bfc776b5a7
parent80fad4039414d2a78b98aa469c80553b45dff01b (diff)
downloadscummvm-rg350-93c8e145a87ae7b98c9815144048c3b3c8eee733.tar.gz
scummvm-rg350-93c8e145a87ae7b98c9815144048c3b3c8eee733.tar.bz2
scummvm-rg350-93c8e145a87ae7b98c9815144048c3b3c8eee733.zip
akos cleanup, second stage
svn-id: r5242
-rw-r--r--scumm/akos.cpp204
-rw-r--r--scumm/akos.h38
2 files changed, 125 insertions, 117 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 22f2bfa40e..7e11e6d504 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -260,72 +260,71 @@ bool AkosRenderer::drawCostumeChannel(int chan)
return true;
}
-void AkosRenderer::akos_generic_decode()
+void AkosRenderer::codec1_genericDecode()
{
- AkosRenderer * ar = this;
byte *src, *dst;
byte len, height, maskbit;
uint y, color;
const byte *scaleytab, *mask;
- y = ar->v1.y;
+ y = v1.y;
- len = ar->v1.replen;
- src = ar->srcptr;
- dst = ar->v1.destptr;
- color = ar->v1.repcolor;
- height = ar->_height;
+ len = v1.replen;
+ src = srcptr;
+ dst = v1.destptr;
+ color = v1.repcolor;
+ height = _height;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
- maskbit = revBitMask[ar->v1.x & 7];
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
+ scaleytab = &v1.scaletable[v1.tmp_y];
+ maskbit = revBitMask[v1.x & 7];
+ mask = v1.mask_ptr + (v1.x >> 3);
if (len)
goto StartPos;
do {
len = *src++;
- color = len >> ar->v1.shl;
- len &= ar->v1.mask;
+ color = len >> v1.shl;
+ len &= v1.mask;
if (!len)
len = *src++;
do {
- if (*scaleytab++ < ar->scale_y) {
- if (color && y < ar->outheight
- && (!ar->v1.mask_ptr || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) {
- *dst = ar->palette[color];
+ if (*scaleytab++ < scale_y) {
+ if (color && y < outheight
+ && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) {
+ *dst = palette[color];
}
mask += 40;
- dst += ar->outwidth;
+ dst += outwidth;
y++;
}
if (!--height) {
- if (!--ar->v1.skip_width)
+ if (!--v1.skip_width)
return;
- height = ar->_height;
- y = ar->v1.y;
+ height = _height;
+ y = v1.y;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
+ scaleytab = &v1.scaletable[v1.tmp_y];
- if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
- ar->v1.x += ar->v1.scaleXstep;
- if (ar->v1.x >= g_scumm->_realWidth)
+ if (v1.scaletable[v1.tmp_x] < scale_x) {
+ v1.x += v1.scaleXstep;
+ if (v1.x >= _vm->_realWidth)
return;
- maskbit = revBitMask[ar->v1.x & 7];
- ar->v1.destptr += ar->v1.scaleXstep;
+ maskbit = revBitMask[v1.x & 7];
+ v1.destptr += v1.scaleXstep;
}
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
- ar->v1.tmp_x += ar->v1.scaleXstep;
- dst = ar->v1.destptr;
+ mask = v1.mask_ptr + (v1.x >> 3);
+ v1.tmp_x += v1.scaleXstep;
+ dst = v1.destptr;
}
StartPos:;
} while (--len);
} while (1);
}
-void akos_c1_spec1(AkosRenderer * ar)
+void AkosRenderer::codec1_spec1()
{
byte *src, *dst;
byte len, height, maskbit;
@@ -334,66 +333,71 @@ void akos_c1_spec1(AkosRenderer * ar)
const byte *scaleytab, *mask;
- y = ar->v1.y;
+ y = v1.y;
- len = ar->v1.replen;
- src = ar->srcptr;
- dst = ar->v1.destptr;
- color = ar->v1.repcolor;
- height = ar->_height;
+ len = v1.replen;
+ src = srcptr;
+ dst = v1.destptr;
+ color = v1.repcolor;
+ height = _height;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
- maskbit = revBitMask[ar->v1.x & 7];
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
+ scaleytab = &v1.scaletable[v1.tmp_y];
+ maskbit = revBitMask[v1.x & 7];
+ mask = v1.mask_ptr + (v1.x >> 3);
if (len)
goto StartPos;
do {
len = *src++;
- color = len >> ar->v1.shl;
- len &= ar->v1.mask;
+ color = len >> v1.shl;
+ len &= v1.mask;
if (!len)
len = *src++;
do {
- if (*scaleytab++ < ar->scale_y) {
- if (color && y < ar->outheight
- && (!ar->v1.mask_ptr || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) {
- pcolor = ar->palette[color];
+ if (*scaleytab++ < scale_y) {
+ if (color && y < outheight
+ && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) {
+ pcolor = palette[color];
if (pcolor == 13)
- pcolor = ar->shadow_table[*dst];
+ pcolor = shadow_table[*dst];
*dst = pcolor;
}
mask += 40;
- dst += ar->outwidth;
+ dst += outwidth;
y++;
}
if (!--height) {
- if (!--ar->v1.skip_width)
+ if (!--v1.skip_width)
return;
- height = ar->_height;
- y = ar->v1.y;
+ height = _height;
+ y = v1.y;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
+ scaleytab = &v1.scaletable[v1.tmp_y];
- if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
- ar->v1.x += ar->v1.scaleXstep;
- if (ar->v1.x >= g_scumm->_realWidth)
+ if (v1.scaletable[v1.tmp_x] < scale_x) {
+ v1.x += v1.scaleXstep;
+ if (v1.x >= _vm->_realWidth)
return;
- maskbit = revBitMask[ar->v1.x & 7];
- ar->v1.destptr += ar->v1.scaleXstep;
+ maskbit = revBitMask[v1.x & 7];
+ v1.destptr += v1.scaleXstep;
}
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
- ar->v1.tmp_x += ar->v1.scaleXstep;
- dst = ar->v1.destptr;
+ mask = v1.mask_ptr + (v1.x >> 3);
+ v1.tmp_x += v1.scaleXstep;
+ dst = v1.destptr;
}
StartPos:;
} while (--len);
} while (1);
}
-void akos_c1_spec3(AkosRenderer * ar)
+void AkosRenderer::codec1_spec2()
+{
+ warning("codec1_spec2"); // TODO
+}
+
+void AkosRenderer::codec1_spec3()
{
byte *src, *dst;
byte len, height, maskbit;
@@ -402,62 +406,62 @@ void akos_c1_spec3(AkosRenderer * ar)
const byte *scaleytab, *mask;
- y = ar->v1.y;
+ y = v1.y;
- len = ar->v1.replen;
- src = ar->srcptr;
- dst = ar->v1.destptr;
- color = ar->v1.repcolor;
- height = ar->_height;
+ len = v1.replen;
+ src = srcptr;
+ dst = v1.destptr;
+ color = v1.repcolor;
+ height = _height;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
- maskbit = revBitMask[ar->v1.x & 7];
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
+ scaleytab = &v1.scaletable[v1.tmp_y];
+ maskbit = revBitMask[v1.x & 7];
+ mask = v1.mask_ptr + (v1.x >> 3);
if (len)
goto StartPos;
do {
len = *src++;
- color = len >> ar->v1.shl;
- len &= ar->v1.mask;
+ color = len >> v1.shl;
+ len &= v1.mask;
if (!len)
len = *src++;
do {
- if (*scaleytab++ < ar->scale_y) {
- if (color && y < ar->outheight
- && (!ar->v1.mask_ptr || !((mask[0] | mask[ar->v1.imgbufoffs]) & maskbit))) {
- pcolor = ar->palette[color];
+ if (*scaleytab++ < scale_y) {
+ if (color && y < outheight
+ && (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) {
+ pcolor = palette[color];
if (pcolor < 8) {
pcolor = (pcolor << 8) + *dst;
- *dst = ar->shadow_table[pcolor];
+ *dst = shadow_table[pcolor];
} else {
*dst = pcolor;
}
}
mask += 40;
- dst += ar->outwidth;
+ dst += outwidth;
y++;
}
if (!--height) {
- if (!--ar->v1.skip_width)
+ if (!--v1.skip_width)
return;
- height = ar->_height;
- y = ar->v1.y;
+ height = _height;
+ y = v1.y;
- scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
+ scaleytab = &v1.scaletable[v1.tmp_y];
- if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
- ar->v1.x += ar->v1.scaleXstep;
- if (ar->v1.x >= g_scumm->_realWidth)
+ if (v1.scaletable[v1.tmp_x] < scale_x) {
+ v1.x += v1.scaleXstep;
+ if (v1.x >= _vm->_realWidth)
return;
- maskbit = revBitMask[ar->v1.x & 7];
- ar->v1.destptr += ar->v1.scaleXstep;
+ maskbit = revBitMask[v1.x & 7];
+ v1.destptr += v1.scaleXstep;
}
- mask = ar->v1.mask_ptr + (ar->v1.x >> 3);
- ar->v1.tmp_x += ar->v1.scaleXstep;
- dst = ar->v1.destptr;
+ mask = v1.mask_ptr + (v1.x >> 3);
+ v1.tmp_x += v1.scaleXstep;
+ dst = v1.destptr;
}
StartPos:;
} while (--len);
@@ -795,18 +799,18 @@ void AkosRenderer::codec1()
switch (shadow_mode) {
case 1:
- akos_c1_spec1(this);
- return;
+ codec1_spec1();
+ break;
case 2:
-// akos_c1_spec2(this);
- warning("akos_c1_spec2");
- return;
+ codec1_spec2();
+ break;
case 3:
- akos_c1_spec3(this);
- return;
+ codec1_spec3();
+ break;
+ default:
+ codec1_genericDecode();
+ break;
}
-
- akos_generic_decode();
}
@@ -1197,7 +1201,7 @@ void AkosRenderer::akos16DecompressMask(byte * dest, int32 pitch, byte * src, in
akos16SkipData(numskip_before);
}
- maskpitch = ((uint)g_scumm->_realWidth / 8) + 1;
+ maskpitch = ((uint)_vm->_realWidth / 8) + 1;
while (t_height != 0) {
akos16DecodeLine(tmp_buf, t_width, dir);
diff --git a/scumm/akos.h b/scumm/akos.h
index 63ffb6f382..9bc5d92ede 100644
--- a/scumm/akos.h
+++ b/scumm/akos.h
@@ -80,6 +80,17 @@ struct AkosRenderer {
byte *srcptr;
byte *shadow_table;
+ /* put less used stuff at the bottom to optimize opcodes */
+ int draw_top, draw_bottom;
+protected:
+ byte *akpl, *akci, *aksq;
+ AkosOffset *akof;
+ byte *akcd;
+
+ byte palette[256];
+
+ Scumm *_vm;
+
struct {
/* codec stuff */
const byte *scaletable;
@@ -97,17 +108,6 @@ struct AkosRenderer {
int imgbufoffs;
} v1;
- /* put less used stuff at the bottom to optimize opcodes */
- int draw_top, draw_bottom;
- byte *akpl, *akci, *aksq;
- AkosOffset *akof;
- byte *akcd;
-
- byte palette[256];
-
-protected:
- Scumm *_vm;
-
struct {
byte unk5;
int unk6;
@@ -123,23 +123,27 @@ protected:
public:
// Constructor, sets all data to 0
- AkosRenderer(Scumm *scumm) {
+ AkosRenderer(Scumm *scumm) {
memset(this, 0, sizeof(AkosRenderer));
_vm = scumm;
- } bool drawCostume();
+ }
+ bool drawCostume();
void setPalette(byte *palette);
void setCostume(int costume);
void setFacing(Actor * a);
protected:
- void akos_generic_decode();
bool drawCostumeChannel(int chan);
void codec1();
+ void codec1_spec1();
+ void codec1_spec2();
+ void codec1_spec3();
+ void codec1_genericDecode();
+ void codec1_ignorePakCols(int num);
+
void codec5();
+
void codec16();
- void codec1_ignorePakCols(int num);
- void c1_spec2();
- void c1_spec3();
void akos16SetupBitReader(byte *src);
void akos16PutOnScreen(byte * dest, byte * src, byte transparency, int32 count);
void akos16SkipData(int32 numskip);