aboutsummaryrefslogtreecommitdiff
path: root/saga/animation.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-09-24 10:13:17 +0000
committerTorbjörn Andersson2005-09-24 10:13:17 +0000
commitee4b2ccb02bc53f3c861ac899985796ebd0ce2a0 (patch)
tree4db0792e283c8ad4c8d2552b8764bad079f6e228 /saga/animation.cpp
parente077fdd9eda8a4eb455810b994deef8cc1805311 (diff)
downloadscummvm-rg350-ee4b2ccb02bc53f3c861ac899985796ebd0ce2a0.tar.gz
scummvm-rg350-ee4b2ccb02bc53f3c861ac899985796ebd0ce2a0.tar.bz2
scummvm-rg350-ee4b2ccb02bc53f3c861ac899985796ebd0ce2a0.zip
Some more preliminary cutaway work. The backgrounds are displayed now, but
not the animations themselves. Still, it's enough to make the IHNM intro look fairly interesting. svn-id: r18874
Diffstat (limited to 'saga/animation.cpp')
-rw-r--r--saga/animation.cpp53
1 files changed, 50 insertions, 3 deletions
diff --git a/saga/animation.cpp b/saga/animation.cpp
index 799fd3f974..33082058af 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -27,7 +27,10 @@
#include "saga/console.h"
#include "saga/events.h"
+#include "saga/interface.h"
#include "saga/render.h"
+#include "saga/rscfile.h"
+#include "saga/scene.h"
#include "saga/animation.h"
@@ -55,8 +58,8 @@ void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) {
MemoryReadStream cutawayS(resourcePointer, resourceLength);
for (int i = 0; i < _cutawayListLength; i++) {
- _cutawayList[i].backgroundID = cutawayS.readUint16LE();
- _cutawayList[i].frameID = cutawayS.readUint16LE();
+ _cutawayList[i].backgroundResourceId = cutawayS.readUint16LE();
+ _cutawayList[i].animResourceId = cutawayS.readUint16LE();
_cutawayList[i].maxFrame = (int16)cutawayS.readUint16LE();
_cutawayList[i].frameRate = (int16)cutawayS.readUint16LE();
}
@@ -68,6 +71,51 @@ void Anim::freeCutawayList(void) {
_cutawayListLength = 0;
}
+void Anim::playCutaway(int cut, bool fade) {
+ debug(0, "playCutaway(%d, %d)", cut, fade);
+
+ if (fade) {
+ // TODO: Fade down. Is this blocking or non-blocking?
+ }
+
+ // TODO: Stop all other animations
+
+ _vm->_gfx->showCursor(false);
+ _vm->_interface->setStatusText("");
+ _vm->_interface->setSaveReminderState(0);
+
+ // TODO: Hide the inventory. Perhaps by adding a new panel mode?
+
+ // Set the initial background and palette for the cutaway
+
+ ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
+
+ byte *resourceData;
+ size_t resourceDataLength;
+
+ _vm->_resource->loadResource(context, _cutawayList[cut].backgroundResourceId, resourceData, resourceDataLength);
+
+ byte *buf;
+ size_t buflen;
+ int width;
+ int height;
+
+ _vm->decodeBGImage(resourceData, resourceDataLength, &buf, &buflen, &width, &height);
+
+ PalEntry *palette = (PalEntry *)_vm->getImagePal(resourceData, resourceDataLength);
+
+ Surface *bgSurface = _vm->_render->getBackGroundSurface();
+ const Rect rect(width, height);
+
+ bgSurface->blit(rect, buf);
+ _vm->_gfx->setPalette(palette);
+
+ free(buf);
+ free(resourceData);
+
+ // TODO: Start the animation
+}
+
void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
AnimationData *anim;
uint16 temp;
@@ -230,7 +278,6 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
event.time = frameTime;
_vm->_events->queue(&event);
-
}
void Anim::stop(uint16 animId) {