ScummVM API documentation
clients.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 MEDIASTATION_CLIENTS_H
23 #define MEDIASTATION_CLIENTS_H
24 
25 #include "mediastation/datafile.h"
26 
27 namespace MediaStation {
28 
29 class ScreenActor;
30 
32 public:
34  virtual ~ParameterClient();
35 
36  virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) = 0;
37 };
38 
39 enum DeviceOwnerSectionType {
40  kDeviceOwnerAllowMultipleSounds = 0x35,
41  kDeviceOwnerAllowMultipleStreams = 0x36,
42 };
43 
45 public:
46  virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) override;
47 
48  bool _allowMultipleSounds = false;
49  bool _allowMultipleStreams = false;
50 };
51 
52 enum DocumentSectionType {
53  kDocumentContextLoadComplete = 0x10,
54  kDocumentStartupInformation = 0x2e,
55  kDocumentEntryScreen = 0x2f,
56 };
57 
58 class Document : public ParameterClient {
59 friend class Debugger;
60 
61 public:
62  virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) override;
63  void readStartupInformation(Chunk &chunk);
64  void readContextLoadComplete(Chunk &chunk);
65 
66  void beginTitle();
67  void startContextLoad(uint contextId);
68  bool isContextLoadInProgress(uint contextId);
69  void branchToScreen(uint screenId, bool disableScreenAutoUpdate);
70 
71  void streamDidClose(uint streamId);
72  void streamDidFinish(uint streamId);
73  // These implementations are left empty because they are empty in the original,
74  // but they are kept because they are technically still defined in the original.
75  void streamDidOpen(uint streamId) {};
76  void streamWillRead(uint streamId) {};
77 
78  uint contextIdForScreenActorId(uint screenActorId);
79  void addToContextLoadQueue(uint contextId);
80  void removeFromContextLoadQueue(uint contextId);
81  bool isContextLoadQueued(uint contextId);
82  void contextReleaseComplete(uint contextId);
83  void contextAlreadyReleased(uint contextId);
84 
85  Common::String getDebugString();
86 
87 private:
88  uint _currentScreenActorId = 0;
89  StreamFeed *_currentStreamFeed = nullptr;
90  Common::Array<uint> _contextLoadQueue;
91  bool _entryPointScreenIdWasOverridden = false;
92  uint _entryPointScreenId = 0;
93  uint _entryPointStreamId = 0;
94  uint _loadingContextId = 0;
95  uint _loadingScreenActorId = 0;
96  uint _disabledScreenAutoUpdateToken = 0;
97 
98  void contextLoadDidComplete();
99  void screenLoadDidComplete();
100  void startFeed(uint streamId);
101  // This is named stopFeed in the original, but it is a bit of a misnomer
102  // because it also closes the stream feed. In the lower-level stream feed manager
103  // and stream feeds themselves, stopping the stream feed and closing it is
104  // two separate operations.
105  void stopFeed();
106  void blowAwayCurrentScreen();
107  void preloadParentContexts(uint contextId);
108  void checkQueuedContextLoads();
109 };
110 
111 } // End of namespace MediaStation
112 
113 #endif
Definition: str.h:59
Definition: actor.h:34
Definition: datafile.h:99
Definition: clients.h:31
Definition: datafile.h:176
Definition: clients.h:58
Definition: clients.h:44
Definition: debugger.h:31