ScummVM API documentation
log_msg.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BAGLIB_LOG_MSG_H
24 #define BAGEL_BAGLIB_LOG_MSG_H
25 
26 #include "bagel/spacebar/baglib/text_object.h"
27 #include "bagel/spacebar/baglib/storage_dev_bmp.h"
28 
29 namespace Bagel {
30 namespace SpaceBar {
31 
33 protected:
34  int _sdevWidth;
35 
36 public:
37  CBagLogResidue(int sdevWidth);
38  virtual ~CBagLogResidue() {
39  }
40 
41  void setSize(const CBofSize &size) override;
42 
43  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
44 };
45 
46 #define MSG_TIME_MASK 0x3FFF
47 #define MSG_PLAYED_MASK 0x4000
48 
49 class CBagLogMsg : public CBagTextObject {
50 protected:
51  CBofString _msgSendee;
52  CBofString _msgTimeStr;
53  int _sdevWidth;
54 
55 public:
56  CBagLogMsg(int sdevWidth);
57  virtual ~CBagLogMsg() {
58  }
59 
60  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
61 
66  ParseCodes setInfo(CBagIfstream &istr) override;
67 
68  void setSize(const CBofSize &size) override;
69 
70  void setProperty(const CBofString &prop, int val) override;
71  int getProperty(const CBofString &prop) override;
72 
73  void setMsgSendee(const CBofString &sendee) {
74  _msgSendee = sendee;
75  }
76  CBofString getMsgSendee() const {
77  return _msgSendee;
78  }
79 
80  void setMsgTime(int &msgTime) {
81  const int state = getState();
82  setState((state & MSG_PLAYED_MASK) | (msgTime & MSG_TIME_MASK));
83  }
84 
85  int getMsgTime() {
86  return getState() & MSG_TIME_MASK;
87  }
88 
89  void setMsgPlayed(bool playedFl) {
90  const int state = getState();
91  setState((state & MSG_TIME_MASK) | (playedFl == true ? MSG_PLAYED_MASK : 0));
92  }
93  bool getMsgPlayed() {
94  return (getState() & MSG_PLAYED_MASK) != 0;
95  }
96 };
97 
98 #define mSusChecked 0x0001
99 #define mSusVoicePrinted 0x0002
100 #define mSusResiduePrinted 0x0004
101 
103 protected:
104  int _nSdevWidth;
105 
106  CBofString _susName;
107  CBofString _susSpecies;
108  CBofString _susRoom;
109 
110 public:
111  CBagLogSuspect(int sdevWidth);
112  virtual ~CBagLogSuspect() {
113  }
114 
115  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
116 
117  void setSize(const CBofSize &size) override;
118 
119  ParseCodes setInfo(CBagIfstream &istr) override;
120 
121  void setProperty(const CBofString &prop, int val) override;
122  int getProperty(const CBofString &prop) override;
123 
124  void setSusName(const CBofString &susName) {
125  _susName = susName;
126  }
127  void setSusSpecies(const CBofString &susSpecies) {
128  _susSpecies = susSpecies;
129  }
130  void setSusRoom(const CBofString &susRoom) {
131  _susRoom = susRoom;
132  }
133 
134  void setSusVoicePrinted(bool bVal) {
135  bVal == false ? setState(getState() & ~mSusVoicePrinted) : setState(getState() | mSusVoicePrinted);
136  }
137  bool getSusVoicePrinted() {
138  return (getState() & mSusVoicePrinted) != 0;
139  }
140 
141  void setSusResiduePrinted(bool bVal) {
142  bVal == false ? setState(getState() & ~mSusResiduePrinted) : setState(getState() | mSusResiduePrinted);
143  }
144  bool getSusResiduePrinted() {
145  return (getState() & mSusResiduePrinted) != 0;
146  }
147 
148  void setSusChecked(bool bVal) {
149  bVal == false ? setState(getState() & ~mSusChecked) : setState(getState() | mSusChecked);
150  }
151  bool getSusChecked() {
152  return (getState() & mSusChecked) != 0;
153  }
154 };
155 
156 class CBagLog : public CBagStorageDevBmp {
157 protected:
158  // Queued messages waited to be played and inserted into SDEV
159  CBofList<CBagObject *> *_queuedMsgList;
160 
161  static CBagLog *_lastFloatPage;
162 
163 public:
164  CBagLog();
165  virtual ~CBagLog();
166  static void initialize() {
167  _lastFloatPage = nullptr;
168  }
169 
170  CBagObject *onNewUserObject(const CBofString &initStr) override;
171 
178  ErrorCode activateLocalObject(CBagObject *bagObj) override;
179 
183  ErrorCode releaseMsg();
184 
185  ErrorCode playMsgQueue();
186 
190  bool removeFromMsgQueue(CBagObject *bagObj);
191 
199  CBofPoint arrangeFloater(CBofPoint &pos, CBagObject *bagObj) override;
200 
201  int getCurFltPage();
202  void setCurFltPage(int fltPage);
203 
204  static void arrangePages();
205  static void initArrangePages() {
206  _lastFloatPage = nullptr;
207  }
208 };
209 
211 public:
213  virtual ~CBagEnergyDetectorObject();
214 
215  // Need private setinfo so we can parse energy detector fields
216  ParseCodes setInfo(CBagIfstream &istr) override;
217 
218  ErrorCode update(CBofBitmap *, CBofPoint, CBofRect *, int) override;
219 
220  ErrorCode attach() override;
221 
222  void setMsgTime(int &nVal) {
223  setState(nVal);
224  }
225  int getMsgTime() {
226  return getState();
227  }
228 
229 private:
230  CBofString _energyTimeStr;
231  CBofString _zhapsStr;
232  CBofString _causeStr;
233 
234  bool _textInitializedFl;
235 };
236 
237 // Special object, clue object.
238 class CBagLogClue : public CBagTextObject {
239 private:
240  CBagVar *_stringVar1;
241  CBagVar *_stringVar2;
242  CBagVar *_stringVar3;
243  CBagVar *_stringVar4;
244  int _sdevWidth;
245 
246 public:
247  CBagLogClue(const CBofString &initStr, int sdevWidth, int pointSize);
248  virtual ~CBagLogClue() {
249  }
250 
251  ErrorCode attach() override;
252 
253  ParseCodes setInfo(CBagIfstream &istr) override;
254 
255  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
256 };
257 
258 } // namespace SpaceBar
259 } // namespace Bagel
260 
261 #endif
Definition: ifstream.h:32
Definition: log_msg.h:102
Definition: size.h:32
Definition: object.h:86
Definition: rect.h:35
Definition: text_object.h:38
Definition: log_msg.h:49
Definition: log_msg.h:238
Definition: string.h:38
Definition: log_msg.h:156
Definition: afxwin.h:27
ParseCodes setInfo(CBagIfstream &istr) override
Definition: point.h:32
Definition: storage_dev_bmp.h:32
Definition: list.h:60
Definition: var.h:33
Definition: log_msg.h:32
Definition: bitmap.h:57