diff options
author | Max Horn | 2005-03-27 01:07:22 +0000 |
---|---|---|
committer | Max Horn | 2005-03-27 01:07:22 +0000 |
commit | abcf7bf2de88c3926843fa3fd613e50f5ea63cd5 (patch) | |
tree | ac27f9a9639270ceff80adb478f19fba339ea9bc /scumm/akos.cpp | |
parent | 5bd26a52df502391714b539df30eb76e50c72cf7 (diff) | |
download | scummvm-rg350-abcf7bf2de88c3926843fa3fd613e50f5ea63cd5.tar.gz scummvm-rg350-abcf7bf2de88c3926843fa3fd613e50f5ea63cd5.tar.bz2 scummvm-rg350-abcf7bf2de88c3926843fa3fd613e50f5ea63cd5.zip |
Tie the AKOS code into the new costume infrastructure, too
svn-id: r17259
Diffstat (limited to 'scumm/akos.cpp')
-rw-r--r-- | scumm/akos.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 28ef532c93..920141d4af 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -137,20 +137,21 @@ static bool akos_compare(int a, int b, byte cmd) { } } -bool ScummEngine::akos_hasManyDirections(int costume) { - byte *akos; - const AkosHeader *akhd; +void AkosCostumeLoader::loadCostume(int id) { + _akos = _vm->getResourceAddress(rtCostume, id); + assert(_akos); +} - akos = getResourceAddress(rtCostume, costume); - assert(akos); +bool AkosCostumeLoader::hasManyDirections() { + const AkosHeader *akhd; - akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos); + akhd = (const AkosHeader *)_vm->findResourceData(MKID('AKHD'), _akos); return (akhd->flags & 2) != 0; } -void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { +void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { uint anim; - const byte *akos, *r; + const byte *r; const AkosHeader *akhd; uint offs; int i; @@ -161,20 +162,19 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { if (a->_costume == 0) return; - if (_version >= 7 && akos_hasManyDirections(a->_costume)) + loadCostume(a->_costume); + + if (_vm->_version >= 7 && hasManyDirections()) anim = toSimpleDir(1, a->getFacing()) + frame * 8; else anim = newDirToOldDir(a->getFacing()) + frame * 4; - akos = getResourceAddress(rtCostume, a->_costume); - assert(akos); - - akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos); + akhd = (const AkosHeader *)_vm->findResourceData(MKID('AKHD'), _akos); if (anim >= READ_LE_UINT16(&akhd->num_anims)) return; - r = findResourceData(MKID('AKCH'), akos); + r = _vm->findResourceData(MKID('AKCH'), _akos); assert(r); offs = READ_LE_UINT16(r + anim * sizeof(uint16)); @@ -182,8 +182,8 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { return; r += offs; - const uint8 *akst = findResourceData(MKID('AKST'), akos); - const uint8 *aksf = findResourceData(MKID('AKSF'), akos); + const uint8 *akst = _vm->findResourceData(MKID('AKST'), _akos); + const uint8 *aksf = _vm->findResourceData(MKID('AKSF'), _akos); i = 0; mask = READ_LE_UINT16(r); r += 2; @@ -201,7 +201,7 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { a->_cost.seq3[i] = 0; if (akst) { - int size = getResourceDataSize(akst) / 8; + int size = _vm->getResourceDataSize(akst) / 8; if (size > 0) { bool found = false; while (size--) { @@ -231,7 +231,7 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { a->_cost.seq1[i] = 0; a->_cost.seq2[i] = 0; if (aksf) { - int size = getResourceDataSize(aksf) / 6; + int size = _vm->getResourceDataSize(aksf) / 6; if (size > 0) { bool found = false; while (size--) { @@ -256,7 +256,7 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) { a->_cost.curpos[i] = start; a->_cost.seq3[i] = 0; if (akst) { - int size = getResourceDataSize(akst) / 8; + int size = _vm->getResourceDataSize(akst) / 8; if (size > 0) { bool found = false; while (size--) { @@ -1239,6 +1239,10 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { return 0; } +byte AkosCostumeLoader::increaseAnims(Actor *a) { + return _vm->akos_increaseAnims(_akos, a); +} + bool ScummEngine::akos_increaseAnims(const byte *akos, Actor *a) { const byte *aksq, *akfo; int i; |