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