-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapLoader.js
More file actions
39 lines (33 loc) · 801 Bytes
/
Copy pathMapLoader.js
File metadata and controls
39 lines (33 loc) · 801 Bytes
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
importScripts("WorkerConsole.js", "BinaryLoader.js", "jdataview.js", "StringUtil.js", "MPQParser.js");
var view = null;
var map = {};
function parseMap(data)
{
view = new jDataView(data);
parseHeader();
parseFooter();
parseMPQ();
self.postMessage(map);
};
function parseHeader()
{
map.header = {};
map.header.type = view.getString(4);
view.getInt32();
map.header.name = view.getBlizzardString();
map.header.flags = view.getInt32();
map.header.maxPlayers = view.getInt32();
};
function parseMPQ()
{
map.mpq = new MPQParser(view);
};
function parseFooter()
{
map.footer = {};
map.footer.type = view.getString(4, view.byteLength-260);
map.footer.auth = view.getString(256);
};
self.addEventListener('message', function(e) {
BinaryLoader(e.data, parseMap);
}, false);