[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.55,1.56 animation.h,1.30,1.31 rscfile.cpp,1.41,1.42 scene.cpp,1.146,1.147 scene.h,1.75,1.76
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Fri Sep 23 07:31:02 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30399
Modified Files:
animation.cpp animation.h rscfile.cpp scene.cpp scene.h
Log Message:
Experimental loading of the cutaway list. Next step will be to get ScummVM
to actually *play* the cutaways. I'll look into that later.
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- animation.cpp 13 Aug 2005 16:27:47 -0000 1.55
+++ animation.cpp 23 Sep 2005 14:29:26 -0000 1.56
@@ -36,6 +36,9 @@
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 @@
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;
Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- animation.h 4 Aug 2005 14:49:02 -0000 1.30
+++ animation.h 23 Sep 2005 14:29:26 -0000 1.31
@@ -33,7 +33,6 @@
#define MAX_ANIMATIONS 10
#define DEFAULT_FRAME_TIME 140
-
#define SAGA_FRAME_START 0xF
#define SAGA_FRAME_END 0x3F
#define SAGA_FRAME_NOOP 0x1F
@@ -52,6 +51,15 @@
ANIM_ENDSCENE = 0x80 // When animation ends, dispatch scene end event
};
+// Cutaway info array member. Cutaways are basically animations with a really
+// bad attitude.
+struct Cutaway {
+ uint16 backgroundID;
+ uint16 frameID;
+ int16 maxFrame;
+ int16 frameRate;
+};
+
// Animation info array member
struct AnimationData {
byte *resourceData;
@@ -99,6 +107,9 @@
Anim(SagaEngine *vm);
~Anim(void);
+ void loadCutawayList(const byte *resourcePointer, size_t resourceLength);
+ void freeCutawayList(void);
+
void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
void freeId(uint16 animId);
void play(uint16 animId, int vectorTime, bool playing = true);
@@ -156,7 +167,8 @@
SagaEngine *_vm;
AnimationData *_animations[MAX_ANIMATIONS];
-
+ Cutaway *_cutawayList;
+ int _cutawayListLength;
};
} // End of namespace Saga
Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- rscfile.cpp 21 Sep 2005 10:09:58 -0000 1.41
+++ rscfile.cpp 23 Sep 2005 14:29:26 -0000 1.42
@@ -25,6 +25,7 @@
#include "saga/saga.h"
#include "saga/actor.h"
+#include "saga/animation.h"
#include "saga/interface.h"
#include "saga/music.h"
#include "saga/rscfile.h"
@@ -521,11 +522,15 @@
_vm->_actor->loadObjList(_metaResource.objectCount, _metaResource.objectsResourceID);
- // TODO: cutawayList
+ _vm->_resource->loadResource(resourceContext, _metaResource.cutawayListResourceID, resourcePointer, resourceLength);
- // TODO: songTable Long
- _vm->_resource->loadResource(resourceContext, _metaResource.songTableID,
- resourcePointer, resourceLength);
+ if (resourceLength == 0) {
+ error("Resource::loadGlobalResources Can't load cutaway list");
+ }
+
+ _vm->_anim->loadCutawayList(resourcePointer, resourceLength);
+
+ _vm->_resource->loadResource(resourceContext, _metaResource.songTableID, resourcePointer, resourceLength);
if (resourceLength == 0) {
error("Resource::loadGlobalResources Can't load songs list for current track");
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- scene.cpp 3 Sep 2005 10:35:34 -0000 1.146
+++ scene.cpp 23 Sep 2005 14:29:26 -0000 1.147
@@ -478,12 +478,6 @@
loadScene(&sceneParams);
}
-void Scene::freeCutawayList() {
- // TODO
- // It has to be in different class
- warning("STUB: freeCutawayList()");
-}
-
void Scene::getSlopes(int &beginSlope, int &endSlope) {
beginSlope = _vm->getSceneHeight() - _sceneDescription.beginSlope;
endSlope = _vm->getSceneHeight() - _sceneDescription.endSlope;
@@ -608,7 +602,7 @@
if (loadSceneParams->chapter == 6)
_vm->_interface->setLeftPortrait(0);
- freeCutawayList();
+ _vm->_anim->freeCutawayList();
_vm->_script->freeModules();
// deleteAllScenes();
Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- scene.h 13 Aug 2005 19:41:11 -0000 1.75
+++ scene.h 23 Sep 2005 14:29:26 -0000 1.76
@@ -251,11 +251,9 @@
_sceneQueue.clear();
}
void changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType, int chapter = NO_CHAPTER_CHANGE);
- void freeCutawayList();
bool isSceneLoaded() const { return _sceneLoaded; }
-
int getSceneResourceId(int sceneNumber) {
if ((sceneNumber < 0) || (sceneNumber >= _sceneCount)) {
error("getSceneResourceId: wrong sceneNumber %i", sceneNumber);
More information about the Scummvm-git-logs
mailing list