ScummVM API documentation
chore.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRIM_CHORE_H
23 #define GRIM_CHORE_H
24 
25 #include "engines/grim/animation.h"
26 
27 namespace Grim {
28 
29 class Costume;
30 class Animation;
31 class Component;
32 class TextSplitter;
33 
34 struct TrackKey {
35  int time, value;
36 };
37 
38 struct ChoreTrack {
39  int compID;
40  int numKeys;
41  TrackKey *keys;
42  Component *component;
43 };
44 
45 class Chore {
46 public:
47  Chore(char name[32], int id, Costume *owner, int length, int numTracks);
48  virtual ~Chore();
49 
50  void load(TextSplitter &ts);
51  virtual void play(uint msecs);
52  virtual void playLooping(uint msecs);
53  void setLooping(bool val) { _looping = val; }
54  virtual void stop(uint msecs);
55  virtual void update(uint time);
56  void setLastFrame();
57  void fadeIn(uint msecs);
58  void fadeOut(uint msecs);
59  void setPaused(bool paused);
60 
61  bool isPlaying() { return _playing; }
62  bool isPaused() { return _paused; }
63  bool isLooping() { return _looping; }
64 
65  void advance(uint msecs);
66 
67  const char *getName() const { return _name; }
68 
69  int getChoreId() { return _choreId; }
70 
71  Costume *getOwner() { return _owner; }
72 
73  virtual void saveState(SaveGame *state) const;
74  virtual void restoreState(SaveGame *state);
75 protected:
76  void setKeys(int startTime, int stopTime);
77  virtual void fade(Animation::FadeMode, uint msecs);
78  Component *getComponentForTrack(int i) const;
79 
80  Costume *_owner;
81 
82  int _choreId;
83  int _length;
84  int _numTracks;
85  ChoreTrack *_tracks;
86  char _name[32];
87 
88  bool _hasPlayed, _playing, _looping, _paused;
89  int _currTime;
90 
91  friend class EMICostume;
92 };
93 
94 } // end of namespace Grim
95 
96 #endif
Definition: savegame.h:33
Definition: actor.h:33
Definition: chore.h:34
Definition: chore.h:38
Definition: costumeemi.h:40
Definition: component.h:38
Definition: textsplit.h:35
Definition: chore.h:45
Definition: costume.h:45