ScummVM API documentation
logo.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 SHERLOCK_SCALPEL_TSAGE_LOGO_H
23 #define SHERLOCK_SCALPEL_TSAGE_LOGO_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/file.h"
28 #include "common/list.h"
29 #include "common/str.h"
30 #include "common/str-array.h"
31 #include "common/util.h"
32 #include "graphics/surface.h"
33 #include "sherlock/scalpel/tsage/resources.h"
34 #include "sherlock/screen.h"
35 
36 namespace Sherlock {
37 namespace Scalpel {
38 
39 class ScalpelEngine;
40 
41 namespace TsAGE {
42 
43 class ObjectSurface : public Surface {
44 public:
45  Common::Point _centroid;
46 public:
47  ObjectSurface() : Surface() {}
48  ~ObjectSurface() override {}
49 };
50 
51 class Visage {
52 private:
54 
58  void surfaceFromRes(ObjectSurface &s);
59 public:
60  static TLib *_tLib;
61  int _resNum;
62  int _rlbNum;
63 public:
64  Visage();
65  ~Visage();
66 
70  void setVisage(int resNum, int rlbNum = 9999);
71 
75  void clear();
76 
80  void getFrame(ObjectSurface &s, int frameNum);
81 
85  int getFrameCount() const;
86 
90  bool isLoaded() const;
91 };
92 
93 class Object {
94 private:
95  Visage _visage;
96  uint32 _updateStartFrame;
97  bool _isAnimating;
98  bool _finished;
99  uint32 _walkStartFrame;
100  int _angle;
101  int _changeCtr;
102  int _majorDiff, _minorDiff;
103  Common::Point _moveDelta;
104  Common::Point _moveSign;
105 
109  int changeFrame();
110 
114  int getNewFrame();
115 
119  void calculateMoveAngle();
120 
124  void move();
125 
129  bool dontMove() const;
130 
134  void endMove();
135 public:
136  static ScalpelEngine *_vm;
137  Common::Point _position;
138  Common::Point _destination;
139  Common::Rect _oldBounds;
140  int _frame;
141  int _numFrames;
142  int _frameChange;
143 public:
144  Object();
145 
149  void setVisage(int visage, int strip);
150 
154  void setAnimMode(bool isAnimating);
155 
159  void setDestination(const Common::Point &pt);
160 
164  bool isAnimEnded() const;
165 
169  bool isMoving() const;
170 
174  void erase();
175 
179  void update();
180 
184  void remove() { _visage.clear(); }
185 };
186 
188  int frame;
189  int x;
190  int y;
191 };
192 
193 class Logo {
194 private:
195  ScalpelEngine *_vm;
196  TLib _lib;
197  int _counter, _frameCounter;
198  bool _finished;
199  byte _originalPalette[PALETTE_SIZE];
200  byte _palette1[PALETTE_SIZE];
201  byte _palette2[PALETTE_SIZE];
202  byte _palette3[PALETTE_SIZE];
203  Object _objects[4];
204  uint _waitFrames;
205  uint32 _waitStartFrame;
206  int _animateObject;
207  uint32 _animateStartFrame;
208  uint _animateFrameDelay;
209  const AnimationFrame *_animateFrames;
210  uint _animateFrame;
211 
212  Logo(ScalpelEngine *vm);
213  ~Logo();
214 
215  void nextFrame();
216 
217  bool finished() const;
218 
223  void waitFrames(uint frames);
224 
230  void startAnimation(uint object, uint frameDelay, const AnimationFrame *frames);
231 
235  void loadBackground();
236 
240  void fade(const byte palette[PALETTE_SIZE], int step = 6);
241 public:
242  static bool show(ScalpelEngine *vm);
243 };
244 
245 } // end of namespace TsAGE
246 } // end of namespace Scalpel
247 } // end of namespace Sherlock
248 
249 #endif
void clear(uint32 color=0)
Definition: scalpel.h:50
Definition: surface.h:118
Definition: resources.h:108
Definition: animation.h:29
Definition: rect.h:144
Definition: stream.h:745
Definition: rect.h:45
virtual void update()
Definition: blueforce_dialogs.h:30
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: logo.h:193