ScummVM API documentation
costume.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_COSTUME_H
23 #define GRIM_COSTUME_H
24 
25 #include "common/str.h"
26 
27 #include "math/matrix4.h"
28 
29 #include "engines/grim/object.h"
30 
31 namespace Grim {
32 
33 typedef uint32 tag32;
34 
35 class CMap;
36 class Model;
37 class ModelNode;
38 class TextSplitter;
39 class ModelComponent;
40 class Component;
41 class Chore;
42 class BaseHead;
43 class Actor;
44 
45 class Costume : public Object {
46 public:
47  Costume(const Common::String &filename, Actor *owner, Costume *prevCost);
48 
49  virtual ~Costume();
50  virtual void load(Common::SeekableReadStream *data);
51 
52  const Common::String &getFilename() const { return _fname; }
53  void playChore(const char *name, uint msecs = 0);
54  virtual void playChore(int num, uint msecs = 0);
55  void playChoreLooping(const char *name, uint msecs = 0);
56  virtual void playChoreLooping(int num, uint msecs = 0);
57  void setChoreLastFrame(int num);
58  void setChoreLooping(int num, bool val);
59  void stopChore(int num, uint msecs = 0);
60  void fadeChoreIn(int chore, uint msecs);
61  void fadeChoreOut(int chore, uint msecs);
62  ModelNode *getModelNodes();
63  Model *getModel();
64  void setColormap(const Common::String &map);
65  void stopChores(bool ignoreLoopingChores = false, int msecs = 0);
66  int isChoring(const char *name, bool excludeLooping);
67  int isChoring(int num, bool excludeLooping);
68  int isChoring(bool excludeLooping);
69  int getNumChores() const { return _numChores; }
70  Chore *getChore(const char *name);
71  Chore *getChore(int i) { return _chores[i]; }
72  int getChoreId(const char *name);
73  const Common::List<Chore *> &getPlayingChores() const { return _playingChores; }
74 
75  void setHead(int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw);
76  void setLookAtRate(float rate);
77  float getLookAtRate() const;
78  virtual void moveHead(bool entering, const Math::Vector3d &lookAt);
79  int getHeadJoint() const;
80 
81  CMap *getCMap() { return _cmap; }
82 
83  virtual int update(uint frameTime);
84  void animate();
85  virtual void draw();
86  void getBoundingBox(int *x1, int *y1, int *x2, int *y2);
87  void setPosRotate(const Math::Vector3d &pos, const Math::Angle &pitch,
88  const Math::Angle &yaw, const Math::Angle &roll);
89  Math::Matrix4 getMatrix() const;
90  Actor *getOwner() const { return _owner; }
91 
92  Costume *getPreviousCostume() const;
93 
94  virtual void saveState(SaveGame *state) const;
95  virtual bool restoreState(SaveGame *state);
96 
97  Component *getComponent(int num) { return _components[num]; }
98 protected:
99  virtual Component *loadComponent(tag32 tag, Component *parent, int parentID, const char *name, Component *prevComponent);
100 
101  void load(TextSplitter &ts, Costume *prevCost);
102 
103  ModelComponent *getMainModelComponent() const;
104 
105  Common::String _fname;
106  Costume *_prevCostume;
107 
108  int _numComponents;
109  Component **_components;
110 
111  BaseHead *_head;
112 
113  ObjectPtr<CMap> _cmap;
114  int _numChores;
115  Chore **_chores;
116  Common::List<Chore*> _playingChores;
117  Math::Matrix4 _matrix;
118  Actor *_owner;
119 
120  float _lookAtRate;
121 
122  friend class Chore;
123 };
124 
125 } // end of namespace Grim
126 
127 #endif
Definition: str.h:59
Definition: head.h:32
Definition: list.h:44
Definition: savegame.h:33
Definition: stream.h:745
Definition: actor.h:33
Definition: colormap.h:35
Definition: component.h:38
Definition: model.h:43
Definition: textsplit.h:35
Definition: model_component.h:32
Definition: model.h:158
Definition: object.h:69
Actor represents a 3D character on screen.
Definition: actor.h:72
Definition: chore.h:45
Definition: object.h:32
Definition: costume.h:45