ScummVM API documentation
scene_text_store.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 HOLLYWOOD_SCENE_TEXT_STORE_H
23#define HOLLYWOOD_SCENE_TEXT_STORE_H
24
25#include "common/array.h"
26#include "common/str.h"
27#include "common/types.h"
28
29namespace Common {
30class SeekableReadStream;
31}
32
33namespace Hollywood {
34
35class TextTranslation;
36
39 textRecordId(0),
40 continuationCount(0),
41 voiceSampleId(0) {
42 }
43
44 SceneSpeechCue(uint16 newTextRecordId, byte newContinuationCount,
45 uint16 newVoiceSampleId) :
46 textRecordId(newTextRecordId),
47 continuationCount(newContinuationCount),
48 voiceSampleId(newVoiceSampleId) {
49 }
50
51 bool valid() const { return textRecordId != 0; }
52
53 uint16 textRecordId;
54 byte continuationCount;
55 uint16 voiceSampleId;
56};
57
65public:
66 SceneTextStore(const TextTranslation *translation = nullptr);
67
68 bool load(const char *archiveName, const char *sceneDebugName, uint stageIndex,
69 uint inventoryRowsOffsetIndex, uint32 speechCueDescriptorOffset,
70 bool validateSequentialVoiceMap = false);
71 bool loadStage(const char *archiveName, const char *sceneDebugName, uint stageIndex);
72 bool loadStaticSpeech(const char *archiveName, const char *sceneDebugName,
73 uint inventoryRowsOffsetIndex, uint32 speechCueDescriptorOffset);
74
75 Common::String inventoryItemName(byte itemId) const;
76 Common::String dialogueMenuText(byte stageId, byte textRowId) const;
77 SceneSpeechCue stageCue(uint16 rowIndex, byte frameIndex) const;
78 bool getStageCue(uint16 rowIndex, byte frameIndex, uint16 &textRecordId,
79 byte &continuationCount, uint16 &voiceSampleId) const;
80 bool getStaticSpeechCue(uint16 rowIndex, byte frameIndex, uint16 &textRecordId,
81 byte &continuationCount, uint16 &voiceSampleId) const;
82 Common::String largeTextRecord(uint16 recordId) const;
83
84 Common::Array<byte> _decodeKey;
85 Common::Array<byte> _stageBlock;
86 Common::Array<byte> _stageSmallRows;
87 Common::Array<byte> _stageLargeRows;
88 Common::Array<byte> _staticSpeechCueDescriptors;
89 Common::Array<byte> _inventoryOwnerSmallRows;
90 Common::Array<byte> _inventoryOwnerLargeRows;
91
92private:
93 SceneSpeechCue staticSpeechCue(uint16 rowIndex, byte frameIndex) const;
94
95 bool readDecodeKey(Common::SeekableReadStream &stream, const char *archiveName);
96 bool readStage(Common::SeekableReadStream &stream, const char *archiveName,
97 uint stageIndex);
98 bool readStaticSpeechCues(Common::SeekableReadStream &stream,
99 const char *archiveName, uint32 speechCueDescriptorOffset,
100 uint trailingByteCount = 0);
101 bool readStaticSpeechRows(Common::SeekableReadStream &stream,
102 const char *archiveName, uint inventoryRowsOffsetIndex,
103 uint32 speechCueDescriptorOffset);
104 bool readInventoryRows(Common::SeekableReadStream &stream, const char *archiveName,
105 uint inventoryRowsOffsetIndex, byte smallRowCount, uint16 largeRowCount);
106 uint16 findStageVoiceSampleBase(uint largeRowCount) const;
107
108 uint16 _stageVoiceSampleBase;
109 bool _validateSequentialVoiceMap;
110 const TextTranslation *_translation;
111};
112
113} // End of namespace Hollywood
114
115#endif // HOLLYWOOD_SCENE_TEXT_STORE_H
Definition: stream.h:745
Definition: str.h:59
Definition: scene_text_store.h:64
Definition: text_translation.h:40
Definition: algorithm.h:29
Definition: scene_text_store.h:37