aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
Diffstat (limited to 'saga')
-rw-r--r--saga/animation.cpp22
-rw-r--r--saga/animation.h2
-rw-r--r--saga/scene.cpp19
-rw-r--r--saga/scene.h8
4 files changed, 8 insertions, 43 deletions
diff --git a/saga/animation.cpp b/saga/animation.cpp
index 1b89969e64..6ce761187e 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -44,20 +44,10 @@ Anim::~Anim(void) {
reset();
}
-uint16 Anim::load(const byte *animResourceData, size_t animResourceLength) {
+void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
AnimationData *anim;
- uint16 animId = 0;
- uint16 i;
- // Find an unused animation slot
- for (i = 0; i < MAX_ANIMATIONS; i++) {
- if (_animations[i] == NULL) {
- animId = i;
- break;
- }
- }
-
- if (animId == MAX_ANIMATIONS) {
+ if (animId >= MAX_ANIMATIONS) {
error("Anim::load could not find unused animation slot");
}
@@ -74,8 +64,6 @@ uint16 Anim::load(const byte *animResourceData, size_t animResourceLength) {
anim->loopFrame = headerReadS.readByte() - 1;
anim->start = headerReadS.readUint16BE();
- if (anim->start != 65535 && anim->start != 0)
- warning("Anim::load: found different start: %d. Fix Anim::play()", anim->start);
anim->start += headerReadS.pos();
@@ -100,9 +88,7 @@ uint16 Anim::load(const byte *animResourceData, size_t animResourceLength) {
anim->frameTime = DEFAULT_FRAME_TIME;
anim->flags = 0;
anim->linkId = -1;
- anim->state = ANIM_PAUSE;
-
- return animId;
+ anim->state = ANIM_PAUSE;
}
void Anim::link(int16 animId1, int16 animId2) {
@@ -814,7 +800,7 @@ void Anim::animInfo() {
for (i = 0; i < MAX_ANIMATIONS; i++) {
if (_animations[i] == NULL) {
- break;
+ continue;
}
_vm->_console->DebugPrintf("%02d: Frames: %u Flags: %u\n", i, _animations[i]->maxFrame, _animations[i]->flags);
diff --git a/saga/animation.h b/saga/animation.h
index ca6c027f73..184c122ce9 100644
--- a/saga/animation.h
+++ b/saga/animation.h
@@ -116,7 +116,7 @@ public:
Anim(SagaEngine *vm);
~Anim(void);
- uint16 load(const byte *animResourceData, size_t animResourceLength);
+ void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
void freeId(uint16 animId);
void play(uint16 animId, int vectorTime, bool playing = true);
void link(int16 animId1, int16 animId2);
diff --git a/saga/scene.cpp b/saga/scene.cpp
index b313623096..778bb6873d 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -114,7 +114,6 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) {
memset(&_sceneDescription, 0, sizeof(_sceneDescription));
_resListEntries = 0;
_resList = NULL;
- _animEntries = 0;
_sceneProc = NULL;
_objectMap = new ObjectMap(_vm);
_actionMap = new ObjectMap(_vm);
@@ -831,19 +830,11 @@ int Scene::processSceneResources() {
case SAGA_ANIM_6:
case SAGA_ANIM_7:
{
- uint16 animId;
+ uint16 animId = _resList[i].res_type - SAGA_ANIM_1;
- debug(0, "Loading animation resource...");
+ debug(0, "Loading animation resource animId=%i", animId);
- animId = _vm->_anim->load(resourceData, resourceDataLength);
-
- SCENE_ANIMINFO *new_animinfo;
-
- new_animinfo = _animList.pushBack().operator->();
-
- new_animinfo->anim_handle = animId;
- new_animinfo->anim_res_number = _resList[i].res_number;
- _animEntries++;
+ _vm->_anim->load(animId, resourceData, resourceDataLength);
}
break;
case SAGA_ISO_MULTI:
@@ -949,10 +940,6 @@ void Scene::endScene() {
_sceneStrings.freeMem();
_vm->_isoMap->freeMem();
- _animList.clear();
-
- _animEntries = 0;
-
_vm->_events->clearList();
_vm->textClearList(_textList);
diff --git a/saga/scene.h b/saga/scene.h
index 21f2ac31e7..cf0dc19c85 100644
--- a/saga/scene.h
+++ b/saga/scene.h
@@ -148,12 +148,6 @@ struct SCENE_IMAGE {
PALENTRY pal[256];
};
-struct SCENE_ANIMINFO {
- int anim_res_number;
- int anim_handle;
-};
-
-typedef SortedList<SCENE_ANIMINFO> SceneAnimInfoList;
enum SceneTransitionType {
kTransitionNoFade,
@@ -298,8 +292,6 @@ class Scene {
SceneDescription _sceneDescription;
int _resListEntries;
SCENE_RESLIST *_resList;
- int _animEntries;
- SceneAnimInfoList _animList;
SceneProc *_sceneProc;
SCENE_IMAGE _bg;
SCENE_IMAGE _bgMask;