From 1897e6046ba105d03c164c24b991558754db92fc Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 23 Sep 2005 14:29:26 +0000 Subject: 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 --- saga/animation.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'saga/animation.cpp') 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; -- cgit v1.2.3