aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/animation.h
diff options
context:
space:
mode:
authorRobert Špalek2009-11-10 05:16:34 +0000
committerRobert Špalek2009-11-10 05:16:34 +0000
commite2ca397e63861b256d50ba5ea9550db3ac4421e5 (patch)
tree59886600416d6f6f680ccf4c6e4f65b4259c556d /engines/draci/animation.h
parent501dfa24895b15f3be8b50406e62fe557f3d0fb1 (diff)
downloadscummvm-rg350-e2ca397e63861b256d50ba5ea9550db3ac4421e5.tar.gz
scummvm-rg350-e2ca397e63861b256d50ba5ea9550db3ac4421e5.tar.bz2
scummvm-rg350-e2ca397e63861b256d50ba5ea9550db3ac4421e5.zip
Huge refactoring of data structures.
Replaced IDs of objects by pointers, which saves many lookups, each of which is horribly ineffective. Moved a lot of code into methods of structs now turned into objects. Tested the new code a lot and seems to work as well as the old code. svn-id: r45799
Diffstat (limited to 'engines/draci/animation.h')
-rw-r--r--engines/draci/animation.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/engines/draci/animation.h b/engines/draci/animation.h
index aff2680c37..b669d53272 100644
--- a/engines/draci/animation.h
+++ b/engines/draci/animation.h
@@ -62,7 +62,7 @@ class Animation {
typedef void (Animation::* AnimationCallback)();
public:
- Animation(DraciEngine *v, int index);
+ Animation(DraciEngine *v, int id, uint z, bool playing);
~Animation();
uint getZ() const { return _z; }
@@ -120,10 +120,13 @@ public:
void registerCallback(AnimationCallback callback) { _callback = callback; }
void doNothing() {}
- void stopAnimation();
void exitGameLoop();
void tellWalkingState();
+ void play();
+ void stop();
+ void del();
+
private:
uint nextFrameNum() const;
void deleteFrames();
@@ -174,17 +177,13 @@ public:
AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1) {}
~AnimationManager() { deleteAll(); }
- Animation *addAnimation(int id, uint z, bool playing);
- Animation *addText(int id, bool playing);
- Animation *addItem(int id, bool playing);
- void addOverlay(Drawable *overlay, uint z);
+ void insert(Animation *anim, bool allocateIndex);
+ Animation *load(uint animNum);
- void play(int id);
- void stop(int id);
void pauseAnimations();
void unpauseAnimations();
- void deleteAnimation(int id);
+ void deleteAnimation(Animation *anim);
void deleteOverlays();
void deleteAll();
@@ -195,11 +194,10 @@ public:
int getLastIndex() const { return _lastIndex; }
void deleteAfterIndex(int index);
- int getTopAnimationID(int x, int y) const;
+ const Animation *getTopAnimation(int x, int y) const;
private:
void sortAnimations();
- void insertAnimation(Animation *anim);
DraciEngine *_vm;