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/baglib/text_object.h"
27 #include "bagel/baglib/storage_dev_bmp.h"
28 
29 namespace Bagel {
30 
32 protected:
33  int _sdevWidth;
34 
35 public:
36  CBagLogResidue(int sdevWidth);
37  virtual ~CBagLogResidue() {}
38 
39  void setSize(const CBofSize &size) override;
40 
41  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
42 };
43 
44 #define MSG_TIME_MASK 0x3FFF
45 #define MSG_PLAYED_MASK 0x4000
46 
47 class CBagLogMsg : public CBagTextObject {
48 protected:
49  CBofString _msgSendee;
50  CBofString _msgTimeStr;
51  int _sdevWidth;
52 
53 public:
54  CBagLogMsg(int sdevWidth);
55  virtual ~CBagLogMsg() {}
56 
57  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
58 
63  ParseCodes setInfo(CBagIfstream &istr) override;
64 
65  void setSize(const CBofSize &size) override;
66 
67  void setProperty(const CBofString &prop, int val) override;
68  int getProperty(const CBofString &prop) override;
69 
70  void setMsgSendee(const CBofString &sendee) {
71  _msgSendee = sendee;
72  }
73  CBofString getMsgSendee() const {
74  return _msgSendee;
75  }
76 
77  void setMsgTime(int &msgTime) {
78  const int state = getState();
79  setState((state & MSG_PLAYED_MASK) | (msgTime & MSG_TIME_MASK));
80  }
81 
82  int getMsgTime() {
83  return getState() & MSG_TIME_MASK;
84  }
85 
86  void setMsgPlayed(bool playedFl) {
87  const int state = getState();
88  setState((state & MSG_TIME_MASK) | (playedFl == true ? MSG_PLAYED_MASK : 0));
89  }
90  bool getMsgPlayed() {
91  return (getState() & MSG_PLAYED_MASK) != 0;
92  }
93 };
94 
95 #define mSusChecked 0x0001
96 #define mSusVoicePrinted 0x0002
97 #define mSusResiduePrinted 0x0004
98 
100 protected:
101  int _nSdevWidth;
102 
103  CBofString _susName;
104  CBofString _susSpecies;
105  CBofString _susRoom;
106 
107 public:
108  CBagLogSuspect(int sdevWidth);
109  virtual ~CBagLogSuspect() {}
110 
111  ErrorCode update(CBofBitmap *bmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
112 
113  void setSize(const CBofSize &size) override;
114 
115  ParseCodes setInfo(CBagIfstream &istr) override;
116 
117  void setProperty(const CBofString &prop, int val) override;
118  int getProperty(const CBofString &prop) override;
119 
120  void setSusName(const CBofString &susName) {
121  _susName = susName;
122  }
123  void setSusSpecies(const CBofString &susSpecies) {
124  _susSpecies = susSpecies;
125  }
126  void setSusRoom(const CBofString &susRoom) {
127  _susRoom = susRoom;
128  }
129 
130  void setSusVoicePrinted(bool bVal) {
131  bVal == false ? setState(getState() & ~mSusVoicePrinted) : setState(getState() | mSusVoicePrinted);
132  }
133  bool getSusVoicePrinted() {
134  return (getState() & mSusVoicePrinted) != 0;
135  }
136 
137  void setSusResiduePrinted(bool bVal) {
138  bVal == false ? setState(getState() & ~mSusResiduePrinted) : setState(getState() | mSusResiduePrinted);
139  }
140  bool getSusResiduePrinted() {
141  return (getState() & mSusResiduePrinted) != 0;
142  }
143 
144  void setSusChecked(bool bVal) {
145  bVal == false ? setState(getState() & ~mSusChecked) : setState(getState() | mSusChecked);
146  }
147  bool getSusChecked() {
148  return (getState() & mSusChecked) != 0;
149  }
150 };
151 
152 class CBagLog : public CBagStorageDevBmp {
153 protected:
154  // Queued messages waited to be played and inserted into SDEV
155  CBofList<CBagObject *> *_queuedMsgList;
156 
157  static CBagLog *_lastFloatPage;
158 
159 public:
160  CBagLog();
161  virtual ~CBagLog();
162  static void initialize() {
163  _lastFloatPage = nullptr;
164  }
165 
166  CBagObject *onNewUserObject(const CBofString &initStr) override;
167 
174  ErrorCode activateLocalObject(CBagObject *bagObj) override;
175 
179  ErrorCode releaseMsg();
180 
181  ErrorCode playMsgQueue();
182 
186  bool removeFromMsgQueue(CBagObject *bagObj);
187 
195  CBofPoint arrangeFloater(CBofPoint &pos, CBagObject *bagObj) override;
196 
197  int getCurFltPage();
198  void setCurFltPage(int fltPage);
199 
200  static void arrangePages();
201  static void initArrangePages() {
202  _lastFloatPage = nullptr;
203  }
204 };
205 
207 public:
209  virtual ~CBagEnergyDetectorObject();
210 
211  // Need private setinfo so we can parse energy detector fields
212  ParseCodes setInfo(CBagIfstream &istr) override;
213 
214  ErrorCode update(CBofBitmap *, CBofPoint, CBofRect *, int) override;
215 
216  ErrorCode attach() override;
217 
218  void setMsgTime(int &nVal) {
219  setState(nVal);
220  }
221  int getMsgTime() {
222  return getState();
223  }
224 
225 private:
226  CBofString _energyTimeStr;
227  CBofString _zhapsStr;
228  CBofString _causeStr;
229 
230  bool _textInitializedFl;
231 };
232 
233 // Special object, clue object.
234 class CBagLogClue : public CBagTextObject {
235 private:
236  CBagVar *_stringVar1;
237  CBagVar *_stringVar2;
238  CBagVar *_stringVar3;
239  CBagVar *_stringVar4;
240  int _sdevWidth;
241 
242 public:
243  CBagLogClue(const CBofString &initStr, int sdevWidth, int pointSize);
244  virtual ~CBagLogClue() {}
245 
246  ErrorCode attach() override;
247 
248  ParseCodes setInfo(CBagIfstream &istr) override;
249 
250  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect *srcRect = nullptr, int maskColor = -1) override;
251 };
252 
253 } // namespace Bagel
254 
255 #endif
Definition: log_msg.h:31
Definition: log_msg.h:234
Definition: size.h:31
Definition: bitmap.h:55
Definition: text_object.h:37
Definition: log_msg.h:47
Definition: rect.h:36
ParseCodes setInfo(CBagIfstream &istr) override
Definition: object.h:85
Definition: ifstream.h:31
Definition: log_msg.h:152
Definition: string.h:38
Definition: bagel.h:31
Definition: log_msg.h:99
Definition: point.h:34
Definition: var.h:32
Definition: list.h:60
Definition: log_msg.h:206
Definition: storage_dev_bmp.h:31