diff options
author | Torbjörn Andersson | 2005-09-23 14:29:26 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-09-23 14:29:26 +0000 |
commit | 1897e6046ba105d03c164c24b991558754db92fc (patch) | |
tree | 96aeca8d9617bc993927de5a0f7ba3bf0a5b0c27 /saga/animation.cpp | |
parent | 843399b9e8ca0faa2426a683c36898c9bb37ce21 (diff) | |
download | scummvm-rg350-1897e6046ba105d03c164c24b991558754db92fc.tar.gz scummvm-rg350-1897e6046ba105d03c164c24b991558754db92fc.tar.bz2 scummvm-rg350-1897e6046ba105d03c164c24b991558754db92fc.zip |
Experimental loading of the cutaway list. Next step will be to get ScummVM
to actually *play* the cutaways. I'll look into that later.
svn-id: r18865
Diffstat (limited to 'saga/animation.cpp')
-rw-r--r-- | saga/animation.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/saga/animation.cpp b/saga/animation.cpp index 732c32efa2..799fd3f974 100644 --- a/saga/animation.cpp +++ b/saga/animation.cpp @@ -36,6 +36,9 @@ namespace Saga { Anim::Anim(SagaEngine *vm) : _vm(vm) { uint16 i; + _cutawayList = NULL; + _cutawayListLength = 0; + for (i = 0; i < MAX_ANIMATIONS; i++) _animations[i] = NULL; } @@ -44,6 +47,27 @@ Anim::~Anim(void) { reset(); } +void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) { + free(_cutawayList); + _cutawayListLength = resourceLength / 8; + _cutawayList = (Cutaway *)malloc(_cutawayListLength * sizeof(Cutaway)); + + MemoryReadStream cutawayS(resourcePointer, resourceLength); + + for (int i = 0; i < _cutawayListLength; i++) { + _cutawayList[i].backgroundID = cutawayS.readUint16LE(); + _cutawayList[i].frameID = cutawayS.readUint16LE(); + _cutawayList[i].maxFrame = (int16)cutawayS.readUint16LE(); + _cutawayList[i].frameRate = (int16)cutawayS.readUint16LE(); + } +} + +void Anim::freeCutawayList(void) { + free(_cutawayList); + _cutawayList = NULL; + _cutawayListLength = 0; +} + void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) { AnimationData *anim; uint16 temp; |