ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

chore.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_CHORE_H
00024 #define GRIM_CHORE_H
00025 
00026 #include "engines/grim/animation.h"
00027 
00028 namespace Grim {
00029 
00030 class Costume;
00031 class Animation;
00032 class Component;
00033 class TextSplitter;
00034 
00035 struct TrackKey {
00036     int time, value;
00037 };
00038 
00039 struct ChoreTrack {
00040     int compID;
00041     int numKeys;
00042     TrackKey *keys;
00043     Component *component;
00044 };
00045 
00046 class Chore {
00047 public:
00048     Chore(char name[32], int id, Costume *owner, int length, int numTracks);
00049     virtual ~Chore();
00050 
00051     void load(TextSplitter &ts);
00052     virtual void play(uint msecs);
00053     virtual void playLooping(uint msecs);
00054     void setLooping(bool val) { _looping = val; }
00055     virtual void stop(uint msecs);
00056     virtual void update(uint time);
00057     void setLastFrame();
00058     void fadeIn(uint msecs);
00059     void fadeOut(uint msecs);
00060     void setPaused(bool paused);
00061 
00062     bool isPlaying() { return _playing; }
00063     bool isPaused() { return _paused; }
00064     bool isLooping() { return _looping; }
00065 
00066     void advance(uint msecs);
00067 
00068     const char *getName() const { return _name; }
00069 
00070     int getChoreId() { return _choreId; }
00071 
00072     Costume *getOwner() { return _owner; }
00073 
00074     virtual void saveState(SaveGame *state) const;
00075     virtual void restoreState(SaveGame *state);
00076 protected:
00077     void setKeys(int startTime, int stopTime);
00078     virtual void fade(Animation::FadeMode, uint msecs);
00079     Component *getComponentForTrack(int i) const;
00080 
00081     Costume *_owner;
00082 
00083     int _choreId;
00084     int _length;
00085     int _numTracks;
00086     ChoreTrack *_tracks;
00087     char _name[32];
00088 
00089     bool _hasPlayed, _playing, _looping, _paused;
00090     int _currTime;
00091 
00092     friend class EMICostume;
00093 };
00094 
00095 } // end of namespace Grim
00096 
00097 #endif


Generated on Sat Mar 23 2019 05:01:22 for ResidualVM by doxygen 1.7.1
curved edge   curved edge