aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2005-10-29 01:59:18 +0000
committerTravis Howell2005-10-29 01:59:18 +0000
commite90ba2e929b48abe735057a8d36b594ec1810ea2 (patch)
tree057130a25adcc8f81e1894a8cdaefda0f11536dd /scumm
parent0b438df7ce91b0db78daffda77adcadfb02908f0 (diff)
downloadscummvm-rg350-e90ba2e929b48abe735057a8d36b594ec1810ea2.tar.gz
scummvm-rg350-e90ba2e929b48abe735057a8d36b594ec1810ea2.tar.bz2
scummvm-rg350-e90ba2e929b48abe735057a8d36b594ec1810ea2.zip
Read from XMAP resource directly, instead of reading into memory.
svn-id: r19357
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp20
-rw-r--r--scumm/akos.cpp18
-rw-r--r--scumm/akos.h4
-rw-r--r--scumm/base-costume.h2
-rw-r--r--scumm/costume.cpp6
-rw-r--r--scumm/costume.h6
6 files changed, 27 insertions, 29 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 9b543873ce..0017b10191 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -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);
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 93401f15f5..f625f86e8a 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -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);
}
diff --git a/scumm/akos.h b/scumm/akos.h
index f49b16f67c..1b0d4bd0b9 100644
--- a/scumm/akos.h
+++ b/scumm/akos.h
@@ -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);
diff --git a/scumm/base-costume.h b/scumm/base-costume.h
index c1eee948ea..9a873daa55 100644
--- a/scumm/base-costume.h
+++ b/scumm/base-costume.h
@@ -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);
diff --git a/scumm/costume.cpp b/scumm/costume.cpp
index 35535205d8..345cd88e21 100644
--- a/scumm/costume.cpp
+++ b/scumm/costume.cpp
@@ -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);
}
diff --git a/scumm/costume.h b/scumm/costume.h
index 126115a307..f7fda1500c 100644
--- a/scumm/costume.h
+++ b/scumm/costume.h
@@ -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);