ScummVM API documentation
livingbooks_itemtypes.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 MOHAWK_LIVINGBOOKS_ITEMTYPES_H
23 #define MOHAWK_LIVINGBOOKS_ITEMTYPES_H
24 
25 #include "mohawk/livingbooks_item.h"
26 
27 #include "common/array.h"
28 #include "common/rect.h"
29 
30 namespace Common {
31  class MemoryReadStreamEndian;
32 }
33 
34 namespace Mohawk {
35 
36 class MohawkEngine_LivingBooks;
37 class LBPage;
38 
39 class LBSoundItem : public LBItem {
40 public:
42  ~LBSoundItem() override;
43 
44  void update() override;
45  bool togglePlaying(bool playing, bool restart) override;
46  void stop() override;
47 
48 protected:
49  LBItem *createClone() override;
50 
51  bool _running;
52 };
53 
54 struct GroupEntry {
55  uint entryId;
56  uint entryType;
57 };
58 
59 class LBGroupItem : public LBItem {
60 public:
62 
63  void readData(uint16 type, uint16 size, Common::MemoryReadStreamEndian *stream) override;
64 
65  void destroySelf() override;
66  void setEnabled(bool enabled) override;
67  void setGlobalEnabled(bool enabled) override;
68  bool contains(Common::Point point) override;
69  bool togglePlaying(bool playing, bool restart) override;
70  // 0x12
71  void seek(uint16 pos) override;
72  void setVisible(bool visible) override;
73  void setGlobalVisible(bool visible) override;
74  void startPhase(uint phase) override;
75  void stop() override;
76  void load() override;
77  void unload() override;
78  void moveBy(const Common::Point &pos) override;
79  void moveTo(const Common::Point &pos) override;
80 
81 protected:
82  LBItem *createClone() override;
83 
84  bool _starting;
85 
86  Common::Array<GroupEntry> _groupEntries;
87 };
88 
89 class LBPaletteItem : public LBItem {
90 public:
92  ~LBPaletteItem() override;
93 
94  void readData(uint16 type, uint16 size, Common::MemoryReadStreamEndian *stream) override;
95 
96  bool togglePlaying(bool playing, bool restart) override;
97  void update() override;
98 
99 protected:
100  LBItem *createClone() override;
101 
102  uint16 _fadeInPeriod, _fadeInStep, _drawStart, _drawCount;
103  uint32 _fadeInStart, _fadeInCurrent;
104  byte *_palette;
105 };
106 
107 struct LiveTextWord {
108  Common::Rect bounds;
109  uint16 soundId;
110 
111  uint16 itemType;
112  uint16 itemId;
113 };
114 
116  uint16 wordStart, wordCount;
117  uint16 highlightStart, highlightEnd;
118  uint16 startId, endId;
119 };
120 
121 class LBLiveTextItem : public LBItem {
122 public:
124 
125  void readData(uint16 type, uint16 size, Common::MemoryReadStreamEndian *stream) override;
126 
127  bool contains(Common::Point point) override;
128  void update() override;
129  void draw() override;
130  void handleMouseDown(Common::Point pos) override;
131  bool togglePlaying(bool playing, bool restart) override;
132  void stop() override;
133  void notify(uint16 data, uint16 from) override;
134 
135 protected:
136  LBItem *createClone() override;
137 
138  void paletteUpdate(uint16 word, bool on);
139  void drawWord(uint word, uint yPos);
140 
141  uint16 _currentPhrase, _currentWord;
142 
143  byte _backgroundColor[4];
144  byte _foregroundColor[4];
145  byte _highlightColor[4];
146  uint16 _paletteIndex;
147 
150 };
151 
152 class LBPictureItem : public LBItem {
153 public:
155 
156  void readData(uint16 type, uint16 size, Common::MemoryReadStreamEndian *stream) override;
157 
158  bool contains(Common::Point point) override;
159  void draw() override;
160  void init() override;
161 
162 protected:
163  LBItem *createClone() override;
164 };
165 
166 class LBMovieItem : public LBItem {
167 public:
169  ~LBMovieItem() override;
170 
171  void update() override;
172  bool togglePlaying(bool playing, bool restart) override;
173 
174 protected:
175  LBItem *createClone() override;
176 };
177 
178 class LBMiniGameItem : public LBItem {
179 public:
181  ~LBMiniGameItem() override;
182 
183  bool togglePlaying(bool playing, bool restart) override;
184 
185 protected:
186  LBItem *createClone() override;
187 };
188 
189 class LBProxyItem : public LBItem {
190 public:
192  ~LBProxyItem() override;
193 
194  void load() override;
195  void unload() override;
196 
197 protected:
198  LBItem *createClone() override;
199 
200  class LBPage *_page;
201 };
202 
203 } // End of namespace Mohawk
204 
205 #endif
Definition: livingbooks_itemtypes.h:115
Definition: livingbooks_itemtypes.h:166
Definition: livingbooks_itemtypes.h:121
Definition: livingbooks_itemtypes.h:54
Definition: array.h:52
Definition: rect.h:536
Definition: memstream.h:103
Definition: livingbooks_item.h:45
Definition: livingbooks_itemtypes.h:189
Definition: livingbooks_itemtypes.h:107
Definition: algorithm.h:29
Definition: rect.h:144
Definition: livingbooks_itemtypes.h:39
Definition: livingbooks_itemtypes.h:59
Definition: livingbooks_itemtypes.h:178
Definition: livingbooks_itemtypes.h:152
Definition: livingbooks_page.h:34
Definition: bitmap.h:32
Definition: livingbooks_itemtypes.h:89
Definition: livingbooks.h:84