File: directorysubentry.h

package info (click to toggle)
residualvm 0.3.1%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye
  • size: 31,292 kB
  • sloc: cpp: 227,029; sh: 7,256; xml: 1,731; perl: 1,067; java: 861; asm: 738; python: 691; ansic: 272; makefile: 139; objc: 81; sed: 22; php: 1
file content (103 lines) | stat: -rw-r--r-- 2,679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* ResidualVM - A 3D game interpreter
 *
 * ResidualVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the AUTHORS
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef MYST3_DIRECTORYSUBENTRY_H
#define MYST3_DIRECTORYSUBENTRY_H

#include "common/array.h"
#include "common/memstream.h"
#include "math/vector3d.h"

namespace Myst3 {

struct SpotItemData {
	uint32 u;
	uint32 v;
};

struct VideoData {
	Math::Vector3d v1;
	Math::Vector3d v2;
	int32 u;
	int32 v;
	int32 width;
	int32 height;
};

typedef Common::Array<uint32> MiscData;

class Archive;

class DirectorySubEntry {
	public:
		enum ResourceType {
			kCubeFace = 0,
			kWaterEffectMask = 1,
			kLavaEffectMask = 2,
			kMagneticEffectMask = 3,
			kShieldEffectMask = 4,
			kSpotItem = 5,
			kFrame = 6,
			kRawData = 7,
			kMovie = 8,
			kStillMovie = 10,
			kText = 11,
			kTextMetadata = 12,
			kNumMetadata = 13,
			kLocalizedSpotItem = 69,
			kLocalizedFrame = 70,
			kMultitrackMovie = 72,
			kDialogMovie = 74
		};

		DirectorySubEntry(Archive *archive);

		void readFromStream(Common::SeekableReadStream &inStream);
		void dumpToFile(Common::SeekableReadStream &inStream, const char* room, uint32 index);
		Common::MemoryReadStream *getData() const;
		uint16 getFace() const { return _face; }
		ResourceType getType() const { return _type; }
		const SpotItemData &getSpotItemData() const { return _spotItemData; }
		const VideoData &getVideoData() const { return _videoData; }
		uint32 getMiscData(uint index) const;
		Common::String getTextData(uint index) const;

	private:
		uint32 _offset;
		uint32 _size;
		uint16 _metadataSize;
		byte _face;
		ResourceType _type;

		// Metadata
		SpotItemData _spotItemData;
		VideoData _videoData;
		MiscData _miscData;

		Archive *_archive;
};

typedef Common::Array<const DirectorySubEntry *> DirectorySubEntryList;

} // End of namespace Myst3

#endif // MYST3_DIRECTORYSUBENTRY_H