forked from Popov72/TRN2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
244 lines (217 loc) · 10.7 KB
/
index.html
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="babylonJS/public/lib/jquery-3.3.1.min.js"></script>
<style>
body {
margin: 0;
background-color: #8AB7FF;
}
#logo {
display: block;
text-align: center;
}
#logo img {
width: 320px;
}
#container {
text-align: center;
}
#levels {
margin-top: 30px;
text-align: center;
}
.thumbnail {
display: inline-block;
position: relative;
margin-right: 30px;
margin-bottom: 30px;
}
.hvr-pulse {
display: block;
}
.hvr-pulse:hover {
animation: pulse 2s infinite;
animation-name: hvr-pulse;
animation-timing-function: linear;
cursor: pointer;
}
@keyframes hvr-pulse {
0% {
transform: scale(1);
}
25% {
transform: scale(1.08);
}
50% {
transform: scale(1.0);
}
75% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
.cutscene {
width: 26px;
display: inline;
position: absolute;
right: 2px;
bottom: 0px;
}
.gametitle .text {
display: inline-block;
margin-top: 8px;
text-shadow: -1px -1px 0px rgba(255,255,255,0.2), 1px 1px 0px rgba(0,0,0,1);
color: white;
}
</style>
</head>
<body>
<div id="container">
<span id="logo"><img src="resources/picture/logo.png"/></span>
<select id="engine">
<option value="babylonJS">Babylon.js</option>
<option value="threeJS">Threejs</option>
</select>
<select id="trgame">
<option value="TR1">Tomb Raider 1</option>
<option value="TR2">Tomb Raider 2</option>
<option value="TR3">Tomb Raider 3</option>
<option value="TR4">Tomb Raider 4</option>
<option value="TR4Cut">Tomb Raider 4 Cut Scenes</option>
</select>
<div id="levels"></div>
</div>
<script>
let game = 'TR1', qs = QueryString();
const CutsceneTR4 = [
{ "file": "angkor1.tr4", "description": "Young Lara appearing from behind Von Croy at level start", "index": 6 },
{ "file": "angkor1.tr4", "description": "Young Lara getting backpack", "index": 5 },
{ "file": "ang_race.tr4", "description": "Von Croy winning race", "index": 8 },
{ "file": "ang_race.tr4", "description": "Young Lara winning race", "index": 7 },
{ "file": "ang_race.tr4", "description": "Revealing Iris, Von Croy getting trapped and Young Lara going for help", "index": 9 },
{ "file": "settomb2.tr4", "description": "Lara pulling Ankh off Seth's Tomb", "index": 14 },
{ "file": "karnak1.tr4", "description": "Lara arriving in jeep", "index": 12 },
{ "file": "hall.tr4", "description": "Von Croy and bad guys coming in car / jeeps", "index": 13 },
{ "file": "alexhub.tr4", "description": "First meeting with Jean-Yves", "index": 17 },
{ "file": "alexhub2.tr4", "description": "Lara using pole and hook to get keys", "index": 21 },
{ "file": "alexhub.tr4", "description": "Second meeting with Jean-Yves", "index": 18 },
{ "file": "alexhub.tr4", "description": "Third meeting with Jean-Yves", "index": 19 },
{ "file": "libend.tr4", "description": "Lara reading scroll and running away when Von Croy coming", "index": 10 },
{ "file": "alexhub.tr4", "description": "Fourth meeting with Jean-Yves", "index": 20 },
{ "file": "palaces2.tr4", "description": "Lara approaching and sitting on throne", "index": 22 },
{ "file": "highstrt.tr4", "description": "First dialog with Aziz", "index": 25 },
{ "file": "highstrt.tr4", "description": "Second dialog with Aziz", "index": 26 },
{ "file": "lowstrt.tr4", "description": "Lara speaking with injured guy to get code", "index": 24 },
{ "file": "highstrt.tr4", "description": "Lara coming back to Aziz, destroying of the beast", "index": 11 },
{ "file": "citnew.tr4", "description": "Lara freeing Jean-Yves bound to a pole", "index": 16 },
{ "file": "citnew.tr4", "description": "Lara meeting Von Croy and 4 dogs", "index": 15 },
{ "file": "joby1a.tr4", "description": "Lara kneeling, reading inscription then standing", "index": 3 },
{ "file": "joby1a.tr4", "description": "Lara pulling out shovel and starting to dig", "index": 1 },
{ "file": "joby3a.tr4", "description": "Lara fighting scorpion and getting keys", "index": 4 },
{ "file": "joby5b.tr4", "description": "Lara activating Horus in light shaft", "index": 23 },
{ "file": "joby5c.tr4", "description": "Lara riding up from the light shaft and sealing it", "index": 27 },
{ "file": "title.tr4", "description": "Lara revealing hidden golden skull", "index": 28 },
{ "file": "title.tr4", "description": "Lara crossing falling wooden bridge ", "index": 29 },
{ "file": "title.tr4", "description": "Lara fighting Mummy", "index": 30 },
];
function QueryString() {
const query_string = {},
query = window.location.search.substring(1),
vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[decodeURIComponent(pair[0])] === "undefined") {
query_string[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
// If second entry with this name
} else if (typeof query_string[decodeURIComponent(pair[0])] === "string") {
var arr = [ query_string[decodeURIComponent(pair[0])], decodeURIComponent(pair[1]) ];
query_string[decodeURIComponent(pair[0])] = arr;
// If third or later entry with this name
} else {
query_string[decodeURIComponent(pair[0])].push(decodeURIComponent(pair[1]));
}
}
return query_string;
}
function showLevels() {
if (game == 'TR4Cut') {
const js = [];
for (let l = 0; l < CutsceneTR4.length; ++l) {
const cut = CutsceneTR4[l];
if (cut === null) {
continue;
}
const id = cut.file, name = cut.description, idx = cut.index;
const picname = 'cutscene_' + idx;
const img = '<img class="cutscene" src="resources/picture/movie.png"/>';
js.push(
'<span class="thumbnail" level="' + id + '" type="cutscene" cindex="' + idx + '">' +
'<span class="timage"><img class="hvr-pulse" src="resources/picture/TR4Cutscene/' + picname + '.jpg"/></span>' +
'<span class="gametitle">' + img + '<span class="text">' + name + '</span></span>' +
'</span>'
);
}
jQuery('#levels').html(js.join(''));
} else {
fetch('resources/level/TRLevels.xml').then((response) => {
response.text().then((txt) => {
const root = jQuery.parseXML(txt);
var levels = jQuery(root).find('game[id="' + game + '"] > levels > level');
var js = [];
for (var l = 0; l < levels.length; ++l) {
var level = levels[l], id = level.attributes['id'].nodeValue, tp = level.attributes['type'].nodeValue, name = level.attributes['name'].nodeValue, img = '';
var picname = id.substr(0, id.indexOf('.'));
if (tp == 'cutscene') {
img = '<img class="cutscene" src="resources/picture/movie.png"/>';
}
js.push(
'<span class="thumbnail" level="' + id + '" type="' + tp + '">' +
'<span class="timage"><img class="hvr-pulse" src="resources/picture/' + game + '/' + picname + '.jpg"/></span>' +
'<span class="gametitle">' + img + '<span class="text">' + name + '</span></span>' +
'</span>'
);
}
jQuery('#levels').html(js.join(''));
});
});
}
}
jQuery(window).on('load', function() {
var qgame = qs.trgame, qengine = qs.engine;
if (qengine) {
jQuery('#engine').val(qengine);
}
if (qgame) {
jQuery('#trgame').val(qgame);
game = qgame;
}
jQuery('#trgame').on('change', function(event) {
game = this.options[this.selectedIndex].value;
showLevels();
});
jQuery('#levels').on('click', function(event) {
var ot = jQuery(event.target).closest('.thumbnail');
if (ot.length > 0) {
const level = ot.attr('level'), type = ot.attr('type'), engine = jQuery('#engine').val();
let gamepath = game;
if (gamepath == 'TR4Cut') {
gamepath = 'TR4';
}
let url = engine + '/public/TRN.html?relpath=../../&engine=' + engine + '&trgame=' + game + '&level=' + gamepath.toLowerCase() + '/' + level + '&autostart=' + (type == 'cutscene' ? '0' : '1');
if (game == 'TR4Cut') {
url += '&cutscene=' + ot.attr('cindex');
}
document.location.href = url;
}
});
showLevels();
});
</script>
</body>
</html>