diff options
author | Denis Kasak | 2009-07-24 05:00:53 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-24 05:00:53 +0000 |
commit | c1ad0c3926f4d53a9c5fdefefde9344d4abb6f10 (patch) | |
tree | b6927f0a7416aa6148ea023d9bb0a5460fef00cf /engines/draci/animation.h | |
parent | a2bca06b3fe00379d8accf29e7f442fe0a3cd781 (diff) | |
download | scummvm-rg350-c1ad0c3926f4d53a9c5fdefefde9344d4abb6f10.tar.gz scummvm-rg350-c1ad0c3926f4d53a9c5fdefefde9344d4abb6f10.tar.bz2 scummvm-rg350-c1ad0c3926f4d53a9c5fdefefde9344d4abb6f10.zip |
* Added tracking and deleting animations by index (which represents the order in which they were loaded). This is needed by some GPL commands.
* Added Game::getNumObjects() which returns the number of objects in the game
* Fixed segfault (accessing a null Animation *)
* Added some docs to various things
svn-id: r42683
Diffstat (limited to 'engines/draci/animation.h')
-rw-r--r-- | engines/draci/animation.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/engines/draci/animation.h b/engines/draci/animation.h index 683af7c812..5229972543 100644 --- a/engines/draci/animation.h +++ b/engines/draci/animation.h @@ -30,16 +30,30 @@ namespace Draci { +/** + * Animation IDs for those animations that don't have their IDs + * specified in the data files. + */ enum { kOverlayImage = -1, kWalkingMapOverlay = -2, kUnused = -3 }; +/** + * Default argument to Animation::getFrame() that makes it return + * the current frame instead of the user specifying it. + */ enum { kCurrentFrame = -1 }; +/** + * Used by overlays as a neutral index that won't get + * released with the GPL Release command. + */ +enum { kIgnoreIndex = -2 }; + class DraciEngine; class Animation { public: - Animation(DraciEngine *vm); + Animation(DraciEngine *v, int index); ~Animation(); uint getZ(); @@ -66,6 +80,9 @@ public: int getRelativeX(); int getRelativeY(); + int getIndex(); + void setIndex(int index); + void setScaleFactors(double scaleX, double scaleY); void markDirtyRect(Surface *surface); @@ -74,7 +91,16 @@ private: uint nextFrameNum(); - int _id; + /** Internal animation ID + * (as specified in the data files and the bytecode) + */ + int _id; + + /** The recency index of an animation, i.e. the most recently added animation has + * the highest index. Some script commands need this. + */ + int _index; + uint _currentFrame; uint _z; @@ -96,7 +122,7 @@ private: class AnimationManager { public: - AnimationManager(DraciEngine *vm) : _vm(vm) {}; + AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1) {} ~AnimationManager() { deleteAll(); } Animation *addAnimation(int id, uint z, bool playing = false); @@ -113,12 +139,20 @@ public: Animation *getAnimation(int id); + int getLastIndex(); + void deleteAfterIndex(int index); + private: void sortAnimations(); void insertAnimation(Animation *anim); DraciEngine *_vm; Common::List<Animation *> _animations; + + /** The index of the most recently added animation. + * See Animation::_index for details. + */ + int _lastIndex; }; } |