ScummVM API documentation
sprite.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 DIRECTOR_SPRITE_H
23 #define DIRECTOR_SPRITE_H
24 
25 namespace Director {
26 
27 class Frame;
28 class BitmapCastMember;
29 class ShapeCastMember;
30 class TextCastMember;
31 
32 /* Director in a Nutshell, page 15:
33 The following properties of a sprite are auto-puppeted whenever the property is
34 set: backColor, blend, editable, foreColor, beight, ink, loc, locH, locV, member,
35 moveable, rect, and width Auto-puppeting of individual properties has no effect
36 on the puppet of sprite property. */
37 enum AutoPuppetProperty {
38  kAPNone = 0,
39  kAPCast,
40  kAPBackColor,
41  kAPBbox,
42  kAPBlend,
43  kAPEditable,
44  kAPForeColor,
45  kAPHeight,
46  kAPInk,
47  kAPLoc,
48  kAPLocH,
49  kAPLocV,
50  kAPMember,
51  kAPMoveable,
52  kAPRect,
53  kAPWidth,
54 };
55 
56 class Sprite {
57 public:
58  Sprite(Frame *frame = nullptr);
59  Sprite(const Sprite &sprite);
60  Sprite& operator=(const Sprite &sprite);
61  ~Sprite();
62 
63  Frame *getFrame() const { return _frame; }
64  Score *getScore() const { return _score; }
65 
66  void reset();
67 
68  void updateEditable();
69 
70  bool respondsToMouse();
71  bool isActive();
72  bool shouldHilite();
73  bool checkSpriteType();
74 
75  uint16 getPattern();
76  void setPattern(uint16 pattern);
77 
78  void setCast(CastMemberID memberID, bool replaceDims = true);
79  bool isQDShape();
80  Graphics::Surface *getQDMatte();
81  void createQDMatte();
82  MacShape *getShape();
83  uint32 getForeColor();
84  uint32 getBackColor();
85  void setAutoPuppet(AutoPuppetProperty property, bool value);
86  bool getAutoPuppet(AutoPuppetProperty property);
87 
88  inline int getWidth() { return _width; }
89  void setWidth(int w);
90  inline int getHeight() { return _height; }
91  void setHeight(int h);
92 
93  Common::Rect getBbox(bool unstretched);
94  void setBbox(int l, int t, int r, int b);
95 
96  Common::Point getPosition();
97  void setPosition(int x, int y);
98 
99  Frame *_frame;
100  Score *_score;
101  Movie *_movie;
102 
103  Graphics::FloodFill *_matte; // matte for quickdraw shape
104 
105  CastMemberID _scriptId;
106  byte _colorcode; // x40 editable, 0x80 moveable
107  byte _blendAmount;
108  uint32 _unk3;
109 
110  bool _enabled;
111  SpriteType _spriteType;
112  byte _inkData;
113  InkType _ink;
114  bool _trails;
115 
116  CastMemberID _castId;
117  uint16 _pattern;
118  CastMember *_cast;
119 
120  byte _thickness;
121 
122  // These fields are used for tracking the position, width and height of the sprite,
123  // as received from the score frame data.
124  // Don't change these; instead adjust the equivalent properties in Channel.
125  Common::Point _startPoint;
126  int16 _width;
127  int16 _height;
128 
129  bool _moveable;
130  bool _editable;
131  bool _puppet;
132  uint32 _autoPuppet; // autopuppet, based upon Director in a Nutshell, page 15
133  bool _immediate;
134  uint32 _backColor;
135  uint32 _foreColor;
136 
137  byte _blend;
138 
139  byte _volume;
140  bool _stretch;
141 };
142 
143 } // End of namespace Director
144 
145 #endif
Definition: surface.h:67
Definition: surface.h:587
Definition: rect.h:144
Definition: movie.h:86
Definition: archive.h:35
Definition: sprite.h:56
Definition: score.h:63
Definition: rect.h:45
Definition: director.h:127
Definition: frame.h:151
Definition: castmember.h:45
Definition: types.h:414