forked from fuzzie/unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.h
139 lines (108 loc) · 3.65 KB
/
data.h
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UNITY_DATA_H
#define UNITY_DATA_H
#include "common/stream.h"
#include "common/archive.h"
#include "common/rect.h"
#include "common/hashmap.h"
#include "object.h"
#include "origdata.h"
namespace Unity {
class Graphics;
class Sound;
class SpritePlayer;
class Object;
class Trigger;
struct Triangle {
Common::Point points[3];
uint16 distances[3];
};
struct ScreenPolygon {
unsigned int id;
byte type;
Common::Array<Common::Point> points;
Common::Array<uint16> distances;
Common::Array<Triangle> triangles;
bool insideTriangle(unsigned int x, unsigned int y, unsigned int &triangle);
};
struct Screen {
unsigned int world, screen;
Common::Array<Common::Array<Common::Point> > entrypoints;
Common::Array<ScreenPolygon> polygons;
Common::Array<Object *> objects;
};
struct ComputerEntry {
uint16 flags;
Common::String title, heading, text;
Common::Array<uint> subentries;
uint16 imageWidth, imageHeight;
byte *imageData;
};
class UnityData {
protected:
class UnityEngine *_vm;
public:
UnityData(UnityEngine *p) : _vm(p) { }
~UnityData();
// data file access
Common::Archive *_data, *_instData;
Common::SeekableReadStream *openFile(Common::String filename);
// current away team screen
Screen _currentScreen;
void loadScreenPolys(Common::String filename);
// triggers
Common::Array<Trigger *> _triggers;
void loadTriggers();
Trigger *getTrigger(uint32 id);
// all objects
Common::HashMap<uint32, Object *> _objects;
Object *getObject(objectID id);
// sprite filenames
Common::Array<Common::String> _spriteFilenames;
void loadSpriteFilenames();
Common::String getSpriteFilename(unsigned int id);
// sector names
Common::Array<Common::String> _sectorNames;
void loadSectorNames();
Common::String getSectorName(unsigned int x, unsigned int y, unsigned int z);
// icon sprites
Common::HashMap<uint32, Common::String> _iconSprites;
void loadIconSprites();
Common::String getIconSprite(objectID id);
// movie info
Common::HashMap<unsigned int, Common::String> _movieFilenames;
Common::HashMap<unsigned int, Common::String> _movieDescriptions;
void loadMovieInfo();
// computer database
Common::Array<ComputerEntry> _computerEntries;
void loadComputerDatabase();
// hardcoded data
Common::Array<BridgeItem> _bridgeItems;
Common::Array<BridgeObject> _bridgeObjects;
Common::Array<BridgeScreenEntry> _bridgeScreenEntries;
Common::Array<FailHailEntry> _failHailEntries;
Common::Array<AwayTeamScreenData> _awayTeamScreenData;
Common::Array<Common::String> _transporterSpriteNames;
Common::HashMap<uint32, Common::String> _presetSounds;
Common::HashMap<uint32, Common::String> _adviceNames;
Common::Array<Common::String> _actionStrings;
Common::Array<BackgroundSoundDefault> _backgroundSoundDefaults;
void loadExecutableData();
Common::HashMap<unsigned int, Common::HashMap<unsigned int, Conversation *>*> _conversations;
Conversation *getConversation(unsigned int world, unsigned int id);
};
} // Unity
#endif