summaryrefslogtreecommitdiffstats
path: root/pacman-google
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-03 14:18:18 +0200
committermanuel <manuel@mausz.at>2011-04-03 14:18:18 +0200
commit1fdff302cf1d22beff62b4a705dc44352ccc7a43 (patch)
tree78b8027ec9eb483cd7547a0fb984693fe3211fb7 /pacman-google
parent2ce3395d2e42a2e9e51807f452f2e030a48c6a52 (diff)
downloadfoop-1fdff302cf1d22beff62b4a705dc44352ccc7a43.tar.gz
foop-1fdff302cf1d22beff62b4a705dc44352ccc7a43.tar.bz2
foop-1fdff302cf1d22beff62b4a705dc44352ccc7a43.zip
adding google pacman
Diffstat (limited to 'pacman-google')
-rw-r--r--pacman-google/index.html115
-rw-r--r--pacman-google/src/js/pacman10-hp.2.js3162
-rw-r--r--pacman-google/src/js/pacman10-hp.3.js3200
-rw-r--r--pacman-google/src/js/pacman10-hp.js3163
-rw-r--r--pacman-google/src/pacman10-hp-sprite-2.pngbin0 -> 6857 bytes
-rw-r--r--pacman-google/src/pacman10-hp-sprite.pngbin0 -> 7413 bytes
-rw-r--r--pacman-google/src/pacman10-hp.gifbin0 -> 1757 bytes
-rw-r--r--pacman-google/src/pacman10-hp.pngbin0 -> 7506 bytes
-rw-r--r--pacman-google/src/swf/pacman10-hp-sound.swfbin0 -> 130937 bytes
9 files changed, 9640 insertions, 0 deletions
diff --git a/pacman-google/index.html b/pacman-google/index.html
new file mode 100644
index 0000000..bf507d3
--- /dev/null
+++ b/pacman-google/index.html
@@ -0,0 +1,115 @@
1<!doctype html>
2<html>
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>Google Pacman</title>
6 <script>
7 window.google = {}
8 </script>
9 <style>
10 body{background:#222;font-family:monospace;margin-top:50px}
11 td{line-height:.8em;}
12 form{margin-bottom:20px;}
13 input{font-family:inherit;-moz-box-sizing:content-box}
14 a{color:#11c;text-decoration:none}
15 a:hover,a:active{text-decoration:underline}
16 a:visited{color:#551a8b}
17 #logo{width:554px;height:186px;background:black url(src/pacman10-hp.gif) 0 0 no-repeat;position:relative;margin-bottom:9px}
18 #logo-l{width:200px;height:2px;left:177px;top:157px;background:#990;position:absolute;display:none;overflow:hidden}
19 #logo-b{position:absolute;left:0;background:#ff0;height:8px;width:0}
20 #wrapper{width:554px;height:186px;padding:10px;background:#000;-webkit-border-radius:8px;}
21 .lsb:active{background:-webkit-gradient(linear,left top,left bottom,from(#ccc),to(#ddd))}
22 .ds{display:-moz-inline-box}
23 .ds{border-bottom:solid 1px #e7e7e7;border-right:solid 1px #e7e7e7;display:inline-block;margin:3px 0 4px;margin-left:4px;margin-right:3px:height:32px}
24 .lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px;display:block}
25 .lsb{background:url(/images/srpr/nav_logo13.png) bottom;font:15px arial,sans-serif;border:none;cursor:pointer;height:30px;margin:0;outline:0;vertical-align:top}
26 .lsb:active{background:#ccc}
27 #footer ul{list-style-type:none;padding:0}
28 #footer a{display:inline-block;color:#444;font-size:10pt;font-family:monospace;padding:5px}
29 #footer a:hover{color:#666;text-decoration:none;background:#333}
30
31 </style>
32</head>
33<body>
34 <center>
35 <div id="wrapper">
36 <a href="#gameover" id="dlink"></a>
37 <div id='logo' title="PAC-MAN's 30th Birthday! Doodle with PAC-MAN™ & ©1980 NAMCO BANDAI Games Inc.">
38 <div id="logo-l">
39 <div id="logo-b">
40 </div>
41 </div>
42 </div>
43 </div>
44 <script>
45 google.dom = {};
46 google.pacManSound = true;
47 google.browser = {};
48 google.browser.engine = {}
49
50 google.dom.remove = function (a) {
51 return a && a.parentNode && a.parentNode.removeChild(a)
52 };
53
54 google.dom.append = function (a) {
55 return document.body.appendChild(a)
56 };
57
58 google.browser.engine.IE = false
59 google.pml = function () {
60 function d(a) {
61 if (!google.pml_installed) {
62 google.pml_installed = true;
63 if (!a) {
64 document.getElementById("logo").style.background = "black";
65 window.setTimeout(function () {
66 var b = document.getElementById("logo-l");
67 if (b) b.style.display = "block"
68 }, 400)
69 }
70 a = document.createElement("script");
71 a.type = "text/javascript";
72 a.src = "src/js/pacman10-hp.3.js";
73 document.body.appendChild(a)
74 }
75 }
76 function e() {
77 if (document.f && document.f.btnI) document.f.btnI.onclick = function () {
78 typeof google.pacman != "undefined" ? google.pacman.insertCoin() : d(false);
79 return false
80 }
81 }
82 if (!google.pml_loaded) {
83 google.pml_loaded = true;
84 window.setTimeout(function () {
85 document.f && d(true)
86 }, 1E4);
87 e();
88 }
89 };
90 </script>
91
92 <form action="#submit" name='f'>
93 <table width="23%" cellpadding='0' cellspacing='0'>
94 <tr valign='top'>
95 <td align='center' nowrap><br style="line-height:0">
96 <span class='ds'>
97 <span class='lsbb'>
98 <input name='btnI' type='submit' value="Insert Coin" class='lsb'>
99 </span>
100 </span>
101 </td>
102 </tr>
103 </table>
104 </form>
105
106 <div id="footer">
107 <ul>
108 <li><a href="http://github.com/macek/google_pacman">GitHub macek/google_pacman</a></li>
109 <li><a href="http://google.com">&copy; 2010, Google</a></li>
110 <li><a href="http://pacman.com">&copy; 1980, NAMCO BANDAI Games Inc.</a></li>
111 </ul>
112 </div>
113 <script>google.pml && google.pml()</script>
114 </center>
115</html>
diff --git a/pacman-google/src/js/pacman10-hp.2.js b/pacman-google/src/js/pacman10-hp.2.js
new file mode 100644
index 0000000..ba93880
--- /dev/null
+++ b/pacman-google/src/js/pacman10-hp.2.js
@@ -0,0 +1,3162 @@
1google.pacman ||
2function () {
3 var a = true,
4 e = false,
5 g = {},
6 i = [1, 4, 2, 8],
7 l = {
8 0: {
9 axis: 0,
10 increment: 0
11 },
12 1: {
13 axis: 0,
14 increment: -1
15 },
16 2: {
17 axis: 0,
18 increment: +1
19 },
20 4: {
21 axis: 1,
22 increment: -1
23 },
24 8: {
25 axis: 1,
26 increment: +1
27 }
28 },
29 m = [0, 7, 17, 32],
30 n = [{
31 x: 5,
32 y: 1,
33 w: 56
34 },
35 {
36 x: 5,
37 y: 4,
38 w: 5
39 },
40 {
41 x: 5,
42 y: 1,
43 h: 4
44 },
45 {
46 x: 9,
47 y: 1,
48 h: 12
49 },
50 {
51 x: 5,
52 y: 12,
53 h: 4
54 },
55 {
56 x: 10,
57 y: 12,
58 h: 4
59 },
60 {
61 x: 5,
62 y: 15,
63 w: 16
64 },
65 {
66 x: 5,
67 y: 12,
68 w: 31
69 },
70 {
71 x: 60,
72 y: 1,
73 h: 4
74 },
75 {
76 x: 54,
77 y: 1,
78 h: 4
79 },
80 {
81 x: 19,
82 y: 1,
83 h: 12
84 },
85 {
86 x: 19,
87 y: 4,
88 w: 26
89 },
90 {
91 x: 13,
92 y: 5,
93 w: 7
94 },
95 {
96 x: 13,
97 y: 5,
98 h: 4
99 },
100 {
101 x: 13,
102 y: 8,
103 w: 3
104 },
105 {
106 x: 56,
107 y: 4,
108 h: 9
109 },
110 {
111 x: 48,
112 y: 4,
113 w: 13
114 },
115 {
116 x: 48,
117 y: 1,
118 h: 12
119 },
120 {
121 x: 60,
122 y: 12,
123 h: 4
124 },
125 {
126 x: 44,
127 y: 15,
128 w: 17
129 },
130 {
131 x: 54,
132 y: 12,
133 h: 4
134 },
135 {
136 x: 44,
137 y: 12,
138 w: 17
139 },
140 {
141 x: 44,
142 y: 1,
143 h: 15
144 },
145 {
146 x: 41,
147 y: 13,
148 w: 4
149 },
150 {
151 x: 41,
152 y: 13,
153 h: 3
154 },
155 {
156 x: 38,
157 y: 13,
158 h: 3
159 },
160 {
161 x: 38,
162 y: 15,
163 w: 4
164 },
165 {
166 x: 35,
167 y: 10,
168 w: 10
169 },
170 {
171 x: 35,
172 y: 1,
173 h: 15
174 },
175 {
176 x: 35,
177 y: 13,
178 w: 4
179 },
180 {
181 x: 21,
182 y: 12,
183 h: 4
184 },
185 {
186 x: 24,
187 y: 12,
188 h: 4
189 },
190 {
191 x: 24,
192 y: 15,
193 w: 12
194 },
195 {
196 x: 27,
197 y: 4,
198 h: 9
199 },
200 {
201 x: 52,
202 y: 9,
203 w: 5
204 },
205 {
206 x: 56,
207 y: 8,
208 w: 10,
209 type: 1
210 },
211 {
212 x: 1,
213 y: 8,
214 w: 9,
215 type: 1
216 }],
217 o = [{
218 x: 1,
219 y: 8,
220 w: 8
221 },
222 {
223 x: 57,
224 y: 8,
225 w: 9
226 },
227 {
228 x: 44,
229 y: 2,
230 h: 10
231 },
232 {
233 x: 35,
234 y: 5,
235 h: 7
236 },
237 {
238 x: 36,
239 y: 4,
240 w: 8
241 },
242 {
243 x: 36,
244 y: 10,
245 w: 8
246 },
247 {
248 x: 39,
249 y: 15,
250 w: 2
251 }],
252 p = [{
253 x: 5,
254 y: 15
255 },
256 {
257 x: 5,
258 y: 3
259 },
260 {
261 x: 15,
262 y: 8
263 },
264 {
265 x: 60,
266 y: 3
267 },
268 {
269 x: 60,
270 y: 15
271 }],
272 q = [{
273 x: 2,
274 y: 8
275 },
276 {
277 x: 63,
278 y: 8
279 }],
280 r = {
281 1: [{
282 x: 39.5,
283 y: 15,
284 dir: 4
285 },
286 {
287 x: 39.5,
288 y: 4,
289 dir: 4,
290 scatterX: 57,
291 scatterY: -4
292 },
293 {
294 x: 39.5,
295 y: 7,
296 dir: 2,
297 scatterX: 0,
298 scatterY: -4
299 },
300 {
301 x: 37.625,
302 y: 7,
303 dir: 1,
304 scatterX: 57,
305 scatterY: 20
306 },
307 {
308 x: 41.375,
309 y: 7,
310 dir: 1,
311 scatterX: 0,
312 scatterY: 20
313 }],
314 2: [{
315 x: 40.25,
316 y: 15,
317 dir: 8
318 },
319 {
320 x: 38.75,
321 y: 15,
322 dir: 4
323 },
324 {
325 x: 39.5,
326 y: 4,
327 dir: 4,
328 scatterX: 57,
329 scatterY: -4
330 },
331 {
332 x: 39.5,
333 y: 7,
334 dir: 2,
335 scatterX: 0,
336 scatterY: -4
337 },
338 {
339 x: 37.625,
340 y: 7,
341 dir: 1,
342 scatterX: 57,
343 scatterY: 20
344 },
345 {
346 x: 41.375,
347 y: 7,
348 dir: 1,
349 scatterX: 0,
350 scatterY: 20
351 }]
352 },
353 s = [32, 312],
354 v = [80, 312],
355 w = {
356 0: 0.16,
357 1: 0.23,
358 2: 1,
359 3: 1,
360 4: 2.23,
361 5: 0.3,
362 6: 1.9,
363 7: 2.23,
364 8: 1.9,
365 9: 5,
366 10: 1.9,
367 11: 1.18,
368 12: 0.3,
369 13: 0.5,
370 14: 1.9,
371 15: 9,
372 16: 10,
373 17: 0.26
374 },
375 y = 0.8 * 0.4,
376 z = [{},
377 {
378 ghostSpeed: 0.75,
379 ghostTunnelSpeed: 0.4,
380 playerSpeed: 0.8,
381 dotEatingSpeed: 0.71,
382 ghostFrightSpeed: 0.5,
383 playerFrightSpeed: 0.9,
384 dotEatingFrightSpeed: 0.79,
385 elroyDotsLeftPart1: 20,
386 elroySpeedPart1: 0.8,
387 elroyDotsLeftPart2: 10,
388 elroySpeedPart2: 0.85,
389 frightTime: 6,
390 frightBlinkCount: 5,
391 fruit: 1,
392 fruitScore: 100,
393 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 20, 5, 1],
394 penForceTime: 4,
395 penLeavingLimits: [0, 0, 30, 60]
396 },
397 {
398 ghostSpeed: 0.85,
399 ghostTunnelSpeed: 0.45,
400 playerSpeed: 0.9,
401 dotEatingSpeed: 0.79,
402 ghostFrightSpeed: 0.55,
403 playerFrightSpeed: 0.95,
404 dotEatingFrightSpeed: 0.83,
405 elroyDotsLeftPart1: 30,
406 elroySpeedPart1: 0.9,
407 elroyDotsLeftPart2: 15,
408 elroySpeedPart2: 0.95,
409 frightTime: 5,
410 frightBlinkCount: 5,
411 fruit: 2,
412 fruitScore: 300,
413 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
414 penForceTime: 4,
415 penLeavingLimits: [0, 0, 0, 50],
416 cutsceneId: 1
417 },
418 {
419 ghostSpeed: 0.85,
420 ghostTunnelSpeed: 0.45,
421 playerSpeed: 0.9,
422 dotEatingSpeed: 0.79,
423 ghostFrightSpeed: 0.55,
424 playerFrightSpeed: 0.95,
425 dotEatingFrightSpeed: 0.83,
426 elroyDotsLeftPart1: 40,
427 elroySpeedPart1: 0.9,
428 elroyDotsLeftPart2: 20,
429 elroySpeedPart2: 0.95,
430 frightTime: 4,
431 frightBlinkCount: 5,
432 fruit: 3,
433 fruitScore: 500,
434 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
435 penForceTime: 4,
436 penLeavingLimits: [0, 0, 0, 0]
437 },
438 {
439 ghostSpeed: 0.85,
440 ghostTunnelSpeed: 0.45,
441 playerSpeed: 0.9,
442 dotEatingSpeed: 0.79,
443 ghostFrightSpeed: 0.55,
444 playerFrightSpeed: 0.95,
445 dotEatingFrightSpeed: 0.83,
446 elroyDotsLeftPart1: 40,
447 elroySpeedPart1: 0.9,
448 elroyDotsLeftPart2: 20,
449 elroySpeedPart2: 0.95,
450 frightTime: 3,
451 frightBlinkCount: 5,
452 fruit: 3,
453 fruitScore: 500,
454 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
455 penForceTime: 4,
456 penLeavingLimits: [0, 0, 0, 0]
457 },
458 {
459 ghostSpeed: 0.95,
460 ghostTunnelSpeed: 0.5,
461 playerSpeed: 1,
462 dotEatingSpeed: 0.87,
463 ghostFrightSpeed: 0.6,
464 playerFrightSpeed: 1,
465 dotEatingFrightSpeed: 0.87,
466 elroyDotsLeftPart1: 40,
467 elroySpeedPart1: 1,
468 elroyDotsLeftPart2: 20,
469 elroySpeedPart2: 1.05,
470 frightTime: 2,
471 frightBlinkCount: 5,
472 fruit: 4,
473 fruitScore: 700,
474 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
475 penForceTime: 3,
476 penLeavingLimits: [0, 0, 0, 0],
477 cutsceneId: 2
478 },
479 {
480 ghostSpeed: 0.95,
481 ghostTunnelSpeed: 0.5,
482 playerSpeed: 1,
483 dotEatingSpeed: 0.87,
484 ghostFrightSpeed: 0.6,
485 playerFrightSpeed: 1,
486 dotEatingFrightSpeed: 0.87,
487 elroyDotsLeftPart1: 50,
488 elroySpeedPart1: 1,
489 elroyDotsLeftPart2: 25,
490 elroySpeedPart2: 1.05,
491 frightTime: 5,
492 frightBlinkCount: 5,
493 fruit: 4,
494 fruitScore: 700,
495 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
496 penForceTime: 3,
497 penLeavingLimits: [0, 0, 0, 0]
498 },
499 {
500 ghostSpeed: 0.95,
501 ghostTunnelSpeed: 0.5,
502 playerSpeed: 1,
503 dotEatingSpeed: 0.87,
504 ghostFrightSpeed: 0.6,
505 playerFrightSpeed: 1,
506 dotEatingFrightSpeed: 0.87,
507 elroyDotsLeftPart1: 50,
508 elroySpeedPart1: 1,
509 elroyDotsLeftPart2: 25,
510 elroySpeedPart2: 1.05,
511 frightTime: 2,
512 frightBlinkCount: 5,
513 fruit: 5,
514 fruitScore: 1E3,
515 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
516 penForceTime: 3,
517 penLeavingLimits: [0, 0, 0, 0]
518 },
519 {
520 ghostSpeed: 0.95,
521 ghostTunnelSpeed: 0.5,
522 playerSpeed: 1,
523 dotEatingSpeed: 0.87,
524 ghostFrightSpeed: 0.6,
525 playerFrightSpeed: 1,
526 dotEatingFrightSpeed: 0.87,
527 elroyDotsLeftPart1: 50,
528 elroySpeedPart1: 1,
529 elroyDotsLeftPart2: 25,
530 elroySpeedPart2: 1.05,
531 frightTime: 2,
532 frightBlinkCount: 5,
533 fruit: 5,
534 fruitScore: 1E3,
535 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
536 penForceTime: 3,
537 penLeavingLimits: [0, 0, 0, 0]
538 },
539 {
540 ghostSpeed: 0.95,
541 ghostTunnelSpeed: 0.5,
542 playerSpeed: 1,
543 dotEatingSpeed: 0.87,
544 ghostFrightSpeed: 0.6,
545 playerFrightSpeed: 1,
546 dotEatingFrightSpeed: 0.87,
547 elroyDotsLeftPart1: 60,
548 elroySpeedPart1: 1,
549 elroyDotsLeftPart2: 30,
550 elroySpeedPart2: 1.05,
551 frightTime: 1,
552 frightBlinkCount: 3,
553 fruit: 6,
554 fruitScore: 2E3,
555 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
556 penForceTime: 3,
557 penLeavingLimits: [0, 0, 0, 0],
558 cutsceneId: 3
559 },
560 {
561 ghostSpeed: 0.95,
562 ghostTunnelSpeed: 0.5,
563 playerSpeed: 1,
564 dotEatingSpeed: 0.87,
565 ghostFrightSpeed: 0.6,
566 playerFrightSpeed: 1,
567 dotEatingFrightSpeed: 0.87,
568 elroyDotsLeftPart1: 60,
569 elroySpeedPart1: 1,
570 elroyDotsLeftPart2: 30,
571 elroySpeedPart2: 1.05,
572 frightTime: 5,
573 frightBlinkCount: 5,
574 fruit: 6,
575 fruitScore: 2E3,
576 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
577 penForceTime: 3,
578 penLeavingLimits: [0, 0, 0, 0]
579 },
580 {
581 ghostSpeed: 0.95,
582 ghostTunnelSpeed: 0.5,
583 playerSpeed: 1,
584 dotEatingSpeed: 0.87,
585 ghostFrightSpeed: 0.6,
586 playerFrightSpeed: 1,
587 dotEatingFrightSpeed: 0.87,
588 elroyDotsLeftPart1: 60,
589 elroySpeedPart1: 1,
590 elroyDotsLeftPart2: 30,
591 elroySpeedPart2: 1.05,
592 frightTime: 2,
593 frightBlinkCount: 5,
594 fruit: 7,
595 fruitScore: 3E3,
596 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
597 penForceTime: 3,
598 penLeavingLimits: [0, 0, 0, 0]
599 },
600 {
601 ghostSpeed: 0.95,
602 ghostTunnelSpeed: 0.5,
603 playerSpeed: 1,
604 dotEatingSpeed: 0.87,
605 ghostFrightSpeed: 0.6,
606 playerFrightSpeed: 1,
607 dotEatingFrightSpeed: 0.87,
608 elroyDotsLeftPart1: 80,
609 elroySpeedPart1: 1,
610 elroyDotsLeftPart2: 40,
611 elroySpeedPart2: 1.05,
612 frightTime: 1,
613 frightBlinkCount: 3,
614 fruit: 7,
615 fruitScore: 3E3,
616 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
617 penForceTime: 3,
618 penLeavingLimits: [0, 0, 0, 0]
619 },
620 {
621 ghostSpeed: 0.95,
622 ghostTunnelSpeed: 0.5,
623 playerSpeed: 1,
624 dotEatingSpeed: 0.87,
625 ghostFrightSpeed: 0.6,
626 playerFrightSpeed: 1,
627 dotEatingFrightSpeed: 0.87,
628 elroyDotsLeftPart1: 80,
629 elroySpeedPart1: 1,
630 elroyDotsLeftPart2: 40,
631 elroySpeedPart2: 1.05,
632 frightTime: 1,
633 frightBlinkCount: 3,
634 fruit: 8,
635 fruitScore: 5E3,
636 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
637 penForceTime: 3,
638 penLeavingLimits: [0, 0, 0, 0],
639 cutsceneId: 3
640 },
641 {
642 ghostSpeed: 0.95,
643 ghostTunnelSpeed: 0.5,
644 playerSpeed: 1,
645 dotEatingSpeed: 0.87,
646 ghostFrightSpeed: 0.6,
647 playerFrightSpeed: 1,
648 dotEatingFrightSpeed: 0.87,
649 elroyDotsLeftPart1: 80,
650 elroySpeedPart1: 1,
651 elroyDotsLeftPart2: 40,
652 elroySpeedPart2: 1.05,
653 frightTime: 3,
654 frightBlinkCount: 5,
655 fruit: 8,
656 fruitScore: 5E3,
657 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
658 penForceTime: 3,
659 penLeavingLimits: [0, 0, 0, 0]
660 },
661 {
662 ghostSpeed: 0.95,
663 ghostTunnelSpeed: 0.5,
664 playerSpeed: 1,
665 dotEatingSpeed: 0.87,
666 ghostFrightSpeed: 0.6,
667 playerFrightSpeed: 1,
668 dotEatingFrightSpeed: 0.87,
669 elroyDotsLeftPart1: 100,
670 elroySpeedPart1: 1,
671 elroyDotsLeftPart2: 50,
672 elroySpeedPart2: 1.05,
673 frightTime: 1,
674 frightBlinkCount: 3,
675 fruit: 8,
676 fruitScore: 5E3,
677 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
678 penForceTime: 3,
679 penLeavingLimits: [0, 0, 0, 0]
680 },
681 {
682 ghostSpeed: 0.95,
683 ghostTunnelSpeed: 0.5,
684 playerSpeed: 1,
685 dotEatingSpeed: 0.87,
686 ghostFrightSpeed: 0.6,
687 playerFrightSpeed: 1,
688 dotEatingFrightSpeed: 0.87,
689 elroyDotsLeftPart1: 100,
690 elroySpeedPart1: 1,
691 elroyDotsLeftPart2: 50,
692 elroySpeedPart2: 1.05,
693 frightTime: 1,
694 frightBlinkCount: 3,
695 fruit: 8,
696 fruitScore: 5E3,
697 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
698 penForceTime: 3,
699 penLeavingLimits: [0, 0, 0, 0]
700 },
701 {
702 ghostSpeed: 0.95,
703 ghostTunnelSpeed: 0.5,
704 playerSpeed: 1,
705 dotEatingSpeed: 0.87,
706 ghostFrightSpeed: 0.6,
707 playerFrightSpeed: 1,
708 dotEatingFrightSpeed: 0.87,
709 elroyDotsLeftPart1: 100,
710 elroySpeedPart1: 1,
711 elroyDotsLeftPart2: 50,
712 elroySpeedPart2: 1.05,
713 frightTime: 0,
714 frightBlinkCount: 0,
715 fruit: 8,
716 fruitScore: 5E3,
717 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
718 penForceTime: 3,
719 penLeavingLimits: [0, 0, 0, 0],
720 cutsceneId: 3
721 },
722 {
723 ghostSpeed: 0.95,
724 ghostTunnelSpeed: 0.5,
725 playerSpeed: 1,
726 dotEatingSpeed: 0.87,
727 ghostFrightSpeed: 0.6,
728 playerFrightSpeed: 1,
729 dotEatingFrightSpeed: 0.87,
730 elroyDotsLeftPart1: 100,
731 elroySpeedPart1: 1,
732 elroyDotsLeftPart2: 50,
733 elroySpeedPart2: 1.05,
734 frightTime: 1,
735 frightBlinkCount: 3,
736 fruit: 8,
737 fruitScore: 5E3,
738 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
739 penForceTime: 3,
740 penLeavingLimits: [0, 0, 0, 0]
741 },
742 {
743 ghostSpeed: 0.95,
744 ghostTunnelSpeed: 0.5,
745 playerSpeed: 1,
746 dotEatingSpeed: 0.87,
747 ghostFrightSpeed: 0.6,
748 playerFrightSpeed: 1,
749 dotEatingFrightSpeed: 0.87,
750 elroyDotsLeftPart1: 120,
751 elroySpeedPart1: 1,
752 elroyDotsLeftPart2: 60,
753 elroySpeedPart2: 1.05,
754 frightTime: 0,
755 frightBlinkCount: 0,
756 fruit: 8,
757 fruitScore: 5E3,
758 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
759 penForceTime: 3,
760 penLeavingLimits: [0, 0, 0, 0]
761 },
762 {
763 ghostSpeed: 0.95,
764 ghostTunnelSpeed: 0.5,
765 playerSpeed: 1,
766 dotEatingSpeed: 0.87,
767 ghostFrightSpeed: 0.6,
768 playerFrightSpeed: 1,
769 dotEatingFrightSpeed: 0.87,
770 elroyDotsLeftPart1: 120,
771 elroySpeedPart1: 1,
772 elroyDotsLeftPart2: 60,
773 elroySpeedPart2: 1.05,
774 frightTime: 0,
775 frightBlinkCount: 0,
776 fruit: 8,
777 fruitScore: 5E3,
778 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
779 penForceTime: 3,
780 penLeavingLimits: [0, 0, 0, 0]
781 },
782 {
783 ghostSpeed: 0.95,
784 ghostTunnelSpeed: 0.5,
785 playerSpeed: 0.9,
786 dotEatingSpeed: 0.79,
787 ghostFrightSpeed: 0.75,
788 playerFrightSpeed: 0.9,
789 dotEatingFrightSpeed: 0.79,
790 elroyDotsLeftPart1: 120,
791 elroySpeedPart1: 1,
792 elroyDotsLeftPart2: 60,
793 elroySpeedPart2: 1.05,
794 frightTime: 0,
795 frightBlinkCount: 0,
796 fruit: 8,
797 fruitScore: 5E3,
798 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
799 penForceTime: 3,
800 penLeavingLimits: [0, 0, 0, 0]
801 }],
802 A = {
803 1: [{
804 x: 37.6,
805 y: 7,
806 dir: 1,
807 dest: 6.375,
808 speed: 0.48
809 },
810 {
811 x: 37.6,
812 y: 6.375,
813 dir: 2,
814 dest: 7.625,
815 speed: 0.48
816 },
817 {
818 x: 37.6,
819 y: 7.625,
820 dir: 1,
821 dest: 7,
822 speed: 0.48
823 }],
824 2: [{
825 x: 39.5,
826 y: 7,
827 dir: 2,
828 dest: 7.625,
829 speed: 0.48
830 },
831 {
832 x: 39.5,
833 y: 7.625,
834 dir: 1,
835 dest: 6.375,
836 speed: 0.48
837 },
838 {
839 x: 39.5,
840 y: 6.375,
841 dir: 2,
842 dest: 7,
843 speed: 0.48
844 }],
845 3: [{
846 x: 41.4,
847 y: 7,
848 dir: 1,
849 dest: 6.375,
850 speed: 0.48
851 },
852 {
853 x: 41.4,
854 y: 6.375,
855 dir: 2,
856 dest: 7.625,
857 speed: 0.48
858 },
859 {
860 x: 41.4,
861 y: 7.625,
862 dir: 1,
863 dest: 7,
864 speed: 0.48
865 }],
866 4: [{
867 x: 37.6,
868 y: 7,
869 dir: 8,
870 dest: 39.5,
871 speed: y
872 },
873 {
874 x: 39.5,
875 y: 7,
876 dir: 1,
877 dest: 4,
878 speed: y
879 }],
880 5: [{
881 x: 39.5,
882 y: 7,
883 dir: 1,
884 dest: 4,
885 speed: y
886 }],
887 6: [{
888 x: 41.4,
889 y: 7,
890 dir: 4,
891 dest: 39.5,
892 speed: y
893 },
894 {
895 x: 39.5,
896 y: 7,
897 dir: 1,
898 dest: 4,
899 speed: y
900 }],
901 7: [{
902 x: 39.5,
903 y: 4,
904 dir: 2,
905 dest: 7,
906 speed: 1.6
907 },
908 {
909 x: 39.5,
910 y: 7,
911 dir: 4,
912 dest: 37.625,
913 speed: 1.6
914 }],
915 8: [{
916 x: 39.5,
917 y: 4,
918 dir: 2,
919 dest: 7,
920 speed: 1.6
921 }],
922 9: [{
923 x: 39.5,
924 y: 4,
925 dir: 2,
926 dest: 7,
927 speed: 1.6
928 },
929 {
930 x: 39.5,
931 y: 7,
932 dir: 8,
933 dest: 41.375,
934 speed: 1.6
935 }],
936 10: [{
937 x: 37.6,
938 y: 7,
939 dir: 8,
940 dest: 39.5,
941 speed: y
942 },
943 {
944 x: 39.5,
945 y: 7,
946 dir: 1,
947 dest: 4,
948 speed: y
949 }],
950 11: [{
951 x: 39.5,
952 y: 7,
953 dir: 1,
954 dest: 4,
955 speed: y
956 }],
957 12: [{
958 x: 41.4,
959 y: 7,
960 dir: 4,
961 dest: 39.5,
962 speed: y
963 },
964 {
965 x: 39.5,
966 y: 7,
967 dir: 1,
968 dest: 4,
969 speed: y
970 }]
971 },
972 B = {
973 1: {
974 actors: [{
975 ghost: e,
976 x: 64,
977 y: 9,
978 id: 0
979 },
980 {
981 ghost: a,
982 x: 68.2,
983 y: 9,
984 id: 1
985 }],
986 sequence: [{
987 time: 5.5,
988 moves: [{
989 dir: 4,
990 speed: 0.75 * 0.8 * 2
991 },
992 {
993 dir: 4,
994 speed: 0.78 * 0.8 * 2
995 }]
996 },
997 {
998 time: 0.1,
999 moves: [{
1000 dir: 4,
1001 speed: 32
1002 },
1003 {
1004 dir: 4,
1005 speed: 0
1006 }]
1007 },
1008 {
1009 time: 9,
1010 moves: [{
1011 dir: 8,
1012 speed: 0.75 * 0.8 * 2,
1013 elId: "pcm-bpcm"
1014 },
1015 {
1016 dir: 8,
1017 speed: 0.8,
1018 mode: 4
1019 }]
1020 }]
1021 },
1022 2: {
1023 actors: [{
1024 ghost: e,
1025 x: 64,
1026 y: 9,
1027 id: 0
1028 },
1029 {
1030 ghost: a,
1031 x: 70.2,
1032 y: 9,
1033 id: 1
1034 },
1035 {
1036 ghost: a,
1037 x: 32,
1038 y: 9.5,
1039 id: 2
1040 }],
1041 sequence: [{
1042 time: 2.7,
1043 moves: [{
1044 dir: 4,
1045 speed: 0.75 * 0.8 * 2
1046 },
1047 {
1048 dir: 4,
1049 speed: 0.78 * 0.8 * 2
1050 },
1051 {
1052 dir: 0,
1053 speed: 0,
1054 elId: "pcm-stck"
1055 }]
1056 },
1057 {
1058 time: 1,
1059 moves: [{
1060 dir: 4,
1061 speed: 0.75 * 0.8 * 2
1062 },
1063 {
1064 dir: 4,
1065 speed: 0.1 * 0.8
1066 },
1067 {
1068 dir: 0,
1069 speed: 0,
1070 elId: "pcm-stck"
1071 }]
1072 },
1073 {
1074 time: 1.3,
1075 moves: [{
1076 dir: 4,
1077 speed: 0.75 * 0.8 * 2
1078 },
1079 {
1080 dir: 4,
1081 speed: 0
1082 },
1083 {
1084 dir: 0,
1085 speed: 0,
1086 elId: "pcm-stck"
1087 }]
1088 },
1089 {
1090 time: 1,
1091 moves: [{
1092 dir: 4,
1093 speed: 0.75 * 0.8 * 2
1094 },
1095 {
1096 dir: 4,
1097 speed: 0,
1098 elId: "pcm-ghfa"
1099 },
1100 {
1101 dir: 0,
1102 speed: 0,
1103 elId: "pcm-stck"
1104 }]
1105 },
1106 {
1107 time: 2.5,
1108 moves: [{
1109 dir: 4,
1110 speed: 0.75 * 0.8 * 2
1111 },
1112 {
1113 dir: 4,
1114 speed: 0,
1115 elId: "pcm-ghfa"
1116 },
1117 {
1118 dir: 0,
1119 speed: 0,
1120 elId: "pcm-stck"
1121 }]
1122 }]
1123 },
1124 3: {
1125 actors: [{
1126 ghost: e,
1127 x: 64,
1128 y: 9,
1129 id: 0
1130 },
1131 {
1132 ghost: a,
1133 x: 70.2,
1134 y: 9,
1135 id: 2
1136 }],
1137 sequence: [{
1138 time: 5.3,
1139 moves: [{
1140 dir: 4,
1141 speed: 0.75 * 0.8 * 2
1142 },
1143 {
1144 dir: 4,
1145 speed: 0.78 * 0.8 * 2,
1146 elId: "pcm-ghin"
1147 }]
1148 },
1149 {
1150 time: 5.3,
1151 moves: [{
1152 dir: 4,
1153 speed: 0
1154 },
1155 {
1156 dir: 8,
1157 speed: 0.78 * 0.8 * 2,
1158 elId: "pcm-gbug"
1159 }]
1160 }]
1161 }
1162 },
1163 C = [90, 45, 30],
1164 D = C[0];
1165
1166 function E(b) {
1167 this.id = b
1168 }
1169 E.prototype.A = function () {
1170 var b = r[g.playerCount][this.id];
1171 this.pos = [b.y * 8, b.x * 8];
1172 this.posDelta = [0, 0];
1173 this.tilePos = [b.y * 8, b.x * 8];
1174 this.targetPos = [b.scatterY * 8, b.scatterX * 8];
1175 this.scatterPos = [b.scatterY * 8, b.scatterX * 8];
1176 this.lastActiveDir = this.dir = b.dir;
1177 this.physicalSpeed = this.requestedDir = this.nextDir = 0;
1178 this.c(0);
1179 this.reverseDirectionsNext = this.freeToLeavePen = this.modeChangedWhileInPen = this.eatenInThisFrightMode = e;
1180 this.l()
1181 };
1182 E.prototype.createElement = function () {
1183 this.el = document.createElement("div");
1184 this.el.className = "pcm-ac";
1185 this.el.id = "actor" + this.id;
1186 g.prepareElement(this.el, 0, 0);
1187 g.playfieldEl.appendChild(this.el);
1188 this.elPos = [0, 0];
1189 this.elBackgroundPos = [0, 0]
1190 };
1191 E.prototype.a = function (b) {
1192 var c = this.mode;
1193 this.mode = b;
1194 if (this.id == g.playerCount + 3 && (b == 16 || c == 16)) g.updateCruiseElroySpeed();
1195 switch (c) {
1196 case 32:
1197 g.ghostExitingPenNow = e;
1198 break;
1199 case 8:
1200 g.ghostEyesCount > 0 && g.ghostEyesCount--;
1201 g.ghostEyesCount == 0 && g.playAmbientSound();
1202 break
1203 }
1204 switch (b) {
1205 case 4:
1206 this.fullSpeed = g.levels.ghostFrightSpeed * 0.8;
1207 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1208 this.followingRoutine = e;
1209 break;
1210 case 1:
1211 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1212 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1213 this.followingRoutine =
1214 e;
1215 break;
1216 case 2:
1217 this.targetPos = this.scatterPos;
1218 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1219 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1220 this.followingRoutine = e;
1221 break;
1222 case 8:
1223 this.tunnelSpeed = this.fullSpeed = 1.6;
1224 this.targetPos = [s[0], s[1]];
1225 this.freeToLeavePen = this.followingRoutine = e;
1226 break;
1227 case 16:
1228 this.l();
1229 this.followingRoutine = a;
1230 this.routineMoveId = -1;
1231 switch (this.id) {
1232 case g.playerCount + 1:
1233 this.routineToFollow = 2;
1234 break;
1235 case g.playerCount + 2:
1236 this.routineToFollow = 1;
1237 break;
1238 case g.playerCount + 3:
1239 this.routineToFollow =
1240 3;
1241 break
1242 }
1243 break;
1244 case 32:
1245 this.followingRoutine = a;
1246 this.routineMoveId = -1;
1247 switch (this.id) {
1248 case g.playerCount + 1:
1249 this.routineToFollow = 5;
1250 break;
1251 case g.playerCount + 2:
1252 this.routineToFollow = 4;
1253 break;
1254 case g.playerCount + 3:
1255 this.routineToFollow = 6;
1256 break
1257 }
1258 g.ghostExitingPenNow = a;
1259 break;
1260 case 64:
1261 this.followingRoutine = a;
1262 this.routineMoveId = -1;
1263 switch (this.id) {
1264 case g.playerCount:
1265 case g.playerCount + 1:
1266 this.routineToFollow = 8;
1267 break;
1268 case g.playerCount + 2:
1269 this.routineToFollow = 7;
1270 break;
1271 case g.playerCount + 3:
1272 this.routineToFollow = 9;
1273 break
1274 }
1275 break;
1276 case 128:
1277 this.followingRoutine = a;
1278 this.routineMoveId = -1;
1279 switch (this.id) {
1280 case g.playerCount:
1281 case g.playerCount + 1:
1282 this.routineToFollow = 11;
1283 break;
1284 case g.playerCount + 2:
1285 this.routineToFollow = 10;
1286 break;
1287 case g.playerCount + 3:
1288 this.routineToFollow = 12;
1289 break
1290 }
1291 break
1292 }
1293 this.d()
1294 };
1295 E.prototype.l = function () {
1296 if (this.id >= g.playerCount) this.targetPlayerId = Math.floor(g.rand() * g.playerCount)
1297 };
1298 E.prototype.z = function (b) {
1299 if (this.dir == g.oppositeDirections[b]) {
1300 this.dir = b;
1301 this.posDelta = [0, 0];
1302 this.currentSpeed != 2 && this.c(0);
1303 if (this.dir != 0) this.lastActiveDir = this.dir;
1304 this.nextDir = 0
1305 } else if (this.dir != b) if (this.dir == 0) {
1306 if (g.playfield[this.pos[0]][this.pos[1]].allowedDir & b) this.dir = b
1307 } else {
1308 var c = g.playfield[this.tilePos[0]][this.tilePos[1]];
1309 if (c && c.allowedDir & b) {
1310 c = l[this.dir];
1311 var d = [this.pos[0], this.pos[1]];
1312 d[c.axis] -= c.increment;
1313 var f = 0;
1314 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 1;
1315 else {
1316 d[c.axis] -= c.increment;
1317 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 2
1318 }
1319 if (f) {
1320 this.dir = b;
1321 this.pos[0] = this.tilePos[0];
1322 this.pos[1] = this.tilePos[1];
1323 c = l[this.dir];
1324 this.pos[c.axis] += c.increment * f;
1325 return
1326 }
1327 }
1328 this.nextDir = b;
1329 this.posDelta = [0, 0]
1330 }
1331 };
1332 E.prototype.i = function (b) {
1333 var c = this.tilePos,
1334 d = l[this.dir],
1335 f = [c[0], c[1]];
1336 f[d.axis] += d.increment * 8;
1337 var h = g.playfield[f[0]][f[1]];
1338 if (b && !h.intersection) h = g.playfield[c[0]][c[1]];
1339 if (h.intersection) switch (this.mode) {
1340 case 2:
1341 case 1:
1342 case 8:
1343 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1344 else {
1345 b = 99999999999;
1346 c = 0;
1347 for (var j in i) {
1348 var k = i[j];
1349 if (h.allowedDir & k && this.dir != g.oppositeDirections[k]) {
1350 d = l[k];
1351 var x = [f[0], f[1]];
1352 x[d.axis] += d.increment;
1353 d = g.getDistance(x, [this.targetPos[0], this.targetPos[1]]);
1354 if (d < b) {
1355 b = d;
1356 c = k
1357 }
1358 }
1359 }
1360 if (c) this.nextDir = c
1361 }
1362 break;
1363 case 4:
1364 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1365 else {
1366 do f = i[Math.floor(g.rand() * 4)];
1367 while ((f & h.allowedDir) == 0 || f == g.oppositeDirections[this.dir]);
1368 this.nextDir = f
1369 }
1370 break
1371 }
1372 };
1373 E.prototype.p = function (b) {
1374 g.tilesChanged = a;
1375 if (this.reverseDirectionsNext) {
1376 this.dir = g.oppositeDirections[this.dir];
1377 this.nextDir = 0;
1378 this.reverseDirectionsNext = e;
1379 this.i(a)
1380 }
1381 if (!this.ghost && !g.playfield[b[0]][b[1]].path) {
1382 this.pos[0] = this.lastGoodTilePos[0];
1383 this.pos[1] = this.lastGoodTilePos[1];
1384 b[0] = this.lastGoodTilePos[0];
1385 b[1] = this.lastGoodTilePos[1];
1386 this.dir = 0
1387 } else this.lastGoodTilePos = [b[0], b[1]];
1388 g.playfield[b[0]][b[1]].type == 1 && this.mode != 8 ? this.c(2) : this.c(0);
1389 !this.ghost && g.playfield[b[0]][b[1]].dot && g.dotEaten(this.id, b);
1390 this.tilePos[0] = b[0];
1391 this.tilePos[1] = b[1]
1392 };
1393 E.prototype.t = function () {
1394 var b = this.tilePos;
1395 switch (this.dir) {
1396 case 1:
1397 var c = [b[0], b[1]],
1398 d = [b[0] + 3.6, b[1]];
1399 break;
1400 case 2:
1401 c = [b[0] - 4, b[1]];
1402 d = [b[0], b[1]];
1403 break;
1404 case 4:
1405 c = [b[0], b[1]];
1406 d = [b[0], b[1] + 3.6];
1407 break;
1408 case 8:
1409 c = [b[0], b[1] - 4];
1410 d = [b[0], b[1]];
1411 break
1412 }
1413 if (this.pos[0] >= c[0] && this.pos[0] <= d[0] && this.pos[1] >= c[1] && this.pos[1] <= d[1]) {
1414 b = l[this.nextDir];
1415 this.posDelta[b.axis] += b.increment
1416 }
1417 };
1418 E.prototype.n = function () {
1419 if (this.pos[0] == q[0].y * 8 && this.pos[1] == q[0].x * 8) {
1420 this.pos[0] = q[1].y * 8;
1421 this.pos[1] = (q[1].x - 1) * 8
1422 } else if (this.pos[0] == q[1].y * 8 && this.pos[1] == q[1].x * 8) {
1423 this.pos[0] = q[0].y * 8;
1424 this.pos[1] = (q[0].x + 1) * 8
1425 }
1426 this.mode == 8 && this.pos[0] == s[0] && this.pos[1] == s[1] && this.a(64);
1427 if (!this.ghost && this.pos[0] == v[0] && (this.pos[1] == v[1] || this.pos[1] == v[1] + 8)) g.eatFruit(this.id)
1428 };
1429 E.prototype.u = function () {
1430 this.n();
1431 this.ghost && this.i(e);
1432 var b = g.playfield[this.pos[0]][this.pos[1]];
1433 if (b.intersection) if (this.nextDir && this.nextDir & b.allowedDir) {
1434 if (this.dir != 0) this.lastActiveDir = this.dir;
1435 this.dir = this.nextDir;
1436 this.nextDir = 0;
1437 if (!this.ghost) {
1438 this.pos[0] += this.posDelta[0];
1439 this.pos[1] += this.posDelta[1];
1440 this.posDelta = [0, 0]
1441 }
1442 } else if ((this.dir & b.allowedDir) == 0) {
1443 if (this.dir != 0) this.lastActiveDir = this.dir;
1444 this.nextDir = this.dir = 0;
1445 this.c(0)
1446 }
1447 };
1448 E.prototype.o = function () {
1449 var b = this.pos[0] / 8,
1450 c = this.pos[1] / 8,
1451 d = [Math.round(b) * 8, Math.round(c) * 8];
1452 if (d[0] != this.tilePos[0] || d[1] != this.tilePos[1]) this.p(d);
1453 else {
1454 b = [Math.floor(b) * 8, Math.floor(c) * 8];
1455 this.pos[1] == b[1] && this.pos[0] == b[0] && this.u()
1456 }!this.ghost && this.nextDir && g.playfield[d[0]][d[1]].intersection && this.nextDir & g.playfield[d[0]][d[1]].allowedDir && this.t()
1457 };
1458 E.prototype.B = function () {
1459 if (this.id == g.playerCount && g.dotsRemaining < g.levels.elroyDotsLeftPart1 && this.mode == 2 && (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16)) {
1460 var b = g.actors[this.targetPlayerId];
1461 this.targetPos = [b.tilePos[0], b.tilePos[1]]
1462 } else if (this.ghost && this.mode == 1) {
1463 b = g.actors[this.targetPlayerId];
1464 switch (this.id) {
1465 case g.playerCount:
1466 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1467 break;
1468 case g.playerCount + 1:
1469 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1470 var c = l[b.dir];
1471 this.targetPos[c.axis] += 32 * c.increment;
1472 if (b.dir == 1) this.targetPos[1] -= 32;
1473 break;
1474 case g.playerCount + 2:
1475 var d = g.actors[g.playerCount],
1476 f = [b.tilePos[0], b.tilePos[1]];
1477 c = l[b.dir];
1478 f[c.axis] += 16 * c.increment;
1479 if (b.dir == 1) f[1] -= 16;
1480 this.targetPos[0] = f[0] * 2 - d.tilePos[0];
1481 this.targetPos[1] = f[1] * 2 - d.tilePos[1];
1482 break;
1483 case g.playerCount + 3:
1484 c = g.getDistance(b.tilePos, this.tilePos);
1485 this.targetPos = c > 64 ? [b.tilePos[0], b.tilePos[1]] : this.scatterPos;
1486 break
1487 }
1488 }
1489 };
1490 E.prototype.v = function () {
1491 this.routineMoveId++;
1492 if (this.routineMoveId == A[this.routineToFollow].length) if (this.mode == 16 && this.freeToLeavePen && !g.ghostExitingPenNow) {
1493 this.eatenInThisFrightMode ? this.a(128) : this.a(32);
1494 return
1495 } else if (this.mode == 32 || this.mode == 128) {
1496 this.pos = [s[0], s[1] + 4];
1497 this.dir = this.modeChangedWhileInPen ? 8 : 4;
1498 var b = g.mainGhostMode;
1499 if (this.mode == 128 && b == 4) b = g.lastMainGhostMode;
1500 this.a(b);
1501 return
1502 } else if (this.mode == 64) {
1503 if (this.id == g.playerCount || this.freeToLeavePen) this.a(128);
1504 else {
1505 this.eatenInThisFrightMode =
1506 a;
1507 this.a(16)
1508 }
1509 return
1510 } else this.routineMoveId = 0;
1511 b = A[this.routineToFollow][this.routineMoveId];
1512 this.pos[0] = b.y * 8;
1513 this.pos[1] = b.x * 8;
1514 this.dir = b.dir;
1515 this.physicalSpeed = 0;
1516 this.speedIntervals = g.getSpeedIntervals(b.speed);
1517 this.proceedToNextRoutineMove = e;
1518 this.b()
1519 };
1520 E.prototype.m = function () {
1521 var b = A[this.routineToFollow][this.routineMoveId];
1522 if (b) if (this.speedIntervals[g.intervalTime]) {
1523 var c = l[this.dir];
1524 this.pos[c.axis] += c.increment;
1525 switch (this.dir) {
1526 case 1:
1527 case 4:
1528 if (this.pos[c.axis] < b.dest * 8) {
1529 this.pos[c.axis] = b.dest * 8;
1530 this.proceedToNextRoutineMove = a
1531 }
1532 break;
1533 case 2:
1534 case 8:
1535 if (this.pos[c.axis] > b.dest * 8) {
1536 this.pos[c.axis] = b.dest * 8;
1537 this.proceedToNextRoutineMove = a
1538 }
1539 break
1540 }
1541 this.b()
1542 }
1543 };
1544 E.prototype.j = function () {
1545 if (this.routineMoveId == -1 || this.proceedToNextRoutineMove) this.v();
1546 this.m()
1547 };
1548 E.prototype.d = function () {
1549 switch (this.currentSpeed) {
1550 case 0:
1551 var b = this.id == g.playerCount && (this.mode == 2 || this.mode == 1) ? g.cruiseElroySpeed : this.fullSpeed;
1552 break;
1553 case 1:
1554 b = this.dotEatingSpeed;
1555 break;
1556 case 2:
1557 b = this.tunnelSpeed;
1558 break
1559 }
1560 if (this.physicalSpeed != b) {
1561 this.physicalSpeed = b;
1562 this.speedIntervals = g.getSpeedIntervals(this.physicalSpeed)
1563 }
1564 };
1565 E.prototype.c = function (b) {
1566 this.currentSpeed = b;
1567 this.d()
1568 };
1569 E.prototype.e = function () {
1570 if (this.dir) if (this.speedIntervals[g.intervalTime]) {
1571 var b = l[this.dir];
1572 this.pos[b.axis] += b.increment;
1573 this.o();
1574 this.b()
1575 }
1576 };
1577 E.prototype.move = function () {
1578 if (g.gameplayMode == 0 || this.ghost && g.gameplayMode == 1 && (this.mode == 8 || this.mode == 64)) {
1579 if (this.requestedDir != 0) {
1580 this.z(this.requestedDir);
1581 this.requestedDir = 0
1582 }
1583 if (this.followingRoutine) {
1584 this.j();
1585 this.mode == 64 && this.j()
1586 } else {
1587 this.e();
1588 this.mode == 8 && this.e()
1589 }
1590 }
1591 };
1592 E.prototype.k = function () {
1593 var b = g.getPlayfieldX(this.pos[1] + this.posDelta[1]),
1594 c = g.getPlayfieldY(this.pos[0] + this.posDelta[0]);
1595 if (this.elPos[0] != c || this.elPos[1] != b) {
1596 this.elPos[0] = c;
1597 this.elPos[1] = b;
1598 this.el.style.left = b + "px";
1599 this.el.style.top = c + "px"
1600 }
1601 };
1602 E.prototype.s = function () {
1603 var b = 0,
1604 c = 0,
1605 d = this.dir;
1606 if (d == 0) d = this.lastActiveDir;
1607 if (g.gameplayMode == 1 && this.id == g.playerEatingGhostId) {
1608 b = 3;
1609 c = 0
1610 } else if ((g.gameplayMode == 9 || g.gameplayMode == 10) && this.id == 0) {
1611 b = 2;
1612 c = 0
1613 } else if (g.gameplayMode == 4 || g.gameplayMode == 5 || g.gameplayMode == 7) {
1614 b = this.id == 0 ? 2 : 4;
1615 c = 0
1616 } else if (g.gameplayMode == 3) if (this.id == g.playerDyingId) {
1617 d = 20 - Math.floor(g.gameplayModeTime / g.timing[4] * 21);
1618 if (this.id == 0) {
1619 b = d - 1;
1620 switch (b) {
1621 case -1:
1622 b = 0;
1623 break;
1624 case 11:
1625 b = 10;
1626 break;
1627 case 12:
1628 case 13:
1629 case 14:
1630 case 15:
1631 case 16:
1632 case 17:
1633 case 18:
1634 case 19:
1635 case 20:
1636 b =
1637 11;
1638 break
1639 }
1640 c = 12
1641 } else switch (d) {
1642 case 0:
1643 case 1:
1644 case 2:
1645 case 6:
1646 case 10:
1647 b = 4;
1648 c = 3;
1649 break;
1650 case 3:
1651 case 7:
1652 case 11:
1653 b = 4;
1654 c = 0;
1655 break;
1656 case 4:
1657 case 8:
1658 case 12:
1659 case 13:
1660 case 14:
1661 case 15:
1662 case 16:
1663 case 17:
1664 case 18:
1665 case 19:
1666 case 20:
1667 b = 4;
1668 c = 2;
1669 break;
1670 case 5:
1671 case 9:
1672 b = 4;
1673 c = 1;
1674 break
1675 }
1676 } else {
1677 b = 3;
1678 c = 0
1679 } else if (this.el.id == "pcm-bpcm") {
1680 b = 14;
1681 c = 0;
1682 d = Math.floor(g.globalTime * 0.2) % 4;
1683 if (d == 3) d = 1;
1684 c += 2 * d
1685 } else {
1686 switch (d) {
1687 case 4:
1688 c = 0;
1689 break;
1690 case 8:
1691 c = 1;
1692 break;
1693 case 1:
1694 c = 2;
1695 break;
1696 case 2:
1697 c = 3;
1698 break
1699 }
1700 if (g.gameplayMode != 2) b = Math.floor(g.globalTime * 0.3) % 4;
1701 if (b == 3 && this.dir == 0) b = 0;
1702 if (b == 2 && this.id == 0) b = 0;
1703 if (b == 3) {
1704 b = 2;
1705 if (this.id == 0) c = 0
1706 }
1707 if (this.id == 1) b += 4
1708 }
1709 return [c, b]
1710 };
1711 E.prototype.r = function () {
1712 var b = 0,
1713 c = 0;
1714 if (g.gameplayMode == 10 || g.gameplayMode == 4 || g.gameplayMode == 3) {
1715 b = 3;
1716 c = 0
1717 } else if (g.gameplayMode == 1 && this.id == g.ghostBeingEatenId) {
1718 switch (g.modeScoreMultiplier) {
1719 case 2:
1720 b = 0;
1721 break;
1722 case 4:
1723 b = 1;
1724 break;
1725 case 8:
1726 b = 2;
1727 break;
1728 case 16:
1729 b = 3;
1730 break
1731 }
1732 c = 11;
1733 this.el.className = "pcm-ac pcm-n"
1734 } else if (this.mode == 4 || (this.mode == 16 || this.mode == 32) && g.mainGhostMode == 4 && !this.eatenInThisFrightMode) {
1735 b = 0;
1736 c = 8;
1737 if (g.frightModeTime < g.levels.frightTotalTime - g.levels.frightTime && Math.floor(g.frightModeTime / g.timing[1]) % 2 == 0) b += 2;
1738 b += Math.floor(g.globalTime / 16) % 2
1739 } else if (this.mode == 8 || this.mode == 64) {
1740 c = this.nextDir;
1741 if (!c) c = this.dir;
1742 switch (c) {
1743 case 4:
1744 b = 2;
1745 break;
1746 case 8:
1747 b = 3;
1748 break;
1749 case 1:
1750 b = 0;
1751 break;
1752 case 2:
1753 b = 1;
1754 break
1755 }
1756 c = 10
1757 } else if (this.el.id == "pcm-ghin") {
1758 b = 6;
1759 c = 8;
1760 b += Math.floor(g.globalTime / 16) % 2
1761 } else if (this.el.id == "pcm-gbug") {
1762 b = 6;
1763 c = 9;
1764 c += Math.floor(g.globalTime / 16) % 2
1765 } else if (this.el.id == "pcm-ghfa") {
1766 b = g.cutsceneSequenceId == 3 ? 6 : 7;
1767 c = 11
1768 } else if (this.el.id == "pcm-stck") {
1769 b = g.cutsceneSequenceId == 1 ? g.cutsceneTime > 60 ? 1 : g.cutsceneTime > 45 ? 2 : 3 : g.cutsceneSequenceId == 2 ? 3 : g.cutsceneSequenceId == 3 || g.cutsceneSequenceId == 4 ? 4 : 0;
1770 c = 13
1771 } else {
1772 c = this.nextDir;
1773 if (!c || g.playfield[this.tilePos[0]][this.tilePos[1]].type == 1) c = this.dir;
1774 switch (c) {
1775 case 4:
1776 b = 4;
1777 break;
1778 case 8:
1779 b = 6;
1780 break;
1781 case 1:
1782 b = 0;
1783 break;
1784 case 2:
1785 b = 2;
1786 break
1787 }
1788 c = 4 + this.id - g.playerCount;
1789 if (this.speed > 0 || g.gameplayMode != 13) b += Math.floor(g.globalTime / 16) % 2
1790 }
1791 return [c, b]
1792 };
1793 E.prototype.b = function () {
1794 this.k();
1795 var b = [0, 0];
1796 b = g.gameplayMode == 8 || g.gameplayMode == 14 ? [0, 3] : this.ghost ? this.r() : this.s();
1797 if (this.elBackgroundPos[0] != b[0] || this.elBackgroundPos[1] != b[1]) {
1798 this.elBackgroundPos[0] = b[0];
1799 this.elBackgroundPos[1] = b[1];
1800 b[0] *= 16;
1801 b[1] *= 16;
1802 g.changeElementBkPos(this.el, b[1], b[0], a)
1803 }
1804 };
1805 g.rand = function () {
1806 var b = 4294967296,
1807 c = 134775813;
1808 c = c * g.randSeed + 1;
1809 return (g.randSeed = c % b) / b
1810 };
1811 g.seed = function (b) {
1812 g.randSeed = b
1813 };
1814 g.getDistance = function (b, c) {
1815 return Math.sqrt((c[1] - b[1]) * (c[1] - b[1]) + (c[0] - b[0]) * (c[0] - b[0]))
1816 };
1817 g.getPlayfieldX = function (b) {
1818 return b + -32
1819 };
1820 g.getPlayfieldY = function (b) {
1821 return b + 0
1822 };
1823 g.getCorrectedSpritePos = function (b) {
1824 return b / 8 * 10 + 2
1825 };
1826 g.getDotElementId = function (b, c) {
1827 return "pcm-d" + b + "-" + c
1828 };
1829 g.showElementById = function (b, c) {
1830 var d = document.getElementById(b);
1831 if (d) d.style.visibility = c ? "visible" : "hidden"
1832 };
1833 g.getAbsoluteElPos = function (b) {
1834 var c = [0, 0];
1835 do {
1836 c[0] += b.offsetTop;
1837 c[1] += b.offsetLeft
1838 } while (b = b.offsetParent);
1839 return c
1840 };
1841 g.prepareElement = function (b, c, d) {
1842 c = g.getCorrectedSpritePos(parseInt(c, 10));
1843 d = g.getCorrectedSpritePos(parseInt(d, 10));
1844 if (g.useCss) {
1845 b.style.backgroundImage = "url(src/pacman10-hp-sprite.png)";
1846 b.style.backgroundPosition = -c + "px " + -d + "px";
1847 b.style.backgroundRepeat = "no-repeat"
1848 } else {
1849 b.style.overflow = "hidden";
1850 c = "display: block; position: relative; left: " + -c + "px; top: " + -d + "px";
1851 b.innerHTML = '<img style="' + c + '" src="src/pacman10-hp-sprite.png">'
1852 }
1853 };
1854 g.changeElementBkPos = function (b, c, d, f) {
1855 if (f) {
1856 c = g.getCorrectedSpritePos(c);
1857 d = g.getCorrectedSpritePos(d)
1858 }
1859 if (g.useCss) b.style.backgroundPosition = -c + "px " + -d + "px";
1860 else if (b.childNodes[0]) {
1861 b.childNodes[0].style.left = -c + "px";
1862 b.childNodes[0].style.top = -d + "px"
1863 }
1864 };
1865 g.determinePlayfieldDimensions = function () {
1866 g.playfieldWidth = 0;
1867 g.playfieldHeight = 0;
1868 for (var b in n) {
1869 var c = n[b];
1870 if (c.w) {
1871 c = c.x + c.w - 1;
1872 if (c > g.playfieldWidth) g.playfieldWidth = c
1873 } else {
1874 c = c.y + c.h - 1;
1875 if (c > g.playfieldHeight) g.playfieldHeight = c
1876 }
1877 }
1878 };
1879 g.preparePlayfield = function () {
1880 g.playfield = [];
1881 for (var b = 0; b <= g.playfieldHeight + 1; b++) {
1882 g.playfield[b * 8] = [];
1883 for (var c = -2; c <= g.playfieldWidth + 1; c++) g.playfield[b * 8][c * 8] = {
1884 path: 0,
1885 dot: 0,
1886 intersection: 0
1887 }
1888 }
1889 };
1890 g.preparePaths = function () {
1891 for (var b in n) {
1892 var c = n[b],
1893 d = c.type;
1894 if (c.w) {
1895 for (var f = c.y * 8, h = c.x * 8; h <= (c.x + c.w - 1) * 8; h += 8) {
1896 g.playfield[f][h].path = a;
1897 if (g.playfield[f][h].dot == 0) {
1898 g.playfield[f][h].dot = 1;
1899 g.dotsRemaining++
1900 }
1901 g.playfield[f][h].type = !d || h != c.x * 8 && h != (c.x + c.w - 1) * 8 ? d : 0
1902 }
1903 g.playfield[f][c.x * 8].intersection = a;
1904 g.playfield[f][(c.x + c.w - 1) * 8].intersection = a
1905 } else {
1906 h = c.x * 8;
1907 for (f = c.y * 8; f <= (c.y + c.h - 1) * 8; f += 8) {
1908 if (g.playfield[f][h].path) g.playfield[f][h].intersection = a;
1909 g.playfield[f][h].path = a;
1910 if (g.playfield[f][h].dot == 0) {
1911 g.playfield[f][h].dot = 1;
1912 g.dotsRemaining++
1913 }
1914 g.playfield[f][h].type = !d || f != c.y * 8 && f != (c.y + c.h - 1) * 8 ? d : 0
1915 }
1916 g.playfield[c.y * 8][h].intersection = a;
1917 g.playfield[(c.y + c.h - 1) * 8][h].intersection = a
1918 }
1919 }
1920 for (b in o) if (o[b].w) for (h = o[b].x * 8; h <= (o[b].x + o[b].w - 1) * 8; h += 8) {
1921 g.playfield[o[b].y * 8][h].dot = 0;
1922 g.dotsRemaining--
1923 } else for (f = o[b].y * 8; f <= (o[b].y + o[b].h - 1) * 8; f += 8) {
1924 g.playfield[f][o[b].x * 8].dot = 0;
1925 g.dotsRemaining--
1926 }
1927 };
1928 g.prepareAllowedDirections = function () {
1929 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) {
1930 g.playfield[b][c].allowedDir = 0;
1931 if (g.playfield[b - 8][c].path) g.playfield[b][c].allowedDir += 1;
1932 if (g.playfield[b + 8][c].path) g.playfield[b][c].allowedDir += 2;
1933 if (g.playfield[b][c - 8].path) g.playfield[b][c].allowedDir += 4;
1934 if (g.playfield[b][c + 8].path) g.playfield[b][c].allowedDir += 8
1935 }
1936 };
1937 g.createDotElements = function () {
1938 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) if (g.playfield[b][c].dot) {
1939 var d = document.createElement("div");
1940 d.className = "pcm-d";
1941 d.id = g.getDotElementId(b, c);
1942 d.style.left = c + -32 + "px";
1943 d.style.top = b + 0 + "px";
1944 g.playfieldEl.appendChild(d)
1945 }
1946 };
1947 g.createEnergizerElements = function () {
1948 for (var b in p) {
1949 var c = p[b],
1950 d = g.getDotElementId(c.y * 8, c.x * 8);
1951 document.getElementById(d).className = "pcm-e";
1952 g.prepareElement(document.getElementById(d), 0, 144);
1953 g.playfield[c.y * 8][c.x * 8].dot = 2
1954 }
1955 };
1956 g.createFruitElement = function () {
1957 g.fruitEl = document.createElement("div");
1958 g.fruitEl.id = "pcm-f";
1959 g.fruitEl.style.left = g.getPlayfieldX(v[1]) + "px";
1960 g.fruitEl.style.top = g.getPlayfieldY(v[0]) + "px";
1961 g.prepareElement(g.fruitEl, -32, -16);
1962 g.playfieldEl.appendChild(g.fruitEl)
1963 };
1964 g.createPlayfieldElements = function () {
1965 g.doorEl = document.createElement("div");
1966 g.doorEl.id = "pcm-do";
1967 g.doorEl.style.display = "none";
1968 g.playfieldEl.appendChild(g.doorEl);
1969 g.createDotElements();
1970 g.createEnergizerElements();
1971 g.createFruitElement()
1972 };
1973 g.createActors = function () {
1974 g.actors = [];
1975 for (var b = 0; b < g.playerCount + 4; b++) {
1976 g.actors[b] = new E(b);
1977 if (b < g.playerCount) {
1978 g.actors[b].ghost = e;
1979 g.actors[b].mode = 1
1980 } else g.actors[b].ghost = a
1981 }
1982 };
1983 g.restartActors = function () {
1984 for (var b in g.actors) g.actors[b].A()
1985 };
1986 g.createActorElements = function () {
1987 for (var b in g.actors) g.actors[b].createElement()
1988 };
1989 g.createPlayfield = function () {
1990 g.playfieldEl = document.createElement("div");
1991 g.playfieldEl.id = "pcm-p";
1992 g.canvasEl.appendChild(g.playfieldEl)
1993 };
1994 g.resetPlayfield = function () {
1995 g.dotsRemaining = 0;
1996 g.dotsEaten = 0;
1997 g.playfieldEl.innerHTML = "";
1998 g.prepareElement(g.playfieldEl, 256, 0);
1999 g.determinePlayfieldDimensions();
2000 g.preparePlayfield();
2001 g.preparePaths();
2002 g.prepareAllowedDirections();
2003 g.createPlayfieldElements();
2004 g.createActorElements()
2005 };
2006 g.keyPressed = function (b) {
2007 var c = e;
2008 switch (b) {
2009 case 37:
2010 g.actors[0].requestedDir = 4;
2011 c = a;
2012 break;
2013 case 38:
2014 g.actors[0].requestedDir = 1;
2015 c = a;
2016 break;
2017 case 39:
2018 g.actors[0].requestedDir = 8;
2019 c = a;
2020 break;
2021 case 40:
2022 g.actors[0].requestedDir = 2;
2023 c = a;
2024 break;
2025 case 65:
2026 if (g.playerCount == 2) {
2027 g.actors[1].requestedDir = 4;
2028 c = a
2029 }
2030 break;
2031 case 83:
2032 if (g.playerCount == 2) {
2033 g.actors[1].requestedDir = 2;
2034 c = a
2035 }
2036 break;
2037 case 68:
2038 if (g.playerCount == 2) {
2039 g.actors[1].requestedDir = 8;
2040 c = a
2041 }
2042 break;
2043 case 87:
2044 if (g.playerCount == 2) {
2045 g.actors[1].requestedDir = 1;
2046 c = a
2047 }
2048 break
2049 }
2050 return c
2051 };
2052 g.handleKeyDown = function (b) {
2053 if (!b) b = window.event;
2054 if (g.keyPressed(b.keyCode)) if (b.preventDefault) b.preventDefault();
2055 else b.returnValue = e
2056 };
2057 g.canvasClicked = function (b, c) {
2058 var d = g.getAbsoluteElPos(g.canvasEl);
2059 b -= d[1] - -32;
2060 c -= d[0] - 0;
2061 d = g.actors[0];
2062 var f = g.getPlayfieldX(d.pos[1] + d.posDelta[1]) + 16,
2063 h = g.getPlayfieldY(d.pos[0] + d.posDelta[0]) + 32,
2064 j = Math.abs(b - f),
2065 k = Math.abs(c - h);
2066 if (j > 8 && k < j) d.requestedDir = b > f ? 8 : 4;
2067 else if (k > 8 && j < k) d.requestedDir = c > h ? 2 : 1
2068 };
2069 g.handleClick = function (b) {
2070 if (!b) b = window.event;
2071 g.canvasClicked(b.clientX, b.clientY)
2072 };
2073 g.registerTouch = function () {
2074 document.body.addEventListener("touchstart", g.handleTouchStart, a);
2075 g.canvasEl.addEventListener("touchstart", g.handleTouchStart, a);
2076 document.f && document.f.q && document.f.q.addEventListener("touchstart", g.handleTouchStart, a)
2077 };
2078 g.handleTouchStart = function (b) {
2079 g.touchDX = 0;
2080 g.touchDY = 0;
2081 if (b.touches.length == 1) {
2082 g.touchStartX = b.touches[0].pageX;
2083 g.touchStartY = b.touches[0].pageY;
2084 document.body.addEventListener("touchmove", g.handleTouchMove, a);
2085 document.body.addEventListener("touchend", g.handleTouchEnd, a)
2086 }
2087 b.preventDefault();
2088 b.stopPropagation()
2089 };
2090 g.handleTouchMove = function (b) {
2091 if (b.touches.length > 1) g.cancelTouch();
2092 else {
2093 g.touchDX = b.touches[0].pageX - g.touchStartX;
2094 g.touchDY = b.touches[0].pageY - g.touchStartY
2095 }
2096 b.preventDefault();
2097 b.stopPropagation()
2098 };
2099 g.handleTouchEnd = function (b) {
2100 if (g.touchDX == 0 && g.touchDY == 0) g.canvasClicked(g.touchStartX, g.touchStartY);
2101 else {
2102 var c = Math.abs(g.touchDX),
2103 d = Math.abs(g.touchDY);
2104 if (c < 8 && d < 8) g.canvasClicked(g.touchStartX, g.touchStartY);
2105 else if (c > 15 && d < c * 2 / 3) g.actors[0].requestedDir = g.touchDX > 0 ? 8 : 4;
2106 else if (d > 15 && c < d * 2 / 3) g.actors[0].requestedDir = g.touchDY > 0 ? 2 : 1
2107 }
2108 b.preventDefault();
2109 b.stopPropagation();
2110 g.cancelTouch()
2111 };
2112 g.cancelTouch = function () {
2113 document.body.removeEventListener("touchmove", g.handleTouchMove, a);
2114 document.body.removeEventListener("touchend", g.handleTouchEnd, a);
2115 g.touchStartX = null;
2116 g.touchStartY = null
2117 };
2118 g.addEventListeners = function () {
2119 if (window.addEventListener) {
2120 window.addEventListener("keydown", g.handleKeyDown, e);
2121 g.canvasEl.addEventListener("click", g.handleClick, e);
2122 g.registerTouch()
2123 } else {
2124 document.body.attachEvent("onkeydown", g.handleKeyDown);
2125 g.canvasEl.attachEvent("onclick", g.handleClick)
2126 }
2127 };
2128 g.startGameplay = function () {
2129 g.score = [0, 0];
2130 g.extraLifeAwarded = [e, e];
2131 g.lives = 3;
2132 g.level = 0;
2133 g.paused = e;
2134 g.globalTime = 0;
2135 g.newLevel(a)
2136 };
2137 g.restartGameplay = function (b) {
2138 g.seed(0);
2139 g.frightModeTime = 0;
2140 g.intervalTime = 0;
2141 g.gameplayModeTime = 0;
2142 g.fruitTime = 0;
2143 g.ghostModeSwitchPos = 0;
2144 g.ghostModeTime = g.levels.ghostModeSwitchTimes[0] * D;
2145 g.ghostExitingPenNow = e;
2146 g.ghostEyesCount = 0;
2147 g.tilesChanged = e;
2148 g.updateCruiseElroySpeed();
2149 g.hideFruit();
2150 g.resetForcePenLeaveTime();
2151 g.restartActors();
2152 g.updateActorPositions();
2153 g.switchMainGhostMode(2, a);
2154 for (var c = g.playerCount + 1; c < g.playerCount + 4; c++) g.actors[c].a(16);
2155 g.dotEatingChannel = [0, 0];
2156 g.dotEatingSoundPart = [1, 1];
2157 g.clearDotEatingNow();
2158 b ? g.changeGameplayMode(4) : g.changeGameplayMode(6)
2159 };
2160 g.initiateDoubleMode = function () {
2161 if (g.playerCount != 2) {
2162 g.stopAllAudio();
2163 g.changeGameplayMode(12)
2164 }
2165 };
2166 g.newGame = function () {
2167 g.playerCount = 1;
2168 g.createChrome();
2169 g.createPlayfield();
2170 g.createActors();
2171 g.startGameplay()
2172 };
2173 g.switchToDoubleMode = function () {
2174 g.playerCount = 2;
2175 g.createChrome();
2176 g.createPlayfield();
2177 g.createActors();
2178 g.startGameplay()
2179 };
2180 g.insertCoin = function () {
2181 g.gameplayMode == 8 || g.gameplayMode == 14 ? g.newGame() : g.initiateDoubleMode()
2182 };
2183 g.createKillScreenElement = function (b, c, d, f, h) {
2184 var j = document.createElement("div");
2185 j.style.left = b + "px";
2186 j.style.top = c + "px";
2187 j.style.width = d + "px";
2188 j.style.height = f + "px";
2189 j.style.zIndex = 119;
2190 if (h) {
2191 j.style.background = "url(src/pacman10-hp-sprite.png) -" + g.killScreenTileX + "px -" + g.killScreenTileY + "px no-repeat";
2192 g.killScreenTileY += 8
2193 } else j.style.background = "black";
2194 g.playfieldEl.appendChild(j)
2195 };
2196 g.killScreen = function () {
2197 g.seed(0);
2198 g.canvasEl.style.visibility = "";
2199 g.createKillScreenElement(272, 0, 200, 80, e);
2200 g.createKillScreenElement(280, 80, 192, 56, e);
2201 g.killScreenTileX = 80;
2202 g.killScreenTileY = 0;
2203 for (var b = 280; b <= 472; b += 8) for (var c = 0; c <= 136; c += 8) {
2204 if (g.rand() < 0.03) {
2205 g.killScreenTileX = Math.floor(g.rand() * 25) * 10;
2206 g.killScreenTileY = Math.floor(g.rand() * 2) * 10
2207 }
2208 g.createKillScreenElement(b, c, 8, 8, a)
2209 }
2210 g.changeGameplayMode(14)
2211 };
2212 g.newLevel = function (b) {
2213 g.level++;
2214 g.levels = g.level >= z.length ? z[z.length - 1] : z[g.level];
2215 g.levels.frightTime = Math.round(g.levels.frightTime * D);
2216 g.levels.frightTotalTime = g.levels.frightTime + g.timing[1] * (g.levels.frightBlinkCount * 2 - 1);
2217 for (var c in g.actors) g.actors[c].dotCount = 0;
2218 g.alternatePenLeavingScheme = e;
2219 g.lostLifeOnThisLevel = e;
2220 g.updateChrome();
2221 g.resetPlayfield();
2222 g.restartGameplay(b);
2223 g.level == 256 && g.killScreen()
2224 };
2225 g.newLife = function () {
2226 g.lostLifeOnThisLevel = a;
2227 g.alternatePenLeavingScheme = a;
2228 g.alternateDotCount = 0;
2229 g.lives--;
2230 g.updateChromeLives();
2231 g.lives == -1 ? g.changeGameplayMode(8) : g.restartGameplay(e)
2232 };
2233 g.switchMainGhostMode = function (b, c) {
2234 if (b == 4 && g.levels.frightTime == 0) for (var d in g.actors) {
2235 var f = g.actors[d];
2236 if (f.ghost) f.reverseDirectionsNext = a
2237 } else {
2238 f = g.mainGhostMode;
2239 if (b == 4 && g.mainGhostMode != 4) g.lastMainGhostMode = g.mainGhostMode;
2240 g.mainGhostMode = b;
2241 if (b == 4 || f == 4) g.playAmbientSound();
2242 switch (b) {
2243 case 1:
2244 case 2:
2245 g.currentPlayerSpeed = g.levels.playerSpeed * 0.8;
2246 g.currentDotEatingSpeed = g.levels.dotEatingSpeed * 0.8;
2247 break;
2248 case 4:
2249 g.currentPlayerSpeed = g.levels.playerFrightSpeed * 0.8;
2250 g.currentDotEatingSpeed = g.levels.dotEatingFrightSpeed * 0.8;
2251 g.frightModeTime = g.levels.frightTotalTime;
2252 g.modeScoreMultiplier = 1;
2253 break
2254 }
2255 for (d in g.actors) {
2256 f = g.actors[d];
2257 if (f.ghost) {
2258 if (b != 64 && !c) f.modeChangedWhileInPen = a;
2259 if (b == 4) f.eatenInThisFrightMode = e;
2260 if (f.mode != 8 && f.mode != 16 && f.mode != 32 && f.mode != 128 && f.mode != 64 || c) {
2261 if (!c && f.mode != 4 && f.mode != b) f.reverseDirectionsNext = a;
2262 f.a(b)
2263 }
2264 } else {
2265 f.fullSpeed = g.currentPlayerSpeed;
2266 f.dotEatingSpeed = g.currentDotEatingSpeed;
2267 f.tunnelSpeed = g.currentPlayerSpeed;
2268 f.d()
2269 }
2270 }
2271 }
2272 };
2273 g.figureOutPenLeaving = function () {
2274 if (g.alternatePenLeavingScheme) {
2275 g.alternateDotCount++;
2276 switch (g.alternateDotCount) {
2277 case m[1]:
2278 g.actors[g.playerCount + 1].freeToLeavePen = a;
2279 break;
2280 case m[2]:
2281 g.actors[g.playerCount + 2].freeToLeavePen = a;
2282 break;
2283 case m[3]:
2284 if (g.actors[g.playerCount + 3].mode == 16) g.alternatePenLeavingScheme = e;
2285 break
2286 }
2287 } else if (g.actors[g.playerCount + 1].mode == 16 || g.actors[g.playerCount + 1].mode == 8) {
2288 g.actors[g.playerCount + 1].dotCount++;
2289 if (g.actors[g.playerCount + 1].dotCount >= g.levels.penLeavingLimits[1]) g.actors[g.playerCount + 1].freeToLeavePen = a
2290 } else if (g.actors[g.playerCount + 2].mode == 16 || g.actors[g.playerCount + 2].mode == 8) {
2291 g.actors[g.playerCount + 2].dotCount++;
2292 if (g.actors[g.playerCount + 2].dotCount >= g.levels.penLeavingLimits[2]) g.actors[g.playerCount + 2].freeToLeavePen = a
2293 } else if (g.actors[g.playerCount + 3].mode == 16 || g.actors[g.playerCount + 3].mode == 8) {
2294 g.actors[g.playerCount + 3].dotCount++;
2295 if (g.actors[g.playerCount + 3].dotCount >= g.levels.penLeavingLimits[3]) g.actors[g.playerCount + 3].freeToLeavePen = a
2296 }
2297 };
2298 g.resetForcePenLeaveTime = function () {
2299 g.forcePenLeaveTime = g.levels.penForceTime * D
2300 };
2301 g.dotEaten = function (b, c) {
2302 g.dotsRemaining--;
2303 g.dotsEaten++;
2304 g.actors[b].c(1);
2305 g.playDotEatingSound(b);
2306 if (g.playfield[c[0]][c[1]].dot == 2) {
2307 g.switchMainGhostMode(4, e);
2308 g.addToScore(50, b)
2309 } else g.addToScore(10, b);
2310 var d = document.getElementById(g.getDotElementId(c[0], c[1]));
2311 d.style.display = "none";
2312 g.playfield[c[0]][c[1]].dot = 0;
2313 g.updateCruiseElroySpeed();
2314 g.resetForcePenLeaveTime();
2315 g.figureOutPenLeaving();
2316 if (g.dotsEaten == 70 || g.dotsEaten == 170) g.showFruit();
2317 g.dotsRemaining == 0 && g.finishLevel();
2318 g.playAmbientSound()
2319 };
2320 g.getFruitSprite = function (b) {
2321 var c = b <= 4 ? 128 : 160;
2322 b = 128 + 16 * ((b - 1) % 4);
2323 return [c, b]
2324 };
2325 g.getFruitScoreSprite = function (b) {
2326 var c = 128;
2327 b = 16 * (b - 1);
2328 return [c, b]
2329 };
2330 g.hideFruit = function () {
2331 g.fruitShown = e;
2332 g.changeElementBkPos(g.fruitEl, 32, 16, a)
2333 };
2334 g.showFruit = function () {
2335 g.fruitShown = a;
2336 var b = g.getFruitSprite(g.levels.fruit);
2337 g.changeElementBkPos(g.fruitEl, b[0], b[1], a);
2338 g.fruitTime = g.timing[15] + (g.timing[16] - g.timing[15]) * g.rand()
2339 };
2340 g.eatFruit = function (b) {
2341 if (g.fruitShown) {
2342 g.playSound("fruit", 0);
2343 g.fruitShown = e;
2344 var c = g.getFruitScoreSprite(g.levels.fruit);
2345 g.changeElementBkPos(g.fruitEl, c[0], c[1], a);
2346 g.fruitTime = g.timing[14];
2347 g.addToScore(g.levels.fruitScore, b)
2348 }
2349 };
2350 g.updateActorTargetPositions = function () {
2351 for (var b = g.playerCount; b < g.playerCount + 4; b++) g.actors[b].B()
2352 };
2353 g.moveActors = function () {
2354 for (var b in g.actors) g.actors[b].move()
2355 };
2356 g.ghostDies = function (b, c) {
2357 g.playSound("eating-ghost", 0);
2358 g.addToScore(200 * g.modeScoreMultiplier, c);
2359 g.modeScoreMultiplier *= 2;
2360 g.ghostBeingEatenId = b;
2361 g.playerEatingGhostId = c;
2362 g.changeGameplayMode(1)
2363 };
2364 g.playerDies = function (b) {
2365 g.playerDyingId = b;
2366 g.changeGameplayMode(2)
2367 };
2368 g.detectCollisions = function () {
2369 g.tilesChanged = e;
2370 for (var b = g.playerCount; b < g.playerCount + 4; b++) for (var c = 0; c < g.playerCount; c++) if (g.actors[b].tilePos[0] == g.actors[c].tilePos[0] && g.actors[b].tilePos[1] == g.actors[c].tilePos[1]) if (g.actors[b].mode == 4) {
2371 g.ghostDies(b, c);
2372 return
2373 } else g.actors[b].mode != 8 && g.actors[b].mode != 16 && g.actors[b].mode != 32 && g.actors[b].mode != 128 && g.actors[b].mode != 64 && g.playerDies(c)
2374 };
2375 g.updateCruiseElroySpeed = function () {
2376 var b = g.levels.ghostSpeed * 0.8;
2377 if (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16) {
2378 var c = g.levels;
2379 if (g.dotsRemaining < c.elroyDotsLeftPart2) b = c.elroySpeedPart2 * 0.8;
2380 else if (g.dotsRemaining < c.elroyDotsLeftPart1) b = c.elroySpeedPart1 * 0.8
2381 }
2382 if (b != g.cruiseElroySpeed) {
2383 g.cruiseElroySpeed = b;
2384 g.actors[g.playerCount].d()
2385 }
2386 };
2387 g.getSpeedIntervals = function (b) {
2388 if (!g.speedIntervals[b]) {
2389 var c = 0,
2390 d = 0;
2391 g.speedIntervals[b] = [];
2392 for (var f = 0; f < D; f++) {
2393 c += b;
2394 if (Math.floor(c) > d) {
2395 g.speedIntervals[b].push(a);
2396 d = Math.floor(c)
2397 } else g.speedIntervals[b].push(e)
2398 }
2399 }
2400 return g.speedIntervals[b]
2401 };
2402 g.finishLevel = function () {
2403 g.changeGameplayMode(9)
2404 };
2405 g.changeGameplayMode = function (b) {
2406 g.gameplayMode = b;
2407 if (b != 13) for (var c = 0; c < g.playerCount + 4; c++) g.actors[c].b();
2408 switch (b) {
2409 case 0:
2410 g.playAmbientSound();
2411 break;
2412 case 2:
2413 g.stopAllAudio();
2414 g.gameplayModeTime = g.timing[3];
2415 break;
2416 case 3:
2417 g.playerDyingId == 0 ? g.playSound("death", 0) : g.playSound("death-double", 0);
2418 g.gameplayModeTime = g.timing[4];
2419 break;
2420 case 6:
2421 g.canvasEl.style.visibility = "hidden";
2422 g.gameplayModeTime = g.timing[5];
2423 break;
2424 case 7:
2425 g.stopAllAudio();
2426 g.canvasEl.style.visibility = "";
2427 g.doorEl.style.display = "block";
2428 b = document.createElement("div");
2429 b.id = "pcm-re";
2430 g.prepareElement(b, 160, 0);
2431 g.playfieldEl.appendChild(b);
2432 g.gameplayModeTime = g.timing[6];
2433 break;
2434 case 4:
2435 g.doorEl.style.display = "block";
2436 b = document.createElement("div");
2437 b.id = "pcm-re";
2438 g.prepareElement(b, 160, 0);
2439 g.playfieldEl.appendChild(b);
2440 g.gameplayModeTime = g.timing[7];
2441 g.stopAllAudio();
2442 g.playerCount == 2 ? g.playSound("start-music-double", 0, a) : g.playSound("start-music", 0, a);
2443 break;
2444 case 5:
2445 g.lives--;
2446 g.updateChromeLives();
2447 g.gameplayModeTime = g.timing[8];
2448 break;
2449 case 8:
2450 case 14:
2451 b = document.getElementById("pcm-re");
2452 google.dom.remove(b);
2453 g.stopAllAudio();
2454 b = document.createElement("div");
2455 b.id = "pcm-go";
2456 g.prepareElement(b, 8, 152);
2457 g.playfieldEl.appendChild(b);
2458 g.gameplayModeTime = g.timing[9];
2459 break;
2460 case 9:
2461 g.stopAllAudio();
2462 g.gameplayModeTime = g.timing[10];
2463 break;
2464 case 10:
2465 g.doorEl.style.display = "none";
2466 g.gameplayModeTime = g.timing[11];
2467 break;
2468 case 11:
2469 g.canvasEl.style.visibility = "hidden";
2470 g.gameplayModeTime = g.timing[12];
2471 break;
2472 case 12:
2473 g.playfieldEl.style.visibility = "hidden";
2474 g.gameplayModeTime = g.timing[13];
2475 break;
2476 case 1:
2477 g.gameplayModeTime =
2478 g.timing[2];
2479 break;
2480 case 13:
2481 g.startCutscene();
2482 break
2483 }
2484 };
2485 g.showChrome = function (b) {
2486 g.showElementById("pcm-sc-1-l", b);
2487 g.showElementById("pcm-sc-2-l", b);
2488 g.showElementById("pcm-sc-1", b);
2489 g.showElementById("pcm-sc-2", b);
2490 g.showElementById("pcm-li", b);
2491 g.showElementById("pcm-so", b)
2492 };
2493 g.startCutscene = function () {
2494 g.playfieldEl.style.visibility = "hidden";
2495 g.canvasEl.style.visibility = "";
2496 g.showChrome(e);
2497 g.cutsceneCanvasEl = document.createElement("div");
2498 g.cutsceneCanvasEl.id = "pcm-cc";
2499 g.canvasEl.appendChild(g.cutsceneCanvasEl);
2500 g.cutscene = B[g.cutsceneId];
2501 g.cutsceneSequenceId = -1;
2502 g.frightModeTime = g.levels.frightTotalTime;
2503 g.cutsceneActors = [];
2504 for (var b in g.cutscene.actors) {
2505 var c = g.cutscene.actors[b].id;
2506 if (c > 0) c += g.playerCount - 1;
2507 var d = document.createElement("div");
2508 d.className = "pcm-ac";
2509 d.id = "actor" + c;
2510 g.prepareElement(d, 0, 0);
2511 c = new E(c);
2512 c.el = d;
2513 c.elBackgroundPos = [0, 0];
2514 c.elPos = [0, 0];
2515 c.pos = [g.cutscene.actors[b].y * 8, g.cutscene.actors[b].x * 8];
2516 c.posDelta = [0, 0];
2517 c.ghost = g.cutscene.actors[b].ghost;
2518 g.cutsceneCanvasEl.appendChild(d);
2519 g.cutsceneActors.push(c)
2520 }
2521 g.cutsceneNextSequence();
2522 g.stopAllAudio();
2523 g.playAmbientSound()
2524 };
2525 g.stopCutscene = function () {
2526 g.playfieldEl.style.visibility = "";
2527 google.dom.remove(g.cutsceneCanvasEl);
2528 g.showChrome(a);
2529 g.newLevel(e)
2530 };
2531 g.cutsceneNextSequence = function () {
2532 g.cutsceneSequenceId++;
2533 if (g.cutscene.sequence.length == g.cutsceneSequenceId) g.stopCutscene();
2534 else {
2535 var b = g.cutscene.sequence[g.cutsceneSequenceId];
2536 g.cutsceneTime = b.time * D;
2537 for (var c in g.cutsceneActors) {
2538 var d = g.cutsceneActors[c];
2539 d.dir = b.moves[c].dir;
2540 d.speed = b.moves[c].speed;
2541 if (b.moves[c].elId) d.el.id = b.moves[c].elId;
2542 if (b.moves[c].mode) d.mode = b.moves[c].mode;
2543 d.b()
2544 }
2545 }
2546 };
2547 g.checkCutscene = function () {
2548 g.cutsceneTime <= 0 && g.cutsceneNextSequence()
2549 };
2550 g.advanceCutscene = function () {
2551 for (var b in g.cutsceneActors) {
2552 var c = g.cutsceneActors[b],
2553 d = l[c.dir];
2554 c.pos[d.axis] += d.increment * c.speed;
2555 c.b()
2556 }
2557 g.cutsceneTime--
2558 };
2559 g.updateActorPositions = function () {
2560 for (var b in g.actors) g.actors[b].k()
2561 };
2562 g.blinkEnergizers = function () {
2563 switch (g.gameplayMode) {
2564 case 4:
2565 case 5:
2566 case 6:
2567 case 7:
2568 case 9:
2569 case 10:
2570 case 11:
2571 case 12:
2572 g.playfieldEl.className = "";
2573 break;
2574 case 8:
2575 case 14:
2576 g.playfieldEl.className = "blk";
2577 break;
2578 default:
2579 if (g.globalTime % (g.timing[0] * 2) == 0) g.playfieldEl.className = "";
2580 else if (g.globalTime % (g.timing[0] * 2) == g.timing[0]) g.playfieldEl.className = "blk";
2581 break
2582 }
2583 };
2584 g.blinkScoreLabels = function () {
2585 if (g.gameplayMode != 13) {
2586 var b = "";
2587 if (g.globalTime % (g.timing[17] * 2) == 0) b = "visible";
2588 else if (g.globalTime % (g.timing[17] * 2) == g.timing[17]) b = "hidden";
2589 if (b) for (var c = 0; c < g.playerCount; c++) g.scoreLabelEl[c].style.visibility = b
2590 }
2591 };
2592 g.finishFrightMode = function () {
2593 g.switchMainGhostMode(g.lastMainGhostMode, e)
2594 };
2595 g.handleGameplayModeTimer = function () {
2596 if (g.gameplayModeTime) {
2597 g.gameplayModeTime--;
2598 switch (g.gameplayMode) {
2599 case 2:
2600 case 3:
2601 for (var b = 0; b < g.playerCount + 4; b++) g.actors[b].b();
2602 break;
2603 case 10:
2604 Math.floor(g.gameplayModeTime / (g.timing[11] / 8)) % 2 == 0 ? g.changeElementBkPos(g.playfieldEl, 322, 2, e) : g.changeElementBkPos(g.playfieldEl, 322, 138, e)
2605 }
2606 if (g.gameplayModeTime <= 0) {
2607 g.gameplayModeTime = 0;
2608 switch (g.gameplayMode) {
2609 case 1:
2610 g.changeGameplayMode(0);
2611 g.ghostEyesCount++;
2612 g.playAmbientSound();
2613 g.actors[g.ghostBeingEatenId].el.className = "pcm-ac";
2614 g.actors[g.ghostBeingEatenId].a(8);
2615 var c = e;
2616 for (b = g.playerCount; b < g.playerCount + 4; b++) if (g.actors[b].mode == 4 || (g.actors[b].mode == 16 || g.actors[b].mode == 128) && !g.actors[b].eatenInThisFrightMode) {
2617 c = a;
2618 break
2619 }
2620 c || g.finishFrightMode();
2621 break;
2622 case 2:
2623 g.changeGameplayMode(3);
2624 break;
2625 case 3:
2626 g.newLife();
2627 break;
2628 case 4:
2629 g.changeGameplayMode(5);
2630 break;
2631 case 6:
2632 g.changeGameplayMode(7);
2633 break;
2634 case 7:
2635 case 5:
2636 b = document.getElementById("pcm-re");
2637 google.dom.remove(b);
2638 g.changeGameplayMode(0);
2639 break;
2640 case 8:
2641 b = document.getElementById("pcm-go");
2642 google.dom.remove(b);
2643 google.pacManQuery && google.pacManQuery();
2644 break;
2645 case 9:
2646 g.changeGameplayMode(10);
2647 break;
2648 case 10:
2649 g.changeGameplayMode(11);
2650 break;
2651 case 11:
2652 if (g.levels.cutsceneId) {
2653 g.cutsceneId = g.levels.cutsceneId;
2654 g.changeGameplayMode(13)
2655 } else {
2656 g.canvasEl.style.visibility = "";
2657 g.newLevel(e)
2658 }
2659 break;
2660 case 12:
2661 g.playfieldEl.style.visibility = "";
2662 g.canvasEl.style.visibility = "";
2663 g.switchToDoubleMode();
2664 break
2665 }
2666 }
2667 }
2668 };
2669 g.handleFruitTimer = function () {
2670 if (g.fruitTime) {
2671 g.fruitTime--;
2672 g.fruitTime <= 0 && g.hideFruit()
2673 }
2674 };
2675 g.handleGhostModeTimer = function () {
2676 if (g.frightModeTime) {
2677 g.frightModeTime--;
2678 if (g.frightModeTime <= 0) {
2679 g.frightModeTime = 0;
2680 g.finishFrightMode()
2681 }
2682 } else if (g.ghostModeTime > 0) {
2683 g.ghostModeTime--;
2684 if (g.ghostModeTime <= 0) {
2685 g.ghostModeTime = 0;
2686 g.ghostModeSwitchPos++;
2687 if (g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]) {
2688 g.ghostModeTime = g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos] * D;
2689 switch (g.mainGhostMode) {
2690 case 2:
2691 g.switchMainGhostMode(1, e);
2692 break;
2693 case 1:
2694 g.switchMainGhostMode(2, e);
2695 break
2696 }
2697 }
2698 }
2699 }
2700 };
2701 g.handleForcePenLeaveTimer = function () {
2702 if (g.forcePenLeaveTime) {
2703 g.forcePenLeaveTime--;
2704 if (g.forcePenLeaveTime <= 0) {
2705 for (var b = 1; b <= 3; b++) if (g.actors[g.playerCount + b].mode == 16) {
2706 g.actors[g.playerCount + b].freeToLeavePen = a;
2707 break
2708 }
2709 g.resetForcePenLeaveTime()
2710 }
2711 }
2712 };
2713 g.handleTimers = function () {
2714 if (g.gameplayMode == 0) {
2715 g.handleForcePenLeaveTimer();
2716 g.handleFruitTimer();
2717 g.handleGhostModeTimer()
2718 }
2719 g.handleGameplayModeTimer()
2720 };
2721 g.tick = function () {
2722 var b = (new Date).getTime();
2723 g.lastTimeDelta += b - g.lastTime - g.tickInterval;
2724 if (g.lastTimeDelta > 100) g.lastTimeDelta = 100;
2725 if (g.canDecreaseFps && g.lastTimeDelta > 50) {
2726 g.lastTimeSlownessCount++;
2727 g.lastTimeSlownessCount == 20 && g.decreaseFps()
2728 }
2729 var c = 0;
2730 if (g.lastTimeDelta > g.tickInterval) {
2731 c = Math.floor(g.lastTimeDelta / g.tickInterval);
2732 g.lastTimeDelta -= g.tickInterval * c
2733 }
2734 g.lastTime = b;
2735 if (g.gameplayMode == 13) {
2736 for (b = 0; b < g.tickMultiplier + c; b++) {
2737 g.advanceCutscene();
2738 g.intervalTime = (g.intervalTime + 1) % D;
2739 g.globalTime++
2740 }
2741 g.checkCutscene();
2742 g.blinkScoreLabels()
2743 } else for (b = 0; b < g.tickMultiplier + c; b++) {
2744 g.moveActors();
2745 if (g.gameplayMode == 0) if (g.tilesChanged) {
2746 g.detectCollisions();
2747 g.updateActorTargetPositions()
2748 }
2749 g.globalTime++;
2750 g.intervalTime = (g.intervalTime + 1) % D;
2751 g.blinkEnergizers();
2752 g.blinkScoreLabels();
2753 g.handleTimers()
2754 }
2755 };
2756 g.extraLife = function (b) {
2757 g.playSound("extra-life", 0);
2758 g.extraLifeAwarded[b] = a;
2759 g.lives++;
2760 if (g.lives > 5) g.lives = 5;
2761 g.updateChromeLives()
2762 };
2763 g.addToScore = function (b, c) {
2764 g.score[c] += b;
2765 !g.extraLifeAwarded[c] && g.score[c] > 1E4 && g.extraLife(c);
2766 g.updateChromeScore(c)
2767 };
2768 g.updateChrome = function () {
2769 g.updateChromeLevel();
2770 g.updateChromeLives();
2771 for (var b = 0; b < g.playerCount; b++) g.updateChromeScore(b)
2772 };
2773 g.updateChromeScore = function (b) {
2774 var c = g.score[b].toString();
2775 if (c.length > g.scoreDigits) c = c.substr(c.length - g.scoreDigits, g.scoreDigits);
2776 for (var d = 0; d < g.scoreDigits; d++) {
2777 var f = document.getElementById("pcm-sc-" + (b + 1) + "-" + d),
2778 h = c.substr(d, 1);
2779 h ? g.changeElementBkPos(f, 8 + 8 * parseInt(h, 10), 144, a) : g.changeElementBkPos(f, 48, 0, a)
2780 }
2781 };
2782 g.updateChromeLives = function () {
2783 g.livesEl.innerHTML = "";
2784 for (var b = 0; b < g.lives; b++) {
2785 var c = document.createElement("div");
2786 c.className = "pcm-lif";
2787 g.prepareElement(c, 64, 129);
2788 g.livesEl.appendChild(c)
2789 }
2790 };
2791 g.updateChromeLevel = function () {
2792 g.levelEl.innerHTML = "";
2793 for (var b = g.level; b >= Math.max(g.level - 4 + 1, 1); b--) {
2794 var c = b >= z.length ? z[z.length - 1].fruit : z[b].fruit,
2795 d = document.createElement("div");
2796 c = g.getFruitSprite(c);
2797 g.prepareElement(d, c[0], c[1]);
2798 g.levelEl.appendChild(d)
2799 }
2800 g.levelEl.style.marginTop = (4 - Math.min(g.level, 4)) * 16 + "px"
2801 };
2802 g.createChrome = function () {
2803 g.canvasEl.innerHTML = "";
2804 g.scoreDigits = g.playerCount == 1 ? 10 : 5;
2805 g.scoreLabelEl = [];
2806 g.scoreLabelEl[0] = document.createElement("div");
2807 g.scoreLabelEl[0].id = "pcm-sc-1-l";
2808 g.prepareElement(g.scoreLabelEl[0], 160, 56);
2809 g.canvasEl.appendChild(g.scoreLabelEl[0]);
2810 g.scoreEl = [];
2811 g.scoreEl[0] = document.createElement("div");
2812 g.scoreEl[0].id = "pcm-sc-1";
2813 for (var b = 0; b < g.scoreDigits; b++) {
2814 var c = document.createElement("div");
2815 c.id = "pcm-sc-1-" + b;
2816 c.style.top = b * 8 + "px";
2817 c.style.left = 0;
2818 c.style.position = "absolute";
2819 c.style.width = "8px";
2820 c.style.height = "8px";
2821 g.prepareElement(c, 48, 0);
2822 g.scoreEl[0].appendChild(c)
2823 }
2824 g.canvasEl.appendChild(g.scoreEl[0]);
2825 g.livesEl = document.createElement("div");
2826 g.livesEl.id = "pcm-li";
2827 g.canvasEl.appendChild(g.livesEl);
2828 g.levelEl = document.createElement("div");
2829 g.levelEl.id = "pcm-le";
2830 g.canvasEl.appendChild(g.levelEl);
2831 if (g.playerCount == 2) {
2832 g.scoreLabelEl[1] = document.createElement("div");
2833 g.scoreLabelEl[1].id = "pcm-sc-2-l";
2834 g.prepareElement(g.scoreLabelEl[1], 160, 64);
2835 g.canvasEl.appendChild(g.scoreLabelEl[1]);
2836 g.scoreEl[1] = document.createElement("div");
2837 g.scoreEl[1].id = "pcm-sc-2";
2838 for (b = 0; b < g.scoreDigits; b++) {
2839 c = document.createElement("div");
2840 c.id = "pcm-sc-2-" + b;
2841 c.style.top = b * 8 + "px";
2842 c.style.left = 0;
2843 c.style.position = "absolute";
2844 c.style.width = "8px";
2845 c.style.height = "8px";
2846 g.prepareElement(c, 48, 0);
2847 g.scoreEl[1].appendChild(c)
2848 }
2849 g.canvasEl.appendChild(g.scoreEl[1])
2850 }
2851 };
2852 g.clearDotEatingNow = function () {
2853 g.dotEatingNow = [e, e];
2854 g.dotEatingNext = [e, e]
2855 };
2856 g.playSound = function (b, c, d) {
2857 if (!(!g.soundAvailable || !g.soundEnabled || g.paused)) {
2858 d || g.stopSoundChannel(c);
2859 try {
2860 g.flashSoundPlayer.playTrack(b, c)
2861 } catch (f) {
2862 g.soundAvailable = e
2863 }
2864 }
2865 };
2866 g.stopSoundChannel = function (b) {
2867 if (g.soundAvailable && g.soundEnabled) try {
2868 g.flashSoundPlayer.stopChannel(b)
2869 } catch (c) {
2870 g.soundAvailable = e
2871 }
2872 };
2873 g.stopAllAudio = function () {
2874 if (g.soundAvailable && g.soundEnabled) {
2875 try {
2876 g.flashSoundPlayer.stopAmbientTrack()
2877 } catch (b) {
2878 g.soundAvailable = e
2879 }
2880 for (var c = 0; c < 5; c++) g.stopSoundChannel(c)
2881 }
2882 };
2883 g.playDotEatingSound = function (b) {
2884 if (g.soundAvailable && g.soundEnabled) if (g.gameplayMode == 0) if (g.dotEatingNow[b]) g.dotEatingNext[b] = a;
2885 else {
2886 if (b == 0) {
2887 var c = g.dotEatingSoundPart[b] == 1 ? "eating-dot-1" : "eating-dot-2";
2888 g.playSound(c, 1 + g.dotEatingChannel[b], a);
2889 g.dotTimer = window.setInterval(g.repeatDotEatingSoundPacMan, 150)
2890 } else {
2891 g.playSound("eating-dot-double", 3 + g.dotEatingChannel[b], a);
2892 g.dotTimerMs = window.setInterval(g.repeatDotEatingSoundMsPacMan, 150)
2893 }
2894 g.dotEatingChannel[b] = (g.dotEatingChannel[b] + 1) % 2;
2895 g.dotEatingSoundPart[b] =
2896 3 - g.dotEatingSoundPart[b]
2897 }
2898 };
2899 g.repeatDotEatingSound = function (b) {
2900 g.dotEatingNow[b] = e;
2901 if (g.dotEatingNext[b]) {
2902 g.dotEatingNext[b] = e;
2903 g.playDotEatingSound(b)
2904 }
2905 };
2906 g.repeatDotEatingSoundPacMan = function () {
2907 g.repeatDotEatingSound(0)
2908 };
2909 g.repeatDotEatingSoundMsPacMan = function () {
2910 g.repeatDotEatingSound(1)
2911 };
2912 g.playAmbientSound = function () {
2913 if (g.soundAvailable && g.soundEnabled) {
2914 var b = 0;
2915 if (g.gameplayMode == 0 || g.gameplayMode == 1) b = g.ghostEyesCount ? "ambient-eyes" : g.mainGhostMode == 4 ? "ambient-fright" : g.dotsEaten > 241 ? "ambient-4" : g.dotsEaten > 207 ? "ambient-3" : g.dotsEaten > 138 ? "ambient-2" : "ambient-1";
2916 else if (g.gameplayMode == 13) b = "cutscene";
2917 if (b) try {
2918 g.flashSoundPlayer.playAmbientTrack(b)
2919 } catch (c) {
2920 g.soundAvailable = e
2921 }
2922 }
2923 };
2924 g.initializeTickTimer = function () {
2925 window.clearInterval(g.tickTimer);
2926 g.fps = C[g.fpsChoice];
2927 g.tickInterval = 1E3 / g.fps;
2928 g.tickMultiplier = D / g.fps;
2929 g.timing = {};
2930 for (var b in w) {
2931 var c = !g.soundEnabled && (b == 7 || b == 8) ? 1 : w[b];
2932 g.timing[b] = Math.round(c * D)
2933 }
2934 g.lastTime = (new Date).getTime();
2935 g.lastTimeDelta = 0;
2936 g.lastTimeSlownessCount = 0;
2937 g.tickTimer = window.setInterval(g.tick, g.tickInterval)
2938 };
2939 g.decreaseFps = function () {
2940 if (g.fpsChoice < C.length - 1) {
2941 g.fpsChoice++;
2942 g.initializeTickTimer();
2943 if (g.fpsChoice == C.length - 1) g.canDecreaseFps = e
2944 }
2945 };
2946 g.addCss = function () {
2947 var b = "#pcm-c { width: 554px; border-top: 25px solid black; padding-bottom: 25px; height: 136px; position: relative; background: black; outline: 0; overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}#pcm-c * { position: absolute; overflow: hidden;}#pcm-p,#pcm-cc { left: 45px; width: 464px; height: 136px; z-index: 99; overflow: hidden;}#pcm-p .pcm-d { width: 2px; height: 2px; margin-left: 3px; margin-top: 3px; background: #f8b090; z-index: 100;}#pcm-p .pcm-e { width: 8px; height: 8px; z-index: 101;}#pcm-sc-1 { left: 18px; top: 16px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-sc-2 { left: 18px; top: 80px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-le { position: absolute; left: 515px; top: 74px; height: 64px; width: 32px;} #pcm-le div { position: relative;}#pcm-sc-1-l { left: -2px; top: 0; width: 48px; height: 8px;}#pcm-sc-2-l { left: -2px; top: 64px; width: 48px; height: 8px;}#pcm-so { left: 7px; top: 116px; width: 12px; height: 12px; border: 8px solid black; cursor: pointer;}#pcm-li { position: absolute; left: 523px; top: 0; height: 80px; width: 16px;}#pcm-li .pcm-lif { position: relative; width: 16px; height: 12px; margin-bottom: 3px;}#pcm-p.blk .pcm-e { visibility: hidden;}#pcm-c .pcm-ac { width: 16px; height: 16px; margin-left: -4px; margin-top: -4px; z-index: 110;}#pcm-c .pcm-n { z-index: 111;}#pcm-c #pcm-stck { z-index: 109;}#pcm-c #pcm-gbug { width: 32px;}#pcm-c #pcm-bpcm { width: 32px; height: 32px; margin-left: -20px; margin-top: -20px;}#pcm-f,#pcm-le div { width: 32px; height: 16px; z-index: 105;}#pcm-f { margin-left: -8px; margin-top: -4px;}#pcm-do { width: 19px; height: 2px; left: 279px; top: 46px; overflow: hidden; position: absolute; background: #ffaaa5;}#pcm-re { width: 48px; height: 8px; z-index: 120; left: 264px; top: 80px;}#pcm-go { width: 80px; height: 8px; z-index: 120; left: 248px; top: 80px;}";
2948 g.styleElement =
2949 document.createElement("style");
2950 g.styleElement.type = "text/css";
2951 if (g.styleElement.styleSheet) g.styleElement.styleSheet.cssText = b;
2952 else g.styleElement.appendChild(document.createTextNode(b));
2953 document.getElementsByTagName("head")[0].appendChild(g.styleElement)
2954 };
2955 g.createCanvasElement = function () {
2956 g.canvasEl = document.createElement("div");
2957 g.canvasEl.id = "pcm-c";
2958 g.canvasEl.hideFocus = a;
2959 document.getElementById("logo").appendChild(g.canvasEl);
2960 g.canvasEl.tabIndex = 0;
2961 g.canvasEl.focus()
2962 };
2963 g.everythingIsReady = function () {
2964 if (!g.ready) {
2965 g.ready = a;
2966 var b = document.getElementById("logo-l");
2967 google.dom.remove(b);
2968 document.getElementById("logo").style.background = "black";
2969 g.addCss();
2970 g.createCanvasElement();
2971 g.speedIntervals = [];
2972 g.oppositeDirections = [];
2973 g.oppositeDirections[1] = 2;
2974 g.oppositeDirections[2] = 1;
2975 g.oppositeDirections[4] = 8;
2976 g.oppositeDirections[8] = 4;
2977 g.addEventListeners();
2978 g.fpsChoice = 0;
2979 g.canDecreaseFps = a;
2980 g.initializeTickTimer();
2981 g.newGame()
2982 }
2983 };
2984 g.checkIfEverythingIsReady = function () {
2985 if (g.soundReady || g.graphicsReady) g.updateLoadingProgress(0.67);
2986 if (g.soundReady && g.graphicsReady) {
2987 g.updateLoadingProgress(1);
2988 g.everythingIsReady()
2989 }
2990 };
2991 g.preloadImage = function (b) {
2992 var c = new Image,
2993 d = google.browser.engine.IE;
2994 if (!d) c.onload = g.imageLoaded;
2995 c.src = b;
2996 d && g.imageLoaded()
2997 };
2998 g.imageLoaded = function () {
2999 g.graphicsReady = a;
3000 g.checkIfEverythingIsReady()
3001 };
3002 g.prepareGraphics = function () {
3003 g.graphicsReady = e;
3004 g.preloadImage("src/pacman10-hp-sprite.png")
3005 };
3006 g.trimString = function (b) {
3007 return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "")
3008 };
3009 g.g = function (b, c) {
3010 if (b < c) return -1;
3011 else if (b > c) return 1;
3012 return 0
3013 };
3014 g.compareVersions = function (b, c) {
3015 for (var d = 0, f = g.trimString(String(b)).split("."), h = g.trimString(String(c)).split("."), j = Math.max(f.length, h.length), k = 0; d == 0 && k < j; k++) {
3016 var x = f[k] || "",
3017 F = h[k] || "",
3018 G = new RegExp("(\\d*)(\\D*)", "g"),
3019 H = new RegExp("(\\d*)(\\D*)", "g");
3020 do {
3021 var t = G.exec(x) || ["", "", ""],
3022 u = H.exec(F) || ["", "", ""];
3023 if (t[0].length == 0 && u[0].length == 0) break;
3024 d = t[1].length == 0 ? 0 : parseInt(t[1], 10);
3025 var I = u[1].length == 0 ? 0 : parseInt(u[1], 10);
3026 d = g.g(d, I) || g.g(t[2].length == 0, u[2].length == 0) || g.g(t[2], u[2])
3027 } while (d == 0)
3028 }
3029 return d
3030 };
3031 g.getFlashVersion = function (b) {
3032 b = b.match(/[\d]+/g);
3033 b.length = 3;
3034 return b.join(".")
3035 };
3036 g.detectFlash = function () {
3037 var b = e,
3038 c = "";
3039 if (navigator.plugins && navigator.plugins.length) {
3040 var d = navigator.plugins["Shockwave Flash"];
3041 if (d) {
3042 b = a;
3043 if (d.description) c = g.getFlashVersion(d.description)
3044 }
3045 if (navigator.plugins["Shockwave Flash 2.0"]) {
3046 b = a;
3047 c = "2.0.0.11"
3048 }
3049 } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
3050 if (b = (d = navigator.mimeTypes["application/x-shockwave-flash"]) && d.enabledPlugin) {
3051 c = d.enabledPlugin.description;
3052 c = g.getFlashVersion(c)
3053 }
3054 } else try {
3055 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
3056 b = a;
3057 c = g.getFlashVersion(d.GetVariable("$version"))
3058 } catch (f) {
3059 try {
3060 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
3061 b = a;
3062 c = "6.0.21"
3063 } catch (h) {
3064 try {
3065 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
3066 b = a;
3067 c = g.getFlashVersion(d.GetVariable("$version"))
3068 } catch (j) {}
3069 }
3070 }
3071 g.hasFlash = b;
3072 g.flashVersion = c
3073 };
3074 g.isFlashVersion = function (b) {
3075 return g.compareVersions(g.flashVersion, b) >= 0
3076 };
3077 g.prepareSound = function () {
3078 g.soundAvailable = e;
3079 g.soundEnabled = e;
3080 g.soundReady = e;
3081 g.detectFlash();
3082 if (!g.hasFlash || !g.isFlashVersion("9.0.0.0")) {
3083 g.soundReady = a;
3084 g.checkIfEverythingIsReady()
3085 } else {
3086 g.flashIframe = document.createElement("iframe");
3087 g.flashIframe.name = "pm-sound";
3088 g.flashIframe.style.position = "absolute";
3089 g.flashIframe.style.top = "-150px";
3090 g.flashIframe.style.border = 0;
3091 g.flashIframe.style.width = "100px";
3092 g.flashIframe.style.height = "100px";
3093 google.dom.append(g.flashIframe);
3094 g.flashIframeDoc = g.flashIframe.contentDocument;
3095 if (g.flashIframeDoc == undefined || g.flashIframeDoc == null) g.flashIframeDoc = g.flashIframe.contentWindow.document;
3096 g.flashIframeDoc.open();
3097 g.flashIframeDoc.write('<html><head></head><body><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="pacman-sound-player" type="application/x-shockwave-flash"> <param name="movie" value="src/swf/pacman10-hp-sound.swf"> <param name="allowScriptAccess" value="always"> <object id="pacman-sound-player-2" type="application/x-shockwave-flash" data="src/swf/pacman10-hp-sound.swf" width="0" height="0"><param name="allowScriptAccess" value="always"> </object></object></body></html>');
3098 g.flashIframeDoc.close();
3099 window.setTimeout(g.flashNotReady, 3E3)
3100 }
3101 };
3102 g.flashNotReady = function () {
3103 if (!g.ready) {
3104 g.soundAvailable = e;
3105 g.soundEnabled = e;
3106 g.soundReady = a;
3107 g.checkIfEverythingIsReady()
3108 }
3109 };
3110 g.flashReady = function (b) {
3111 g.flashSoundPlayer = b;
3112 g.soundAvailable = a;
3113 g.soundEnabled = a;
3114 g.soundReady = a;
3115 g.checkIfEverythingIsReady()
3116 };
3117 g.flashLoaded = function () {
3118 if (g.flashIframeDoc) {
3119 var b = g.flashIframeDoc.getElementById("pacman-sound-player");
3120 if (b && b.playTrack) {
3121 g.flashReady(b);
3122 return
3123 } else if ((b = g.flashIframeDoc.getElementById("pacman-sound-player-2")) && b.playTrack) {
3124 g.flashReady(b);
3125 return
3126 }
3127 }
3128 g.flashNotReady()
3129 };
3130 g.destroy = function () {
3131 if (google.pacman) {
3132 g.stopAllAudio();
3133 window.clearInterval(g.tickTimer);
3134 window.clearInterval(g.dotTimer);
3135 window.clearInterval(g.dotTimerMs);
3136 google.dom.remove(g.styleElement);
3137 google.dom.remove(g.flashIframe);
3138 google.dom.remove(g.canvasEl);
3139 google.pacman = undefined
3140 }
3141 };
3142 g.exportFunctionCalls = function () {
3143 google.pacman = {};
3144 google.pacman.insertCoin = g.insertCoin;
3145 google.pacman.flashLoaded = g.flashLoaded;
3146 google.pacman.destroy = g.destroy
3147 };
3148 g.updateLoadingProgress = function (b) {
3149 b = Math.round(b * 200);
3150 document.getElementById("logo-b").style.width = b + "px"
3151 };
3152 g.init = function () {
3153 g.ready = e;
3154 document.getElementById("logo").title = "";
3155 g.updateLoadingProgress(0.33);
3156 g.exportFunctionCalls();
3157 g.useCss = navigator.userAgent.indexOf("MSIE 5.") != -1 || navigator.userAgent.indexOf("MSIE 6.") != -1 || navigator.userAgent.indexOf("MSIE 7.") != -1 ? e : a;
3158 g.prepareGraphics();
3159 g.prepareSound()
3160 };
3161 g.init();
3162}(); \ No newline at end of file
diff --git a/pacman-google/src/js/pacman10-hp.3.js b/pacman-google/src/js/pacman10-hp.3.js
new file mode 100644
index 0000000..fe3ef91
--- /dev/null
+++ b/pacman-google/src/js/pacman10-hp.3.js
@@ -0,0 +1,3200 @@
1/*!
2 * Google Pacman
3 *
4 * Copyright 2010, Google
5 *
6 * Date: Fri May 21 2010
7 */
8
9google.pacman ||
10function () {
11 var a = true,
12 e = false,
13 g = {},
14 i = [1, 4, 2, 8],
15 l = {
16 0: {
17 axis: 0,
18 increment: 0
19 },
20 1: {
21 axis: 0,
22 increment: -1
23 },
24 2: {
25 axis: 0,
26 increment: +1
27 },
28 4: {
29 axis: 1,
30 increment: -1
31 },
32 8: {
33 axis: 1,
34 increment: +1
35 }
36 },
37 m = [0, 7, 17, 32],
38 n = [{
39 x: 5,
40 y: 1,
41 w: 56
42 },
43 {
44 x: 5,
45 y: 4,
46 w: 5
47 },
48 {
49 x: 5,
50 y: 1,
51 h: 4
52 },
53 {
54 x: 9,
55 y: 1,
56 h: 12
57 },
58 {
59 x: 5,
60 y: 12,
61 h: 4
62 },
63 {
64 x: 10,
65 y: 12,
66 h: 4
67 },
68 {
69 x: 5,
70 y: 15,
71 w: 16
72 },
73 {
74 x: 5,
75 y: 12,
76 w: 31
77 },
78 {
79 x: 60,
80 y: 1,
81 h: 4
82 },
83 {
84 x: 54,
85 y: 1,
86 h: 4
87 },
88 {
89 x: 19,
90 y: 1,
91 h: 12
92 },
93 {
94 x: 19,
95 y: 4,
96 w: 26
97 },
98 {
99 x: 13,
100 y: 5,
101 w: 7
102 },
103 {
104 x: 13,
105 y: 5,
106 h: 4
107 },
108 {
109 x: 13,
110 y: 8,
111 w: 3
112 },
113 {
114 x: 56,
115 y: 4,
116 h: 9
117 },
118 {
119 x: 48,
120 y: 4,
121 w: 13
122 },
123 {
124 x: 48,
125 y: 1,
126 h: 12
127 },
128 {
129 x: 60,
130 y: 12,
131 h: 4
132 },
133 {
134 x: 44,
135 y: 15,
136 w: 17
137 },
138 {
139 x: 54,
140 y: 12,
141 h: 4
142 },
143 {
144 x: 44,
145 y: 12,
146 w: 17
147 },
148 {
149 x: 44,
150 y: 1,
151 h: 15
152 },
153 {
154 x: 41,
155 y: 13,
156 w: 4
157 },
158 {
159 x: 41,
160 y: 13,
161 h: 3
162 },
163 {
164 x: 38,
165 y: 13,
166 h: 3
167 },
168 {
169 x: 38,
170 y: 15,
171 w: 4
172 },
173 {
174 x: 35,
175 y: 10,
176 w: 10
177 },
178 {
179 x: 35,
180 y: 1,
181 h: 15
182 },
183 {
184 x: 35,
185 y: 13,
186 w: 4
187 },
188 {
189 x: 21,
190 y: 12,
191 h: 4
192 },
193 {
194 x: 24,
195 y: 12,
196 h: 4
197 },
198 {
199 x: 24,
200 y: 15,
201 w: 12
202 },
203 {
204 x: 27,
205 y: 4,
206 h: 9
207 },
208 {
209 x: 52,
210 y: 9,
211 w: 5
212 },
213 {
214 x: 56,
215 y: 8,
216 w: 10,
217 type: 1
218 },
219 {
220 x: 1,
221 y: 8,
222 w: 9,
223 type: 1
224 }],
225 o = [{
226 x: 1,
227 y: 8,
228 w: 8
229 },
230 {
231 x: 57,
232 y: 8,
233 w: 9
234 },
235 {
236 x: 44,
237 y: 2,
238 h: 10
239 },
240 {
241 x: 35,
242 y: 5,
243 h: 7
244 },
245 {
246 x: 36,
247 y: 4,
248 w: 8
249 },
250 {
251 x: 36,
252 y: 10,
253 w: 8
254 },
255 {
256 x: 39,
257 y: 15,
258 w: 2
259 }],
260 p = [{
261 x: 5,
262 y: 15
263 },
264 {
265 x: 5,
266 y: 3
267 },
268 {
269 x: 15,
270 y: 8
271 },
272 {
273 x: 60,
274 y: 3
275 },
276 {
277 x: 60,
278 y: 15
279 }],
280 q = [{
281 x: 2,
282 y: 8
283 },
284 {
285 x: 63,
286 y: 8
287 }],
288 r = {
289 1: [{
290 x: 39.5,
291 y: 15,
292 dir: 4
293 },
294 {
295 x: 39.5,
296 y: 4,
297 dir: 4,
298 scatterX: 57,
299 scatterY: -4
300 },
301 {
302 x: 39.5,
303 y: 7,
304 dir: 2,
305 scatterX: 0,
306 scatterY: -4
307 },
308 {
309 x: 37.625,
310 y: 7,
311 dir: 1,
312 scatterX: 57,
313 scatterY: 20
314 },
315 {
316 x: 41.375,
317 y: 7,
318 dir: 1,
319 scatterX: 0,
320 scatterY: 20
321 }],
322 2: [{
323 x: 40.25,
324 y: 15,
325 dir: 8
326 },
327 {
328 x: 38.75,
329 y: 15,
330 dir: 4
331 },
332 {
333 x: 39.5,
334 y: 4,
335 dir: 4,
336 scatterX: 57,
337 scatterY: -4
338 },
339 {
340 x: 39.5,
341 y: 7,
342 dir: 2,
343 scatterX: 0,
344 scatterY: -4
345 },
346 {
347 x: 37.625,
348 y: 7,
349 dir: 1,
350 scatterX: 57,
351 scatterY: 20
352 },
353 {
354 x: 41.375,
355 y: 7,
356 dir: 1,
357 scatterX: 0,
358 scatterY: 20
359 }]
360 },
361 s = [32, 312],
362 v = [80, 312],
363 w = {
364 0: 0.16,
365 1: 0.23,
366 2: 1,
367 3: 1,
368 4: 2.23,
369 5: 0.3,
370 6: 1.9,
371 7: 2.23,
372 8: 1.9,
373 9: 5,
374 10: 1.9,
375 11: 1.18,
376 12: 0.3,
377 13: 0.5,
378 14: 1.9,
379 15: 9,
380 16: 10,
381 17: 0.26
382 },
383 y = 0.8 * 0.4,
384 z = [{},
385 {
386 ghostSpeed: 0.75,
387 ghostTunnelSpeed: 0.4,
388 playerSpeed: 0.8,
389 dotEatingSpeed: 0.71,
390 ghostFrightSpeed: 0.5,
391 playerFrightSpeed: 0.9,
392 dotEatingFrightSpeed: 0.79,
393 elroyDotsLeftPart1: 20,
394 elroySpeedPart1: 0.8,
395 elroyDotsLeftPart2: 10,
396 elroySpeedPart2: 0.85,
397 frightTime: 6,
398 frightBlinkCount: 5,
399 fruit: 1,
400 fruitScore: 100,
401 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 20, 5, 1],
402 penForceTime: 4,
403 penLeavingLimits: [0, 0, 30, 60]
404 },
405 {
406 ghostSpeed: 0.85,
407 ghostTunnelSpeed: 0.45,
408 playerSpeed: 0.9,
409 dotEatingSpeed: 0.79,
410 ghostFrightSpeed: 0.55,
411 playerFrightSpeed: 0.95,
412 dotEatingFrightSpeed: 0.83,
413 elroyDotsLeftPart1: 30,
414 elroySpeedPart1: 0.9,
415 elroyDotsLeftPart2: 15,
416 elroySpeedPart2: 0.95,
417 frightTime: 5,
418 frightBlinkCount: 5,
419 fruit: 2,
420 fruitScore: 300,
421 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
422 penForceTime: 4,
423 penLeavingLimits: [0, 0, 0, 50],
424 cutsceneId: 1
425 },
426 {
427 ghostSpeed: 0.85,
428 ghostTunnelSpeed: 0.45,
429 playerSpeed: 0.9,
430 dotEatingSpeed: 0.79,
431 ghostFrightSpeed: 0.55,
432 playerFrightSpeed: 0.95,
433 dotEatingFrightSpeed: 0.83,
434 elroyDotsLeftPart1: 40,
435 elroySpeedPart1: 0.9,
436 elroyDotsLeftPart2: 20,
437 elroySpeedPart2: 0.95,
438 frightTime: 4,
439 frightBlinkCount: 5,
440 fruit: 3,
441 fruitScore: 500,
442 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
443 penForceTime: 4,
444 penLeavingLimits: [0, 0, 0, 0]
445 },
446 {
447 ghostSpeed: 0.85,
448 ghostTunnelSpeed: 0.45,
449 playerSpeed: 0.9,
450 dotEatingSpeed: 0.79,
451 ghostFrightSpeed: 0.55,
452 playerFrightSpeed: 0.95,
453 dotEatingFrightSpeed: 0.83,
454 elroyDotsLeftPart1: 40,
455 elroySpeedPart1: 0.9,
456 elroyDotsLeftPart2: 20,
457 elroySpeedPart2: 0.95,
458 frightTime: 3,
459 frightBlinkCount: 5,
460 fruit: 3,
461 fruitScore: 500,
462 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
463 penForceTime: 4,
464 penLeavingLimits: [0, 0, 0, 0]
465 },
466 {
467 ghostSpeed: 0.95,
468 ghostTunnelSpeed: 0.5,
469 playerSpeed: 1,
470 dotEatingSpeed: 0.87,
471 ghostFrightSpeed: 0.6,
472 playerFrightSpeed: 1,
473 dotEatingFrightSpeed: 0.87,
474 elroyDotsLeftPart1: 40,
475 elroySpeedPart1: 1,
476 elroyDotsLeftPart2: 20,
477 elroySpeedPart2: 1.05,
478 frightTime: 2,
479 frightBlinkCount: 5,
480 fruit: 4,
481 fruitScore: 700,
482 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
483 penForceTime: 3,
484 penLeavingLimits: [0, 0, 0, 0],
485 cutsceneId: 2
486 },
487 {
488 ghostSpeed: 0.95,
489 ghostTunnelSpeed: 0.5,
490 playerSpeed: 1,
491 dotEatingSpeed: 0.87,
492 ghostFrightSpeed: 0.6,
493 playerFrightSpeed: 1,
494 dotEatingFrightSpeed: 0.87,
495 elroyDotsLeftPart1: 50,
496 elroySpeedPart1: 1,
497 elroyDotsLeftPart2: 25,
498 elroySpeedPart2: 1.05,
499 frightTime: 5,
500 frightBlinkCount: 5,
501 fruit: 4,
502 fruitScore: 700,
503 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
504 penForceTime: 3,
505 penLeavingLimits: [0, 0, 0, 0]
506 },
507 {
508 ghostSpeed: 0.95,
509 ghostTunnelSpeed: 0.5,
510 playerSpeed: 1,
511 dotEatingSpeed: 0.87,
512 ghostFrightSpeed: 0.6,
513 playerFrightSpeed: 1,
514 dotEatingFrightSpeed: 0.87,
515 elroyDotsLeftPart1: 50,
516 elroySpeedPart1: 1,
517 elroyDotsLeftPart2: 25,
518 elroySpeedPart2: 1.05,
519 frightTime: 2,
520 frightBlinkCount: 5,
521 fruit: 5,
522 fruitScore: 1E3,
523 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
524 penForceTime: 3,
525 penLeavingLimits: [0, 0, 0, 0]
526 },
527 {
528 ghostSpeed: 0.95,
529 ghostTunnelSpeed: 0.5,
530 playerSpeed: 1,
531 dotEatingSpeed: 0.87,
532 ghostFrightSpeed: 0.6,
533 playerFrightSpeed: 1,
534 dotEatingFrightSpeed: 0.87,
535 elroyDotsLeftPart1: 50,
536 elroySpeedPart1: 1,
537 elroyDotsLeftPart2: 25,
538 elroySpeedPart2: 1.05,
539 frightTime: 2,
540 frightBlinkCount: 5,
541 fruit: 5,
542 fruitScore: 1E3,
543 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
544 penForceTime: 3,
545 penLeavingLimits: [0, 0, 0, 0]
546 },
547 {
548 ghostSpeed: 0.95,
549 ghostTunnelSpeed: 0.5,
550 playerSpeed: 1,
551 dotEatingSpeed: 0.87,
552 ghostFrightSpeed: 0.6,
553 playerFrightSpeed: 1,
554 dotEatingFrightSpeed: 0.87,
555 elroyDotsLeftPart1: 60,
556 elroySpeedPart1: 1,
557 elroyDotsLeftPart2: 30,
558 elroySpeedPart2: 1.05,
559 frightTime: 1,
560 frightBlinkCount: 3,
561 fruit: 6,
562 fruitScore: 2E3,
563 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
564 penForceTime: 3,
565 penLeavingLimits: [0, 0, 0, 0],
566 cutsceneId: 3
567 },
568 {
569 ghostSpeed: 0.95,
570 ghostTunnelSpeed: 0.5,
571 playerSpeed: 1,
572 dotEatingSpeed: 0.87,
573 ghostFrightSpeed: 0.6,
574 playerFrightSpeed: 1,
575 dotEatingFrightSpeed: 0.87,
576 elroyDotsLeftPart1: 60,
577 elroySpeedPart1: 1,
578 elroyDotsLeftPart2: 30,
579 elroySpeedPart2: 1.05,
580 frightTime: 5,
581 frightBlinkCount: 5,
582 fruit: 6,
583 fruitScore: 2E3,
584 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
585 penForceTime: 3,
586 penLeavingLimits: [0, 0, 0, 0]
587 },
588 {
589 ghostSpeed: 0.95,
590 ghostTunnelSpeed: 0.5,
591 playerSpeed: 1,
592 dotEatingSpeed: 0.87,
593 ghostFrightSpeed: 0.6,
594 playerFrightSpeed: 1,
595 dotEatingFrightSpeed: 0.87,
596 elroyDotsLeftPart1: 60,
597 elroySpeedPart1: 1,
598 elroyDotsLeftPart2: 30,
599 elroySpeedPart2: 1.05,
600 frightTime: 2,
601 frightBlinkCount: 5,
602 fruit: 7,
603 fruitScore: 3E3,
604 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
605 penForceTime: 3,
606 penLeavingLimits: [0, 0, 0, 0]
607 },
608 {
609 ghostSpeed: 0.95,
610 ghostTunnelSpeed: 0.5,
611 playerSpeed: 1,
612 dotEatingSpeed: 0.87,
613 ghostFrightSpeed: 0.6,
614 playerFrightSpeed: 1,
615 dotEatingFrightSpeed: 0.87,
616 elroyDotsLeftPart1: 80,
617 elroySpeedPart1: 1,
618 elroyDotsLeftPart2: 40,
619 elroySpeedPart2: 1.05,
620 frightTime: 1,
621 frightBlinkCount: 3,
622 fruit: 7,
623 fruitScore: 3E3,
624 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
625 penForceTime: 3,
626 penLeavingLimits: [0, 0, 0, 0]
627 },
628 {
629 ghostSpeed: 0.95,
630 ghostTunnelSpeed: 0.5,
631 playerSpeed: 1,
632 dotEatingSpeed: 0.87,
633 ghostFrightSpeed: 0.6,
634 playerFrightSpeed: 1,
635 dotEatingFrightSpeed: 0.87,
636 elroyDotsLeftPart1: 80,
637 elroySpeedPart1: 1,
638 elroyDotsLeftPart2: 40,
639 elroySpeedPart2: 1.05,
640 frightTime: 1,
641 frightBlinkCount: 3,
642 fruit: 8,
643 fruitScore: 5E3,
644 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
645 penForceTime: 3,
646 penLeavingLimits: [0, 0, 0, 0],
647 cutsceneId: 3
648 },
649 {
650 ghostSpeed: 0.95,
651 ghostTunnelSpeed: 0.5,
652 playerSpeed: 1,
653 dotEatingSpeed: 0.87,
654 ghostFrightSpeed: 0.6,
655 playerFrightSpeed: 1,
656 dotEatingFrightSpeed: 0.87,
657 elroyDotsLeftPart1: 80,
658 elroySpeedPart1: 1,
659 elroyDotsLeftPart2: 40,
660 elroySpeedPart2: 1.05,
661 frightTime: 3,
662 frightBlinkCount: 5,
663 fruit: 8,
664 fruitScore: 5E3,
665 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
666 penForceTime: 3,
667 penLeavingLimits: [0, 0, 0, 0]
668 },
669 {
670 ghostSpeed: 0.95,
671 ghostTunnelSpeed: 0.5,
672 playerSpeed: 1,
673 dotEatingSpeed: 0.87,
674 ghostFrightSpeed: 0.6,
675 playerFrightSpeed: 1,
676 dotEatingFrightSpeed: 0.87,
677 elroyDotsLeftPart1: 100,
678 elroySpeedPart1: 1,
679 elroyDotsLeftPart2: 50,
680 elroySpeedPart2: 1.05,
681 frightTime: 1,
682 frightBlinkCount: 3,
683 fruit: 8,
684 fruitScore: 5E3,
685 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
686 penForceTime: 3,
687 penLeavingLimits: [0, 0, 0, 0]
688 },
689 {
690 ghostSpeed: 0.95,
691 ghostTunnelSpeed: 0.5,
692 playerSpeed: 1,
693 dotEatingSpeed: 0.87,
694 ghostFrightSpeed: 0.6,
695 playerFrightSpeed: 1,
696 dotEatingFrightSpeed: 0.87,
697 elroyDotsLeftPart1: 100,
698 elroySpeedPart1: 1,
699 elroyDotsLeftPart2: 50,
700 elroySpeedPart2: 1.05,
701 frightTime: 1,
702 frightBlinkCount: 3,
703 fruit: 8,
704 fruitScore: 5E3,
705 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
706 penForceTime: 3,
707 penLeavingLimits: [0, 0, 0, 0]
708 },
709 {
710 ghostSpeed: 0.95,
711 ghostTunnelSpeed: 0.5,
712 playerSpeed: 1,
713 dotEatingSpeed: 0.87,
714 ghostFrightSpeed: 0.6,
715 playerFrightSpeed: 1,
716 dotEatingFrightSpeed: 0.87,
717 elroyDotsLeftPart1: 100,
718 elroySpeedPart1: 1,
719 elroyDotsLeftPart2: 50,
720 elroySpeedPart2: 1.05,
721 frightTime: 0,
722 frightBlinkCount: 0,
723 fruit: 8,
724 fruitScore: 5E3,
725 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
726 penForceTime: 3,
727 penLeavingLimits: [0, 0, 0, 0],
728 cutsceneId: 3
729 },
730 {
731 ghostSpeed: 0.95,
732 ghostTunnelSpeed: 0.5,
733 playerSpeed: 1,
734 dotEatingSpeed: 0.87,
735 ghostFrightSpeed: 0.6,
736 playerFrightSpeed: 1,
737 dotEatingFrightSpeed: 0.87,
738 elroyDotsLeftPart1: 100,
739 elroySpeedPart1: 1,
740 elroyDotsLeftPart2: 50,
741 elroySpeedPart2: 1.05,
742 frightTime: 1,
743 frightBlinkCount: 3,
744 fruit: 8,
745 fruitScore: 5E3,
746 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
747 penForceTime: 3,
748 penLeavingLimits: [0, 0, 0, 0]
749 },
750 {
751 ghostSpeed: 0.95,
752 ghostTunnelSpeed: 0.5,
753 playerSpeed: 1,
754 dotEatingSpeed: 0.87,
755 ghostFrightSpeed: 0.6,
756 playerFrightSpeed: 1,
757 dotEatingFrightSpeed: 0.87,
758 elroyDotsLeftPart1: 120,
759 elroySpeedPart1: 1,
760 elroyDotsLeftPart2: 60,
761 elroySpeedPart2: 1.05,
762 frightTime: 0,
763 frightBlinkCount: 0,
764 fruit: 8,
765 fruitScore: 5E3,
766 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
767 penForceTime: 3,
768 penLeavingLimits: [0, 0, 0, 0]
769 },
770 {
771 ghostSpeed: 0.95,
772 ghostTunnelSpeed: 0.5,
773 playerSpeed: 1,
774 dotEatingSpeed: 0.87,
775 ghostFrightSpeed: 0.6,
776 playerFrightSpeed: 1,
777 dotEatingFrightSpeed: 0.87,
778 elroyDotsLeftPart1: 120,
779 elroySpeedPart1: 1,
780 elroyDotsLeftPart2: 60,
781 elroySpeedPart2: 1.05,
782 frightTime: 0,
783 frightBlinkCount: 0,
784 fruit: 8,
785 fruitScore: 5E3,
786 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
787 penForceTime: 3,
788 penLeavingLimits: [0, 0, 0, 0]
789 },
790 {
791 ghostSpeed: 0.95,
792 ghostTunnelSpeed: 0.5,
793 playerSpeed: 0.9,
794 dotEatingSpeed: 0.79,
795 ghostFrightSpeed: 0.75,
796 playerFrightSpeed: 0.9,
797 dotEatingFrightSpeed: 0.79,
798 elroyDotsLeftPart1: 120,
799 elroySpeedPart1: 1,
800 elroyDotsLeftPart2: 60,
801 elroySpeedPart2: 1.05,
802 frightTime: 0,
803 frightBlinkCount: 0,
804 fruit: 8,
805 fruitScore: 5E3,
806 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
807 penForceTime: 3,
808 penLeavingLimits: [0, 0, 0, 0]
809 }],
810 A = {
811 1: [{
812 x: 37.6,
813 y: 7,
814 dir: 1,
815 dest: 6.375,
816 speed: 0.48
817 },
818 {
819 x: 37.6,
820 y: 6.375,
821 dir: 2,
822 dest: 7.625,
823 speed: 0.48
824 },
825 {
826 x: 37.6,
827 y: 7.625,
828 dir: 1,
829 dest: 7,
830 speed: 0.48
831 }],
832 2: [{
833 x: 39.5,
834 y: 7,
835 dir: 2,
836 dest: 7.625,
837 speed: 0.48
838 },
839 {
840 x: 39.5,
841 y: 7.625,
842 dir: 1,
843 dest: 6.375,
844 speed: 0.48
845 },
846 {
847 x: 39.5,
848 y: 6.375,
849 dir: 2,
850 dest: 7,
851 speed: 0.48
852 }],
853 3: [{
854 x: 41.4,
855 y: 7,
856 dir: 1,
857 dest: 6.375,
858 speed: 0.48
859 },
860 {
861 x: 41.4,
862 y: 6.375,
863 dir: 2,
864 dest: 7.625,
865 speed: 0.48
866 },
867 {
868 x: 41.4,
869 y: 7.625,
870 dir: 1,
871 dest: 7,
872 speed: 0.48
873 }],
874 4: [{
875 x: 37.6,
876 y: 7,
877 dir: 8,
878 dest: 39.5,
879 speed: y
880 },
881 {
882 x: 39.5,
883 y: 7,
884 dir: 1,
885 dest: 4,
886 speed: y
887 }],
888 5: [{
889 x: 39.5,
890 y: 7,
891 dir: 1,
892 dest: 4,
893 speed: y
894 }],
895 6: [{
896 x: 41.4,
897 y: 7,
898 dir: 4,
899 dest: 39.5,
900 speed: y
901 },
902 {
903 x: 39.5,
904 y: 7,
905 dir: 1,
906 dest: 4,
907 speed: y
908 }],
909 7: [{
910 x: 39.5,
911 y: 4,
912 dir: 2,
913 dest: 7,
914 speed: 1.6
915 },
916 {
917 x: 39.5,
918 y: 7,
919 dir: 4,
920 dest: 37.625,
921 speed: 1.6
922 }],
923 8: [{
924 x: 39.5,
925 y: 4,
926 dir: 2,
927 dest: 7,
928 speed: 1.6
929 }],
930 9: [{
931 x: 39.5,
932 y: 4,
933 dir: 2,
934 dest: 7,
935 speed: 1.6
936 },
937 {
938 x: 39.5,
939 y: 7,
940 dir: 8,
941 dest: 41.375,
942 speed: 1.6
943 }],
944 10: [{
945 x: 37.6,
946 y: 7,
947 dir: 8,
948 dest: 39.5,
949 speed: y
950 },
951 {
952 x: 39.5,
953 y: 7,
954 dir: 1,
955 dest: 4,
956 speed: y
957 }],
958 11: [{
959 x: 39.5,
960 y: 7,
961 dir: 1,
962 dest: 4,
963 speed: y
964 }],
965 12: [{
966 x: 41.4,
967 y: 7,
968 dir: 4,
969 dest: 39.5,
970 speed: y
971 },
972 {
973 x: 39.5,
974 y: 7,
975 dir: 1,
976 dest: 4,
977 speed: y
978 }]
979 },
980 B = {
981 1: {
982 actors: [{
983 ghost: e,
984 x: 64,
985 y: 9,
986 id: 0
987 },
988 {
989 ghost: a,
990 x: 68.2,
991 y: 9,
992 id: 1
993 }],
994 sequence: [{
995 time: 5.5,
996 moves: [{
997 dir: 4,
998 speed: 0.75 * 0.8 * 2
999 },
1000 {
1001 dir: 4,
1002 speed: 0.78 * 0.8 * 2
1003 }]
1004 },
1005 {
1006 time: 0.1,
1007 moves: [{
1008 dir: 4,
1009 speed: 32
1010 },
1011 {
1012 dir: 4,
1013 speed: 0
1014 }]
1015 },
1016 {
1017 time: 9,
1018 moves: [{
1019 dir: 8,
1020 speed: 0.75 * 0.8 * 2,
1021 elId: "pcm-bpcm"
1022 },
1023 {
1024 dir: 8,
1025 speed: 0.8,
1026 mode: 4
1027 }]
1028 }]
1029 },
1030 2: {
1031 actors: [{
1032 ghost: e,
1033 x: 64,
1034 y: 9,
1035 id: 0
1036 },
1037 {
1038 ghost: a,
1039 x: 70.2,
1040 y: 9,
1041 id: 1
1042 },
1043 {
1044 ghost: a,
1045 x: 32,
1046 y: 9.5,
1047 id: 2
1048 }],
1049 sequence: [{
1050 time: 2.7,
1051 moves: [{
1052 dir: 4,
1053 speed: 0.75 * 0.8 * 2
1054 },
1055 {
1056 dir: 4,
1057 speed: 0.78 * 0.8 * 2
1058 },
1059 {
1060 dir: 0,
1061 speed: 0,
1062 elId: "pcm-stck"
1063 }]
1064 },
1065 {
1066 time: 1,
1067 moves: [{
1068 dir: 4,
1069 speed: 0.75 * 0.8 * 2
1070 },
1071 {
1072 dir: 4,
1073 speed: 0.1 * 0.8
1074 },
1075 {
1076 dir: 0,
1077 speed: 0,
1078 elId: "pcm-stck"
1079 }]
1080 },
1081 {
1082 time: 1.3,
1083 moves: [{
1084 dir: 4,
1085 speed: 0.75 * 0.8 * 2
1086 },
1087 {
1088 dir: 4,
1089 speed: 0
1090 },
1091 {
1092 dir: 0,
1093 speed: 0,
1094 elId: "pcm-stck"
1095 }]
1096 },
1097 {
1098 time: 1,
1099 moves: [{
1100 dir: 4,
1101 speed: 0.75 * 0.8 * 2
1102 },
1103 {
1104 dir: 4,
1105 speed: 0,
1106 elId: "pcm-ghfa"
1107 },
1108 {
1109 dir: 0,
1110 speed: 0,
1111 elId: "pcm-stck"
1112 }]
1113 },
1114 {
1115 time: 2.5,
1116 moves: [{
1117 dir: 4,
1118 speed: 0.75 * 0.8 * 2
1119 },
1120 {
1121 dir: 4,
1122 speed: 0,
1123 elId: "pcm-ghfa"
1124 },
1125 {
1126 dir: 0,
1127 speed: 0,
1128 elId: "pcm-stck"
1129 }]
1130 }]
1131 },
1132 3: {
1133 actors: [{
1134 ghost: e,
1135 x: 64,
1136 y: 9,
1137 id: 0
1138 },
1139 {
1140 ghost: a,
1141 x: 70.2,
1142 y: 9,
1143 id: 2
1144 }],
1145 sequence: [{
1146 time: 5.3,
1147 moves: [{
1148 dir: 4,
1149 speed: 0.75 * 0.8 * 2
1150 },
1151 {
1152 dir: 4,
1153 speed: 0.78 * 0.8 * 2,
1154 elId: "pcm-ghin"
1155 }]
1156 },
1157 {
1158 time: 5.3,
1159 moves: [{
1160 dir: 4,
1161 speed: 0
1162 },
1163 {
1164 dir: 8,
1165 speed: 0.78 * 0.8 * 2,
1166 elId: "pcm-gbug"
1167 }]
1168 }]
1169 }
1170 },
1171 C = [90, 45, 30],
1172 D = C[0];
1173
1174 function E(b) {
1175 this.id = b
1176 }
1177 E.prototype.A = function () {
1178 var b = r[g.playerCount][this.id];
1179 this.pos = [b.y * 8, b.x * 8];
1180 this.posDelta = [0, 0];
1181 this.tilePos = [b.y * 8, b.x * 8];
1182 this.targetPos = [b.scatterY * 8, b.scatterX * 8];
1183 this.scatterPos = [b.scatterY * 8, b.scatterX * 8];
1184 this.lastActiveDir = this.dir = b.dir;
1185 this.physicalSpeed = this.requestedDir = this.nextDir = 0;
1186 this.c(0);
1187 this.reverseDirectionsNext = this.freeToLeavePen = this.modeChangedWhileInPen = this.eatenInThisFrightMode = e;
1188 this.l()
1189 };
1190 E.prototype.createElement = function () {
1191 this.el = document.createElement("div");
1192 this.el.className = "pcm-ac";
1193 this.el.id = "actor" + this.id;
1194 g.prepareElement(this.el, 0, 0);
1195 g.playfieldEl.appendChild(this.el);
1196 this.elPos = [0, 0];
1197 this.elBackgroundPos = [0, 0]
1198 };
1199 E.prototype.a = function (b) {
1200 var c = this.mode;
1201 this.mode = b;
1202 if (this.id == g.playerCount + 3 && (b == 16 || c == 16)) g.updateCruiseElroySpeed();
1203 switch (c) {
1204 case 32:
1205 g.ghostExitingPenNow = e;
1206 break;
1207 case 8:
1208 g.ghostEyesCount > 0 && g.ghostEyesCount--;
1209 g.ghostEyesCount == 0 && g.playAmbientSound();
1210 break
1211 }
1212 switch (b) {
1213 case 4:
1214 this.fullSpeed = g.levels.ghostFrightSpeed * 0.8;
1215 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1216 this.followingRoutine = e;
1217 break;
1218 case 1:
1219 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1220 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1221 this.followingRoutine =
1222 e;
1223 break;
1224 case 2:
1225 this.targetPos = this.scatterPos;
1226 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1227 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1228 this.followingRoutine = e;
1229 break;
1230 case 8:
1231 this.tunnelSpeed = this.fullSpeed = 1.6;
1232 this.targetPos = [s[0], s[1]];
1233 this.freeToLeavePen = this.followingRoutine = e;
1234 break;
1235 case 16:
1236 this.l();
1237 this.followingRoutine = a;
1238 this.routineMoveId = -1;
1239 switch (this.id) {
1240 case g.playerCount + 1:
1241 this.routineToFollow = 2;
1242 break;
1243 case g.playerCount + 2:
1244 this.routineToFollow = 1;
1245 break;
1246 case g.playerCount + 3:
1247 this.routineToFollow =
1248 3;
1249 break
1250 }
1251 break;
1252 case 32:
1253 this.followingRoutine = a;
1254 this.routineMoveId = -1;
1255 switch (this.id) {
1256 case g.playerCount + 1:
1257 this.routineToFollow = 5;
1258 break;
1259 case g.playerCount + 2:
1260 this.routineToFollow = 4;
1261 break;
1262 case g.playerCount + 3:
1263 this.routineToFollow = 6;
1264 break
1265 }
1266 g.ghostExitingPenNow = a;
1267 break;
1268 case 64:
1269 this.followingRoutine = a;
1270 this.routineMoveId = -1;
1271 switch (this.id) {
1272 case g.playerCount:
1273 case g.playerCount + 1:
1274 this.routineToFollow = 8;
1275 break;
1276 case g.playerCount + 2:
1277 this.routineToFollow = 7;
1278 break;
1279 case g.playerCount + 3:
1280 this.routineToFollow = 9;
1281 break
1282 }
1283 break;
1284 case 128:
1285 this.followingRoutine = a;
1286 this.routineMoveId = -1;
1287 switch (this.id) {
1288 case g.playerCount:
1289 case g.playerCount + 1:
1290 this.routineToFollow = 11;
1291 break;
1292 case g.playerCount + 2:
1293 this.routineToFollow = 10;
1294 break;
1295 case g.playerCount + 3:
1296 this.routineToFollow = 12;
1297 break
1298 }
1299 break
1300 }
1301 this.d()
1302 };
1303 E.prototype.l = function () {
1304 if (this.id >= g.playerCount) this.targetPlayerId = Math.floor(g.rand() * g.playerCount)
1305 };
1306 E.prototype.z = function (b) {
1307 if (!g.userDisabledSound) {
1308 google.pacManSound = a;
1309 g.updateSoundIcon()
1310 }
1311 if (this.dir == g.oppositeDirections[b]) {
1312 this.dir = b;
1313 this.posDelta = [0, 0];
1314 this.currentSpeed != 2 && this.c(0);
1315 if (this.dir != 0) this.lastActiveDir = this.dir;
1316 this.nextDir = 0
1317 } else if (this.dir != b) if (this.dir == 0) {
1318 if (g.playfield[this.pos[0]][this.pos[1]].allowedDir & b) this.dir = b
1319 } else {
1320 var c = g.playfield[this.tilePos[0]][this.tilePos[1]];
1321 if (c && c.allowedDir & b) {
1322 c = l[this.dir];
1323 var d = [this.pos[0], this.pos[1]];
1324 d[c.axis] -= c.increment;
1325 var f = 0;
1326 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 1;
1327 else {
1328 d[c.axis] -= c.increment;
1329 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 2
1330 }
1331 if (f) {
1332 this.dir = b;
1333 this.pos[0] = this.tilePos[0];
1334 this.pos[1] = this.tilePos[1];
1335 c = l[this.dir];
1336 this.pos[c.axis] += c.increment * f;
1337 return
1338 }
1339 }
1340 this.nextDir = b;
1341 this.posDelta = [0, 0]
1342 }
1343 };
1344 E.prototype.i = function (b) {
1345 var c = this.tilePos,
1346 d = l[this.dir],
1347 f = [c[0], c[1]];
1348 f[d.axis] += d.increment * 8;
1349 var h = g.playfield[f[0]][f[1]];
1350 if (b && !h.intersection) h = g.playfield[c[0]][c[1]];
1351 if (h.intersection) switch (this.mode) {
1352 case 2:
1353 case 1:
1354 case 8:
1355 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1356 else {
1357 b = 99999999999;
1358 c = 0;
1359 for (var j in i) {
1360 var k = i[j];
1361 if (h.allowedDir & k && this.dir != g.oppositeDirections[k]) {
1362 d = l[k];
1363 var x = [f[0], f[1]];
1364 x[d.axis] += d.increment;
1365 d = g.getDistance(x, [this.targetPos[0], this.targetPos[1]]);
1366 if (d < b) {
1367 b = d;
1368 c = k
1369 }
1370 }
1371 }
1372 if (c) this.nextDir = c
1373 }
1374 break;
1375 case 4:
1376 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1377 else {
1378 do f = i[Math.floor(g.rand() * 4)];
1379 while ((f & h.allowedDir) == 0 || f == g.oppositeDirections[this.dir]);
1380 this.nextDir = f
1381 }
1382 break
1383 }
1384 };
1385 E.prototype.p = function (b) {
1386 g.tilesChanged = a;
1387 if (this.reverseDirectionsNext) {
1388 this.dir = g.oppositeDirections[this.dir];
1389 this.nextDir = 0;
1390 this.reverseDirectionsNext = e;
1391 this.i(a)
1392 }
1393 if (!this.ghost && !g.playfield[b[0]][b[1]].path) {
1394 this.pos[0] = this.lastGoodTilePos[0];
1395 this.pos[1] = this.lastGoodTilePos[1];
1396 b[0] = this.lastGoodTilePos[0];
1397 b[1] = this.lastGoodTilePos[1];
1398 this.dir = 0
1399 } else this.lastGoodTilePos = [b[0], b[1]];
1400 g.playfield[b[0]][b[1]].type == 1 && this.mode != 8 ? this.c(2) : this.c(0);
1401 !this.ghost && g.playfield[b[0]][b[1]].dot && g.dotEaten(this.id, b);
1402 this.tilePos[0] = b[0];
1403 this.tilePos[1] = b[1]
1404 };
1405 E.prototype.t = function () {
1406 var b = this.tilePos;
1407 switch (this.dir) {
1408 case 1:
1409 var c = [b[0], b[1]],
1410 d = [b[0] + 3.6, b[1]];
1411 break;
1412 case 2:
1413 c = [b[0] - 4, b[1]];
1414 d = [b[0], b[1]];
1415 break;
1416 case 4:
1417 c = [b[0], b[1]];
1418 d = [b[0], b[1] + 3.6];
1419 break;
1420 case 8:
1421 c = [b[0], b[1] - 4];
1422 d = [b[0], b[1]];
1423 break
1424 }
1425 if (this.pos[0] >= c[0] && this.pos[0] <= d[0] && this.pos[1] >= c[1] && this.pos[1] <= d[1]) {
1426 b = l[this.nextDir];
1427 this.posDelta[b.axis] += b.increment
1428 }
1429 };
1430 E.prototype.n = function () {
1431 if (this.pos[0] == q[0].y * 8 && this.pos[1] == q[0].x * 8) {
1432 this.pos[0] = q[1].y * 8;
1433 this.pos[1] = (q[1].x - 1) * 8
1434 } else if (this.pos[0] == q[1].y * 8 && this.pos[1] == q[1].x * 8) {
1435 this.pos[0] = q[0].y * 8;
1436 this.pos[1] = (q[0].x + 1) * 8
1437 }
1438 this.mode == 8 && this.pos[0] == s[0] && this.pos[1] == s[1] && this.a(64);
1439 if (!this.ghost && this.pos[0] == v[0] && (this.pos[1] == v[1] || this.pos[1] == v[1] + 8)) g.eatFruit(this.id)
1440 };
1441 E.prototype.u = function () {
1442 this.n();
1443 this.ghost && this.i(e);
1444 var b = g.playfield[this.pos[0]][this.pos[1]];
1445 if (b.intersection) if (this.nextDir && this.nextDir & b.allowedDir) {
1446 if (this.dir != 0) this.lastActiveDir = this.dir;
1447 this.dir = this.nextDir;
1448 this.nextDir = 0;
1449 if (!this.ghost) {
1450 this.pos[0] += this.posDelta[0];
1451 this.pos[1] += this.posDelta[1];
1452 this.posDelta = [0, 0]
1453 }
1454 } else if ((this.dir & b.allowedDir) == 0) {
1455 if (this.dir != 0) this.lastActiveDir = this.dir;
1456 this.nextDir = this.dir = 0;
1457 this.c(0)
1458 }
1459 };
1460 E.prototype.o = function () {
1461 var b = this.pos[0] / 8,
1462 c = this.pos[1] / 8,
1463 d = [Math.round(b) * 8, Math.round(c) * 8];
1464 if (d[0] != this.tilePos[0] || d[1] != this.tilePos[1]) this.p(d);
1465 else {
1466 b = [Math.floor(b) * 8, Math.floor(c) * 8];
1467 this.pos[1] == b[1] && this.pos[0] == b[0] && this.u()
1468 }!this.ghost && this.nextDir && g.playfield[d[0]][d[1]].intersection && this.nextDir & g.playfield[d[0]][d[1]].allowedDir && this.t()
1469 };
1470 E.prototype.B = function () {
1471 if (this.id == g.playerCount && g.dotsRemaining < g.levels.elroyDotsLeftPart1 && this.mode == 2 && (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16)) {
1472 var b = g.actors[this.targetPlayerId];
1473 this.targetPos = [b.tilePos[0], b.tilePos[1]]
1474 } else if (this.ghost && this.mode == 1) {
1475 b = g.actors[this.targetPlayerId];
1476 switch (this.id) {
1477 case g.playerCount:
1478 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1479 break;
1480 case g.playerCount + 1:
1481 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1482 var c = l[b.dir];
1483 this.targetPos[c.axis] += 32 * c.increment;
1484 if (b.dir == 1) this.targetPos[1] -= 32;
1485 break;
1486 case g.playerCount + 2:
1487 var d = g.actors[g.playerCount],
1488 f = [b.tilePos[0], b.tilePos[1]];
1489 c = l[b.dir];
1490 f[c.axis] += 16 * c.increment;
1491 if (b.dir == 1) f[1] -= 16;
1492 this.targetPos[0] = f[0] * 2 - d.tilePos[0];
1493 this.targetPos[1] = f[1] * 2 - d.tilePos[1];
1494 break;
1495 case g.playerCount + 3:
1496 c = g.getDistance(b.tilePos, this.tilePos);
1497 this.targetPos = c > 64 ? [b.tilePos[0], b.tilePos[1]] : this.scatterPos;
1498 break
1499 }
1500 }
1501 };
1502 E.prototype.v = function () {
1503 this.routineMoveId++;
1504 if (this.routineMoveId == A[this.routineToFollow].length) if (this.mode == 16 && this.freeToLeavePen && !g.ghostExitingPenNow) {
1505 this.eatenInThisFrightMode ? this.a(128) : this.a(32);
1506 return
1507 } else if (this.mode == 32 || this.mode == 128) {
1508 this.pos = [s[0], s[1] + 4];
1509 this.dir = this.modeChangedWhileInPen ? 8 : 4;
1510 var b = g.mainGhostMode;
1511 if (this.mode == 128 && b == 4) b = g.lastMainGhostMode;
1512 this.a(b);
1513 return
1514 } else if (this.mode == 64) {
1515 if (this.id == g.playerCount || this.freeToLeavePen) this.a(128);
1516 else {
1517 this.eatenInThisFrightMode =
1518 a;
1519 this.a(16)
1520 }
1521 return
1522 } else this.routineMoveId = 0;
1523 b = A[this.routineToFollow][this.routineMoveId];
1524 this.pos[0] = b.y * 8;
1525 this.pos[1] = b.x * 8;
1526 this.dir = b.dir;
1527 this.physicalSpeed = 0;
1528 this.speedIntervals = g.getSpeedIntervals(b.speed);
1529 this.proceedToNextRoutineMove = e;
1530 this.b()
1531 };
1532 E.prototype.m = function () {
1533 var b = A[this.routineToFollow][this.routineMoveId];
1534 if (b) if (this.speedIntervals[g.intervalTime]) {
1535 var c = l[this.dir];
1536 this.pos[c.axis] += c.increment;
1537 switch (this.dir) {
1538 case 1:
1539 case 4:
1540 if (this.pos[c.axis] < b.dest * 8) {
1541 this.pos[c.axis] = b.dest * 8;
1542 this.proceedToNextRoutineMove = a
1543 }
1544 break;
1545 case 2:
1546 case 8:
1547 if (this.pos[c.axis] > b.dest * 8) {
1548 this.pos[c.axis] = b.dest * 8;
1549 this.proceedToNextRoutineMove = a
1550 }
1551 break
1552 }
1553 this.b()
1554 }
1555 };
1556 E.prototype.j = function () {
1557 if (this.routineMoveId == -1 || this.proceedToNextRoutineMove) this.v();
1558 this.m()
1559 };
1560 E.prototype.d = function () {
1561 switch (this.currentSpeed) {
1562 case 0:
1563 var b = this.id == g.playerCount && (this.mode == 2 || this.mode == 1) ? g.cruiseElroySpeed : this.fullSpeed;
1564 break;
1565 case 1:
1566 b = this.dotEatingSpeed;
1567 break;
1568 case 2:
1569 b = this.tunnelSpeed;
1570 break
1571 }
1572 if (this.physicalSpeed != b) {
1573 this.physicalSpeed = b;
1574 this.speedIntervals = g.getSpeedIntervals(this.physicalSpeed)
1575 }
1576 };
1577 E.prototype.c = function (b) {
1578 this.currentSpeed = b;
1579 this.d()
1580 };
1581 E.prototype.e = function () {
1582 if (this.dir) if (this.speedIntervals[g.intervalTime]) {
1583 var b = l[this.dir];
1584 this.pos[b.axis] += b.increment;
1585 this.o();
1586 this.b()
1587 }
1588 };
1589 E.prototype.move = function () {
1590 if (g.gameplayMode == 0 || this.ghost && g.gameplayMode == 1 && (this.mode == 8 || this.mode == 64)) {
1591 if (this.requestedDir != 0) {
1592 this.z(this.requestedDir);
1593 this.requestedDir = 0
1594 }
1595 if (this.followingRoutine) {
1596 this.j();
1597 this.mode == 64 && this.j()
1598 } else {
1599 this.e();
1600 this.mode == 8 && this.e()
1601 }
1602 }
1603 };
1604 E.prototype.k = function () {
1605 var b = g.getPlayfieldX(this.pos[1] + this.posDelta[1]),
1606 c = g.getPlayfieldY(this.pos[0] + this.posDelta[0]);
1607 if (this.elPos[0] != c || this.elPos[1] != b) {
1608 this.elPos[0] = c;
1609 this.elPos[1] = b;
1610 this.el.style.left = b + "px";
1611 this.el.style.top = c + "px"
1612 }
1613 };
1614 E.prototype.s = function () {
1615 var b = 0,
1616 c = 0,
1617 d = this.dir;
1618 if (d == 0) d = this.lastActiveDir;
1619 if (g.gameplayMode == 1 && this.id == g.playerEatingGhostId) {
1620 b = 3;
1621 c = 0
1622 } else if ((g.gameplayMode == 9 || g.gameplayMode == 10) && this.id == 0) {
1623 b = 2;
1624 c = 0
1625 } else if (g.gameplayMode == 4 || g.gameplayMode == 5 || g.gameplayMode == 7) {
1626 b = this.id == 0 ? 2 : 4;
1627 c = 0
1628 } else if (g.gameplayMode == 3) if (this.id == g.playerDyingId) {
1629 d = 20 - Math.floor(g.gameplayModeTime / g.timing[4] * 21);
1630 if (this.id == 0) {
1631 b = d - 1;
1632 switch (b) {
1633 case -1:
1634 b = 0;
1635 break;
1636 case 11:
1637 b = 10;
1638 break;
1639 case 12:
1640 case 13:
1641 case 14:
1642 case 15:
1643 case 16:
1644 case 17:
1645 case 18:
1646 case 19:
1647 case 20:
1648 b =
1649 11;
1650 break
1651 }
1652 c = 12
1653 } else switch (d) {
1654 case 0:
1655 case 1:
1656 case 2:
1657 case 6:
1658 case 10:
1659 b = 4;
1660 c = 3;
1661 break;
1662 case 3:
1663 case 7:
1664 case 11:
1665 b = 4;
1666 c = 0;
1667 break;
1668 case 4:
1669 case 8:
1670 case 12:
1671 case 13:
1672 case 14:
1673 case 15:
1674 case 16:
1675 case 17:
1676 case 18:
1677 case 19:
1678 case 20:
1679 b = 4;
1680 c = 2;
1681 break;
1682 case 5:
1683 case 9:
1684 b = 4;
1685 c = 1;
1686 break
1687 }
1688 } else {
1689 b = 3;
1690 c = 0
1691 } else if (this.el.id == "pcm-bpcm") {
1692 b = 14;
1693 c = 0;
1694 d = Math.floor(g.globalTime * 0.2) % 4;
1695 if (d == 3) d = 1;
1696 c += 2 * d
1697 } else {
1698 switch (d) {
1699 case 4:
1700 c = 0;
1701 break;
1702 case 8:
1703 c = 1;
1704 break;
1705 case 1:
1706 c = 2;
1707 break;
1708 case 2:
1709 c = 3;
1710 break
1711 }
1712 if (g.gameplayMode != 2) b = Math.floor(g.globalTime * 0.3) % 4;
1713 if (b == 3 && this.dir == 0) b = 0;
1714 if (b == 2 && this.id == 0) b = 0;
1715 if (b == 3) {
1716 b = 2;
1717 if (this.id == 0) c = 0
1718 }
1719 if (this.id == 1) b += 4
1720 }
1721 return [c, b]
1722 };
1723 E.prototype.r = function () {
1724 var b = 0,
1725 c = 0;
1726 if (g.gameplayMode == 10 || g.gameplayMode == 4 || g.gameplayMode == 3) {
1727 b = 3;
1728 c = 0
1729 } else if (g.gameplayMode == 1 && this.id == g.ghostBeingEatenId) {
1730 switch (g.modeScoreMultiplier) {
1731 case 2:
1732 b = 0;
1733 break;
1734 case 4:
1735 b = 1;
1736 break;
1737 case 8:
1738 b = 2;
1739 break;
1740 case 16:
1741 b = 3;
1742 break
1743 }
1744 c = 11;
1745 this.el.className = "pcm-ac pcm-n"
1746 } else if (this.mode == 4 || (this.mode == 16 || this.mode == 32) && g.mainGhostMode == 4 && !this.eatenInThisFrightMode) {
1747 b = 0;
1748 c = 8;
1749 if (g.frightModeTime < g.levels.frightTotalTime - g.levels.frightTime && Math.floor(g.frightModeTime / g.timing[1]) % 2 == 0) b += 2;
1750 b += Math.floor(g.globalTime / 16) % 2
1751 } else if (this.mode == 8 || this.mode == 64) {
1752 c = this.nextDir;
1753 if (!c) c = this.dir;
1754 switch (c) {
1755 case 4:
1756 b = 2;
1757 break;
1758 case 8:
1759 b = 3;
1760 break;
1761 case 1:
1762 b = 0;
1763 break;
1764 case 2:
1765 b = 1;
1766 break
1767 }
1768 c = 10
1769 } else if (this.el.id == "pcm-ghin") {
1770 b = 6;
1771 c = 8;
1772 b += Math.floor(g.globalTime / 16) % 2
1773 } else if (this.el.id == "pcm-gbug") {
1774 b = 6;
1775 c = 9;
1776 c += Math.floor(g.globalTime / 16) % 2
1777 } else if (this.el.id == "pcm-ghfa") {
1778 b = g.cutsceneSequenceId == 3 ? 6 : 7;
1779 c = 11
1780 } else if (this.el.id == "pcm-stck") {
1781 b = g.cutsceneSequenceId == 1 ? g.cutsceneTime > 60 ? 1 : g.cutsceneTime > 45 ? 2 : 3 : g.cutsceneSequenceId == 2 ? 3 : g.cutsceneSequenceId == 3 || g.cutsceneSequenceId == 4 ? 4 : 0;
1782 c = 13
1783 } else {
1784 c = this.nextDir;
1785 if (!c || g.playfield[this.tilePos[0]][this.tilePos[1]].type == 1) c = this.dir;
1786 switch (c) {
1787 case 4:
1788 b = 4;
1789 break;
1790 case 8:
1791 b = 6;
1792 break;
1793 case 1:
1794 b = 0;
1795 break;
1796 case 2:
1797 b = 2;
1798 break
1799 }
1800 c = 4 + this.id - g.playerCount;
1801 if (this.speed > 0 || g.gameplayMode != 13) b += Math.floor(g.globalTime / 16) % 2
1802 }
1803 return [c, b]
1804 };
1805 E.prototype.b = function () {
1806 this.k();
1807 var b = [0, 0];
1808 b = g.gameplayMode == 8 || g.gameplayMode == 14 ? [0, 3] : this.ghost ? this.r() : this.s();
1809 if (this.elBackgroundPos[0] != b[0] || this.elBackgroundPos[1] != b[1]) {
1810 this.elBackgroundPos[0] = b[0];
1811 this.elBackgroundPos[1] = b[1];
1812 b[0] *= 16;
1813 b[1] *= 16;
1814 g.changeElementBkPos(this.el, b[1], b[0], a)
1815 }
1816 };
1817 g.rand = function () {
1818 var b = 4294967296,
1819 c = 134775813;
1820 c = c * g.randSeed + 1;
1821 return (g.randSeed = c % b) / b
1822 };
1823 g.seed = function (b) {
1824 g.randSeed = b
1825 };
1826 g.getDistance = function (b, c) {
1827 return Math.sqrt((c[1] - b[1]) * (c[1] - b[1]) + (c[0] - b[0]) * (c[0] - b[0]))
1828 };
1829 g.getPlayfieldX = function (b) {
1830 return b + -32
1831 };
1832 g.getPlayfieldY = function (b) {
1833 return b + 0
1834 };
1835 g.getCorrectedSpritePos = function (b) {
1836 return b / 8 * 10 + 2
1837 };
1838 g.getDotElementId = function (b, c) {
1839 return "pcm-d" + b + "-" + c
1840 };
1841 g.showElementById = function (b, c) {
1842 var d = document.getElementById(b);
1843 if (d) d.style.visibility = c ? "visible" : "hidden"
1844 };
1845 g.getAbsoluteElPos = function (b) {
1846 var c = [0, 0];
1847 do {
1848 c[0] += b.offsetTop;
1849 c[1] += b.offsetLeft
1850 } while (b = b.offsetParent);
1851 return c
1852 };
1853 g.prepareElement = function (b, c, d) {
1854 c = g.getCorrectedSpritePos(parseInt(c, 10));
1855 d = g.getCorrectedSpritePos(parseInt(d, 10));
1856 if (g.useCss) {
1857 b.style.backgroundImage = "url(src/pacman10-hp-sprite-2.png)";
1858 b.style.backgroundPosition = -c + "px " + -d + "px";
1859 b.style.backgroundRepeat = "no-repeat"
1860 } else {
1861 b.style.overflow = "hidden";
1862 c = "display: block; position: relative; left: " + -c + "px; top: " + -d + "px";
1863 b.innerHTML = '<img style="' + c + '" src="src/pacman10-hp-sprite-2.png">'
1864 }
1865 };
1866 g.changeElementBkPos = function (b, c, d, f) {
1867 if (f) {
1868 c = g.getCorrectedSpritePos(c);
1869 d = g.getCorrectedSpritePos(d)
1870 }
1871 if (g.useCss) b.style.backgroundPosition = -c + "px " + -d + "px";
1872 else if (b.childNodes[0]) {
1873 b.childNodes[0].style.left = -c + "px";
1874 b.childNodes[0].style.top = -d + "px"
1875 }
1876 };
1877 g.determinePlayfieldDimensions = function () {
1878 g.playfieldWidth = 0;
1879 g.playfieldHeight = 0;
1880 for (var b in n) {
1881 var c = n[b];
1882 if (c.w) {
1883 c = c.x + c.w - 1;
1884 if (c > g.playfieldWidth) g.playfieldWidth = c
1885 } else {
1886 c = c.y + c.h - 1;
1887 if (c > g.playfieldHeight) g.playfieldHeight = c
1888 }
1889 }
1890 };
1891 g.preparePlayfield = function () {
1892 g.playfield = [];
1893 for (var b = 0; b <= g.playfieldHeight + 1; b++) {
1894 g.playfield[b * 8] = [];
1895 for (var c = -2; c <= g.playfieldWidth + 1; c++) g.playfield[b * 8][c * 8] = {
1896 path: 0,
1897 dot: 0,
1898 intersection: 0
1899 }
1900 }
1901 };
1902 g.preparePaths = function () {
1903 for (var b in n) {
1904 var c = n[b],
1905 d = c.type;
1906 if (c.w) {
1907 for (var f = c.y * 8, h = c.x * 8; h <= (c.x + c.w - 1) * 8; h += 8) {
1908 g.playfield[f][h].path = a;
1909 if (g.playfield[f][h].dot == 0) {
1910 g.playfield[f][h].dot = 1;
1911 g.dotsRemaining++
1912 }
1913 g.playfield[f][h].type = !d || h != c.x * 8 && h != (c.x + c.w - 1) * 8 ? d : 0
1914 }
1915 g.playfield[f][c.x * 8].intersection = a;
1916 g.playfield[f][(c.x + c.w - 1) * 8].intersection = a
1917 } else {
1918 h = c.x * 8;
1919 for (f = c.y * 8; f <= (c.y + c.h - 1) * 8; f += 8) {
1920 if (g.playfield[f][h].path) g.playfield[f][h].intersection = a;
1921 g.playfield[f][h].path = a;
1922 if (g.playfield[f][h].dot == 0) {
1923 g.playfield[f][h].dot = 1;
1924 g.dotsRemaining++
1925 }
1926 g.playfield[f][h].type = !d || f != c.y * 8 && f != (c.y + c.h - 1) * 8 ? d : 0
1927 }
1928 g.playfield[c.y * 8][h].intersection = a;
1929 g.playfield[(c.y + c.h - 1) * 8][h].intersection = a
1930 }
1931 }
1932 for (b in o) if (o[b].w) for (h = o[b].x * 8; h <= (o[b].x + o[b].w - 1) * 8; h += 8) {
1933 g.playfield[o[b].y * 8][h].dot = 0;
1934 g.dotsRemaining--
1935 } else for (f = o[b].y * 8; f <= (o[b].y + o[b].h - 1) * 8; f += 8) {
1936 g.playfield[f][o[b].x * 8].dot = 0;
1937 g.dotsRemaining--
1938 }
1939 };
1940 g.prepareAllowedDirections = function () {
1941 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) {
1942 g.playfield[b][c].allowedDir = 0;
1943 if (g.playfield[b - 8][c].path) g.playfield[b][c].allowedDir += 1;
1944 if (g.playfield[b + 8][c].path) g.playfield[b][c].allowedDir += 2;
1945 if (g.playfield[b][c - 8].path) g.playfield[b][c].allowedDir += 4;
1946 if (g.playfield[b][c + 8].path) g.playfield[b][c].allowedDir += 8
1947 }
1948 };
1949 g.createDotElements = function () {
1950 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) if (g.playfield[b][c].dot) {
1951 var d = document.createElement("div");
1952 d.className = "pcm-d";
1953 d.id = g.getDotElementId(b, c);
1954 d.style.left = c + -32 + "px";
1955 d.style.top = b + 0 + "px";
1956 g.playfieldEl.appendChild(d)
1957 }
1958 };
1959 g.createEnergizerElements = function () {
1960 for (var b in p) {
1961 var c = p[b],
1962 d = g.getDotElementId(c.y * 8, c.x * 8);
1963 document.getElementById(d).className = "pcm-e";
1964 g.prepareElement(document.getElementById(d), 0, 144);
1965 g.playfield[c.y * 8][c.x * 8].dot = 2
1966 }
1967 };
1968 g.createFruitElement = function () {
1969 g.fruitEl = document.createElement("div");
1970 g.fruitEl.id = "pcm-f";
1971 g.fruitEl.style.left = g.getPlayfieldX(v[1]) + "px";
1972 g.fruitEl.style.top = g.getPlayfieldY(v[0]) + "px";
1973 g.prepareElement(g.fruitEl, -32, -16);
1974 g.playfieldEl.appendChild(g.fruitEl)
1975 };
1976 g.createPlayfieldElements = function () {
1977 g.doorEl = document.createElement("div");
1978 g.doorEl.id = "pcm-do";
1979 g.doorEl.style.display = "none";
1980 g.playfieldEl.appendChild(g.doorEl);
1981 g.createDotElements();
1982 g.createEnergizerElements();
1983 g.createFruitElement()
1984 };
1985 g.createActors = function () {
1986 g.actors = [];
1987 for (var b = 0; b < g.playerCount + 4; b++) {
1988 g.actors[b] = new E(b);
1989 if (b < g.playerCount) {
1990 g.actors[b].ghost = e;
1991 g.actors[b].mode = 1
1992 } else g.actors[b].ghost = a
1993 }
1994 };
1995 g.restartActors = function () {
1996 for (var b in g.actors) g.actors[b].A()
1997 };
1998 g.createActorElements = function () {
1999 for (var b in g.actors) g.actors[b].createElement()
2000 };
2001 g.createPlayfield = function () {
2002 g.playfieldEl = document.createElement("div");
2003 g.playfieldEl.id = "pcm-p";
2004 g.canvasEl.appendChild(g.playfieldEl)
2005 };
2006 g.resetPlayfield = function () {
2007 g.dotsRemaining = 0;
2008 g.dotsEaten = 0;
2009 g.playfieldEl.innerHTML = "";
2010 g.prepareElement(g.playfieldEl, 256, 0);
2011 g.determinePlayfieldDimensions();
2012 g.preparePlayfield();
2013 g.preparePaths();
2014 g.prepareAllowedDirections();
2015 g.createPlayfieldElements();
2016 g.createActorElements()
2017 };
2018 g.keyPressed = function (b) {
2019 var c = e;
2020 switch (b) {
2021 case 37:
2022 g.actors[0].requestedDir = 4;
2023 c = a;
2024 break;
2025 case 38:
2026 g.actors[0].requestedDir = 1;
2027 c = a;
2028 break;
2029 case 39:
2030 g.actors[0].requestedDir = 8;
2031 c = a;
2032 break;
2033 case 40:
2034 g.actors[0].requestedDir = 2;
2035 c = a;
2036 break;
2037 case 65:
2038 if (g.playerCount == 2) {
2039 g.actors[1].requestedDir = 4;
2040 c = a
2041 }
2042 break;
2043 case 83:
2044 if (g.playerCount == 2) {
2045 g.actors[1].requestedDir = 2;
2046 c = a
2047 }
2048 break;
2049 case 68:
2050 if (g.playerCount == 2) {
2051 g.actors[1].requestedDir = 8;
2052 c = a
2053 }
2054 break;
2055 case 87:
2056 if (g.playerCount == 2) {
2057 g.actors[1].requestedDir = 1;
2058 c = a
2059 }
2060 break
2061 }
2062 return c
2063 };
2064 g.handleKeyDown = function (b) {
2065 if (!b) b = window.event;
2066 if (g.keyPressed(b.keyCode)) if (b.preventDefault) b.preventDefault();
2067 else b.returnValue = e
2068 };
2069 g.canvasClicked = function (b, c) {
2070 var d = g.getAbsoluteElPos(g.canvasEl);
2071 b -= d[1] - -32;
2072 c -= d[0] - 0;
2073 d = g.actors[0];
2074 var f = g.getPlayfieldX(d.pos[1] + d.posDelta[1]) + 16,
2075 h = g.getPlayfieldY(d.pos[0] + d.posDelta[0]) + 32,
2076 j = Math.abs(b - f),
2077 k = Math.abs(c - h);
2078 if (j > 8 && k < j) d.requestedDir = b > f ? 8 : 4;
2079 else if (k > 8 && j < k) d.requestedDir = c > h ? 2 : 1
2080 };
2081 g.handleClick = function (b) {
2082 if (!b) b = window.event;
2083 g.canvasClicked(b.clientX, b.clientY)
2084 };
2085 g.registerTouch = function () {
2086 document.body.addEventListener("touchstart", g.handleTouchStart, a);
2087 g.canvasEl.addEventListener("touchstart", g.handleTouchStart, a);
2088 document.f && document.f.q && document.f.q.addEventListener("touchstart", g.handleTouchStart, a)
2089 };
2090 g.handleTouchStart = function (b) {
2091 g.touchDX = 0;
2092 g.touchDY = 0;
2093 if (b.touches.length == 1) {
2094 g.touchStartX = b.touches[0].pageX;
2095 g.touchStartY = b.touches[0].pageY;
2096 document.body.addEventListener("touchmove", g.handleTouchMove, a);
2097 document.body.addEventListener("touchend", g.handleTouchEnd, a)
2098 }
2099 b.preventDefault();
2100 b.stopPropagation()
2101 };
2102 g.handleTouchMove = function (b) {
2103 if (b.touches.length > 1) g.cancelTouch();
2104 else {
2105 g.touchDX = b.touches[0].pageX - g.touchStartX;
2106 g.touchDY = b.touches[0].pageY - g.touchStartY
2107 }
2108 b.preventDefault();
2109 b.stopPropagation()
2110 };
2111 g.handleTouchEnd = function (b) {
2112 if (g.touchDX == 0 && g.touchDY == 0) g.canvasClicked(g.touchStartX, g.touchStartY);
2113 else {
2114 var c = Math.abs(g.touchDX),
2115 d = Math.abs(g.touchDY);
2116 if (c < 8 && d < 8) g.canvasClicked(g.touchStartX, g.touchStartY);
2117 else if (c > 15 && d < c * 2 / 3) g.actors[0].requestedDir = g.touchDX > 0 ? 8 : 4;
2118 else if (d > 15 && c < d * 2 / 3) g.actors[0].requestedDir = g.touchDY > 0 ? 2 : 1
2119 }
2120 b.preventDefault();
2121 b.stopPropagation();
2122 g.cancelTouch()
2123 };
2124 g.cancelTouch = function () {
2125 document.body.removeEventListener("touchmove", g.handleTouchMove, a);
2126 document.body.removeEventListener("touchend", g.handleTouchEnd, a);
2127 g.touchStartX = null;
2128 g.touchStartY = null
2129 };
2130 g.addEventListeners = function () {
2131 if (window.addEventListener) {
2132 window.addEventListener("keydown", g.handleKeyDown, e);
2133 g.canvasEl.addEventListener("click", g.handleClick, e);
2134 g.registerTouch()
2135 } else {
2136 document.body.attachEvent("onkeydown", g.handleKeyDown);
2137 g.canvasEl.attachEvent("onclick", g.handleClick)
2138 }
2139 };
2140 g.startGameplay = function () {
2141 g.score = [0, 0];
2142 g.extraLifeAwarded = [e, e];
2143 g.lives = 3;
2144 g.level = 0;
2145 g.paused = e;
2146 g.globalTime = 0;
2147 g.newLevel(a)
2148 };
2149 g.restartGameplay = function (b) {
2150 g.seed(0);
2151 g.frightModeTime = 0;
2152 g.intervalTime = 0;
2153 g.gameplayModeTime = 0;
2154 g.fruitTime = 0;
2155 g.ghostModeSwitchPos = 0;
2156 g.ghostModeTime = g.levels.ghostModeSwitchTimes[0] * D;
2157 g.ghostExitingPenNow = e;
2158 g.ghostEyesCount = 0;
2159 g.tilesChanged = e;
2160 g.updateCruiseElroySpeed();
2161 g.hideFruit();
2162 g.resetForcePenLeaveTime();
2163 g.restartActors();
2164 g.updateActorPositions();
2165 g.switchMainGhostMode(2, a);
2166 for (var c = g.playerCount + 1; c < g.playerCount + 4; c++) g.actors[c].a(16);
2167 g.dotEatingChannel = [0, 0];
2168 g.dotEatingSoundPart = [1, 1];
2169 g.clearDotEatingNow();
2170 b ? g.changeGameplayMode(4) : g.changeGameplayMode(6)
2171 };
2172 g.initiateDoubleMode = function () {
2173 if (g.playerCount != 2) {
2174 g.stopAllAudio();
2175 g.changeGameplayMode(12)
2176 }
2177 };
2178 g.newGame = function () {
2179 g.playerCount = 1;
2180 g.createChrome();
2181 g.createPlayfield();
2182 g.createActors();
2183 g.startGameplay()
2184 };
2185 g.switchToDoubleMode = function () {
2186 g.playerCount = 2;
2187 g.createChrome();
2188 g.createPlayfield();
2189 g.createActors();
2190 g.startGameplay()
2191 };
2192 g.insertCoin = function () {
2193 g.gameplayMode == 8 || g.gameplayMode == 14 ? g.newGame() : g.initiateDoubleMode()
2194 };
2195 g.createKillScreenElement = function (b, c, d, f, h) {
2196 var j = document.createElement("div");
2197 j.style.left = b + "px";
2198 j.style.top = c + "px";
2199 j.style.width = d + "px";
2200 j.style.height = f + "px";
2201 j.style.zIndex = 119;
2202 if (h) {
2203 j.style.background = "url(src/pacman10-hp-sprite-2.png) -" + g.killScreenTileX + "px -" + g.killScreenTileY + "px no-repeat";
2204 g.killScreenTileY += 8
2205 } else j.style.background = "black";
2206 g.playfieldEl.appendChild(j)
2207 };
2208 g.killScreen = function () {
2209 g.seed(0);
2210 g.canvasEl.style.visibility = "";
2211 g.createKillScreenElement(272, 0, 200, 80, e);
2212 g.createKillScreenElement(280, 80, 192, 56, e);
2213 g.killScreenTileX = 80;
2214 g.killScreenTileY = 0;
2215 for (var b = 280; b <= 472; b += 8) for (var c = 0; c <= 136; c += 8) {
2216 if (g.rand() < 0.03) {
2217 g.killScreenTileX = Math.floor(g.rand() * 25) * 10;
2218 g.killScreenTileY = Math.floor(g.rand() * 2) * 10
2219 }
2220 g.createKillScreenElement(b, c, 8, 8, a)
2221 }
2222 g.changeGameplayMode(14)
2223 };
2224 g.newLevel = function (b) {
2225 g.level++;
2226 g.levels = g.level >= z.length ? z[z.length - 1] : z[g.level];
2227 // start issue 14: Ghosts stay blue permanently on restart
2228 if ((g.levels.frightTime > 0) && (g.levels.frightTime <= 6))
2229 g.levels.frightTime = Math.round(g.levels.frightTime * D);
2230 // end issue 14
2231 g.levels.frightTotalTime = g.levels.frightTime + g.timing[1] * (g.levels.frightBlinkCount * 2 - 1);
2232 for (var c in g.actors) g.actors[c].dotCount = 0;
2233 g.alternatePenLeavingScheme = e;
2234 g.lostLifeOnThisLevel = e;
2235 g.updateChrome();
2236 g.resetPlayfield();
2237 g.restartGameplay(b);
2238 g.level == 256 && g.killScreen()
2239 };
2240 g.newLife = function () {
2241 g.lostLifeOnThisLevel = a;
2242 g.alternatePenLeavingScheme = a;
2243 g.alternateDotCount = 0;
2244 g.lives--;
2245 g.updateChromeLives();
2246 g.lives == -1 ? g.changeGameplayMode(8) : g.restartGameplay(e)
2247 };
2248 g.switchMainGhostMode = function (b, c) {
2249 if (b == 4 && g.levels.frightTime == 0) for (var d in g.actors) {
2250 var f = g.actors[d];
2251 if (f.ghost) f.reverseDirectionsNext = a
2252 } else {
2253 f = g.mainGhostMode;
2254 if (b == 4 && g.mainGhostMode != 4) g.lastMainGhostMode = g.mainGhostMode;
2255 g.mainGhostMode = b;
2256 if (b == 4 || f == 4) g.playAmbientSound();
2257 switch (b) {
2258 case 1:
2259 case 2:
2260 g.currentPlayerSpeed = g.levels.playerSpeed * 0.8;
2261 g.currentDotEatingSpeed = g.levels.dotEatingSpeed * 0.8;
2262 break;
2263 case 4:
2264 g.currentPlayerSpeed = g.levels.playerFrightSpeed * 0.8;
2265 g.currentDotEatingSpeed = g.levels.dotEatingFrightSpeed * 0.8;
2266 g.frightModeTime = g.levels.frightTotalTime;
2267 g.modeScoreMultiplier = 1;
2268 break
2269 }
2270 for (d in g.actors) {
2271 f = g.actors[d];
2272 if (f.ghost) {
2273 if (b != 64 && !c) f.modeChangedWhileInPen = a;
2274 if (b == 4) f.eatenInThisFrightMode = e;
2275 if (f.mode != 8 && f.mode != 16 && f.mode != 32 && f.mode != 128 && f.mode != 64 || c) {
2276 if (!c && f.mode != 4 && f.mode != b) f.reverseDirectionsNext = a;
2277 f.a(b)
2278 }
2279 } else {
2280 f.fullSpeed = g.currentPlayerSpeed;
2281 f.dotEatingSpeed = g.currentDotEatingSpeed;
2282 f.tunnelSpeed = g.currentPlayerSpeed;
2283 f.d()
2284 }
2285 }
2286 }
2287 };
2288 g.figureOutPenLeaving = function () {
2289 if (g.alternatePenLeavingScheme) {
2290 g.alternateDotCount++;
2291 switch (g.alternateDotCount) {
2292 case m[1]:
2293 g.actors[g.playerCount + 1].freeToLeavePen = a;
2294 break;
2295 case m[2]:
2296 g.actors[g.playerCount + 2].freeToLeavePen = a;
2297 break;
2298 case m[3]:
2299 if (g.actors[g.playerCount + 3].mode == 16) g.alternatePenLeavingScheme = e;
2300 break
2301 }
2302 } else if (g.actors[g.playerCount + 1].mode == 16 || g.actors[g.playerCount + 1].mode == 8) {
2303 g.actors[g.playerCount + 1].dotCount++;
2304 if (g.actors[g.playerCount + 1].dotCount >= g.levels.penLeavingLimits[1]) g.actors[g.playerCount + 1].freeToLeavePen = a
2305 } else if (g.actors[g.playerCount + 2].mode == 16 || g.actors[g.playerCount + 2].mode == 8) {
2306 g.actors[g.playerCount + 2].dotCount++;
2307 if (g.actors[g.playerCount + 2].dotCount >= g.levels.penLeavingLimits[2]) g.actors[g.playerCount + 2].freeToLeavePen = a
2308 } else if (g.actors[g.playerCount + 3].mode == 16 || g.actors[g.playerCount + 3].mode == 8) {
2309 g.actors[g.playerCount + 3].dotCount++;
2310 if (g.actors[g.playerCount + 3].dotCount >= g.levels.penLeavingLimits[3]) g.actors[g.playerCount + 3].freeToLeavePen = a
2311 }
2312 };
2313 g.resetForcePenLeaveTime = function () {
2314 g.forcePenLeaveTime = g.levels.penForceTime * D
2315 };
2316 g.dotEaten = function (b, c) {
2317 g.dotsRemaining--;
2318 g.dotsEaten++;
2319 g.actors[b].c(1);
2320 g.playDotEatingSound(b);
2321 if (g.playfield[c[0]][c[1]].dot == 2) {
2322 g.switchMainGhostMode(4, e);
2323 g.addToScore(50, b)
2324 } else g.addToScore(10, b);
2325 var d = document.getElementById(g.getDotElementId(c[0], c[1]));
2326 d.style.display = "none";
2327 g.playfield[c[0]][c[1]].dot = 0;
2328 g.updateCruiseElroySpeed();
2329 g.resetForcePenLeaveTime();
2330 g.figureOutPenLeaving();
2331 if (g.dotsEaten == 70 || g.dotsEaten == 170) g.showFruit();
2332 g.dotsRemaining == 0 && g.finishLevel();
2333 g.playAmbientSound()
2334 };
2335 g.getFruitSprite = function (b) {
2336 var c = b <= 4 ? 128 : 160;
2337 b = 128 + 16 * ((b - 1) % 4);
2338 return [c, b]
2339 };
2340 g.getFruitScoreSprite = function (b) {
2341 var c = 128;
2342 b = 16 * (b - 1);
2343 return [c, b]
2344 };
2345 g.hideFruit = function () {
2346 g.fruitShown = e;
2347 g.changeElementBkPos(g.fruitEl, 32, 16, a)
2348 };
2349 g.showFruit = function () {
2350 g.fruitShown = a;
2351 var b = g.getFruitSprite(g.levels.fruit);
2352 g.changeElementBkPos(g.fruitEl, b[0], b[1], a);
2353 g.fruitTime = g.timing[15] + (g.timing[16] - g.timing[15]) * g.rand()
2354 };
2355 g.eatFruit = function (b) {
2356 if (g.fruitShown) {
2357 g.playSound("fruit", 0);
2358 g.fruitShown = e;
2359 var c = g.getFruitScoreSprite(g.levels.fruit);
2360 g.changeElementBkPos(g.fruitEl, c[0], c[1], a);
2361 g.fruitTime = g.timing[14];
2362 g.addToScore(g.levels.fruitScore, b)
2363 }
2364 };
2365 g.updateActorTargetPositions = function () {
2366 for (var b = g.playerCount; b < g.playerCount + 4; b++) g.actors[b].B()
2367 };
2368 g.moveActors = function () {
2369 for (var b in g.actors) g.actors[b].move()
2370 };
2371 g.ghostDies = function (b, c) {
2372 g.playSound("eating-ghost", 0);
2373 g.addToScore(200 * g.modeScoreMultiplier, c);
2374 g.modeScoreMultiplier *= 2;
2375 g.ghostBeingEatenId = b;
2376 g.playerEatingGhostId = c;
2377 g.changeGameplayMode(1)
2378 };
2379 g.playerDies = function (b) {
2380 g.playerDyingId = b;
2381 g.changeGameplayMode(2)
2382 };
2383 g.detectCollisions = function () {
2384 g.tilesChanged = e;
2385 for (var b = g.playerCount; b < g.playerCount + 4; b++) for (var c = 0; c < g.playerCount; c++) if (g.actors[b].tilePos[0] == g.actors[c].tilePos[0] && g.actors[b].tilePos[1] == g.actors[c].tilePos[1]) if (g.actors[b].mode == 4) {
2386 g.ghostDies(b, c);
2387 return
2388 } else g.actors[b].mode != 8 && g.actors[b].mode != 16 && g.actors[b].mode != 32 && g.actors[b].mode != 128 && g.actors[b].mode != 64 && g.playerDies(c)
2389 };
2390 g.updateCruiseElroySpeed = function () {
2391 var b = g.levels.ghostSpeed * 0.8;
2392 if (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16) {
2393 var c = g.levels;
2394 if (g.dotsRemaining < c.elroyDotsLeftPart2) b = c.elroySpeedPart2 * 0.8;
2395 else if (g.dotsRemaining < c.elroyDotsLeftPart1) b = c.elroySpeedPart1 * 0.8
2396 }
2397 if (b != g.cruiseElroySpeed) {
2398 g.cruiseElroySpeed = b;
2399 g.actors[g.playerCount].d()
2400 }
2401 };
2402 g.getSpeedIntervals = function (b) {
2403 if (!g.speedIntervals[b]) {
2404 var c = 0,
2405 d = 0;
2406 g.speedIntervals[b] = [];
2407 for (var f = 0; f < D; f++) {
2408 c += b;
2409 if (Math.floor(c) > d) {
2410 g.speedIntervals[b].push(a);
2411 d = Math.floor(c)
2412 } else g.speedIntervals[b].push(e)
2413 }
2414 }
2415 return g.speedIntervals[b]
2416 };
2417 g.finishLevel = function () {
2418 g.changeGameplayMode(9)
2419 };
2420 g.changeGameplayMode = function (b) {
2421 g.gameplayMode = b;
2422 if (b != 13) for (var c = 0; c < g.playerCount + 4; c++) g.actors[c].b();
2423 switch (b) {
2424 case 0:
2425 g.playAmbientSound();
2426 break;
2427 case 2:
2428 g.stopAllAudio();
2429 g.gameplayModeTime = g.timing[3];
2430 break;
2431 case 3:
2432 g.playerDyingId == 0 ? g.playSound("death", 0) : g.playSound("death-double", 0);
2433 g.gameplayModeTime = g.timing[4];
2434 break;
2435 case 6:
2436 g.canvasEl.style.visibility = "hidden";
2437 g.gameplayModeTime = g.timing[5];
2438 break;
2439 case 7:
2440 g.stopAllAudio();
2441 g.canvasEl.style.visibility = "";
2442 g.doorEl.style.display = "block";
2443 b = document.createElement("div");
2444 b.id = "pcm-re";
2445 g.prepareElement(b, 160, 0);
2446 g.playfieldEl.appendChild(b);
2447 g.gameplayModeTime = g.timing[6];
2448 break;
2449 case 4:
2450 g.doorEl.style.display = "block";
2451 b = document.createElement("div");
2452 b.id = "pcm-re";
2453 g.prepareElement(b, 160, 0);
2454 g.playfieldEl.appendChild(b);
2455 g.gameplayModeTime = g.timing[7];
2456 g.stopAllAudio();
2457 g.playerCount == 2 ? g.playSound("start-music-double", 0, a) : g.playSound("start-music", 0, a);
2458 break;
2459 case 5:
2460 g.lives--;
2461 g.updateChromeLives();
2462 g.gameplayModeTime = g.timing[8];
2463 break;
2464 case 8:
2465 case 14:
2466 b = document.getElementById("pcm-re");
2467 google.dom.remove(b);
2468 g.stopAllAudio();
2469 b = document.createElement("div");
2470 b.id = "pcm-go";
2471 g.prepareElement(b, 8, 152);
2472 g.playfieldEl.appendChild(b);
2473 g.gameplayModeTime = g.timing[9];
2474 break;
2475 case 9:
2476 g.stopAllAudio();
2477 g.gameplayModeTime = g.timing[10];
2478 break;
2479 case 10:
2480 g.doorEl.style.display = "none";
2481 g.gameplayModeTime = g.timing[11];
2482 break;
2483 case 11:
2484 g.canvasEl.style.visibility = "hidden";
2485 g.gameplayModeTime = g.timing[12];
2486 break;
2487 case 12:
2488 g.playfieldEl.style.visibility = "hidden";
2489 g.gameplayModeTime = g.timing[13];
2490 break;
2491 case 1:
2492 g.gameplayModeTime =
2493 g.timing[2];
2494 break;
2495 case 13:
2496 g.startCutscene();
2497 break
2498 }
2499 };
2500 g.showChrome = function (b) {
2501 g.showElementById("pcm-sc-1-l", b);
2502 g.showElementById("pcm-sc-2-l", b);
2503 g.showElementById("pcm-sc-1", b);
2504 g.showElementById("pcm-sc-2", b);
2505 g.showElementById("pcm-li", b);
2506 g.showElementById("pcm-so", b)
2507 };
2508 g.toggleSound = function (b) {
2509 b = window.event || b;
2510 b.cancelBubble = a;
2511 if (google.pacManSound) {
2512 g.userDisabledSound = a;
2513 g.stopAllAudio();
2514 google.pacManSound = e
2515 } else {
2516 google.pacManSound = a;
2517 g.playAmbientSound()
2518 }
2519 g.updateSoundIcon();
2520 return b.returnValue = e
2521 };
2522 g.updateSoundIcon = function () {
2523 if (g.soundEl) google.pacManSound ? g.changeElementBkPos(g.soundEl, 216, 105, e) : g.changeElementBkPos(g.soundEl, 236, 105, e)
2524 };
2525 g.startCutscene = function () {
2526 g.playfieldEl.style.visibility = "hidden";
2527 g.canvasEl.style.visibility = "";
2528 g.showChrome(e);
2529 g.cutsceneCanvasEl = document.createElement("div");
2530 g.cutsceneCanvasEl.id = "pcm-cc";
2531 g.canvasEl.appendChild(g.cutsceneCanvasEl);
2532 g.cutscene = B[g.cutsceneId];
2533 g.cutsceneSequenceId = -1;
2534 g.frightModeTime = g.levels.frightTotalTime;
2535 g.cutsceneActors = [];
2536 for (var b in g.cutscene.actors) {
2537 var c = g.cutscene.actors[b].id;
2538 if (c > 0) c += g.playerCount - 1;
2539 var d = document.createElement("div");
2540 d.className = "pcm-ac";
2541 d.id = "actor" + c;
2542 g.prepareElement(d, 0, 0);
2543 c = new E(c);
2544 c.el = d;
2545 c.elBackgroundPos = [0, 0];
2546 c.elPos = [0, 0];
2547 c.pos = [g.cutscene.actors[b].y * 8, g.cutscene.actors[b].x * 8];
2548 c.posDelta = [0, 0];
2549 c.ghost = g.cutscene.actors[b].ghost;
2550 g.cutsceneCanvasEl.appendChild(d);
2551 g.cutsceneActors.push(c)
2552 }
2553 g.cutsceneNextSequence();
2554 g.stopAllAudio();
2555 g.playAmbientSound()
2556 };
2557 g.stopCutscene = function () {
2558 g.playfieldEl.style.visibility = "";
2559 google.dom.remove(g.cutsceneCanvasEl);
2560 g.showChrome(a);
2561 g.newLevel(e)
2562 };
2563 g.cutsceneNextSequence = function () {
2564 g.cutsceneSequenceId++;
2565 if (g.cutscene.sequence.length == g.cutsceneSequenceId) g.stopCutscene();
2566 else {
2567 var b = g.cutscene.sequence[g.cutsceneSequenceId];
2568 g.cutsceneTime = b.time * D;
2569 for (var c in g.cutsceneActors) {
2570 var d = g.cutsceneActors[c];
2571 d.dir = b.moves[c].dir;
2572 d.speed = b.moves[c].speed;
2573 if (b.moves[c].elId) d.el.id = b.moves[c].elId;
2574 if (b.moves[c].mode) d.mode = b.moves[c].mode;
2575 d.b()
2576 }
2577 }
2578 };
2579 g.checkCutscene = function () {
2580 g.cutsceneTime <= 0 && g.cutsceneNextSequence()
2581 };
2582 g.advanceCutscene = function () {
2583 for (var b in g.cutsceneActors) {
2584 var c = g.cutsceneActors[b],
2585 d = l[c.dir];
2586 c.pos[d.axis] += d.increment * c.speed;
2587 c.b()
2588 }
2589 g.cutsceneTime--
2590 };
2591 g.updateActorPositions = function () {
2592 for (var b in g.actors) g.actors[b].k()
2593 };
2594 g.blinkEnergizers = function () {
2595 switch (g.gameplayMode) {
2596 case 4:
2597 case 5:
2598 case 6:
2599 case 7:
2600 case 9:
2601 case 10:
2602 case 11:
2603 case 12:
2604 g.playfieldEl.className = "";
2605 break;
2606 case 8:
2607 case 14:
2608 g.playfieldEl.className = "blk";
2609 break;
2610 default:
2611 if (g.globalTime % (g.timing[0] * 2) == 0) g.playfieldEl.className = "";
2612 else if (g.globalTime % (g.timing[0] * 2) == g.timing[0]) g.playfieldEl.className = "blk";
2613 break
2614 }
2615 };
2616 g.blinkScoreLabels = function () {
2617 if (g.gameplayMode != 13) {
2618 var b = "";
2619 if (g.globalTime % (g.timing[17] * 2) == 0) b = "visible";
2620 else if (g.globalTime % (g.timing[17] * 2) == g.timing[17]) b = "hidden";
2621 if (b) for (var c = 0; c < g.playerCount; c++) g.scoreLabelEl[c].style.visibility = b
2622 }
2623 };
2624 g.finishFrightMode = function () {
2625 g.switchMainGhostMode(g.lastMainGhostMode, e)
2626 };
2627 g.handleGameplayModeTimer = function () {
2628 if (g.gameplayModeTime) {
2629 g.gameplayModeTime--;
2630 switch (g.gameplayMode) {
2631 case 2:
2632 case 3:
2633 for (var b = 0; b < g.playerCount + 4; b++) g.actors[b].b();
2634 break;
2635 case 10:
2636 Math.floor(g.gameplayModeTime / (g.timing[11] / 8)) % 2 == 0 ? g.changeElementBkPos(g.playfieldEl, 322, 2, e) : g.changeElementBkPos(g.playfieldEl, 322, 138, e)
2637 }
2638 if (g.gameplayModeTime <= 0) {
2639 g.gameplayModeTime = 0;
2640 switch (g.gameplayMode) {
2641 case 1:
2642 g.changeGameplayMode(0);
2643 g.ghostEyesCount++;
2644 g.playAmbientSound();
2645 g.actors[g.ghostBeingEatenId].el.className = "pcm-ac";
2646 g.actors[g.ghostBeingEatenId].a(8);
2647 var c = e;
2648 for (b = g.playerCount; b < g.playerCount + 4; b++) if (g.actors[b].mode == 4 || (g.actors[b].mode == 16 || g.actors[b].mode == 128) && !g.actors[b].eatenInThisFrightMode) {
2649 c = a;
2650 break
2651 }
2652 c || g.finishFrightMode();
2653 break;
2654 case 2:
2655 g.changeGameplayMode(3);
2656 break;
2657 case 3:
2658 g.newLife();
2659 break;
2660 case 4:
2661 g.changeGameplayMode(5);
2662 break;
2663 case 6:
2664 g.changeGameplayMode(7);
2665 break;
2666 case 7:
2667 case 5:
2668 b = document.getElementById("pcm-re");
2669 google.dom.remove(b);
2670 g.changeGameplayMode(0);
2671 break;
2672 case 8:
2673 b = document.getElementById("pcm-go");
2674 google.dom.remove(b);
2675 google.pacManQuery && google.pacManQuery();
2676 break;
2677 case 9:
2678 g.changeGameplayMode(10);
2679 break;
2680 case 10:
2681 g.changeGameplayMode(11);
2682 break;
2683 case 11:
2684 if (g.levels.cutsceneId) {
2685 g.cutsceneId = g.levels.cutsceneId;
2686 g.changeGameplayMode(13)
2687 } else {
2688 g.canvasEl.style.visibility = "";
2689 g.newLevel(e)
2690 }
2691 break;
2692 case 12:
2693 g.playfieldEl.style.visibility = "";
2694 g.canvasEl.style.visibility = "";
2695 g.switchToDoubleMode();
2696 break
2697 }
2698 }
2699 }
2700 };
2701 g.handleFruitTimer = function () {
2702 if (g.fruitTime) {
2703 g.fruitTime--;
2704 g.fruitTime <= 0 && g.hideFruit()
2705 }
2706 };
2707 g.handleGhostModeTimer = function () {
2708 if (g.frightModeTime) {
2709 g.frightModeTime--;
2710 if (g.frightModeTime <= 0) {
2711 g.frightModeTime = 0;
2712 g.finishFrightMode()
2713 }
2714 } else if (g.ghostModeTime > 0) {
2715 g.ghostModeTime--;
2716 if (g.ghostModeTime <= 0) {
2717 g.ghostModeTime = 0;
2718 g.ghostModeSwitchPos++;
2719 if (g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]) {
2720 g.ghostModeTime = g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos] * D;
2721 switch (g.mainGhostMode) {
2722 case 2:
2723 g.switchMainGhostMode(1, e);
2724 break;
2725 case 1:
2726 g.switchMainGhostMode(2, e);
2727 break
2728 }
2729 }
2730 }
2731 }
2732 };
2733 g.handleForcePenLeaveTimer = function () {
2734 if (g.forcePenLeaveTime) {
2735 g.forcePenLeaveTime--;
2736 if (g.forcePenLeaveTime <= 0) {
2737 for (var b = 1; b <= 3; b++) if (g.actors[g.playerCount + b].mode == 16) {
2738 g.actors[g.playerCount + b].freeToLeavePen = a;
2739 break
2740 }
2741 g.resetForcePenLeaveTime()
2742 }
2743 }
2744 };
2745 g.handleTimers = function () {
2746 if (g.gameplayMode == 0) {
2747 g.handleForcePenLeaveTimer();
2748 g.handleFruitTimer();
2749 g.handleGhostModeTimer()
2750 }
2751 g.handleGameplayModeTimer()
2752 };
2753 g.tick = function () {
2754 var b = (new Date).getTime();
2755 g.lastTimeDelta += b - g.lastTime - g.tickInterval;
2756 if (g.lastTimeDelta > 100) g.lastTimeDelta = 100;
2757 if (g.canDecreaseFps && g.lastTimeDelta > 50) {
2758 g.lastTimeSlownessCount++;
2759 g.lastTimeSlownessCount == 20 && g.decreaseFps()
2760 }
2761 var c = 0;
2762 if (g.lastTimeDelta > g.tickInterval) {
2763 c = Math.floor(g.lastTimeDelta / g.tickInterval);
2764 g.lastTimeDelta -= g.tickInterval * c
2765 }
2766 g.lastTime = b;
2767 if (g.gameplayMode == 13) {
2768 for (b = 0; b < g.tickMultiplier + c; b++) {
2769 g.advanceCutscene();
2770 g.intervalTime = (g.intervalTime + 1) % D;
2771 g.globalTime++
2772 }
2773 g.checkCutscene();
2774 g.blinkScoreLabels()
2775 } else for (b = 0; b < g.tickMultiplier + c; b++) {
2776 g.moveActors();
2777 if (g.gameplayMode == 0) if (g.tilesChanged) {
2778 g.detectCollisions();
2779 g.updateActorTargetPositions()
2780 }
2781 g.globalTime++;
2782 g.intervalTime = (g.intervalTime + 1) % D;
2783 g.blinkEnergizers();
2784 g.blinkScoreLabels();
2785 g.handleTimers()
2786 }
2787 };
2788 g.extraLife = function (b) {
2789 g.playSound("extra-life", 0);
2790 g.extraLifeAwarded[b] = a;
2791 g.lives++;
2792 if (g.lives > 5) g.lives = 5;
2793 g.updateChromeLives()
2794 };
2795 g.addToScore = function (b, c) {
2796 g.score[c] += b;
2797 !g.extraLifeAwarded[c] && g.score[c] > 1E4 && g.extraLife(c);
2798 g.updateChromeScore(c)
2799 };
2800 g.updateChrome = function () {
2801 g.updateChromeLevel();
2802 g.updateChromeLives();
2803 for (var b = 0; b < g.playerCount; b++) g.updateChromeScore(b)
2804 };
2805 g.updateChromeScore = function (b) {
2806 var c = g.score[b].toString();
2807 if (c.length > g.scoreDigits) c = c.substr(c.length - g.scoreDigits, g.scoreDigits);
2808 for (var d = 0; d < g.scoreDigits; d++) {
2809 var f = document.getElementById("pcm-sc-" + (b + 1) + "-" + d),
2810 h = c.substr(d, 1);
2811 h ? g.changeElementBkPos(f, 8 + 8 * parseInt(h, 10), 144, a) : g.changeElementBkPos(f, 48, 0, a)
2812 }
2813 };
2814 g.updateChromeLives = function () {
2815 g.livesEl.innerHTML = "";
2816 for (var b = 0; b < g.lives; b++) {
2817 var c = document.createElement("div");
2818 c.className = "pcm-lif";
2819 g.prepareElement(c, 64, 129);
2820 g.livesEl.appendChild(c)
2821 }
2822 };
2823 g.updateChromeLevel = function () {
2824 g.levelEl.innerHTML = "";
2825 for (var b = g.level; b >= Math.max(g.level - 4 + 1, 1); b--) {
2826 var c = b >= z.length ? z[z.length - 1].fruit : z[b].fruit,
2827 d = document.createElement("div");
2828 c = g.getFruitSprite(c);
2829 g.prepareElement(d, c[0], c[1]);
2830 g.levelEl.appendChild(d)
2831 }
2832 g.levelEl.style.marginTop = (4 - Math.min(g.level, 4)) * 16 + "px"
2833 };
2834 g.createChrome = function () {
2835 g.canvasEl.innerHTML = "";
2836 g.scoreDigits = g.playerCount == 1 ? 10 : 5;
2837 g.scoreLabelEl = [];
2838 g.scoreLabelEl[0] = document.createElement("div");
2839 g.scoreLabelEl[0].id = "pcm-sc-1-l";
2840 g.prepareElement(g.scoreLabelEl[0], 160, 56);
2841 g.canvasEl.appendChild(g.scoreLabelEl[0]);
2842 g.scoreEl = [];
2843 g.scoreEl[0] = document.createElement("div");
2844 g.scoreEl[0].id = "pcm-sc-1";
2845 for (var b = 0; b < g.scoreDigits; b++) {
2846 var c = document.createElement("div");
2847 c.id = "pcm-sc-1-" + b;
2848 c.style.top = b * 8 + "px";
2849 c.style.left = 0;
2850 c.style.position = "absolute";
2851 c.style.width = "8px";
2852 c.style.height = "8px";
2853 g.prepareElement(c, 48, 0);
2854 g.scoreEl[0].appendChild(c)
2855 }
2856 g.canvasEl.appendChild(g.scoreEl[0]);
2857 g.livesEl = document.createElement("div");
2858 g.livesEl.id = "pcm-li";
2859 g.canvasEl.appendChild(g.livesEl);
2860 g.levelEl = document.createElement("div");
2861 g.levelEl.id = "pcm-le";
2862 g.canvasEl.appendChild(g.levelEl);
2863 if (g.playerCount == 2) {
2864 g.scoreLabelEl[1] = document.createElement("div");
2865 g.scoreLabelEl[1].id = "pcm-sc-2-l";
2866 g.prepareElement(g.scoreLabelEl[1], 160, 64);
2867 g.canvasEl.appendChild(g.scoreLabelEl[1]);
2868 g.scoreEl[1] = document.createElement("div");
2869 g.scoreEl[1].id = "pcm-sc-2";
2870 for (b = 0; b < g.scoreDigits; b++) {
2871 c = document.createElement("div");
2872 c.id = "pcm-sc-2-" + b;
2873 c.style.top = b * 8 + "px";
2874 c.style.left = 0;
2875 c.style.position = "absolute";
2876 c.style.width = "8px";
2877 c.style.height = "8px";
2878 g.prepareElement(c, 48, 0);
2879 g.scoreEl[1].appendChild(c)
2880 }
2881 g.canvasEl.appendChild(g.scoreEl[1])
2882 }
2883 if (g.soundAvailable) {
2884 g.soundEl = document.createElement("div");
2885 g.soundEl.id = "pcm-so";
2886 g.prepareElement(g.soundEl, -32, -16);
2887 g.canvasEl.appendChild(g.soundEl);
2888 g.soundEl.onclick =
2889 g.toggleSound;
2890 g.updateSoundIcon()
2891 }
2892 };
2893 g.clearDotEatingNow = function () {
2894 g.dotEatingNow = [e, e];
2895 g.dotEatingNext = [e, e]
2896 };
2897 g.playSound = function (b, c, d) {
2898 if (!(!g.soundAvailable || !google.pacManSound || g.paused)) {
2899 d || g.stopSoundChannel(c);
2900 try {
2901 g.flashSoundPlayer.playTrack(b, c)
2902 } catch (f) {
2903 g.soundAvailable = e
2904 }
2905 }
2906 };
2907 g.stopSoundChannel = function (b) {
2908 if (g.soundAvailable) try {
2909 g.flashSoundPlayer.stopChannel(b)
2910 } catch (c) {
2911 g.soundAvailable = e
2912 }
2913 };
2914 g.stopAllAudio = function () {
2915 if (g.soundAvailable) {
2916 try {
2917 g.flashSoundPlayer.stopAmbientTrack()
2918 } catch (b) {
2919 g.soundAvailable = e
2920 }
2921 for (var c = 0; c < 5; c++) g.stopSoundChannel(c)
2922 }
2923 };
2924 g.playDotEatingSound = function (b) {
2925 if (g.soundAvailable && google.pacManSound) if (g.gameplayMode == 0) if (g.dotEatingNow[b]) g.dotEatingNext[b] = a;
2926 else {
2927 if (b == 0) {
2928 var c = g.dotEatingSoundPart[b] == 1 ? "eating-dot-1" : "eating-dot-2";
2929 g.playSound(c, 1 + g.dotEatingChannel[b], a);
2930 g.dotTimer = window.setInterval(g.repeatDotEatingSoundPacMan, 150)
2931 } else {
2932 g.playSound("eating-dot-double", 3 + g.dotEatingChannel[b], a);
2933 g.dotTimerMs = window.setInterval(g.repeatDotEatingSoundMsPacMan, 150)
2934 }
2935 g.dotEatingChannel[b] = (g.dotEatingChannel[b] + 1) % 2;
2936 g.dotEatingSoundPart[b] =
2937 3 - g.dotEatingSoundPart[b]
2938 }
2939 };
2940 g.repeatDotEatingSound = function (b) {
2941 g.dotEatingNow[b] = e;
2942 if (g.dotEatingNext[b]) {
2943 g.dotEatingNext[b] = e;
2944 g.playDotEatingSound(b)
2945 }
2946 };
2947 g.repeatDotEatingSoundPacMan = function () {
2948 g.repeatDotEatingSound(0)
2949 };
2950 g.repeatDotEatingSoundMsPacMan = function () {
2951 g.repeatDotEatingSound(1)
2952 };
2953 g.playAmbientSound = function () {
2954 if (g.soundAvailable && google.pacManSound) {
2955 var b = 0;
2956 if (g.gameplayMode == 0 || g.gameplayMode == 1) b = g.ghostEyesCount ? "ambient-eyes" : g.mainGhostMode == 4 ? "ambient-fright" : g.dotsEaten > 241 ? "ambient-4" : g.dotsEaten > 207 ? "ambient-3" : g.dotsEaten > 138 ? "ambient-2" : "ambient-1";
2957 else if (g.gameplayMode == 13) b = "cutscene";
2958 if (b) try {
2959 g.flashSoundPlayer.playAmbientTrack(b)
2960 } catch (c) {
2961 g.soundAvailable = e
2962 }
2963 }
2964 };
2965 g.initializeTickTimer = function () {
2966 window.clearInterval(g.tickTimer);
2967 g.fps = C[g.fpsChoice];
2968 g.tickInterval = 1E3 / g.fps;
2969 g.tickMultiplier = D / g.fps;
2970 g.timing = {};
2971 for (var b in w) {
2972 var c = !google.pacManSound && (b == 7 || b == 8) ? 1 : w[b];
2973 g.timing[b] = Math.round(c * D)
2974 }
2975 g.lastTime = (new Date).getTime();
2976 g.lastTimeDelta = 0;
2977 g.lastTimeSlownessCount = 0;
2978 g.tickTimer = window.setInterval(g.tick, g.tickInterval)
2979 };
2980 g.decreaseFps = function () {
2981 if (g.fpsChoice < C.length - 1) {
2982 g.fpsChoice++;
2983 g.initializeTickTimer();
2984 if (g.fpsChoice == C.length - 1) g.canDecreaseFps = e
2985 }
2986 };
2987 g.addCss = function () {
2988 var b = "#pcm-c { width: 554px; border-top: 25px solid black; padding-bottom: 25px; height: 136px; position: relative; background: black; outline: 0; overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}#pcm-c * { position: absolute; overflow: hidden;}#pcm-p,#pcm-cc { left: 45px; width: 464px; height: 136px; z-index: 99; overflow: hidden;}#pcm-p .pcm-d { width: 2px; height: 2px; margin-left: 3px; margin-top: 3px; background: #f8b090; z-index: 100;}#pcm-p .pcm-e { width: 8px; height: 8px; z-index: 101;}#pcm-sc-1 { left: 18px; top: 16px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-sc-2 { left: 18px; top: 80px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-le { position: absolute; left: 515px; top: 74px; height: 64px; width: 32px;} #pcm-le div { position: relative;}#pcm-sc-1-l { left: -2px; top: 0; width: 48px; height: 8px;}#pcm-sc-2-l { left: -2px; top: 64px; width: 48px; height: 8px;}#pcm-so { left: 7px; top: 116px; width: 12px; height: 12px; border: 8px solid black; cursor: pointer;}#pcm-li { position: absolute; left: 523px; top: 0; height: 80px; width: 16px;}#pcm-li .pcm-lif { position: relative; width: 16px; height: 12px; margin-bottom: 3px;}#pcm-p.blk .pcm-e { visibility: hidden;}#pcm-c .pcm-ac { width: 16px; height: 16px; margin-left: -4px; margin-top: -4px; z-index: 110;}#pcm-c .pcm-n { z-index: 111;}#pcm-c #pcm-stck { z-index: 109;}#pcm-c #pcm-gbug { width: 32px;}#pcm-c #pcm-bpcm { width: 32px; height: 32px; margin-left: -20px; margin-top: -20px;}#pcm-f,#pcm-le div { width: 32px; height: 16px; z-index: 105;}#pcm-f { margin-left: -8px; margin-top: -4px;}#pcm-do { width: 19px; height: 2px; left: 279px; top: 46px; overflow: hidden; position: absolute; background: #ffaaa5;}#pcm-re { width: 48px; height: 8px; z-index: 120; left: 264px; top: 80px;}#pcm-go { width: 80px; height: 8px; z-index: 120; left: 248px; top: 80px;}";
2989 g.styleElement =
2990 document.createElement("style");
2991 g.styleElement.type = "text/css";
2992 if (g.styleElement.styleSheet) g.styleElement.styleSheet.cssText = b;
2993 else g.styleElement.appendChild(document.createTextNode(b));
2994 document.getElementsByTagName("head")[0].appendChild(g.styleElement)
2995 };
2996 g.createCanvasElement = function () {
2997 g.canvasEl = document.createElement("div");
2998 g.canvasEl.id = "pcm-c";
2999 g.canvasEl.hideFocus = a;
3000 document.getElementById("logo").appendChild(g.canvasEl);
3001 g.canvasEl.tabIndex = 0;
3002 g.canvasEl.focus()
3003 };
3004 g.everythingIsReady = function () {
3005 if (!g.ready) {
3006 g.ready = a;
3007 var b = document.getElementById("logo-l");
3008 google.dom.remove(b);
3009 document.getElementById("logo").style.background = "black";
3010 g.addCss();
3011 g.createCanvasElement();
3012 g.speedIntervals = [];
3013 g.oppositeDirections = [];
3014 g.oppositeDirections[1] = 2;
3015 g.oppositeDirections[2] = 1;
3016 g.oppositeDirections[4] = 8;
3017 g.oppositeDirections[8] = 4;
3018 g.addEventListeners();
3019 g.fpsChoice = 0;
3020 g.canDecreaseFps = a;
3021 g.initializeTickTimer();
3022 g.newGame()
3023 }
3024 };
3025 g.checkIfEverythingIsReady = function () {
3026 if (g.soundReady || g.graphicsReady) g.updateLoadingProgress(0.67);
3027 if (g.soundReady && g.graphicsReady) {
3028 g.updateLoadingProgress(1);
3029 g.everythingIsReady()
3030 }
3031 };
3032 g.preloadImage = function (b) {
3033 var c = new Image,
3034 d = google.browser.engine.IE;
3035 if (!d) c.onload = g.imageLoaded;
3036 c.src = b;
3037 d && g.imageLoaded()
3038 };
3039 g.imageLoaded = function () {
3040 g.graphicsReady = a;
3041 g.checkIfEverythingIsReady()
3042 };
3043 g.prepareGraphics = function () {
3044 g.graphicsReady = e;
3045 g.preloadImage("src/pacman10-hp-sprite-2.png")
3046 };
3047 g.trimString = function (b) {
3048 return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "")
3049 };
3050 g.g = function (b, c) {
3051 if (b < c) return -1;
3052 else if (b > c) return 1;
3053 return 0
3054 };
3055 g.compareVersions = function (b, c) {
3056 for (var d = 0, f = g.trimString(String(b)).split("."), h = g.trimString(String(c)).split("."), j = Math.max(f.length, h.length), k = 0; d == 0 && k < j; k++) {
3057 var x = f[k] || "",
3058 F = h[k] || "",
3059 G = new RegExp("(\\d*)(\\D*)", "g"),
3060 H = new RegExp("(\\d*)(\\D*)", "g");
3061 do {
3062 var t = G.exec(x) || ["", "", ""],
3063 u = H.exec(F) || ["", "", ""];
3064 if (t[0].length == 0 && u[0].length == 0) break;
3065 d = t[1].length == 0 ? 0 : parseInt(t[1], 10);
3066 var I = u[1].length == 0 ? 0 : parseInt(u[1], 10);
3067 d = g.g(d, I) || g.g(t[2].length == 0, u[2].length == 0) || g.g(t[2], u[2])
3068 } while (d == 0)
3069 }
3070 return d
3071 };
3072 g.getFlashVersion = function (b) {
3073 b = b.match(/[\d]+/g);
3074 b.length = 3;
3075 return b.join(".")
3076 };
3077 g.detectFlash = function () {
3078 var b = e,
3079 c = "";
3080 if (navigator.plugins && navigator.plugins.length) {
3081 var d = navigator.plugins["Shockwave Flash"];
3082 if (d) {
3083 b = a;
3084 if (d.description) c = g.getFlashVersion(d.description)
3085 }
3086 if (navigator.plugins["Shockwave Flash 2.0"]) {
3087 b = a;
3088 c = "2.0.0.11"
3089 }
3090 } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
3091 if (b = (d = navigator.mimeTypes["application/x-shockwave-flash"]) && d.enabledPlugin) {
3092 c = d.enabledPlugin.description;
3093 c = g.getFlashVersion(c)
3094 }
3095 } else try {
3096 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
3097 b = a;
3098 c = g.getFlashVersion(d.GetVariable("$version"))
3099 } catch (f) {
3100 try {
3101 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
3102 b = a;
3103 c = "6.0.21"
3104 } catch (h) {
3105 try {
3106 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
3107 b = a;
3108 c = g.getFlashVersion(d.GetVariable("$version"))
3109 } catch (j) {}
3110 }
3111 }
3112 g.hasFlash = b;
3113 g.flashVersion = c
3114 };
3115 g.isFlashVersion = function (b) {
3116 return g.compareVersions(g.flashVersion, b) >= 0
3117 };
3118 g.prepareSound = function () {
3119 g.soundAvailable = e;
3120 g.soundReady = e;
3121 g.detectFlash();
3122 if (!g.hasFlash || !g.isFlashVersion("9.0.0.0")) {
3123 g.soundReady = a;
3124 g.checkIfEverythingIsReady()
3125 } else {
3126 g.flashIframe = document.createElement("iframe");
3127 g.flashIframe.name = "pm-sound";
3128 g.flashIframe.style.position = "absolute";
3129 g.flashIframe.style.top = "-150px";
3130 g.flashIframe.style.border = 0;
3131 g.flashIframe.style.width = "100px";
3132 g.flashIframe.style.height = "100px";
3133 google.dom.append(g.flashIframe);
3134 g.flashIframeDoc = g.flashIframe.contentDocument;
3135 if (g.flashIframeDoc == undefined || g.flashIframeDoc == null) g.flashIframeDoc = g.flashIframe.contentWindow.document;
3136 g.flashIframeDoc.open();
3137 g.flashIframeDoc.write('<html><head></head><body><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="pacman-sound-player" type="application/x-shockwave-flash"> <param name="movie" value="src/swf/pacman10-hp-sound.swf"> <param name="allowScriptAccess" value="always"> <object id="pacman-sound-player-2" type="application/x-shockwave-flash" data="src/swf/pacman10-hp-sound.swf" width="0" height="0"><param name="allowScriptAccess" value="always"> </object></object></body></html>');
3138 g.flashIframeDoc.close();
3139 window.setTimeout(g.flashNotReady, 3E3)
3140 }
3141 };
3142 g.flashNotReady = function () {
3143 if (!g.ready) {
3144 g.soundAvailable = e;
3145 g.soundReady = a;
3146 g.checkIfEverythingIsReady()
3147 }
3148 };
3149 g.flashReady = function (b) {
3150 g.flashSoundPlayer = b;
3151 g.soundAvailable = a;
3152 g.soundReady = a;
3153 g.checkIfEverythingIsReady()
3154 };
3155 g.flashLoaded = function () {
3156 if (g.flashIframeDoc) {
3157 var b = g.flashIframeDoc.getElementById("pacman-sound-player");
3158 if (b && b.playTrack) {
3159 g.flashReady(b);
3160 return
3161 } else if ((b = g.flashIframeDoc.getElementById("pacman-sound-player-2")) && b.playTrack) {
3162 g.flashReady(b);
3163 return
3164 }
3165 }
3166 g.flashNotReady()
3167 };
3168 g.destroy = function () {
3169 if (google.pacman) {
3170 g.stopAllAudio();
3171 window.clearInterval(g.tickTimer);
3172 window.clearInterval(g.dotTimer);
3173 window.clearInterval(g.dotTimerMs);
3174 google.dom.remove(g.styleElement);
3175 google.dom.remove(g.flashIframe);
3176 google.dom.remove(g.canvasEl);
3177 google.pacman = undefined
3178 }
3179 };
3180 g.exportFunctionCalls = function () {
3181 google.pacman = {};
3182 google.pacman.insertCoin = g.insertCoin;
3183 google.pacman.flashLoaded = g.flashLoaded;
3184 google.pacman.destroy = g.destroy
3185 };
3186 g.updateLoadingProgress = function (b) {
3187 b = Math.round(b * 200);
3188 document.getElementById("logo-b").style.width = b + "px"
3189 };
3190 g.init = function () {
3191 g.ready = e;
3192 document.getElementById("logo").title = "";
3193 g.updateLoadingProgress(0.33);
3194 g.exportFunctionCalls();
3195 g.useCss = navigator.userAgent.indexOf("MSIE 5.") != -1 || navigator.userAgent.indexOf("MSIE 6.") != -1 || navigator.userAgent.indexOf("MSIE 7.") != -1 ? e : a;
3196 g.prepareGraphics();
3197 g.prepareSound()
3198 };
3199 g.init();
3200}(); \ No newline at end of file
diff --git a/pacman-google/src/js/pacman10-hp.js b/pacman-google/src/js/pacman10-hp.js
new file mode 100644
index 0000000..9de2ebe
--- /dev/null
+++ b/pacman-google/src/js/pacman10-hp.js
@@ -0,0 +1,3163 @@
1google.pacman ||
2function () {
3 var a = true,
4 e = false,
5 g = {},
6 i = [1, 4, 2, 8],
7 l = {
8 0: {
9 axis: 0,
10 increment: 0
11 },
12 1: {
13 axis: 0,
14 increment: -1
15 },
16 2: {
17 axis: 0,
18 increment: +1
19 },
20 4: {
21 axis: 1,
22 increment: -1
23 },
24 8: {
25 axis: 1,
26 increment: +1
27 }
28 },
29 m = [0, 7, 17, 32],
30 n = [{
31 x: 5,
32 y: 1,
33 w: 56
34 },
35 {
36 x: 5,
37 y: 4,
38 w: 5
39 },
40 {
41 x: 5,
42 y: 1,
43 h: 4
44 },
45 {
46 x: 9,
47 y: 1,
48 h: 12
49 },
50 {
51 x: 5,
52 y: 12,
53 h: 4
54 },
55 {
56 x: 10,
57 y: 12,
58 h: 4
59 },
60 {
61 x: 5,
62 y: 15,
63 w: 16
64 },
65 {
66 x: 5,
67 y: 12,
68 w: 31
69 },
70 {
71 x: 60,
72 y: 1,
73 h: 4
74 },
75 {
76 x: 54,
77 y: 1,
78 h: 4
79 },
80 {
81 x: 19,
82 y: 1,
83 h: 12
84 },
85 {
86 x: 19,
87 y: 4,
88 w: 26
89 },
90 {
91 x: 13,
92 y: 5,
93 w: 7
94 },
95 {
96 x: 13,
97 y: 5,
98 h: 4
99 },
100 {
101 x: 13,
102 y: 8,
103 w: 3
104 },
105 {
106 x: 56,
107 y: 4,
108 h: 9
109 },
110 {
111 x: 48,
112 y: 4,
113 w: 13
114 },
115 {
116 x: 48,
117 y: 1,
118 h: 12
119 },
120 {
121 x: 60,
122 y: 12,
123 h: 4
124 },
125 {
126 x: 44,
127 y: 15,
128 w: 17
129 },
130 {
131 x: 54,
132 y: 12,
133 h: 4
134 },
135 {
136 x: 44,
137 y: 12,
138 w: 17
139 },
140 {
141 x: 44,
142 y: 1,
143 h: 15
144 },
145 {
146 x: 41,
147 y: 13,
148 w: 4
149 },
150 {
151 x: 41,
152 y: 13,
153 h: 3
154 },
155 {
156 x: 38,
157 y: 13,
158 h: 3
159 },
160 {
161 x: 38,
162 y: 15,
163 w: 4
164 },
165 {
166 x: 35,
167 y: 10,
168 w: 10
169 },
170 {
171 x: 35,
172 y: 1,
173 h: 15
174 },
175 {
176 x: 35,
177 y: 13,
178 w: 4
179 },
180 {
181 x: 21,
182 y: 12,
183 h: 4
184 },
185 {
186 x: 24,
187 y: 12,
188 h: 4
189 },
190 {
191 x: 24,
192 y: 15,
193 w: 12
194 },
195 {
196 x: 27,
197 y: 4,
198 h: 9
199 },
200 {
201 x: 52,
202 y: 9,
203 w: 5
204 },
205 {
206 x: 56,
207 y: 8,
208 w: 10,
209 type: 1
210 },
211 {
212 x: 1,
213 y: 8,
214 w: 9,
215 type: 1
216 }],
217 o = [{
218 x: 1,
219 y: 8,
220 w: 8
221 },
222 {
223 x: 57,
224 y: 8,
225 w: 9
226 },
227 {
228 x: 44,
229 y: 2,
230 h: 10
231 },
232 {
233 x: 35,
234 y: 5,
235 h: 7
236 },
237 {
238 x: 36,
239 y: 4,
240 w: 8
241 },
242 {
243 x: 36,
244 y: 10,
245 w: 8
246 },
247 {
248 x: 39,
249 y: 15,
250 w: 2
251 }],
252 p = [{
253 x: 5,
254 y: 15
255 },
256 {
257 x: 5,
258 y: 3
259 },
260 {
261 x: 15,
262 y: 8
263 },
264 {
265 x: 60,
266 y: 3
267 },
268 {
269 x: 60,
270 y: 15
271 }],
272 q = [{
273 x: 2,
274 y: 8
275 },
276 {
277 x: 63,
278 y: 8
279 }],
280 r = {
281 1: [{
282 x: 39.5,
283 y: 15,
284 dir: 4
285 },
286 {
287 x: 39.5,
288 y: 4,
289 dir: 4,
290 scatterX: 57,
291 scatterY: -4
292 },
293 {
294 x: 39.5,
295 y: 7,
296 dir: 2,
297 scatterX: 0,
298 scatterY: -4
299 },
300 {
301 x: 37.625,
302 y: 7,
303 dir: 1,
304 scatterX: 57,
305 scatterY: 20
306 },
307 {
308 x: 41.375,
309 y: 7,
310 dir: 1,
311 scatterX: 0,
312 scatterY: 20
313 }],
314 2: [{
315 x: 40.25,
316 y: 15,
317 dir: 8
318 },
319 {
320 x: 38.75,
321 y: 15,
322 dir: 4
323 },
324 {
325 x: 39.5,
326 y: 4,
327 dir: 4,
328 scatterX: 57,
329 scatterY: -4
330 },
331 {
332 x: 39.5,
333 y: 7,
334 dir: 2,
335 scatterX: 0,
336 scatterY: -4
337 },
338 {
339 x: 37.625,
340 y: 7,
341 dir: 1,
342 scatterX: 57,
343 scatterY: 20
344 },
345 {
346 x: 41.375,
347 y: 7,
348 dir: 1,
349 scatterX: 0,
350 scatterY: 20
351 }]
352 },
353 s = [32, 312],
354 v = [80, 312],
355 w = {
356 0: 0.16,
357 1: 0.23,
358 2: 1,
359 3: 1,
360 4: 2.23,
361 5: 0.3,
362 6: 1.9,
363 7: 2.23,
364 8: 1.9,
365 9: 5,
366 10: 1.9,
367 11: 1.18,
368 12: 0.3,
369 13: 0.5,
370 14: 1.9,
371 15: 9,
372 16: 10,
373 17: 0.26
374 },
375 y = 0.8 * 0.4,
376 z = [{},
377 {
378 ghostSpeed: 0.75,
379 ghostTunnelSpeed: 0.4,
380 playerSpeed: 0.8,
381 dotEatingSpeed: 0.71,
382 ghostFrightSpeed: 0.5,
383 playerFrightSpeed: 0.9,
384 dotEatingFrightSpeed: 0.79,
385 elroyDotsLeftPart1: 20,
386 elroySpeedPart1: 0.8,
387 elroyDotsLeftPart2: 10,
388 elroySpeedPart2: 0.85,
389 frightTime: 6,
390 frightBlinkCount: 5,
391 fruit: 1,
392 fruitScore: 100,
393 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 20, 5, 1],
394 penForceTime: 4,
395 penLeavingLimits: [0, 0, 30, 60]
396 },
397 {
398 ghostSpeed: 0.85,
399 ghostTunnelSpeed: 0.45,
400 playerSpeed: 0.9,
401 dotEatingSpeed: 0.79,
402 ghostFrightSpeed: 0.55,
403 playerFrightSpeed: 0.95,
404 dotEatingFrightSpeed: 0.83,
405 elroyDotsLeftPart1: 30,
406 elroySpeedPart1: 0.9,
407 elroyDotsLeftPart2: 15,
408 elroySpeedPart2: 0.95,
409 frightTime: 5,
410 frightBlinkCount: 5,
411 fruit: 2,
412 fruitScore: 300,
413 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
414 penForceTime: 4,
415 penLeavingLimits: [0, 0, 0, 50],
416 cutsceneId: 1
417 },
418 {
419 ghostSpeed: 0.85,
420 ghostTunnelSpeed: 0.45,
421 playerSpeed: 0.9,
422 dotEatingSpeed: 0.79,
423 ghostFrightSpeed: 0.55,
424 playerFrightSpeed: 0.95,
425 dotEatingFrightSpeed: 0.83,
426 elroyDotsLeftPart1: 40,
427 elroySpeedPart1: 0.9,
428 elroyDotsLeftPart2: 20,
429 elroySpeedPart2: 0.95,
430 frightTime: 4,
431 frightBlinkCount: 5,
432 fruit: 3,
433 fruitScore: 500,
434 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
435 penForceTime: 4,
436 penLeavingLimits: [0, 0, 0, 0]
437 },
438 {
439 ghostSpeed: 0.85,
440 ghostTunnelSpeed: 0.45,
441 playerSpeed: 0.9,
442 dotEatingSpeed: 0.79,
443 ghostFrightSpeed: 0.55,
444 playerFrightSpeed: 0.95,
445 dotEatingFrightSpeed: 0.83,
446 elroyDotsLeftPart1: 40,
447 elroySpeedPart1: 0.9,
448 elroyDotsLeftPart2: 20,
449 elroySpeedPart2: 0.95,
450 frightTime: 3,
451 frightBlinkCount: 5,
452 fruit: 3,
453 fruitScore: 500,
454 ghostModeSwitchTimes: [7, 20, 7, 20, 5, 1033, 1 / 60, 1],
455 penForceTime: 4,
456 penLeavingLimits: [0, 0, 0, 0]
457 },
458 {
459 ghostSpeed: 0.95,
460 ghostTunnelSpeed: 0.5,
461 playerSpeed: 1,
462 dotEatingSpeed: 0.87,
463 ghostFrightSpeed: 0.6,
464 playerFrightSpeed: 1,
465 dotEatingFrightSpeed: 0.87,
466 elroyDotsLeftPart1: 40,
467 elroySpeedPart1: 1,
468 elroyDotsLeftPart2: 20,
469 elroySpeedPart2: 1.05,
470 frightTime: 2,
471 frightBlinkCount: 5,
472 fruit: 4,
473 fruitScore: 700,
474 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
475 penForceTime: 3,
476 penLeavingLimits: [0, 0, 0, 0],
477 cutsceneId: 2
478 },
479 {
480 ghostSpeed: 0.95,
481 ghostTunnelSpeed: 0.5,
482 playerSpeed: 1,
483 dotEatingSpeed: 0.87,
484 ghostFrightSpeed: 0.6,
485 playerFrightSpeed: 1,
486 dotEatingFrightSpeed: 0.87,
487 elroyDotsLeftPart1: 50,
488 elroySpeedPart1: 1,
489 elroyDotsLeftPart2: 25,
490 elroySpeedPart2: 1.05,
491 frightTime: 5,
492 frightBlinkCount: 5,
493 fruit: 4,
494 fruitScore: 700,
495 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
496 penForceTime: 3,
497 penLeavingLimits: [0, 0, 0, 0]
498 },
499 {
500 ghostSpeed: 0.95,
501 ghostTunnelSpeed: 0.5,
502 playerSpeed: 1,
503 dotEatingSpeed: 0.87,
504 ghostFrightSpeed: 0.6,
505 playerFrightSpeed: 1,
506 dotEatingFrightSpeed: 0.87,
507 elroyDotsLeftPart1: 50,
508 elroySpeedPart1: 1,
509 elroyDotsLeftPart2: 25,
510 elroySpeedPart2: 1.05,
511 frightTime: 2,
512 frightBlinkCount: 5,
513 fruit: 5,
514 fruitScore: 1E3,
515 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
516 penForceTime: 3,
517 penLeavingLimits: [0, 0, 0, 0]
518 },
519 {
520 ghostSpeed: 0.95,
521 ghostTunnelSpeed: 0.5,
522 playerSpeed: 1,
523 dotEatingSpeed: 0.87,
524 ghostFrightSpeed: 0.6,
525 playerFrightSpeed: 1,
526 dotEatingFrightSpeed: 0.87,
527 elroyDotsLeftPart1: 50,
528 elroySpeedPart1: 1,
529 elroyDotsLeftPart2: 25,
530 elroySpeedPart2: 1.05,
531 frightTime: 2,
532 frightBlinkCount: 5,
533 fruit: 5,
534 fruitScore: 1E3,
535 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
536 penForceTime: 3,
537 penLeavingLimits: [0, 0, 0, 0]
538 },
539 {
540 ghostSpeed: 0.95,
541 ghostTunnelSpeed: 0.5,
542 playerSpeed: 1,
543 dotEatingSpeed: 0.87,
544 ghostFrightSpeed: 0.6,
545 playerFrightSpeed: 1,
546 dotEatingFrightSpeed: 0.87,
547 elroyDotsLeftPart1: 60,
548 elroySpeedPart1: 1,
549 elroyDotsLeftPart2: 30,
550 elroySpeedPart2: 1.05,
551 frightTime: 1,
552 frightBlinkCount: 3,
553 fruit: 6,
554 fruitScore: 2E3,
555 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
556 penForceTime: 3,
557 penLeavingLimits: [0, 0, 0, 0],
558 cutsceneId: 3
559 },
560 {
561 ghostSpeed: 0.95,
562 ghostTunnelSpeed: 0.5,
563 playerSpeed: 1,
564 dotEatingSpeed: 0.87,
565 ghostFrightSpeed: 0.6,
566 playerFrightSpeed: 1,
567 dotEatingFrightSpeed: 0.87,
568 elroyDotsLeftPart1: 60,
569 elroySpeedPart1: 1,
570 elroyDotsLeftPart2: 30,
571 elroySpeedPart2: 1.05,
572 frightTime: 5,
573 frightBlinkCount: 5,
574 fruit: 6,
575 fruitScore: 2E3,
576 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
577 penForceTime: 3,
578 penLeavingLimits: [0, 0, 0, 0]
579 },
580 {
581 ghostSpeed: 0.95,
582 ghostTunnelSpeed: 0.5,
583 playerSpeed: 1,
584 dotEatingSpeed: 0.87,
585 ghostFrightSpeed: 0.6,
586 playerFrightSpeed: 1,
587 dotEatingFrightSpeed: 0.87,
588 elroyDotsLeftPart1: 60,
589 elroySpeedPart1: 1,
590 elroyDotsLeftPart2: 30,
591 elroySpeedPart2: 1.05,
592 frightTime: 2,
593 frightBlinkCount: 5,
594 fruit: 7,
595 fruitScore: 3E3,
596 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
597 penForceTime: 3,
598 penLeavingLimits: [0, 0, 0, 0]
599 },
600 {
601 ghostSpeed: 0.95,
602 ghostTunnelSpeed: 0.5,
603 playerSpeed: 1,
604 dotEatingSpeed: 0.87,
605 ghostFrightSpeed: 0.6,
606 playerFrightSpeed: 1,
607 dotEatingFrightSpeed: 0.87,
608 elroyDotsLeftPart1: 80,
609 elroySpeedPart1: 1,
610 elroyDotsLeftPart2: 40,
611 elroySpeedPart2: 1.05,
612 frightTime: 1,
613 frightBlinkCount: 3,
614 fruit: 7,
615 fruitScore: 3E3,
616 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
617 penForceTime: 3,
618 penLeavingLimits: [0, 0, 0, 0]
619 },
620 {
621 ghostSpeed: 0.95,
622 ghostTunnelSpeed: 0.5,
623 playerSpeed: 1,
624 dotEatingSpeed: 0.87,
625 ghostFrightSpeed: 0.6,
626 playerFrightSpeed: 1,
627 dotEatingFrightSpeed: 0.87,
628 elroyDotsLeftPart1: 80,
629 elroySpeedPart1: 1,
630 elroyDotsLeftPart2: 40,
631 elroySpeedPart2: 1.05,
632 frightTime: 1,
633 frightBlinkCount: 3,
634 fruit: 8,
635 fruitScore: 5E3,
636 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
637 penForceTime: 3,
638 penLeavingLimits: [0, 0, 0, 0],
639 cutsceneId: 3
640 },
641 {
642 ghostSpeed: 0.95,
643 ghostTunnelSpeed: 0.5,
644 playerSpeed: 1,
645 dotEatingSpeed: 0.87,
646 ghostFrightSpeed: 0.6,
647 playerFrightSpeed: 1,
648 dotEatingFrightSpeed: 0.87,
649 elroyDotsLeftPart1: 80,
650 elroySpeedPart1: 1,
651 elroyDotsLeftPart2: 40,
652 elroySpeedPart2: 1.05,
653 frightTime: 3,
654 frightBlinkCount: 5,
655 fruit: 8,
656 fruitScore: 5E3,
657 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
658 penForceTime: 3,
659 penLeavingLimits: [0, 0, 0, 0]
660 },
661 {
662 ghostSpeed: 0.95,
663 ghostTunnelSpeed: 0.5,
664 playerSpeed: 1,
665 dotEatingSpeed: 0.87,
666 ghostFrightSpeed: 0.6,
667 playerFrightSpeed: 1,
668 dotEatingFrightSpeed: 0.87,
669 elroyDotsLeftPart1: 100,
670 elroySpeedPart1: 1,
671 elroyDotsLeftPart2: 50,
672 elroySpeedPart2: 1.05,
673 frightTime: 1,
674 frightBlinkCount: 3,
675 fruit: 8,
676 fruitScore: 5E3,
677 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
678 penForceTime: 3,
679 penLeavingLimits: [0, 0, 0, 0]
680 },
681 {
682 ghostSpeed: 0.95,
683 ghostTunnelSpeed: 0.5,
684 playerSpeed: 1,
685 dotEatingSpeed: 0.87,
686 ghostFrightSpeed: 0.6,
687 playerFrightSpeed: 1,
688 dotEatingFrightSpeed: 0.87,
689 elroyDotsLeftPart1: 100,
690 elroySpeedPart1: 1,
691 elroyDotsLeftPart2: 50,
692 elroySpeedPart2: 1.05,
693 frightTime: 1,
694 frightBlinkCount: 3,
695 fruit: 8,
696 fruitScore: 5E3,
697 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
698 penForceTime: 3,
699 penLeavingLimits: [0, 0, 0, 0]
700 },
701 {
702 ghostSpeed: 0.95,
703 ghostTunnelSpeed: 0.5,
704 playerSpeed: 1,
705 dotEatingSpeed: 0.87,
706 ghostFrightSpeed: 0.6,
707 playerFrightSpeed: 1,
708 dotEatingFrightSpeed: 0.87,
709 elroyDotsLeftPart1: 100,
710 elroySpeedPart1: 1,
711 elroyDotsLeftPart2: 50,
712 elroySpeedPart2: 1.05,
713 frightTime: 0,
714 frightBlinkCount: 0,
715 fruit: 8,
716 fruitScore: 5E3,
717 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
718 penForceTime: 3,
719 penLeavingLimits: [0, 0, 0, 0],
720 cutsceneId: 3
721 },
722 {
723 ghostSpeed: 0.95,
724 ghostTunnelSpeed: 0.5,
725 playerSpeed: 1,
726 dotEatingSpeed: 0.87,
727 ghostFrightSpeed: 0.6,
728 playerFrightSpeed: 1,
729 dotEatingFrightSpeed: 0.87,
730 elroyDotsLeftPart1: 100,
731 elroySpeedPart1: 1,
732 elroyDotsLeftPart2: 50,
733 elroySpeedPart2: 1.05,
734 frightTime: 1,
735 frightBlinkCount: 3,
736 fruit: 8,
737 fruitScore: 5E3,
738 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
739 penForceTime: 3,
740 penLeavingLimits: [0, 0, 0, 0]
741 },
742 {
743 ghostSpeed: 0.95,
744 ghostTunnelSpeed: 0.5,
745 playerSpeed: 1,
746 dotEatingSpeed: 0.87,
747 ghostFrightSpeed: 0.6,
748 playerFrightSpeed: 1,
749 dotEatingFrightSpeed: 0.87,
750 elroyDotsLeftPart1: 120,
751 elroySpeedPart1: 1,
752 elroyDotsLeftPart2: 60,
753 elroySpeedPart2: 1.05,
754 frightTime: 0,
755 frightBlinkCount: 0,
756 fruit: 8,
757 fruitScore: 5E3,
758 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
759 penForceTime: 3,
760 penLeavingLimits: [0, 0, 0, 0]
761 },
762 {
763 ghostSpeed: 0.95,
764 ghostTunnelSpeed: 0.5,
765 playerSpeed: 1,
766 dotEatingSpeed: 0.87,
767 ghostFrightSpeed: 0.6,
768 playerFrightSpeed: 1,
769 dotEatingFrightSpeed: 0.87,
770 elroyDotsLeftPart1: 120,
771 elroySpeedPart1: 1,
772 elroyDotsLeftPart2: 60,
773 elroySpeedPart2: 1.05,
774 frightTime: 0,
775 frightBlinkCount: 0,
776 fruit: 8,
777 fruitScore: 5E3,
778 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
779 penForceTime: 3,
780 penLeavingLimits: [0, 0, 0, 0]
781 },
782 {
783 ghostSpeed: 0.95,
784 ghostTunnelSpeed: 0.5,
785 playerSpeed: 0.9,
786 dotEatingSpeed: 0.79,
787 ghostFrightSpeed: 0.75,
788 playerFrightSpeed: 0.9,
789 dotEatingFrightSpeed: 0.79,
790 elroyDotsLeftPart1: 120,
791 elroySpeedPart1: 1,
792 elroyDotsLeftPart2: 60,
793 elroySpeedPart2: 1.05,
794 frightTime: 0,
795 frightBlinkCount: 0,
796 fruit: 8,
797 fruitScore: 5E3,
798 ghostModeSwitchTimes: [5, 20, 5, 20, 5, 1037, 1 / 60, 1],
799 penForceTime: 3,
800 penLeavingLimits: [0, 0, 0, 0]
801 }],
802 A = {
803 1: [{
804 x: 37.6,
805 y: 7,
806 dir: 1,
807 dest: 6.375,
808 speed: 0.48
809 },
810 {
811 x: 37.6,
812 y: 6.375,
813 dir: 2,
814 dest: 7.625,
815 speed: 0.48
816 },
817 {
818 x: 37.6,
819 y: 7.625,
820 dir: 1,
821 dest: 7,
822 speed: 0.48
823 }],
824 2: [{
825 x: 39.5,
826 y: 7,
827 dir: 2,
828 dest: 7.625,
829 speed: 0.48
830 },
831 {
832 x: 39.5,
833 y: 7.625,
834 dir: 1,
835 dest: 6.375,
836 speed: 0.48
837 },
838 {
839 x: 39.5,
840 y: 6.375,
841 dir: 2,
842 dest: 7,
843 speed: 0.48
844 }],
845 3: [{
846 x: 41.4,
847 y: 7,
848 dir: 1,
849 dest: 6.375,
850 speed: 0.48
851 },
852 {
853 x: 41.4,
854 y: 6.375,
855 dir: 2,
856 dest: 7.625,
857 speed: 0.48
858 },
859 {
860 x: 41.4,
861 y: 7.625,
862 dir: 1,
863 dest: 7,
864 speed: 0.48
865 }],
866 4: [{
867 x: 37.6,
868 y: 7,
869 dir: 8,
870 dest: 39.5,
871 speed: y
872 },
873 {
874 x: 39.5,
875 y: 7,
876 dir: 1,
877 dest: 4,
878 speed: y
879 }],
880 5: [{
881 x: 39.5,
882 y: 7,
883 dir: 1,
884 dest: 4,
885 speed: y
886 }],
887 6: [{
888 x: 41.4,
889 y: 7,
890 dir: 4,
891 dest: 39.5,
892 speed: y
893 },
894 {
895 x: 39.5,
896 y: 7,
897 dir: 1,
898 dest: 4,
899 speed: y
900 }],
901 7: [{
902 x: 39.5,
903 y: 4,
904 dir: 2,
905 dest: 7,
906 speed: 1.6
907 },
908 {
909 x: 39.5,
910 y: 7,
911 dir: 4,
912 dest: 37.625,
913 speed: 1.6
914 }],
915 8: [{
916 x: 39.5,
917 y: 4,
918 dir: 2,
919 dest: 7,
920 speed: 1.6
921 }],
922 9: [{
923 x: 39.5,
924 y: 4,
925 dir: 2,
926 dest: 7,
927 speed: 1.6
928 },
929 {
930 x: 39.5,
931 y: 7,
932 dir: 8,
933 dest: 41.375,
934 speed: 1.6
935 }],
936 10: [{
937 x: 37.6,
938 y: 7,
939 dir: 8,
940 dest: 39.5,
941 speed: y
942 },
943 {
944 x: 39.5,
945 y: 7,
946 dir: 1,
947 dest: 4,
948 speed: y
949 }],
950 11: [{
951 x: 39.5,
952 y: 7,
953 dir: 1,
954 dest: 4,
955 speed: y
956 }],
957 12: [{
958 x: 41.4,
959 y: 7,
960 dir: 4,
961 dest: 39.5,
962 speed: y
963 },
964 {
965 x: 39.5,
966 y: 7,
967 dir: 1,
968 dest: 4,
969 speed: y
970 }]
971 },
972 B = {
973 1: {
974 actors: [{
975 ghost: e,
976 x: 64,
977 y: 9,
978 id: 0
979 },
980 {
981 ghost: a,
982 x: 68.2,
983 y: 9,
984 id: 1
985 }],
986 sequence: [{
987 time: 5.5,
988 moves: [{
989 dir: 4,
990 speed: 0.75 * 0.8 * 2
991 },
992 {
993 dir: 4,
994 speed: 0.78 * 0.8 * 2
995 }]
996 },
997 {
998 time: 0.1,
999 moves: [{
1000 dir: 4,
1001 speed: 32
1002 },
1003 {
1004 dir: 4,
1005 speed: 0
1006 }]
1007 },
1008 {
1009 time: 9,
1010 moves: [{
1011 dir: 8,
1012 speed: 0.75 * 0.8 * 2,
1013 elId: "pcm-bpcm"
1014 },
1015 {
1016 dir: 8,
1017 speed: 0.8,
1018 mode: 4
1019 }]
1020 }]
1021 },
1022 2: {
1023 actors: [{
1024 ghost: e,
1025 x: 64,
1026 y: 9,
1027 id: 0
1028 },
1029 {
1030 ghost: a,
1031 x: 70.2,
1032 y: 9,
1033 id: 1
1034 },
1035 {
1036 ghost: a,
1037 x: 32,
1038 y: 9.5,
1039 id: 2
1040 }],
1041 sequence: [{
1042 time: 2.7,
1043 moves: [{
1044 dir: 4,
1045 speed: 0.75 * 0.8 * 2
1046 },
1047 {
1048 dir: 4,
1049 speed: 0.78 * 0.8 * 2
1050 },
1051 {
1052 dir: 0,
1053 speed: 0,
1054 elId: "pcm-stck"
1055 }]
1056 },
1057 {
1058 time: 1,
1059 moves: [{
1060 dir: 4,
1061 speed: 0.75 * 0.8 * 2
1062 },
1063 {
1064 dir: 4,
1065 speed: 0.1 * 0.8
1066 },
1067 {
1068 dir: 0,
1069 speed: 0,
1070 elId: "pcm-stck"
1071 }]
1072 },
1073 {
1074 time: 1.3,
1075 moves: [{
1076 dir: 4,
1077 speed: 0.75 * 0.8 * 2
1078 },
1079 {
1080 dir: 4,
1081 speed: 0
1082 },
1083 {
1084 dir: 0,
1085 speed: 0,
1086 elId: "pcm-stck"
1087 }]
1088 },
1089 {
1090 time: 1,
1091 moves: [{
1092 dir: 4,
1093 speed: 0.75 * 0.8 * 2
1094 },
1095 {
1096 dir: 4,
1097 speed: 0,
1098 elId: "pcm-ghfa"
1099 },
1100 {
1101 dir: 0,
1102 speed: 0,
1103 elId: "pcm-stck"
1104 }]
1105 },
1106 {
1107 time: 2.5,
1108 moves: [{
1109 dir: 4,
1110 speed: 0.75 * 0.8 * 2
1111 },
1112 {
1113 dir: 4,
1114 speed: 0,
1115 elId: "pcm-ghfa"
1116 },
1117 {
1118 dir: 0,
1119 speed: 0,
1120 elId: "pcm-stck"
1121 }]
1122 }]
1123 },
1124 3: {
1125 actors: [{
1126 ghost: e,
1127 x: 64,
1128 y: 9,
1129 id: 0
1130 },
1131 {
1132 ghost: a,
1133 x: 70.2,
1134 y: 9,
1135 id: 2
1136 }],
1137 sequence: [{
1138 time: 5.3,
1139 moves: [{
1140 dir: 4,
1141 speed: 0.75 * 0.8 * 2
1142 },
1143 {
1144 dir: 4,
1145 speed: 0.78 * 0.8 * 2,
1146 elId: "pcm-ghin"
1147 }]
1148 },
1149 {
1150 time: 5.3,
1151 moves: [{
1152 dir: 4,
1153 speed: 0
1154 },
1155 {
1156 dir: 8,
1157 speed: 0.78 * 0.8 * 2,
1158 elId: "pcm-gbug"
1159 }]
1160 }]
1161 }
1162 },
1163 C = [90, 45, 30],
1164 D = C[0];
1165
1166 function E(b) {
1167 this.id = b
1168 }
1169 E.prototype.A = function () {
1170 var b = r[g.playerCount][this.id];
1171 this.pos = [b.y * 8, b.x * 8];
1172 this.posDelta = [0, 0];
1173 this.tilePos = [b.y * 8, b.x * 8];
1174 this.targetPos = [b.scatterY * 8, b.scatterX * 8];
1175 this.scatterPos = [b.scatterY * 8, b.scatterX * 8];
1176 this.lastActiveDir = this.dir = b.dir;
1177 this.physicalSpeed = this.requestedDir = this.nextDir = 0;
1178 this.c(0);
1179 this.reverseDirectionsNext = this.freeToLeavePen = this.modeChangedWhileInPen = this.eatenInThisFrightMode = e;
1180 this.l()
1181 };
1182 E.prototype.createElement = function () {
1183 this.el = document.createElement("div");
1184 this.el.className = "pcm-ac";
1185 this.el.id = "actor" + this.id;
1186 g.prepareElement(this.el, 0, 0);
1187 g.playfieldEl.appendChild(this.el);
1188 this.elPos = [0, 0];
1189 this.elBackgroundPos = [0, 0]
1190 };
1191 E.prototype.a = function (b) {
1192 var c = this.mode;
1193 this.mode = b;
1194 if (this.id == g.playerCount + 3 && (b == 16 || c == 16)) g.updateCruiseElroySpeed();
1195 switch (c) {
1196 case 32:
1197 g.ghostExitingPenNow = e;
1198 break;
1199 case 8:
1200 g.ghostEyesCount > 0 && g.ghostEyesCount--;
1201 g.ghostEyesCount == 0 && g.playAmbientSound();
1202 break
1203 }
1204 switch (b) {
1205 case 4:
1206 this.fullSpeed = g.levels.ghostFrightSpeed * 0.8;
1207 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1208 this.followingRoutine = e;
1209 break;
1210 case 1:
1211 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1212 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1213 this.followingRoutine =
1214 e;
1215 break;
1216 case 2:
1217 this.targetPos = this.scatterPos;
1218 this.fullSpeed = g.levels.ghostSpeed * 0.8;
1219 this.tunnelSpeed = g.levels.ghostTunnelSpeed * 0.8;
1220 this.followingRoutine = e;
1221 break;
1222 case 8:
1223 this.tunnelSpeed = this.fullSpeed = 1.6;
1224 this.targetPos = [s[0], s[1]];
1225 this.freeToLeavePen = this.followingRoutine = e;
1226 break;
1227 case 16:
1228 this.l();
1229 this.followingRoutine = a;
1230 this.routineMoveId = -1;
1231 switch (this.id) {
1232 case g.playerCount + 1:
1233 this.routineToFollow = 2;
1234 break;
1235 case g.playerCount + 2:
1236 this.routineToFollow = 1;
1237 break;
1238 case g.playerCount + 3:
1239 this.routineToFollow =
1240 3;
1241 break
1242 }
1243 break;
1244 case 32:
1245 this.followingRoutine = a;
1246 this.routineMoveId = -1;
1247 switch (this.id) {
1248 case g.playerCount + 1:
1249 this.routineToFollow = 5;
1250 break;
1251 case g.playerCount + 2:
1252 this.routineToFollow = 4;
1253 break;
1254 case g.playerCount + 3:
1255 this.routineToFollow = 6;
1256 break
1257 }
1258 g.ghostExitingPenNow = a;
1259 break;
1260 case 64:
1261 this.followingRoutine = a;
1262 this.routineMoveId = -1;
1263 switch (this.id) {
1264 case g.playerCount:
1265 case g.playerCount + 1:
1266 this.routineToFollow = 8;
1267 break;
1268 case g.playerCount + 2:
1269 this.routineToFollow = 7;
1270 break;
1271 case g.playerCount + 3:
1272 this.routineToFollow = 9;
1273 break
1274 }
1275 break;
1276 case 128:
1277 this.followingRoutine = a;
1278 this.routineMoveId = -1;
1279 switch (this.id) {
1280 case g.playerCount:
1281 case g.playerCount + 1:
1282 this.routineToFollow = 11;
1283 break;
1284 case g.playerCount + 2:
1285 this.routineToFollow = 10;
1286 break;
1287 case g.playerCount + 3:
1288 this.routineToFollow = 12;
1289 break
1290 }
1291 break
1292 }
1293 this.d()
1294 };
1295 E.prototype.l = function () {
1296 if (this.id >= g.playerCount) this.targetPlayerId = Math.floor(g.rand() * g.playerCount)
1297 };
1298 E.prototype.z = function (b) {
1299 if (this.dir == g.oppositeDirections[b]) {
1300 this.dir = b;
1301 this.posDelta = [0, 0];
1302 this.currentSpeed != 2 && this.c(0);
1303 if (this.dir != 0) this.lastActiveDir = this.dir;
1304 this.nextDir = 0
1305 } else if (this.dir != b) if (this.dir == 0) {
1306 if (g.playfield[this.pos[0]][this.pos[1]].allowedDir & b) this.dir = b
1307 } else {
1308 var c = g.playfield[this.tilePos[0]][this.tilePos[1]];
1309 if (c && c.allowedDir & b) {
1310 c = l[this.dir];
1311 var d = [this.pos[0], this.pos[1]];
1312 d[c.axis] -= c.increment;
1313 var f = 0;
1314 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 1;
1315 else {
1316 d[c.axis] -= c.increment;
1317 if (d[0] == this.tilePos[0] && d[1] == this.tilePos[1]) f = 2
1318 }
1319 if (f) {
1320 this.dir = b;
1321 this.pos[0] = this.tilePos[0];
1322 this.pos[1] = this.tilePos[1];
1323 c = l[this.dir];
1324 this.pos[c.axis] += c.increment * f;
1325 return
1326 }
1327 }
1328 this.nextDir = b;
1329 this.posDelta = [0, 0]
1330 }
1331 };
1332 E.prototype.i = function (b) {
1333 var c = this.tilePos,
1334 d = l[this.dir],
1335 f = [c[0], c[1]];
1336 f[d.axis] += d.increment * 8;
1337 var h = g.playfield[f[0]][f[1]];
1338 if (b && !h.intersection) h = g.playfield[c[0]][c[1]];
1339 if (h.intersection) switch (this.mode) {
1340 case 2:
1341 case 1:
1342 case 8:
1343 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1344 else {
1345 b = 99999999999;
1346 c = 0;
1347 for (var j in i) {
1348 var k = i[j];
1349 if (h.allowedDir & k && this.dir != g.oppositeDirections[k]) {
1350 d = l[k];
1351 var x = [f[0], f[1]];
1352 x[d.axis] += d.increment;
1353 d = g.getDistance(x, [this.targetPos[0], this.targetPos[1]]);
1354 if (d < b) {
1355 b = d;
1356 c = k
1357 }
1358 }
1359 }
1360 if (c) this.nextDir = c
1361 }
1362 break;
1363 case 4:
1364 if ((this.dir & h.allowedDir) == 0 && h.allowedDir == g.oppositeDirections[this.dir]) this.nextDir = g.oppositeDirections[this.dir];
1365 else {
1366 do f = i[Math.floor(g.rand() * 4)];
1367 while ((f & h.allowedDir) == 0 || f == g.oppositeDirections[this.dir]);
1368 this.nextDir = f
1369 }
1370 break
1371 }
1372 };
1373 E.prototype.p = function (b) {
1374 g.tilesChanged = a;
1375 if (this.reverseDirectionsNext) {
1376 this.dir = g.oppositeDirections[this.dir];
1377 this.nextDir = 0;
1378 this.reverseDirectionsNext = e;
1379 this.i(a)
1380 }
1381 if (!this.ghost && !g.playfield[b[0]][b[1]].path) {
1382 this.pos[0] = this.lastGoodTilePos[0];
1383 this.pos[1] = this.lastGoodTilePos[1];
1384 b[0] = this.lastGoodTilePos[0];
1385 b[1] = this.lastGoodTilePos[1];
1386 this.dir = 0
1387 } else this.lastGoodTilePos = [b[0], b[1]];
1388 g.playfield[b[0]][b[1]].type == 1 && this.mode != 8 ? this.c(2) : this.c(0);
1389 !this.ghost && g.playfield[b[0]][b[1]].dot && g.dotEaten(this.id, b);
1390 this.tilePos[0] = b[0];
1391 this.tilePos[1] = b[1]
1392 };
1393 E.prototype.t = function () {
1394 var b = this.tilePos;
1395 switch (this.dir) {
1396 case 1:
1397 var c = [b[0], b[1]],
1398 d = [b[0] + 3.6, b[1]];
1399 break;
1400 case 2:
1401 c = [b[0] - 4, b[1]];
1402 d = [b[0], b[1]];
1403 break;
1404 case 4:
1405 c = [b[0], b[1]];
1406 d = [b[0], b[1] + 3.6];
1407 break;
1408 case 8:
1409 c = [b[0], b[1] - 4];
1410 d = [b[0], b[1]];
1411 break
1412 }
1413 if (this.pos[0] >= c[0] && this.pos[0] <= d[0] && this.pos[1] >= c[1] && this.pos[1] <= d[1]) {
1414 b = l[this.nextDir];
1415 this.posDelta[b.axis] += b.increment
1416 }
1417 };
1418 E.prototype.n = function () {
1419 if (this.pos[0] == q[0].y * 8 && this.pos[1] == q[0].x * 8) {
1420 this.pos[0] = q[1].y * 8;
1421 this.pos[1] = (q[1].x - 1) * 8
1422 } else if (this.pos[0] == q[1].y * 8 && this.pos[1] == q[1].x * 8) {
1423 this.pos[0] = q[0].y * 8;
1424 this.pos[1] = (q[0].x + 1) * 8
1425 }
1426 this.mode == 8 && this.pos[0] == s[0] && this.pos[1] == s[1] && this.a(64);
1427 if (!this.ghost && this.pos[0] == v[0] && (this.pos[1] == v[1] || this.pos[1] == v[1] + 8)) g.eatFruit(this.id)
1428 };
1429 E.prototype.u = function () {
1430 this.n();
1431 this.ghost && this.i(e);
1432 var b = g.playfield[this.pos[0]][this.pos[1]];
1433 if (b.intersection) if (this.nextDir && this.nextDir & b.allowedDir) {
1434 if (this.dir != 0) this.lastActiveDir = this.dir;
1435 this.dir = this.nextDir;
1436 this.nextDir = 0;
1437 if (!this.ghost) {
1438 this.pos[0] += this.posDelta[0];
1439 this.pos[1] += this.posDelta[1];
1440 this.posDelta = [0, 0]
1441 }
1442 } else if ((this.dir & b.allowedDir) == 0) {
1443 if (this.dir != 0) this.lastActiveDir = this.dir;
1444 this.nextDir = this.dir = 0;
1445 this.c(0)
1446 }
1447 };
1448 E.prototype.o = function () {
1449 var b = this.pos[0] / 8,
1450 c = this.pos[1] / 8,
1451 d = [Math.round(b) * 8, Math.round(c) * 8];
1452 if (d[0] != this.tilePos[0] || d[1] != this.tilePos[1]) this.p(d);
1453 else {
1454 b = [Math.floor(b) * 8, Math.floor(c) * 8];
1455 this.pos[1] == b[1] && this.pos[0] == b[0] && this.u()
1456 }!this.ghost && this.nextDir && g.playfield[d[0]][d[1]].intersection && this.nextDir & g.playfield[d[0]][d[1]].allowedDir && this.t()
1457 };
1458 E.prototype.B = function () {
1459 if (this.id == g.playerCount && g.dotsRemaining < g.levels.elroyDotsLeftPart1 && this.mode == 2 && (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16)) {
1460 var b = g.actors[this.targetPlayerId];
1461 this.targetPos = [b.tilePos[0], b.tilePos[1]]
1462 } else if (this.ghost && this.mode == 1) {
1463 b = g.actors[this.targetPlayerId];
1464 switch (this.id) {
1465 case g.playerCount:
1466 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1467 break;
1468 case g.playerCount + 1:
1469 this.targetPos = [b.tilePos[0], b.tilePos[1]];
1470 var c = l[b.dir];
1471 this.targetPos[c.axis] += 32 * c.increment;
1472 if (b.dir == 1) this.targetPos[1] -= 32;
1473 break;
1474 case g.playerCount + 2:
1475 var d = g.actors[g.playerCount],
1476 f = [b.tilePos[0], b.tilePos[1]];
1477 c = l[b.dir];
1478 f[c.axis] += 16 * c.increment;
1479 if (b.dir == 1) f[1] -= 16;
1480 this.targetPos[0] = f[0] * 2 - d.tilePos[0];
1481 this.targetPos[1] = f[1] * 2 - d.tilePos[1];
1482 break;
1483 case g.playerCount + 3:
1484 c = g.getDistance(b.tilePos, this.tilePos);
1485 this.targetPos = c > 64 ? [b.tilePos[0], b.tilePos[1]] : this.scatterPos;
1486 break
1487 }
1488 }
1489 };
1490 E.prototype.v = function () {
1491 this.routineMoveId++;
1492 if (this.routineMoveId == A[this.routineToFollow].length) if (this.mode == 16 && this.freeToLeavePen && !g.ghostExitingPenNow) {
1493 this.eatenInThisFrightMode ? this.a(128) : this.a(32);
1494 return
1495 } else if (this.mode == 32 || this.mode == 128) {
1496 this.pos = [s[0], s[1] + 4];
1497 this.dir = this.modeChangedWhileInPen ? 8 : 4;
1498 var b = g.mainGhostMode;
1499 if (this.mode == 128 && b == 4) b = g.lastMainGhostMode;
1500 this.a(b);
1501 return
1502 } else if (this.mode == 64) {
1503 if (this.id == g.playerCount || this.freeToLeavePen) this.a(128);
1504 else {
1505 this.eatenInThisFrightMode =
1506 a;
1507 this.a(16)
1508 }
1509 return
1510 } else this.routineMoveId = 0;
1511 b = A[this.routineToFollow][this.routineMoveId];
1512 this.pos[0] = b.y * 8;
1513 this.pos[1] = b.x * 8;
1514 this.dir = b.dir;
1515 this.physicalSpeed = 0;
1516 this.speedIntervals = g.getSpeedIntervals(b.speed);
1517 this.proceedToNextRoutineMove = e;
1518 this.b()
1519 };
1520 E.prototype.m = function () {
1521 var b = A[this.routineToFollow][this.routineMoveId];
1522 if (b) if (this.speedIntervals[g.intervalTime]) {
1523 var c = l[this.dir];
1524 this.pos[c.axis] += c.increment;
1525 switch (this.dir) {
1526 case 1:
1527 case 4:
1528 if (this.pos[c.axis] < b.dest * 8) {
1529 this.pos[c.axis] = b.dest * 8;
1530 this.proceedToNextRoutineMove = a
1531 }
1532 break;
1533 case 2:
1534 case 8:
1535 if (this.pos[c.axis] > b.dest * 8) {
1536 this.pos[c.axis] = b.dest * 8;
1537 this.proceedToNextRoutineMove = a
1538 }
1539 break
1540 }
1541 this.b()
1542 }
1543 };
1544 E.prototype.j = function () {
1545 if (this.routineMoveId == -1 || this.proceedToNextRoutineMove) this.v();
1546 this.m()
1547 };
1548 E.prototype.d = function () {
1549 switch (this.currentSpeed) {
1550 case 0:
1551 var b = this.id == g.playerCount && (this.mode == 2 || this.mode == 1) ? g.cruiseElroySpeed : this.fullSpeed;
1552 break;
1553 case 1:
1554 b = this.dotEatingSpeed;
1555 break;
1556 case 2:
1557 b = this.tunnelSpeed;
1558 break
1559 }
1560 if (this.physicalSpeed != b) {
1561 this.physicalSpeed = b;
1562 this.speedIntervals = g.getSpeedIntervals(this.physicalSpeed)
1563 }
1564 };
1565 E.prototype.c = function (b) {
1566 this.currentSpeed = b;
1567 this.d()
1568 };
1569 E.prototype.e = function () {
1570 if (this.dir) if (this.speedIntervals[g.intervalTime]) {
1571 var b = l[this.dir];
1572 this.pos[b.axis] += b.increment;
1573 this.o();
1574 this.b()
1575 }
1576 };
1577 E.prototype.move = function () {
1578 if (g.gameplayMode == 0 || this.ghost && g.gameplayMode == 1 && (this.mode == 8 || this.mode == 64)) {
1579 if (this.requestedDir != 0) {
1580 this.z(this.requestedDir);
1581 this.requestedDir = 0
1582 }
1583 if (this.followingRoutine) {
1584 this.j();
1585 this.mode == 64 && this.j()
1586 } else {
1587 this.e();
1588 this.mode == 8 && this.e()
1589 }
1590 }
1591 };
1592 E.prototype.k = function () {
1593 var b = g.getPlayfieldX(this.pos[1] + this.posDelta[1]),
1594 c = g.getPlayfieldY(this.pos[0] + this.posDelta[0]);
1595 if (this.elPos[0] != c || this.elPos[1] != b) {
1596 this.elPos[0] = c;
1597 this.elPos[1] = b;
1598 this.el.style.left = b + "px";
1599 this.el.style.top = c + "px"
1600 }
1601 };
1602 E.prototype.s = function () {
1603 var b = 0,
1604 c = 0,
1605 d = this.dir;
1606 if (d == 0) d = this.lastActiveDir;
1607 if (g.gameplayMode == 1 && this.id == g.playerEatingGhostId) {
1608 b = 3;
1609 c = 0
1610 } else if ((g.gameplayMode == 9 || g.gameplayMode == 10) && this.id == 0) {
1611 b = 2;
1612 c = 0
1613 } else if (g.gameplayMode == 4 || g.gameplayMode == 5 || g.gameplayMode == 7) {
1614 b = this.id == 0 ? 2 : 4;
1615 c = 0
1616 } else if (g.gameplayMode == 3) if (this.id == g.playerDyingId) {
1617 d = 20 - Math.floor(g.gameplayModeTime / g.timing[4] * 21);
1618 if (this.id == 0) {
1619 b = d - 1;
1620 switch (b) {
1621 case -1:
1622 b = 0;
1623 break;
1624 case 11:
1625 b = 10;
1626 break;
1627 case 12:
1628 case 13:
1629 case 14:
1630 case 15:
1631 case 16:
1632 case 17:
1633 case 18:
1634 case 19:
1635 case 20:
1636 b =
1637 11;
1638 break
1639 }
1640 c = 12
1641 } else switch (d) {
1642 case 0:
1643 case 1:
1644 case 2:
1645 case 6:
1646 case 10:
1647 b = 4;
1648 c = 3;
1649 break;
1650 case 3:
1651 case 7:
1652 case 11:
1653 b = 4;
1654 c = 0;
1655 break;
1656 case 4:
1657 case 8:
1658 case 12:
1659 case 13:
1660 case 14:
1661 case 15:
1662 case 16:
1663 case 17:
1664 case 18:
1665 case 19:
1666 case 20:
1667 b = 4;
1668 c = 2;
1669 break;
1670 case 5:
1671 case 9:
1672 b = 4;
1673 c = 1;
1674 break
1675 }
1676 } else {
1677 b = 3;
1678 c = 0
1679 } else if (this.el.id == "pcm-bpcm") {
1680 b = 14;
1681 c = 0;
1682 d = Math.floor(g.globalTime * 0.2) % 4;
1683 if (d == 3) d = 1;
1684 c += 2 * d
1685 } else {
1686 switch (d) {
1687 case 4:
1688 c = 0;
1689 break;
1690 case 8:
1691 c = 1;
1692 break;
1693 case 1:
1694 c = 2;
1695 break;
1696 case 2:
1697 c = 3;
1698 break
1699 }
1700 if (g.gameplayMode != 2) b = Math.floor(g.globalTime * 0.3) % 4;
1701 if (b == 3 && this.dir == 0) b = 0;
1702 if (b == 2 && this.id == 0) b = 0;
1703 if (b == 3) {
1704 b = 2;
1705 c = 0
1706 }
1707 if (this.id == 1) b += 4
1708 }
1709 return [c, b]
1710 };
1711 E.prototype.r = function () {
1712 var b = 0,
1713 c = 0;
1714 if (g.gameplayMode == 10 || g.gameplayMode == 4 || g.gameplayMode == 3) {
1715 b = 3;
1716 c = 0
1717 } else if (g.gameplayMode == 1 && this.id == g.ghostBeingEatenId) {
1718 switch (g.modeScoreMultiplier) {
1719 case 2:
1720 b = 0;
1721 break;
1722 case 4:
1723 b = 1;
1724 break;
1725 case 8:
1726 b = 2;
1727 break;
1728 case 16:
1729 b = 3;
1730 break
1731 }
1732 c = 11;
1733 this.el.className = "pcm-ac pcm-n"
1734 } else if (this.mode == 4 || (this.mode == 16 || this.mode == 32) && g.mainGhostMode == 4 && !this.eatenInThisFrightMode) {
1735 b = 0;
1736 c = 8;
1737 if (g.frightModeTime < g.levels.frightTotalTime - g.levels.frightTime && Math.floor(g.frightModeTime / g.timing[1]) % 2 == 0) b += 2;
1738 b += Math.floor(g.globalTime / 16) % 2
1739 } else if (this.mode == 8 || this.mode == 64) {
1740 c = this.nextDir;
1741 if (!c) c = this.dir;
1742 switch (c) {
1743 case 4:
1744 b = 2;
1745 break;
1746 case 8:
1747 b = 3;
1748 break;
1749 case 1:
1750 b = 0;
1751 break;
1752 case 2:
1753 b = 1;
1754 break
1755 }
1756 c = 10
1757 } else if (this.el.id == "pcm-ghin") {
1758 b = 6;
1759 c = 8;
1760 b += Math.floor(g.globalTime / 16) % 2
1761 } else if (this.el.id == "pcm-gbug") {
1762 b = 6;
1763 c = 9;
1764 c += Math.floor(g.globalTime / 16) % 2
1765 } else if (this.el.id == "pcm-ghfa") {
1766 b = g.cutsceneSequenceId == 3 ? 6 : 7;
1767 c = 11
1768 } else if (this.el.id == "pcm-stck") {
1769 b = g.cutsceneSequenceId == 1 ? g.cutsceneTime > 60 ? 1 : g.cutsceneTime > 45 ? 2 : 3 : g.cutsceneSequenceId == 2 ? 3 : g.cutsceneSequenceId == 3 || g.cutsceneSequenceId == 4 ? 4 : 0;
1770 c = 13
1771 } else {
1772 c = this.nextDir;
1773 if (!c || g.playfield[this.tilePos[0]][this.tilePos[1]].type == 1) c = this.dir;
1774 switch (c) {
1775 case 4:
1776 b = 4;
1777 break;
1778 case 8:
1779 b = 6;
1780 break;
1781 case 1:
1782 b = 0;
1783 break;
1784 case 2:
1785 b = 2;
1786 break
1787 }
1788 c = 4 + this.id - g.playerCount;
1789 if (this.speed > 0 || g.gameplayMode != 13) b += Math.floor(g.globalTime / 16) % 2
1790 }
1791 return [c, b]
1792 };
1793 E.prototype.b = function () {
1794 this.k();
1795 var b = [0, 0];
1796 b = g.gameplayMode == 8 || g.gameplayMode == 14 ? [0, 3] : this.ghost ? this.r() : this.s();
1797 if (this.elBackgroundPos[0] != b[0] || this.elBackgroundPos[1] != b[1]) {
1798 this.elBackgroundPos[0] = b[0];
1799 this.elBackgroundPos[1] = b[1];
1800 b[0] *= 16;
1801 b[1] *= 16;
1802 g.changeElementBkPos(this.el, b[1], b[0], a)
1803 }
1804 };
1805 g.rand = function () {
1806 var b = 4294967296,
1807 c = 134775813;
1808 c = c * g.randSeed + 1;
1809 return (g.randSeed = c % b) / b
1810 };
1811 g.seed = function (b) {
1812 g.randSeed = b
1813 };
1814 g.getDistance = function (b, c) {
1815 return Math.sqrt((c[1] - b[1]) * (c[1] - b[1]) + (c[0] - b[0]) * (c[0] - b[0]))
1816 };
1817 g.getPlayfieldX = function (b) {
1818 return b + -32
1819 };
1820 g.getPlayfieldY = function (b) {
1821 return b + 0
1822 };
1823 g.getCorrectedSpritePos = function (b) {
1824 return b / 8 * 10 + 2
1825 };
1826 g.getDotElementId = function (b, c) {
1827 return "pcm-d" + b + "-" + c
1828 };
1829 g.showElementById = function (b, c) {
1830 var d = document.getElementById(b);
1831 if (d) d.style.visibility = c ? "visible" : "hidden"
1832 };
1833 g.getAbsoluteElPos = function (b) {
1834 var c = [0, 0];
1835 do {
1836 c[0] += b.offsetTop;
1837 c[1] += b.offsetLeft
1838 } while (b = b.offsetParent);
1839 return c
1840 };
1841 g.prepareElement = function (b, c, d) {
1842 c = g.getCorrectedSpritePos(parseInt(c, 10));
1843 d = g.getCorrectedSpritePos(parseInt(d, 10));
1844 if (g.useCss) {
1845 b.style.backgroundImage = "url(/src/pacman10-hp-sprite.png)";
1846 b.style.backgroundPosition = -c + "px " + -d + "px";
1847 b.style.backgroundRepeat = "no-repeat"
1848 } else {
1849 b.style.overflow = "hidden";
1850 c = "display: block; position: relative; left: " + -c + "px; top: " + -d + "px";
1851 b.innerHTML = '<img style="' + c + '" src="/src/pacman10-hp-sprite.png">'
1852 }
1853 };
1854 g.changeElementBkPos = function (b, c, d, f) {
1855 if (f) {
1856 c = g.getCorrectedSpritePos(c);
1857 d = g.getCorrectedSpritePos(d)
1858 }
1859 if (g.useCss) b.style.backgroundPosition = -c + "px " + -d + "px";
1860 else if (b.childNodes[0]) {
1861 b.childNodes[0].style.left = -c + "px";
1862 b.childNodes[0].style.top = -d + "px"
1863 }
1864 };
1865 g.determinePlayfieldDimensions = function () {
1866 g.playfieldWidth = 0;
1867 g.playfieldHeight = 0;
1868 for (var b in n) {
1869 var c = n[b];
1870 if (c.w) {
1871 c = c.x + c.w - 1;
1872 if (c > g.playfieldWidth) g.playfieldWidth = c
1873 } else {
1874 c = c.y + c.h - 1;
1875 if (c > g.playfieldHeight) g.playfieldHeight = c
1876 }
1877 }
1878 };
1879 g.preparePlayfield = function () {
1880 g.playfield = [];
1881 for (var b = 0; b <= g.playfieldHeight + 1; b++) {
1882 g.playfield[b * 8] = [];
1883 for (var c = -2; c <= g.playfieldWidth + 1; c++) g.playfield[b * 8][c * 8] = {
1884 path: 0,
1885 dot: 0,
1886 intersection: 0
1887 }
1888 }
1889 };
1890 g.preparePaths = function () {
1891 for (var b in n) {
1892 var c = n[b],
1893 d = c.type;
1894 if (c.w) {
1895 for (var f = c.y * 8, h = c.x * 8; h <= (c.x + c.w - 1) * 8; h += 8) {
1896 g.playfield[f][h].path = a;
1897 if (g.playfield[f][h].dot == 0) {
1898 g.playfield[f][h].dot = 1;
1899 g.dotsRemaining++
1900 }
1901 g.playfield[f][h].type = !d || h != c.x * 8 && h != (c.x + c.w - 1) * 8 ? d : 0
1902 }
1903 g.playfield[f][c.x * 8].intersection = a;
1904 g.playfield[f][(c.x + c.w - 1) * 8].intersection = a
1905 } else {
1906 h = c.x * 8;
1907 for (f = c.y * 8; f <= (c.y + c.h - 1) * 8; f += 8) {
1908 if (g.playfield[f][h].path) g.playfield[f][h].intersection = a;
1909 g.playfield[f][h].path = a;
1910 if (g.playfield[f][h].dot == 0) {
1911 g.playfield[f][h].dot = 1;
1912 g.dotsRemaining++
1913 }
1914 g.playfield[f][h].type = !d || f != c.y * 8 && f != (c.y + c.h - 1) * 8 ? d : 0
1915 }
1916 g.playfield[c.y * 8][h].intersection = a;
1917 g.playfield[(c.y + c.h - 1) * 8][h].intersection = a
1918 }
1919 }
1920 for (b in o) if (o[b].w) for (h = o[b].x * 8; h <= (o[b].x + o[b].w - 1) * 8; h += 8) {
1921 g.playfield[o[b].y * 8][h].dot = 0;
1922 g.dotsRemaining--
1923 } else for (f = o[b].y * 8; f <= (o[b].y + o[b].h - 1) * 8; f += 8) {
1924 g.playfield[f][o[b].x * 8].dot = 0;
1925 g.dotsRemaining--
1926 }
1927 };
1928 g.prepareAllowedDirections = function () {
1929 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) {
1930 g.playfield[b][c].allowedDir = 0;
1931 if (g.playfield[b - 8][c].path) g.playfield[b][c].allowedDir += 1;
1932 if (g.playfield[b + 8][c].path) g.playfield[b][c].allowedDir += 2;
1933 if (g.playfield[b][c - 8].path) g.playfield[b][c].allowedDir += 4;
1934 if (g.playfield[b][c + 8].path) g.playfield[b][c].allowedDir += 8
1935 }
1936 };
1937 g.createDotElements = function () {
1938 for (var b = 8; b <= g.playfieldHeight * 8; b += 8) for (var c = 8; c <= g.playfieldWidth * 8; c += 8) if (g.playfield[b][c].dot) {
1939 var d = document.createElement("div");
1940 d.className = "pcm-d";
1941 d.id = g.getDotElementId(b, c);
1942 d.style.left = c + -32 + "px";
1943 d.style.top = b + 0 + "px";
1944 g.playfieldEl.appendChild(d)
1945 }
1946 };
1947 g.createEnergizerElements = function () {
1948 for (var b in p) {
1949 var c = p[b],
1950 d = g.getDotElementId(c.y * 8, c.x * 8);
1951 document.getElementById(d).className = "pcm-e";
1952 g.prepareElement(document.getElementById(d), 0, 144);
1953 g.playfield[c.y * 8][c.x * 8].dot = 2
1954 }
1955 };
1956 g.createFruitElement = function () {
1957 g.fruitEl = document.createElement("div");
1958 g.fruitEl.id = "pcm-f";
1959 g.fruitEl.style.left = g.getPlayfieldX(v[1]) + "px";
1960 g.fruitEl.style.top = g.getPlayfieldY(v[0]) + "px";
1961 g.prepareElement(g.fruitEl, -32, -16);
1962 g.playfieldEl.appendChild(g.fruitEl)
1963 };
1964 g.createPlayfieldElements = function () {
1965 g.doorEl = document.createElement("div");
1966 g.doorEl.id = "pcm-do";
1967 g.doorEl.style.display = "none";
1968 g.playfieldEl.appendChild(g.doorEl);
1969 g.createDotElements();
1970 g.createEnergizerElements();
1971 g.createFruitElement()
1972 };
1973 g.createActors = function () {
1974 g.actors = [];
1975 for (var b = 0; b < g.playerCount + 4; b++) {
1976 g.actors[b] = new E(b);
1977 if (b < g.playerCount) {
1978 g.actors[b].ghost = e;
1979 g.actors[b].mode = 1
1980 } else g.actors[b].ghost = a
1981 }
1982 };
1983 g.restartActors = function () {
1984 for (var b in g.actors) g.actors[b].A()
1985 };
1986 g.createActorElements = function () {
1987 for (var b in g.actors) g.actors[b].createElement()
1988 };
1989 g.createPlayfield = function () {
1990 g.playfieldEl = document.createElement("div");
1991 g.playfieldEl.id = "pcm-p";
1992 g.canvasEl.appendChild(g.playfieldEl)
1993 };
1994 g.resetPlayfield = function () {
1995 g.dotsRemaining = 0;
1996 g.dotsEaten = 0;
1997 g.playfieldEl.innerHTML = "";
1998 g.prepareElement(g.playfieldEl, 256, 0);
1999 g.determinePlayfieldDimensions();
2000 g.preparePlayfield();
2001 g.preparePaths();
2002 g.prepareAllowedDirections();
2003 g.createPlayfieldElements();
2004 g.createActorElements()
2005 };
2006 g.keyPressed = function (b) {
2007 var c = e;
2008 switch (b) {
2009 case 37:
2010 g.actors[0].requestedDir = 4;
2011 c = a;
2012 break;
2013 case 38:
2014 g.actors[0].requestedDir = 1;
2015 c = a;
2016 break;
2017 case 39:
2018 g.actors[0].requestedDir = 8;
2019 c = a;
2020 break;
2021 case 40:
2022 g.actors[0].requestedDir = 2;
2023 c = a;
2024 break;
2025 case 65:
2026 if (g.playerCount == 2) {
2027 g.actors[1].requestedDir = 4;
2028 c = a
2029 }
2030 break;
2031 case 83:
2032 if (g.playerCount == 2) {
2033 g.actors[1].requestedDir = 2;
2034 c = a
2035 }
2036 break;
2037 case 68:
2038 if (g.playerCount == 2) {
2039 g.actors[1].requestedDir = 8;
2040 c = a
2041 }
2042 break;
2043 case 87:
2044 if (g.playerCount == 2) {
2045 g.actors[1].requestedDir = 1;
2046 c = a
2047 }
2048 break
2049 }
2050 return c
2051 };
2052 g.handleKeyDown = function (b) {
2053 if (!b) b = window.event;
2054 if (g.keyPressed(b.keyCode)) if (b.preventDefault) b.preventDefault();
2055 else b.returnValue = e
2056 };
2057 g.canvasClicked = function (b, c) {
2058 var d = g.getAbsoluteElPos(g.canvasEl);
2059 b -= d[1] - -32;
2060 c -= d[0] - 0;
2061 d = g.actors[0];
2062 var f = g.getPlayfieldX(d.pos[1] + d.posDelta[1]) + 16,
2063 h = g.getPlayfieldY(d.pos[0] + d.posDelta[0]) + 32,
2064 j = Math.abs(b - f),
2065 k = Math.abs(c - h);
2066 if (j > 8 && k < j) d.requestedDir = b > f ? 8 : 4;
2067 else if (k > 8 && j < k) d.requestedDir = c > h ? 2 : 1
2068 };
2069 g.handleClick = function (b) {
2070 if (!b) b = window.event;
2071 g.canvasClicked(b.clientX, b.clientY)
2072 };
2073 g.registerTouch = function () {
2074 document.body.addEventListener("touchstart", g.handleTouchStart, a);
2075 g.canvasEl.addEventListener("touchstart", g.handleTouchStart, a);
2076 document.f && document.f.q && document.f.q.addEventListener("touchstart", g.handleTouchStart, a)
2077 };
2078 g.handleTouchStart = function (b) {
2079 g.touchDX = 0;
2080 g.touchDY = 0;
2081 if (b.touches.length == 1) {
2082 g.touchStartX = b.touches[0].pageX;
2083 g.touchStartY = b.touches[0].pageY;
2084 document.body.addEventListener("touchmove", g.handleTouchMove, a);
2085 document.body.addEventListener("touchend", g.handleTouchEnd, a)
2086 }
2087 b.preventDefault();
2088 b.stopPropagation()
2089 };
2090 g.handleTouchMove = function (b) {
2091 if (b.touches.length > 1) g.cancelTouch();
2092 else {
2093 g.touchDX = b.touches[0].pageX - g.touchStartX;
2094 g.touchDY = b.touches[0].pageY - g.touchStartY
2095 }
2096 b.preventDefault();
2097 b.stopPropagation()
2098 };
2099 g.handleTouchEnd = function (b) {
2100 if (g.touchDX == 0 && g.touchDY == 0) g.canvasClicked(g.touchStartX, g.touchStartY);
2101 else {
2102 var c = Math.abs(g.touchDX),
2103 d = Math.abs(g.touchDY);
2104 if (c < 8 && d < 8) g.canvasClicked(g.touchStartX, g.touchStartY);
2105 else if (c > 15 && d < c * 2 / 3) g.actors[0].requestedDir = g.touchDX > 0 ? 8 : 4;
2106 else if (d > 15 && c < d * 2 / 3) g.actors[0].requestedDir = g.touchDY > 0 ? 2 : 1
2107 }
2108 b.preventDefault();
2109 b.stopPropagation();
2110 g.cancelTouch()
2111 };
2112 g.cancelTouch = function () {
2113 document.body.removeEventListener("touchmove", g.handleTouchMove, a);
2114 document.body.removeEventListener("touchend", g.handleTouchEnd, a);
2115 g.touchStartX = null;
2116 g.touchStartY = null
2117 };
2118 g.addEventListeners = function () {
2119 if (window.addEventListener) {
2120 window.addEventListener("keydown", g.handleKeyDown, e);
2121 g.canvasEl.addEventListener("click", g.handleClick, e);
2122 g.registerTouch()
2123 } else {
2124 document.body.attachEvent("onkeydown", g.handleKeyDown);
2125 g.canvasEl.attachEvent("onclick", g.handleClick)
2126 }
2127 };
2128 g.startGameplay = function () {
2129 g.score = [0, 0];
2130 g.extraLifeAwarded = [e, e];
2131 g.lives = 3;
2132 g.level = 0;
2133 g.paused = e;
2134 g.globalTime = 0;
2135 g.newLevel(a)
2136 };
2137 g.restartGameplay = function (b) {
2138 g.seed(0);
2139 g.frightModeTime = 0;
2140 g.intervalTime = 0;
2141 g.gameplayModeTime = 0;
2142 g.fruitTime = 0;
2143 g.ghostModeSwitchPos = 0;
2144 g.ghostModeTime = g.levels.ghostModeSwitchTimes[0] * D;
2145 g.ghostExitingPenNow = e;
2146 g.ghostEyesCount = 0;
2147 g.tilesChanged = e;
2148 g.updateCruiseElroySpeed();
2149 g.hideFruit();
2150 g.resetForcePenLeaveTime();
2151 g.restartActors();
2152 g.updateActorPositions();
2153 g.switchMainGhostMode(2, a);
2154 for (var c = g.playerCount + 1; c < g.playerCount + 4; c++) g.actors[c].a(16);
2155 g.dotEatingChannel = [0, 0];
2156 g.dotEatingSoundPart = [1, 1];
2157 g.clearDotEatingNow();
2158 b ? g.changeGameplayMode(4) : g.changeGameplayMode(6)
2159 };
2160 g.initiateDoubleMode = function () {
2161 if (g.playerCount != 2) {
2162 g.stopAllAudio();
2163 g.changeGameplayMode(12)
2164 }
2165 };
2166 g.newGame = function () {
2167 g.playerCount = 1;
2168 g.createChrome();
2169 g.createPlayfield();
2170 g.createActors();
2171 g.startGameplay()
2172 };
2173 g.switchToDoubleMode = function () {
2174 g.playerCount = 2;
2175 g.createChrome();
2176 g.createPlayfield();
2177 g.createActors();
2178 g.startGameplay()
2179 };
2180 g.insertCoin = function () {
2181 g.gameplayMode == 8 || g.gameplayMode == 14 ? g.newGame() : g.initiateDoubleMode()
2182 };
2183 g.createKillScreenElement = function (b, c, d, f, h) {
2184 var j = document.createElement("div");
2185 j.style.left = b + "px";
2186 j.style.top = c + "px";
2187 j.style.width = d + "px";
2188 j.style.height = f + "px";
2189 j.style.zIndex = 119;
2190 if (h) {
2191 j.style.background = "url(/src/pacman10-hp-sprite.png) -" + g.killScreenTileX + "px -" + g.killScreenTileY + "px no-repeat";
2192 g.killScreenTileY += 8
2193 } else j.style.background = "black";
2194 g.playfieldEl.appendChild(j)
2195 };
2196 g.killScreen = function () {
2197 g.seed(0);
2198 g.canvasEl.style.visibility = "";
2199 g.createKillScreenElement(272, 0, 200, 80, e);
2200 g.createKillScreenElement(280, 80, 192, 56, e);
2201 g.killScreenTileX = 80;
2202 g.killScreenTileY = 0;
2203 for (var b = 280; b <= 472; b += 8) for (var c = 0; c <= 136; c += 8) {
2204 if (g.rand() < 0.03) {
2205 g.killScreenTileX = Math.floor(g.rand() * 25) * 10;
2206 g.killScreenTileY = Math.floor(g.rand() * 2) * 10
2207 }
2208 g.createKillScreenElement(b, c, 8, 8, a)
2209 }
2210 g.changeGameplayMode(14)
2211 };
2212 g.newLevel = function (b) {
2213 g.level++;
2214 g.levels = g.level >= z.length ? z[z.length - 1] : z[g.level];
2215 g.levels.frightTime = Math.round(g.levels.frightTime * D);
2216 g.levels.frightTotalTime = g.levels.frightTime + g.timing[1] * (g.levels.frightBlinkCount * 2 - 1);
2217 for (var c in g.actors) g.actors[c].dotCount = 0;
2218 g.alternatePenLeavingScheme = e;
2219 g.lostLifeOnThisLevel = e;
2220 g.updateChrome();
2221 g.resetPlayfield();
2222 g.restartGameplay(b);
2223 g.level == 256 && g.killScreen()
2224 };
2225 g.newLife = function () {
2226 g.lostLifeOnThisLevel = a;
2227 g.alternatePenLeavingScheme = a;
2228 g.alternateDotCount = 0;
2229 g.lives--;
2230 g.updateChromeLives();
2231 g.lives == -1 ? g.changeGameplayMode(8) : g.restartGameplay(e)
2232 };
2233 g.switchMainGhostMode = function (b, c) {
2234 if (b == 4 && g.levels.frightTime == 0) for (var d in g.actors) {
2235 var f = g.actors[d];
2236 if (f.ghost) f.reverseDirectionsNext = a
2237 } else {
2238 f = g.mainGhostMode;
2239 if (b == 4 && g.mainGhostMode != 4) g.lastMainGhostMode = g.mainGhostMode;
2240 g.mainGhostMode = b;
2241 if (b == 4 || f == 4) g.playAmbientSound();
2242 switch (b) {
2243 case 1:
2244 case 2:
2245 g.currentPlayerSpeed = g.levels.playerSpeed * 0.8;
2246 g.currentDotEatingSpeed = g.levels.dotEatingSpeed * 0.8;
2247 break;
2248 case 4:
2249 g.currentPlayerSpeed = g.levels.playerFrightSpeed * 0.8;
2250 g.currentDotEatingSpeed = g.levels.dotEatingFrightSpeed * 0.8;
2251 g.frightModeTime = g.levels.frightTotalTime;
2252 g.modeScoreMultiplier = 1;
2253 break
2254 }
2255 for (d in g.actors) {
2256 f = g.actors[d];
2257 if (f.ghost) {
2258 if (b != 64 && !c) f.modeChangedWhileInPen = a;
2259 if (b == 4) f.eatenInThisFrightMode = e;
2260 if (f.mode != 8 && f.mode != 16 && f.mode != 32 && f.mode != 128 && f.mode != 64 || c) {
2261 if (!c && f.mode != 4 && f.mode != b) f.reverseDirectionsNext = a;
2262 f.a(b)
2263 }
2264 } else {
2265 f.fullSpeed = g.currentPlayerSpeed;
2266 f.dotEatingSpeed = g.currentDotEatingSpeed;
2267 f.tunnelSpeed = g.currentPlayerSpeed;
2268 f.d()
2269 }
2270 }
2271 }
2272 };
2273 g.figureOutPenLeaving = function () {
2274 if (g.alternatePenLeavingScheme) {
2275 g.alternateDotCount++;
2276 switch (g.alternateDotCount) {
2277 case m[1]:
2278 g.actors[g.playerCount + 1].freeToLeavePen = a;
2279 break;
2280 case m[2]:
2281 g.actors[g.playerCount + 2].freeToLeavePen = a;
2282 break;
2283 case m[3]:
2284 if (g.actors[g.playerCount + 3].mode == 16) g.alternatePenLeavingScheme = e;
2285 break
2286 }
2287 } else if (g.actors[g.playerCount + 1].mode == 16 || g.actors[g.playerCount + 1].mode == 8) {
2288 g.actors[g.playerCount + 1].dotCount++;
2289 if (g.actors[g.playerCount + 1].dotCount >= g.levels.penLeavingLimits[1]) g.actors[g.playerCount + 1].freeToLeavePen = a
2290 } else if (g.actors[g.playerCount + 2].mode == 16 || g.actors[g.playerCount + 2].mode == 8) {
2291 g.actors[g.playerCount + 2].dotCount++;
2292 if (g.actors[g.playerCount + 2].dotCount >= g.levels.penLeavingLimits[2]) g.actors[g.playerCount + 2].freeToLeavePen = a
2293 } else if (g.actors[g.playerCount + 3].mode == 16 || g.actors[g.playerCount + 3].mode == 8) {
2294 g.actors[g.playerCount + 3].dotCount++;
2295 if (g.actors[g.playerCount + 3].dotCount >= g.levels.penLeavingLimits[3]) g.actors[g.playerCount + 3].freeToLeavePen = a
2296 }
2297 };
2298 g.resetForcePenLeaveTime = function () {
2299 g.forcePenLeaveTime = g.levels.penForceTime * D
2300 };
2301 g.dotEaten = function (b, c) {
2302 g.dotsRemaining--;
2303 g.dotsEaten++;
2304 g.actors[b].c(1);
2305 g.playDotEatingSound(b);
2306 if (g.playfield[c[0]][c[1]].dot == 2) {
2307 g.switchMainGhostMode(4, e);
2308 g.addToScore(50, b)
2309 } else g.addToScore(10, b);
2310 var d = document.getElementById(g.getDotElementId(c[0], c[1]));
2311 d.style.display = "none";
2312 g.playfield[c[0]][c[1]].dot = 0;
2313 g.updateCruiseElroySpeed();
2314 g.resetForcePenLeaveTime();
2315 g.figureOutPenLeaving();
2316 if (g.dotsEaten == 70 || g.dotsEaten == 170) g.showFruit();
2317 g.dotsRemaining == 0 && g.finishLevel();
2318 g.playAmbientSound()
2319 };
2320 g.getFruitSprite = function (b) {
2321 var c = b <= 4 ? 128 : 160;
2322 b = 128 + 16 * ((b - 1) % 4);
2323 return [c, b]
2324 };
2325 g.getFruitScoreSprite = function (b) {
2326 var c = 128;
2327 b = 16 * (b - 1);
2328 return [c, b]
2329 };
2330 g.hideFruit = function () {
2331 g.fruitShown = e;
2332 g.changeElementBkPos(g.fruitEl, 32, 16, a)
2333 };
2334 g.showFruit = function () {
2335 g.fruitShown = a;
2336 var b = g.getFruitSprite(g.levels.fruit);
2337 g.changeElementBkPos(g.fruitEl, b[0], b[1], a);
2338 g.fruitTime = g.timing[15] + (g.timing[16] - g.timing[15]) * g.rand()
2339 };
2340 g.eatFruit = function (b) {
2341 if (g.fruitShown) {
2342 g.playSound("fruit", 0);
2343 g.fruitShown = e;
2344 var c = g.getFruitScoreSprite(g.levels.fruit);
2345 g.changeElementBkPos(g.fruitEl, c[0], c[1], a);
2346 g.fruitTime = g.timing[14];
2347 g.addToScore(g.levels.fruitScore, b)
2348 }
2349 };
2350 g.updateActorTargetPositions = function () {
2351 for (var b = g.playerCount; b < g.playerCount + 4; b++) g.actors[b].B()
2352 };
2353 g.moveActors = function () {
2354 for (var b in g.actors) g.actors[b].move()
2355 };
2356 g.ghostDies = function (b, c) {
2357 g.playSound("eating-ghost", 0);
2358 g.addToScore(200 * g.modeScoreMultiplier, c);
2359 g.modeScoreMultiplier *= 2;
2360 g.ghostBeingEatenId = b;
2361 g.playerEatingGhostId = c;
2362 g.changeGameplayMode(1)
2363 };
2364 g.playerDies = function (b) {
2365 g.playerDyingId = b;
2366 g.changeGameplayMode(2)
2367 };
2368 g.detectCollisions = function () {
2369 g.tilesChanged = e;
2370 for (var b = g.playerCount; b < g.playerCount + 4; b++) for (var c = 0; c < g.playerCount; c++) if (g.actors[b].tilePos[0] == g.actors[c].tilePos[0] && g.actors[b].tilePos[1] == g.actors[c].tilePos[1]) if (g.actors[b].mode == 4) {
2371 g.ghostDies(b, c);
2372 return
2373 } else g.actors[b].mode != 8 && g.actors[b].mode != 16 && g.actors[b].mode != 32 && g.actors[b].mode != 128 && g.actors[b].mode != 64 && g.playerDies(c)
2374 };
2375 g.updateCruiseElroySpeed = function () {
2376 var b = g.levels.ghostSpeed * 0.8;
2377 if (!g.lostLifeOnThisLevel || g.actors[g.playerCount + 3].mode != 16) {
2378 var c = g.levels;
2379 if (g.dotsRemaining < c.elroyDotsLeftPart2) b = c.elroySpeedPart2 * 0.8;
2380 else if (g.dotsRemaining < c.elroyDotsLeftPart1) b = c.elroySpeedPart1 * 0.8
2381 }
2382 if (b != g.cruiseElroySpeed) {
2383 g.cruiseElroySpeed = b;
2384 g.actors[g.playerCount].d()
2385 }
2386 };
2387 g.getSpeedIntervals = function (b) {
2388 if (!g.speedIntervals[b]) {
2389 var c = 0,
2390 d = 0;
2391 g.speedIntervals[b] = [];
2392 for (var f = 0; f < D; f++) {
2393 c += b;
2394 if (Math.floor(c) > d) {
2395 g.speedIntervals[b].push(a);
2396 d = Math.floor(c)
2397 } else g.speedIntervals[b].push(e)
2398 }
2399 }
2400 return g.speedIntervals[b]
2401 };
2402 g.finishLevel = function () {
2403 g.changeGameplayMode(9)
2404 };
2405 g.changeGameplayMode = function (b) {
2406 g.gameplayMode = b;
2407 if (b != 13) for (var c = 0; c < g.playerCount + 4; c++) g.actors[c].b();
2408 switch (b) {
2409 case 0:
2410 g.playAmbientSound();
2411 break;
2412 case 2:
2413 g.stopAllAudio();
2414 g.gameplayModeTime = g.timing[3];
2415 break;
2416 case 3:
2417 g.playerDyingId == 0 ? g.playSound("death", 0) : g.playSound("death-double", 0);
2418 g.gameplayModeTime = g.timing[4];
2419 break;
2420 case 6:
2421 g.canvasEl.style.visibility = "hidden";
2422 g.gameplayModeTime = g.timing[5];
2423 break;
2424 case 7:
2425 g.stopAllAudio();
2426 g.canvasEl.style.visibility = "";
2427 g.doorEl.style.display = "block";
2428 b = document.createElement("div");
2429 b.id = "pcm-re";
2430 g.prepareElement(b, 160, 0);
2431 g.playfieldEl.appendChild(b);
2432 g.gameplayModeTime = g.timing[6];
2433 break;
2434 case 4:
2435 g.doorEl.style.display = "block";
2436 b = document.createElement("div");
2437 b.id = "pcm-re";
2438 g.prepareElement(b, 160, 0);
2439 g.playfieldEl.appendChild(b);
2440 g.gameplayModeTime = g.timing[7];
2441 g.stopAllAudio();
2442 g.playerCount == 2 ? g.playSound("start-music-double", 0, a) : g.playSound("start-music", 0, a);
2443 break;
2444 case 5:
2445 g.lives--;
2446 g.updateChromeLives();
2447 g.gameplayModeTime = g.timing[8];
2448 break;
2449 case 8:
2450 case 14:
2451 b = document.getElementById("pcm-re");
2452 google.dom.remove(b);
2453 g.stopAllAudio();
2454 b = document.createElement("div");
2455 b.id = "pcm-go";
2456 g.prepareElement(b, 8, 152);
2457 g.playfieldEl.appendChild(b);
2458 g.gameplayModeTime = g.timing[9];
2459 break;
2460 case 9:
2461 g.stopAllAudio();
2462 g.gameplayModeTime = g.timing[10];
2463 break;
2464 case 10:
2465 g.doorEl.style.display = "none";
2466 g.gameplayModeTime = g.timing[11];
2467 break;
2468 case 11:
2469 g.canvasEl.style.visibility = "hidden";
2470 g.gameplayModeTime = g.timing[12];
2471 break;
2472 case 12:
2473 g.playfieldEl.style.visibility = "hidden";
2474 g.gameplayModeTime = g.timing[13];
2475 break;
2476 case 1:
2477 g.gameplayModeTime =
2478 g.timing[2];
2479 break;
2480 case 13:
2481 g.startCutscene();
2482 break
2483 }
2484 };
2485 g.showChrome = function (b) {
2486 g.showElementById("pcm-sc-1-l", b);
2487 g.showElementById("pcm-sc-2-l", b);
2488 g.showElementById("pcm-sc-1", b);
2489 g.showElementById("pcm-sc-2", b);
2490 g.showElementById("pcm-li", b);
2491 g.showElementById("pcm-so", b)
2492 };
2493 g.startCutscene = function () {
2494 g.playfieldEl.style.visibility = "hidden";
2495 g.canvasEl.style.visibility = "";
2496 g.showChrome(e);
2497 g.cutsceneCanvasEl = document.createElement("div");
2498 g.cutsceneCanvasEl.id = "pcm-cc";
2499 g.canvasEl.appendChild(g.cutsceneCanvasEl);
2500 g.cutscene = B[g.cutsceneId];
2501 g.cutsceneSequenceId = -1;
2502 g.frightModeTime = g.levels.frightTotalTime;
2503 g.cutsceneActors = [];
2504 for (var b in g.cutscene.actors) {
2505 var c = g.cutscene.actors[b].id;
2506 if (c > 0) c += g.playerCount - 1;
2507 var d = document.createElement("div");
2508 d.className = "pcm-ac";
2509 d.id = "actor" + c;
2510 g.prepareElement(d, 0, 0);
2511 c = new E(c);
2512 c.el = d;
2513 c.elBackgroundPos = [0, 0];
2514 c.elPos = [0, 0];
2515 c.pos = [g.cutscene.actors[b].y * 8, g.cutscene.actors[b].x * 8];
2516 c.posDelta = [0, 0];
2517 c.ghost = g.cutscene.actors[b].ghost;
2518 g.cutsceneCanvasEl.appendChild(d);
2519 g.cutsceneActors.push(c)
2520 }
2521 g.cutsceneNextSequence();
2522 g.stopAllAudio();
2523 g.playAmbientSound()
2524 };
2525 g.stopCutscene = function () {
2526 g.playfieldEl.style.visibility = "";
2527 google.dom.remove(g.cutsceneCanvasEl);
2528 g.showChrome(a);
2529 g.newLevel(e)
2530 };
2531 g.cutsceneNextSequence = function () {
2532 g.cutsceneSequenceId++;
2533 if (g.cutscene.sequence.length == g.cutsceneSequenceId) g.stopCutscene();
2534 else {
2535 var b = g.cutscene.sequence[g.cutsceneSequenceId];
2536 g.cutsceneTime = b.time * D;
2537 for (var c in g.cutsceneActors) {
2538 var d = g.cutsceneActors[c];
2539 d.dir = b.moves[c].dir;
2540 d.speed = b.moves[c].speed;
2541 if (b.moves[c].elId) d.el.id = b.moves[c].elId;
2542 if (b.moves[c].mode) d.mode = b.moves[c].mode;
2543 d.b()
2544 }
2545 }
2546 };
2547 g.checkCutscene = function () {
2548 g.cutsceneTime <= 0 && g.cutsceneNextSequence()
2549 };
2550 g.advanceCutscene = function () {
2551 for (var b in g.cutsceneActors) {
2552 var c = g.cutsceneActors[b],
2553 d = l[c.dir];
2554 c.pos[d.axis] += d.increment * c.speed;
2555 c.b()
2556 }
2557 g.cutsceneTime--
2558 };
2559 g.updateActorPositions = function () {
2560 for (var b in g.actors) g.actors[b].k()
2561 };
2562 g.blinkEnergizers = function () {
2563 switch (g.gameplayMode) {
2564 case 4:
2565 case 5:
2566 case 6:
2567 case 7:
2568 case 9:
2569 case 10:
2570 case 11:
2571 case 12:
2572 g.playfieldEl.className = "";
2573 break;
2574 case 8:
2575 case 14:
2576 g.playfieldEl.className = "blk";
2577 break;
2578 default:
2579 if (g.globalTime % (g.timing[0] * 2) == 0) g.playfieldEl.className = "";
2580 else if (g.globalTime % (g.timing[0] * 2) == g.timing[0]) g.playfieldEl.className = "blk";
2581 break
2582 }
2583 };
2584 g.blinkScoreLabels = function () {
2585 if (g.gameplayMode != 13) {
2586 var b = "";
2587 if (g.globalTime % (g.timing[17] * 2) == 0) b = "visible";
2588 else if (g.globalTime % (g.timing[17] * 2) == g.timing[17]) b = "hidden";
2589 if (b) for (var c = 0; c < g.playerCount; c++) g.scoreLabelEl[c].style.visibility = b
2590 }
2591 };
2592 g.finishFrightMode = function () {
2593 g.switchMainGhostMode(g.lastMainGhostMode, e)
2594 };
2595 g.handleGameplayModeTimer = function () {
2596 if (g.gameplayModeTime) {
2597 g.gameplayModeTime--;
2598 switch (g.gameplayMode) {
2599 case 2:
2600 case 3:
2601 for (var b = 0; b < g.playerCount + 4; b++) g.actors[b].b();
2602 break;
2603 case 10:
2604 Math.floor(g.gameplayModeTime / (g.timing[11] / 8)) % 2 == 0 ? g.changeElementBkPos(g.playfieldEl, 322, 2, e) : g.changeElementBkPos(g.playfieldEl, 322, 138, e)
2605 }
2606 if (g.gameplayModeTime <= 0) {
2607 g.gameplayModeTime = 0;
2608 switch (g.gameplayMode) {
2609 case 1:
2610 g.changeGameplayMode(0);
2611 g.ghostEyesCount++;
2612 g.playAmbientSound();
2613 g.actors[g.ghostBeingEatenId].el.className = "pcm-ac";
2614 g.actors[g.ghostBeingEatenId].a(8);
2615 var c = e;
2616 for (b = g.playerCount; b < g.playerCount + 4; b++) if (g.actors[b].mode == 4 || (g.actors[b].mode == 16 || g.actors[b].mode == 128) && !g.actors[b].eatenInThisFrightMode) {
2617 c = a;
2618 break
2619 }
2620 c || g.finishFrightMode();
2621 break;
2622 case 2:
2623 g.changeGameplayMode(3);
2624 break;
2625 case 3:
2626 g.newLife();
2627 break;
2628 case 4:
2629 g.changeGameplayMode(5);
2630 break;
2631 case 6:
2632 g.changeGameplayMode(7);
2633 break;
2634 case 7:
2635 case 5:
2636 b = document.getElementById("pcm-re");
2637 google.dom.remove(b);
2638 g.changeGameplayMode(0);
2639 break;
2640 case 8:
2641 b = document.getElementById("pcm-go");
2642 google.dom.remove(b);
2643 google.pacManQuery && google.pacManQuery();
2644 break;
2645 case 9:
2646 g.changeGameplayMode(10);
2647 break;
2648 case 10:
2649 g.changeGameplayMode(11);
2650 break;
2651 case 11:
2652 if (g.levels.cutsceneId) {
2653 g.cutsceneId = g.levels.cutsceneId;
2654 g.changeGameplayMode(13)
2655 } else {
2656 g.canvasEl.style.visibility = "";
2657 g.newLevel(e)
2658 }
2659 break;
2660 case 12:
2661 g.playfieldEl.style.visibility = "";
2662 g.canvasEl.style.visibility = "";
2663 g.switchToDoubleMode();
2664 break
2665 }
2666 }
2667 }
2668 };
2669 g.handleFruitTimer = function () {
2670 if (g.fruitTime) {
2671 g.fruitTime--;
2672 g.fruitTime <= 0 && g.hideFruit()
2673 }
2674 };
2675 g.handleGhostModeTimer = function () {
2676 if (g.frightModeTime) {
2677 g.frightModeTime--;
2678 if (g.frightModeTime <= 0) {
2679 g.frightModeTime = 0;
2680 g.finishFrightMode()
2681 }
2682 } else if (g.ghostModeTime > 0) {
2683 g.ghostModeTime--;
2684 if (g.ghostModeTime <= 0) {
2685 g.ghostModeTime = 0;
2686 g.ghostModeSwitchPos++;
2687 if (g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]) {
2688 g.ghostModeTime = g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos] * D;
2689 switch (g.mainGhostMode) {
2690 case 2:
2691 g.switchMainGhostMode(1, e);
2692 break;
2693 case 1:
2694 g.switchMainGhostMode(2, e);
2695 break
2696 }
2697 }
2698 }
2699 }
2700 };
2701 g.handleForcePenLeaveTimer = function () {
2702 if (g.forcePenLeaveTime) {
2703 g.forcePenLeaveTime--;
2704 if (g.forcePenLeaveTime <= 0) {
2705 for (var b = 1; b <= 3; b++) if (g.actors[g.playerCount + b].mode == 16) {
2706 g.actors[g.playerCount + b].freeToLeavePen = a;
2707 break
2708 }
2709 g.resetForcePenLeaveTime()
2710 }
2711 }
2712 };
2713 g.handleTimers = function () {
2714 if (g.gameplayMode == 0) {
2715 g.handleForcePenLeaveTimer();
2716 g.handleFruitTimer();
2717 g.handleGhostModeTimer()
2718 }
2719 g.handleGameplayModeTimer()
2720 };
2721 g.tick = function () {
2722 var b = (new Date).getTime();
2723 g.lastTimeDelta += b - g.lastTime - g.tickInterval;
2724 if (g.lastTimeDelta > 100) g.lastTimeDelta = 100;
2725 if (g.canDecreaseFps && g.lastTimeDelta > 50) {
2726 g.lastTimeSlownessCount++;
2727 g.lastTimeSlownessCount == 20 && g.decreaseFps()
2728 }
2729 var c = 0;
2730 if (g.lastTimeDelta > g.tickInterval) {
2731 c = Math.floor(g.lastTimeDelta / g.tickInterval);
2732 g.lastTimeDelta -= g.tickInterval * c
2733 }
2734 g.lastTime = b;
2735 if (g.gameplayMode == 13) {
2736 for (b = 0; b < g.tickMultiplier + c; b++) {
2737 g.advanceCutscene();
2738 g.intervalTime = (g.intervalTime + 1) % D;
2739 g.globalTime++
2740 }
2741 g.checkCutscene();
2742 g.blinkScoreLabels()
2743 } else for (b = 0; b < g.tickMultiplier + c; b++) {
2744 g.moveActors();
2745 if (g.gameplayMode == 0) if (g.tilesChanged) {
2746 g.detectCollisions();
2747 g.updateActorTargetPositions()
2748 }
2749 g.globalTime++;
2750 g.intervalTime = (g.intervalTime + 1) % D;
2751 g.blinkEnergizers();
2752 g.blinkScoreLabels();
2753 g.handleTimers()
2754 }
2755 };
2756 g.extraLife = function (b) {
2757 g.playSound("extra-life", 0);
2758 g.extraLifeAwarded[b] = a;
2759 g.lives++;
2760 if (g.lives > 5) g.lives = 5;
2761 g.updateChromeLives()
2762 };
2763 g.addToScore = function (b, c) {
2764 g.score[c] += b;
2765 !g.extraLifeAwarded[c] && g.score[c] > 1E4 && g.extraLife(c);
2766 g.updateChromeScore(c)
2767 };
2768 g.updateChrome = function () {
2769 g.updateChromeLevel();
2770 g.updateChromeLives();
2771 for (var b = 0; b < g.playerCount; b++) g.updateChromeScore(b)
2772 };
2773 g.updateChromeScore = function (b) {
2774 var c = g.score[b].toString();
2775 if (c.length > g.scoreDigits) c = c.substr(c.length - g.scoreDigits, g.scoreDigits);
2776 for (var d = 0; d < g.scoreDigits; d++) {
2777 var f = document.getElementById("pcm-sc-" + (b + 1) + "-" + d),
2778 h = c.substr(d, 1);
2779 h ? g.changeElementBkPos(f, 8 + 8 * parseInt(h, 10), 144, a) : g.changeElementBkPos(f, 48, 0, a)
2780 }
2781 };
2782 g.updateChromeLives = function () {
2783 g.livesEl.innerHTML = "";
2784 for (var b = 0; b < g.lives; b++) {
2785 var c = document.createElement("div");
2786 c.className = "pcm-lif";
2787 g.prepareElement(c, 64, 129);
2788 g.livesEl.appendChild(c)
2789 }
2790 };
2791 g.updateChromeLevel = function () {
2792 g.levelEl.innerHTML = "";
2793 for (var b = g.level; b >= Math.max(g.level - 4 + 1, 1); b--) {
2794 var c = b >= z.length ? z[z.length - 1].fruit : z[b].fruit,
2795 d = document.createElement("div");
2796 c = g.getFruitSprite(c);
2797 g.prepareElement(d, c[0], c[1]);
2798 g.levelEl.appendChild(d)
2799 }
2800 g.levelEl.style.marginTop = (4 - Math.min(g.level, 4)) * 16 + "px"
2801 };
2802 g.createChrome = function () {
2803 g.canvasEl.innerHTML = "";
2804 g.scoreDigits = g.playerCount == 1 ? 10 : 5;
2805 g.scoreLabelEl = [];
2806 g.scoreLabelEl[0] = document.createElement("div");
2807 g.scoreLabelEl[0].id = "pcm-sc-1-l";
2808 g.prepareElement(g.scoreLabelEl[0], 160, 56);
2809 g.canvasEl.appendChild(g.scoreLabelEl[0]);
2810 g.scoreEl = [];
2811 g.scoreEl[0] = document.createElement("div");
2812 g.scoreEl[0].id = "pcm-sc-1";
2813 for (var b = 0; b < g.scoreDigits; b++) {
2814 var c = document.createElement("div");
2815 c.id = "pcm-sc-1-" + b;
2816 c.style.top = b * 8 + "px";
2817 c.style.left = 0;
2818 c.style.position = "absolute";
2819 c.style.width = "8px";
2820 c.style.height = "8px";
2821 g.prepareElement(c, 48, 0);
2822 g.scoreEl[0].appendChild(c)
2823 }
2824 g.canvasEl.appendChild(g.scoreEl[0]);
2825 g.livesEl = document.createElement("div");
2826 g.livesEl.id = "pcm-li";
2827 g.canvasEl.appendChild(g.livesEl);
2828 g.levelEl = document.createElement("div");
2829 g.levelEl.id = "pcm-le";
2830 g.canvasEl.appendChild(g.levelEl);
2831 if (g.playerCount == 2) {
2832 g.scoreLabelEl[1] = document.createElement("div");
2833 g.scoreLabelEl[1].id = "pcm-sc-2-l";
2834 g.prepareElement(g.scoreLabelEl[1], 160, 64);
2835 g.canvasEl.appendChild(g.scoreLabelEl[1]);
2836 g.scoreEl[1] = document.createElement("div");
2837 g.scoreEl[1].id = "pcm-sc-2";
2838 for (b = 0; b < g.scoreDigits; b++) {
2839 c = document.createElement("div");
2840 c.id = "pcm-sc-2-" + b;
2841 c.style.top = b * 8 + "px";
2842 c.style.left = 0;
2843 c.style.position = "absolute";
2844 c.style.width = "8px";
2845 c.style.height = "8px";
2846 g.prepareElement(c, 48, 0);
2847 g.scoreEl[1].appendChild(c)
2848 }
2849 g.canvasEl.appendChild(g.scoreEl[1])
2850 }
2851 };
2852 g.clearDotEatingNow = function () {
2853 g.dotEatingNow = [e, e];
2854 g.dotEatingNext = [e, e]
2855 };
2856 g.playSound = function (b, c, d) {
2857 if (!(!g.soundAvailable || !g.soundEnabled || g.paused)) {
2858 d || g.stopSoundChannel(c);
2859 try {
2860 g.flashSoundPlayer.playTrack(b, c)
2861 } catch (f) {
2862 g.soundAvailable = e
2863 }
2864 }
2865 };
2866 g.stopSoundChannel = function (b) {
2867 if (g.soundAvailable && g.soundEnabled) try {
2868 g.flashSoundPlayer.stopChannel(b)
2869 } catch (c) {
2870 g.soundAvailable = e
2871 }
2872 };
2873 g.stopAllAudio = function () {
2874 if (g.soundAvailable && g.soundEnabled) {
2875 try {
2876 g.flashSoundPlayer.stopAmbientTrack()
2877 } catch (b) {
2878 g.soundAvailable = e
2879 }
2880 for (var c = 0; c < 5; c++) g.stopSoundChannel(c)
2881 }
2882 };
2883 g.playDotEatingSound = function (b) {
2884 if (g.soundAvailable && g.soundEnabled) if (g.gameplayMode == 0) if (g.dotEatingNow[b]) g.dotEatingNext[b] = a;
2885 else {
2886 if (b == 0) {
2887 var c = g.dotEatingSoundPart[b] == 1 ? "eating-dot-1" : "eating-dot-2";
2888 g.playSound(c, 1 + g.dotEatingChannel[b], a);
2889 g.dotTimer = window.setInterval(g.repeatDotEatingSoundPacMan, 150)
2890 } else {
2891 g.playSound("eating-dot-double", 3 + g.dotEatingChannel[b], a);
2892 g.dotTimerMs = window.setInterval(g.repeatDotEatingSoundMsPacMan, 150)
2893 }
2894 g.dotEatingChannel[b] = (g.dotEatingChannel[b] + 1) % 2;
2895 g.dotEatingSoundPart[b] =
2896 3 - g.dotEatingSoundPart[b]
2897 }
2898 };
2899 g.repeatDotEatingSound = function (b) {
2900 g.dotEatingNow[b] = e;
2901 if (g.dotEatingNext[b]) {
2902 g.dotEatingNext[b] = e;
2903 g.playDotEatingSound(b)
2904 }
2905 };
2906 g.repeatDotEatingSoundPacMan = function () {
2907 g.repeatDotEatingSound(0)
2908 };
2909 g.repeatDotEatingSoundMsPacMan = function () {
2910 g.repeatDotEatingSound(1)
2911 };
2912 g.playAmbientSound = function () {
2913 if (g.soundAvailable && g.soundEnabled) {
2914 var b = 0;
2915 if (g.gameplayMode == 0 || g.gameplayMode == 1) b = g.ghostEyesCount ? "ambient-eyes" : g.mainGhostMode == 4 ? "ambient-fright" : g.dotsEaten > 241 ? "ambient-4" : g.dotsEaten > 207 ? "ambient-3" : g.dotsEaten > 138 ? "ambient-2" : "ambient-1";
2916 else if (g.gameplayMode == 13) b = "cutscene";
2917 if (b) try {
2918 g.flashSoundPlayer.playAmbientTrack(b)
2919 } catch (c) {
2920 g.soundAvailable = e
2921 }
2922 }
2923 };
2924 g.initializeTickTimer = function () {
2925 window.clearInterval(g.tickTimer);
2926 g.fps = C[g.fpsChoice];
2927 g.tickInterval = 1E3 / g.fps;
2928 g.tickMultiplier = D / g.fps;
2929 g.timing = {};
2930 for (var b in w) {
2931 var c = !g.soundEnabled && (b == 7 || b == 8) ? 1 : w[b];
2932 g.timing[b] = Math.round(c * D)
2933 }
2934 g.lastTime = (new Date).getTime();
2935 g.lastTimeDelta = 0;
2936 g.lastTimeSlownessCount = 0;
2937 g.tickTimer = window.setInterval(g.tick, g.tickInterval)
2938 };
2939 g.decreaseFps = function () {
2940 if (g.fpsChoice < C.length - 1) {
2941 g.fpsChoice++;
2942 g.initializeTickTimer();
2943 if (g.fpsChoice == C.length - 1) g.canDecreaseFps = e
2944 }
2945 };
2946 g.addCss = function () {
2947 var b = "#pcm-c { width: 554px; border-top: 25px solid black; padding-bottom: 25px; height: 136px; position: relative; background: black; outline: 0; overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}#pcm-c * { position: absolute; overflow: hidden;}#pcm-p,#pcm-cc { left: 45px; width: 464px; height: 136px; z-index: 99; overflow: hidden;}#pcm-p .pcm-d { width: 2px; height: 2px; margin-left: 3px; margin-top: 3px; background: #f8b090; z-index: 100;}#pcm-p .pcm-e { width: 8px; height: 8px; z-index: 101;}#pcm-sc-1 { left: 18px; top: 16px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-sc-2 { left: 18px; top: 80px; width: 8px; height: 56px; position: absolute; overflow: hidden;}#pcm-le { position: absolute; left: 515px; top: 74px; height: 64px; width: 32px;} #pcm-le div { position: relative;}#pcm-sc-1-l { left: -2px; top: 0; width: 48px; height: 8px;}#pcm-sc-2-l { left: -2px; top: 64px; width: 48px; height: 8px;}#pcm-so { left: 7px; top: 116px; width: 12px; height: 12px; border: 8px solid black; cursor: pointer;}#pcm-li { position: absolute; left: 523px; top: 0; height: 80px; width: 16px;}#pcm-li .pcm-lif { position: relative; width: 16px; height: 12px; margin-bottom: 3px;}#pcm-p.blk .pcm-e { visibility: hidden;}#pcm-c .pcm-ac { width: 16px; height: 16px; margin-left: -4px; margin-top: -4px; z-index: 110;}#pcm-c .pcm-n { z-index: 111;}#pcm-c #pcm-stck { z-index: 109;}#pcm-c #pcm-gbug { width: 32px;}#pcm-c #pcm-bpcm { width: 32px; height: 32px; margin-left: -20px; margin-top: -20px;}#pcm-f,#pcm-le div { width: 32px; height: 16px; z-index: 105;}#pcm-f { margin-left: -8px; margin-top: -4px;}#pcm-do { width: 19px; height: 2px; left: 279px; top: 46px; overflow: hidden; position: absolute; background: #ffaaa5;}#pcm-re { width: 48px; height: 8px; z-index: 120; left: 264px; top: 80px;}#pcm-go { width: 80px; height: 8px; z-index: 120; left: 248px; top: 80px;}";
2948 g.styleElement =
2949 document.createElement("style");
2950 g.styleElement.type = "text/css";
2951 if (g.styleElement.styleSheet) g.styleElement.styleSheet.cssText = b;
2952 else g.styleElement.appendChild(document.createTextNode(b));
2953 document.getElementsByTagName("head")[0].appendChild(g.styleElement)
2954 };
2955 g.createCanvasElement = function () {
2956 g.canvasEl = document.createElement("div");
2957 g.canvasEl.id = "pcm-c";
2958 g.canvasEl.hideFocus = a;
2959 document.getElementById("logo").appendChild(g.canvasEl);
2960 g.canvasEl.tabIndex = 0;
2961 g.canvasEl.focus()
2962 };
2963 g.everythingIsReady = function () {
2964 if (!g.ready) {
2965 g.ready = a;
2966 var b = document.getElementById("logo-l");
2967 google.dom.remove(b);
2968 document.getElementById("logo").style.background = "black";
2969 g.addCss();
2970 g.createCanvasElement();
2971 g.speedIntervals = [];
2972 g.oppositeDirections = [];
2973 g.oppositeDirections[1] = 2;
2974 g.oppositeDirections[2] = 1;
2975 g.oppositeDirections[4] = 8;
2976 g.oppositeDirections[8] = 4;
2977 g.addEventListeners();
2978 g.fpsChoice = 0;
2979 g.canDecreaseFps = a;
2980 g.initializeTickTimer();
2981 g.newGame()
2982 }
2983 };
2984 g.checkIfEverythingIsReady = function () {
2985 if (g.soundReady || g.graphicsReady) g.updateLoadingProgress(0.67);
2986 if (g.soundReady && g.graphicsReady) {
2987 g.updateLoadingProgress(1);
2988 g.everythingIsReady()
2989 }
2990 };
2991 g.preloadImage = function (b) {
2992 var c = new Image,
2993 d = google.browser.engine.IE;
2994 if (!d) c.onload = g.imageLoaded;
2995 c.src = b;
2996 d && g.imageLoaded()
2997 };
2998 g.imageLoaded = function () {
2999 g.graphicsReady = a;
3000 g.checkIfEverythingIsReady()
3001 };
3002 g.prepareGraphics = function () {
3003 g.graphicsReady = e;
3004 g.preloadImage("/src/pacman10-hp-sprite.png")
3005 };
3006 g.trimString = function (b) {
3007 return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "")
3008 };
3009 g.g = function (b, c) {
3010 if (b < c) return -1;
3011 else if (b > c) return 1;
3012 return 0
3013 };
3014 g.compareVersions = function (b, c) {
3015 for (var d = 0, f = g.trimString(String(b)).split("."), h = g.trimString(String(c)).split("."), j = Math.max(f.length, h.length), k = 0; d == 0 && k < j; k++) {
3016 var x = f[k] || "",
3017 F = h[k] || "",
3018 G = new RegExp("(\\d*)(\\D*)", "g"),
3019 H = new RegExp("(\\d*)(\\D*)", "g");
3020 do {
3021 var t = G.exec(x) || ["", "", ""],
3022 u = H.exec(F) || ["", "", ""];
3023 if (t[0].length == 0 && u[0].length == 0) break;
3024 d = t[1].length == 0 ? 0 : parseInt(t[1], 10);
3025 var I = u[1].length == 0 ? 0 : parseInt(u[1], 10);
3026 d = g.g(d, I) || g.g(t[2].length == 0, u[2].length == 0) || g.g(t[2], u[2])
3027 } while (d == 0)
3028 }
3029 return d
3030 };
3031 g.getFlashVersion = function (b) {
3032 b = b.match(/[\d]+/g);
3033 b.length = 3;
3034 return b.join(".")
3035 };
3036 g.detectFlash = function () {
3037 var b = e,
3038 c = "";
3039 if (navigator.plugins && navigator.plugins.length) {
3040 var d = navigator.plugins["Shockwave Flash"];
3041 if (d) {
3042 b = a;
3043 if (d.description) c = g.getFlashVersion(d.description)
3044 }
3045 if (navigator.plugins["Shockwave Flash 2.0"]) {
3046 b = a;
3047 c = "2.0.0.11"
3048 }
3049 } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
3050 if (b = (d = navigator.mimeTypes["application/x-shockwave-flash"]) && d.enabledPlugin) {
3051 c = d.enabledPlugin.description;
3052 c = g.getFlashVersion(c)
3053 }
3054 } else try {
3055 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
3056 b = a;
3057 c = g.getFlashVersion(d.GetVariable("$version"))
3058 } catch (f) {
3059 try {
3060 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
3061 b = a;
3062 c = "6.0.21"
3063 } catch (h) {
3064 try {
3065 d = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
3066 b = a;
3067 c = g.getFlashVersion(d.GetVariable("$version"))
3068 } catch (j) {}
3069 }
3070 }
3071 g.hasFlash = b;
3072 g.flashVersion = c
3073 };
3074 g.isFlashVersion = function (b) {
3075 return g.compareVersions(g.flashVersion, b) >= 0
3076 };
3077 g.prepareSound = function () {
3078 g.soundAvailable = e;
3079 g.soundEnabled = e;
3080 g.soundReady = e;
3081 g.detectFlash();
3082 if (!g.hasFlash || !g.isFlashVersion("9.0.0.0")) {
3083 g.soundReady = a;
3084 g.checkIfEverythingIsReady()
3085 } else {
3086 g.flashIframe = document.createElement("iframe");
3087 g.flashIframe.name = "pm-sound";
3088 g.flashIframe.style.position = "absolute";
3089 g.flashIframe.style.left = "-150px";
3090 g.flashIframe.style.top = "-150px";
3091 g.flashIframe.style.border = 0;
3092 g.flashIframe.style.width = "100px";
3093 g.flashIframe.style.height = "100px";
3094 google.dom.append(g.flashIframe);
3095 g.flashIframeDoc = g.flashIframe.contentDocument;
3096 if (g.flashIframeDoc == undefined || g.flashIframeDoc == null) g.flashIframeDoc = g.flashIframe.contentWindow.document;
3097 g.flashIframeDoc.open();
3098 g.flashIframeDoc.write('<html><head></head><body><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="pacman-sound-player" type="application/x-shockwave-flash"> <param name="movie" value="src/swf/pacman10-hp-sound.swf"> <object id="pacman-sound-player-2" type="application/x-shockwave-flash" data="src/swf/pacman10-hp-sound.swf" width="0" height="0"></object></object></body></html>');
3099 g.flashIframeDoc.close();
3100 window.setTimeout(g.flashNotReady, 3E3)
3101 }
3102 };
3103 g.flashNotReady = function () {
3104 if (!g.ready) {
3105 g.soundAvailable = e;
3106 g.soundEnabled = e;
3107 g.soundReady = a;
3108 g.checkIfEverythingIsReady()
3109 }
3110 };
3111 g.flashReady = function (b) {
3112 g.flashSoundPlayer = b;
3113 g.soundAvailable = a;
3114 g.soundEnabled = a;
3115 g.soundReady = a;
3116 g.checkIfEverythingIsReady()
3117 };
3118 g.flashLoaded = function () {
3119 if (g.flashIframeDoc) {
3120 var b = g.flashIframeDoc.getElementById("pacman-sound-player");
3121 if (b && b.playTrack) {
3122 g.flashReady(b);
3123 return
3124 } else if ((b = g.flashIframeDoc.getElementById("pacman-sound-player-2")) && b.playTrack) {
3125 g.flashReady(b);
3126 return
3127 }
3128 }
3129 g.flashNotReady()
3130 };
3131 g.destroy = function () {
3132 if (google.pacman) {
3133 g.stopAllAudio();
3134 window.clearInterval(g.tickTimer);
3135 window.clearInterval(g.dotTimer);
3136 window.clearInterval(g.dotTimerMs);
3137 google.dom.remove(g.styleElement);
3138 google.dom.remove(g.flashIframe);
3139 google.dom.remove(g.canvasEl);
3140 google.pacman = undefined
3141 }
3142 };
3143 g.exportFunctionCalls = function () {
3144 google.pacman = {};
3145 google.pacman.insertCoin = g.insertCoin;
3146 google.pacman.flashLoaded = g.flashLoaded;
3147 google.pacman.destroy = g.destroy
3148 };
3149 g.updateLoadingProgress = function (b) {
3150 b = Math.round(b * 200);
3151 document.getElementById("logo-b").style.width = b + "px"
3152 };
3153 g.init = function () {
3154 g.ready = e;
3155 document.getElementById("logo").title = "";
3156 g.updateLoadingProgress(0.33);
3157 g.exportFunctionCalls();
3158 g.useCss = navigator.userAgent.indexOf("MSIE 5.") != -1 || navigator.userAgent.indexOf("MSIE 6.") != -1 || navigator.userAgent.indexOf("MSIE 7.") != -1 ? e : a;
3159 g.prepareGraphics();
3160 g.prepareSound()
3161 };
3162 g.init();
3163}(); \ No newline at end of file
diff --git a/pacman-google/src/pacman10-hp-sprite-2.png b/pacman-google/src/pacman10-hp-sprite-2.png
new file mode 100644
index 0000000..7354b9d
--- /dev/null
+++ b/pacman-google/src/pacman10-hp-sprite-2.png
Binary files differ
diff --git a/pacman-google/src/pacman10-hp-sprite.png b/pacman-google/src/pacman10-hp-sprite.png
new file mode 100644
index 0000000..8ab4790
--- /dev/null
+++ b/pacman-google/src/pacman10-hp-sprite.png
Binary files differ
diff --git a/pacman-google/src/pacman10-hp.gif b/pacman-google/src/pacman10-hp.gif
new file mode 100644
index 0000000..056e5dc
--- /dev/null
+++ b/pacman-google/src/pacman10-hp.gif
Binary files differ
diff --git a/pacman-google/src/pacman10-hp.png b/pacman-google/src/pacman10-hp.png
new file mode 100644
index 0000000..ffb5d37
--- /dev/null
+++ b/pacman-google/src/pacman10-hp.png
Binary files differ
diff --git a/pacman-google/src/swf/pacman10-hp-sound.swf b/pacman-google/src/swf/pacman10-hp-sound.swf
new file mode 100644
index 0000000..0786781
--- /dev/null
+++ b/pacman-google/src/swf/pacman10-hp-sound.swf
Binary files differ