ScummVM API documentation
diary.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 STARK_SERVICES_DIARY_H
23 #define STARK_SERVICES_DIARY_H
24 
25 #include "common/path.h"
26 #include "common/str.h"
27 #include "common/str-array.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 class WriteStream;
32 }
33 
34 namespace Stark {
35 
36 class ResourceSerializer;
37 
43 class Diary {
44 public:
46  Common::String line;
47  int32 characterId;
48 
50  };
51 
52  struct ConversationLog {
53  Common::String title;
54  Common::String characterName;
55  int32 characterId;
56  int32 chapter;
57  bool dialogActive;
59 
61  };
62 
63  Diary();
64  virtual ~Diary();
65 
67  bool isEnabled() const;
68 
70  bool hasUnreadEntries() const;
71 
73  void setDiaryAllRead() { _hasUnreadEntries = false; }
74 
76  void addDiaryEntry(const Common::String &name);
77 
79  uint32 getPageIndex() const { return _pageIndex; };
80  void setPageIndex(uint32 pageIndex) { _pageIndex = pageIndex; }
81 
83  void addFMVEntry(const Common::Path &filename, const Common::String &title, int gameDisc);
84 
86  uint countFMV() const { return _fmvEntries.size(); }
87  const Common::Path &getFMVFilename(uint index) const { return _fmvEntries[index].filename; }
88  const Common::String &getFMVTitle(uint index) const { return _fmvEntries[index].title; }
89 
91  uint countDiary() const { return _diaryEntries.size(); }
92  const Common::String &getDiary(uint index) const { return _diaryEntries[index]; }
93 
95  uint countDialog() const { return _conversationEntries.size(); }
96  const ConversationLog &getDialog(uint index) const { return _conversationEntries[index]; }
97 
99  void openDialog(const Common::String &title, const Common::String &characterName, int32 characterId);
100 
102  void logSpeech(const Common::String &line, int32 characterId);
103 
105  void closeDialog();
106 
108  void clear();
109 
111  void readStateFromStream(Common::SeekableReadStream *stream, uint32 version);
112 
114  void writeStateToStream(Common::WriteStream *stream);
115 
116 private:
117  struct FMVEntry {
118  Common::Path filename;
119  Common::String title;
120  int gameDisc;
121  };
122 
123  bool hasFMVEntry(const Common::Path &filename) const;
124  void saveLoad(ResourceSerializer *serializer);
125 
126  Common::Array<Common::String> _diaryEntries;
127  Common::Array<FMVEntry> _fmvEntries;
128  Common::Array<ConversationLog> _conversationEntries;
129 
130  bool _hasUnreadEntries;
131  uint32 _pageIndex;
132 };
133 
134 } // End of namespace Stark
135 
136 #endif // STARK_SERVICES_DIARY_H
void setDiaryAllRead()
Definition: diary.h:73
Definition: str.h:59
Definition: stream.h:77
Definition: diary.h:45
Definition: array.h:52
Definition: path.h:52
Definition: diary.h:52
Definition: stream.h:745
uint countDiary() const
Definition: diary.h:91
Definition: diary.h:43
uint countFMV() const
Definition: diary.h:86
Definition: console.h:27
uint countDialog() const
Definition: diary.h:95
Definition: algorithm.h:29
uint32 getPageIndex() const
Definition: diary.h:79
Definition: stateprovider.h:51