ScummVM API documentation
slot.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 LASTEXPRESS_SOUND_SLOT_H
23 #define LASTEXPRESS_SOUND_SLOT_H
24 
25 #include "lastexpress/shared.h"
26 #include "lastexpress/lastexpress.h"
27 #include "lastexpress/sound/sound.h"
28 
29 namespace LastExpress {
30 
31 class LastExpressEngine;
32 class Subtitle;
33 class SoundManager;
34 struct HPF;
35 
36 #include "common/pack-start.h"
37 typedef struct SaveSlot {
38  int32 status;
39  int32 tag;
40  int32 blockCount;
41  int32 time;
42  int32 fadeDelayCounter;
43  int32 unusedVar;
44  int32 character;
45  int32 delayTicks;
46  int32 priority;
47  char name1[16];
48  char name2[16];
49 
50  SaveSlot() {
51  status = 0;
52  tag = 0;
53  blockCount = 0;
54  time = 0;
55  fadeDelayCounter = 0;
56  unusedVar = 0;
57  character = 0;
58  delayTicks = 0;
59  priority = 0;
60  memset(name1, 0, 16);
61  memset(name2, 0, 16);
62  }
63 } SaveSlot;
64 #include "common/pack-end.h"
65 
66 class Slot {
67  friend class Subtitle;
68  friend class LastExpressEngine;
69  friend class SoundManager;
70  friend class LogicManager;
71  friend class SubtitleManager;
72  friend class Menu;
73 
74 public:
75  Slot(SoundManager *soundMan, const char *filename, int typeFlags, int priority);
76  Slot(SoundManager *soundMan, int typeFlags, int priority);
77  Slot(SoundManager *soundMan, SaveSlot *soundEntry);
78  ~Slot();
79 
80  void play();
81  void setFade(int volume);
82  void setVol(int volume);
83  void setTag(int typeFlags);
84  void setType(int typeFlags);
85  void setSub(const char *filename);
86  bool getBuffer();
87  void releaseBuffer();
88  void virtualize();
89  void devirtualize();
90  bool load(const char *filename);
91  void stream();
92  bool update();
93 
94  // The following getters/setters were not in the original
95  // but are needed for thread safety
96  int32 getStatusFlags();
97  void setStatusFlags(int32 flags);
98  void addStatusFlag(int32 flag);
99  void removeStatusFlag(int32 flag);
100  int32 getTag();
101  bool hasTag(int32 tag);
102  void assignDirectTag(int32 tag);
103  int getAssociatedCharacter();
104  void setAssociatedCharacter(int character);
105  int32 getTime();
106  Slot *getNext();
107  void setNext(Slot *next);
108  int getPriority();
109  bool closeArchive();
110  void assignDirectVolume(int volume);
111  int getVolume();
112  void setChainedSound(Slot *chainedSound);
113  Subtitle *getSubtitle();
114  int32 getSize();
115  void setSize(int32 size);
116  int32 getNumLoadedBytes();
117  void setNumLoadedBytes(int32 bytes);
118  void advanceLoadedBytesBy(int32 loadedBytes);
119  byte *getDataStart();
120  void setDataStart(byte *dataStart);
121  byte *getDataEnd();
122  void setDataEnd(byte *dataEnd);
123  void setDataEndByte(int32 pos, byte value);
124  void advanceDataEndBy(int32 size);
125  byte *getSoundBuffer();
126  void setSoundBuffer(byte *bufferPtr);
127  byte *getCurrentBufferPtr();
128  void advanceCurrentBufferPtrBy(int32 size);
129  void setCurrentBufferPtr(byte *bufferPtr);
130  byte *getCurrentDataPtr();
131  void setCurrentDataPtr(byte *dataPtr);
132  int32 getBlockCount();
133  void setBlockCount(int32 blockCount);
134  void setDelayedStartTime(int32 time);
135  char *getName2();
136 
137 private:
138  LastExpressEngine *_engine = nullptr;
139  SoundManager *_soundMan = nullptr;
140 
141  int32 _statusFlags = 0;
142  int32 _tag = 0;
143  byte *_dataStart = nullptr;
144  byte *_dataEnd = 0;
145  byte *_currentDataPtr = nullptr;
146  byte *_soundBuffer = nullptr;
147  byte *_currentBufferPtr = nullptr;
148  int32 _blockCount = 0;
149  int32 _time = 0;
150  int32 _size = 0;
151  int32 _loadedBytes = 0;
152  HPF *_archive = nullptr;
153  Slot *_chainedSound = nullptr;
154  int32 _fadeDelayCounter = 0;
155  int32 _unusedVar = 0;
156  int32 _fadeTargetVolume = 0;
157  int _volume = 0;
158  int _character = 0;
159  int32 _delayedStartTime = 0;
160  int _priority = 0;
161  char _name1[16];
162  char _name2[16];
163  Slot *_next = nullptr;
164  Subtitle *_subtitle = nullptr;
165 };
166 
167 
168 } // End of namespace LastExpress
169 
170 #endif // LASTEXPRESS_SOUND_SLOT_H
Definition: subtitle.h:57
Definition: lastexpress.h:523
Definition: archive.h:48
Definition: archive.h:29
Definition: menu.h:37
Definition: sound.h:46
Definition: slot.h:66
Definition: slot.h:37
Definition: subtitle.h:36
Definition: logic.h:51