Read from XMAP resource directly, instead of reading into memory.

svn-id: r19357
This commit is contained in:
Travis Howell 2005-10-29 01:59:18 +00:00
parent 0b438df7ce
commit e90ba2e929
6 changed files with 27 additions and 29 deletions

View File

@ -1106,27 +1106,13 @@ void Actor::drawActorCostume(bool hitTestMode) {
}
bcr->_shadow_mode = _shadowMode;
if (_vm->_features & GF_SMALL_HEADER) {
bcr->_shadow_table = NULL;
#ifndef DISABLE_HE
} else if (_vm->_heversion >= 95 && _heXmapNum) {
byte shadow_table[65536];
const uint8 *dataPtr = _vm->getResourceAddress(rtImage, _heXmapNum);
assert(dataPtr);
const uint8 *xmapPtr = _vm->findResourceData(MKID('XMAP'), dataPtr);
assert(xmapPtr);
int32 size = _vm->getResourceDataSize(xmapPtr);
assert(size == 65536);
memcpy(shadow_table, xmapPtr, size);
bcr->_shadow_table = shadow_table;
if (_vm->_version >= 5 && _vm->_heversion == 0) {
bcr->_shadow_table = _vm->_shadowPalette;
} else if (_vm->_heversion == 70) {
bcr->_shadow_table = _vm->_HEV7ActorPalette;
#endif
} else {
bcr->_shadow_table = _vm->_shadowPalette;
}
bcr->setCostume(_costume);
bcr->setCostume(_costume, _heXmapNum);
bcr->setPalette(_palette);
bcr->setFacing(this);

View File

@ -324,7 +324,7 @@ void AkosRenderer::setPalette(byte *new_palette) {
}
}
void AkosRenderer::setCostume(int costume) {
void AkosRenderer::setCostume(int costume, int shadow) {
akos = _vm->getResourceAddress(rtCostume, costume);
assert(akos);
@ -336,6 +336,13 @@ void AkosRenderer::setCostume(int costume) {
akpl = _vm->findResourceData(MKID('AKPL'), akos);
codec = READ_LE_UINT16(&akhd->codec);
akct = _vm->findResourceData(MKID('AKCT'), akos);
if (shadow) {
const uint8 *xmapPtr = _vm->getResourceAddress(rtImage, shadow);
assert(xmapPtr);
xmap = _vm->findResourceData(MKID('XMAP'), xmapPtr);
assert(xmap);
}
}
void AkosRenderer::setFacing(const Actor *a) {
@ -491,7 +498,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) {
continue;
if (_vm->_heversion >= 95) {
_shadow_mode = ((shadowMask & 0x8000) && _shadow_table) ? 3 : 0;
_shadow_mode = ((shadowMask & 0x8000) && xmap) ? 3 : 0;
}
switch (codec) {
@ -565,7 +572,10 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
} else if (_shadow_mode == 2) {
error("codec1_spec2"); // TODO
} else if (_shadow_mode == 3) {
if (_vm->_heversion >= 95 || pcolor < 8) {
if (_vm->_heversion >= 95) {
pcolor = (pcolor << 8) + *dst;
pcolor = xmap[pcolor];
} else if (pcolor < 8) {
pcolor = (pcolor << 8) + *dst;
pcolor = _shadow_table[pcolor];
}
@ -1323,7 +1333,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
byte *dstPtr = (byte *)_out.pixels + dst.left + dst.top * _out.pitch;
if (_shadow_mode == 3) {
Wiz::decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src, palPtr, _shadow_table);
Wiz::decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src, palPtr, xmap);
} else {
Wiz::decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src, palPtr);
}

View File

@ -67,6 +67,7 @@ protected:
const AkosOffset *akof;
const byte *akcd;
const byte *akct;
const uint8 *xmap;
struct {
byte unk5;
@ -90,6 +91,7 @@ public:
akof = 0;
akcd = 0;
akct = 0;
xmap = 0;
_actorHitMode = false;
}
@ -99,7 +101,7 @@ public:
void setPalette(byte *palette);
void setFacing(const Actor *a);
void setCostume(int costume);
void setCostume(int costume, int shadow);
protected:
byte drawLimb(const Actor *a, int limb);

View File

@ -151,7 +151,7 @@ public:
virtual void setPalette(byte *palette) = 0;
virtual void setFacing(const Actor *a) = 0;
virtual void setCostume(int costume) = 0;
virtual void setCostume(int costume, int shadow) = 0;
byte drawCostume(const VirtScreen &vs, int numStrips, const Actor *a, bool drawToBackBuf);

View File

@ -781,7 +781,7 @@ void NESCostumeRenderer::setFacing(const Actor *a) {
//_mirror = newDirToOldDir(a->getFacing()) != 0 || _loaded._mirror;
}
void NESCostumeRenderer::setCostume(int costume) {
void NESCostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);
}
@ -888,7 +888,7 @@ void ClassicCostumeRenderer::setFacing(const Actor *a) {
_mirror = newDirToOldDir(a->getFacing()) != 0 || _loaded._mirror;
}
void ClassicCostumeRenderer::setCostume(int costume) {
void ClassicCostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);
}
@ -1120,7 +1120,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
return 0;
}
void C64CostumeRenderer::setCostume(int costume) {
void C64CostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);
}

View File

@ -92,7 +92,7 @@ public:
void setPalette(byte *palette);
void setFacing(const Actor *a);
void setCostume(int costume);
void setCostume(int costume, int shadow);
protected:
byte drawLimb(const Actor *a, int limb);
@ -114,7 +114,7 @@ public:
void setPalette(byte *palette);
void setFacing(const Actor *a);
void setCostume(int costume);
void setCostume(int costume, int shadow);
protected:
byte drawLimb(const Actor *a, int limb);
@ -129,7 +129,7 @@ public:
void setPalette(byte *palette) {}
void setFacing(const Actor *a) {}
void setCostume(int costume);
void setCostume(int costume, int shadow);
protected:
byte drawLimb(const Actor *a, int limb);