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:
31  ParameterClient() {};
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 
42 class DeviceOwner : public ParameterClient {
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(uint overriddenEntryPointScreenId = 0);
63  void startContextLoad(uint contextId);
64  bool isContextLoadInProgress(uint contextId);
65  void branchToScreen();
66  void scheduleScreenBranch(uint screenActorId);
67  void scheduleContextRelease(uint contextId);
68 
69  void streamDidClose(uint streamId);
70  void streamDidFinish(uint streamId);
71  // These implementations are left empty because they are empty in the original,
72  // but they are kept because they are technically still defined in the original.
73  void streamDidOpen(uint streamId) {};
74  void streamWillRead(uint streamId) {};
75 
76  void process();
77  uint contextIdForScreenActorId(uint screenActorId);
78 
79 private:
80  uint _currentScreenActorId = 0;
81  StreamFeed *_currentStreamFeed = nullptr;
82  Common::Array<uint> _requestedContextReleaseId;
83  Common::Array<uint> _contextLoadQueue;
84  uint _requestedScreenBranchId = 0;
85  bool _entryPointScreenIdWasOverridden = false;
86  uint _entryPointScreenId = 0;
87  uint _entryPointStreamId = 0;
88  uint _loadingContextId = 0;
89  uint _loadingScreenActorId = 0;
90 
91  void contextLoadDidComplete();
92  void screenLoadDidComplete();
93  void startFeed(uint streamId);
94  // This is named stopFeed in the original, but it is a bit of a misnomer
95  // because it also closes the stream feed. In the lower-level stream feed manager
96  // and stream feeds themselves, stopping the stream feed and closing it is
97  // two separate operations.
98  void stopFeed();
99  void blowAwayCurrentScreen();
100  void preloadParentContexts(uint contextId);
101  void addToContextLoadQueue(uint contextId);
102  bool isContextLoadQueued(uint contextId);
103  void checkQueuedContextLoads();
104 };
105 
106 } // End of namespace MediaStation
107 
108 #endif
Definition: actor.h:33
Definition: datafile.h:102
Definition: clients.h:29
Definition: datafile.h:179
Definition: clients.h:56
Definition: clients.h:42