ScummVM API documentation
component.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_COMPONENT_H
23 #define GRIM_COMPONENT_H
24 
25 #include "math/matrix4.h"
26 
27 #include "engines/grim/object.h"
28 #include "engines/grim/animation.h"
29 
30 namespace Grim {
31 
32 typedef uint32 tag32;
33 
34 class Costume;
35 class CMap;
36 class SaveGame;
37 
38 class Component {
39 public:
40  Component(Component *parent, int parentID, const char *name, tag32 tag);
41 
42  CMap *getCMap();
43  virtual void setColormap(CMap *c);
44  bool isVisible();
45  Component *getParent() { return _parent; }
46  virtual void setMatrix(const Math::Matrix4 &) { };
47  virtual void init() { }
48  virtual void setKey(int) { }
49  virtual void setMapName(char *) { }
50  virtual int update(uint time) { return 0; }
51  virtual void animate() { }
52  virtual void draw() { }
53  virtual void reset() { }
54  virtual void fade(Animation::FadeMode, int) { }
55  virtual void advance(uint msecs) { }
56  virtual void setPaused(bool paused) { }
57  virtual void resetColormap() { }
58  virtual void saveState(SaveGame *) { }
59  virtual void restoreState(SaveGame *) { }
60  virtual ~Component();
61 
62  bool isComponentType(char a0, char a1, char a2, char a3) { return _tag == MKTAG(a0, a1, a2, a3); }
63 
64 protected:
65  ObjectPtr<CMap> _cmap, _previousCmap;
66  tag32 _tag;
67  int _parentID;
68  bool _visible;
69  Component *_parent, *_child, *_sibling;
70  Costume *_cost;
71  Common::String _name;
72 
73  void setCostume(Costume *cost) { _cost = cost; }
74  void setParent(Component *newParent);
75  void removeChild(Component *child);
76  void resetHierCMap();
77 
78  friend class Costume;
79  friend class EMICostume;
80 };
81 
82 } // end of namespace Grim
83 
84 #endif
Definition: str.h:59
Definition: savegame.h:33
Definition: actor.h:33
Definition: colormap.h:35
Definition: costumeemi.h:40
Definition: component.h:38
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: object.h:69
Definition: costume.h:45