Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 208.84 KB | None | 0 0
  1. var A = window;
  2. var E = document;
  3.  
  4. var debugMode = false;
  5.  
  6. var posX, posY;
  7. var lastX, lastY;
  8.  
  9. var lastFrame;
  10. var currentFrame;
  11.  
  12. var initialLoad = true;
  13. var buttonIndex = 0;
  14. var maxButtons = 20;
  15. var buttons = new Array(maxButtons);
  16. for (var i = 0; i < maxButtons; i++)
  17. buttons[i] = new Array(3);
  18.  
  19. var auraEnabled = false;
  20. var auraTime = 0;
  21. var auraRadius = 10;
  22.  
  23. var markerEnabled = false;
  24.  
  25. var movementEnabled = true;
  26.  
  27. var imageScale = 1.0;
  28. var imgData = [ [17,49,17,57],
  29. [18,44,18,52],
  30. [18,55,18,59],
  31. [19,41,19,46],
  32. [19,58,19,60],
  33. [20,40,20,42],
  34. [20,60,20,62],
  35. [21,38,21,40],
  36. [21,61,21,63],
  37. [22,37,22,39],
  38. [22,62,22,64],
  39. [23,37,23,38],
  40. [23,63,23,65],
  41. [24,36,24,37],
  42. [24,64,24,65],
  43. [25,35,25,37],
  44. [25,65,25,66],
  45. [26,34,26,36],
  46. [26,65,26,67],
  47. [27,33,27,35],
  48. [27,66,27,67],
  49. [28,32,28,34],
  50. [28,67,28,68],
  51. [29,32,29,34],
  52. [29,67,29,68],
  53. [30,31,30,33],
  54. [30,67,30,69],
  55. [31,31,31,32],
  56. [31,68,31,69],
  57. [32,31,32,32],
  58. [32,68,32,69],
  59. [33,30,33,31],
  60. [33,55,33,59],
  61. [33,68,33,69],
  62. [34,30,34,31],
  63. [34,53,34,58],
  64. [34,59,34,61],
  65. [34,68,34,70],
  66. [35,29,35,31],
  67. [35,52,35,57],
  68. [35,61,35,62],
  69. [35,69,35,70],
  70. [36,29,36,30],
  71. [36,50,36,57],
  72. [36,62,36,63],
  73. [36,69,36,70],
  74. [37,29,37,30],
  75. [37,50,37,58],
  76. [37,62,37,63],
  77. [37,69,37,70],
  78. [38,28,38,30],
  79. [38,49,38,58],
  80. [38,69,38,71],
  81. [38,108,38,115],
  82. [39,28,39,29],
  83. [39,49,39,57],
  84. [39,63,39,64],
  85. [39,70,39,71],
  86. [39,107,39,110],
  87. [39,114,39,116],
  88. [40,28,40,35],
  89. [40,48,40,57],
  90. [40,63,40,64],
  91. [40,70,40,71],
  92. [40,107,40,109],
  93. [40,116,40,117],
  94. [41,27,41,32],
  95. [41,35,41,36],
  96. [41,48,41,57],
  97. [41,63,41,64],
  98. [41,70,41,71],
  99. [41,107,41,108],
  100. [41,117,41,118],
  101. [42,26,42,32],
  102. [42,36,42,37],
  103. [42,48,42,56],
  104. [42,62,42,64],
  105. [42,70,42,72],
  106. [42,107,42,108],
  107. [42,118,42,119],
  108. [43,25,43,32],
  109. [43,36,43,38],
  110. [43,41,43,42],
  111. [43,48,43,56],
  112. [43,62,43,63],
  113. [43,70,43,72],
  114. [43,107,43,108],
  115. [43,118,43,119],
  116. [44,25,44,32],
  117. [44,37,44,38],
  118. [44,40,44,41],
  119. [44,47,44,55],
  120. [44,61,44,63],
  121. [44,71,44,72],
  122. [44,107,44,108],
  123. [44,118,44,119],
  124. [45,24,45,32],
  125. [45,37,45,40],
  126. [45,48,45,50],
  127. [45,59,45,62],
  128. [45,71,45,72],
  129. [45,107,45,108],
  130. [45,118,45,119],
  131. [46,24,46,32],
  132. [46,37,46,40],
  133. [46,49,46,51],
  134. [46,58,46,60],
  135. [46,71,46,72],
  136. [46,107,46,108],
  137. [46,119,46,120],
  138. [47,23,47,32],
  139. [47,37,47,39],
  140. [47,50,47,53],
  141. [47,55,47,58],
  142. [47,71,47,73],
  143. [47,107,47,108],
  144. [47,119,47,120],
  145. [48,23,48,31],
  146. [48,36,48,39],
  147. [48,52,48,56],
  148. [48,72,48,73],
  149. [48,107,48,108],
  150. [48,119,48,120],
  151. [49,23,49,30],
  152. [49,35,49,38],
  153. [49,62,49,65],
  154. [49,72,49,73],
  155. [49,106,49,108],
  156. [49,119,49,120],
  157. [50,24,50,29],
  158. [50,34,50,38],
  159. [50,43,50,46],
  160. [50,61,50,64],
  161. [50,72,50,74],
  162. [50,106,50,108],
  163. [50,119,50,120],
  164. [51,24,51,28],
  165. [51,32,51,34],
  166. [51,36,51,37],
  167. [51,40,51,42],
  168. [51,45,51,46],
  169. [51,58,51,62],
  170. [51,72,51,74],
  171. [51,106,51,108],
  172. [51,119,51,120],
  173. [52,25,52,32],
  174. [52,36,52,37],
  175. [52,45,52,46],
  176. [52,56,52,60],
  177. [52,73,52,74],
  178. [52,106,52,108],
  179. [52,119,52,120],
  180. [53,26,53,28],
  181. [53,35,53,37],
  182. [53,44,53,46],
  183. [53,55,53,58],
  184. [53,73,53,74],
  185. [53,106,53,107],
  186. [53,119,53,120],
  187. [54,26,54,27],
  188. [54,36,54,38],
  189. [54,41,54,45],
  190. [54,52,54,56],
  191. [54,73,54,75],
  192. [54,106,54,107],
  193. [54,119,54,120],
  194. [55,26,55,27],
  195. [55,37,55,44],
  196. [55,50,55,54],
  197. [55,74,55,75],
  198. [55,106,55,107],
  199. [55,119,55,120],
  200. [56,26,56,27],
  201. [56,47,56,51],
  202. [56,74,56,75],
  203. [56,106,56,107],
  204. [56,119,56,120],
  205. [57,26,57,27],
  206. [57,45,57,49],
  207. [57,74,57,76],
  208. [57,106,57,107],
  209. [57,119,57,120],
  210. [58,26,58,27],
  211. [58,42,58,46],
  212. [58,74,58,76],
  213. [58,106,58,107],
  214. [58,115,58,116],
  215. [58,118,58,119],
  216. [59,26,59,28],
  217. [59,39,59,44],
  218. [59,75,59,76],
  219. [59,105,59,107],
  220. [59,118,59,119],
  221. [60,27,60,28],
  222. [60,37,60,41],
  223. [60,75,60,77],
  224. [60,105,60,106],
  225. [60,118,60,119],
  226. [60,124,60,125],
  227. [61,27,61,28],
  228. [61,33,61,38],
  229. [61,76,61,77],
  230. [61,105,61,106],
  231. [61,117,61,118],
  232. [61,123,61,127],
  233. [62,27,62,28],
  234. [62,30,62,35],
  235. [62,76,62,78],
  236. [62,104,62,106],
  237. [62,116,62,118],
  238. [62,122,62,124],
  239. [62,126,62,128],
  240. [63,27,63,28],
  241. [63,30,63,31],
  242. [63,77,63,78],
  243. [63,98,63,102],
  244. [63,104,63,105],
  245. [63,116,63,117],
  246. [63,121,63,123],
  247. [63,126,63,128],
  248. [64,27,64,28],
  249. [64,77,64,79],
  250. [64,95,64,105],
  251. [64,116,64,118],
  252. [64,119,64,121],
  253. [64,126,64,128],
  254. [65,27,65,29],
  255. [65,68,65,69],
  256. [65,78,65,79],
  257. [65,92,65,96],
  258. [65,103,65,105],
  259. [65,115,65,120],
  260. [65,123,65,126],
  261. [65,127,65,128],
  262. [66,28,66,29],
  263. [66,63,66,64],
  264. [66,68,66,70],
  265. [66,78,66,80],
  266. [66,91,66,93],
  267. [66,103,66,104],
  268. [66,117,66,118],
  269. [66,127,66,128],
  270. [67,28,67,29],
  271. [67,63,67,64],
  272. [67,69,67,70],
  273. [67,79,67,80],
  274. [67,89,67,91],
  275. [67,103,67,104],
  276. [67,126,67,128],
  277. [68,28,68,29],
  278. [68,64,68,65],
  279. [68,69,68,70],
  280. [68,79,68,81],
  281. [68,87,68,89],
  282. [68,102,68,104],
  283. [68,120,68,131],
  284. [69,28,69,29],
  285. [69,69,69,70],
  286. [69,80,69,82],
  287. [69,87,69,88],
  288. [69,102,69,103],
  289. [69,122,69,132],
  290. [70,29,70,30],
  291. [70,70,70,71],
  292. [70,80,70,82],
  293. [70,85,70,87],
  294. [70,101,70,113],
  295. [70,132,70,133],
  296. [71,29,71,30],
  297. [71,65,71,66],
  298. [71,70,71,71],
  299. [71,81,71,83],
  300. [71,85,71,86],
  301. [71,91,71,92],
  302. [71,99,71,116],
  303. [71,132,71,133],
  304. [72,29,72,30],
  305. [72,65,72,66],
  306. [72,70,72,71],
  307. [72,81,72,85],
  308. [72,91,72,94],
  309. [72,97,72,100],
  310. [72,115,72,118],
  311. [72,132,72,134],
  312. [73,29,73,30],
  313. [73,70,73,72],
  314. [73,81,73,85],
  315. [73,94,73,99],
  316. [73,118,73,120],
  317. [73,132,73,133],
  318. [74,29,74,30],
  319. [74,71,74,72],
  320. [74,81,74,84],
  321. [74,95,74,98],
  322. [74,119,74,120],
  323. [74,132,74,133],
  324. [75,30,75,31],
  325. [75,66,75,67],
  326. [75,71,75,72],
  327. [75,82,75,84],
  328. [75,94,75,96],
  329. [75,120,75,121],
  330. [75,128,75,129],
  331. [75,131,75,133],
  332. [76,30,76,31],
  333. [76,66,76,67],
  334. [76,71,76,72],
  335. [76,83,76,84],
  336. [76,89,76,90],
  337. [76,94,76,95],
  338. [76,121,76,122],
  339. [76,124,76,125],
  340. [76,129,76,132],
  341. [77,30,77,31],
  342. [77,72,77,73],
  343. [77,83,77,84],
  344. [77,93,77,94],
  345. [77,121,77,123],
  346. [77,129,77,132],
  347. [78,30,78,32],
  348. [78,67,78,68],
  349. [78,72,78,73],
  350. [78,84,78,85],
  351. [78,92,78,93],
  352. [78,122,78,123],
  353. [78,125,78,129],
  354. [79,30,79,32],
  355. [79,67,79,68],
  356. [79,72,79,73],
  357. [79,85,79,86],
  358. [79,91,79,93],
  359. [79,122,79,128],
  360. [80,31,80,32],
  361. [80,67,80,68],
  362. [80,72,80,74],
  363. [80,91,80,92],
  364. [80,122,80,123],
  365. [81,31,81,33],
  366. [81,73,81,74],
  367. [81,91,81,92],
  368. [81,123,81,124],
  369. [82,31,82,33],
  370. [82,68,82,69],
  371. [82,73,82,74],
  372. [82,102,82,103],
  373. [82,123,82,124],
  374. [83,32,83,33],
  375. [83,68,83,69],
  376. [83,73,83,74],
  377. [83,101,83,102],
  378. [83,123,83,124],
  379. [84,32,84,33],
  380. [84,68,84,69],
  381. [84,73,84,74],
  382. [84,123,84,124],
  383. [85,32,85,34],
  384. [85,69,85,70],
  385. [85,73,85,74],
  386. [85,123,85,124],
  387. [86,33,86,35],
  388. [86,69,86,70],
  389. [86,74,86,75],
  390. [86,123,86,124],
  391. [87,34,87,35],
  392. [87,74,87,75],
  393. [87,123,87,124],
  394. [88,34,88,36],
  395. [88,70,88,71],
  396. [88,75,88,76],
  397. [88,122,88,124],
  398. [89,35,89,36],
  399. [89,70,89,71],
  400. [89,75,89,81],
  401. [89,122,89,123],
  402. [90,35,90,37],
  403. [90,71,90,72],
  404. [90,81,90,84],
  405. [90,121,90,123],
  406. [91,36,91,37],
  407. [91,71,91,72],
  408. [91,84,91,85],
  409. [91,121,91,122],
  410. [92,36,92,38],
  411. [92,70,92,71],
  412. [92,84,92,85],
  413. [92,121,92,122],
  414. [93,37,93,39],
  415. [93,70,93,71],
  416. [93,76,93,78],
  417. [93,83,93,85],
  418. [93,120,93,122],
  419. [94,38,94,39],
  420. [94,69,94,70],
  421. [94,77,94,83],
  422. [94,120,94,121],
  423. [95,38,95,40],
  424. [95,69,95,70],
  425. [95,73,95,74],
  426. [95,77,95,78],
  427. [95,119,95,121],
  428. [96,39,96,41],
  429. [96,69,96,70],
  430. [96,73,96,74],
  431. [96,77,96,78],
  432. [96,104,96,105],
  433. [96,119,96,120],
  434. [97,40,97,41],
  435. [97,69,97,70],
  436. [97,73,97,75],
  437. [97,77,97,78],
  438. [97,118,97,120],
  439. [98,40,98,42],
  440. [98,69,98,70],
  441. [98,73,98,76],
  442. [98,78,98,79],
  443. [98,117,98,119],
  444. [99,41,99,43],
  445. [99,69,99,70],
  446. [99,73,99,74],
  447. [99,75,99,78],
  448. [99,108,99,109],
  449. [99,117,99,118],
  450. [100,42,100,44],
  451. [100,69,100,71],
  452. [100,72,100,73],
  453. [100,76,100,78],
  454. [100,116,100,118],
  455. [101,43,101,45],
  456. [101,70,101,72],
  457. [101,115,101,117],
  458. [102,43,102,45],
  459. [102,114,102,116],
  460. [103,44,103,46],
  461. [103,113,103,115],
  462. [104,45,104,47],
  463. [104,111,104,114],
  464. [105,46,105,48],
  465. [105,109,105,113],
  466. [106,47,106,48],
  467. [106,107,106,111],
  468. [107,48,107,49],
  469. [107,101,107,109],
  470. [108,48,108,51],
  471. [108,101,108,105],
  472. [109,49,109,52],
  473. [109,103,109,104],
  474. [110,51,110,54],
  475. [110,96,110,98],
  476. [110,103,110,104],
  477. [111,52,111,55],
  478. [111,94,111,98],
  479. [111,103,111,104],
  480. [112,54,112,57],
  481. [112,92,112,95],
  482. [112,97,112,98],
  483. [112,103,112,104],
  484. [113,55,113,59],
  485. [113,90,113,93],
  486. [113,97,113,99],
  487. [113,103,113,105],
  488. [114,57,114,61],
  489. [114,87,114,92],
  490. [114,98,114,99],
  491. [114,103,114,105],
  492. [115,59,115,65],
  493. [115,83,115,90],
  494. [115,98,115,99],
  495. [115,104,115,105],
  496. [116,61,116,87],
  497. [116,98,116,99],
  498. [116,104,116,105],
  499. [117,66,117,82],
  500. [117,98,117,100],
  501. [117,104,117,105],
  502. [118,70,118,71],
  503. [118,74,118,75],
  504. [118,99,118,100],
  505. [118,104,118,106],
  506. [119,70,119,71],
  507. [119,74,119,76],
  508. [119,91,119,93],
  509. [119,99,119,100],
  510. [119,105,119,106],
  511. [120,70,120,71],
  512. [120,74,120,76],
  513. [120,88,120,101],
  514. [120,105,120,106],
  515. [121,70,121,71],
  516. [121,74,121,76],
  517. [121,88,121,90],
  518. [121,98,121,101],
  519. [121,105,121,107],
  520. [122,70,122,71],
  521. [122,74,122,76],
  522. [122,89,122,91],
  523. [122,106,122,107],
  524. [123,69,123,71],
  525. [123,74,123,76],
  526. [123,90,123,92],
  527. [123,106,123,107],
  528. [124,69,124,71],
  529. [124,74,124,75],
  530. [124,91,124,94],
  531. [124,106,124,107],
  532. [125,69,125,71],
  533. [125,74,125,75],
  534. [125,92,125,95],
  535. [125,106,125,107],
  536. [126,69,126,70],
  537. [126,75,126,76],
  538. [126,94,126,97],
  539. [126,106,126,108],
  540. [127,69,127,70],
  541. [127,75,127,76],
  542. [127,96,127,99],
  543. [127,107,127,108],
  544. [128,69,128,71],
  545. [128,74,128,76],
  546. [128,98,128,103],
  547. [128,107,128,108],
  548. [129,69,129,71],
  549. [129,74,129,75],
  550. [129,101,129,108],
  551. [130,58,130,63],
  552. [130,70,130,71],
  553. [130,74,130,75],
  554. [131,57,131,59],
  555. [131,63,131,66],
  556. [131,69,131,71],
  557. [131,74,131,75],
  558. [132,58,132,59],
  559. [132,65,132,68],
  560. [132,69,132,71],
  561. [132,74,132,75],
  562. [133,58,133,60],
  563. [133,67,133,71],
  564. [133,74,133,75],
  565. [134,59,134,61],
  566. [134,68,134,70],
  567. [134,74,134,75],
  568. [135,60,135,62],
  569. [135,74,135,75],
  570. [136,61,136,63],
  571. [136,73,136,75],
  572. [137,62,137,65],
  573. [137,73,137,75],
  574. [138,64,138,66],
  575. [138,73,138,74],
  576. [139,65,139,68],
  577. [139,72,139,74],
  578. [140,67,140,74],
  579. [141,70,141,73],
  580. ];
  581.  
  582. var fontSize = 2;
  583. var letterOffset = 0;
  584. var alphabet = new Array(200);
  585. alphabet[58] = [
  586. [0,0,0,1],
  587. [2,0,2,1]
  588. ];
  589. alphabet[40] = [
  590. [0,2,1,0],
  591. [2,2,1,0]
  592. ];
  593. alphabet[41] = [
  594. [0,0,1,2],
  595. [2,0,1,2]
  596. ];
  597. alphabet[63] = [
  598. [1,0,0,0],
  599. [0,0,0,2],
  600. [0,2,1,2],
  601. [1,2,1,1],
  602. [1,1,2,1]
  603. ];
  604. alphabet[97] = [
  605. [2,0,0,0],
  606. [0,0,0,2],
  607. [0,2,2,2],
  608. [1,0,1,2]
  609. ];
  610. alphabet[98] = [
  611. [2,0,0,0],
  612. [0,0,0,2],
  613. [0,2,2,2],
  614. [2,2,2,0],
  615. [1,0,1,2]
  616. ];
  617. alphabet[99] = [
  618. [2,2,2,0],
  619. [2,0,0,0],
  620. [0,0,0,2]
  621. ];
  622. alphabet[100] = [
  623. [2,0,0,0],
  624. [0,0,0,1],
  625. [0,1,1,2],
  626. [1,2,2,1],
  627. [2,1,2,0]
  628. ];
  629. alphabet[101] = [
  630. [2,2,2,0],
  631. [2,0,0,0],
  632. [0,0,0,2],
  633. [1,0,1,2]
  634. ];
  635. alphabet[102] = [
  636. [2,0,0,0],
  637. [0,0,0,2],
  638. [1,0,1,2]
  639. ];
  640. alphabet[103] = [
  641. [1,1,1,2],
  642. [1,2,2,2],
  643. [2,2,2,0],
  644. [2,0,0,0],
  645. [0,0,0,2]
  646. ];
  647. alphabet[104] = [
  648. [0,0,2,0],
  649. [0,2,2,2],
  650. [1,0,1,2]
  651. ];
  652. alphabet[105] = [
  653. [0,0,0,2],
  654. [0,1,2,1],
  655. [2,0,2,2]
  656. ];
  657. alphabet[106] = [
  658. [0,0,0,2],
  659. [0,1,2,1],
  660. [2,0,2,1]
  661. ];
  662. alphabet[107] = [
  663. [0,0,2,0],
  664. [1,0,0,2],
  665. [1,0,2,2]
  666. ];
  667. alphabet[108] = [
  668. [0,0,2,0],
  669. [2,0,2,2]
  670. ];
  671. alphabet[109] = [
  672. [0,0,2,0],
  673. [0,0,2,1],
  674. [2,1,0,2],
  675. [0,2,2,2]
  676. ];
  677. alphabet[110] = [
  678. [0,0,2,0],
  679. [0,0,2,2],
  680. [0,2,2,2]
  681. ];
  682. alphabet[111] = [
  683. [2,0,0,0],
  684. [0,0,0,2],
  685. [0,2,2,2],
  686. [2,2,2,0]
  687. ];
  688. alphabet[112] = [
  689. [2,0,0,0],
  690. [0,0,0,2],
  691. [0,2,1,2],
  692. [1,2,1,0]
  693. ];
  694. alphabet[113] = [
  695. [2,0,0,0],
  696. [0,0,0,2],
  697. [0,2,2,2],
  698. [2,2,2,0],
  699. [1,1,2,2]
  700. ];
  701. alphabet[114] = [
  702. [2,0,0,0],
  703. [0,0,0,2],
  704. [0,2,1,2],
  705. [1,2,1,0],
  706. [1,1,2,2]
  707. ];
  708. alphabet[115] = [
  709. [0,0,0,2],
  710. [1,0,1,2],
  711. [2,0,2,2],
  712. [0,0,1,0],
  713. [1,2,2,2]
  714. ];
  715. alphabet[116] = [
  716. [0,0,0,2],
  717. [0,1,2,1]
  718. ];
  719. alphabet[117] = [
  720. [0,0,2,0],
  721. [0,2,2,2],
  722. [2,0,2,2]
  723. ];
  724. alphabet[118] = [
  725. [0,0,2,1],
  726. [0,2,2,1]
  727. ];
  728. alphabet[119] = [
  729. [0,0,2,0],
  730. [0,2,2,2],
  731. [2,0,1,1],
  732. [2,2,1,1]
  733. ];
  734. alphabet[120] = [
  735. [0,0,2,2],
  736. [2,0,0,2]
  737. ];
  738. alphabet[121] = [
  739. [0,0,1,1],
  740. [0,2,1,1],
  741. [1,1,2,1]
  742. ];
  743. alphabet[122] = [
  744. [0,0,0,2],
  745. [0,2,2,0],
  746. [2,0,2,2]
  747. ];
  748.  
  749.  
  750. function sa(f) {
  751. return f << 1
  752. }
  753.  
  754. function ta(f) {
  755. return f << 1
  756. }
  757.  
  758. function U() {
  759. //return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y
  760. }
  761.  
  762. function ba() {
  763. a.fillStyle = "#000000";
  764. a.font = "35px NovaSquare";
  765. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  766. a.font = "16px NovaSquare";
  767. a.fillText("Play the game on http://cursors.io/", 400 - a.measureText("Play the game on http://cursors.io/").width /
  768. 2, 330);
  769. top.location = "http://cursors.io";
  770. throw "Please do not embed our website, thank you.";
  771. }
  772.  
  773. function ua(f) {
  774. V(f)
  775. }
  776.  
  777. // Apparently unimportant
  778. function W(f, b) {
  779. J = f;
  780. K = b;
  781. k = v = f;
  782. q = w = b;
  783. B = v << 1;
  784. C = w << 1
  785. }
  786.  
  787. // Handles clicking
  788. function va(f) {
  789. if (D) return L = !1, V(f), !1;
  790. //U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  791. if (L) L = !1, Q();
  792. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  793. else if (100 < t - ca && v == k && w == q) {
  794. ca = t;
  795. I.push([v << 1, w << 1, t]);
  796. wa(v, w, 10);
  797. var b = [v, w];
  798. N.push(b);
  799. setTimeout(function() {
  800. N.remove(b)
  801. }, 1E3)
  802. }
  803. return !1
  804. }
  805.  
  806. // Apparently unimportant
  807. function xa(f) {
  808. Y = !1
  809. }
  810.  
  811. // Sets local storage for cursor lock and drawing
  812. function ya() {
  813. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"))
  814. }
  815.  
  816. // Handles mouse movement and drawing
  817. function V(f) {
  818. if (U()) {
  819. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  820. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  821. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1)
  822. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  823. k = v, q = w; /* Changed to allow movement through walls */
  824. lastX = posX;
  825. lastY = posY;
  826. posX = k;
  827. posY = q;
  828. if (debugMode) console.log(v + ", " + w);
  829. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  830. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  831. b = R;
  832. f = S;
  833. var a = k,
  834. d = q;
  835. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  836. var g = new ArrayBuffer(9),
  837. e = new DataView(g);
  838.  
  839. e.setUint8(0, 3);
  840. e.setUint16(1, b, !0);
  841. e.setUint16(3, f, !0);
  842. e.setUint16(5, a, !0);
  843. e.setUint16(7, d, !0);
  844. u.send(g)
  845.  
  846. if (markerEnabled) {
  847. e.setUint8(0, 3);
  848. e.setUint16(1, b+2, !0);
  849. e.setUint16(3, f, !0);
  850. e.setUint16(5, a+2, !0);
  851. e.setUint16(7, d, !0);
  852. u.send(g)
  853. e.setUint8(0, 3);
  854. e.setUint16(1, b, !0);
  855. e.setUint16(3, f+2, !0);
  856. e.setUint16(5, a, !0);
  857. e.setUint16(7, d+2, !0);
  858. u.send(g)
  859. e.setUint8(0, 3);
  860. e.setUint16(1, b-2, !0);
  861. e.setUint16(3, f, !0);
  862. e.setUint16(5, a-2, !0);
  863. e.setUint16(7, d, !0);
  864. u.send(g)
  865. e.setUint8(0, 3);
  866. e.setUint16(1, b, !0);
  867. e.setUint16(3, f-2, !0);
  868. e.setUint16(5, a, !0);
  869. e.setUint16(7, d-2, !0);
  870. u.send(g)
  871. }
  872. }
  873. R = k;
  874. S = q;
  875. da = t
  876. }
  877. }
  878.  
  879. // Apparently not important
  880. function Z() {
  881. ea(k, q) && Q();
  882. if (z(k, q)) {
  883. var a;
  884. a: {
  885. a = k;
  886. var b = q,
  887. c = [],
  888. d = new Uint8Array(12E4);
  889. c.push([a, b]);
  890. d[a + 400 * b] = 1;
  891. do {
  892. var g = c.shift(),
  893. e = g[0],
  894. g = g[1];
  895. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  896. if (!z(e, g)) {
  897. a = {
  898. x: e,
  899. y: g
  900. };
  901. break a
  902. }
  903. d[e -
  904. 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  905. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  906. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  907. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1)
  908. }
  909. } while (0 < c.length);
  910. a = {
  911. x: a,
  912. y: b
  913. }
  914. }
  915. k = a.x;
  916. q = a.y
  917. }
  918. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  919. ea(k, q) && Q()
  920. }
  921.  
  922. // Cleans up map on level transition
  923. function $() {
  924. console.log("Next map");
  925. initialLoad = true;
  926. for (var i = 0; i < maxButtons; i++)
  927. buttons[i] = new Array(3);
  928. buttonIndex = 0;
  929. T.set(za);
  930. r = [];
  931. I = [];
  932. O = []
  933. }
  934.  
  935. // Enables image smoothing
  936. function ga(f) {
  937. a.imageSmoothingEnabled = f;
  938. a.mozImageSmoothingEnabled = f;
  939. a.oImageSmoothingEnabled = f;
  940. a.webkitImageSmoothingEnabled = f
  941. }
  942.  
  943. // Prints connected message
  944. function Aa() {
  945. $();
  946. console.log("Connected!")
  947. }
  948.  
  949. // Prints socket closed message
  950. function Ba(a) {
  951. $();
  952. console.log("Socket closed: " + a.reason)
  953. }
  954.  
  955. // Prints socket error message
  956. function Ca(a) {
  957. console.log("Socket error")
  958. }
  959.  
  960. // Gets strings, but without it the map won't load
  961. function Da(a, b) {
  962. for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0);
  963. 0 != d && (c += String.fromCharCode(d));
  964. return [c, b + 1]
  965. }
  966.  
  967. // You get a TERRIBLE framerate if you remove the contents of this function
  968. function Ea(a, b) {
  969. setTimeout(function() {
  970. var c = a.getUint16(b, !0),
  971. d = 0;
  972. a: for (; d < c; d++) {
  973. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  974. var l = N[n];
  975. if (l[0] == g && l[1] == e) {
  976. N.splice(n, 1);
  977. continue a
  978. }
  979. }
  980. I.push([g << 1, e << 1, t])
  981. }
  982. }, 100);
  983. return b +
  984. 2 + 4 * a.getUint16(b, !0)
  985. }
  986.  
  987. // Apparently not important
  988. function Fa(a, b) {
  989. !H.checked && setTimeout(function() {
  990. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  991. var g = a.getUint16(b + 2 + 8 * d, !0),
  992. e = a.getUint16(b + 4 + 8 * d, !0),
  993. n = a.getUint16(b + 6 + 8 * d, !0),
  994. l = a.getUint16(b + 8 + 8 * d, !0);
  995. O.push([g << 1, e << 1, n << 1, l << 1, t])
  996. }
  997. }, 50);
  998. return b + 2 + 8 * a.getUint16(b, !0)
  999. }
  1000.  
  1001. // Draws the level. Or at least, without it the level doesn't show up.
  1002. function Ga(a) {
  1003. buttonIndex = 0;
  1004. initialLoad = false;
  1005. a = a.data;
  1006. var b = new DataView(a);
  1007. switch (b.getUint8(0)) {
  1008. case 0: // If this doesn't run then you see two of your cursor. One of them lags behind
  1009. ha = b.getUint32(1, !0);
  1010. break;
  1011. case 1: // Without this, doors don't show up
  1012. var c;
  1013. ia = c = b.getUint16(1, !0);
  1014. ja = 100 <= c;
  1015. var d = [],
  1016. g;
  1017. for (g in F) F.hasOwnProperty(g) && d.push(g);
  1018. for (var e =
  1019. 0; e < c; e++) {
  1020. g = b.getUint32(3 + 8 * e, !0);
  1021. var n = b.getUint16(7 + 8 * e, !0),
  1022. l = b.getUint16(9 + 8 * e, !0);
  1023. if (g != ha)
  1024. if (null != F[g]) {
  1025. for (var p = 0; p < d.length; p++)
  1026. if (d[p] == g) {
  1027. d.splice(p, 1);
  1028. break
  1029. }
  1030. g = F[g];
  1031. g.oldX = g.getX();
  1032. g.oldY = g.getY();
  1033. g.newX = n;
  1034. g.newY = l;
  1035. g.time = t
  1036. } else F[g] = new ka(n, l)
  1037. }
  1038. for (e = 0; e < d.length; e++) delete F[d[e]];
  1039. c = Ea(b, 3 + 8 * c);
  1040. g = b.getUint16(c, !0);
  1041. c += 2;
  1042. for (d = 0; d < g; d++) {
  1043. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  1044. if (r[e].id == n) {
  1045. var k = r[e];
  1046. if (1 == k.type)
  1047. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  1048. for (var h =
  1049. n; h < n + p; ++h) --T[h + 400 * m];
  1050. r.splice(e, 1);
  1051. break a
  1052. }c += 4
  1053. }
  1054. g = b.getUint16(c, !0);
  1055. c += 2;
  1056. for (d = 0; d < g; d++) {
  1057. a: {
  1058. e = b.getUint32(c, !0);
  1059. for (n = 0; n < r.length; n++)
  1060. if (r[n].id == e) {
  1061. e = r[n];
  1062. break a
  1063. }
  1064. e = {
  1065. id: e
  1066. };
  1067. r.push(e)
  1068. }
  1069. c += 4;c = la(b, c, e)
  1070. }
  1071. c = Fa(b, c);
  1072. if (a.byteLength < c + 4) break;
  1073. aa = b.getUint32(c, !0);
  1074. break;
  1075. case 4: // Without this the level don't show
  1076. $();
  1077. W(b.getUint16(1, !0), b.getUint16(3, !0));
  1078. g = b.getUint16(5, !0);
  1079. c = 7;
  1080. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  1081. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  1082. Z();
  1083. break;
  1084. case 5: // Without this things don't trigger unless you are drawing. Also, you can't click buttons.
  1085. W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z()
  1086. }
  1087. }
  1088.  
  1089. // Without this, your position only updates if you click or draw
  1090. function Q() {
  1091. lastFrame = currentFrame;
  1092. currentFrame = new Date().getTime();
  1093.  
  1094. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  1095. var a = new ArrayBuffer(9);
  1096. b = new DataView(a);
  1097. b.setUint8(0, 1);
  1098. b.setUint16(1, k, !0);
  1099. b.setUint16(3, q, !0);
  1100. b.setUint32(5, G, !0);
  1101. u.send(a);
  1102. J = k;
  1103. K = q
  1104. }
  1105.  
  1106. if (auraEnabled) // Drawing cursor aura
  1107. drawAura(J, K);
  1108. }
  1109.  
  1110. // Without this clicking doesn't actually get transmitted to the server
  1111. function wa(a, b, numClicks) {
  1112. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  1113. var c = new ArrayBuffer(9),
  1114. d = new DataView(c);
  1115. d.setUint8(0, 2);
  1116. d.setUint16(1, a, !0);
  1117. d.setUint16(3, b, !0);
  1118. d.setUint32(5, G, !0);
  1119. for (var i = 0; i < numClicks; i++) { u.send(c) } // Changed to click multiple times
  1120. }
  1121. }
  1122.  
  1123. function la(f, b, c) {
  1124. function d() { // Handles drawing stuff
  1125. if (c.type == 4 && initialLoad) {
  1126. c.x = f.getUint16(b, !0);
  1127. buttons[buttonIndex][0] = c.x
  1128. b += 2;
  1129. c.y = f.getUint16(b, !0);
  1130. buttons[buttonIndex][1] = c.y
  1131. b += 2;
  1132. c.width = f.getUint16(b, !0);
  1133. b += 2;
  1134. c.height = f.getUint16(b, !0);
  1135. b += 2
  1136.  
  1137. buttonIndex++;
  1138. } else {
  1139. c.x = f.getUint16(b, !0);
  1140. b += 2;
  1141. c.y = f.getUint16(b, !0);
  1142. b += 2;
  1143. c.width = f.getUint16(b, !0);
  1144. b += 2;
  1145. c.height = f.getUint16(b, !0);
  1146. b += 2
  1147. }
  1148. }
  1149. function g() { // Handles coloring stuff
  1150. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  1151. b += 4;
  1152. c.color = "#" + a
  1153. }
  1154. var e = f.getUint8(b);
  1155. b += 1;
  1156. c.type = e;
  1157. switch (e) {
  1158. case 255:
  1159. break;
  1160. case 0: // Draws text
  1161. c.x = f.getUint16(b, !0);
  1162. b += 2;
  1163. c.y = f.getUint16(b, !0);
  1164. b += 2;
  1165. c.size = f.getUint8(b);
  1166. b += 1;
  1167. c.isCentered = !!f.getUint8(b);
  1168. b += 1;
  1169. e = Da(f, b);
  1170. c.text = e[0];
  1171. b = e[1];
  1172. break;
  1173. case 1: // May relate to cursor movement?
  1174. d();
  1175. var n = !c.color;
  1176. g();
  1177. var e = c.x | 0,
  1178. l = c.y | 0,
  1179. p = c.width | 0,
  1180. k = c.height | 0;
  1181. if (n)
  1182. for (n = l; n < l + k; ++n)
  1183. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  1184. break;
  1185. case 2: // Draws exit points
  1186. d();
  1187. c.isBad = !!f.getUint8(b);
  1188. b += 1;
  1189. break;
  1190. case 3: // Handles the area triggers
  1191. d();
  1192. c.count = f.getUint16(b, !0);
  1193. b += 2;
  1194. g();
  1195. break;
  1196. case 4: // Something about buttons, but also affects doors and area triggers
  1197. d();
  1198. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  1199. c.count = f.getUint16(b, !0);
  1200. if (initialLoad) buttons[buttonIndex-1][2] = 1;
  1201. b += 2;
  1202. g();
  1203. break;
  1204. case 5:
  1205. c.x = f.getUint16(b, !0);
  1206. b += 2;
  1207. c.y = f.getUint16(b, !0);
  1208. b += 2;
  1209. c.queue = [
  1210. [0, c.x, c.y]
  1211. ];
  1212. c.potentialQueue = [];
  1213. c.explored = new Uint8Array(12E4);
  1214. c.img = a.createImageData(400, 300);
  1215. e = E.createElement("canvas");
  1216. e.width = 400;
  1217. e.height = 300;
  1218. c.canvas = e;
  1219. c.ctx = c.canvas.getContext("2d");
  1220. break;
  1221. default:
  1222. throw Error("Unknown object type " + e);
  1223. }
  1224. return b
  1225. }
  1226.  
  1227. function ea(a, b) {
  1228. if (-1 != J && -1 != K) {
  1229. var c = fa(J, K, a, b);
  1230. if (c.x != a || c.y != b) return !0
  1231. }
  1232. for (c = 0; c < r.length; c++) {
  1233. var d = r[c];
  1234. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0
  1235. }
  1236. return !1
  1237. }
  1238.  
  1239. function ma() {
  1240. a.clearRect(0, 0, 800, 600);
  1241. a.save();
  1242. if (null != u && u.readyState != WebSocket.OPEN || L) {
  1243. var f;
  1244. if (null == u) f = "Click to begin";
  1245. else switch (u.readyState) {
  1246. case WebSocket.CONNECTING:
  1247. f = "Connecting";
  1248. break;
  1249. case WebSocket.CLOSING:
  1250. case WebSocket.CLOSED:
  1251. f = "Lost connection to server";
  1252. break;
  1253. default:
  1254. f = "Click to begin"
  1255. }
  1256. a.font = "60px NovaSquare";
  1257. a.fillText(f, 400 - a.measureText(f).width / 2, 315);
  1258. na();
  1259. oa(!1)
  1260. } else {
  1261. a.fillStyle = "#000000";
  1262. a.save();
  1263. a.globalAlpha = 1;
  1264. Ha();
  1265. for (f = 0; f < r.length; f++) {
  1266. var b = r[f];
  1267. if (0 == b.type) {
  1268. a.font = b.size + "px NovaSquare";
  1269. var c = b.x << 1,
  1270. d = b.y << 1;
  1271. b.isCentered && (c -= a.measureText(b.text).width / 2);
  1272. a.fillStyle = "#000000";
  1273. a.fillText(b.text,
  1274. c, d)
  1275. } else if (1 == b.type) a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2, a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2), a.globalAlpha = 1;
  1276. else if (2 == b.type) a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.globalAlpha = 1;
  1277. else if (3 == b.type) {
  1278. var c = b.x << 1,
  1279. d = b.y << 1,
  1280. g = b.width << 1,
  1281. e = b.height << 1;
  1282. a.fillStyle = b.color;
  1283. a.globalAlpha = .2;
  1284. a.fillRect(c, d, g, e);
  1285. a.globalAlpha =
  1286. .5;
  1287. a.fillStyle = "#000000";
  1288. 40 > b.width || 40 > b.height ? (a.font = "30px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10)) : (a.font = "60px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20));
  1289. a.globalAlpha = 1
  1290. } else if (4 == b.type) {
  1291. c = b.x << 1;
  1292. d = b.y << 1;
  1293. g = b.width << 1;
  1294. e = b.height << 1;
  1295. a.fillStyle = b.color;
  1296. a.strokeStyle = b.color;
  1297. a.globalAlpha = 1;
  1298. a.fillRect(c, d, g, e);
  1299. a.globalAlpha = .2;
  1300. a.fillStyle = "#000000";
  1301. a.fillRect(c, d, g, e);
  1302. a.globalAlpha = 1;
  1303. a.fillStyle = b.color;
  1304. var n = 150 > t - b.lastClickAt,
  1305. l = n ? 8 : 12;
  1306. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  1307. a.strokeStyle = "#000000";
  1308. a.globalAlpha = .1;
  1309. a.beginPath();
  1310. a.moveTo(c, d);
  1311. a.lineTo(c + l, d + l);
  1312. a.moveTo(c + g, d);
  1313. a.lineTo(c + g - l, d + l);
  1314. a.moveTo(c, d + e);
  1315. a.lineTo(c + l, d + e - l);
  1316. a.moveTo(c + g, d + e);
  1317. a.lineTo(c + g - l, d + e - l);
  1318. a.moveTo(c, d);
  1319. a.rect(c, d, g, e);
  1320. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  1321. a.stroke();
  1322. a.fillStyle = "#000000";
  1323. a.globalAlpha = .5;
  1324. 50 > b.width || 50 > b.height ? (a.font = "35px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13)) : (a.font = "45px NovaSquare", a.fillText(b.count,
  1325. c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16));
  1326. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  1327. a.globalAlpha = 1
  1328. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600), ga(!0))
  1329. }
  1330. a.restore();
  1331. D || (a.font = "12px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5, f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw", a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1, a.fillText(f,
  1332. 10, 590), 0 != aa && (f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1, a.fillText(f, 790 - b, 590)));
  1333. na();
  1334. if (!H.checked) {
  1335. a.save();
  1336. a.strokeStyle = "#000000";
  1337. a.lineWidth = 1;
  1338. t = +new Date;
  1339. for (f = 0; f < O.length; f++) b = O[f], c = 10 - (t - b[4]) / 1E3, 0 >= c ? (O.splice(f, 1), --f) : (1 < c && (c = 1), a.globalAlpha = .3 * c, a.beginPath(), a.moveTo(b[0] - .5, b[1] - .5), a.lineTo(b[2] - .5, b[3] - .5), a.stroke());
  1340. a.restore()
  1341. }
  1342. a.save();
  1343. for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) -
  1344. 6);
  1345. a.restore();
  1346. oa(!0)
  1347. }
  1348. a.restore();
  1349. A.requestAnimationFrame(ma)
  1350. }
  1351.  
  1352. function na() { // draws circles when you click
  1353. a.save();
  1354. a.strokeStyle = "#000000";
  1355. t = +new Date;
  1356. for (var f = 0; f < I.length; f++) {
  1357. var b = I[f],
  1358. c = (t - b[2]) / 1E3,
  1359. d = 1 - 2 * c;
  1360. 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke())
  1361. }
  1362. a.restore()
  1363. }
  1364.  
  1365. function oa(f) {
  1366. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5);
  1367. else {
  1368. var b = 0,
  1369. c = 0;
  1370. v != k || w != q ? (a.save(), f && (a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath(), a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1),
  1371. a.fill()), a.globalAlpha = .5, a.drawImage(P, B - 5, C - 5), a.restore()) : (b = B & 1, c = C & 1);
  1372. a.save();
  1373. f && (a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath(), a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1), a.fill());
  1374. a.globalAlpha = 1;
  1375. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5)
  1376. }
  1377. a.restore()
  1378. }
  1379.  
  1380. function ka(a, b) {
  1381. this.oldX = this.newX = a;
  1382. this.oldY = this.newY = b;
  1383. this.time = t
  1384. }
  1385.  
  1386. function pa(a) {
  1387. return a * a * (3 - 2 * a)
  1388. }
  1389.  
  1390. function fa(a, b, c, d) {
  1391. a |= 0;
  1392. b |= 0;
  1393. c |= 0;
  1394. d |= 0;
  1395. if (z(a, b)) return {
  1396. x: a,
  1397. y: b
  1398. };
  1399. if (a == c && b == d) return {
  1400. x: c,
  1401. y: d
  1402. };
  1403. var g = a,
  1404. e = b;
  1405. c = c - a | 0;
  1406. d = d - b | 0;
  1407. var n =
  1408. 0,
  1409. l = 0,
  1410. p = 0,
  1411. k = 0;
  1412. 0 > c ? n = -1 : 0 < c && (n = 1);
  1413. 0 > d ? l = -1 : 0 < d && (l = 1);
  1414. 0 > c ? p = -1 : 0 < c && (p = 1);
  1415. var m = Math.abs(c) | 0,
  1416. h = Math.abs(d) | 0;
  1417. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  1418. c = m >> 1;
  1419. for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k);
  1420. return {
  1421. x: g,
  1422. y: e
  1423. }
  1424. }
  1425.  
  1426. function z(a, b) {
  1427. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  1428. }
  1429.  
  1430. function Ja() {
  1431. for (var a = 0; a < r.length; a++) {
  1432. var b = r[a];
  1433. 5 == b.type && Ka(b)
  1434. }
  1435. }
  1436.  
  1437. function Ka(a) {
  1438. function b(a, b, c) {
  1439. e.push([c, a, b]);
  1440. l[a + 400 * b] = !0;
  1441. g(a, b)
  1442. }
  1443.  
  1444. function c(a, b, c) {
  1445. p.push([c,
  1446. a, b
  1447. ]);
  1448. l[a + 400 * b] = !0
  1449. }
  1450.  
  1451. function d(a, b) {
  1452. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  1453. }
  1454.  
  1455. function g(a, b) {
  1456. var c = 4 * (a + 400 * b);
  1457. k[c + 0] = 255;
  1458. k[c + 1] = 153;
  1459. k[c + 2] = 153;
  1460. k[c + 3] = 255
  1461. }
  1462. for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m);
  1463. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  1464. for (r = 0; 50 > r && 0 != e.length; ++r) {
  1465. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  1466. var x = e[m][0];
  1467. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  1468. }
  1469. for (m = 0; m < q.length; ++m) {
  1470. var x = q[m][0],
  1471. h = q[m][1],
  1472. s = q[m][2],
  1473. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  1474. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  1475. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  1476. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  1477. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  1478. 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2));
  1479. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  1480. b(h - 1, s + 1, x + Math.SQRT2));
  1481. 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2));
  1482. 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2))
  1483. }
  1484. }
  1485. a.ctx.putImageData(a.img, 0, 0)
  1486. }
  1487. var y, a, ia = 0,
  1488. v = 0,
  1489. w = 0,
  1490. B = 0,
  1491. C = 0,
  1492. k = 0,
  1493. q = 0,
  1494. J = -1,
  1495. K = -1,
  1496. M = null,
  1497. H = null,
  1498. P = new Image;
  1499. P.src = "img/cursor.png";
  1500. var Ia = P,
  1501. D = -1 != A.location.search.indexOf("editor"),
  1502. I = [],
  1503. O = [],
  1504. t = 0,
  1505. ca = 0,
  1506. u = null,
  1507. ha = -1,
  1508. F = {},
  1509. aa = 0,
  1510. ja = !1,
  1511. Y = !1,
  1512. R = 0,
  1513. S = 0,
  1514. da = 0,
  1515. X = !1,
  1516. L = !D && !0,
  1517. T = new Uint8Array(12E4),
  1518. r = [],
  1519. N = [];
  1520. Array.prototype.remove =
  1521. function(a) {
  1522. a = this.indexOf(a);
  1523. return -1 != a ? (this.splice(a, 1), !0) : !1
  1524. };
  1525. var G = 0;
  1526. ka.prototype = {
  1527. oldX: 0,
  1528. oldY: 0,
  1529. newX: 0,
  1530. newY: 0,
  1531. time: 0,
  1532. getX: function() {
  1533. var a = this.newX - this.oldX,
  1534. b = (t - this.time) / 100,
  1535. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1536. return this.oldX + b * a
  1537. },
  1538. getY: function() {
  1539. var a = this.newY - this.oldY,
  1540. b = (t - this.time) / 100,
  1541. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1542. return this.oldY + b * a
  1543. }
  1544. };
  1545. var ra = function() {
  1546. function f() {
  1547. var a = 0,
  1548. b = 0,
  1549. c = v / 10,
  1550. d = w / 10;
  1551. n < c ? (c = Math.ceil(c), a = Math.floor(n)) : (c = Math.floor(c), a = Math.ceil(n));
  1552. l < d ? (d = Math.ceil(d), b = Math.floor(l)) :
  1553. (d = Math.floor(d), b = Math.ceil(l));
  1554. if (a > c) var e = c,
  1555. c = a,
  1556. a = e;
  1557. b > d && (e = d, d = b, b = e);
  1558. return {
  1559. sx: a,
  1560. sy: b,
  1561. fx: c,
  1562. fy: d
  1563. }
  1564. }
  1565.  
  1566. function b() {
  1567. e = !0;
  1568. n = v / 10;
  1569. l = w / 10
  1570. }
  1571.  
  1572. function c(a) {
  1573. return "0x" + parseInt(a.slice(1), 16).toString(16).toUpperCase()
  1574. }
  1575.  
  1576. function d(a, b, c, d, e) {
  1577. a = {
  1578. x: 10 * ~~(k / 10) - ~~(a / 2) + c,
  1579. y: 10 * ~~(q / 10) - ~~(b / 2) + d,
  1580. width: a,
  1581. height: b
  1582. };
  1583. for (var f in e) e.hasOwnProperty(f) && (a[f] = e[f]);
  1584. return a
  1585. }
  1586.  
  1587. function g(a, b) {
  1588. for (var c = null, d = Number.POSITIVE_INFINITY, e = 0; e < r.length; e++) {
  1589. var f = r[e];
  1590. if (f.hasOwnProperty("x") && f.hasOwnProperty("y") && f.hasOwnProperty("width") &&
  1591. f.hasOwnProperty("height")) {
  1592. var g = f.x + f.width / 2,
  1593. h = f.y + f.height / 2,
  1594. g = (a - g) * (a - g) + (b - h) * (b - h);
  1595. g < d && (d = g, c = f)
  1596. }
  1597. }
  1598. return c
  1599. }
  1600. var e = !1,
  1601. n = 0,
  1602. l = 0,
  1603. p = 1,
  1604. u = 200,
  1605. m = 150,
  1606. h = new Uint8Array(1200),
  1607. t = "#000000 #FF9999 #9999FF #FFFF99 #99FFFF #FF99FF #3333FF".split(" ");
  1608. E.addEventListener("mouseup", function() {
  1609. if (e) {
  1610. for (var a = f(), b = p, c = a.sy; c < a.fy; ++c)
  1611. for (var d = a.sx; d < a.fx; ++d) h[d + 40 * c] = b;
  1612. e = !1
  1613. }
  1614. });
  1615. E.addEventListener("mousemove", function() {});
  1616. A.generateCode = function() {
  1617. for (var a = "class Level? : public Level {\npublic:\n\tLevel?() : Level(" +
  1618. u + ", " + m + "){}\n\n\tvoid OnInit(){\n", a = a + ("\t\tstd::vector<LevelObject*> wallByColor[" + t.length + "];\n"), b = new Uint8Array(1200), d = [], e = 0; 30 > e; ++e)
  1619. for (var f = 0; 40 > f; ++f)
  1620. if (!b[f + 40 * e]) {
  1621. var g = h[f + 40 * e];
  1622. if (0 != g) {
  1623. for (var k = f; 40 > f && h[f + 40 * e] == g && !b[f + 40 * e];) b[f + 40 * e] = !0, ++f;
  1624. var l = f--,
  1625. p = l - k,
  1626. q = e++;
  1627. a: for (; 30 > e;) {
  1628. for (var n = k; n < l; ++n) {
  1629. if (h[n + 40 * e] != g) break a;
  1630. if (b[n + 40 * e]) break a
  1631. }
  1632. for (n = k; n < l; ++n) b[n + 40 * e] = !0;
  1633. ++e
  1634. }
  1635. l = e - q;
  1636. e = q;
  1637. d.push({
  1638. x: 10 * k,
  1639. y: 10 * q,
  1640. width: 10 * p,
  1641. height: 10 * l,
  1642. color: g - 1
  1643. })
  1644. }
  1645. }
  1646. for (b = 0; b < d.length; b++) e = d[b], 0 ==
  1647. e.color ? a += "\t\tAddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", 0x000000));\n" : (f = c(t[e.color]), a += "\t\twallByColor[" + e.color + "].push_back(AddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", " + f + ")));\n");
  1648. for (b = 0; b < r.length; b++) d = r[b], 0 != d.type && (2 == d.type ? a += "\t\tAddObject(new ObjTeleport(LevelManager::GetNextLevel(this), " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + "));\n" : 3 == d.type ? (a += "\t\tAddObject(new ObjAreaCounter(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y +
  1649. ", " + d.width + ", " + d.height + ", ", a += d.count + ", " + c(d.color) + "));\n") : 4 == d.type && (a += "\t\tAddObject(new ObjClickBox(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + ", ", a += d.count + ", 1000, " + c(d.color) + "));\n"));
  1650. return a += "\t}\n};\n"
  1651. };
  1652. E.addEventListener("keydown", function(a) {
  1653. if (a.keyCode == 8) {
  1654. a.preventDefault();
  1655. if (message.length > 0) {
  1656. message = message.substring(0, message.length - 1);
  1657. messageDisplay.innerHTML = message;
  1658. }
  1659. }
  1660. else if (a.keyCode == 9) {
  1661. a.preventDefault();
  1662. }
  1663. if (D) {
  1664. var b = a.keyCode;
  1665. 65 == b ? (--p, 0 > p && (p = t.length)) : 83 == b ? (++p, p > t.length && (p = 0)) : 66 == b ? 1 >= p || r.push(d(40, 40, 5, 5, {
  1666. type: 4,
  1667. color: t[p - 1],
  1668. colorCode: p - 1,
  1669. count: 5
  1670. })) : 90 == b ? r.pop() : 87 == b ? r.push(d(50, 50, -5, -5, {
  1671. type: 2,
  1672. isBad: !1
  1673. })) : 79 == b ? (u = k, m = q) : 78 == b ? 1 >= p || r.push(d(40, 40, 0, 0, {
  1674. type: 3,
  1675. color: t[p - 1],
  1676. colorCode: p - 1,
  1677. count: 1
  1678. })) : 37 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.width -= 10 : (b.x -= 10, b.width += 10), 0 == b.width && r.splice(r.indexOf(b), 1))) : 39 == b ? (b = g(v, w), null != b && (a.shiftKey ? (b.x += 10, b.width -= 10) : b.width += 10, 0 == b.width && r.splice(r.indexOf(b), 1))) : 38 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.height -= 10 : (b.y -= 10, b.height += 10), 0 == b.height && r.splice(r.indexOf(b), 1))) : 40 == b && (b = g(v, w), null != b && (a.shiftKey ? (b.y += 10, b.height -= 10) : b.height +=
  1679. 10, 0 == b.height && r.splice(r.indexOf(b), 1)))
  1680. }
  1681. });
  1682. return {
  1683. renderEditor: function() {
  1684. if (D) {
  1685. a.save();
  1686. a.fillStyle = "#FF0000";
  1687. a.strokeStyle = "#FF0000";
  1688. a.lineWidth = 1;
  1689. a.globalAlpha = .09;
  1690. a.beginPath();
  1691. for (var b = 0; 400 > b; b += 10) a.moveTo((b << 1) + .5, 0), a.lineTo((b << 1) + .5, 600);
  1692. for (var c = 0; 300 > c; c += 10) a.moveTo(0, (c << 1) + .5), a.lineTo(800, (c << 1) + .5);
  1693. a.stroke();
  1694. a.lineWidth = 2;
  1695. a.beginPath();
  1696. a.moveTo(400.5, 0);
  1697. a.lineTo(400.5, 600);
  1698. a.moveTo(0, 300.5, 0);
  1699. a.lineTo(800, 300.5);
  1700. a.stroke();
  1701. a.lineWidth = 1;
  1702. a.globalAlpha = 1;
  1703. a.fillStyle = "#000000";
  1704. for (var d = f(), c = 0; 300 > c; c += 10)
  1705. for (b = 0; 400 > b; b += 10) {
  1706. var g = b / 10 | 0,
  1707. k = c / 10 | 0,
  1708. l = h[g + 40 * k];
  1709. e && g >= d.sx && g < d.fx && k >= d.sy && k < d.fy && (l = p);
  1710. 0 != l && (a.fillStyle = t[l - 1], a.fillRect(b << 1, c << 1, 20, 20))
  1711. }
  1712. a.save();
  1713. a.globalAlpha = .09;
  1714. a.fillStyle = "#0000FF";
  1715. a.beginPath();
  1716. a.arc(u << 1, m << 1, 20, 0, 2 * Math.PI, !1);
  1717. a.fill();
  1718. a.restore();
  1719. a.save();
  1720. a.fillStyle = "#FFFFFF";
  1721. a.strokeStyle = "#000000";
  1722. a.lineWidth = 2.5;
  1723. a.font = "14px NovaSquare";
  1724. a.globalAlpha = .5;
  1725. a.strokeText("Current color: ", 10, 590);
  1726. a.globalAlpha = 1;
  1727. a.fillText("Current color: ", 10,
  1728. 590);
  1729. 0 == p ? a.fillText("ESR", 105, 590) : (a.fillStyle = "#000000", a.fillRect(104, 575, 22, 22), a.fillStyle = t[p - 1], a.fillRect(105, 576, 20, 20));
  1730. a.restore();
  1731. a.restore()
  1732. }
  1733. },
  1734. initEditor: function() {
  1735. y.addEventListener("mousedown", b)
  1736. }
  1737. }
  1738. }(),
  1739. Ha = ra.renderEditor,
  1740. La = ra.initEditor,
  1741. za = new Uint8Array(12E4);
  1742. Array.prototype.remove = function(a) {
  1743. a = this.indexOf(a);
  1744. return -1 != a ? (this.splice(a, 1), !0) : !1
  1745. };
  1746.  
  1747. function handleKeyboard(e) {
  1748. if ((e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63 || e.keyCode == 58 || e.keyCode == 40 || e.keyCode == 41) {
  1749. message = message.concat(String.fromCharCode(e.keyCode));
  1750. messageDisplay.innerHTML = message;
  1751. return;
  1752. }
  1753. switch(e.keyCode) {
  1754. case 13:
  1755. drawWord(message, posX, posY);
  1756. message = "";
  1757. messageDisplay.innerHTML = message;
  1758. e.preventDefault();
  1759. break;
  1760. case 96: // Click all buttons
  1761. clickAllButtons();
  1762. break;
  1763. case 47:
  1764. movementEnabled = !movementEnabled
  1765. break;
  1766. case 45: // Toggle Aura
  1767. auraEnabled = !auraEnabled;
  1768. break;
  1769. case 43:
  1770. drawImage(posX, posY);
  1771. break;
  1772. case 42:
  1773. markerEnabled = !markerEnabled;
  1774. break;
  1775. default:
  1776. return;
  1777. }
  1778. }
  1779.  
  1780. function clickAllButtons() {
  1781. for (var i = 0; i < maxButtons; i++) {
  1782. if (buttons[i][0] == null) break;
  1783. wa(buttons[i][0], buttons[i][1], buttons[i][2]);
  1784. }
  1785. }
  1786.  
  1787. function drawAura(x, y) {
  1788. var dt = 360/(1000/40)/2;
  1789. if (u != null && u.readyState == WebSocket.OPEN) {
  1790. var g = new ArrayBuffer(9),
  1791. e = new DataView(g);
  1792. e.setUint8(0, 3);
  1793. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  1794. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  1795. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  1796. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  1797. u.send(g)
  1798. }
  1799.  
  1800. auraTime += dt;
  1801. }
  1802.  
  1803. function degToRad(deg) {
  1804. return deg * (Math.PI / 180);
  1805. }
  1806.  
  1807. function radToDeg(rad) {
  1808. return rad * (180 / Math.PI);
  1809. }
  1810.  
  1811. var drawIndex = 0;
  1812. function drawImage(x, y) {
  1813. setTimeout(function () {
  1814. var g = new ArrayBuffer(9),
  1815. e = new DataView(g);
  1816.  
  1817. e.setUint8(0, 3);
  1818. e.setUint16(1, x+imgData[drawIndex][1]*imageScale, !0);
  1819. e.setUint16(3, y+imgData[drawIndex][0]*imageScale, !0);
  1820. e.setUint16(5, x+imgData[drawIndex][3]*imageScale, !0);
  1821. e.setUint16(7, y+imgData[drawIndex][2]*imageScale, !0);
  1822. u.send(g);
  1823.  
  1824. drawIndex++;
  1825. if (drawIndex < imgData.length)
  1826. drawImage(x, y);
  1827. else
  1828. drawIndex = 0;
  1829. }, 15)
  1830. }
  1831.  
  1832. function drawLetter(a, x, y) {
  1833. var letter = alphabet[a];
  1834.  
  1835. if (letter == null)
  1836. return;
  1837.  
  1838. var g = new ArrayBuffer(9),
  1839. e = new DataView(g);
  1840.  
  1841. for (var i = 0; i < letter.length; i++) {
  1842. e.setUint8(0, 3);
  1843. e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  1844. e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  1845. e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  1846. e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  1847. for (var j = 0; j < 4; j++) { u.send(g); }
  1848. }
  1849. }
  1850.  
  1851. var messageDisplay;
  1852. var message = new String();
  1853. var wordIndex = 0;
  1854. function drawWord(s, x, y) {
  1855. setTimeout(function () {
  1856. drawLetter(s.charCodeAt(0), x, y);
  1857. wordIndex++;
  1858. if (s.length > 0)
  1859. drawWord(s.substring(1, s.length), x+fontSize*3, y);
  1860. else {
  1861. wordIndex = 0;
  1862. letterOffset = 0;
  1863. }
  1864. }, 20);
  1865. }
  1866.  
  1867. function doit() {
  1868. document.body.innerHTML += '<div id="messageDisplay"></div>';
  1869. messageDisplay = document.getElementById("messageDisplay");
  1870.  
  1871. y = E.getElementById("canvas");
  1872. a = y.getContext("2d");
  1873. try {
  1874. A.top.location.origin != A.location.origin && ba()
  1875. } catch (f) {
  1876. ba()
  1877. }
  1878. y.onmousemove = ua;
  1879. y.onmousedown = va;
  1880. y.onmouseup = xa;
  1881. M = E.getElementById("noCursorLock");
  1882. H = E.getElementById("noDrawings");
  1883. null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  1884. A.onbeforeunload = ya;
  1885. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  1886. y.style.cursor = "none";
  1887. La();
  1888. D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
  1889. Ba, u.onerror = Ca);
  1890. setInterval(Q, 50);
  1891. setInterval(Ja, 40);
  1892. A.requestAnimationFrame(ma)
  1893.  
  1894. document.onkeypress = handleKeyboard;
  1895. }
  1896.  
  1897. doit();var A = window;
  1898. var E = document;
  1899.  
  1900. var debugMode = false;
  1901.  
  1902. var posX, posY;
  1903. var lastX, lastY;
  1904.  
  1905. var lastFrame;
  1906. var currentFrame;
  1907.  
  1908. var initialLoad = true;
  1909. var buttonIndex = 0;
  1910. var maxButtons = 20;
  1911. var buttons = new Array(maxButtons);
  1912. for (var i = 0; i < maxButtons; i++)
  1913. buttons[i] = new Array(3);
  1914.  
  1915. var auraEnabled = false;
  1916. var auraTime = 0;
  1917. var auraRadius = 10;
  1918.  
  1919. var markerEnabled = false;
  1920.  
  1921. var movementEnabled = true;
  1922.  
  1923. var imageScale = 1.0;
  1924. var imgData = [ [17,49,17,57],
  1925. [18,44,18,52],
  1926. [18,55,18,59],
  1927. [19,41,19,46],
  1928. [19,58,19,60],
  1929. [20,40,20,42],
  1930. [20,60,20,62],
  1931. [21,38,21,40],
  1932. [21,61,21,63],
  1933. [22,37,22,39],
  1934. [22,62,22,64],
  1935. [23,37,23,38],
  1936. [23,63,23,65],
  1937. [24,36,24,37],
  1938. [24,64,24,65],
  1939. [25,35,25,37],
  1940. [25,65,25,66],
  1941. [26,34,26,36],
  1942. [26,65,26,67],
  1943. [27,33,27,35],
  1944. [27,66,27,67],
  1945. [28,32,28,34],
  1946. [28,67,28,68],
  1947. [29,32,29,34],
  1948. [29,67,29,68],
  1949. [30,31,30,33],
  1950. [30,67,30,69],
  1951. [31,31,31,32],
  1952. [31,68,31,69],
  1953. [32,31,32,32],
  1954. [32,68,32,69],
  1955. [33,30,33,31],
  1956. [33,55,33,59],
  1957. [33,68,33,69],
  1958. [34,30,34,31],
  1959. [34,53,34,58],
  1960. [34,59,34,61],
  1961. [34,68,34,70],
  1962. [35,29,35,31],
  1963. [35,52,35,57],
  1964. [35,61,35,62],
  1965. [35,69,35,70],
  1966. [36,29,36,30],
  1967. [36,50,36,57],
  1968. [36,62,36,63],
  1969. [36,69,36,70],
  1970. [37,29,37,30],
  1971. [37,50,37,58],
  1972. [37,62,37,63],
  1973. [37,69,37,70],
  1974. [38,28,38,30],
  1975. [38,49,38,58],
  1976. [38,69,38,71],
  1977. [38,108,38,115],
  1978. [39,28,39,29],
  1979. [39,49,39,57],
  1980. [39,63,39,64],
  1981. [39,70,39,71],
  1982. [39,107,39,110],
  1983. [39,114,39,116],
  1984. [40,28,40,35],
  1985. [40,48,40,57],
  1986. [40,63,40,64],
  1987. [40,70,40,71],
  1988. [40,107,40,109],
  1989. [40,116,40,117],
  1990. [41,27,41,32],
  1991. [41,35,41,36],
  1992. [41,48,41,57],
  1993. [41,63,41,64],
  1994. [41,70,41,71],
  1995. [41,107,41,108],
  1996. [41,117,41,118],
  1997. [42,26,42,32],
  1998. [42,36,42,37],
  1999. [42,48,42,56],
  2000. [42,62,42,64],
  2001. [42,70,42,72],
  2002. [42,107,42,108],
  2003. [42,118,42,119],
  2004. [43,25,43,32],
  2005. [43,36,43,38],
  2006. [43,41,43,42],
  2007. [43,48,43,56],
  2008. [43,62,43,63],
  2009. [43,70,43,72],
  2010. [43,107,43,108],
  2011. [43,118,43,119],
  2012. [44,25,44,32],
  2013. [44,37,44,38],
  2014. [44,40,44,41],
  2015. [44,47,44,55],
  2016. [44,61,44,63],
  2017. [44,71,44,72],
  2018. [44,107,44,108],
  2019. [44,118,44,119],
  2020. [45,24,45,32],
  2021. [45,37,45,40],
  2022. [45,48,45,50],
  2023. [45,59,45,62],
  2024. [45,71,45,72],
  2025. [45,107,45,108],
  2026. [45,118,45,119],
  2027. [46,24,46,32],
  2028. [46,37,46,40],
  2029. [46,49,46,51],
  2030. [46,58,46,60],
  2031. [46,71,46,72],
  2032. [46,107,46,108],
  2033. [46,119,46,120],
  2034. [47,23,47,32],
  2035. [47,37,47,39],
  2036. [47,50,47,53],
  2037. [47,55,47,58],
  2038. [47,71,47,73],
  2039. [47,107,47,108],
  2040. [47,119,47,120],
  2041. [48,23,48,31],
  2042. [48,36,48,39],
  2043. [48,52,48,56],
  2044. [48,72,48,73],
  2045. [48,107,48,108],
  2046. [48,119,48,120],
  2047. [49,23,49,30],
  2048. [49,35,49,38],
  2049. [49,62,49,65],
  2050. [49,72,49,73],
  2051. [49,106,49,108],
  2052. [49,119,49,120],
  2053. [50,24,50,29],
  2054. [50,34,50,38],
  2055. [50,43,50,46],
  2056. [50,61,50,64],
  2057. [50,72,50,74],
  2058. [50,106,50,108],
  2059. [50,119,50,120],
  2060. [51,24,51,28],
  2061. [51,32,51,34],
  2062. [51,36,51,37],
  2063. [51,40,51,42],
  2064. [51,45,51,46],
  2065. [51,58,51,62],
  2066. [51,72,51,74],
  2067. [51,106,51,108],
  2068. [51,119,51,120],
  2069. [52,25,52,32],
  2070. [52,36,52,37],
  2071. [52,45,52,46],
  2072. [52,56,52,60],
  2073. [52,73,52,74],
  2074. [52,106,52,108],
  2075. [52,119,52,120],
  2076. [53,26,53,28],
  2077. [53,35,53,37],
  2078. [53,44,53,46],
  2079. [53,55,53,58],
  2080. [53,73,53,74],
  2081. [53,106,53,107],
  2082. [53,119,53,120],
  2083. [54,26,54,27],
  2084. [54,36,54,38],
  2085. [54,41,54,45],
  2086. [54,52,54,56],
  2087. [54,73,54,75],
  2088. [54,106,54,107],
  2089. [54,119,54,120],
  2090. [55,26,55,27],
  2091. [55,37,55,44],
  2092. [55,50,55,54],
  2093. [55,74,55,75],
  2094. [55,106,55,107],
  2095. [55,119,55,120],
  2096. [56,26,56,27],
  2097. [56,47,56,51],
  2098. [56,74,56,75],
  2099. [56,106,56,107],
  2100. [56,119,56,120],
  2101. [57,26,57,27],
  2102. [57,45,57,49],
  2103. [57,74,57,76],
  2104. [57,106,57,107],
  2105. [57,119,57,120],
  2106. [58,26,58,27],
  2107. [58,42,58,46],
  2108. [58,74,58,76],
  2109. [58,106,58,107],
  2110. [58,115,58,116],
  2111. [58,118,58,119],
  2112. [59,26,59,28],
  2113. [59,39,59,44],
  2114. [59,75,59,76],
  2115. [59,105,59,107],
  2116. [59,118,59,119],
  2117. [60,27,60,28],
  2118. [60,37,60,41],
  2119. [60,75,60,77],
  2120. [60,105,60,106],
  2121. [60,118,60,119],
  2122. [60,124,60,125],
  2123. [61,27,61,28],
  2124. [61,33,61,38],
  2125. [61,76,61,77],
  2126. [61,105,61,106],
  2127. [61,117,61,118],
  2128. [61,123,61,127],
  2129. [62,27,62,28],
  2130. [62,30,62,35],
  2131. [62,76,62,78],
  2132. [62,104,62,106],
  2133. [62,116,62,118],
  2134. [62,122,62,124],
  2135. [62,126,62,128],
  2136. [63,27,63,28],
  2137. [63,30,63,31],
  2138. [63,77,63,78],
  2139. [63,98,63,102],
  2140. [63,104,63,105],
  2141. [63,116,63,117],
  2142. [63,121,63,123],
  2143. [63,126,63,128],
  2144. [64,27,64,28],
  2145. [64,77,64,79],
  2146. [64,95,64,105],
  2147. [64,116,64,118],
  2148. [64,119,64,121],
  2149. [64,126,64,128],
  2150. [65,27,65,29],
  2151. [65,68,65,69],
  2152. [65,78,65,79],
  2153. [65,92,65,96],
  2154. [65,103,65,105],
  2155. [65,115,65,120],
  2156. [65,123,65,126],
  2157. [65,127,65,128],
  2158. [66,28,66,29],
  2159. [66,63,66,64],
  2160. [66,68,66,70],
  2161. [66,78,66,80],
  2162. [66,91,66,93],
  2163. [66,103,66,104],
  2164. [66,117,66,118],
  2165. [66,127,66,128],
  2166. [67,28,67,29],
  2167. [67,63,67,64],
  2168. [67,69,67,70],
  2169. [67,79,67,80],
  2170. [67,89,67,91],
  2171. [67,103,67,104],
  2172. [67,126,67,128],
  2173. [68,28,68,29],
  2174. [68,64,68,65],
  2175. [68,69,68,70],
  2176. [68,79,68,81],
  2177. [68,87,68,89],
  2178. [68,102,68,104],
  2179. [68,120,68,131],
  2180. [69,28,69,29],
  2181. [69,69,69,70],
  2182. [69,80,69,82],
  2183. [69,87,69,88],
  2184. [69,102,69,103],
  2185. [69,122,69,132],
  2186. [70,29,70,30],
  2187. [70,70,70,71],
  2188. [70,80,70,82],
  2189. [70,85,70,87],
  2190. [70,101,70,113],
  2191. [70,132,70,133],
  2192. [71,29,71,30],
  2193. [71,65,71,66],
  2194. [71,70,71,71],
  2195. [71,81,71,83],
  2196. [71,85,71,86],
  2197. [71,91,71,92],
  2198. [71,99,71,116],
  2199. [71,132,71,133],
  2200. [72,29,72,30],
  2201. [72,65,72,66],
  2202. [72,70,72,71],
  2203. [72,81,72,85],
  2204. [72,91,72,94],
  2205. [72,97,72,100],
  2206. [72,115,72,118],
  2207. [72,132,72,134],
  2208. [73,29,73,30],
  2209. [73,70,73,72],
  2210. [73,81,73,85],
  2211. [73,94,73,99],
  2212. [73,118,73,120],
  2213. [73,132,73,133],
  2214. [74,29,74,30],
  2215. [74,71,74,72],
  2216. [74,81,74,84],
  2217. [74,95,74,98],
  2218. [74,119,74,120],
  2219. [74,132,74,133],
  2220. [75,30,75,31],
  2221. [75,66,75,67],
  2222. [75,71,75,72],
  2223. [75,82,75,84],
  2224. [75,94,75,96],
  2225. [75,120,75,121],
  2226. [75,128,75,129],
  2227. [75,131,75,133],
  2228. [76,30,76,31],
  2229. [76,66,76,67],
  2230. [76,71,76,72],
  2231. [76,83,76,84],
  2232. [76,89,76,90],
  2233. [76,94,76,95],
  2234. [76,121,76,122],
  2235. [76,124,76,125],
  2236. [76,129,76,132],
  2237. [77,30,77,31],
  2238. [77,72,77,73],
  2239. [77,83,77,84],
  2240. [77,93,77,94],
  2241. [77,121,77,123],
  2242. [77,129,77,132],
  2243. [78,30,78,32],
  2244. [78,67,78,68],
  2245. [78,72,78,73],
  2246. [78,84,78,85],
  2247. [78,92,78,93],
  2248. [78,122,78,123],
  2249. [78,125,78,129],
  2250. [79,30,79,32],
  2251. [79,67,79,68],
  2252. [79,72,79,73],
  2253. [79,85,79,86],
  2254. [79,91,79,93],
  2255. [79,122,79,128],
  2256. [80,31,80,32],
  2257. [80,67,80,68],
  2258. [80,72,80,74],
  2259. [80,91,80,92],
  2260. [80,122,80,123],
  2261. [81,31,81,33],
  2262. [81,73,81,74],
  2263. [81,91,81,92],
  2264. [81,123,81,124],
  2265. [82,31,82,33],
  2266. [82,68,82,69],
  2267. [82,73,82,74],
  2268. [82,102,82,103],
  2269. [82,123,82,124],
  2270. [83,32,83,33],
  2271. [83,68,83,69],
  2272. [83,73,83,74],
  2273. [83,101,83,102],
  2274. [83,123,83,124],
  2275. [84,32,84,33],
  2276. [84,68,84,69],
  2277. [84,73,84,74],
  2278. [84,123,84,124],
  2279. [85,32,85,34],
  2280. [85,69,85,70],
  2281. [85,73,85,74],
  2282. [85,123,85,124],
  2283. [86,33,86,35],
  2284. [86,69,86,70],
  2285. [86,74,86,75],
  2286. [86,123,86,124],
  2287. [87,34,87,35],
  2288. [87,74,87,75],
  2289. [87,123,87,124],
  2290. [88,34,88,36],
  2291. [88,70,88,71],
  2292. [88,75,88,76],
  2293. [88,122,88,124],
  2294. [89,35,89,36],
  2295. [89,70,89,71],
  2296. [89,75,89,81],
  2297. [89,122,89,123],
  2298. [90,35,90,37],
  2299. [90,71,90,72],
  2300. [90,81,90,84],
  2301. [90,121,90,123],
  2302. [91,36,91,37],
  2303. [91,71,91,72],
  2304. [91,84,91,85],
  2305. [91,121,91,122],
  2306. [92,36,92,38],
  2307. [92,70,92,71],
  2308. [92,84,92,85],
  2309. [92,121,92,122],
  2310. [93,37,93,39],
  2311. [93,70,93,71],
  2312. [93,76,93,78],
  2313. [93,83,93,85],
  2314. [93,120,93,122],
  2315. [94,38,94,39],
  2316. [94,69,94,70],
  2317. [94,77,94,83],
  2318. [94,120,94,121],
  2319. [95,38,95,40],
  2320. [95,69,95,70],
  2321. [95,73,95,74],
  2322. [95,77,95,78],
  2323. [95,119,95,121],
  2324. [96,39,96,41],
  2325. [96,69,96,70],
  2326. [96,73,96,74],
  2327. [96,77,96,78],
  2328. [96,104,96,105],
  2329. [96,119,96,120],
  2330. [97,40,97,41],
  2331. [97,69,97,70],
  2332. [97,73,97,75],
  2333. [97,77,97,78],
  2334. [97,118,97,120],
  2335. [98,40,98,42],
  2336. [98,69,98,70],
  2337. [98,73,98,76],
  2338. [98,78,98,79],
  2339. [98,117,98,119],
  2340. [99,41,99,43],
  2341. [99,69,99,70],
  2342. [99,73,99,74],
  2343. [99,75,99,78],
  2344. [99,108,99,109],
  2345. [99,117,99,118],
  2346. [100,42,100,44],
  2347. [100,69,100,71],
  2348. [100,72,100,73],
  2349. [100,76,100,78],
  2350. [100,116,100,118],
  2351. [101,43,101,45],
  2352. [101,70,101,72],
  2353. [101,115,101,117],
  2354. [102,43,102,45],
  2355. [102,114,102,116],
  2356. [103,44,103,46],
  2357. [103,113,103,115],
  2358. [104,45,104,47],
  2359. [104,111,104,114],
  2360. [105,46,105,48],
  2361. [105,109,105,113],
  2362. [106,47,106,48],
  2363. [106,107,106,111],
  2364. [107,48,107,49],
  2365. [107,101,107,109],
  2366. [108,48,108,51],
  2367. [108,101,108,105],
  2368. [109,49,109,52],
  2369. [109,103,109,104],
  2370. [110,51,110,54],
  2371. [110,96,110,98],
  2372. [110,103,110,104],
  2373. [111,52,111,55],
  2374. [111,94,111,98],
  2375. [111,103,111,104],
  2376. [112,54,112,57],
  2377. [112,92,112,95],
  2378. [112,97,112,98],
  2379. [112,103,112,104],
  2380. [113,55,113,59],
  2381. [113,90,113,93],
  2382. [113,97,113,99],
  2383. [113,103,113,105],
  2384. [114,57,114,61],
  2385. [114,87,114,92],
  2386. [114,98,114,99],
  2387. [114,103,114,105],
  2388. [115,59,115,65],
  2389. [115,83,115,90],
  2390. [115,98,115,99],
  2391. [115,104,115,105],
  2392. [116,61,116,87],
  2393. [116,98,116,99],
  2394. [116,104,116,105],
  2395. [117,66,117,82],
  2396. [117,98,117,100],
  2397. [117,104,117,105],
  2398. [118,70,118,71],
  2399. [118,74,118,75],
  2400. [118,99,118,100],
  2401. [118,104,118,106],
  2402. [119,70,119,71],
  2403. [119,74,119,76],
  2404. [119,91,119,93],
  2405. [119,99,119,100],
  2406. [119,105,119,106],
  2407. [120,70,120,71],
  2408. [120,74,120,76],
  2409. [120,88,120,101],
  2410. [120,105,120,106],
  2411. [121,70,121,71],
  2412. [121,74,121,76],
  2413. [121,88,121,90],
  2414. [121,98,121,101],
  2415. [121,105,121,107],
  2416. [122,70,122,71],
  2417. [122,74,122,76],
  2418. [122,89,122,91],
  2419. [122,106,122,107],
  2420. [123,69,123,71],
  2421. [123,74,123,76],
  2422. [123,90,123,92],
  2423. [123,106,123,107],
  2424. [124,69,124,71],
  2425. [124,74,124,75],
  2426. [124,91,124,94],
  2427. [124,106,124,107],
  2428. [125,69,125,71],
  2429. [125,74,125,75],
  2430. [125,92,125,95],
  2431. [125,106,125,107],
  2432. [126,69,126,70],
  2433. [126,75,126,76],
  2434. [126,94,126,97],
  2435. [126,106,126,108],
  2436. [127,69,127,70],
  2437. [127,75,127,76],
  2438. [127,96,127,99],
  2439. [127,107,127,108],
  2440. [128,69,128,71],
  2441. [128,74,128,76],
  2442. [128,98,128,103],
  2443. [128,107,128,108],
  2444. [129,69,129,71],
  2445. [129,74,129,75],
  2446. [129,101,129,108],
  2447. [130,58,130,63],
  2448. [130,70,130,71],
  2449. [130,74,130,75],
  2450. [131,57,131,59],
  2451. [131,63,131,66],
  2452. [131,69,131,71],
  2453. [131,74,131,75],
  2454. [132,58,132,59],
  2455. [132,65,132,68],
  2456. [132,69,132,71],
  2457. [132,74,132,75],
  2458. [133,58,133,60],
  2459. [133,67,133,71],
  2460. [133,74,133,75],
  2461. [134,59,134,61],
  2462. [134,68,134,70],
  2463. [134,74,134,75],
  2464. [135,60,135,62],
  2465. [135,74,135,75],
  2466. [136,61,136,63],
  2467. [136,73,136,75],
  2468. [137,62,137,65],
  2469. [137,73,137,75],
  2470. [138,64,138,66],
  2471. [138,73,138,74],
  2472. [139,65,139,68],
  2473. [139,72,139,74],
  2474. [140,67,140,74],
  2475. [141,70,141,73],
  2476. ];
  2477.  
  2478. var fontSize = 2;
  2479. var letterOffset = 0;
  2480. var alphabet = new Array(200);
  2481. alphabet[58] = [
  2482. [0,0,0,1],
  2483. [2,0,2,1]
  2484. ];
  2485. alphabet[40] = [
  2486. [0,2,1,0],
  2487. [2,2,1,0]
  2488. ];
  2489. alphabet[41] = [
  2490. [0,0,1,2],
  2491. [2,0,1,2]
  2492. ];
  2493. alphabet[63] = [
  2494. [1,0,0,0],
  2495. [0,0,0,2],
  2496. [0,2,1,2],
  2497. [1,2,1,1],
  2498. [1,1,2,1]
  2499. ];
  2500. alphabet[97] = [
  2501. [2,0,0,0],
  2502. [0,0,0,2],
  2503. [0,2,2,2],
  2504. [1,0,1,2]
  2505. ];
  2506. alphabet[98] = [
  2507. [2,0,0,0],
  2508. [0,0,0,2],
  2509. [0,2,2,2],
  2510. [2,2,2,0],
  2511. [1,0,1,2]
  2512. ];
  2513. alphabet[99] = [
  2514. [2,2,2,0],
  2515. [2,0,0,0],
  2516. [0,0,0,2]
  2517. ];
  2518. alphabet[100] = [
  2519. [2,0,0,0],
  2520. [0,0,0,1],
  2521. [0,1,1,2],
  2522. [1,2,2,1],
  2523. [2,1,2,0]
  2524. ];
  2525. alphabet[101] = [
  2526. [2,2,2,0],
  2527. [2,0,0,0],
  2528. [0,0,0,2],
  2529. [1,0,1,2]
  2530. ];
  2531. alphabet[102] = [
  2532. [2,0,0,0],
  2533. [0,0,0,2],
  2534. [1,0,1,2]
  2535. ];
  2536. alphabet[103] = [
  2537. [1,1,1,2],
  2538. [1,2,2,2],
  2539. [2,2,2,0],
  2540. [2,0,0,0],
  2541. [0,0,0,2]
  2542. ];
  2543. alphabet[104] = [
  2544. [0,0,2,0],
  2545. [0,2,2,2],
  2546. [1,0,1,2]
  2547. ];
  2548. alphabet[105] = [
  2549. [0,0,0,2],
  2550. [0,1,2,1],
  2551. [2,0,2,2]
  2552. ];
  2553. alphabet[106] = [
  2554. [0,0,0,2],
  2555. [0,1,2,1],
  2556. [2,0,2,1]
  2557. ];
  2558. alphabet[107] = [
  2559. [0,0,2,0],
  2560. [1,0,0,2],
  2561. [1,0,2,2]
  2562. ];
  2563. alphabet[108] = [
  2564. [0,0,2,0],
  2565. [2,0,2,2]
  2566. ];
  2567. alphabet[109] = [
  2568. [0,0,2,0],
  2569. [0,0,2,1],
  2570. [2,1,0,2],
  2571. [0,2,2,2]
  2572. ];
  2573. alphabet[110] = [
  2574. [0,0,2,0],
  2575. [0,0,2,2],
  2576. [0,2,2,2]
  2577. ];
  2578. alphabet[111] = [
  2579. [2,0,0,0],
  2580. [0,0,0,2],
  2581. [0,2,2,2],
  2582. [2,2,2,0]
  2583. ];
  2584. alphabet[112] = [
  2585. [2,0,0,0],
  2586. [0,0,0,2],
  2587. [0,2,1,2],
  2588. [1,2,1,0]
  2589. ];
  2590. alphabet[113] = [
  2591. [2,0,0,0],
  2592. [0,0,0,2],
  2593. [0,2,2,2],
  2594. [2,2,2,0],
  2595. [1,1,2,2]
  2596. ];
  2597. alphabet[114] = [
  2598. [2,0,0,0],
  2599. [0,0,0,2],
  2600. [0,2,1,2],
  2601. [1,2,1,0],
  2602. [1,1,2,2]
  2603. ];
  2604. alphabet[115] = [
  2605. [0,0,0,2],
  2606. [1,0,1,2],
  2607. [2,0,2,2],
  2608. [0,0,1,0],
  2609. [1,2,2,2]
  2610. ];
  2611. alphabet[116] = [
  2612. [0,0,0,2],
  2613. [0,1,2,1]
  2614. ];
  2615. alphabet[117] = [
  2616. [0,0,2,0],
  2617. [0,2,2,2],
  2618. [2,0,2,2]
  2619. ];
  2620. alphabet[118] = [
  2621. [0,0,2,1],
  2622. [0,2,2,1]
  2623. ];
  2624. alphabet[119] = [
  2625. [0,0,2,0],
  2626. [0,2,2,2],
  2627. [2,0,1,1],
  2628. [2,2,1,1]
  2629. ];
  2630. alphabet[120] = [
  2631. [0,0,2,2],
  2632. [2,0,0,2]
  2633. ];
  2634. alphabet[121] = [
  2635. [0,0,1,1],
  2636. [0,2,1,1],
  2637. [1,1,2,1]
  2638. ];
  2639. alphabet[122] = [
  2640. [0,0,0,2],
  2641. [0,2,2,0],
  2642. [2,0,2,2]
  2643. ];
  2644.  
  2645.  
  2646. function sa(f) {
  2647. return f << 1
  2648. }
  2649.  
  2650. function ta(f) {
  2651. return f << 1
  2652. }
  2653.  
  2654. function U() {
  2655. //return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y
  2656. }
  2657.  
  2658. function ba() {
  2659. a.fillStyle = "#000000";
  2660. a.font = "35px NovaSquare";
  2661. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  2662. a.font = "16px NovaSquare";
  2663. a.fillText("Play the game on http://cursors.io/", 400 - a.measureText("Play the game on http://cursors.io/").width /
  2664. 2, 330);
  2665. top.location = "http://cursors.io";
  2666. throw "Please do not embed our website, thank you.";
  2667. }
  2668.  
  2669. function ua(f) {
  2670. V(f)
  2671. }
  2672.  
  2673. // Apparently unimportant
  2674. function W(f, b) {
  2675. J = f;
  2676. K = b;
  2677. k = v = f;
  2678. q = w = b;
  2679. B = v << 1;
  2680. C = w << 1
  2681. }
  2682.  
  2683. // Handles clicking
  2684. function va(f) {
  2685. if (D) return L = !1, V(f), !1;
  2686. //U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  2687. if (L) L = !1, Q();
  2688. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  2689. else if (100 < t - ca && v == k && w == q) {
  2690. ca = t;
  2691. I.push([v << 1, w << 1, t]);
  2692. wa(v, w, 10);
  2693. var b = [v, w];
  2694. N.push(b);
  2695. setTimeout(function() {
  2696. N.remove(b)
  2697. }, 1E3)
  2698. }
  2699. return !1
  2700. }
  2701.  
  2702. // Apparently unimportant
  2703. function xa(f) {
  2704. Y = !1
  2705. }
  2706.  
  2707. // Sets local storage for cursor lock and drawing
  2708. function ya() {
  2709. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"))
  2710. }
  2711.  
  2712. // Handles mouse movement and drawing
  2713. function V(f) {
  2714. if (U()) {
  2715. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  2716. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  2717. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1)
  2718. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  2719. k = v, q = w; /* Changed to allow movement through walls */
  2720. lastX = posX;
  2721. lastY = posY;
  2722. posX = k;
  2723. posY = q;
  2724. if (debugMode) console.log(v + ", " + w);
  2725. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  2726. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  2727. b = R;
  2728. f = S;
  2729. var a = k,
  2730. d = q;
  2731. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  2732. var g = new ArrayBuffer(9),
  2733. e = new DataView(g);
  2734.  
  2735. e.setUint8(0, 3);
  2736. e.setUint16(1, b, !0);
  2737. e.setUint16(3, f, !0);
  2738. e.setUint16(5, a, !0);
  2739. e.setUint16(7, d, !0);
  2740. u.send(g)
  2741.  
  2742. if (markerEnabled) {
  2743. e.setUint8(0, 3);
  2744. e.setUint16(1, b+2, !0);
  2745. e.setUint16(3, f, !0);
  2746. e.setUint16(5, a+2, !0);
  2747. e.setUint16(7, d, !0);
  2748. u.send(g)
  2749. e.setUint8(0, 3);
  2750. e.setUint16(1, b, !0);
  2751. e.setUint16(3, f+2, !0);
  2752. e.setUint16(5, a, !0);
  2753. e.setUint16(7, d+2, !0);
  2754. u.send(g)
  2755. e.setUint8(0, 3);
  2756. e.setUint16(1, b-2, !0);
  2757. e.setUint16(3, f, !0);
  2758. e.setUint16(5, a-2, !0);
  2759. e.setUint16(7, d, !0);
  2760. u.send(g)
  2761. e.setUint8(0, 3);
  2762. e.setUint16(1, b, !0);
  2763. e.setUint16(3, f-2, !0);
  2764. e.setUint16(5, a, !0);
  2765. e.setUint16(7, d-2, !0);
  2766. u.send(g)
  2767. }
  2768. }
  2769. R = k;
  2770. S = q;
  2771. da = t
  2772. }
  2773. }
  2774.  
  2775. // Apparently not important
  2776. function Z() {
  2777. ea(k, q) && Q();
  2778. if (z(k, q)) {
  2779. var a;
  2780. a: {
  2781. a = k;
  2782. var b = q,
  2783. c = [],
  2784. d = new Uint8Array(12E4);
  2785. c.push([a, b]);
  2786. d[a + 400 * b] = 1;
  2787. do {
  2788. var g = c.shift(),
  2789. e = g[0],
  2790. g = g[1];
  2791. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  2792. if (!z(e, g)) {
  2793. a = {
  2794. x: e,
  2795. y: g
  2796. };
  2797. break a
  2798. }
  2799. d[e -
  2800. 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  2801. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  2802. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  2803. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1)
  2804. }
  2805. } while (0 < c.length);
  2806. a = {
  2807. x: a,
  2808. y: b
  2809. }
  2810. }
  2811. k = a.x;
  2812. q = a.y
  2813. }
  2814. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  2815. ea(k, q) && Q()
  2816. }
  2817.  
  2818. // Cleans up map on level transition
  2819. function $() {
  2820. console.log("Next map");
  2821. initialLoad = true;
  2822. for (var i = 0; i < maxButtons; i++)
  2823. buttons[i] = new Array(3);
  2824. buttonIndex = 0;
  2825. T.set(za);
  2826. r = [];
  2827. I = [];
  2828. O = []
  2829. }
  2830.  
  2831. // Enables image smoothing
  2832. function ga(f) {
  2833. a.imageSmoothingEnabled = f;
  2834. a.mozImageSmoothingEnabled = f;
  2835. a.oImageSmoothingEnabled = f;
  2836. a.webkitImageSmoothingEnabled = f
  2837. }
  2838.  
  2839. // Prints connected message
  2840. function Aa() {
  2841. $();
  2842. console.log("Connected!")
  2843. }
  2844.  
  2845. // Prints socket closed message
  2846. function Ba(a) {
  2847. $();
  2848. console.log("Socket closed: " + a.reason)
  2849. }
  2850.  
  2851. // Prints socket error message
  2852. function Ca(a) {
  2853. console.log("Socket error")
  2854. }
  2855.  
  2856. // Gets strings, but without it the map won't load
  2857. function Da(a, b) {
  2858. for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0);
  2859. 0 != d && (c += String.fromCharCode(d));
  2860. return [c, b + 1]
  2861. }
  2862.  
  2863. // You get a TERRIBLE framerate if you remove the contents of this function
  2864. function Ea(a, b) {
  2865. setTimeout(function() {
  2866. var c = a.getUint16(b, !0),
  2867. d = 0;
  2868. a: for (; d < c; d++) {
  2869. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  2870. var l = N[n];
  2871. if (l[0] == g && l[1] == e) {
  2872. N.splice(n, 1);
  2873. continue a
  2874. }
  2875. }
  2876. I.push([g << 1, e << 1, t])
  2877. }
  2878. }, 100);
  2879. return b +
  2880. 2 + 4 * a.getUint16(b, !0)
  2881. }
  2882.  
  2883. // Apparently not important
  2884. function Fa(a, b) {
  2885. !H.checked && setTimeout(function() {
  2886. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  2887. var g = a.getUint16(b + 2 + 8 * d, !0),
  2888. e = a.getUint16(b + 4 + 8 * d, !0),
  2889. n = a.getUint16(b + 6 + 8 * d, !0),
  2890. l = a.getUint16(b + 8 + 8 * d, !0);
  2891. O.push([g << 1, e << 1, n << 1, l << 1, t])
  2892. }
  2893. }, 50);
  2894. return b + 2 + 8 * a.getUint16(b, !0)
  2895. }
  2896.  
  2897. // Draws the level. Or at least, without it the level doesn't show up.
  2898. function Ga(a) {
  2899. buttonIndex = 0;
  2900. initialLoad = false;
  2901. a = a.data;
  2902. var b = new DataView(a);
  2903. switch (b.getUint8(0)) {
  2904. case 0: // If this doesn't run then you see two of your cursor. One of them lags behind
  2905. ha = b.getUint32(1, !0);
  2906. break;
  2907. case 1: // Without this, doors don't show up
  2908. var c;
  2909. ia = c = b.getUint16(1, !0);
  2910. ja = 100 <= c;
  2911. var d = [],
  2912. g;
  2913. for (g in F) F.hasOwnProperty(g) && d.push(g);
  2914. for (var e =
  2915. 0; e < c; e++) {
  2916. g = b.getUint32(3 + 8 * e, !0);
  2917. var n = b.getUint16(7 + 8 * e, !0),
  2918. l = b.getUint16(9 + 8 * e, !0);
  2919. if (g != ha)
  2920. if (null != F[g]) {
  2921. for (var p = 0; p < d.length; p++)
  2922. if (d[p] == g) {
  2923. d.splice(p, 1);
  2924. break
  2925. }
  2926. g = F[g];
  2927. g.oldX = g.getX();
  2928. g.oldY = g.getY();
  2929. g.newX = n;
  2930. g.newY = l;
  2931. g.time = t
  2932. } else F[g] = new ka(n, l)
  2933. }
  2934. for (e = 0; e < d.length; e++) delete F[d[e]];
  2935. c = Ea(b, 3 + 8 * c);
  2936. g = b.getUint16(c, !0);
  2937. c += 2;
  2938. for (d = 0; d < g; d++) {
  2939. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  2940. if (r[e].id == n) {
  2941. var k = r[e];
  2942. if (1 == k.type)
  2943. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  2944. for (var h =
  2945. n; h < n + p; ++h) --T[h + 400 * m];
  2946. r.splice(e, 1);
  2947. break a
  2948. }c += 4
  2949. }
  2950. g = b.getUint16(c, !0);
  2951. c += 2;
  2952. for (d = 0; d < g; d++) {
  2953. a: {
  2954. e = b.getUint32(c, !0);
  2955. for (n = 0; n < r.length; n++)
  2956. if (r[n].id == e) {
  2957. e = r[n];
  2958. break a
  2959. }
  2960. e = {
  2961. id: e
  2962. };
  2963. r.push(e)
  2964. }
  2965. c += 4;c = la(b, c, e)
  2966. }
  2967. c = Fa(b, c);
  2968. if (a.byteLength < c + 4) break;
  2969. aa = b.getUint32(c, !0);
  2970. break;
  2971. case 4: // Without this the level don't show
  2972. $();
  2973. W(b.getUint16(1, !0), b.getUint16(3, !0));
  2974. g = b.getUint16(5, !0);
  2975. c = 7;
  2976. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  2977. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  2978. Z();
  2979. break;
  2980. case 5: // Without this things don't trigger unless you are drawing. Also, you can't click buttons.
  2981. W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z()
  2982. }
  2983. }
  2984.  
  2985. // Without this, your position only updates if you click or draw
  2986. function Q() {
  2987. lastFrame = currentFrame;
  2988. currentFrame = new Date().getTime();
  2989.  
  2990. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  2991. var a = new ArrayBuffer(9);
  2992. b = new DataView(a);
  2993. b.setUint8(0, 1);
  2994. b.setUint16(1, k, !0);
  2995. b.setUint16(3, q, !0);
  2996. b.setUint32(5, G, !0);
  2997. u.send(a);
  2998. J = k;
  2999. K = q
  3000. }
  3001.  
  3002. if (auraEnabled) // Drawing cursor aura
  3003. drawAura(J, K);
  3004. }
  3005.  
  3006. // Without this clicking doesn't actually get transmitted to the server
  3007. function wa(a, b, numClicks) {
  3008. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  3009. var c = new ArrayBuffer(9),
  3010. d = new DataView(c);
  3011. d.setUint8(0, 2);
  3012. d.setUint16(1, a, !0);
  3013. d.setUint16(3, b, !0);
  3014. d.setUint32(5, G, !0);
  3015. for (var i = 0; i < numClicks; i++) { u.send(c) } // Changed to click multiple times
  3016. }
  3017. }
  3018.  
  3019. function la(f, b, c) {
  3020. function d() { // Handles drawing stuff
  3021. if (c.type == 4 && initialLoad) {
  3022. c.x = f.getUint16(b, !0);
  3023. buttons[buttonIndex][0] = c.x
  3024. b += 2;
  3025. c.y = f.getUint16(b, !0);
  3026. buttons[buttonIndex][1] = c.y
  3027. b += 2;
  3028. c.width = f.getUint16(b, !0);
  3029. b += 2;
  3030. c.height = f.getUint16(b, !0);
  3031. b += 2
  3032.  
  3033. buttonIndex++;
  3034. } else {
  3035. c.x = f.getUint16(b, !0);
  3036. b += 2;
  3037. c.y = f.getUint16(b, !0);
  3038. b += 2;
  3039. c.width = f.getUint16(b, !0);
  3040. b += 2;
  3041. c.height = f.getUint16(b, !0);
  3042. b += 2
  3043. }
  3044. }
  3045. function g() { // Handles coloring stuff
  3046. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  3047. b += 4;
  3048. c.color = "#" + a
  3049. }
  3050. var e = f.getUint8(b);
  3051. b += 1;
  3052. c.type = e;
  3053. switch (e) {
  3054. case 255:
  3055. break;
  3056. case 0: // Draws text
  3057. c.x = f.getUint16(b, !0);
  3058. b += 2;
  3059. c.y = f.getUint16(b, !0);
  3060. b += 2;
  3061. c.size = f.getUint8(b);
  3062. b += 1;
  3063. c.isCentered = !!f.getUint8(b);
  3064. b += 1;
  3065. e = Da(f, b);
  3066. c.text = e[0];
  3067. b = e[1];
  3068. break;
  3069. case 1: // May relate to cursor movement?
  3070. d();
  3071. var n = !c.color;
  3072. g();
  3073. var e = c.x | 0,
  3074. l = c.y | 0,
  3075. p = c.width | 0,
  3076. k = c.height | 0;
  3077. if (n)
  3078. for (n = l; n < l + k; ++n)
  3079. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  3080. break;
  3081. case 2: // Draws exit points
  3082. d();
  3083. c.isBad = !!f.getUint8(b);
  3084. b += 1;
  3085. break;
  3086. case 3: // Handles the area triggers
  3087. d();
  3088. c.count = f.getUint16(b, !0);
  3089. b += 2;
  3090. g();
  3091. break;
  3092. case 4: // Something about buttons, but also affects doors and area triggers
  3093. d();
  3094. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  3095. c.count = f.getUint16(b, !0);
  3096. if (initialLoad) buttons[buttonIndex-1][2] = 1;
  3097. b += 2;
  3098. g();
  3099. break;
  3100. case 5:
  3101. c.x = f.getUint16(b, !0);
  3102. b += 2;
  3103. c.y = f.getUint16(b, !0);
  3104. b += 2;
  3105. c.queue = [
  3106. [0, c.x, c.y]
  3107. ];
  3108. c.potentialQueue = [];
  3109. c.explored = new Uint8Array(12E4);
  3110. c.img = a.createImageData(400, 300);
  3111. e = E.createElement("canvas");
  3112. e.width = 400;
  3113. e.height = 300;
  3114. c.canvas = e;
  3115. c.ctx = c.canvas.getContext("2d");
  3116. break;
  3117. default:
  3118. throw Error("Unknown object type " + e);
  3119. }
  3120. return b
  3121. }
  3122.  
  3123. function ea(a, b) {
  3124. if (-1 != J && -1 != K) {
  3125. var c = fa(J, K, a, b);
  3126. if (c.x != a || c.y != b) return !0
  3127. }
  3128. for (c = 0; c < r.length; c++) {
  3129. var d = r[c];
  3130. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0
  3131. }
  3132. return !1
  3133. }
  3134.  
  3135. function ma() {
  3136. a.clearRect(0, 0, 800, 600);
  3137. a.save();
  3138. if (null != u && u.readyState != WebSocket.OPEN || L) {
  3139. var f;
  3140. if (null == u) f = "Click to begin";
  3141. else switch (u.readyState) {
  3142. case WebSocket.CONNECTING:
  3143. f = "Connecting";
  3144. break;
  3145. case WebSocket.CLOSING:
  3146. case WebSocket.CLOSED:
  3147. f = "Lost connection to server";
  3148. break;
  3149. default:
  3150. f = "Click to begin"
  3151. }
  3152. a.font = "60px NovaSquare";
  3153. a.fillText(f, 400 - a.measureText(f).width / 2, 315);
  3154. na();
  3155. oa(!1)
  3156. } else {
  3157. a.fillStyle = "#000000";
  3158. a.save();
  3159. a.globalAlpha = 1;
  3160. Ha();
  3161. for (f = 0; f < r.length; f++) {
  3162. var b = r[f];
  3163. if (0 == b.type) {
  3164. a.font = b.size + "px NovaSquare";
  3165. var c = b.x << 1,
  3166. d = b.y << 1;
  3167. b.isCentered && (c -= a.measureText(b.text).width / 2);
  3168. a.fillStyle = "#000000";
  3169. a.fillText(b.text,
  3170. c, d)
  3171. } else if (1 == b.type) a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2, a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2), a.globalAlpha = 1;
  3172. else if (2 == b.type) a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.globalAlpha = 1;
  3173. else if (3 == b.type) {
  3174. var c = b.x << 1,
  3175. d = b.y << 1,
  3176. g = b.width << 1,
  3177. e = b.height << 1;
  3178. a.fillStyle = b.color;
  3179. a.globalAlpha = .2;
  3180. a.fillRect(c, d, g, e);
  3181. a.globalAlpha =
  3182. .5;
  3183. a.fillStyle = "#000000";
  3184. 40 > b.width || 40 > b.height ? (a.font = "30px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10)) : (a.font = "60px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20));
  3185. a.globalAlpha = 1
  3186. } else if (4 == b.type) {
  3187. c = b.x << 1;
  3188. d = b.y << 1;
  3189. g = b.width << 1;
  3190. e = b.height << 1;
  3191. a.fillStyle = b.color;
  3192. a.strokeStyle = b.color;
  3193. a.globalAlpha = 1;
  3194. a.fillRect(c, d, g, e);
  3195. a.globalAlpha = .2;
  3196. a.fillStyle = "#000000";
  3197. a.fillRect(c, d, g, e);
  3198. a.globalAlpha = 1;
  3199. a.fillStyle = b.color;
  3200. var n = 150 > t - b.lastClickAt,
  3201. l = n ? 8 : 12;
  3202. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  3203. a.strokeStyle = "#000000";
  3204. a.globalAlpha = .1;
  3205. a.beginPath();
  3206. a.moveTo(c, d);
  3207. a.lineTo(c + l, d + l);
  3208. a.moveTo(c + g, d);
  3209. a.lineTo(c + g - l, d + l);
  3210. a.moveTo(c, d + e);
  3211. a.lineTo(c + l, d + e - l);
  3212. a.moveTo(c + g, d + e);
  3213. a.lineTo(c + g - l, d + e - l);
  3214. a.moveTo(c, d);
  3215. a.rect(c, d, g, e);
  3216. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  3217. a.stroke();
  3218. a.fillStyle = "#000000";
  3219. a.globalAlpha = .5;
  3220. 50 > b.width || 50 > b.height ? (a.font = "35px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13)) : (a.font = "45px NovaSquare", a.fillText(b.count,
  3221. c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16));
  3222. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  3223. a.globalAlpha = 1
  3224. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600), ga(!0))
  3225. }
  3226. a.restore();
  3227. D || (a.font = "12px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5, f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw", a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1, a.fillText(f,
  3228. 10, 590), 0 != aa && (f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1, a.fillText(f, 790 - b, 590)));
  3229. na();
  3230. if (!H.checked) {
  3231. a.save();
  3232. a.strokeStyle = "#000000";
  3233. a.lineWidth = 1;
  3234. t = +new Date;
  3235. for (f = 0; f < O.length; f++) b = O[f], c = 10 - (t - b[4]) / 1E3, 0 >= c ? (O.splice(f, 1), --f) : (1 < c && (c = 1), a.globalAlpha = .3 * c, a.beginPath(), a.moveTo(b[0] - .5, b[1] - .5), a.lineTo(b[2] - .5, b[3] - .5), a.stroke());
  3236. a.restore()
  3237. }
  3238. a.save();
  3239. for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) -
  3240. 6);
  3241. a.restore();
  3242. oa(!0)
  3243. }
  3244. a.restore();
  3245. A.requestAnimationFrame(ma)
  3246. }
  3247.  
  3248. function na() { // draws circles when you click
  3249. a.save();
  3250. a.strokeStyle = "#000000";
  3251. t = +new Date;
  3252. for (var f = 0; f < I.length; f++) {
  3253. var b = I[f],
  3254. c = (t - b[2]) / 1E3,
  3255. d = 1 - 2 * c;
  3256. 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke())
  3257. }
  3258. a.restore()
  3259. }
  3260.  
  3261. function oa(f) {
  3262. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5);
  3263. else {
  3264. var b = 0,
  3265. c = 0;
  3266. v != k || w != q ? (a.save(), f && (a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath(), a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1),
  3267. a.fill()), a.globalAlpha = .5, a.drawImage(P, B - 5, C - 5), a.restore()) : (b = B & 1, c = C & 1);
  3268. a.save();
  3269. f && (a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath(), a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1), a.fill());
  3270. a.globalAlpha = 1;
  3271. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5)
  3272. }
  3273. a.restore()
  3274. }
  3275.  
  3276. function ka(a, b) {
  3277. this.oldX = this.newX = a;
  3278. this.oldY = this.newY = b;
  3279. this.time = t
  3280. }
  3281.  
  3282. function pa(a) {
  3283. return a * a * (3 - 2 * a)
  3284. }
  3285.  
  3286. function fa(a, b, c, d) {
  3287. a |= 0;
  3288. b |= 0;
  3289. c |= 0;
  3290. d |= 0;
  3291. if (z(a, b)) return {
  3292. x: a,
  3293. y: b
  3294. };
  3295. if (a == c && b == d) return {
  3296. x: c,
  3297. y: d
  3298. };
  3299. var g = a,
  3300. e = b;
  3301. c = c - a | 0;
  3302. d = d - b | 0;
  3303. var n =
  3304. 0,
  3305. l = 0,
  3306. p = 0,
  3307. k = 0;
  3308. 0 > c ? n = -1 : 0 < c && (n = 1);
  3309. 0 > d ? l = -1 : 0 < d && (l = 1);
  3310. 0 > c ? p = -1 : 0 < c && (p = 1);
  3311. var m = Math.abs(c) | 0,
  3312. h = Math.abs(d) | 0;
  3313. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  3314. c = m >> 1;
  3315. for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k);
  3316. return {
  3317. x: g,
  3318. y: e
  3319. }
  3320. }
  3321.  
  3322. function z(a, b) {
  3323. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  3324. }
  3325.  
  3326. function Ja() {
  3327. for (var a = 0; a < r.length; a++) {
  3328. var b = r[a];
  3329. 5 == b.type && Ka(b)
  3330. }
  3331. }
  3332.  
  3333. function Ka(a) {
  3334. function b(a, b, c) {
  3335. e.push([c, a, b]);
  3336. l[a + 400 * b] = !0;
  3337. g(a, b)
  3338. }
  3339.  
  3340. function c(a, b, c) {
  3341. p.push([c,
  3342. a, b
  3343. ]);
  3344. l[a + 400 * b] = !0
  3345. }
  3346.  
  3347. function d(a, b) {
  3348. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  3349. }
  3350.  
  3351. function g(a, b) {
  3352. var c = 4 * (a + 400 * b);
  3353. k[c + 0] = 255;
  3354. k[c + 1] = 153;
  3355. k[c + 2] = 153;
  3356. k[c + 3] = 255
  3357. }
  3358. for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m);
  3359. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  3360. for (r = 0; 50 > r && 0 != e.length; ++r) {
  3361. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  3362. var x = e[m][0];
  3363. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  3364. }
  3365. for (m = 0; m < q.length; ++m) {
  3366. var x = q[m][0],
  3367. h = q[m][1],
  3368. s = q[m][2],
  3369. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  3370. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  3371. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  3372. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  3373. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  3374. 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2));
  3375. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  3376. b(h - 1, s + 1, x + Math.SQRT2));
  3377. 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2));
  3378. 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2))
  3379. }
  3380. }
  3381. a.ctx.putImageData(a.img, 0, 0)
  3382. }
  3383. var y, a, ia = 0,
  3384. v = 0,
  3385. w = 0,
  3386. B = 0,
  3387. C = 0,
  3388. k = 0,
  3389. q = 0,
  3390. J = -1,
  3391. K = -1,
  3392. M = null,
  3393. H = null,
  3394. P = new Image;
  3395. P.src = "img/cursor.png";
  3396. var Ia = P,
  3397. D = -1 != A.location.search.indexOf("editor"),
  3398. I = [],
  3399. O = [],
  3400. t = 0,
  3401. ca = 0,
  3402. u = null,
  3403. ha = -1,
  3404. F = {},
  3405. aa = 0,
  3406. ja = !1,
  3407. Y = !1,
  3408. R = 0,
  3409. S = 0,
  3410. da = 0,
  3411. X = !1,
  3412. L = !D && !0,
  3413. T = new Uint8Array(12E4),
  3414. r = [],
  3415. N = [];
  3416. Array.prototype.remove =
  3417. function(a) {
  3418. a = this.indexOf(a);
  3419. return -1 != a ? (this.splice(a, 1), !0) : !1
  3420. };
  3421. var G = 0;
  3422. ka.prototype = {
  3423. oldX: 0,
  3424. oldY: 0,
  3425. newX: 0,
  3426. newY: 0,
  3427. time: 0,
  3428. getX: function() {
  3429. var a = this.newX - this.oldX,
  3430. b = (t - this.time) / 100,
  3431. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  3432. return this.oldX + b * a
  3433. },
  3434. getY: function() {
  3435. var a = this.newY - this.oldY,
  3436. b = (t - this.time) / 100,
  3437. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  3438. return this.oldY + b * a
  3439. }
  3440. };
  3441. var ra = function() {
  3442. function f() {
  3443. var a = 0,
  3444. b = 0,
  3445. c = v / 10,
  3446. d = w / 10;
  3447. n < c ? (c = Math.ceil(c), a = Math.floor(n)) : (c = Math.floor(c), a = Math.ceil(n));
  3448. l < d ? (d = Math.ceil(d), b = Math.floor(l)) :
  3449. (d = Math.floor(d), b = Math.ceil(l));
  3450. if (a > c) var e = c,
  3451. c = a,
  3452. a = e;
  3453. b > d && (e = d, d = b, b = e);
  3454. return {
  3455. sx: a,
  3456. sy: b,
  3457. fx: c,
  3458. fy: d
  3459. }
  3460. }
  3461.  
  3462. function b() {
  3463. e = !0;
  3464. n = v / 10;
  3465. l = w / 10
  3466. }
  3467.  
  3468. function c(a) {
  3469. return "0x" + parseInt(a.slice(1), 16).toString(16).toUpperCase()
  3470. }
  3471.  
  3472. function d(a, b, c, d, e) {
  3473. a = {
  3474. x: 10 * ~~(k / 10) - ~~(a / 2) + c,
  3475. y: 10 * ~~(q / 10) - ~~(b / 2) + d,
  3476. width: a,
  3477. height: b
  3478. };
  3479. for (var f in e) e.hasOwnProperty(f) && (a[f] = e[f]);
  3480. return a
  3481. }
  3482.  
  3483. function g(a, b) {
  3484. for (var c = null, d = Number.POSITIVE_INFINITY, e = 0; e < r.length; e++) {
  3485. var f = r[e];
  3486. if (f.hasOwnProperty("x") && f.hasOwnProperty("y") && f.hasOwnProperty("width") &&
  3487. f.hasOwnProperty("height")) {
  3488. var g = f.x + f.width / 2,
  3489. h = f.y + f.height / 2,
  3490. g = (a - g) * (a - g) + (b - h) * (b - h);
  3491. g < d && (d = g, c = f)
  3492. }
  3493. }
  3494. return c
  3495. }
  3496. var e = !1,
  3497. n = 0,
  3498. l = 0,
  3499. p = 1,
  3500. u = 200,
  3501. m = 150,
  3502. h = new Uint8Array(1200),
  3503. t = "#000000 #FF9999 #9999FF #FFFF99 #99FFFF #FF99FF #3333FF".split(" ");
  3504. E.addEventListener("mouseup", function() {
  3505. if (e) {
  3506. for (var a = f(), b = p, c = a.sy; c < a.fy; ++c)
  3507. for (var d = a.sx; d < a.fx; ++d) h[d + 40 * c] = b;
  3508. e = !1
  3509. }
  3510. });
  3511. E.addEventListener("mousemove", function() {});
  3512. A.generateCode = function() {
  3513. for (var a = "class Level? : public Level {\npublic:\n\tLevel?() : Level(" +
  3514. u + ", " + m + "){}\n\n\tvoid OnInit(){\n", a = a + ("\t\tstd::vector<LevelObject*> wallByColor[" + t.length + "];\n"), b = new Uint8Array(1200), d = [], e = 0; 30 > e; ++e)
  3515. for (var f = 0; 40 > f; ++f)
  3516. if (!b[f + 40 * e]) {
  3517. var g = h[f + 40 * e];
  3518. if (0 != g) {
  3519. for (var k = f; 40 > f && h[f + 40 * e] == g && !b[f + 40 * e];) b[f + 40 * e] = !0, ++f;
  3520. var l = f--,
  3521. p = l - k,
  3522. q = e++;
  3523. a: for (; 30 > e;) {
  3524. for (var n = k; n < l; ++n) {
  3525. if (h[n + 40 * e] != g) break a;
  3526. if (b[n + 40 * e]) break a
  3527. }
  3528. for (n = k; n < l; ++n) b[n + 40 * e] = !0;
  3529. ++e
  3530. }
  3531. l = e - q;
  3532. e = q;
  3533. d.push({
  3534. x: 10 * k,
  3535. y: 10 * q,
  3536. width: 10 * p,
  3537. height: 10 * l,
  3538. color: g - 1
  3539. })
  3540. }
  3541. }
  3542. for (b = 0; b < d.length; b++) e = d[b], 0 ==
  3543. e.color ? a += "\t\tAddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", 0x000000));\n" : (f = c(t[e.color]), a += "\t\twallByColor[" + e.color + "].push_back(AddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", " + f + ")));\n");
  3544. for (b = 0; b < r.length; b++) d = r[b], 0 != d.type && (2 == d.type ? a += "\t\tAddObject(new ObjTeleport(LevelManager::GetNextLevel(this), " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + "));\n" : 3 == d.type ? (a += "\t\tAddObject(new ObjAreaCounter(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y +
  3545. ", " + d.width + ", " + d.height + ", ", a += d.count + ", " + c(d.color) + "));\n") : 4 == d.type && (a += "\t\tAddObject(new ObjClickBox(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + ", ", a += d.count + ", 1000, " + c(d.color) + "));\n"));
  3546. return a += "\t}\n};\n"
  3547. };
  3548. E.addEventListener("keydown", function(a) {
  3549. if (a.keyCode == 8) {
  3550. a.preventDefault();
  3551. if (message.length > 0) {
  3552. message = message.substring(0, message.length - 1);
  3553. messageDisplay.innerHTML = message;
  3554. }
  3555. }
  3556. else if (a.keyCode == 9) {
  3557. a.preventDefault();
  3558. }
  3559. if (D) {
  3560. var b = a.keyCode;
  3561. 65 == b ? (--p, 0 > p && (p = t.length)) : 83 == b ? (++p, p > t.length && (p = 0)) : 66 == b ? 1 >= p || r.push(d(40, 40, 5, 5, {
  3562. type: 4,
  3563. color: t[p - 1],
  3564. colorCode: p - 1,
  3565. count: 5
  3566. })) : 90 == b ? r.pop() : 87 == b ? r.push(d(50, 50, -5, -5, {
  3567. type: 2,
  3568. isBad: !1
  3569. })) : 79 == b ? (u = k, m = q) : 78 == b ? 1 >= p || r.push(d(40, 40, 0, 0, {
  3570. type: 3,
  3571. color: t[p - 1],
  3572. colorCode: p - 1,
  3573. count: 1
  3574. })) : 37 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.width -= 10 : (b.x -= 10, b.width += 10), 0 == b.width && r.splice(r.indexOf(b), 1))) : 39 == b ? (b = g(v, w), null != b && (a.shiftKey ? (b.x += 10, b.width -= 10) : b.width += 10, 0 == b.width && r.splice(r.indexOf(b), 1))) : 38 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.height -= 10 : (b.y -= 10, b.height += 10), 0 == b.height && r.splice(r.indexOf(b), 1))) : 40 == b && (b = g(v, w), null != b && (a.shiftKey ? (b.y += 10, b.height -= 10) : b.height +=
  3575. 10, 0 == b.height && r.splice(r.indexOf(b), 1)))
  3576. }
  3577. });
  3578. return {
  3579. renderEditor: function() {
  3580. if (D) {
  3581. a.save();
  3582. a.fillStyle = "#FF0000";
  3583. a.strokeStyle = "#FF0000";
  3584. a.lineWidth = 1;
  3585. a.globalAlpha = .09;
  3586. a.beginPath();
  3587. for (var b = 0; 400 > b; b += 10) a.moveTo((b << 1) + .5, 0), a.lineTo((b << 1) + .5, 600);
  3588. for (var c = 0; 300 > c; c += 10) a.moveTo(0, (c << 1) + .5), a.lineTo(800, (c << 1) + .5);
  3589. a.stroke();
  3590. a.lineWidth = 2;
  3591. a.beginPath();
  3592. a.moveTo(400.5, 0);
  3593. a.lineTo(400.5, 600);
  3594. a.moveTo(0, 300.5, 0);
  3595. a.lineTo(800, 300.5);
  3596. a.stroke();
  3597. a.lineWidth = 1;
  3598. a.globalAlpha = 1;
  3599. a.fillStyle = "#000000";
  3600. for (var d = f(), c = 0; 300 > c; c += 10)
  3601. for (b = 0; 400 > b; b += 10) {
  3602. var g = b / 10 | 0,
  3603. k = c / 10 | 0,
  3604. l = h[g + 40 * k];
  3605. e && g >= d.sx && g < d.fx && k >= d.sy && k < d.fy && (l = p);
  3606. 0 != l && (a.fillStyle = t[l - 1], a.fillRect(b << 1, c << 1, 20, 20))
  3607. }
  3608. a.save();
  3609. a.globalAlpha = .09;
  3610. a.fillStyle = "#0000FF";
  3611. a.beginPath();
  3612. a.arc(u << 1, m << 1, 20, 0, 2 * Math.PI, !1);
  3613. a.fill();
  3614. a.restore();
  3615. a.save();
  3616. a.fillStyle = "#FFFFFF";
  3617. a.strokeStyle = "#000000";
  3618. a.lineWidth = 2.5;
  3619. a.font = "14px NovaSquare";
  3620. a.globalAlpha = .5;
  3621. a.strokeText("Current color: ", 10, 590);
  3622. a.globalAlpha = 1;
  3623. a.fillText("Current color: ", 10,
  3624. 590);
  3625. 0 == p ? a.fillText("ESR", 105, 590) : (a.fillStyle = "#000000", a.fillRect(104, 575, 22, 22), a.fillStyle = t[p - 1], a.fillRect(105, 576, 20, 20));
  3626. a.restore();
  3627. a.restore()
  3628. }
  3629. },
  3630. initEditor: function() {
  3631. y.addEventListener("mousedown", b)
  3632. }
  3633. }
  3634. }(),
  3635. Ha = ra.renderEditor,
  3636. La = ra.initEditor,
  3637. za = new Uint8Array(12E4);
  3638. Array.prototype.remove = function(a) {
  3639. a = this.indexOf(a);
  3640. return -1 != a ? (this.splice(a, 1), !0) : !1
  3641. };
  3642.  
  3643. function handleKeyboard(e) {
  3644. if ((e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63 || e.keyCode == 58 || e.keyCode == 40 || e.keyCode == 41) {
  3645. message = message.concat(String.fromCharCode(e.keyCode));
  3646. messageDisplay.innerHTML = message;
  3647. return;
  3648. }
  3649. switch(e.keyCode) {
  3650. case 13:
  3651. drawWord(message, posX, posY);
  3652. message = "";
  3653. messageDisplay.innerHTML = message;
  3654. e.preventDefault();
  3655. break;
  3656. case 96: // Click all buttons
  3657. clickAllButtons();
  3658. break;
  3659. case 47:
  3660. movementEnabled = !movementEnabled
  3661. break;
  3662. case 45: // Toggle Aura
  3663. auraEnabled = !auraEnabled;
  3664. break;
  3665. case 43:
  3666. drawImage(posX, posY);
  3667. break;
  3668. case 42:
  3669. markerEnabled = !markerEnabled;
  3670. break;
  3671. default:
  3672. return;
  3673. }
  3674. }
  3675.  
  3676. function clickAllButtons() {
  3677. for (var i = 0; i < maxButtons; i++) {
  3678. if (buttons[i][0] == null) break;
  3679. wa(buttons[i][0], buttons[i][1], buttons[i][2]);
  3680. }
  3681. }
  3682.  
  3683. function drawAura(x, y) {
  3684. var dt = 360/(1000/40)/2;
  3685. if (u != null && u.readyState == WebSocket.OPEN) {
  3686. var g = new ArrayBuffer(9),
  3687. e = new DataView(g);
  3688. e.setUint8(0, 3);
  3689. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  3690. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  3691. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  3692. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  3693. u.send(g)
  3694. }
  3695.  
  3696. auraTime += dt;
  3697. }
  3698.  
  3699. function degToRad(deg) {
  3700. return deg * (Math.PI / 180);
  3701. }
  3702.  
  3703. function radToDeg(rad) {
  3704. return rad * (180 / Math.PI);
  3705. }
  3706.  
  3707. var drawIndex = 0;
  3708. function drawImage(x, y) {
  3709. setTimeout(function () {
  3710. var g = new ArrayBuffer(9),
  3711. e = new DataView(g);
  3712.  
  3713. e.setUint8(0, 3);
  3714. e.setUint16(1, x+imgData[drawIndex][1]*imageScale, !0);
  3715. e.setUint16(3, y+imgData[drawIndex][0]*imageScale, !0);
  3716. e.setUint16(5, x+imgData[drawIndex][3]*imageScale, !0);
  3717. e.setUint16(7, y+imgData[drawIndex][2]*imageScale, !0);
  3718. u.send(g);
  3719.  
  3720. drawIndex++;
  3721. if (drawIndex < imgData.length)
  3722. drawImage(x, y);
  3723. else
  3724. drawIndex = 0;
  3725. }, 15)
  3726. }
  3727.  
  3728. function drawLetter(a, x, y) {
  3729. var letter = alphabet[a];
  3730.  
  3731. if (letter == null)
  3732. return;
  3733.  
  3734. var g = new ArrayBuffer(9),
  3735. e = new DataView(g);
  3736.  
  3737. for (var i = 0; i < letter.length; i++) {
  3738. e.setUint8(0, 3);
  3739. e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  3740. e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  3741. e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  3742. e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  3743. for (var j = 0; j < 4; j++) { u.send(g); }
  3744. }
  3745. }
  3746.  
  3747. var messageDisplay;
  3748. var message = new String();
  3749. var wordIndex = 0;
  3750. function drawWord(s, x, y) {
  3751. setTimeout(function () {
  3752. drawLetter(s.charCodeAt(0), x, y);
  3753. wordIndex++;
  3754. if (s.length > 0)
  3755. drawWord(s.substring(1, s.length), x+fontSize*3, y);
  3756. else {
  3757. wordIndex = 0;
  3758. letterOffset = 0;
  3759. }
  3760. }, 20);
  3761. }
  3762.  
  3763. function doit() {
  3764. document.body.innerHTML += '<div id="messageDisplay"></div>';
  3765. messageDisplay = document.getElementById("messageDisplay");
  3766.  
  3767. y = E.getElementById("canvas");
  3768. a = y.getContext("2d");
  3769. try {
  3770. A.top.location.origin != A.location.origin && ba()
  3771. } catch (f) {
  3772. ba()
  3773. }
  3774. y.onmousemove = ua;
  3775. y.onmousedown = va;
  3776. y.onmouseup = xa;
  3777. M = E.getElementById("noCursorLock");
  3778. H = E.getElementById("noDrawings");
  3779. null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  3780. A.onbeforeunload = ya;
  3781. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  3782. y.style.cursor = "none";
  3783. La();
  3784. D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
  3785. Ba, u.onerror = Ca);
  3786. setInterval(Q, 50);
  3787. setInterval(Ja, 40);
  3788. A.requestAnimationFrame(ma)
  3789.  
  3790. document.onkeypress = handleKeyboard;
  3791. }
  3792.  
  3793. doit();var A = window;
  3794. var E = document;
  3795.  
  3796. var debugMode = false;
  3797.  
  3798. var posX, posY;
  3799. var lastX, lastY;
  3800.  
  3801. var lastFrame;
  3802. var currentFrame;
  3803.  
  3804. var initialLoad = true;
  3805. var buttonIndex = 0;
  3806. var maxButtons = 20;
  3807. var buttons = new Array(maxButtons);
  3808. for (var i = 0; i < maxButtons; i++)
  3809. buttons[i] = new Array(3);
  3810.  
  3811. var auraEnabled = false;
  3812. var auraTime = 0;
  3813. var auraRadius = 10;
  3814.  
  3815. var markerEnabled = false;
  3816.  
  3817. var movementEnabled = true;
  3818.  
  3819. var imageScale = 1.0;
  3820. var imgData = [ [17,49,17,57],
  3821. [18,44,18,52],
  3822. [18,55,18,59],
  3823. [19,41,19,46],
  3824. [19,58,19,60],
  3825. [20,40,20,42],
  3826. [20,60,20,62],
  3827. [21,38,21,40],
  3828. [21,61,21,63],
  3829. [22,37,22,39],
  3830. [22,62,22,64],
  3831. [23,37,23,38],
  3832. [23,63,23,65],
  3833. [24,36,24,37],
  3834. [24,64,24,65],
  3835. [25,35,25,37],
  3836. [25,65,25,66],
  3837. [26,34,26,36],
  3838. [26,65,26,67],
  3839. [27,33,27,35],
  3840. [27,66,27,67],
  3841. [28,32,28,34],
  3842. [28,67,28,68],
  3843. [29,32,29,34],
  3844. [29,67,29,68],
  3845. [30,31,30,33],
  3846. [30,67,30,69],
  3847. [31,31,31,32],
  3848. [31,68,31,69],
  3849. [32,31,32,32],
  3850. [32,68,32,69],
  3851. [33,30,33,31],
  3852. [33,55,33,59],
  3853. [33,68,33,69],
  3854. [34,30,34,31],
  3855. [34,53,34,58],
  3856. [34,59,34,61],
  3857. [34,68,34,70],
  3858. [35,29,35,31],
  3859. [35,52,35,57],
  3860. [35,61,35,62],
  3861. [35,69,35,70],
  3862. [36,29,36,30],
  3863. [36,50,36,57],
  3864. [36,62,36,63],
  3865. [36,69,36,70],
  3866. [37,29,37,30],
  3867. [37,50,37,58],
  3868. [37,62,37,63],
  3869. [37,69,37,70],
  3870. [38,28,38,30],
  3871. [38,49,38,58],
  3872. [38,69,38,71],
  3873. [38,108,38,115],
  3874. [39,28,39,29],
  3875. [39,49,39,57],
  3876. [39,63,39,64],
  3877. [39,70,39,71],
  3878. [39,107,39,110],
  3879. [39,114,39,116],
  3880. [40,28,40,35],
  3881. [40,48,40,57],
  3882. [40,63,40,64],
  3883. [40,70,40,71],
  3884. [40,107,40,109],
  3885. [40,116,40,117],
  3886. [41,27,41,32],
  3887. [41,35,41,36],
  3888. [41,48,41,57],
  3889. [41,63,41,64],
  3890. [41,70,41,71],
  3891. [41,107,41,108],
  3892. [41,117,41,118],
  3893. [42,26,42,32],
  3894. [42,36,42,37],
  3895. [42,48,42,56],
  3896. [42,62,42,64],
  3897. [42,70,42,72],
  3898. [42,107,42,108],
  3899. [42,118,42,119],
  3900. [43,25,43,32],
  3901. [43,36,43,38],
  3902. [43,41,43,42],
  3903. [43,48,43,56],
  3904. [43,62,43,63],
  3905. [43,70,43,72],
  3906. [43,107,43,108],
  3907. [43,118,43,119],
  3908. [44,25,44,32],
  3909. [44,37,44,38],
  3910. [44,40,44,41],
  3911. [44,47,44,55],
  3912. [44,61,44,63],
  3913. [44,71,44,72],
  3914. [44,107,44,108],
  3915. [44,118,44,119],
  3916. [45,24,45,32],
  3917. [45,37,45,40],
  3918. [45,48,45,50],
  3919. [45,59,45,62],
  3920. [45,71,45,72],
  3921. [45,107,45,108],
  3922. [45,118,45,119],
  3923. [46,24,46,32],
  3924. [46,37,46,40],
  3925. [46,49,46,51],
  3926. [46,58,46,60],
  3927. [46,71,46,72],
  3928. [46,107,46,108],
  3929. [46,119,46,120],
  3930. [47,23,47,32],
  3931. [47,37,47,39],
  3932. [47,50,47,53],
  3933. [47,55,47,58],
  3934. [47,71,47,73],
  3935. [47,107,47,108],
  3936. [47,119,47,120],
  3937. [48,23,48,31],
  3938. [48,36,48,39],
  3939. [48,52,48,56],
  3940. [48,72,48,73],
  3941. [48,107,48,108],
  3942. [48,119,48,120],
  3943. [49,23,49,30],
  3944. [49,35,49,38],
  3945. [49,62,49,65],
  3946. [49,72,49,73],
  3947. [49,106,49,108],
  3948. [49,119,49,120],
  3949. [50,24,50,29],
  3950. [50,34,50,38],
  3951. [50,43,50,46],
  3952. [50,61,50,64],
  3953. [50,72,50,74],
  3954. [50,106,50,108],
  3955. [50,119,50,120],
  3956. [51,24,51,28],
  3957. [51,32,51,34],
  3958. [51,36,51,37],
  3959. [51,40,51,42],
  3960. [51,45,51,46],
  3961. [51,58,51,62],
  3962. [51,72,51,74],
  3963. [51,106,51,108],
  3964. [51,119,51,120],
  3965. [52,25,52,32],
  3966. [52,36,52,37],
  3967. [52,45,52,46],
  3968. [52,56,52,60],
  3969. [52,73,52,74],
  3970. [52,106,52,108],
  3971. [52,119,52,120],
  3972. [53,26,53,28],
  3973. [53,35,53,37],
  3974. [53,44,53,46],
  3975. [53,55,53,58],
  3976. [53,73,53,74],
  3977. [53,106,53,107],
  3978. [53,119,53,120],
  3979. [54,26,54,27],
  3980. [54,36,54,38],
  3981. [54,41,54,45],
  3982. [54,52,54,56],
  3983. [54,73,54,75],
  3984. [54,106,54,107],
  3985. [54,119,54,120],
  3986. [55,26,55,27],
  3987. [55,37,55,44],
  3988. [55,50,55,54],
  3989. [55,74,55,75],
  3990. [55,106,55,107],
  3991. [55,119,55,120],
  3992. [56,26,56,27],
  3993. [56,47,56,51],
  3994. [56,74,56,75],
  3995. [56,106,56,107],
  3996. [56,119,56,120],
  3997. [57,26,57,27],
  3998. [57,45,57,49],
  3999. [57,74,57,76],
  4000. [57,106,57,107],
  4001. [57,119,57,120],
  4002. [58,26,58,27],
  4003. [58,42,58,46],
  4004. [58,74,58,76],
  4005. [58,106,58,107],
  4006. [58,115,58,116],
  4007. [58,118,58,119],
  4008. [59,26,59,28],
  4009. [59,39,59,44],
  4010. [59,75,59,76],
  4011. [59,105,59,107],
  4012. [59,118,59,119],
  4013. [60,27,60,28],
  4014. [60,37,60,41],
  4015. [60,75,60,77],
  4016. [60,105,60,106],
  4017. [60,118,60,119],
  4018. [60,124,60,125],
  4019. [61,27,61,28],
  4020. [61,33,61,38],
  4021. [61,76,61,77],
  4022. [61,105,61,106],
  4023. [61,117,61,118],
  4024. [61,123,61,127],
  4025. [62,27,62,28],
  4026. [62,30,62,35],
  4027. [62,76,62,78],
  4028. [62,104,62,106],
  4029. [62,116,62,118],
  4030. [62,122,62,124],
  4031. [62,126,62,128],
  4032. [63,27,63,28],
  4033. [63,30,63,31],
  4034. [63,77,63,78],
  4035. [63,98,63,102],
  4036. [63,104,63,105],
  4037. [63,116,63,117],
  4038. [63,121,63,123],
  4039. [63,126,63,128],
  4040. [64,27,64,28],
  4041. [64,77,64,79],
  4042. [64,95,64,105],
  4043. [64,116,64,118],
  4044. [64,119,64,121],
  4045. [64,126,64,128],
  4046. [65,27,65,29],
  4047. [65,68,65,69],
  4048. [65,78,65,79],
  4049. [65,92,65,96],
  4050. [65,103,65,105],
  4051. [65,115,65,120],
  4052. [65,123,65,126],
  4053. [65,127,65,128],
  4054. [66,28,66,29],
  4055. [66,63,66,64],
  4056. [66,68,66,70],
  4057. [66,78,66,80],
  4058. [66,91,66,93],
  4059. [66,103,66,104],
  4060. [66,117,66,118],
  4061. [66,127,66,128],
  4062. [67,28,67,29],
  4063. [67,63,67,64],
  4064. [67,69,67,70],
  4065. [67,79,67,80],
  4066. [67,89,67,91],
  4067. [67,103,67,104],
  4068. [67,126,67,128],
  4069. [68,28,68,29],
  4070. [68,64,68,65],
  4071. [68,69,68,70],
  4072. [68,79,68,81],
  4073. [68,87,68,89],
  4074. [68,102,68,104],
  4075. [68,120,68,131],
  4076. [69,28,69,29],
  4077. [69,69,69,70],
  4078. [69,80,69,82],
  4079. [69,87,69,88],
  4080. [69,102,69,103],
  4081. [69,122,69,132],
  4082. [70,29,70,30],
  4083. [70,70,70,71],
  4084. [70,80,70,82],
  4085. [70,85,70,87],
  4086. [70,101,70,113],
  4087. [70,132,70,133],
  4088. [71,29,71,30],
  4089. [71,65,71,66],
  4090. [71,70,71,71],
  4091. [71,81,71,83],
  4092. [71,85,71,86],
  4093. [71,91,71,92],
  4094. [71,99,71,116],
  4095. [71,132,71,133],
  4096. [72,29,72,30],
  4097. [72,65,72,66],
  4098. [72,70,72,71],
  4099. [72,81,72,85],
  4100. [72,91,72,94],
  4101. [72,97,72,100],
  4102. [72,115,72,118],
  4103. [72,132,72,134],
  4104. [73,29,73,30],
  4105. [73,70,73,72],
  4106. [73,81,73,85],
  4107. [73,94,73,99],
  4108. [73,118,73,120],
  4109. [73,132,73,133],
  4110. [74,29,74,30],
  4111. [74,71,74,72],
  4112. [74,81,74,84],
  4113. [74,95,74,98],
  4114. [74,119,74,120],
  4115. [74,132,74,133],
  4116. [75,30,75,31],
  4117. [75,66,75,67],
  4118. [75,71,75,72],
  4119. [75,82,75,84],
  4120. [75,94,75,96],
  4121. [75,120,75,121],
  4122. [75,128,75,129],
  4123. [75,131,75,133],
  4124. [76,30,76,31],
  4125. [76,66,76,67],
  4126. [76,71,76,72],
  4127. [76,83,76,84],
  4128. [76,89,76,90],
  4129. [76,94,76,95],
  4130. [76,121,76,122],
  4131. [76,124,76,125],
  4132. [76,129,76,132],
  4133. [77,30,77,31],
  4134. [77,72,77,73],
  4135. [77,83,77,84],
  4136. [77,93,77,94],
  4137. [77,121,77,123],
  4138. [77,129,77,132],
  4139. [78,30,78,32],
  4140. [78,67,78,68],
  4141. [78,72,78,73],
  4142. [78,84,78,85],
  4143. [78,92,78,93],
  4144. [78,122,78,123],
  4145. [78,125,78,129],
  4146. [79,30,79,32],
  4147. [79,67,79,68],
  4148. [79,72,79,73],
  4149. [79,85,79,86],
  4150. [79,91,79,93],
  4151. [79,122,79,128],
  4152. [80,31,80,32],
  4153. [80,67,80,68],
  4154. [80,72,80,74],
  4155. [80,91,80,92],
  4156. [80,122,80,123],
  4157. [81,31,81,33],
  4158. [81,73,81,74],
  4159. [81,91,81,92],
  4160. [81,123,81,124],
  4161. [82,31,82,33],
  4162. [82,68,82,69],
  4163. [82,73,82,74],
  4164. [82,102,82,103],
  4165. [82,123,82,124],
  4166. [83,32,83,33],
  4167. [83,68,83,69],
  4168. [83,73,83,74],
  4169. [83,101,83,102],
  4170. [83,123,83,124],
  4171. [84,32,84,33],
  4172. [84,68,84,69],
  4173. [84,73,84,74],
  4174. [84,123,84,124],
  4175. [85,32,85,34],
  4176. [85,69,85,70],
  4177. [85,73,85,74],
  4178. [85,123,85,124],
  4179. [86,33,86,35],
  4180. [86,69,86,70],
  4181. [86,74,86,75],
  4182. [86,123,86,124],
  4183. [87,34,87,35],
  4184. [87,74,87,75],
  4185. [87,123,87,124],
  4186. [88,34,88,36],
  4187. [88,70,88,71],
  4188. [88,75,88,76],
  4189. [88,122,88,124],
  4190. [89,35,89,36],
  4191. [89,70,89,71],
  4192. [89,75,89,81],
  4193. [89,122,89,123],
  4194. [90,35,90,37],
  4195. [90,71,90,72],
  4196. [90,81,90,84],
  4197. [90,121,90,123],
  4198. [91,36,91,37],
  4199. [91,71,91,72],
  4200. [91,84,91,85],
  4201. [91,121,91,122],
  4202. [92,36,92,38],
  4203. [92,70,92,71],
  4204. [92,84,92,85],
  4205. [92,121,92,122],
  4206. [93,37,93,39],
  4207. [93,70,93,71],
  4208. [93,76,93,78],
  4209. [93,83,93,85],
  4210. [93,120,93,122],
  4211. [94,38,94,39],
  4212. [94,69,94,70],
  4213. [94,77,94,83],
  4214. [94,120,94,121],
  4215. [95,38,95,40],
  4216. [95,69,95,70],
  4217. [95,73,95,74],
  4218. [95,77,95,78],
  4219. [95,119,95,121],
  4220. [96,39,96,41],
  4221. [96,69,96,70],
  4222. [96,73,96,74],
  4223. [96,77,96,78],
  4224. [96,104,96,105],
  4225. [96,119,96,120],
  4226. [97,40,97,41],
  4227. [97,69,97,70],
  4228. [97,73,97,75],
  4229. [97,77,97,78],
  4230. [97,118,97,120],
  4231. [98,40,98,42],
  4232. [98,69,98,70],
  4233. [98,73,98,76],
  4234. [98,78,98,79],
  4235. [98,117,98,119],
  4236. [99,41,99,43],
  4237. [99,69,99,70],
  4238. [99,73,99,74],
  4239. [99,75,99,78],
  4240. [99,108,99,109],
  4241. [99,117,99,118],
  4242. [100,42,100,44],
  4243. [100,69,100,71],
  4244. [100,72,100,73],
  4245. [100,76,100,78],
  4246. [100,116,100,118],
  4247. [101,43,101,45],
  4248. [101,70,101,72],
  4249. [101,115,101,117],
  4250. [102,43,102,45],
  4251. [102,114,102,116],
  4252. [103,44,103,46],
  4253. [103,113,103,115],
  4254. [104,45,104,47],
  4255. [104,111,104,114],
  4256. [105,46,105,48],
  4257. [105,109,105,113],
  4258. [106,47,106,48],
  4259. [106,107,106,111],
  4260. [107,48,107,49],
  4261. [107,101,107,109],
  4262. [108,48,108,51],
  4263. [108,101,108,105],
  4264. [109,49,109,52],
  4265. [109,103,109,104],
  4266. [110,51,110,54],
  4267. [110,96,110,98],
  4268. [110,103,110,104],
  4269. [111,52,111,55],
  4270. [111,94,111,98],
  4271. [111,103,111,104],
  4272. [112,54,112,57],
  4273. [112,92,112,95],
  4274. [112,97,112,98],
  4275. [112,103,112,104],
  4276. [113,55,113,59],
  4277. [113,90,113,93],
  4278. [113,97,113,99],
  4279. [113,103,113,105],
  4280. [114,57,114,61],
  4281. [114,87,114,92],
  4282. [114,98,114,99],
  4283. [114,103,114,105],
  4284. [115,59,115,65],
  4285. [115,83,115,90],
  4286. [115,98,115,99],
  4287. [115,104,115,105],
  4288. [116,61,116,87],
  4289. [116,98,116,99],
  4290. [116,104,116,105],
  4291. [117,66,117,82],
  4292. [117,98,117,100],
  4293. [117,104,117,105],
  4294. [118,70,118,71],
  4295. [118,74,118,75],
  4296. [118,99,118,100],
  4297. [118,104,118,106],
  4298. [119,70,119,71],
  4299. [119,74,119,76],
  4300. [119,91,119,93],
  4301. [119,99,119,100],
  4302. [119,105,119,106],
  4303. [120,70,120,71],
  4304. [120,74,120,76],
  4305. [120,88,120,101],
  4306. [120,105,120,106],
  4307. [121,70,121,71],
  4308. [121,74,121,76],
  4309. [121,88,121,90],
  4310. [121,98,121,101],
  4311. [121,105,121,107],
  4312. [122,70,122,71],
  4313. [122,74,122,76],
  4314. [122,89,122,91],
  4315. [122,106,122,107],
  4316. [123,69,123,71],
  4317. [123,74,123,76],
  4318. [123,90,123,92],
  4319. [123,106,123,107],
  4320. [124,69,124,71],
  4321. [124,74,124,75],
  4322. [124,91,124,94],
  4323. [124,106,124,107],
  4324. [125,69,125,71],
  4325. [125,74,125,75],
  4326. [125,92,125,95],
  4327. [125,106,125,107],
  4328. [126,69,126,70],
  4329. [126,75,126,76],
  4330. [126,94,126,97],
  4331. [126,106,126,108],
  4332. [127,69,127,70],
  4333. [127,75,127,76],
  4334. [127,96,127,99],
  4335. [127,107,127,108],
  4336. [128,69,128,71],
  4337. [128,74,128,76],
  4338. [128,98,128,103],
  4339. [128,107,128,108],
  4340. [129,69,129,71],
  4341. [129,74,129,75],
  4342. [129,101,129,108],
  4343. [130,58,130,63],
  4344. [130,70,130,71],
  4345. [130,74,130,75],
  4346. [131,57,131,59],
  4347. [131,63,131,66],
  4348. [131,69,131,71],
  4349. [131,74,131,75],
  4350. [132,58,132,59],
  4351. [132,65,132,68],
  4352. [132,69,132,71],
  4353. [132,74,132,75],
  4354. [133,58,133,60],
  4355. [133,67,133,71],
  4356. [133,74,133,75],
  4357. [134,59,134,61],
  4358. [134,68,134,70],
  4359. [134,74,134,75],
  4360. [135,60,135,62],
  4361. [135,74,135,75],
  4362. [136,61,136,63],
  4363. [136,73,136,75],
  4364. [137,62,137,65],
  4365. [137,73,137,75],
  4366. [138,64,138,66],
  4367. [138,73,138,74],
  4368. [139,65,139,68],
  4369. [139,72,139,74],
  4370. [140,67,140,74],
  4371. [141,70,141,73],
  4372. ];
  4373.  
  4374. var fontSize = 2;
  4375. var letterOffset = 0;
  4376. var alphabet = new Array(200);
  4377. alphabet[58] = [
  4378. [0,0,0,1],
  4379. [2,0,2,1]
  4380. ];
  4381. alphabet[40] = [
  4382. [0,2,1,0],
  4383. [2,2,1,0]
  4384. ];
  4385. alphabet[41] = [
  4386. [0,0,1,2],
  4387. [2,0,1,2]
  4388. ];
  4389. alphabet[63] = [
  4390. [1,0,0,0],
  4391. [0,0,0,2],
  4392. [0,2,1,2],
  4393. [1,2,1,1],
  4394. [1,1,2,1]
  4395. ];
  4396. alphabet[97] = [
  4397. [2,0,0,0],
  4398. [0,0,0,2],
  4399. [0,2,2,2],
  4400. [1,0,1,2]
  4401. ];
  4402. alphabet[98] = [
  4403. [2,0,0,0],
  4404. [0,0,0,2],
  4405. [0,2,2,2],
  4406. [2,2,2,0],
  4407. [1,0,1,2]
  4408. ];
  4409. alphabet[99] = [
  4410. [2,2,2,0],
  4411. [2,0,0,0],
  4412. [0,0,0,2]
  4413. ];
  4414. alphabet[100] = [
  4415. [2,0,0,0],
  4416. [0,0,0,1],
  4417. [0,1,1,2],
  4418. [1,2,2,1],
  4419. [2,1,2,0]
  4420. ];
  4421. alphabet[101] = [
  4422. [2,2,2,0],
  4423. [2,0,0,0],
  4424. [0,0,0,2],
  4425. [1,0,1,2]
  4426. ];
  4427. alphabet[102] = [
  4428. [2,0,0,0],
  4429. [0,0,0,2],
  4430. [1,0,1,2]
  4431. ];
  4432. alphabet[103] = [
  4433. [1,1,1,2],
  4434. [1,2,2,2],
  4435. [2,2,2,0],
  4436. [2,0,0,0],
  4437. [0,0,0,2]
  4438. ];
  4439. alphabet[104] = [
  4440. [0,0,2,0],
  4441. [0,2,2,2],
  4442. [1,0,1,2]
  4443. ];
  4444. alphabet[105] = [
  4445. [0,0,0,2],
  4446. [0,1,2,1],
  4447. [2,0,2,2]
  4448. ];
  4449. alphabet[106] = [
  4450. [0,0,0,2],
  4451. [0,1,2,1],
  4452. [2,0,2,1]
  4453. ];
  4454. alphabet[107] = [
  4455. [0,0,2,0],
  4456. [1,0,0,2],
  4457. [1,0,2,2]
  4458. ];
  4459. alphabet[108] = [
  4460. [0,0,2,0],
  4461. [2,0,2,2]
  4462. ];
  4463. alphabet[109] = [
  4464. [0,0,2,0],
  4465. [0,0,2,1],
  4466. [2,1,0,2],
  4467. [0,2,2,2]
  4468. ];
  4469. alphabet[110] = [
  4470. [0,0,2,0],
  4471. [0,0,2,2],
  4472. [0,2,2,2]
  4473. ];
  4474. alphabet[111] = [
  4475. [2,0,0,0],
  4476. [0,0,0,2],
  4477. [0,2,2,2],
  4478. [2,2,2,0]
  4479. ];
  4480. alphabet[112] = [
  4481. [2,0,0,0],
  4482. [0,0,0,2],
  4483. [0,2,1,2],
  4484. [1,2,1,0]
  4485. ];
  4486. alphabet[113] = [
  4487. [2,0,0,0],
  4488. [0,0,0,2],
  4489. [0,2,2,2],
  4490. [2,2,2,0],
  4491. [1,1,2,2]
  4492. ];
  4493. alphabet[114] = [
  4494. [2,0,0,0],
  4495. [0,0,0,2],
  4496. [0,2,1,2],
  4497. [1,2,1,0],
  4498. [1,1,2,2]
  4499. ];
  4500. alphabet[115] = [
  4501. [0,0,0,2],
  4502. [1,0,1,2],
  4503. [2,0,2,2],
  4504. [0,0,1,0],
  4505. [1,2,2,2]
  4506. ];
  4507. alphabet[116] = [
  4508. [0,0,0,2],
  4509. [0,1,2,1]
  4510. ];
  4511. alphabet[117] = [
  4512. [0,0,2,0],
  4513. [0,2,2,2],
  4514. [2,0,2,2]
  4515. ];
  4516. alphabet[118] = [
  4517. [0,0,2,1],
  4518. [0,2,2,1]
  4519. ];
  4520. alphabet[119] = [
  4521. [0,0,2,0],
  4522. [0,2,2,2],
  4523. [2,0,1,1],
  4524. [2,2,1,1]
  4525. ];
  4526. alphabet[120] = [
  4527. [0,0,2,2],
  4528. [2,0,0,2]
  4529. ];
  4530. alphabet[121] = [
  4531. [0,0,1,1],
  4532. [0,2,1,1],
  4533. [1,1,2,1]
  4534. ];
  4535. alphabet[122] = [
  4536. [0,0,0,2],
  4537. [0,2,2,0],
  4538. [2,0,2,2]
  4539. ];
  4540.  
  4541.  
  4542. function sa(f) {
  4543. return f << 1
  4544. }
  4545.  
  4546. function ta(f) {
  4547. return f << 1
  4548. }
  4549.  
  4550. function U() {
  4551. //return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y
  4552. }
  4553.  
  4554. function ba() {
  4555. a.fillStyle = "#000000";
  4556. a.font = "35px NovaSquare";
  4557. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  4558. a.font = "16px NovaSquare";
  4559. a.fillText("Play the game on http://cursors.io/", 400 - a.measureText("Play the game on http://cursors.io/").width /
  4560. 2, 330);
  4561. top.location = "http://cursors.io";
  4562. throw "Please do not embed our website, thank you.";
  4563. }
  4564.  
  4565. function ua(f) {
  4566. V(f)
  4567. }
  4568.  
  4569. // Apparently unimportant
  4570. function W(f, b) {
  4571. J = f;
  4572. K = b;
  4573. k = v = f;
  4574. q = w = b;
  4575. B = v << 1;
  4576. C = w << 1
  4577. }
  4578.  
  4579. // Handles clicking
  4580. function va(f) {
  4581. if (D) return L = !1, V(f), !1;
  4582. //U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  4583. if (L) L = !1, Q();
  4584. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  4585. else if (100 < t - ca && v == k && w == q) {
  4586. ca = t;
  4587. I.push([v << 1, w << 1, t]);
  4588. wa(v, w, 10);
  4589. var b = [v, w];
  4590. N.push(b);
  4591. setTimeout(function() {
  4592. N.remove(b)
  4593. }, 1E3)
  4594. }
  4595. return !1
  4596. }
  4597.  
  4598. // Apparently unimportant
  4599. function xa(f) {
  4600. Y = !1
  4601. }
  4602.  
  4603. // Sets local storage for cursor lock and drawing
  4604. function ya() {
  4605. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"))
  4606. }
  4607.  
  4608. // Handles mouse movement and drawing
  4609. function V(f) {
  4610. if (U()) {
  4611. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  4612. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  4613. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1)
  4614. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  4615. k = v, q = w; /* Changed to allow movement through walls */
  4616. lastX = posX;
  4617. lastY = posY;
  4618. posX = k;
  4619. posY = q;
  4620. if (debugMode) console.log(v + ", " + w);
  4621. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  4622. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  4623. b = R;
  4624. f = S;
  4625. var a = k,
  4626. d = q;
  4627. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  4628. var g = new ArrayBuffer(9),
  4629. e = new DataView(g);
  4630.  
  4631. e.setUint8(0, 3);
  4632. e.setUint16(1, b, !0);
  4633. e.setUint16(3, f, !0);
  4634. e.setUint16(5, a, !0);
  4635. e.setUint16(7, d, !0);
  4636. u.send(g)
  4637.  
  4638. if (markerEnabled) {
  4639. e.setUint8(0, 3);
  4640. e.setUint16(1, b+2, !0);
  4641. e.setUint16(3, f, !0);
  4642. e.setUint16(5, a+2, !0);
  4643. e.setUint16(7, d, !0);
  4644. u.send(g)
  4645. e.setUint8(0, 3);
  4646. e.setUint16(1, b, !0);
  4647. e.setUint16(3, f+2, !0);
  4648. e.setUint16(5, a, !0);
  4649. e.setUint16(7, d+2, !0);
  4650. u.send(g)
  4651. e.setUint8(0, 3);
  4652. e.setUint16(1, b-2, !0);
  4653. e.setUint16(3, f, !0);
  4654. e.setUint16(5, a-2, !0);
  4655. e.setUint16(7, d, !0);
  4656. u.send(g)
  4657. e.setUint8(0, 3);
  4658. e.setUint16(1, b, !0);
  4659. e.setUint16(3, f-2, !0);
  4660. e.setUint16(5, a, !0);
  4661. e.setUint16(7, d-2, !0);
  4662. u.send(g)
  4663. }
  4664. }
  4665. R = k;
  4666. S = q;
  4667. da = t
  4668. }
  4669. }
  4670.  
  4671. // Apparently not important
  4672. function Z() {
  4673. ea(k, q) && Q();
  4674. if (z(k, q)) {
  4675. var a;
  4676. a: {
  4677. a = k;
  4678. var b = q,
  4679. c = [],
  4680. d = new Uint8Array(12E4);
  4681. c.push([a, b]);
  4682. d[a + 400 * b] = 1;
  4683. do {
  4684. var g = c.shift(),
  4685. e = g[0],
  4686. g = g[1];
  4687. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  4688. if (!z(e, g)) {
  4689. a = {
  4690. x: e,
  4691. y: g
  4692. };
  4693. break a
  4694. }
  4695. d[e -
  4696. 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  4697. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  4698. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  4699. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1)
  4700. }
  4701. } while (0 < c.length);
  4702. a = {
  4703. x: a,
  4704. y: b
  4705. }
  4706. }
  4707. k = a.x;
  4708. q = a.y
  4709. }
  4710. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  4711. ea(k, q) && Q()
  4712. }
  4713.  
  4714. // Cleans up map on level transition
  4715. function $() {
  4716. console.log("Next map");
  4717. initialLoad = true;
  4718. for (var i = 0; i < maxButtons; i++)
  4719. buttons[i] = new Array(3);
  4720. buttonIndex = 0;
  4721. T.set(za);
  4722. r = [];
  4723. I = [];
  4724. O = []
  4725. }
  4726.  
  4727. // Enables image smoothing
  4728. function ga(f) {
  4729. a.imageSmoothingEnabled = f;
  4730. a.mozImageSmoothingEnabled = f;
  4731. a.oImageSmoothingEnabled = f;
  4732. a.webkitImageSmoothingEnabled = f
  4733. }
  4734.  
  4735. // Prints connected message
  4736. function Aa() {
  4737. $();
  4738. console.log("Connected!")
  4739. }
  4740.  
  4741. // Prints socket closed message
  4742. function Ba(a) {
  4743. $();
  4744. console.log("Socket closed: " + a.reason)
  4745. }
  4746.  
  4747. // Prints socket error message
  4748. function Ca(a) {
  4749. console.log("Socket error")
  4750. }
  4751.  
  4752. // Gets strings, but without it the map won't load
  4753. function Da(a, b) {
  4754. for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0);
  4755. 0 != d && (c += String.fromCharCode(d));
  4756. return [c, b + 1]
  4757. }
  4758.  
  4759. // You get a TERRIBLE framerate if you remove the contents of this function
  4760. function Ea(a, b) {
  4761. setTimeout(function() {
  4762. var c = a.getUint16(b, !0),
  4763. d = 0;
  4764. a: for (; d < c; d++) {
  4765. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  4766. var l = N[n];
  4767. if (l[0] == g && l[1] == e) {
  4768. N.splice(n, 1);
  4769. continue a
  4770. }
  4771. }
  4772. I.push([g << 1, e << 1, t])
  4773. }
  4774. }, 100);
  4775. return b +
  4776. 2 + 4 * a.getUint16(b, !0)
  4777. }
  4778.  
  4779. // Apparently not important
  4780. function Fa(a, b) {
  4781. !H.checked && setTimeout(function() {
  4782. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  4783. var g = a.getUint16(b + 2 + 8 * d, !0),
  4784. e = a.getUint16(b + 4 + 8 * d, !0),
  4785. n = a.getUint16(b + 6 + 8 * d, !0),
  4786. l = a.getUint16(b + 8 + 8 * d, !0);
  4787. O.push([g << 1, e << 1, n << 1, l << 1, t])
  4788. }
  4789. }, 50);
  4790. return b + 2 + 8 * a.getUint16(b, !0)
  4791. }
  4792.  
  4793. // Draws the level. Or at least, without it the level doesn't show up.
  4794. function Ga(a) {
  4795. buttonIndex = 0;
  4796. initialLoad = false;
  4797. a = a.data;
  4798. var b = new DataView(a);
  4799. switch (b.getUint8(0)) {
  4800. case 0: // If this doesn't run then you see two of your cursor. One of them lags behind
  4801. ha = b.getUint32(1, !0);
  4802. break;
  4803. case 1: // Without this, doors don't show up
  4804. var c;
  4805. ia = c = b.getUint16(1, !0);
  4806. ja = 100 <= c;
  4807. var d = [],
  4808. g;
  4809. for (g in F) F.hasOwnProperty(g) && d.push(g);
  4810. for (var e =
  4811. 0; e < c; e++) {
  4812. g = b.getUint32(3 + 8 * e, !0);
  4813. var n = b.getUint16(7 + 8 * e, !0),
  4814. l = b.getUint16(9 + 8 * e, !0);
  4815. if (g != ha)
  4816. if (null != F[g]) {
  4817. for (var p = 0; p < d.length; p++)
  4818. if (d[p] == g) {
  4819. d.splice(p, 1);
  4820. break
  4821. }
  4822. g = F[g];
  4823. g.oldX = g.getX();
  4824. g.oldY = g.getY();
  4825. g.newX = n;
  4826. g.newY = l;
  4827. g.time = t
  4828. } else F[g] = new ka(n, l)
  4829. }
  4830. for (e = 0; e < d.length; e++) delete F[d[e]];
  4831. c = Ea(b, 3 + 8 * c);
  4832. g = b.getUint16(c, !0);
  4833. c += 2;
  4834. for (d = 0; d < g; d++) {
  4835. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  4836. if (r[e].id == n) {
  4837. var k = r[e];
  4838. if (1 == k.type)
  4839. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  4840. for (var h =
  4841. n; h < n + p; ++h) --T[h + 400 * m];
  4842. r.splice(e, 1);
  4843. break a
  4844. }c += 4
  4845. }
  4846. g = b.getUint16(c, !0);
  4847. c += 2;
  4848. for (d = 0; d < g; d++) {
  4849. a: {
  4850. e = b.getUint32(c, !0);
  4851. for (n = 0; n < r.length; n++)
  4852. if (r[n].id == e) {
  4853. e = r[n];
  4854. break a
  4855. }
  4856. e = {
  4857. id: e
  4858. };
  4859. r.push(e)
  4860. }
  4861. c += 4;c = la(b, c, e)
  4862. }
  4863. c = Fa(b, c);
  4864. if (a.byteLength < c + 4) break;
  4865. aa = b.getUint32(c, !0);
  4866. break;
  4867. case 4: // Without this the level don't show
  4868. $();
  4869. W(b.getUint16(1, !0), b.getUint16(3, !0));
  4870. g = b.getUint16(5, !0);
  4871. c = 7;
  4872. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  4873. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  4874. Z();
  4875. break;
  4876. case 5: // Without this things don't trigger unless you are drawing. Also, you can't click buttons.
  4877. W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z()
  4878. }
  4879. }
  4880.  
  4881. // Without this, your position only updates if you click or draw
  4882. function Q() {
  4883. lastFrame = currentFrame;
  4884. currentFrame = new Date().getTime();
  4885.  
  4886. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  4887. var a = new ArrayBuffer(9);
  4888. b = new DataView(a);
  4889. b.setUint8(0, 1);
  4890. b.setUint16(1, k, !0);
  4891. b.setUint16(3, q, !0);
  4892. b.setUint32(5, G, !0);
  4893. u.send(a);
  4894. J = k;
  4895. K = q
  4896. }
  4897.  
  4898. if (auraEnabled) // Drawing cursor aura
  4899. drawAura(J, K);
  4900. }
  4901.  
  4902. // Without this clicking doesn't actually get transmitted to the server
  4903. function wa(a, b, numClicks) {
  4904. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  4905. var c = new ArrayBuffer(9),
  4906. d = new DataView(c);
  4907. d.setUint8(0, 2);
  4908. d.setUint16(1, a, !0);
  4909. d.setUint16(3, b, !0);
  4910. d.setUint32(5, G, !0);
  4911. for (var i = 0; i < numClicks; i++) { u.send(c) } // Changed to click multiple times
  4912. }
  4913. }
  4914.  
  4915. function la(f, b, c) {
  4916. function d() { // Handles drawing stuff
  4917. if (c.type == 4 && initialLoad) {
  4918. c.x = f.getUint16(b, !0);
  4919. buttons[buttonIndex][0] = c.x
  4920. b += 2;
  4921. c.y = f.getUint16(b, !0);
  4922. buttons[buttonIndex][1] = c.y
  4923. b += 2;
  4924. c.width = f.getUint16(b, !0);
  4925. b += 2;
  4926. c.height = f.getUint16(b, !0);
  4927. b += 2
  4928.  
  4929. buttonIndex++;
  4930. } else {
  4931. c.x = f.getUint16(b, !0);
  4932. b += 2;
  4933. c.y = f.getUint16(b, !0);
  4934. b += 2;
  4935. c.width = f.getUint16(b, !0);
  4936. b += 2;
  4937. c.height = f.getUint16(b, !0);
  4938. b += 2
  4939. }
  4940. }
  4941. function g() { // Handles coloring stuff
  4942. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  4943. b += 4;
  4944. c.color = "#" + a
  4945. }
  4946. var e = f.getUint8(b);
  4947. b += 1;
  4948. c.type = e;
  4949. switch (e) {
  4950. case 255:
  4951. break;
  4952. case 0: // Draws text
  4953. c.x = f.getUint16(b, !0);
  4954. b += 2;
  4955. c.y = f.getUint16(b, !0);
  4956. b += 2;
  4957. c.size = f.getUint8(b);
  4958. b += 1;
  4959. c.isCentered = !!f.getUint8(b);
  4960. b += 1;
  4961. e = Da(f, b);
  4962. c.text = e[0];
  4963. b = e[1];
  4964. break;
  4965. case 1: // May relate to cursor movement?
  4966. d();
  4967. var n = !c.color;
  4968. g();
  4969. var e = c.x | 0,
  4970. l = c.y | 0,
  4971. p = c.width | 0,
  4972. k = c.height | 0;
  4973. if (n)
  4974. for (n = l; n < l + k; ++n)
  4975. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  4976. break;
  4977. case 2: // Draws exit points
  4978. d();
  4979. c.isBad = !!f.getUint8(b);
  4980. b += 1;
  4981. break;
  4982. case 3: // Handles the area triggers
  4983. d();
  4984. c.count = f.getUint16(b, !0);
  4985. b += 2;
  4986. g();
  4987. break;
  4988. case 4: // Something about buttons, but also affects doors and area triggers
  4989. d();
  4990. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  4991. c.count = f.getUint16(b, !0);
  4992. if (initialLoad) buttons[buttonIndex-1][2] = 1;
  4993. b += 2;
  4994. g();
  4995. break;
  4996. case 5:
  4997. c.x = f.getUint16(b, !0);
  4998. b += 2;
  4999. c.y = f.getUint16(b, !0);
  5000. b += 2;
  5001. c.queue = [
  5002. [0, c.x, c.y]
  5003. ];
  5004. c.potentialQueue = [];
  5005. c.explored = new Uint8Array(12E4);
  5006. c.img = a.createImageData(400, 300);
  5007. e = E.createElement("canvas");
  5008. e.width = 400;
  5009. e.height = 300;
  5010. c.canvas = e;
  5011. c.ctx = c.canvas.getContext("2d");
  5012. break;
  5013. default:
  5014. throw Error("Unknown object type " + e);
  5015. }
  5016. return b
  5017. }
  5018.  
  5019. function ea(a, b) {
  5020. if (-1 != J && -1 != K) {
  5021. var c = fa(J, K, a, b);
  5022. if (c.x != a || c.y != b) return !0
  5023. }
  5024. for (c = 0; c < r.length; c++) {
  5025. var d = r[c];
  5026. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0
  5027. }
  5028. return !1
  5029. }
  5030.  
  5031. function ma() {
  5032. a.clearRect(0, 0, 800, 600);
  5033. a.save();
  5034. if (null != u && u.readyState != WebSocket.OPEN || L) {
  5035. var f;
  5036. if (null == u) f = "Click to begin";
  5037. else switch (u.readyState) {
  5038. case WebSocket.CONNECTING:
  5039. f = "Connecting";
  5040. break;
  5041. case WebSocket.CLOSING:
  5042. case WebSocket.CLOSED:
  5043. f = "Lost connection to server";
  5044. break;
  5045. default:
  5046. f = "Click to begin"
  5047. }
  5048. a.font = "60px NovaSquare";
  5049. a.fillText(f, 400 - a.measureText(f).width / 2, 315);
  5050. na();
  5051. oa(!1)
  5052. } else {
  5053. a.fillStyle = "#000000";
  5054. a.save();
  5055. a.globalAlpha = 1;
  5056. Ha();
  5057. for (f = 0; f < r.length; f++) {
  5058. var b = r[f];
  5059. if (0 == b.type) {
  5060. a.font = b.size + "px NovaSquare";
  5061. var c = b.x << 1,
  5062. d = b.y << 1;
  5063. b.isCentered && (c -= a.measureText(b.text).width / 2);
  5064. a.fillStyle = "#000000";
  5065. a.fillText(b.text,
  5066. c, d)
  5067. } else if (1 == b.type) a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2, a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2), a.globalAlpha = 1;
  5068. else if (2 == b.type) a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.globalAlpha = 1;
  5069. else if (3 == b.type) {
  5070. var c = b.x << 1,
  5071. d = b.y << 1,
  5072. g = b.width << 1,
  5073. e = b.height << 1;
  5074. a.fillStyle = b.color;
  5075. a.globalAlpha = .2;
  5076. a.fillRect(c, d, g, e);
  5077. a.globalAlpha =
  5078. .5;
  5079. a.fillStyle = "#000000";
  5080. 40 > b.width || 40 > b.height ? (a.font = "30px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10)) : (a.font = "60px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20));
  5081. a.globalAlpha = 1
  5082. } else if (4 == b.type) {
  5083. c = b.x << 1;
  5084. d = b.y << 1;
  5085. g = b.width << 1;
  5086. e = b.height << 1;
  5087. a.fillStyle = b.color;
  5088. a.strokeStyle = b.color;
  5089. a.globalAlpha = 1;
  5090. a.fillRect(c, d, g, e);
  5091. a.globalAlpha = .2;
  5092. a.fillStyle = "#000000";
  5093. a.fillRect(c, d, g, e);
  5094. a.globalAlpha = 1;
  5095. a.fillStyle = b.color;
  5096. var n = 150 > t - b.lastClickAt,
  5097. l = n ? 8 : 12;
  5098. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  5099. a.strokeStyle = "#000000";
  5100. a.globalAlpha = .1;
  5101. a.beginPath();
  5102. a.moveTo(c, d);
  5103. a.lineTo(c + l, d + l);
  5104. a.moveTo(c + g, d);
  5105. a.lineTo(c + g - l, d + l);
  5106. a.moveTo(c, d + e);
  5107. a.lineTo(c + l, d + e - l);
  5108. a.moveTo(c + g, d + e);
  5109. a.lineTo(c + g - l, d + e - l);
  5110. a.moveTo(c, d);
  5111. a.rect(c, d, g, e);
  5112. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  5113. a.stroke();
  5114. a.fillStyle = "#000000";
  5115. a.globalAlpha = .5;
  5116. 50 > b.width || 50 > b.height ? (a.font = "35px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13)) : (a.font = "45px NovaSquare", a.fillText(b.count,
  5117. c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16));
  5118. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  5119. a.globalAlpha = 1
  5120. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600), ga(!0))
  5121. }
  5122. a.restore();
  5123. D || (a.font = "12px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5, f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw", a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1, a.fillText(f,
  5124. 10, 590), 0 != aa && (f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1, a.fillText(f, 790 - b, 590)));
  5125. na();
  5126. if (!H.checked) {
  5127. a.save();
  5128. a.strokeStyle = "#000000";
  5129. a.lineWidth = 1;
  5130. t = +new Date;
  5131. for (f = 0; f < O.length; f++) b = O[f], c = 10 - (t - b[4]) / 1E3, 0 >= c ? (O.splice(f, 1), --f) : (1 < c && (c = 1), a.globalAlpha = .3 * c, a.beginPath(), a.moveTo(b[0] - .5, b[1] - .5), a.lineTo(b[2] - .5, b[3] - .5), a.stroke());
  5132. a.restore()
  5133. }
  5134. a.save();
  5135. for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) -
  5136. 6);
  5137. a.restore();
  5138. oa(!0)
  5139. }
  5140. a.restore();
  5141. A.requestAnimationFrame(ma)
  5142. }
  5143.  
  5144. function na() { // draws circles when you click
  5145. a.save();
  5146. a.strokeStyle = "#000000";
  5147. t = +new Date;
  5148. for (var f = 0; f < I.length; f++) {
  5149. var b = I[f],
  5150. c = (t - b[2]) / 1E3,
  5151. d = 1 - 2 * c;
  5152. 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke())
  5153. }
  5154. a.restore()
  5155. }
  5156.  
  5157. function oa(f) {
  5158. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5);
  5159. else {
  5160. var b = 0,
  5161. c = 0;
  5162. v != k || w != q ? (a.save(), f && (a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath(), a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1),
  5163. a.fill()), a.globalAlpha = .5, a.drawImage(P, B - 5, C - 5), a.restore()) : (b = B & 1, c = C & 1);
  5164. a.save();
  5165. f && (a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath(), a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1), a.fill());
  5166. a.globalAlpha = 1;
  5167. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5)
  5168. }
  5169. a.restore()
  5170. }
  5171.  
  5172. function ka(a, b) {
  5173. this.oldX = this.newX = a;
  5174. this.oldY = this.newY = b;
  5175. this.time = t
  5176. }
  5177.  
  5178. function pa(a) {
  5179. return a * a * (3 - 2 * a)
  5180. }
  5181.  
  5182. function fa(a, b, c, d) {
  5183. a |= 0;
  5184. b |= 0;
  5185. c |= 0;
  5186. d |= 0;
  5187. if (z(a, b)) return {
  5188. x: a,
  5189. y: b
  5190. };
  5191. if (a == c && b == d) return {
  5192. x: c,
  5193. y: d
  5194. };
  5195. var g = a,
  5196. e = b;
  5197. c = c - a | 0;
  5198. d = d - b | 0;
  5199. var n =
  5200. 0,
  5201. l = 0,
  5202. p = 0,
  5203. k = 0;
  5204. 0 > c ? n = -1 : 0 < c && (n = 1);
  5205. 0 > d ? l = -1 : 0 < d && (l = 1);
  5206. 0 > c ? p = -1 : 0 < c && (p = 1);
  5207. var m = Math.abs(c) | 0,
  5208. h = Math.abs(d) | 0;
  5209. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  5210. c = m >> 1;
  5211. for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k);
  5212. return {
  5213. x: g,
  5214. y: e
  5215. }
  5216. }
  5217.  
  5218. function z(a, b) {
  5219. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  5220. }
  5221.  
  5222. function Ja() {
  5223. for (var a = 0; a < r.length; a++) {
  5224. var b = r[a];
  5225. 5 == b.type && Ka(b)
  5226. }
  5227. }
  5228.  
  5229. function Ka(a) {
  5230. function b(a, b, c) {
  5231. e.push([c, a, b]);
  5232. l[a + 400 * b] = !0;
  5233. g(a, b)
  5234. }
  5235.  
  5236. function c(a, b, c) {
  5237. p.push([c,
  5238. a, b
  5239. ]);
  5240. l[a + 400 * b] = !0
  5241. }
  5242.  
  5243. function d(a, b) {
  5244. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  5245. }
  5246.  
  5247. function g(a, b) {
  5248. var c = 4 * (a + 400 * b);
  5249. k[c + 0] = 255;
  5250. k[c + 1] = 153;
  5251. k[c + 2] = 153;
  5252. k[c + 3] = 255
  5253. }
  5254. for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m);
  5255. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  5256. for (r = 0; 50 > r && 0 != e.length; ++r) {
  5257. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  5258. var x = e[m][0];
  5259. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  5260. }
  5261. for (m = 0; m < q.length; ++m) {
  5262. var x = q[m][0],
  5263. h = q[m][1],
  5264. s = q[m][2],
  5265. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  5266. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  5267. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  5268. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  5269. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  5270. 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2));
  5271. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  5272. b(h - 1, s + 1, x + Math.SQRT2));
  5273. 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2));
  5274. 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2))
  5275. }
  5276. }
  5277. a.ctx.putImageData(a.img, 0, 0)
  5278. }
  5279. var y, a, ia = 0,
  5280. v = 0,
  5281. w = 0,
  5282. B = 0,
  5283. C = 0,
  5284. k = 0,
  5285. q = 0,
  5286. J = -1,
  5287. K = -1,
  5288. M = null,
  5289. H = null,
  5290. P = new Image;
  5291. P.src = "img/cursor.png";
  5292. var Ia = P,
  5293. D = -1 != A.location.search.indexOf("editor"),
  5294. I = [],
  5295. O = [],
  5296. t = 0,
  5297. ca = 0,
  5298. u = null,
  5299. ha = -1,
  5300. F = {},
  5301. aa = 0,
  5302. ja = !1,
  5303. Y = !1,
  5304. R = 0,
  5305. S = 0,
  5306. da = 0,
  5307. X = !1,
  5308. L = !D && !0,
  5309. T = new Uint8Array(12E4),
  5310. r = [],
  5311. N = [];
  5312. Array.prototype.remove =
  5313. function(a) {
  5314. a = this.indexOf(a);
  5315. return -1 != a ? (this.splice(a, 1), !0) : !1
  5316. };
  5317. var G = 0;
  5318. ka.prototype = {
  5319. oldX: 0,
  5320. oldY: 0,
  5321. newX: 0,
  5322. newY: 0,
  5323. time: 0,
  5324. getX: function() {
  5325. var a = this.newX - this.oldX,
  5326. b = (t - this.time) / 100,
  5327. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  5328. return this.oldX + b * a
  5329. },
  5330. getY: function() {
  5331. var a = this.newY - this.oldY,
  5332. b = (t - this.time) / 100,
  5333. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  5334. return this.oldY + b * a
  5335. }
  5336. };
  5337. var ra = function() {
  5338. function f() {
  5339. var a = 0,
  5340. b = 0,
  5341. c = v / 10,
  5342. d = w / 10;
  5343. n < c ? (c = Math.ceil(c), a = Math.floor(n)) : (c = Math.floor(c), a = Math.ceil(n));
  5344. l < d ? (d = Math.ceil(d), b = Math.floor(l)) :
  5345. (d = Math.floor(d), b = Math.ceil(l));
  5346. if (a > c) var e = c,
  5347. c = a,
  5348. a = e;
  5349. b > d && (e = d, d = b, b = e);
  5350. return {
  5351. sx: a,
  5352. sy: b,
  5353. fx: c,
  5354. fy: d
  5355. }
  5356. }
  5357.  
  5358. function b() {
  5359. e = !0;
  5360. n = v / 10;
  5361. l = w / 10
  5362. }
  5363.  
  5364. function c(a) {
  5365. return "0x" + parseInt(a.slice(1), 16).toString(16).toUpperCase()
  5366. }
  5367.  
  5368. function d(a, b, c, d, e) {
  5369. a = {
  5370. x: 10 * ~~(k / 10) - ~~(a / 2) + c,
  5371. y: 10 * ~~(q / 10) - ~~(b / 2) + d,
  5372. width: a,
  5373. height: b
  5374. };
  5375. for (var f in e) e.hasOwnProperty(f) && (a[f] = e[f]);
  5376. return a
  5377. }
  5378.  
  5379. function g(a, b) {
  5380. for (var c = null, d = Number.POSITIVE_INFINITY, e = 0; e < r.length; e++) {
  5381. var f = r[e];
  5382. if (f.hasOwnProperty("x") && f.hasOwnProperty("y") && f.hasOwnProperty("width") &&
  5383. f.hasOwnProperty("height")) {
  5384. var g = f.x + f.width / 2,
  5385. h = f.y + f.height / 2,
  5386. g = (a - g) * (a - g) + (b - h) * (b - h);
  5387. g < d && (d = g, c = f)
  5388. }
  5389. }
  5390. return c
  5391. }
  5392. var e = !1,
  5393. n = 0,
  5394. l = 0,
  5395. p = 1,
  5396. u = 200,
  5397. m = 150,
  5398. h = new Uint8Array(1200),
  5399. t = "#000000 #FF9999 #9999FF #FFFF99 #99FFFF #FF99FF #3333FF".split(" ");
  5400. E.addEventListener("mouseup", function() {
  5401. if (e) {
  5402. for (var a = f(), b = p, c = a.sy; c < a.fy; ++c)
  5403. for (var d = a.sx; d < a.fx; ++d) h[d + 40 * c] = b;
  5404. e = !1
  5405. }
  5406. });
  5407. E.addEventListener("mousemove", function() {});
  5408. A.generateCode = function() {
  5409. for (var a = "class Level? : public Level {\npublic:\n\tLevel?() : Level(" +
  5410. u + ", " + m + "){}\n\n\tvoid OnInit(){\n", a = a + ("\t\tstd::vector<LevelObject*> wallByColor[" + t.length + "];\n"), b = new Uint8Array(1200), d = [], e = 0; 30 > e; ++e)
  5411. for (var f = 0; 40 > f; ++f)
  5412. if (!b[f + 40 * e]) {
  5413. var g = h[f + 40 * e];
  5414. if (0 != g) {
  5415. for (var k = f; 40 > f && h[f + 40 * e] == g && !b[f + 40 * e];) b[f + 40 * e] = !0, ++f;
  5416. var l = f--,
  5417. p = l - k,
  5418. q = e++;
  5419. a: for (; 30 > e;) {
  5420. for (var n = k; n < l; ++n) {
  5421. if (h[n + 40 * e] != g) break a;
  5422. if (b[n + 40 * e]) break a
  5423. }
  5424. for (n = k; n < l; ++n) b[n + 40 * e] = !0;
  5425. ++e
  5426. }
  5427. l = e - q;
  5428. e = q;
  5429. d.push({
  5430. x: 10 * k,
  5431. y: 10 * q,
  5432. width: 10 * p,
  5433. height: 10 * l,
  5434. color: g - 1
  5435. })
  5436. }
  5437. }
  5438. for (b = 0; b < d.length; b++) e = d[b], 0 ==
  5439. e.color ? a += "\t\tAddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", 0x000000));\n" : (f = c(t[e.color]), a += "\t\twallByColor[" + e.color + "].push_back(AddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", " + f + ")));\n");
  5440. for (b = 0; b < r.length; b++) d = r[b], 0 != d.type && (2 == d.type ? a += "\t\tAddObject(new ObjTeleport(LevelManager::GetNextLevel(this), " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + "));\n" : 3 == d.type ? (a += "\t\tAddObject(new ObjAreaCounter(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y +
  5441. ", " + d.width + ", " + d.height + ", ", a += d.count + ", " + c(d.color) + "));\n") : 4 == d.type && (a += "\t\tAddObject(new ObjClickBox(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + ", ", a += d.count + ", 1000, " + c(d.color) + "));\n"));
  5442. return a += "\t}\n};\n"
  5443. };
  5444. E.addEventListener("keydown", function(a) {
  5445. if (a.keyCode == 8) {
  5446. a.preventDefault();
  5447. if (message.length > 0) {
  5448. message = message.substring(0, message.length - 1);
  5449. messageDisplay.innerHTML = message;
  5450. }
  5451. }
  5452. else if (a.keyCode == 9) {
  5453. a.preventDefault();
  5454. }
  5455. if (D) {
  5456. var b = a.keyCode;
  5457. 65 == b ? (--p, 0 > p && (p = t.length)) : 83 == b ? (++p, p > t.length && (p = 0)) : 66 == b ? 1 >= p || r.push(d(40, 40, 5, 5, {
  5458. type: 4,
  5459. color: t[p - 1],
  5460. colorCode: p - 1,
  5461. count: 5
  5462. })) : 90 == b ? r.pop() : 87 == b ? r.push(d(50, 50, -5, -5, {
  5463. type: 2,
  5464. isBad: !1
  5465. })) : 79 == b ? (u = k, m = q) : 78 == b ? 1 >= p || r.push(d(40, 40, 0, 0, {
  5466. type: 3,
  5467. color: t[p - 1],
  5468. colorCode: p - 1,
  5469. count: 1
  5470. })) : 37 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.width -= 10 : (b.x -= 10, b.width += 10), 0 == b.width && r.splice(r.indexOf(b), 1))) : 39 == b ? (b = g(v, w), null != b && (a.shiftKey ? (b.x += 10, b.width -= 10) : b.width += 10, 0 == b.width && r.splice(r.indexOf(b), 1))) : 38 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.height -= 10 : (b.y -= 10, b.height += 10), 0 == b.height && r.splice(r.indexOf(b), 1))) : 40 == b && (b = g(v, w), null != b && (a.shiftKey ? (b.y += 10, b.height -= 10) : b.height +=
  5471. 10, 0 == b.height && r.splice(r.indexOf(b), 1)))
  5472. }
  5473. });
  5474. return {
  5475. renderEditor: function() {
  5476. if (D) {
  5477. a.save();
  5478. a.fillStyle = "#FF0000";
  5479. a.strokeStyle = "#FF0000";
  5480. a.lineWidth = 1;
  5481. a.globalAlpha = .09;
  5482. a.beginPath();
  5483. for (var b = 0; 400 > b; b += 10) a.moveTo((b << 1) + .5, 0), a.lineTo((b << 1) + .5, 600);
  5484. for (var c = 0; 300 > c; c += 10) a.moveTo(0, (c << 1) + .5), a.lineTo(800, (c << 1) + .5);
  5485. a.stroke();
  5486. a.lineWidth = 2;
  5487. a.beginPath();
  5488. a.moveTo(400.5, 0);
  5489. a.lineTo(400.5, 600);
  5490. a.moveTo(0, 300.5, 0);
  5491. a.lineTo(800, 300.5);
  5492. a.stroke();
  5493. a.lineWidth = 1;
  5494. a.globalAlpha = 1;
  5495. a.fillStyle = "#000000";
  5496. for (var d = f(), c = 0; 300 > c; c += 10)
  5497. for (b = 0; 400 > b; b += 10) {
  5498. var g = b / 10 | 0,
  5499. k = c / 10 | 0,
  5500. l = h[g + 40 * k];
  5501. e && g >= d.sx && g < d.fx && k >= d.sy && k < d.fy && (l = p);
  5502. 0 != l && (a.fillStyle = t[l - 1], a.fillRect(b << 1, c << 1, 20, 20))
  5503. }
  5504. a.save();
  5505. a.globalAlpha = .09;
  5506. a.fillStyle = "#0000FF";
  5507. a.beginPath();
  5508. a.arc(u << 1, m << 1, 20, 0, 2 * Math.PI, !1);
  5509. a.fill();
  5510. a.restore();
  5511. a.save();
  5512. a.fillStyle = "#FFFFFF";
  5513. a.strokeStyle = "#000000";
  5514. a.lineWidth = 2.5;
  5515. a.font = "14px NovaSquare";
  5516. a.globalAlpha = .5;
  5517. a.strokeText("Current color: ", 10, 590);
  5518. a.globalAlpha = 1;
  5519. a.fillText("Current color: ", 10,
  5520. 590);
  5521. 0 == p ? a.fillText("ESR", 105, 590) : (a.fillStyle = "#000000", a.fillRect(104, 575, 22, 22), a.fillStyle = t[p - 1], a.fillRect(105, 576, 20, 20));
  5522. a.restore();
  5523. a.restore()
  5524. }
  5525. },
  5526. initEditor: function() {
  5527. y.addEventListener("mousedown", b)
  5528. }
  5529. }
  5530. }(),
  5531. Ha = ra.renderEditor,
  5532. La = ra.initEditor,
  5533. za = new Uint8Array(12E4);
  5534. Array.prototype.remove = function(a) {
  5535. a = this.indexOf(a);
  5536. return -1 != a ? (this.splice(a, 1), !0) : !1
  5537. };
  5538.  
  5539. function handleKeyboard(e) {
  5540. if ((e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63 || e.keyCode == 58 || e.keyCode == 40 || e.keyCode == 41) {
  5541. message = message.concat(String.fromCharCode(e.keyCode));
  5542. messageDisplay.innerHTML = message;
  5543. return;
  5544. }
  5545. switch(e.keyCode) {
  5546. case 13:
  5547. drawWord(message, posX, posY);
  5548. message = "";
  5549. messageDisplay.innerHTML = message;
  5550. e.preventDefault();
  5551. break;
  5552. case 96: // Click all buttons
  5553. clickAllButtons();
  5554. break;
  5555. case 47:
  5556. movementEnabled = !movementEnabled
  5557. break;
  5558. case 45: // Toggle Aura
  5559. auraEnabled = !auraEnabled;
  5560. break;
  5561. case 43:
  5562. drawImage(posX, posY);
  5563. break;
  5564. case 42:
  5565. markerEnabled = !markerEnabled;
  5566. break;
  5567. default:
  5568. return;
  5569. }
  5570. }
  5571.  
  5572. function clickAllButtons() {
  5573. for (var i = 0; i < maxButtons; i++) {
  5574. if (buttons[i][0] == null) break;
  5575. wa(buttons[i][0], buttons[i][1], buttons[i][2]);
  5576. }
  5577. }
  5578.  
  5579. function drawAura(x, y) {
  5580. var dt = 360/(1000/40)/2;
  5581. if (u != null && u.readyState == WebSocket.OPEN) {
  5582. var g = new ArrayBuffer(9),
  5583. e = new DataView(g);
  5584. e.setUint8(0, 3);
  5585. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  5586. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  5587. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  5588. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  5589. u.send(g)
  5590. }
  5591.  
  5592. auraTime += dt;
  5593. }
  5594.  
  5595. function degToRad(deg) {
  5596. return deg * (Math.PI / 180);
  5597. }
  5598.  
  5599. function radToDeg(rad) {
  5600. return rad * (180 / Math.PI);
  5601. }
  5602.  
  5603. var drawIndex = 0;
  5604. function drawImage(x, y) {
  5605. setTimeout(function () {
  5606. var g = new ArrayBuffer(9),
  5607. e = new DataView(g);
  5608.  
  5609. e.setUint8(0, 3);
  5610. e.setUint16(1, x+imgData[drawIndex][1]*imageScale, !0);
  5611. e.setUint16(3, y+imgData[drawIndex][0]*imageScale, !0);
  5612. e.setUint16(5, x+imgData[drawIndex][3]*imageScale, !0);
  5613. e.setUint16(7, y+imgData[drawIndex][2]*imageScale, !0);
  5614. u.send(g);
  5615.  
  5616. drawIndex++;
  5617. if (drawIndex < imgData.length)
  5618. drawImage(x, y);
  5619. else
  5620. drawIndex = 0;
  5621. }, 15)
  5622. }
  5623.  
  5624. function drawLetter(a, x, y) {
  5625. var letter = alphabet[a];
  5626.  
  5627. if (letter == null)
  5628. return;
  5629.  
  5630. var g = new ArrayBuffer(9),
  5631. e = new DataView(g);
  5632.  
  5633. for (var i = 0; i < letter.length; i++) {
  5634. e.setUint8(0, 3);
  5635. e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  5636. e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  5637. e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  5638. e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  5639. for (var j = 0; j < 4; j++) { u.send(g); }
  5640. }
  5641. }
  5642.  
  5643. var messageDisplay;
  5644. var message = new String();
  5645. var wordIndex = 0;
  5646. function drawWord(s, x, y) {
  5647. setTimeout(function () {
  5648. drawLetter(s.charCodeAt(0), x, y);
  5649. wordIndex++;
  5650. if (s.length > 0)
  5651. drawWord(s.substring(1, s.length), x+fontSize*3, y);
  5652. else {
  5653. wordIndex = 0;
  5654. letterOffset = 0;
  5655. }
  5656. }, 20);
  5657. }
  5658.  
  5659. function doit() {
  5660. document.body.innerHTML += '<div id="messageDisplay"></div>';
  5661. messageDisplay = document.getElementById("messageDisplay");
  5662.  
  5663. y = E.getElementById("canvas");
  5664. a = y.getContext("2d");
  5665. try {
  5666. A.top.location.origin != A.location.origin && ba()
  5667. } catch (f) {
  5668. ba()
  5669. }
  5670. y.onmousemove = ua;
  5671. y.onmousedown = va;
  5672. y.onmouseup = xa;
  5673. M = E.getElementById("noCursorLock");
  5674. H = E.getElementById("noDrawings");
  5675. null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  5676. A.onbeforeunload = ya;
  5677. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  5678. y.style.cursor = "none";
  5679. La();
  5680. D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
  5681. Ba, u.onerror = Ca);
  5682. setInterval(Q, 50);
  5683. setInterval(Ja, 40);
  5684. A.requestAnimationFrame(ma)
  5685.  
  5686. document.onkeypress = handleKeyboard;
  5687. }
  5688.  
  5689. doit();var A = window;
  5690. var E = document;
  5691.  
  5692. var debugMode = false;
  5693.  
  5694. var posX, posY;
  5695. var lastX, lastY;
  5696.  
  5697. var lastFrame;
  5698. var currentFrame;
  5699.  
  5700. var initialLoad = true;
  5701. var buttonIndex = 0;
  5702. var maxButtons = 20;
  5703. var buttons = new Array(maxButtons);
  5704. for (var i = 0; i < maxButtons; i++)
  5705. buttons[i] = new Array(3);
  5706.  
  5707. var auraEnabled = false;
  5708. var auraTime = 0;
  5709. var auraRadius = 10;
  5710.  
  5711. var markerEnabled = false;
  5712.  
  5713. var movementEnabled = true;
  5714.  
  5715. var imageScale = 1.0;
  5716. var imgData = [ [17,49,17,57],
  5717. [18,44,18,52],
  5718. [18,55,18,59],
  5719. [19,41,19,46],
  5720. [19,58,19,60],
  5721. [20,40,20,42],
  5722. [20,60,20,62],
  5723. [21,38,21,40],
  5724. [21,61,21,63],
  5725. [22,37,22,39],
  5726. [22,62,22,64],
  5727. [23,37,23,38],
  5728. [23,63,23,65],
  5729. [24,36,24,37],
  5730. [24,64,24,65],
  5731. [25,35,25,37],
  5732. [25,65,25,66],
  5733. [26,34,26,36],
  5734. [26,65,26,67],
  5735. [27,33,27,35],
  5736. [27,66,27,67],
  5737. [28,32,28,34],
  5738. [28,67,28,68],
  5739. [29,32,29,34],
  5740. [29,67,29,68],
  5741. [30,31,30,33],
  5742. [30,67,30,69],
  5743. [31,31,31,32],
  5744. [31,68,31,69],
  5745. [32,31,32,32],
  5746. [32,68,32,69],
  5747. [33,30,33,31],
  5748. [33,55,33,59],
  5749. [33,68,33,69],
  5750. [34,30,34,31],
  5751. [34,53,34,58],
  5752. [34,59,34,61],
  5753. [34,68,34,70],
  5754. [35,29,35,31],
  5755. [35,52,35,57],
  5756. [35,61,35,62],
  5757. [35,69,35,70],
  5758. [36,29,36,30],
  5759. [36,50,36,57],
  5760. [36,62,36,63],
  5761. [36,69,36,70],
  5762. [37,29,37,30],
  5763. [37,50,37,58],
  5764. [37,62,37,63],
  5765. [37,69,37,70],
  5766. [38,28,38,30],
  5767. [38,49,38,58],
  5768. [38,69,38,71],
  5769. [38,108,38,115],
  5770. [39,28,39,29],
  5771. [39,49,39,57],
  5772. [39,63,39,64],
  5773. [39,70,39,71],
  5774. [39,107,39,110],
  5775. [39,114,39,116],
  5776. [40,28,40,35],
  5777. [40,48,40,57],
  5778. [40,63,40,64],
  5779. [40,70,40,71],
  5780. [40,107,40,109],
  5781. [40,116,40,117],
  5782. [41,27,41,32],
  5783. [41,35,41,36],
  5784. [41,48,41,57],
  5785. [41,63,41,64],
  5786. [41,70,41,71],
  5787. [41,107,41,108],
  5788. [41,117,41,118],
  5789. [42,26,42,32],
  5790. [42,36,42,37],
  5791. [42,48,42,56],
  5792. [42,62,42,64],
  5793. [42,70,42,72],
  5794. [42,107,42,108],
  5795. [42,118,42,119],
  5796. [43,25,43,32],
  5797. [43,36,43,38],
  5798. [43,41,43,42],
  5799. [43,48,43,56],
  5800. [43,62,43,63],
  5801. [43,70,43,72],
  5802. [43,107,43,108],
  5803. [43,118,43,119],
  5804. [44,25,44,32],
  5805. [44,37,44,38],
  5806. [44,40,44,41],
  5807. [44,47,44,55],
  5808. [44,61,44,63],
  5809. [44,71,44,72],
  5810. [44,107,44,108],
  5811. [44,118,44,119],
  5812. [45,24,45,32],
  5813. [45,37,45,40],
  5814. [45,48,45,50],
  5815. [45,59,45,62],
  5816. [45,71,45,72],
  5817. [45,107,45,108],
  5818. [45,118,45,119],
  5819. [46,24,46,32],
  5820. [46,37,46,40],
  5821. [46,49,46,51],
  5822. [46,58,46,60],
  5823. [46,71,46,72],
  5824. [46,107,46,108],
  5825. [46,119,46,120],
  5826. [47,23,47,32],
  5827. [47,37,47,39],
  5828. [47,50,47,53],
  5829. [47,55,47,58],
  5830. [47,71,47,73],
  5831. [47,107,47,108],
  5832. [47,119,47,120],
  5833. [48,23,48,31],
  5834. [48,36,48,39],
  5835. [48,52,48,56],
  5836. [48,72,48,73],
  5837. [48,107,48,108],
  5838. [48,119,48,120],
  5839. [49,23,49,30],
  5840. [49,35,49,38],
  5841. [49,62,49,65],
  5842. [49,72,49,73],
  5843. [49,106,49,108],
  5844. [49,119,49,120],
  5845. [50,24,50,29],
  5846. [50,34,50,38],
  5847. [50,43,50,46],
  5848. [50,61,50,64],
  5849. [50,72,50,74],
  5850. [50,106,50,108],
  5851. [50,119,50,120],
  5852. [51,24,51,28],
  5853. [51,32,51,34],
  5854. [51,36,51,37],
  5855. [51,40,51,42],
  5856. [51,45,51,46],
  5857. [51,58,51,62],
  5858. [51,72,51,74],
  5859. [51,106,51,108],
  5860. [51,119,51,120],
  5861. [52,25,52,32],
  5862. [52,36,52,37],
  5863. [52,45,52,46],
  5864. [52,56,52,60],
  5865. [52,73,52,74],
  5866. [52,106,52,108],
  5867. [52,119,52,120],
  5868. [53,26,53,28],
  5869. [53,35,53,37],
  5870. [53,44,53,46],
  5871. [53,55,53,58],
  5872. [53,73,53,74],
  5873. [53,106,53,107],
  5874. [53,119,53,120],
  5875. [54,26,54,27],
  5876. [54,36,54,38],
  5877. [54,41,54,45],
  5878. [54,52,54,56],
  5879. [54,73,54,75],
  5880. [54,106,54,107],
  5881. [54,119,54,120],
  5882. [55,26,55,27],
  5883. [55,37,55,44],
  5884. [55,50,55,54],
  5885. [55,74,55,75],
  5886. [55,106,55,107],
  5887. [55,119,55,120],
  5888. [56,26,56,27],
  5889. [56,47,56,51],
  5890. [56,74,56,75],
  5891. [56,106,56,107],
  5892. [56,119,56,120],
  5893. [57,26,57,27],
  5894. [57,45,57,49],
  5895. [57,74,57,76],
  5896. [57,106,57,107],
  5897. [57,119,57,120],
  5898. [58,26,58,27],
  5899. [58,42,58,46],
  5900. [58,74,58,76],
  5901. [58,106,58,107],
  5902. [58,115,58,116],
  5903. [58,118,58,119],
  5904. [59,26,59,28],
  5905. [59,39,59,44],
  5906. [59,75,59,76],
  5907. [59,105,59,107],
  5908. [59,118,59,119],
  5909. [60,27,60,28],
  5910. [60,37,60,41],
  5911. [60,75,60,77],
  5912. [60,105,60,106],
  5913. [60,118,60,119],
  5914. [60,124,60,125],
  5915. [61,27,61,28],
  5916. [61,33,61,38],
  5917. [61,76,61,77],
  5918. [61,105,61,106],
  5919. [61,117,61,118],
  5920. [61,123,61,127],
  5921. [62,27,62,28],
  5922. [62,30,62,35],
  5923. [62,76,62,78],
  5924. [62,104,62,106],
  5925. [62,116,62,118],
  5926. [62,122,62,124],
  5927. [62,126,62,128],
  5928. [63,27,63,28],
  5929. [63,30,63,31],
  5930. [63,77,63,78],
  5931. [63,98,63,102],
  5932. [63,104,63,105],
  5933. [63,116,63,117],
  5934. [63,121,63,123],
  5935. [63,126,63,128],
  5936. [64,27,64,28],
  5937. [64,77,64,79],
  5938. [64,95,64,105],
  5939. [64,116,64,118],
  5940. [64,119,64,121],
  5941. [64,126,64,128],
  5942. [65,27,65,29],
  5943. [65,68,65,69],
  5944. [65,78,65,79],
  5945. [65,92,65,96],
  5946. [65,103,65,105],
  5947. [65,115,65,120],
  5948. [65,123,65,126],
  5949. [65,127,65,128],
  5950. [66,28,66,29],
  5951. [66,63,66,64],
  5952. [66,68,66,70],
  5953. [66,78,66,80],
  5954. [66,91,66,93],
  5955. [66,103,66,104],
  5956. [66,117,66,118],
  5957. [66,127,66,128],
  5958. [67,28,67,29],
  5959. [67,63,67,64],
  5960. [67,69,67,70],
  5961. [67,79,67,80],
  5962. [67,89,67,91],
  5963. [67,103,67,104],
  5964. [67,126,67,128],
  5965. [68,28,68,29],
  5966. [68,64,68,65],
  5967. [68,69,68,70],
  5968. [68,79,68,81],
  5969. [68,87,68,89],
  5970. [68,102,68,104],
  5971. [68,120,68,131],
  5972. [69,28,69,29],
  5973. [69,69,69,70],
  5974. [69,80,69,82],
  5975. [69,87,69,88],
  5976. [69,102,69,103],
  5977. [69,122,69,132],
  5978. [70,29,70,30],
  5979. [70,70,70,71],
  5980. [70,80,70,82],
  5981. [70,85,70,87],
  5982. [70,101,70,113],
  5983. [70,132,70,133],
  5984. [71,29,71,30],
  5985. [71,65,71,66],
  5986. [71,70,71,71],
  5987. [71,81,71,83],
  5988. [71,85,71,86],
  5989. [71,91,71,92],
  5990. [71,99,71,116],
  5991. [71,132,71,133],
  5992. [72,29,72,30],
  5993. [72,65,72,66],
  5994. [72,70,72,71],
  5995. [72,81,72,85],
  5996. [72,91,72,94],
  5997. [72,97,72,100],
  5998. [72,115,72,118],
  5999. [72,132,72,134],
  6000. [73,29,73,30],
  6001. [73,70,73,72],
  6002. [73,81,73,85],
  6003. [73,94,73,99],
  6004. [73,118,73,120],
  6005. [73,132,73,133],
  6006. [74,29,74,30],
  6007. [74,71,74,72],
  6008. [74,81,74,84],
  6009. [74,95,74,98],
  6010. [74,119,74,120],
  6011. [74,132,74,133],
  6012. [75,30,75,31],
  6013. [75,66,75,67],
  6014. [75,71,75,72],
  6015. [75,82,75,84],
  6016. [75,94,75,96],
  6017. [75,120,75,121],
  6018. [75,128,75,129],
  6019. [75,131,75,133],
  6020. [76,30,76,31],
  6021. [76,66,76,67],
  6022. [76,71,76,72],
  6023. [76,83,76,84],
  6024. [76,89,76,90],
  6025. [76,94,76,95],
  6026. [76,121,76,122],
  6027. [76,124,76,125],
  6028. [76,129,76,132],
  6029. [77,30,77,31],
  6030. [77,72,77,73],
  6031. [77,83,77,84],
  6032. [77,93,77,94],
  6033. [77,121,77,123],
  6034. [77,129,77,132],
  6035. [78,30,78,32],
  6036. [78,67,78,68],
  6037. [78,72,78,73],
  6038. [78,84,78,85],
  6039. [78,92,78,93],
  6040. [78,122,78,123],
  6041. [78,125,78,129],
  6042. [79,30,79,32],
  6043. [79,67,79,68],
  6044. [79,72,79,73],
  6045. [79,85,79,86],
  6046. [79,91,79,93],
  6047. [79,122,79,128],
  6048. [80,31,80,32],
  6049. [80,67,80,68],
  6050. [80,72,80,74],
  6051. [80,91,80,92],
  6052. [80,122,80,123],
  6053. [81,31,81,33],
  6054. [81,73,81,74],
  6055. [81,91,81,92],
  6056. [81,123,81,124],
  6057. [82,31,82,33],
  6058. [82,68,82,69],
  6059. [82,73,82,74],
  6060. [82,102,82,103],
  6061. [82,123,82,124],
  6062. [83,32,83,33],
  6063. [83,68,83,69],
  6064. [83,73,83,74],
  6065. [83,101,83,102],
  6066. [83,123,83,124],
  6067. [84,32,84,33],
  6068. [84,68,84,69],
  6069. [84,73,84,74],
  6070. [84,123,84,124],
  6071. [85,32,85,34],
  6072. [85,69,85,70],
  6073. [85,73,85,74],
  6074. [85,123,85,124],
  6075. [86,33,86,35],
  6076. [86,69,86,70],
  6077. [86,74,86,75],
  6078. [86,123,86,124],
  6079. [87,34,87,35],
  6080. [87,74,87,75],
  6081. [87,123,87,124],
  6082. [88,34,88,36],
  6083. [88,70,88,71],
  6084. [88,75,88,76],
  6085. [88,122,88,124],
  6086. [89,35,89,36],
  6087. [89,70,89,71],
  6088. [89,75,89,81],
  6089. [89,122,89,123],
  6090. [90,35,90,37],
  6091. [90,71,90,72],
  6092. [90,81,90,84],
  6093. [90,121,90,123],
  6094. [91,36,91,37],
  6095. [91,71,91,72],
  6096. [91,84,91,85],
  6097. [91,121,91,122],
  6098. [92,36,92,38],
  6099. [92,70,92,71],
  6100. [92,84,92,85],
  6101. [92,121,92,122],
  6102. [93,37,93,39],
  6103. [93,70,93,71],
  6104. [93,76,93,78],
  6105. [93,83,93,85],
  6106. [93,120,93,122],
  6107. [94,38,94,39],
  6108. [94,69,94,70],
  6109. [94,77,94,83],
  6110. [94,120,94,121],
  6111. [95,38,95,40],
  6112. [95,69,95,70],
  6113. [95,73,95,74],
  6114. [95,77,95,78],
  6115. [95,119,95,121],
  6116. [96,39,96,41],
  6117. [96,69,96,70],
  6118. [96,73,96,74],
  6119. [96,77,96,78],
  6120. [96,104,96,105],
  6121. [96,119,96,120],
  6122. [97,40,97,41],
  6123. [97,69,97,70],
  6124. [97,73,97,75],
  6125. [97,77,97,78],
  6126. [97,118,97,120],
  6127. [98,40,98,42],
  6128. [98,69,98,70],
  6129. [98,73,98,76],
  6130. [98,78,98,79],
  6131. [98,117,98,119],
  6132. [99,41,99,43],
  6133. [99,69,99,70],
  6134. [99,73,99,74],
  6135. [99,75,99,78],
  6136. [99,108,99,109],
  6137. [99,117,99,118],
  6138. [100,42,100,44],
  6139. [100,69,100,71],
  6140. [100,72,100,73],
  6141. [100,76,100,78],
  6142. [100,116,100,118],
  6143. [101,43,101,45],
  6144. [101,70,101,72],
  6145. [101,115,101,117],
  6146. [102,43,102,45],
  6147. [102,114,102,116],
  6148. [103,44,103,46],
  6149. [103,113,103,115],
  6150. [104,45,104,47],
  6151. [104,111,104,114],
  6152. [105,46,105,48],
  6153. [105,109,105,113],
  6154. [106,47,106,48],
  6155. [106,107,106,111],
  6156. [107,48,107,49],
  6157. [107,101,107,109],
  6158. [108,48,108,51],
  6159. [108,101,108,105],
  6160. [109,49,109,52],
  6161. [109,103,109,104],
  6162. [110,51,110,54],
  6163. [110,96,110,98],
  6164. [110,103,110,104],
  6165. [111,52,111,55],
  6166. [111,94,111,98],
  6167. [111,103,111,104],
  6168. [112,54,112,57],
  6169. [112,92,112,95],
  6170. [112,97,112,98],
  6171. [112,103,112,104],
  6172. [113,55,113,59],
  6173. [113,90,113,93],
  6174. [113,97,113,99],
  6175. [113,103,113,105],
  6176. [114,57,114,61],
  6177. [114,87,114,92],
  6178. [114,98,114,99],
  6179. [114,103,114,105],
  6180. [115,59,115,65],
  6181. [115,83,115,90],
  6182. [115,98,115,99],
  6183. [115,104,115,105],
  6184. [116,61,116,87],
  6185. [116,98,116,99],
  6186. [116,104,116,105],
  6187. [117,66,117,82],
  6188. [117,98,117,100],
  6189. [117,104,117,105],
  6190. [118,70,118,71],
  6191. [118,74,118,75],
  6192. [118,99,118,100],
  6193. [118,104,118,106],
  6194. [119,70,119,71],
  6195. [119,74,119,76],
  6196. [119,91,119,93],
  6197. [119,99,119,100],
  6198. [119,105,119,106],
  6199. [120,70,120,71],
  6200. [120,74,120,76],
  6201. [120,88,120,101],
  6202. [120,105,120,106],
  6203. [121,70,121,71],
  6204. [121,74,121,76],
  6205. [121,88,121,90],
  6206. [121,98,121,101],
  6207. [121,105,121,107],
  6208. [122,70,122,71],
  6209. [122,74,122,76],
  6210. [122,89,122,91],
  6211. [122,106,122,107],
  6212. [123,69,123,71],
  6213. [123,74,123,76],
  6214. [123,90,123,92],
  6215. [123,106,123,107],
  6216. [124,69,124,71],
  6217. [124,74,124,75],
  6218. [124,91,124,94],
  6219. [124,106,124,107],
  6220. [125,69,125,71],
  6221. [125,74,125,75],
  6222. [125,92,125,95],
  6223. [125,106,125,107],
  6224. [126,69,126,70],
  6225. [126,75,126,76],
  6226. [126,94,126,97],
  6227. [126,106,126,108],
  6228. [127,69,127,70],
  6229. [127,75,127,76],
  6230. [127,96,127,99],
  6231. [127,107,127,108],
  6232. [128,69,128,71],
  6233. [128,74,128,76],
  6234. [128,98,128,103],
  6235. [128,107,128,108],
  6236. [129,69,129,71],
  6237. [129,74,129,75],
  6238. [129,101,129,108],
  6239. [130,58,130,63],
  6240. [130,70,130,71],
  6241. [130,74,130,75],
  6242. [131,57,131,59],
  6243. [131,63,131,66],
  6244. [131,69,131,71],
  6245. [131,74,131,75],
  6246. [132,58,132,59],
  6247. [132,65,132,68],
  6248. [132,69,132,71],
  6249. [132,74,132,75],
  6250. [133,58,133,60],
  6251. [133,67,133,71],
  6252. [133,74,133,75],
  6253. [134,59,134,61],
  6254. [134,68,134,70],
  6255. [134,74,134,75],
  6256. [135,60,135,62],
  6257. [135,74,135,75],
  6258. [136,61,136,63],
  6259. [136,73,136,75],
  6260. [137,62,137,65],
  6261. [137,73,137,75],
  6262. [138,64,138,66],
  6263. [138,73,138,74],
  6264. [139,65,139,68],
  6265. [139,72,139,74],
  6266. [140,67,140,74],
  6267. [141,70,141,73],
  6268. ];
  6269.  
  6270. var fontSize = 2;
  6271. var letterOffset = 0;
  6272. var alphabet = new Array(200);
  6273. alphabet[58] = [
  6274. [0,0,0,1],
  6275. [2,0,2,1]
  6276. ];
  6277. alphabet[40] = [
  6278. [0,2,1,0],
  6279. [2,2,1,0]
  6280. ];
  6281. alphabet[41] = [
  6282. [0,0,1,2],
  6283. [2,0,1,2]
  6284. ];
  6285. alphabet[63] = [
  6286. [1,0,0,0],
  6287. [0,0,0,2],
  6288. [0,2,1,2],
  6289. [1,2,1,1],
  6290. [1,1,2,1]
  6291. ];
  6292. alphabet[97] = [
  6293. [2,0,0,0],
  6294. [0,0,0,2],
  6295. [0,2,2,2],
  6296. [1,0,1,2]
  6297. ];
  6298. alphabet[98] = [
  6299. [2,0,0,0],
  6300. [0,0,0,2],
  6301. [0,2,2,2],
  6302. [2,2,2,0],
  6303. [1,0,1,2]
  6304. ];
  6305. alphabet[99] = [
  6306. [2,2,2,0],
  6307. [2,0,0,0],
  6308. [0,0,0,2]
  6309. ];
  6310. alphabet[100] = [
  6311. [2,0,0,0],
  6312. [0,0,0,1],
  6313. [0,1,1,2],
  6314. [1,2,2,1],
  6315. [2,1,2,0]
  6316. ];
  6317. alphabet[101] = [
  6318. [2,2,2,0],
  6319. [2,0,0,0],
  6320. [0,0,0,2],
  6321. [1,0,1,2]
  6322. ];
  6323. alphabet[102] = [
  6324. [2,0,0,0],
  6325. [0,0,0,2],
  6326. [1,0,1,2]
  6327. ];
  6328. alphabet[103] = [
  6329. [1,1,1,2],
  6330. [1,2,2,2],
  6331. [2,2,2,0],
  6332. [2,0,0,0],
  6333. [0,0,0,2]
  6334. ];
  6335. alphabet[104] = [
  6336. [0,0,2,0],
  6337. [0,2,2,2],
  6338. [1,0,1,2]
  6339. ];
  6340. alphabet[105] = [
  6341. [0,0,0,2],
  6342. [0,1,2,1],
  6343. [2,0,2,2]
  6344. ];
  6345. alphabet[106] = [
  6346. [0,0,0,2],
  6347. [0,1,2,1],
  6348. [2,0,2,1]
  6349. ];
  6350. alphabet[107] = [
  6351. [0,0,2,0],
  6352. [1,0,0,2],
  6353. [1,0,2,2]
  6354. ];
  6355. alphabet[108] = [
  6356. [0,0,2,0],
  6357. [2,0,2,2]
  6358. ];
  6359. alphabet[109] = [
  6360. [0,0,2,0],
  6361. [0,0,2,1],
  6362. [2,1,0,2],
  6363. [0,2,2,2]
  6364. ];
  6365. alphabet[110] = [
  6366. [0,0,2,0],
  6367. [0,0,2,2],
  6368. [0,2,2,2]
  6369. ];
  6370. alphabet[111] = [
  6371. [2,0,0,0],
  6372. [0,0,0,2],
  6373. [0,2,2,2],
  6374. [2,2,2,0]
  6375. ];
  6376. alphabet[112] = [
  6377. [2,0,0,0],
  6378. [0,0,0,2],
  6379. [0,2,1,2],
  6380. [1,2,1,0]
  6381. ];
  6382. alphabet[113] = [
  6383. [2,0,0,0],
  6384. [0,0,0,2],
  6385. [0,2,2,2],
  6386. [2,2,2,0],
  6387. [1,1,2,2]
  6388. ];
  6389. alphabet[114] = [
  6390. [2,0,0,0],
  6391. [0,0,0,2],
  6392. [0,2,1,2],
  6393. [1,2,1,0],
  6394. [1,1,2,2]
  6395. ];
  6396. alphabet[115] = [
  6397. [0,0,0,2],
  6398. [1,0,1,2],
  6399. [2,0,2,2],
  6400. [0,0,1,0],
  6401. [1,2,2,2]
  6402. ];
  6403. alphabet[116] = [
  6404. [0,0,0,2],
  6405. [0,1,2,1]
  6406. ];
  6407. alphabet[117] = [
  6408. [0,0,2,0],
  6409. [0,2,2,2],
  6410. [2,0,2,2]
  6411. ];
  6412. alphabet[118] = [
  6413. [0,0,2,1],
  6414. [0,2,2,1]
  6415. ];
  6416. alphabet[119] = [
  6417. [0,0,2,0],
  6418. [0,2,2,2],
  6419. [2,0,1,1],
  6420. [2,2,1,1]
  6421. ];
  6422. alphabet[120] = [
  6423. [0,0,2,2],
  6424. [2,0,0,2]
  6425. ];
  6426. alphabet[121] = [
  6427. [0,0,1,1],
  6428. [0,2,1,1],
  6429. [1,1,2,1]
  6430. ];
  6431. alphabet[122] = [
  6432. [0,0,0,2],
  6433. [0,2,2,0],
  6434. [2,0,2,2]
  6435. ];
  6436.  
  6437.  
  6438. function sa(f) {
  6439. return f << 1
  6440. }
  6441.  
  6442. function ta(f) {
  6443. return f << 1
  6444. }
  6445.  
  6446. function U() {
  6447. //return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y
  6448. }
  6449.  
  6450. function ba() {
  6451. a.fillStyle = "#000000";
  6452. a.font = "35px NovaSquare";
  6453. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  6454. a.font = "16px NovaSquare";
  6455. a.fillText("Play the game on http://cursors.io/", 400 - a.measureText("Play the game on http://cursors.io/").width /
  6456. 2, 330);
  6457. top.location = "http://cursors.io";
  6458. throw "Please do not embed our website, thank you.";
  6459. }
  6460.  
  6461. function ua(f) {
  6462. V(f)
  6463. }
  6464.  
  6465. // Apparently unimportant
  6466. function W(f, b) {
  6467. J = f;
  6468. K = b;
  6469. k = v = f;
  6470. q = w = b;
  6471. B = v << 1;
  6472. C = w << 1
  6473. }
  6474.  
  6475. // Handles clicking
  6476. function va(f) {
  6477. if (D) return L = !1, V(f), !1;
  6478. //U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  6479. if (L) L = !1, Q();
  6480. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  6481. else if (100 < t - ca && v == k && w == q) {
  6482. ca = t;
  6483. I.push([v << 1, w << 1, t]);
  6484. wa(v, w, 10);
  6485. var b = [v, w];
  6486. N.push(b);
  6487. setTimeout(function() {
  6488. N.remove(b)
  6489. }, 1E3)
  6490. }
  6491. return !1
  6492. }
  6493.  
  6494. // Apparently unimportant
  6495. function xa(f) {
  6496. Y = !1
  6497. }
  6498.  
  6499. // Sets local storage for cursor lock and drawing
  6500. function ya() {
  6501. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"))
  6502. }
  6503.  
  6504. // Handles mouse movement and drawing
  6505. function V(f) {
  6506. if (U()) {
  6507. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  6508. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  6509. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1)
  6510. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  6511. k = v, q = w; /* Changed to allow movement through walls */
  6512. lastX = posX;
  6513. lastY = posY;
  6514. posX = k;
  6515. posY = q;
  6516. if (debugMode) console.log(v + ", " + w);
  6517. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  6518. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  6519. b = R;
  6520. f = S;
  6521. var a = k,
  6522. d = q;
  6523. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  6524. var g = new ArrayBuffer(9),
  6525. e = new DataView(g);
  6526.  
  6527. e.setUint8(0, 3);
  6528. e.setUint16(1, b, !0);
  6529. e.setUint16(3, f, !0);
  6530. e.setUint16(5, a, !0);
  6531. e.setUint16(7, d, !0);
  6532. u.send(g)
  6533.  
  6534. if (markerEnabled) {
  6535. e.setUint8(0, 3);
  6536. e.setUint16(1, b+2, !0);
  6537. e.setUint16(3, f, !0);
  6538. e.setUint16(5, a+2, !0);
  6539. e.setUint16(7, d, !0);
  6540. u.send(g)
  6541. e.setUint8(0, 3);
  6542. e.setUint16(1, b, !0);
  6543. e.setUint16(3, f+2, !0);
  6544. e.setUint16(5, a, !0);
  6545. e.setUint16(7, d+2, !0);
  6546. u.send(g)
  6547. e.setUint8(0, 3);
  6548. e.setUint16(1, b-2, !0);
  6549. e.setUint16(3, f, !0);
  6550. e.setUint16(5, a-2, !0);
  6551. e.setUint16(7, d, !0);
  6552. u.send(g)
  6553. e.setUint8(0, 3);
  6554. e.setUint16(1, b, !0);
  6555. e.setUint16(3, f-2, !0);
  6556. e.setUint16(5, a, !0);
  6557. e.setUint16(7, d-2, !0);
  6558. u.send(g)
  6559. }
  6560. }
  6561. R = k;
  6562. S = q;
  6563. da = t
  6564. }
  6565. }
  6566.  
  6567. // Apparently not important
  6568. function Z() {
  6569. ea(k, q) && Q();
  6570. if (z(k, q)) {
  6571. var a;
  6572. a: {
  6573. a = k;
  6574. var b = q,
  6575. c = [],
  6576. d = new Uint8Array(12E4);
  6577. c.push([a, b]);
  6578. d[a + 400 * b] = 1;
  6579. do {
  6580. var g = c.shift(),
  6581. e = g[0],
  6582. g = g[1];
  6583. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  6584. if (!z(e, g)) {
  6585. a = {
  6586. x: e,
  6587. y: g
  6588. };
  6589. break a
  6590. }
  6591. d[e -
  6592. 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  6593. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  6594. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  6595. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1)
  6596. }
  6597. } while (0 < c.length);
  6598. a = {
  6599. x: a,
  6600. y: b
  6601. }
  6602. }
  6603. k = a.x;
  6604. q = a.y
  6605. }
  6606. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  6607. ea(k, q) && Q()
  6608. }
  6609.  
  6610. // Cleans up map on level transition
  6611. function $() {
  6612. console.log("Next map");
  6613. initialLoad = true;
  6614. for (var i = 0; i < maxButtons; i++)
  6615. buttons[i] = new Array(3);
  6616. buttonIndex = 0;
  6617. T.set(za);
  6618. r = [];
  6619. I = [];
  6620. O = []
  6621. }
  6622.  
  6623. // Enables image smoothing
  6624. function ga(f) {
  6625. a.imageSmoothingEnabled = f;
  6626. a.mozImageSmoothingEnabled = f;
  6627. a.oImageSmoothingEnabled = f;
  6628. a.webkitImageSmoothingEnabled = f
  6629. }
  6630.  
  6631. // Prints connected message
  6632. function Aa() {
  6633. $();
  6634. console.log("Connected!")
  6635. }
  6636.  
  6637. // Prints socket closed message
  6638. function Ba(a) {
  6639. $();
  6640. console.log("Socket closed: " + a.reason)
  6641. }
  6642.  
  6643. // Prints socket error message
  6644. function Ca(a) {
  6645. console.log("Socket error")
  6646. }
  6647.  
  6648. // Gets strings, but without it the map won't load
  6649. function Da(a, b) {
  6650. for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0);
  6651. 0 != d && (c += String.fromCharCode(d));
  6652. return [c, b + 1]
  6653. }
  6654.  
  6655. // You get a TERRIBLE framerate if you remove the contents of this function
  6656. function Ea(a, b) {
  6657. setTimeout(function() {
  6658. var c = a.getUint16(b, !0),
  6659. d = 0;
  6660. a: for (; d < c; d++) {
  6661. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  6662. var l = N[n];
  6663. if (l[0] == g && l[1] == e) {
  6664. N.splice(n, 1);
  6665. continue a
  6666. }
  6667. }
  6668. I.push([g << 1, e << 1, t])
  6669. }
  6670. }, 100);
  6671. return b +
  6672. 2 + 4 * a.getUint16(b, !0)
  6673. }
  6674.  
  6675. // Apparently not important
  6676. function Fa(a, b) {
  6677. !H.checked && setTimeout(function() {
  6678. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  6679. var g = a.getUint16(b + 2 + 8 * d, !0),
  6680. e = a.getUint16(b + 4 + 8 * d, !0),
  6681. n = a.getUint16(b + 6 + 8 * d, !0),
  6682. l = a.getUint16(b + 8 + 8 * d, !0);
  6683. O.push([g << 1, e << 1, n << 1, l << 1, t])
  6684. }
  6685. }, 50);
  6686. return b + 2 + 8 * a.getUint16(b, !0)
  6687. }
  6688.  
  6689. // Draws the level. Or at least, without it the level doesn't show up.
  6690. function Ga(a) {
  6691. buttonIndex = 0;
  6692. initialLoad = false;
  6693. a = a.data;
  6694. var b = new DataView(a);
  6695. switch (b.getUint8(0)) {
  6696. case 0: // If this doesn't run then you see two of your cursor. One of them lags behind
  6697. ha = b.getUint32(1, !0);
  6698. break;
  6699. case 1: // Without this, doors don't show up
  6700. var c;
  6701. ia = c = b.getUint16(1, !0);
  6702. ja = 100 <= c;
  6703. var d = [],
  6704. g;
  6705. for (g in F) F.hasOwnProperty(g) && d.push(g);
  6706. for (var e =
  6707. 0; e < c; e++) {
  6708. g = b.getUint32(3 + 8 * e, !0);
  6709. var n = b.getUint16(7 + 8 * e, !0),
  6710. l = b.getUint16(9 + 8 * e, !0);
  6711. if (g != ha)
  6712. if (null != F[g]) {
  6713. for (var p = 0; p < d.length; p++)
  6714. if (d[p] == g) {
  6715. d.splice(p, 1);
  6716. break
  6717. }
  6718. g = F[g];
  6719. g.oldX = g.getX();
  6720. g.oldY = g.getY();
  6721. g.newX = n;
  6722. g.newY = l;
  6723. g.time = t
  6724. } else F[g] = new ka(n, l)
  6725. }
  6726. for (e = 0; e < d.length; e++) delete F[d[e]];
  6727. c = Ea(b, 3 + 8 * c);
  6728. g = b.getUint16(c, !0);
  6729. c += 2;
  6730. for (d = 0; d < g; d++) {
  6731. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  6732. if (r[e].id == n) {
  6733. var k = r[e];
  6734. if (1 == k.type)
  6735. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  6736. for (var h =
  6737. n; h < n + p; ++h) --T[h + 400 * m];
  6738. r.splice(e, 1);
  6739. break a
  6740. }c += 4
  6741. }
  6742. g = b.getUint16(c, !0);
  6743. c += 2;
  6744. for (d = 0; d < g; d++) {
  6745. a: {
  6746. e = b.getUint32(c, !0);
  6747. for (n = 0; n < r.length; n++)
  6748. if (r[n].id == e) {
  6749. e = r[n];
  6750. break a
  6751. }
  6752. e = {
  6753. id: e
  6754. };
  6755. r.push(e)
  6756. }
  6757. c += 4;c = la(b, c, e)
  6758. }
  6759. c = Fa(b, c);
  6760. if (a.byteLength < c + 4) break;
  6761. aa = b.getUint32(c, !0);
  6762. break;
  6763. case 4: // Without this the level don't show
  6764. $();
  6765. W(b.getUint16(1, !0), b.getUint16(3, !0));
  6766. g = b.getUint16(5, !0);
  6767. c = 7;
  6768. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  6769. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  6770. Z();
  6771. break;
  6772. case 5: // Without this things don't trigger unless you are drawing. Also, you can't click buttons.
  6773. W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z()
  6774. }
  6775. }
  6776.  
  6777. // Without this, your position only updates if you click or draw
  6778. function Q() {
  6779. lastFrame = currentFrame;
  6780. currentFrame = new Date().getTime();
  6781.  
  6782. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  6783. var a = new ArrayBuffer(9);
  6784. b = new DataView(a);
  6785. b.setUint8(0, 1);
  6786. b.setUint16(1, k, !0);
  6787. b.setUint16(3, q, !0);
  6788. b.setUint32(5, G, !0);
  6789. u.send(a);
  6790. J = k;
  6791. K = q
  6792. }
  6793.  
  6794. if (auraEnabled) // Drawing cursor aura
  6795. drawAura(J, K);
  6796. }
  6797.  
  6798. // Without this clicking doesn't actually get transmitted to the server
  6799. function wa(a, b, numClicks) {
  6800. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  6801. var c = new ArrayBuffer(9),
  6802. d = new DataView(c);
  6803. d.setUint8(0, 2);
  6804. d.setUint16(1, a, !0);
  6805. d.setUint16(3, b, !0);
  6806. d.setUint32(5, G, !0);
  6807. for (var i = 0; i < numClicks; i++) { u.send(c) } // Changed to click multiple times
  6808. }
  6809. }
  6810.  
  6811. function la(f, b, c) {
  6812. function d() { // Handles drawing stuff
  6813. if (c.type == 4 && initialLoad) {
  6814. c.x = f.getUint16(b, !0);
  6815. buttons[buttonIndex][0] = c.x
  6816. b += 2;
  6817. c.y = f.getUint16(b, !0);
  6818. buttons[buttonIndex][1] = c.y
  6819. b += 2;
  6820. c.width = f.getUint16(b, !0);
  6821. b += 2;
  6822. c.height = f.getUint16(b, !0);
  6823. b += 2
  6824.  
  6825. buttonIndex++;
  6826. } else {
  6827. c.x = f.getUint16(b, !0);
  6828. b += 2;
  6829. c.y = f.getUint16(b, !0);
  6830. b += 2;
  6831. c.width = f.getUint16(b, !0);
  6832. b += 2;
  6833. c.height = f.getUint16(b, !0);
  6834. b += 2
  6835. }
  6836. }
  6837. function g() { // Handles coloring stuff
  6838. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  6839. b += 4;
  6840. c.color = "#" + a
  6841. }
  6842. var e = f.getUint8(b);
  6843. b += 1;
  6844. c.type = e;
  6845. switch (e) {
  6846. case 255:
  6847. break;
  6848. case 0: // Draws text
  6849. c.x = f.getUint16(b, !0);
  6850. b += 2;
  6851. c.y = f.getUint16(b, !0);
  6852. b += 2;
  6853. c.size = f.getUint8(b);
  6854. b += 1;
  6855. c.isCentered = !!f.getUint8(b);
  6856. b += 1;
  6857. e = Da(f, b);
  6858. c.text = e[0];
  6859. b = e[1];
  6860. break;
  6861. case 1: // May relate to cursor movement?
  6862. d();
  6863. var n = !c.color;
  6864. g();
  6865. var e = c.x | 0,
  6866. l = c.y | 0,
  6867. p = c.width | 0,
  6868. k = c.height | 0;
  6869. if (n)
  6870. for (n = l; n < l + k; ++n)
  6871. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  6872. break;
  6873. case 2: // Draws exit points
  6874. d();
  6875. c.isBad = !!f.getUint8(b);
  6876. b += 1;
  6877. break;
  6878. case 3: // Handles the area triggers
  6879. d();
  6880. c.count = f.getUint16(b, !0);
  6881. b += 2;
  6882. g();
  6883. break;
  6884. case 4: // Something about buttons, but also affects doors and area triggers
  6885. d();
  6886. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  6887. c.count = f.getUint16(b, !0);
  6888. if (initialLoad) buttons[buttonIndex-1][2] = 1;
  6889. b += 2;
  6890. g();
  6891. break;
  6892. case 5:
  6893. c.x = f.getUint16(b, !0);
  6894. b += 2;
  6895. c.y = f.getUint16(b, !0);
  6896. b += 2;
  6897. c.queue = [
  6898. [0, c.x, c.y]
  6899. ];
  6900. c.potentialQueue = [];
  6901. c.explored = new Uint8Array(12E4);
  6902. c.img = a.createImageData(400, 300);
  6903. e = E.createElement("canvas");
  6904. e.width = 400;
  6905. e.height = 300;
  6906. c.canvas = e;
  6907. c.ctx = c.canvas.getContext("2d");
  6908. break;
  6909. default:
  6910. throw Error("Unknown object type " + e);
  6911. }
  6912. return b
  6913. }
  6914.  
  6915. function ea(a, b) {
  6916. if (-1 != J && -1 != K) {
  6917. var c = fa(J, K, a, b);
  6918. if (c.x != a || c.y != b) return !0
  6919. }
  6920. for (c = 0; c < r.length; c++) {
  6921. var d = r[c];
  6922. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0
  6923. }
  6924. return !1
  6925. }
  6926.  
  6927. function ma() {
  6928. a.clearRect(0, 0, 800, 600);
  6929. a.save();
  6930. if (null != u && u.readyState != WebSocket.OPEN || L) {
  6931. var f;
  6932. if (null == u) f = "Click to begin";
  6933. else switch (u.readyState) {
  6934. case WebSocket.CONNECTING:
  6935. f = "Connecting";
  6936. break;
  6937. case WebSocket.CLOSING:
  6938. case WebSocket.CLOSED:
  6939. f = "Lost connection to server";
  6940. break;
  6941. default:
  6942. f = "Click to begin"
  6943. }
  6944. a.font = "60px NovaSquare";
  6945. a.fillText(f, 400 - a.measureText(f).width / 2, 315);
  6946. na();
  6947. oa(!1)
  6948. } else {
  6949. a.fillStyle = "#000000";
  6950. a.save();
  6951. a.globalAlpha = 1;
  6952. Ha();
  6953. for (f = 0; f < r.length; f++) {
  6954. var b = r[f];
  6955. if (0 == b.type) {
  6956. a.font = b.size + "px NovaSquare";
  6957. var c = b.x << 1,
  6958. d = b.y << 1;
  6959. b.isCentered && (c -= a.measureText(b.text).width / 2);
  6960. a.fillStyle = "#000000";
  6961. a.fillText(b.text,
  6962. c, d)
  6963. } else if (1 == b.type) a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2, a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2), a.globalAlpha = 1;
  6964. else if (2 == b.type) a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1), a.globalAlpha = 1;
  6965. else if (3 == b.type) {
  6966. var c = b.x << 1,
  6967. d = b.y << 1,
  6968. g = b.width << 1,
  6969. e = b.height << 1;
  6970. a.fillStyle = b.color;
  6971. a.globalAlpha = .2;
  6972. a.fillRect(c, d, g, e);
  6973. a.globalAlpha =
  6974. .5;
  6975. a.fillStyle = "#000000";
  6976. 40 > b.width || 40 > b.height ? (a.font = "30px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10)) : (a.font = "60px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20));
  6977. a.globalAlpha = 1
  6978. } else if (4 == b.type) {
  6979. c = b.x << 1;
  6980. d = b.y << 1;
  6981. g = b.width << 1;
  6982. e = b.height << 1;
  6983. a.fillStyle = b.color;
  6984. a.strokeStyle = b.color;
  6985. a.globalAlpha = 1;
  6986. a.fillRect(c, d, g, e);
  6987. a.globalAlpha = .2;
  6988. a.fillStyle = "#000000";
  6989. a.fillRect(c, d, g, e);
  6990. a.globalAlpha = 1;
  6991. a.fillStyle = b.color;
  6992. var n = 150 > t - b.lastClickAt,
  6993. l = n ? 8 : 12;
  6994. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  6995. a.strokeStyle = "#000000";
  6996. a.globalAlpha = .1;
  6997. a.beginPath();
  6998. a.moveTo(c, d);
  6999. a.lineTo(c + l, d + l);
  7000. a.moveTo(c + g, d);
  7001. a.lineTo(c + g - l, d + l);
  7002. a.moveTo(c, d + e);
  7003. a.lineTo(c + l, d + e - l);
  7004. a.moveTo(c + g, d + e);
  7005. a.lineTo(c + g - l, d + e - l);
  7006. a.moveTo(c, d);
  7007. a.rect(c, d, g, e);
  7008. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  7009. a.stroke();
  7010. a.fillStyle = "#000000";
  7011. a.globalAlpha = .5;
  7012. 50 > b.width || 50 > b.height ? (a.font = "35px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13)) : (a.font = "45px NovaSquare", a.fillText(b.count,
  7013. c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16));
  7014. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  7015. a.globalAlpha = 1
  7016. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600), ga(!0))
  7017. }
  7018. a.restore();
  7019. D || (a.font = "12px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5, f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw", a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1, a.fillText(f,
  7020. 10, 590), 0 != aa && (f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1, a.fillText(f, 790 - b, 590)));
  7021. na();
  7022. if (!H.checked) {
  7023. a.save();
  7024. a.strokeStyle = "#000000";
  7025. a.lineWidth = 1;
  7026. t = +new Date;
  7027. for (f = 0; f < O.length; f++) b = O[f], c = 10 - (t - b[4]) / 1E3, 0 >= c ? (O.splice(f, 1), --f) : (1 < c && (c = 1), a.globalAlpha = .3 * c, a.beginPath(), a.moveTo(b[0] - .5, b[1] - .5), a.lineTo(b[2] - .5, b[3] - .5), a.stroke());
  7028. a.restore()
  7029. }
  7030. a.save();
  7031. for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) -
  7032. 6);
  7033. a.restore();
  7034. oa(!0)
  7035. }
  7036. a.restore();
  7037. A.requestAnimationFrame(ma)
  7038. }
  7039.  
  7040. function na() { // draws circles when you click
  7041. a.save();
  7042. a.strokeStyle = "#000000";
  7043. t = +new Date;
  7044. for (var f = 0; f < I.length; f++) {
  7045. var b = I[f],
  7046. c = (t - b[2]) / 1E3,
  7047. d = 1 - 2 * c;
  7048. 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke())
  7049. }
  7050. a.restore()
  7051. }
  7052.  
  7053. function oa(f) {
  7054. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5);
  7055. else {
  7056. var b = 0,
  7057. c = 0;
  7058. v != k || w != q ? (a.save(), f && (a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath(), a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1),
  7059. a.fill()), a.globalAlpha = .5, a.drawImage(P, B - 5, C - 5), a.restore()) : (b = B & 1, c = C & 1);
  7060. a.save();
  7061. f && (a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath(), a.arc((k << 1) + b + 2, (q << 1) + c + 8, 20, 0, 2 * Math.PI, !1), a.fill());
  7062. a.globalAlpha = 1;
  7063. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5)
  7064. }
  7065. a.restore()
  7066. }
  7067.  
  7068. function ka(a, b) {
  7069. this.oldX = this.newX = a;
  7070. this.oldY = this.newY = b;
  7071. this.time = t
  7072. }
  7073.  
  7074. function pa(a) {
  7075. return a * a * (3 - 2 * a)
  7076. }
  7077.  
  7078. function fa(a, b, c, d) {
  7079. a |= 0;
  7080. b |= 0;
  7081. c |= 0;
  7082. d |= 0;
  7083. if (z(a, b)) return {
  7084. x: a,
  7085. y: b
  7086. };
  7087. if (a == c && b == d) return {
  7088. x: c,
  7089. y: d
  7090. };
  7091. var g = a,
  7092. e = b;
  7093. c = c - a | 0;
  7094. d = d - b | 0;
  7095. var n =
  7096. 0,
  7097. l = 0,
  7098. p = 0,
  7099. k = 0;
  7100. 0 > c ? n = -1 : 0 < c && (n = 1);
  7101. 0 > d ? l = -1 : 0 < d && (l = 1);
  7102. 0 > c ? p = -1 : 0 < c && (p = 1);
  7103. var m = Math.abs(c) | 0,
  7104. h = Math.abs(d) | 0;
  7105. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  7106. c = m >> 1;
  7107. for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k);
  7108. return {
  7109. x: g,
  7110. y: e
  7111. }
  7112. }
  7113.  
  7114. function z(a, b) {
  7115. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  7116. }
  7117.  
  7118. function Ja() {
  7119. for (var a = 0; a < r.length; a++) {
  7120. var b = r[a];
  7121. 5 == b.type && Ka(b)
  7122. }
  7123. }
  7124.  
  7125. function Ka(a) {
  7126. function b(a, b, c) {
  7127. e.push([c, a, b]);
  7128. l[a + 400 * b] = !0;
  7129. g(a, b)
  7130. }
  7131.  
  7132. function c(a, b, c) {
  7133. p.push([c,
  7134. a, b
  7135. ]);
  7136. l[a + 400 * b] = !0
  7137. }
  7138.  
  7139. function d(a, b) {
  7140. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  7141. }
  7142.  
  7143. function g(a, b) {
  7144. var c = 4 * (a + 400 * b);
  7145. k[c + 0] = 255;
  7146. k[c + 1] = 153;
  7147. k[c + 2] = 153;
  7148. k[c + 3] = 255
  7149. }
  7150. for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m);
  7151. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  7152. for (r = 0; 50 > r && 0 != e.length; ++r) {
  7153. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  7154. var x = e[m][0];
  7155. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  7156. }
  7157. for (m = 0; m < q.length; ++m) {
  7158. var x = q[m][0],
  7159. h = q[m][1],
  7160. s = q[m][2],
  7161. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  7162. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  7163. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  7164. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  7165. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  7166. 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2));
  7167. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  7168. b(h - 1, s + 1, x + Math.SQRT2));
  7169. 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2));
  7170. 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2))
  7171. }
  7172. }
  7173. a.ctx.putImageData(a.img, 0, 0)
  7174. }
  7175. var y, a, ia = 0,
  7176. v = 0,
  7177. w = 0,
  7178. B = 0,
  7179. C = 0,
  7180. k = 0,
  7181. q = 0,
  7182. J = -1,
  7183. K = -1,
  7184. M = null,
  7185. H = null,
  7186. P = new Image;
  7187. P.src = "img/cursor.png";
  7188. var Ia = P,
  7189. D = -1 != A.location.search.indexOf("editor"),
  7190. I = [],
  7191. O = [],
  7192. t = 0,
  7193. ca = 0,
  7194. u = null,
  7195. ha = -1,
  7196. F = {},
  7197. aa = 0,
  7198. ja = !1,
  7199. Y = !1,
  7200. R = 0,
  7201. S = 0,
  7202. da = 0,
  7203. X = !1,
  7204. L = !D && !0,
  7205. T = new Uint8Array(12E4),
  7206. r = [],
  7207. N = [];
  7208. Array.prototype.remove =
  7209. function(a) {
  7210. a = this.indexOf(a);
  7211. return -1 != a ? (this.splice(a, 1), !0) : !1
  7212. };
  7213. var G = 0;
  7214. ka.prototype = {
  7215. oldX: 0,
  7216. oldY: 0,
  7217. newX: 0,
  7218. newY: 0,
  7219. time: 0,
  7220. getX: function() {
  7221. var a = this.newX - this.oldX,
  7222. b = (t - this.time) / 100,
  7223. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  7224. return this.oldX + b * a
  7225. },
  7226. getY: function() {
  7227. var a = this.newY - this.oldY,
  7228. b = (t - this.time) / 100,
  7229. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  7230. return this.oldY + b * a
  7231. }
  7232. };
  7233. var ra = function() {
  7234. function f() {
  7235. var a = 0,
  7236. b = 0,
  7237. c = v / 10,
  7238. d = w / 10;
  7239. n < c ? (c = Math.ceil(c), a = Math.floor(n)) : (c = Math.floor(c), a = Math.ceil(n));
  7240. l < d ? (d = Math.ceil(d), b = Math.floor(l)) :
  7241. (d = Math.floor(d), b = Math.ceil(l));
  7242. if (a > c) var e = c,
  7243. c = a,
  7244. a = e;
  7245. b > d && (e = d, d = b, b = e);
  7246. return {
  7247. sx: a,
  7248. sy: b,
  7249. fx: c,
  7250. fy: d
  7251. }
  7252. }
  7253.  
  7254. function b() {
  7255. e = !0;
  7256. n = v / 10;
  7257. l = w / 10
  7258. }
  7259.  
  7260. function c(a) {
  7261. return "0x" + parseInt(a.slice(1), 16).toString(16).toUpperCase()
  7262. }
  7263.  
  7264. function d(a, b, c, d, e) {
  7265. a = {
  7266. x: 10 * ~~(k / 10) - ~~(a / 2) + c,
  7267. y: 10 * ~~(q / 10) - ~~(b / 2) + d,
  7268. width: a,
  7269. height: b
  7270. };
  7271. for (var f in e) e.hasOwnProperty(f) && (a[f] = e[f]);
  7272. return a
  7273. }
  7274.  
  7275. function g(a, b) {
  7276. for (var c = null, d = Number.POSITIVE_INFINITY, e = 0; e < r.length; e++) {
  7277. var f = r[e];
  7278. if (f.hasOwnProperty("x") && f.hasOwnProperty("y") && f.hasOwnProperty("width") &&
  7279. f.hasOwnProperty("height")) {
  7280. var g = f.x + f.width / 2,
  7281. h = f.y + f.height / 2,
  7282. g = (a - g) * (a - g) + (b - h) * (b - h);
  7283. g < d && (d = g, c = f)
  7284. }
  7285. }
  7286. return c
  7287. }
  7288. var e = !1,
  7289. n = 0,
  7290. l = 0,
  7291. p = 1,
  7292. u = 200,
  7293. m = 150,
  7294. h = new Uint8Array(1200),
  7295. t = "#000000 #FF9999 #9999FF #FFFF99 #99FFFF #FF99FF #3333FF".split(" ");
  7296. E.addEventListener("mouseup", function() {
  7297. if (e) {
  7298. for (var a = f(), b = p, c = a.sy; c < a.fy; ++c)
  7299. for (var d = a.sx; d < a.fx; ++d) h[d + 40 * c] = b;
  7300. e = !1
  7301. }
  7302. });
  7303. E.addEventListener("mousemove", function() {});
  7304. A.generateCode = function() {
  7305. for (var a = "class Level? : public Level {\npublic:\n\tLevel?() : Level(" +
  7306. u + ", " + m + "){}\n\n\tvoid OnInit(){\n", a = a + ("\t\tstd::vector<LevelObject*> wallByColor[" + t.length + "];\n"), b = new Uint8Array(1200), d = [], e = 0; 30 > e; ++e)
  7307. for (var f = 0; 40 > f; ++f)
  7308. if (!b[f + 40 * e]) {
  7309. var g = h[f + 40 * e];
  7310. if (0 != g) {
  7311. for (var k = f; 40 > f && h[f + 40 * e] == g && !b[f + 40 * e];) b[f + 40 * e] = !0, ++f;
  7312. var l = f--,
  7313. p = l - k,
  7314. q = e++;
  7315. a: for (; 30 > e;) {
  7316. for (var n = k; n < l; ++n) {
  7317. if (h[n + 40 * e] != g) break a;
  7318. if (b[n + 40 * e]) break a
  7319. }
  7320. for (n = k; n < l; ++n) b[n + 40 * e] = !0;
  7321. ++e
  7322. }
  7323. l = e - q;
  7324. e = q;
  7325. d.push({
  7326. x: 10 * k,
  7327. y: 10 * q,
  7328. width: 10 * p,
  7329. height: 10 * l,
  7330. color: g - 1
  7331. })
  7332. }
  7333. }
  7334. for (b = 0; b < d.length; b++) e = d[b], 0 ==
  7335. e.color ? a += "\t\tAddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", 0x000000));\n" : (f = c(t[e.color]), a += "\t\twallByColor[" + e.color + "].push_back(AddObject(new ObjWall(" + e.x + ", " + e.y + ", " + e.width + ", " + e.height + ", " + f + ")));\n");
  7336. for (b = 0; b < r.length; b++) d = r[b], 0 != d.type && (2 == d.type ? a += "\t\tAddObject(new ObjTeleport(LevelManager::GetNextLevel(this), " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + "));\n" : 3 == d.type ? (a += "\t\tAddObject(new ObjAreaCounter(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y +
  7337. ", " + d.width + ", " + d.height + ", ", a += d.count + ", " + c(d.color) + "));\n") : 4 == d.type && (a += "\t\tAddObject(new ObjClickBox(wallByColor[" + d.colorCode + "], " + d.x + ", " + d.y + ", " + d.width + ", " + d.height + ", ", a += d.count + ", 1000, " + c(d.color) + "));\n"));
  7338. return a += "\t}\n};\n"
  7339. };
  7340. E.addEventListener("keydown", function(a) {
  7341. if (a.keyCode == 8) {
  7342. a.preventDefault();
  7343. if (message.length > 0) {
  7344. message = message.substring(0, message.length - 1);
  7345. messageDisplay.innerHTML = message;
  7346. }
  7347. }
  7348. else if (a.keyCode == 9) {
  7349. a.preventDefault();
  7350. }
  7351. if (D) {
  7352. var b = a.keyCode;
  7353. 65 == b ? (--p, 0 > p && (p = t.length)) : 83 == b ? (++p, p > t.length && (p = 0)) : 66 == b ? 1 >= p || r.push(d(40, 40, 5, 5, {
  7354. type: 4,
  7355. color: t[p - 1],
  7356. colorCode: p - 1,
  7357. count: 5
  7358. })) : 90 == b ? r.pop() : 87 == b ? r.push(d(50, 50, -5, -5, {
  7359. type: 2,
  7360. isBad: !1
  7361. })) : 79 == b ? (u = k, m = q) : 78 == b ? 1 >= p || r.push(d(40, 40, 0, 0, {
  7362. type: 3,
  7363. color: t[p - 1],
  7364. colorCode: p - 1,
  7365. count: 1
  7366. })) : 37 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.width -= 10 : (b.x -= 10, b.width += 10), 0 == b.width && r.splice(r.indexOf(b), 1))) : 39 == b ? (b = g(v, w), null != b && (a.shiftKey ? (b.x += 10, b.width -= 10) : b.width += 10, 0 == b.width && r.splice(r.indexOf(b), 1))) : 38 == b ? (b = g(v, w), null != b && (a.shiftKey ? b.height -= 10 : (b.y -= 10, b.height += 10), 0 == b.height && r.splice(r.indexOf(b), 1))) : 40 == b && (b = g(v, w), null != b && (a.shiftKey ? (b.y += 10, b.height -= 10) : b.height +=
  7367. 10, 0 == b.height && r.splice(r.indexOf(b), 1)))
  7368. }
  7369. });
  7370. return {
  7371. renderEditor: function() {
  7372. if (D) {
  7373. a.save();
  7374. a.fillStyle = "#FF0000";
  7375. a.strokeStyle = "#FF0000";
  7376. a.lineWidth = 1;
  7377. a.globalAlpha = .09;
  7378. a.beginPath();
  7379. for (var b = 0; 400 > b; b += 10) a.moveTo((b << 1) + .5, 0), a.lineTo((b << 1) + .5, 600);
  7380. for (var c = 0; 300 > c; c += 10) a.moveTo(0, (c << 1) + .5), a.lineTo(800, (c << 1) + .5);
  7381. a.stroke();
  7382. a.lineWidth = 2;
  7383. a.beginPath();
  7384. a.moveTo(400.5, 0);
  7385. a.lineTo(400.5, 600);
  7386. a.moveTo(0, 300.5, 0);
  7387. a.lineTo(800, 300.5);
  7388. a.stroke();
  7389. a.lineWidth = 1;
  7390. a.globalAlpha = 1;
  7391. a.fillStyle = "#000000";
  7392. for (var d = f(), c = 0; 300 > c; c += 10)
  7393. for (b = 0; 400 > b; b += 10) {
  7394. var g = b / 10 | 0,
  7395. k = c / 10 | 0,
  7396. l = h[g + 40 * k];
  7397. e && g >= d.sx && g < d.fx && k >= d.sy && k < d.fy && (l = p);
  7398. 0 != l && (a.fillStyle = t[l - 1], a.fillRect(b << 1, c << 1, 20, 20))
  7399. }
  7400. a.save();
  7401. a.globalAlpha = .09;
  7402. a.fillStyle = "#0000FF";
  7403. a.beginPath();
  7404. a.arc(u << 1, m << 1, 20, 0, 2 * Math.PI, !1);
  7405. a.fill();
  7406. a.restore();
  7407. a.save();
  7408. a.fillStyle = "#FFFFFF";
  7409. a.strokeStyle = "#000000";
  7410. a.lineWidth = 2.5;
  7411. a.font = "14px NovaSquare";
  7412. a.globalAlpha = .5;
  7413. a.strokeText("Current color: ", 10, 590);
  7414. a.globalAlpha = 1;
  7415. a.fillText("Current color: ", 10,
  7416. 590);
  7417. 0 == p ? a.fillText("ESR", 105, 590) : (a.fillStyle = "#000000", a.fillRect(104, 575, 22, 22), a.fillStyle = t[p - 1], a.fillRect(105, 576, 20, 20));
  7418. a.restore();
  7419. a.restore()
  7420. }
  7421. },
  7422. initEditor: function() {
  7423. y.addEventListener("mousedown", b)
  7424. }
  7425. }
  7426. }(),
  7427. Ha = ra.renderEditor,
  7428. La = ra.initEditor,
  7429. za = new Uint8Array(12E4);
  7430. Array.prototype.remove = function(a) {
  7431. a = this.indexOf(a);
  7432. return -1 != a ? (this.splice(a, 1), !0) : !1
  7433. };
  7434.  
  7435. function handleKeyboard(e) {
  7436. if ((e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63 || e.keyCode == 58 || e.keyCode == 40 || e.keyCode == 41) {
  7437. message = message.concat(String.fromCharCode(e.keyCode));
  7438. messageDisplay.innerHTML = message;
  7439. return;
  7440. }
  7441. switch(e.keyCode) {
  7442. case 13:
  7443. drawWord(message, posX, posY);
  7444. message = "";
  7445. messageDisplay.innerHTML = message;
  7446. e.preventDefault();
  7447. break;
  7448. case 96: // Click all buttons
  7449. clickAllButtons();
  7450. break;
  7451. case 47:
  7452. movementEnabled = !movementEnabled
  7453. break;
  7454. case 45: // Toggle Aura
  7455. auraEnabled = !auraEnabled;
  7456. break;
  7457. case 43:
  7458. drawImage(posX, posY);
  7459. break;
  7460. case 42:
  7461. markerEnabled = !markerEnabled;
  7462. break;
  7463. default:
  7464. return;
  7465. }
  7466. }
  7467.  
  7468. function clickAllButtons() {
  7469. for (var i = 0; i < maxButtons; i++) {
  7470. if (buttons[i][0] == null) break;
  7471. wa(buttons[i][0], buttons[i][1], buttons[i][2]);
  7472. }
  7473. }
  7474.  
  7475. function drawAura(x, y) {
  7476. var dt = 360/(1000/40)/2;
  7477. if (u != null && u.readyState == WebSocket.OPEN) {
  7478. var g = new ArrayBuffer(9),
  7479. e = new DataView(g);
  7480. e.setUint8(0, 3);
  7481. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  7482. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  7483. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  7484. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  7485. u.send(g)
  7486. }
  7487.  
  7488. auraTime += dt;
  7489. }
  7490.  
  7491. function degToRad(deg) {
  7492. return deg * (Math.PI / 180);
  7493. }
  7494.  
  7495. function radToDeg(rad) {
  7496. return rad * (180 / Math.PI);
  7497. }
  7498.  
  7499. var drawIndex = 0;
  7500. function drawImage(x, y) {
  7501. setTimeout(function () {
  7502. var g = new ArrayBuffer(9),
  7503. e = new DataView(g);
  7504.  
  7505. e.setUint8(0, 3);
  7506. e.setUint16(1, x+imgData[drawIndex][1]*imageScale, !0);
  7507. e.setUint16(3, y+imgData[drawIndex][0]*imageScale, !0);
  7508. e.setUint16(5, x+imgData[drawIndex][3]*imageScale, !0);
  7509. e.setUint16(7, y+imgData[drawIndex][2]*imageScale, !0);
  7510. u.send(g);
  7511.  
  7512. drawIndex++;
  7513. if (drawIndex < imgData.length)
  7514. drawImage(x, y);
  7515. else
  7516. drawIndex = 0;
  7517. }, 15)
  7518. }
  7519.  
  7520. function drawLetter(a, x, y) {
  7521. var letter = alphabet[a];
  7522.  
  7523. if (letter == null)
  7524. return;
  7525.  
  7526. var g = new ArrayBuffer(9),
  7527. e = new DataView(g);
  7528.  
  7529. for (var i = 0; i < letter.length; i++) {
  7530. e.setUint8(0, 3);
  7531. e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  7532. e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  7533. e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  7534. e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  7535. for (var j = 0; j < 4; j++) { u.send(g); }
  7536. }
  7537. }
  7538.  
  7539. var messageDisplay;
  7540. var message = new String();
  7541. var wordIndex = 0;
  7542. function drawWord(s, x, y) {
  7543. setTimeout(function () {
  7544. drawLetter(s.charCodeAt(0), x, y);
  7545. wordIndex++;
  7546. if (s.length > 0)
  7547. drawWord(s.substring(1, s.length), x+fontSize*3, y);
  7548. else {
  7549. wordIndex = 0;
  7550. letterOffset = 0;
  7551. }
  7552. }, 20);
  7553. }
  7554.  
  7555. function doit() {
  7556. document.body.innerHTML += '<div id="messageDisplay"></div>';
  7557. messageDisplay = document.getElementById("messageDisplay");
  7558.  
  7559. y = E.getElementById("canvas");
  7560. a = y.getContext("2d");
  7561. try {
  7562. A.top.location.origin != A.location.origin && ba()
  7563. } catch (f) {
  7564. ba()
  7565. }
  7566. y.onmousemove = ua;
  7567. y.onmousedown = va;
  7568. y.onmouseup = xa;
  7569. M = E.getElementById("noCursorLock");
  7570. H = E.getElementById("noDrawings");
  7571. null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  7572. A.onbeforeunload = ya;
  7573. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  7574. y.style.cursor = "none";
  7575. La();
  7576. D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
  7577. Ba, u.onerror = Ca);
  7578. setInterval(Q, 50);
  7579. setInterval(Ja, 40);
  7580. A.requestAnimationFrame(ma)
  7581.  
  7582. document.onkeypress = handleKeyboard;
  7583. }
  7584.  
  7585. doit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement