mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
more akos/costume merging
svn-id: r6352
This commit is contained in:
parent
08d34d17c0
commit
eaf2e1a313
@ -944,7 +944,7 @@ void Actor::drawActorCostume()
|
||||
// to be at the moment or, if it's not in any box, don't mask
|
||||
// at all.
|
||||
//
|
||||
// This is similar to the clipping == 100 check used for AKOS
|
||||
// This is similar to the _zbuf == 100 check used for AKOS
|
||||
// costumes, except I haven't been able to figure out the
|
||||
// proper check here. It's not quite enough to check if
|
||||
// ignoreBoxes != 0 and checking if walkbox == 0 yields too
|
||||
@ -985,10 +985,10 @@ void Actor::drawActorCostume()
|
||||
|
||||
cr.setCostume(costume);
|
||||
cr.setPalette(palette);
|
||||
cr.setFacing(facing);
|
||||
cr.setFacing(this);
|
||||
|
||||
cr.draw_top = top = 0xFF;
|
||||
cr.draw_bottom = bottom = 0;
|
||||
cr._draw_top = top = 0xFF;
|
||||
cr._draw_bottom = bottom = 0;
|
||||
|
||||
cr._dirty_id = number;
|
||||
|
||||
@ -997,28 +997,28 @@ void Actor::drawActorCostume()
|
||||
needBgReset = true;
|
||||
needRedraw = true;
|
||||
}
|
||||
top = cr.draw_top;
|
||||
bottom = cr.draw_bottom;
|
||||
top = cr._draw_top;
|
||||
bottom = cr._draw_bottom;
|
||||
} else {
|
||||
AkosRenderer ar(_vm);
|
||||
ar.charsetmask = true;
|
||||
ar._x = x - _vm->virtscr[0].xstart;
|
||||
ar._y = y - elevation;
|
||||
ar._actorX = x - _vm->virtscr[0].xstart;
|
||||
ar._actorY = y - elevation;
|
||||
ar._scaleX = scalex;
|
||||
ar._scaleY = scaley;
|
||||
ar.clipping = forceClip;
|
||||
if (ar.clipping == 100) {
|
||||
ar.clipping = _vm->getMaskFromBox(walkbox);
|
||||
if (ar.clipping > _vm->gdi._numZBuffer)
|
||||
ar.clipping = _vm->gdi._numZBuffer;
|
||||
ar._zbuf = forceClip;
|
||||
if (ar._zbuf == 100) {
|
||||
ar._zbuf = _vm->getMaskFromBox(walkbox);
|
||||
if (ar._zbuf > _vm->gdi._numZBuffer)
|
||||
ar._zbuf = _vm->gdi._numZBuffer;
|
||||
}
|
||||
|
||||
ar.outptr = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart;
|
||||
ar.outwidth = _vm->virtscr[0].width;
|
||||
ar.outheight = _vm->virtscr[0].height;
|
||||
|
||||
ar.shadow_mode = shadow_mode;
|
||||
ar.shadow_table = _vm->_shadowPalette;
|
||||
ar._shadow_mode = shadow_mode;
|
||||
ar._shadow_table = _vm->_shadowPalette;
|
||||
|
||||
ar.setCostume(costume);
|
||||
ar.setPalette(palette);
|
||||
@ -1026,8 +1026,8 @@ void Actor::drawActorCostume()
|
||||
|
||||
ar._dirty_id = number;
|
||||
|
||||
ar.draw_top = top = 0x7fffffff;
|
||||
ar.draw_bottom = bottom = 0;
|
||||
ar._draw_top = top = 0x7fffffff;
|
||||
ar._draw_bottom = bottom = 0;
|
||||
|
||||
if (ar.drawCostume(cost)) {
|
||||
// FIXME: this breaks talking in The Dig. But why?
|
||||
@ -1035,8 +1035,8 @@ void Actor::drawActorCostume()
|
||||
//needBgReset = true;
|
||||
//needRedraw = true;
|
||||
}
|
||||
top = ar.draw_top;
|
||||
bottom = ar.draw_bottom;
|
||||
top = ar._draw_top;
|
||||
bottom = ar._draw_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
183
scumm/akos.cpp
183
scumm/akos.cpp
@ -26,6 +26,36 @@
|
||||
#include "imuse.h"
|
||||
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma START_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
struct AkosHeader {
|
||||
byte unk_1[2];
|
||||
byte flags;
|
||||
byte unk_2;
|
||||
uint16 num_anims;
|
||||
uint16 unk_3;
|
||||
uint16 codec;
|
||||
} GCC_PACK;
|
||||
|
||||
struct AkosOffset {
|
||||
uint32 akcd;
|
||||
uint16 akci;
|
||||
} GCC_PACK;
|
||||
|
||||
struct AkosCI {
|
||||
uint16 width, height;
|
||||
int16 rel_x, rel_y;
|
||||
int16 move_x, move_y;
|
||||
} GCC_PACK;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma END_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
enum AkosOpcodes {
|
||||
AKC_Return = 0xC001,
|
||||
AKC_SetVar = 0xC010,
|
||||
@ -205,23 +235,12 @@ void AkosRenderer::setCostume(int costume)
|
||||
|
||||
void AkosRenderer::setFacing(Actor *a)
|
||||
{
|
||||
mirror = (newDirToOldDir(a->facing) != 0 || akhd->flags & 1);
|
||||
_mirror = (newDirToOldDir(a->facing) != 0 || akhd->flags & 1);
|
||||
if (a->flip)
|
||||
mirror ^= 1;
|
||||
_mirror = !_mirror;
|
||||
}
|
||||
|
||||
bool AkosRenderer::drawCostume(const CostumeData &cost)
|
||||
{
|
||||
int i;
|
||||
bool result = false;
|
||||
|
||||
move_x = move_y = 0;
|
||||
for (i = 0; i < 16; i++)
|
||||
result |= drawLimb(cost, i);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AkosRenderer::drawLimb(const CostumeData &cost, int limb)
|
||||
byte AkosRenderer::drawLimb(const CostumeData &cost, int limb)
|
||||
{
|
||||
uint code;
|
||||
byte *p;
|
||||
@ -250,12 +269,12 @@ bool AkosRenderer::drawLimb(const CostumeData &cost, int limb)
|
||||
srcptr = akcd + READ_LE_UINT32(&off->akcd);
|
||||
the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
|
||||
move_x_cur = move_x + (int16)READ_LE_UINT16(&the_akci->rel_x);
|
||||
move_y_cur = move_y + (int16)READ_LE_UINT16(&the_akci->rel_y);
|
||||
_xmoveCur = _xmove + (int16)READ_LE_UINT16(&the_akci->rel_x);
|
||||
_ymoveCur = _ymove + (int16)READ_LE_UINT16(&the_akci->rel_y);
|
||||
_width = READ_LE_UINT16(&the_akci->width);
|
||||
_height = READ_LE_UINT16(&the_akci->height);
|
||||
move_x += (int16)READ_LE_UINT16(&the_akci->move_x);
|
||||
move_y -= (int16)READ_LE_UINT16(&the_akci->move_y);
|
||||
_xmove += (int16)READ_LE_UINT16(&the_akci->move_x);
|
||||
_ymove -= (int16)READ_LE_UINT16(&the_akci->move_y);
|
||||
|
||||
switch (codec) {
|
||||
case 1:
|
||||
@ -283,8 +302,8 @@ bool AkosRenderer::drawLimb(const CostumeData &cost, int limb)
|
||||
srcptr = akcd + READ_LE_UINT32(&off->akcd);
|
||||
the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
|
||||
move_x_cur = move_x + (int16)READ_LE_UINT16(p + 0);
|
||||
move_y_cur = move_y + (int16)READ_LE_UINT16(p + 2);
|
||||
_xmoveCur = _xmove + (int16)READ_LE_UINT16(p + 0);
|
||||
_ymoveCur = _ymove + (int16)READ_LE_UINT16(p + 2);
|
||||
|
||||
p += (p[4] & 0x80) ? 6 : 5;
|
||||
|
||||
@ -411,7 +430,7 @@ void AkosRenderer::codec1_spec1()
|
||||
&& (!v1.mask_ptr || !((mask[0] | mask[v1.imgbufoffs]) & maskbit))) {
|
||||
pcolor = palette[color];
|
||||
if (pcolor == 13)
|
||||
pcolor = shadow_table[*dst];
|
||||
pcolor = _shadow_table[*dst];
|
||||
*dst = pcolor;
|
||||
}
|
||||
mask += _numStrips;
|
||||
@ -485,7 +504,7 @@ void AkosRenderer::codec1_spec3()
|
||||
pcolor = palette[color];
|
||||
if (pcolor < 8) {
|
||||
pcolor = (pcolor << 8) + *dst;
|
||||
*dst = shadow_table[pcolor];
|
||||
*dst = _shadow_table[pcolor];
|
||||
} else {
|
||||
*dst = pcolor;
|
||||
}
|
||||
@ -657,23 +676,23 @@ void AkosRenderer::codec1()
|
||||
|
||||
use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
|
||||
|
||||
cur_x = _x;
|
||||
cur_y = _y;
|
||||
cur_x = _actorX;
|
||||
cur_y = _actorY;
|
||||
|
||||
if (use_scaling) {
|
||||
|
||||
/* Scale direction */
|
||||
v1.scaleXstep = -1;
|
||||
if (move_x_cur < 0) {
|
||||
move_x_cur = -move_x_cur;
|
||||
if (_xmoveCur < 0) {
|
||||
_xmoveCur = -_xmoveCur;
|
||||
v1.scaleXstep = 1;
|
||||
}
|
||||
|
||||
if (mirror) {
|
||||
if (_mirror) {
|
||||
/* Adjust X position */
|
||||
tmp_x = 0x180 - move_x_cur;
|
||||
tmp_x = 0x180 - _xmoveCur;
|
||||
j = tmp_x;
|
||||
for (i = 0; i < move_x_cur; i++) {
|
||||
for (i = 0; i < _xmoveCur; i++) {
|
||||
if (v1.scaletable[j++] < _scaleX)
|
||||
cur_x -= v1.scaleXstep;
|
||||
}
|
||||
@ -692,9 +711,9 @@ void AkosRenderer::codec1()
|
||||
} else {
|
||||
/* No mirror */
|
||||
/* Adjust X position */
|
||||
tmp_x = 0x180 + move_x_cur;
|
||||
tmp_x = 0x180 + _xmoveCur;
|
||||
j = tmp_x;
|
||||
for (i = 0; i < move_x_cur; i++) {
|
||||
for (i = 0; i < _xmoveCur; i++) {
|
||||
if (v1.scaletable[j++] < _scaleX)
|
||||
cur_x += v1.scaleXstep;
|
||||
}
|
||||
@ -716,33 +735,33 @@ void AkosRenderer::codec1()
|
||||
skip--;
|
||||
|
||||
step = -1;
|
||||
if (move_y_cur < 0) {
|
||||
move_y_cur = -move_y_cur;
|
||||
if (_ymoveCur < 0) {
|
||||
_ymoveCur = -_ymoveCur;
|
||||
step = -step;
|
||||
}
|
||||
|
||||
tmp_y = 0x180 - move_y_cur;
|
||||
for (i = 0; i < move_y_cur; i++) {
|
||||
tmp_y = 0x180 - _ymoveCur;
|
||||
for (i = 0; i < _ymoveCur; i++) {
|
||||
if (v1.scaletable[tmp_y++] < _scaleY)
|
||||
cur_y -= step;
|
||||
}
|
||||
|
||||
y_top = y_bottom = cur_y;
|
||||
tmp_y = 0x180 - move_y_cur;
|
||||
tmp_y = 0x180 - _ymoveCur;
|
||||
for (i = 0; i < _height; i++) {
|
||||
if (v1.scaletable[tmp_y++] < _scaleY)
|
||||
y_bottom++;
|
||||
}
|
||||
|
||||
tmp_y = 0x180 - move_y_cur;
|
||||
tmp_y = 0x180 - _ymoveCur;
|
||||
} else {
|
||||
if (!mirror)
|
||||
move_x_cur = -move_x_cur;
|
||||
if (!_mirror)
|
||||
_xmoveCur = -_xmoveCur;
|
||||
|
||||
cur_x += move_x_cur;
|
||||
cur_y += move_y_cur;
|
||||
cur_x += _xmoveCur;
|
||||
cur_y += _ymoveCur;
|
||||
|
||||
if (mirror) {
|
||||
if (_mirror) {
|
||||
x_left = cur_x;
|
||||
x_right = cur_x + _width;
|
||||
} else {
|
||||
@ -762,7 +781,7 @@ void AkosRenderer::codec1()
|
||||
v1.skip_width = _width;
|
||||
|
||||
v1.scaleXstep = -1;
|
||||
if (mirror)
|
||||
if (_mirror)
|
||||
v1.scaleXstep = -v1.scaleXstep;
|
||||
|
||||
if ((int) y_top >= (int) outheight || y_bottom <= 0)
|
||||
@ -774,7 +793,7 @@ void AkosRenderer::codec1()
|
||||
v1.replen = 0;
|
||||
v1.y_pitch = _height * outwidth;
|
||||
|
||||
if (mirror) {
|
||||
if (_mirror) {
|
||||
v1.y_pitch--;
|
||||
if (!use_scaling)
|
||||
skip = -cur_x;
|
||||
@ -819,10 +838,10 @@ void AkosRenderer::codec1()
|
||||
if ((uint) y_bottom > (uint) outheight)
|
||||
y_bottom = outheight;
|
||||
|
||||
if (draw_top > y_top)
|
||||
draw_top = y_top;
|
||||
if (draw_bottom < y_bottom)
|
||||
draw_bottom = y_bottom;
|
||||
if (_draw_top > y_top)
|
||||
_draw_top = y_top;
|
||||
if (_draw_bottom < y_bottom)
|
||||
_draw_bottom = y_bottom;
|
||||
|
||||
if (cur_x == -1)
|
||||
cur_x = 0; /* ?? */
|
||||
@ -830,24 +849,24 @@ void AkosRenderer::codec1()
|
||||
v1.destptr = outptr + cur_x + cur_y * outwidth;
|
||||
|
||||
masking = false;
|
||||
if (clipping) {
|
||||
if (_zbuf) {
|
||||
masking = _vm->isMaskActiveAt(x_left, y_top, x_right, y_bottom,
|
||||
_vm->getResourceAddress(rtBuffer, 9) +
|
||||
_vm->gdi._imgBufOffs[clipping] + _vm->_screenStartStrip) != 0;
|
||||
_vm->gdi._imgBufOffs[_zbuf] + _vm->_screenStartStrip) != 0;
|
||||
}
|
||||
|
||||
v1.mask_ptr = NULL;
|
||||
|
||||
if (masking || charsetmask || shadow_mode) {
|
||||
if (masking || charsetmask || _shadow_mode) {
|
||||
v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + cur_y * _numStrips + _vm->_screenStartStrip;
|
||||
v1.imgbufoffs = _vm->gdi._imgBufOffs[clipping];
|
||||
v1.imgbufoffs = _vm->gdi._imgBufOffs[_zbuf];
|
||||
if (!charsetmask && masking) {
|
||||
v1.mask_ptr += v1.imgbufoffs;
|
||||
v1.imgbufoffs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
switch (shadow_mode) {
|
||||
switch (_shadow_mode) {
|
||||
case 1:
|
||||
codec1_spec1();
|
||||
break;
|
||||
@ -895,14 +914,14 @@ void AkosRenderer::codec1_ignorePakCols(int num)
|
||||
void AkosRenderer::codec5() {
|
||||
int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh, tmp_x, tmp_y;
|
||||
|
||||
if (!mirror) {
|
||||
clip_left = (_x - move_x_cur - _width) + 1;
|
||||
if (!_mirror) {
|
||||
clip_left = (_actorX - _xmoveCur - _width) + 1;
|
||||
} else {
|
||||
clip_left = _x + move_x_cur - 1;
|
||||
clip_left = _actorX + _xmoveCur - 1;
|
||||
}
|
||||
|
||||
clip_right = (clip_left + _width) - 1;
|
||||
clip_top = _y + move_y_cur;
|
||||
clip_top = _actorY + _ymoveCur;
|
||||
clip_bottom = (clip_top + _height) - 1;
|
||||
maxw = outwidth - 1;
|
||||
maxh = outheight - 1;
|
||||
@ -931,10 +950,10 @@ void AkosRenderer::codec5() {
|
||||
|
||||
_vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, 1 << _dirty_id);
|
||||
|
||||
if (draw_top > clip_top)
|
||||
draw_top = clip_top;
|
||||
if (draw_bottom < clip_bottom)
|
||||
draw_bottom = clip_bottom + 1;
|
||||
if (_draw_top > clip_top)
|
||||
_draw_top = clip_top;
|
||||
if (_draw_bottom < clip_bottom)
|
||||
_draw_bottom = clip_bottom + 1;
|
||||
|
||||
BompDrawData bdd;
|
||||
|
||||
@ -946,25 +965,25 @@ void AkosRenderer::codec5() {
|
||||
bdd.dataptr = srcptr;
|
||||
bdd.scale_x = 255;
|
||||
bdd.scale_y = 255;
|
||||
bdd.shadowMode = shadow_mode;
|
||||
bdd.shadowMode = _shadow_mode;
|
||||
|
||||
_vm->_bompScallingXPtr = NULL;
|
||||
_vm->_bompScallingYPtr = NULL;
|
||||
|
||||
int decode_mode;
|
||||
|
||||
if (!mirror) {
|
||||
bdd.x = (_x - move_x_cur - _width) + 1;
|
||||
if (!_mirror) {
|
||||
bdd.x = (_actorX - _xmoveCur - _width) + 1;
|
||||
decode_mode = 3;
|
||||
} else {
|
||||
bdd.x = _x + move_x_cur;
|
||||
bdd.x = _actorX + _xmoveCur;
|
||||
decode_mode = 1;
|
||||
}
|
||||
|
||||
bdd.y = _y + move_y_cur;
|
||||
bdd.y = _actorY + _ymoveCur;
|
||||
|
||||
if (clipping != 0) {
|
||||
_vm->_bompMaskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[clipping];
|
||||
if (_zbuf != 0) {
|
||||
_vm->_bompMaskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
|
||||
_vm->drawBomp(&bdd, decode_mode, 1);
|
||||
} else {
|
||||
_vm->drawBomp(&bdd, decode_mode, 0);
|
||||
@ -989,7 +1008,7 @@ void AkosRenderer::akos16PutOnScreen(byte * dest, byte * src, byte transparency,
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
switch(shadow_mode) {
|
||||
switch(_shadow_mode) {
|
||||
case 0:
|
||||
do {
|
||||
tmp_data = *(src++);
|
||||
@ -1005,7 +1024,7 @@ void AkosRenderer::akos16PutOnScreen(byte * dest, byte * src, byte transparency,
|
||||
tmp_data = *(src++);
|
||||
if (tmp_data != transparency) {
|
||||
if (tmp_data == 13) {
|
||||
tmp_data = shadow_table[*(dest)];
|
||||
tmp_data = _shadow_table[*(dest)];
|
||||
}
|
||||
*(dest) = tmp_data;
|
||||
}
|
||||
@ -1018,7 +1037,7 @@ void AkosRenderer::akos16PutOnScreen(byte * dest, byte * src, byte transparency,
|
||||
tmp_data = *(src++);
|
||||
if (tmp_data != transparency) {
|
||||
if (tmp_data < 8) {
|
||||
tmp_data = shadow_table[*(dest) + (tmp_data << 8)];
|
||||
tmp_data = _shadow_table[*(dest) + (tmp_data << 8)];
|
||||
}
|
||||
*(dest) = tmp_data;
|
||||
}
|
||||
@ -1207,13 +1226,13 @@ void AkosRenderer::akos16DecompressMask(byte * dest, int32 pitch, byte * src, in
|
||||
void AkosRenderer::codec16() {
|
||||
int32 clip_left;
|
||||
|
||||
if(!mirror) {
|
||||
clip_left = (_x - move_x_cur - _width) + 1;
|
||||
if(!_mirror) {
|
||||
clip_left = (_actorX - _xmoveCur - _width) + 1;
|
||||
} else {
|
||||
clip_left = _x + move_x_cur;
|
||||
clip_left = _actorX + _xmoveCur;
|
||||
}
|
||||
|
||||
int32 clip_top = move_y_cur + _y;
|
||||
int32 clip_top = _ymoveCur + _actorY;
|
||||
int32 clip_right = (clip_left + _width) - 1;
|
||||
int32 clip_bottom = (clip_top + _height) - 1;
|
||||
int32 skip_x = 0;
|
||||
@ -1262,10 +1281,10 @@ void AkosRenderer::codec16() {
|
||||
|
||||
_vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, 1 << _dirty_id);
|
||||
|
||||
if (draw_top > clip_top)
|
||||
draw_top = clip_top;
|
||||
if (draw_bottom < clip_bottom)
|
||||
draw_bottom = clip_bottom + 1;
|
||||
if (_draw_top > clip_top)
|
||||
_draw_top = clip_top;
|
||||
if (_draw_bottom < clip_bottom)
|
||||
_draw_bottom = clip_bottom + 1;
|
||||
|
||||
int32 width_unk, height_unk;
|
||||
|
||||
@ -1274,7 +1293,7 @@ void AkosRenderer::codec16() {
|
||||
|
||||
int32 /*tmp1, tmp2, tmp3,*/ dir;
|
||||
|
||||
if (!mirror) {
|
||||
if (!_mirror) {
|
||||
dir = -1;
|
||||
|
||||
int tmp_skip_x = skip_x;
|
||||
@ -1316,12 +1335,12 @@ void AkosRenderer::codec16() {
|
||||
|
||||
byte * dest = outptr + width_unk + height_unk * _vm->_realWidth;
|
||||
|
||||
if (clipping == 0) {
|
||||
if (_zbuf == 0) {
|
||||
akos16Decompress(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, 255);
|
||||
return;
|
||||
}
|
||||
|
||||
byte * ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[clipping];
|
||||
byte * ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
|
||||
ptr += _numStrips * clip_top + (clip_left / 8);
|
||||
akos16DecompressMask(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, 255, ptr, clip_left / 8);
|
||||
}
|
||||
|
86
scumm/akos.h
86
scumm/akos.h
@ -23,80 +23,37 @@
|
||||
#ifndef AKOS_H
|
||||
#define AKOS_H
|
||||
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma START_PACK_STRUCTS
|
||||
#endif
|
||||
#include "base-costume.h"
|
||||
|
||||
struct CostumeData;
|
||||
struct AkosHeader;
|
||||
struct AkosOffset;
|
||||
|
||||
struct AkosHeader {
|
||||
byte unk_1[2];
|
||||
byte flags;
|
||||
byte unk_2;
|
||||
uint16 num_anims;
|
||||
uint16 unk_3;
|
||||
uint16 codec;
|
||||
} GCC_PACK;
|
||||
|
||||
struct AkosOffset {
|
||||
uint32 akcd;
|
||||
uint16 akci;
|
||||
} GCC_PACK;
|
||||
|
||||
struct AkosCI {
|
||||
uint16 width, height;
|
||||
int16 rel_x, rel_y;
|
||||
int16 move_x, move_y;
|
||||
} GCC_PACK;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma END_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
struct AkosRenderer {
|
||||
class AkosRenderer : public BaseCostumeRenderer {
|
||||
public:
|
||||
byte _dirty_id;
|
||||
|
||||
byte shadow_mode;
|
||||
byte *shadow_table;
|
||||
|
||||
int _x, _y;
|
||||
byte _scaleX, _scaleY;
|
||||
byte clipping;
|
||||
bool charsetmask; // FIXME - it seems charsetmask is only set once, in actor.cpp, to true. So can we get rid of it?!?
|
||||
|
||||
int draw_top, draw_bottom;
|
||||
|
||||
byte *outptr;
|
||||
uint outwidth, outheight;
|
||||
|
||||
protected:
|
||||
Scumm *_vm;
|
||||
int32 _numStrips;
|
||||
|
||||
uint16 codec;
|
||||
bool mirror; /* draw actor mirrored */
|
||||
byte *srcptr;
|
||||
|
||||
/* pointer to various parts of the costume resource */
|
||||
// movement of cel to decode
|
||||
int _xmoveCur, _ymoveCur;
|
||||
|
||||
// actor palette
|
||||
byte palette[256];
|
||||
|
||||
// pointer to various parts of the costume resource
|
||||
byte *akos;
|
||||
AkosHeader *akhd;
|
||||
|
||||
/* current move offset */
|
||||
int move_x, move_y;
|
||||
/* movement of cel to decode */
|
||||
int move_x_cur, move_y_cur;
|
||||
/* width and height of cel to decode */
|
||||
int _width, _height;
|
||||
|
||||
byte *srcptr;
|
||||
|
||||
byte *akpl, *akci, *aksq;
|
||||
AkosOffset *akof;
|
||||
byte *akcd;
|
||||
|
||||
byte palette[256];
|
||||
|
||||
struct {
|
||||
/* codec stuff */
|
||||
const byte *scaletable;
|
||||
@ -127,21 +84,24 @@ protected:
|
||||
} akos16;
|
||||
|
||||
public:
|
||||
// Constructor, sets all data to 0
|
||||
AkosRenderer(Scumm *scumm) {
|
||||
memset(this, 0, sizeof(AkosRenderer));
|
||||
_vm = scumm;
|
||||
_numStrips = _vm->gdi._numStrips;
|
||||
AkosRenderer(Scumm *scumm) : BaseCostumeRenderer(scumm) {
|
||||
outptr = 0;
|
||||
srcptr = 0;
|
||||
akos = 0;
|
||||
akhd = 0;
|
||||
akpl = 0;
|
||||
akci = 0;
|
||||
aksq = 0;
|
||||
akof = 0;
|
||||
akcd = 0;
|
||||
}
|
||||
|
||||
void setPalette(byte *palette);
|
||||
void setFacing(Actor *a);
|
||||
void setCostume(int costume);
|
||||
|
||||
bool drawCostume(const CostumeData &cost);
|
||||
|
||||
protected:
|
||||
bool drawLimb(const CostumeData &cost, int limb);
|
||||
byte drawLimb(const CostumeData &cost, int limb);
|
||||
|
||||
void codec1();
|
||||
void codec1_spec1();
|
||||
|
91
scumm/base-costume.h
Normal file
91
scumm/base-costume.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2001 Ludvig Strigeus
|
||||
* Copyright (C) 2001/2002 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BASE_COSTUME_H
|
||||
#define BASE_COSTUME_H
|
||||
|
||||
class Scumm;
|
||||
|
||||
|
||||
struct BaseCostumeRenderer {
|
||||
public:
|
||||
byte _dirty_id;
|
||||
|
||||
byte _shadow_mode;
|
||||
byte *_shadow_table;
|
||||
|
||||
int _actorX, _actorY;
|
||||
byte _zbuf;
|
||||
byte _scaleX, _scaleY;
|
||||
|
||||
int _draw_top, _draw_bottom;
|
||||
|
||||
protected:
|
||||
Scumm *_vm;
|
||||
int32 _numStrips;
|
||||
|
||||
// current move offset
|
||||
int _xmove, _ymove;
|
||||
|
||||
// whether to draw the actor mirrored
|
||||
bool _mirror;
|
||||
|
||||
// width and height of cel to decode
|
||||
int _width, _height;
|
||||
|
||||
public:
|
||||
BaseCostumeRenderer(Scumm *scumm) {
|
||||
_dirty_id = 0;
|
||||
_shadow_mode = 0;
|
||||
_shadow_table = 0;
|
||||
_actorX = _actorY = 0;
|
||||
_zbuf = 0;
|
||||
_scaleX = _scaleY = 0;
|
||||
_draw_top = _draw_bottom = 0;
|
||||
|
||||
_vm = scumm;
|
||||
_numStrips = _vm->gdi._numStrips;
|
||||
_xmove = _ymove = 0;
|
||||
_mirror = false;
|
||||
_width = _height = 0;
|
||||
}
|
||||
|
||||
virtual void setPalette(byte *palette) = 0;
|
||||
virtual void setFacing(Actor *a) = 0;
|
||||
virtual void setCostume(int costume) = 0;
|
||||
|
||||
byte drawCostume(const CostumeData &cost) {
|
||||
int i;
|
||||
byte result = 0;
|
||||
|
||||
_xmove = _ymove = 0;
|
||||
for (i = 0; i < 16; i++)
|
||||
result |= drawLimb(cost, i);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual byte drawLimb(const CostumeData &cost, int limb) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -274,11 +274,11 @@ byte CostumeRenderer::mainRoutine(int slot, int frame)
|
||||
if ((uint) _bottom > _outheight)
|
||||
_bottom = _outheight;
|
||||
|
||||
if (draw_top > _top)
|
||||
draw_top = _top;
|
||||
if (_draw_top > _top)
|
||||
_draw_top = _top;
|
||||
|
||||
if (draw_bottom < _bottom)
|
||||
draw_bottom = _bottom;
|
||||
if (_draw_bottom < _bottom)
|
||||
_draw_bottom = _bottom;
|
||||
|
||||
if (_height2 + _top >= 256) {
|
||||
CHECK_HEAP
|
||||
@ -1227,17 +1227,6 @@ void LoadedCostume::loadCostume(int id)
|
||||
_dataptr = _ptr + READ_LE_UINT16(_ptr + _numColors + 8);
|
||||
}
|
||||
|
||||
byte CostumeRenderer::drawCostume(const CostumeData &cost)
|
||||
{
|
||||
int i;
|
||||
byte result = 0;
|
||||
|
||||
_xmove = _ymove = 0;
|
||||
for (i = 0; i != 16; i++)
|
||||
result |= drawLimb(cost, i);
|
||||
return result;
|
||||
}
|
||||
|
||||
byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb)
|
||||
{
|
||||
int i;
|
||||
@ -1360,9 +1349,9 @@ void CostumeRenderer::setPalette(byte *palette)
|
||||
}
|
||||
}
|
||||
|
||||
void CostumeRenderer::setFacing(uint16 facing)
|
||||
void CostumeRenderer::setFacing(Actor *a)
|
||||
{
|
||||
_mirror = newDirToOldDir(facing) != 0 || (_loaded._ptr[7] & 0x80);
|
||||
_mirror = newDirToOldDir(a->facing) != 0 || (_loaded._ptr[7] & 0x80);
|
||||
}
|
||||
|
||||
void CostumeRenderer::setCostume(int costume)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef COSTUME_H
|
||||
#define COSTUME_H
|
||||
|
||||
class Scumm;
|
||||
#include "base-costume.h"
|
||||
|
||||
class LoadedCostume {
|
||||
protected:
|
||||
@ -42,38 +42,20 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class CostumeRenderer {
|
||||
class CostumeRenderer : public BaseCostumeRenderer {
|
||||
public:
|
||||
byte _dirty_id;
|
||||
|
||||
byte _shadow_mode;
|
||||
byte *_shadow_table;
|
||||
|
||||
int _actorX, _actorY;
|
||||
byte _zbuf;
|
||||
uint _scaleX, _scaleY;
|
||||
|
||||
int draw_top, draw_bottom;
|
||||
|
||||
uint _outheight;
|
||||
|
||||
protected:
|
||||
Scumm *_vm;
|
||||
int32 _numStrips;
|
||||
|
||||
LoadedCostume _loaded;
|
||||
|
||||
byte *_frameptr;
|
||||
byte *_srcptr;
|
||||
byte *_bgbak_ptr, *_backbuff_ptr, *_mask_ptr, *_mask_ptr_dest;
|
||||
int _xmove, _ymove;
|
||||
bool _mirror;
|
||||
byte _maskval;
|
||||
byte _shrval;
|
||||
byte _width2;
|
||||
int _width;
|
||||
byte _height2;
|
||||
int _height;
|
||||
int _xpos, _ypos;
|
||||
|
||||
int _scaleIndexXStep;
|
||||
@ -92,14 +74,12 @@ protected:
|
||||
byte _palette[32];
|
||||
|
||||
public:
|
||||
CostumeRenderer(Scumm *vm) : _vm(vm), _numStrips(vm->gdi._numStrips), _loaded(vm) {}
|
||||
CostumeRenderer(Scumm *vm) : BaseCostumeRenderer(vm), _loaded(vm) {}
|
||||
|
||||
void setPalette(byte *palette);
|
||||
void setFacing(uint16 facing);
|
||||
void setFacing(Actor *a);
|
||||
void setCostume(int costume);
|
||||
|
||||
byte drawCostume(const CostumeData &cost);
|
||||
|
||||
protected:
|
||||
byte drawLimb(const CostumeData &cost, int limb);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user