diff options
-rw-r--r-- | scumm/actor.cpp | 12 | ||||
-rw-r--r-- | scumm/akos.cpp | 12 | ||||
-rw-r--r-- | scumm/base-costume.cpp | 7 | ||||
-rw-r--r-- | scumm/costume.cpp | 10 | ||||
-rw-r--r-- | scumm/gfx.cpp | 16 | ||||
-rw-r--r-- | scumm/scumm.h | 8 |
6 files changed, 29 insertions, 36 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index c6d1497efc..9056b376aa 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -467,7 +467,7 @@ void Actor::startAnimActor(int f) { _needRedraw = true; if (f == _initFrame) _cost.reset(); - _vm->akos_decodeData(this, f, (uint) - 1); + _vm->costumeDecodeData(this, f, (uint) - 1); _frame = f; } } else { @@ -501,10 +501,7 @@ void Actor::startAnimActor(int f) { _cost.reset(); _auxBlock.visible = false; } - if (_vm->_features & GF_NEW_COSTUMES) - _vm->akos_decodeData(this, f, (uint) - 1); - else - _vm->cost_decodeData(this, f, (uint) - 1); + _vm->costumeDecodeData(this, f, (uint) - 1); _frame = f; } } @@ -573,10 +570,7 @@ void Actor::setDirection(int direction) { vald = _cost.frame[i]; if (vald == 0xFFFF) continue; - if (_vm->_features & GF_NEW_COSTUMES) - _vm->akos_decodeData(this, vald, aMask); - else - _vm->cost_decodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask); + _vm->costumeDecodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask); } _needRedraw = true; diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 1e4f0357d7..e09713a26f 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -148,13 +148,6 @@ bool ScummEngine::akos_hasManyDirections(int costume) { return (akhd->flags & 2) != 0; } -int ScummEngine::akos_frameToAnim(Actor *a, int frame) { - if (_version >= 7 && akos_hasManyDirections(a->_costume)) - return toSimpleDir(1, a->getFacing()) + frame * 8; - else - return newDirToOldDir(a->getFacing()) + frame * 4; -} - void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { uint anim; const byte *akos, *r; @@ -168,7 +161,10 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { if (a->_costume == 0) return; - anim = akos_frameToAnim(a, frame); + if (_version >= 7 && akos_hasManyDirections(a->_costume)) + anim = toSimpleDir(1, a->getFacing()) + frame * 8; + else + anim = newDirToOldDir(a->getFacing()) + frame * 4; akos = getResourceAddress(rtCostume, a->_costume); assert(akos); diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp index e7f13ec1ea..8c3fe18ba7 100644 --- a/scumm/base-costume.cpp +++ b/scumm/base-costume.cpp @@ -87,4 +87,11 @@ bool ScummEngine::isCostumeInUse(int cost) const { return false; } +void ScummEngine::costumeDecodeData(Actor *a, int frame, uint usemask) { + if (_features & GF_NEW_COSTUMES) + akos_decodeData(a, frame, usemask); + else + cost_decodeData(a, frame, usemask); +} + } // End of namespace Scumm diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 36b5bd9866..27c5a4ce5b 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -808,7 +808,7 @@ byte CostumeRenderer::drawLimb(const Actor *a, int limb) { } -extern void DecodeNESTileData(const byte *src, byte *dest); +extern void decodeNESTileData(const byte *src, byte *dest); void ScummEngine::cost_decodeNESCostumeGfx() { for (int n = 0; n < 2; n++) { @@ -817,16 +817,12 @@ void ScummEngine::cost_decodeNESCostumeGfx() { if (maxSprites == 0) maxSprites = 256; _v1MMNESCostumeGfx[n] = (byte *)calloc(maxSprites * 16, 1); - DecodeNESTileData(patTable,_v1MMNESCostumeGfx[n]); + decodeNESTileData(patTable,_v1MMNESCostumeGfx[n]); // We will not need it anymore nukeResource(rtCostume, v1MMNEScostTables[n][4]); } } -int ScummEngine::cost_frameToAnim(Actor *a, int frame) { - return newDirToOldDir(a->getFacing()) + frame * 4; -} - void ScummEngine::cost_decodeData(Actor *a, int frame, uint usemask) { const byte *r; uint mask, j; @@ -837,7 +833,7 @@ void ScummEngine::cost_decodeData(Actor *a, int frame, uint usemask) { lc.loadCostume(a->_costume); - anim = cost_frameToAnim(a, frame); + anim = newDirToOldDir(a->getFacing()) + frame * 4; if (anim > lc._numAnim) { return; diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index d0cc1a297c..509d297bb9 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1816,7 +1816,7 @@ void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const { } } -void DecodeNESTileData(const byte *src, byte *dest) { +void decodeNESTileData(const byte *src, byte *dest) { int len = READ_LE_UINT16(src); src += 2; const byte *end = src + len; int numtiles; @@ -1834,23 +1834,23 @@ void Gdi::decodeNESGfx(const byte *room) { if (_NESBaseTiles == 0) { byte *basetiles = _vm->getResourceAddress(rtCostume,37); _NESBaseTiles = basetiles[2]; - DecodeNESTileData(basetiles,_NESPatTable); + decodeNESTileData(basetiles,_NESPatTable); } const byte *gdata = room + READ_LE_UINT16(room + 0x0A); int tileset = *gdata++; int width = READ_LE_UINT16(room + 0x04); // int height = READ_LE_UINT16(room + 0x06); - int i; + int i, j, n; - DecodeNESTileData(_vm->getResourceAddress(rtCostume, 37 + tileset), _NESPatTable + _NESBaseTiles * 16); + decodeNESTileData(_vm->getResourceAddress(rtCostume, 37 + tileset), _NESPatTable + _NESBaseTiles * 16); for (i = 0; i < 16; i++) _NESPalette[i] = *gdata++; for (i = 0; i < 16; i++) { - int n = 0; _NESNametable[i][0] = _NESNametable[i][1] = 0; + n = 0; while (n < width) { byte data = *gdata++; - for (int j = 0; j < (data & 0x7F); j++) + for (j = 0; j < (data & 0x7F); j++) _NESNametable[i][2 + n++] = (data & 0x80) ? (*gdata++) : (*gdata); if (!(data & 0x80)) gdata++; @@ -1859,9 +1859,9 @@ void Gdi::decodeNESGfx(const byte *room) { } const byte *adata = room + READ_LE_UINT16(room + 0x0C); - for (int n = 0; n < 64;) { + for (n = 0; n < 64;) { byte data = *adata++; - for (int j = 0; j < (data & 0x7F); j++) + for (j = 0; j < (data & 0x7F); j++) _NESAttributes[n++] = (data & 0x80) ? (*adata++) : (*adata); if (!(n & 7) && (width == 0x1C)) n += 8; diff --git a/scumm/scumm.h b/scumm/scumm.h index dc85c9601e..4c7fbb6b32 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -810,8 +810,6 @@ protected: void processUpperActors(); int getActorFromPos(int x, int y); - bool isCostumeInUse(int i) const; - public: /* Actor AuxQueue stuff (HE) */ AuxBlock _auxBlocks[16]; @@ -836,9 +834,12 @@ public: int getTalkingActor(); // Wrapper around VAR_TALK_ACTOR for V1 Maniac void setTalkingActor(int variable); + // Generic costume code + void costumeDecodeData(Actor *a, int frame, uint usemask); + bool isCostumeInUse(int i) const; + // Costume class void cost_decodeData(Actor *a, int frame, uint usemask); - int cost_frameToAnim(Actor *a, int frame); void cost_decodeNESCostumeGfx(); // Akos Class @@ -857,7 +858,6 @@ public: void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2); void akos_processQueue(); void akos_decodeData(Actor *a, int frame, uint usemask); - int akos_frameToAnim(Actor *a, int frame); bool akos_hasManyDirections(int costume); protected: |