Advertisement
Guest User

Cursor Jesus

a guest
Feb 9th, 2015
457,470
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Instructions: Go to cursors.io, open console (ctrl + j) and paste this entire script into the console.
  2. // To type: type message and hit enter
  3. // For marker mode: press *
  4. // To push all buttons on the map: hold ~
  5. // To draw a circle(ish) press -
  6. // To draw an image press +
  7.  
  8. var A = window;
  9. var E = document;
  10.  
  11. var debugMode = false;
  12.  
  13. var posX, posY;
  14. var lastX, lastY;
  15.  
  16. var lastFrame;
  17. var currentFrame;
  18.  
  19. var initialLoad = true;
  20. var buttonIndex = 0;
  21. var maxButtons = 20;
  22. var buttons = new Array(maxButtons);
  23. for (var i = 0; i < maxButtons; i++)
  24. buttons[i] = new Array(3);
  25.  
  26. var auraEnabled = false;
  27. var auraTime = 0;
  28. var auraRadius = 10;
  29.  
  30. var markerEnabled = false;
  31.  
  32. var movementEnabled = true;
  33.  
  34. var imageScale = 1.0;
  35. var imgData = [ [17,49,17,57],
  36. [18,44,18,52],
  37. [18,55,18,59],
  38. [19,41,19,46],
  39. [19,58,19,60],
  40. [20,40,20,42],
  41. [20,60,20,62],
  42. [21,38,21,40],
  43. [21,61,21,63],
  44. [22,37,22,39],
  45. [22,62,22,64],
  46. [23,37,23,38],
  47. [23,63,23,65],
  48. [24,36,24,37],
  49. [24,64,24,65],
  50. [25,35,25,37],
  51. [25,65,25,66],
  52. [26,34,26,36],
  53. [26,65,26,67],
  54. [27,33,27,35],
  55. [27,66,27,67],
  56. [28,32,28,34],
  57. [28,67,28,68],
  58. [29,32,29,34],
  59. [29,67,29,68],
  60. [30,31,30,33],
  61. [30,67,30,69],
  62. [31,31,31,32],
  63. [31,68,31,69],
  64. [32,31,32,32],
  65. [32,68,32,69],
  66. [33,30,33,31],
  67. [33,55,33,59],
  68. [33,68,33,69],
  69. [34,30,34,31],
  70. [34,53,34,58],
  71. [34,59,34,61],
  72. [34,68,34,70],
  73. [35,29,35,31],
  74. [35,52,35,57],
  75. [35,61,35,62],
  76. [35,69,35,70],
  77. [36,29,36,30],
  78. [36,50,36,57],
  79. [36,62,36,63],
  80. [36,69,36,70],
  81. [37,29,37,30],
  82. [37,50,37,58],
  83. [37,62,37,63],
  84. [37,69,37,70],
  85. [38,28,38,30],
  86. [38,49,38,58],
  87. [38,69,38,71],
  88. [38,108,38,115],
  89. [39,28,39,29],
  90. [39,49,39,57],
  91. [39,63,39,64],
  92. [39,70,39,71],
  93. [39,107,39,110],
  94. [39,114,39,116],
  95. [40,28,40,35],
  96. [40,48,40,57],
  97. [40,63,40,64],
  98. [40,70,40,71],
  99. [40,107,40,109],
  100. [40,116,40,117],
  101. [41,27,41,32],
  102. [41,35,41,36],
  103. [41,48,41,57],
  104. [41,63,41,64],
  105. [41,70,41,71],
  106. [41,107,41,108],
  107. [41,117,41,118],
  108. [42,26,42,32],
  109. [42,36,42,37],
  110. [42,48,42,56],
  111. [42,62,42,64],
  112. [42,70,42,72],
  113. [42,107,42,108],
  114. [42,118,42,119],
  115. [43,25,43,32],
  116. [43,36,43,38],
  117. [43,41,43,42],
  118. [43,48,43,56],
  119. [43,62,43,63],
  120. [43,70,43,72],
  121. [43,107,43,108],
  122. [43,118,43,119],
  123. [44,25,44,32],
  124. [44,37,44,38],
  125. [44,40,44,41],
  126. [44,47,44,55],
  127. [44,61,44,63],
  128. [44,71,44,72],
  129. [44,107,44,108],
  130. [44,118,44,119],
  131. [45,24,45,32],
  132. [45,37,45,40],
  133. [45,48,45,50],
  134. [45,59,45,62],
  135. [45,71,45,72],
  136. [45,107,45,108],
  137. [45,118,45,119],
  138. [46,24,46,32],
  139. [46,37,46,40],
  140. [46,49,46,51],
  141. [46,58,46,60],
  142. [46,71,46,72],
  143. [46,107,46,108],
  144. [46,119,46,120],
  145. [47,23,47,32],
  146. [47,37,47,39],
  147. [47,50,47,53],
  148. [47,55,47,58],
  149. [47,71,47,73],
  150. [47,107,47,108],
  151. [47,119,47,120],
  152. [48,23,48,31],
  153. [48,36,48,39],
  154. [48,52,48,56],
  155. [48,72,48,73],
  156. [48,107,48,108],
  157. [48,119,48,120],
  158. [49,23,49,30],
  159. [49,35,49,38],
  160. [49,62,49,65],
  161. [49,72,49,73],
  162. [49,106,49,108],
  163. [49,119,49,120],
  164. [50,24,50,29],
  165. [50,34,50,38],
  166. [50,43,50,46],
  167. [50,61,50,64],
  168. [50,72,50,74],
  169. [50,106,50,108],
  170. [50,119,50,120],
  171. [51,24,51,28],
  172. [51,32,51,34],
  173. [51,36,51,37],
  174. [51,40,51,42],
  175. [51,45,51,46],
  176. [51,58,51,62],
  177. [51,72,51,74],
  178. [51,106,51,108],
  179. [51,119,51,120],
  180. [52,25,52,32],
  181. [52,36,52,37],
  182. [52,45,52,46],
  183. [52,56,52,60],
  184. [52,73,52,74],
  185. [52,106,52,108],
  186. [52,119,52,120],
  187. [53,26,53,28],
  188. [53,35,53,37],
  189. [53,44,53,46],
  190. [53,55,53,58],
  191. [53,73,53,74],
  192. [53,106,53,107],
  193. [53,119,53,120],
  194. [54,26,54,27],
  195. [54,36,54,38],
  196. [54,41,54,45],
  197. [54,52,54,56],
  198. [54,73,54,75],
  199. [54,106,54,107],
  200. [54,119,54,120],
  201. [55,26,55,27],
  202. [55,37,55,44],
  203. [55,50,55,54],
  204. [55,74,55,75],
  205. [55,106,55,107],
  206. [55,119,55,120],
  207. [56,26,56,27],
  208. [56,47,56,51],
  209. [56,74,56,75],
  210. [56,106,56,107],
  211. [56,119,56,120],
  212. [57,26,57,27],
  213. [57,45,57,49],
  214. [57,74,57,76],
  215. [57,106,57,107],
  216. [57,119,57,120],
  217. [58,26,58,27],
  218. [58,42,58,46],
  219. [58,74,58,76],
  220. [58,106,58,107],
  221. [58,115,58,116],
  222. [58,118,58,119],
  223. [59,26,59,28],
  224. [59,39,59,44],
  225. [59,75,59,76],
  226. [59,105,59,107],
  227. [59,118,59,119],
  228. [60,27,60,28],
  229. [60,37,60,41],
  230. [60,75,60,77],
  231. [60,105,60,106],
  232. [60,118,60,119],
  233. [60,124,60,125],
  234. [61,27,61,28],
  235. [61,33,61,38],
  236. [61,76,61,77],
  237. [61,105,61,106],
  238. [61,117,61,118],
  239. [61,123,61,127],
  240. [62,27,62,28],
  241. [62,30,62,35],
  242. [62,76,62,78],
  243. [62,104,62,106],
  244. [62,116,62,118],
  245. [62,122,62,124],
  246. [62,126,62,128],
  247. [63,27,63,28],
  248. [63,30,63,31],
  249. [63,77,63,78],
  250. [63,98,63,102],
  251. [63,104,63,105],
  252. [63,116,63,117],
  253. [63,121,63,123],
  254. [63,126,63,128],
  255. [64,27,64,28],
  256. [64,77,64,79],
  257. [64,95,64,105],
  258. [64,116,64,118],
  259. [64,119,64,121],
  260. [64,126,64,128],
  261. [65,27,65,29],
  262. [65,68,65,69],
  263. [65,78,65,79],
  264. [65,92,65,96],
  265. [65,103,65,105],
  266. [65,115,65,120],
  267. [65,123,65,126],
  268. [65,127,65,128],
  269. [66,28,66,29],
  270. [66,63,66,64],
  271. [66,68,66,70],
  272. [66,78,66,80],
  273. [66,91,66,93],
  274. [66,103,66,104],
  275. [66,117,66,118],
  276. [66,127,66,128],
  277. [67,28,67,29],
  278. [67,63,67,64],
  279. [67,69,67,70],
  280. [67,79,67,80],
  281. [67,89,67,91],
  282. [67,103,67,104],
  283. [67,126,67,128],
  284. [68,28,68,29],
  285. [68,64,68,65],
  286. [68,69,68,70],
  287. [68,79,68,81],
  288. [68,87,68,89],
  289. [68,102,68,104],
  290. [68,120,68,131],
  291. [69,28,69,29],
  292. [69,69,69,70],
  293. [69,80,69,82],
  294. [69,87,69,88],
  295. [69,102,69,103],
  296. [69,122,69,132],
  297. [70,29,70,30],
  298. [70,70,70,71],
  299. [70,80,70,82],
  300. [70,85,70,87],
  301. [70,101,70,113],
  302. [70,132,70,133],
  303. [71,29,71,30],
  304. [71,65,71,66],
  305. [71,70,71,71],
  306. [71,81,71,83],
  307. [71,85,71,86],
  308. [71,91,71,92],
  309. [71,99,71,116],
  310. [71,132,71,133],
  311. [72,29,72,30],
  312. [72,65,72,66],
  313. [72,70,72,71],
  314. [72,81,72,85],
  315. [72,91,72,94],
  316. [72,97,72,100],
  317. [72,115,72,118],
  318. [72,132,72,134],
  319. [73,29,73,30],
  320. [73,70,73,72],
  321. [73,81,73,85],
  322. [73,94,73,99],
  323. [73,118,73,120],
  324. [73,132,73,133],
  325. [74,29,74,30],
  326. [74,71,74,72],
  327. [74,81,74,84],
  328. [74,95,74,98],
  329. [74,119,74,120],
  330. [74,132,74,133],
  331. [75,30,75,31],
  332. [75,66,75,67],
  333. [75,71,75,72],
  334. [75,82,75,84],
  335. [75,94,75,96],
  336. [75,120,75,121],
  337. [75,128,75,129],
  338. [75,131,75,133],
  339. [76,30,76,31],
  340. [76,66,76,67],
  341. [76,71,76,72],
  342. [76,83,76,84],
  343. [76,89,76,90],
  344. [76,94,76,95],
  345. [76,121,76,122],
  346. [76,124,76,125],
  347. [76,129,76,132],
  348. [77,30,77,31],
  349. [77,72,77,73],
  350. [77,83,77,84],
  351. [77,93,77,94],
  352. [77,121,77,123],
  353. [77,129,77,132],
  354. [78,30,78,32],
  355. [78,67,78,68],
  356. [78,72,78,73],
  357. [78,84,78,85],
  358. [78,92,78,93],
  359. [78,122,78,123],
  360. [78,125,78,129],
  361. [79,30,79,32],
  362. [79,67,79,68],
  363. [79,72,79,73],
  364. [79,85,79,86],
  365. [79,91,79,93],
  366. [79,122,79,128],
  367. [80,31,80,32],
  368. [80,67,80,68],
  369. [80,72,80,74],
  370. [80,91,80,92],
  371. [80,122,80,123],
  372. [81,31,81,33],
  373. [81,73,81,74],
  374. [81,91,81,92],
  375. [81,123,81,124],
  376. [82,31,82,33],
  377. [82,68,82,69],
  378. [82,73,82,74],
  379. [82,102,82,103],
  380. [82,123,82,124],
  381. [83,32,83,33],
  382. [83,68,83,69],
  383. [83,73,83,74],
  384. [83,101,83,102],
  385. [83,123,83,124],
  386. [84,32,84,33],
  387. [84,68,84,69],
  388. [84,73,84,74],
  389. [84,123,84,124],
  390. [85,32,85,34],
  391. [85,69,85,70],
  392. [85,73,85,74],
  393. [85,123,85,124],
  394. [86,33,86,35],
  395. [86,69,86,70],
  396. [86,74,86,75],
  397. [86,123,86,124],
  398. [87,34,87,35],
  399. [87,74,87,75],
  400. [87,123,87,124],
  401. [88,34,88,36],
  402. [88,70,88,71],
  403. [88,75,88,76],
  404. [88,122,88,124],
  405. [89,35,89,36],
  406. [89,70,89,71],
  407. [89,75,89,81],
  408. [89,122,89,123],
  409. [90,35,90,37],
  410. [90,71,90,72],
  411. [90,81,90,84],
  412. [90,121,90,123],
  413. [91,36,91,37],
  414. [91,71,91,72],
  415. [91,84,91,85],
  416. [91,121,91,122],
  417. [92,36,92,38],
  418. [92,70,92,71],
  419. [92,84,92,85],
  420. [92,121,92,122],
  421. [93,37,93,39],
  422. [93,70,93,71],
  423. [93,76,93,78],
  424. [93,83,93,85],
  425. [93,120,93,122],
  426. [94,38,94,39],
  427. [94,69,94,70],
  428. [94,77,94,83],
  429. [94,120,94,121],
  430. [95,38,95,40],
  431. [95,69,95,70],
  432. [95,73,95,74],
  433. [95,77,95,78],
  434. [95,119,95,121],
  435. [96,39,96,41],
  436. [96,69,96,70],
  437. [96,73,96,74],
  438. [96,77,96,78],
  439. [96,104,96,105],
  440. [96,119,96,120],
  441. [97,40,97,41],
  442. [97,69,97,70],
  443. [97,73,97,75],
  444. [97,77,97,78],
  445. [97,118,97,120],
  446. [98,40,98,42],
  447. [98,69,98,70],
  448. [98,73,98,76],
  449. [98,78,98,79],
  450. [98,117,98,119],
  451. [99,41,99,43],
  452. [99,69,99,70],
  453. [99,73,99,74],
  454. [99,75,99,78],
  455. [99,108,99,109],
  456. [99,117,99,118],
  457. [100,42,100,44],
  458. [100,69,100,71],
  459. [100,72,100,73],
  460. [100,76,100,78],
  461. [100,116,100,118],
  462. [101,43,101,45],
  463. [101,70,101,72],
  464. [101,115,101,117],
  465. [102,43,102,45],
  466. [102,114,102,116],
  467. [103,44,103,46],
  468. [103,113,103,115],
  469. [104,45,104,47],
  470. [104,111,104,114],
  471. [105,46,105,48],
  472. [105,109,105,113],
  473. [106,47,106,48],
  474. [106,107,106,111],
  475. [107,48,107,49],
  476. [107,101,107,109],
  477. [108,48,108,51],
  478. [108,101,108,105],
  479. [109,49,109,52],
  480. [109,103,109,104],
  481. [110,51,110,54],
  482. [110,96,110,98],
  483. [110,103,110,104],
  484. [111,52,111,55],
  485. [111,94,111,98],
  486. [111,103,111,104],
  487. [112,54,112,57],
  488. [112,92,112,95],
  489. [112,97,112,98],
  490. [112,103,112,104],
  491. [113,55,113,59],
  492. [113,90,113,93],
  493. [113,97,113,99],
  494. [113,103,113,105],
  495. [114,57,114,61],
  496. [114,87,114,92],
  497. [114,98,114,99],
  498. [114,103,114,105],
  499. [115,59,115,65],
  500. [115,83,115,90],
  501. [115,98,115,99],
  502. [115,104,115,105],
  503. [116,61,116,87],
  504. [116,98,116,99],
  505. [116,104,116,105],
  506. [117,66,117,82],
  507. [117,98,117,100],
  508. [117,104,117,105],
  509. [118,70,118,71],
  510. [118,74,118,75],
  511. [118,99,118,100],
  512. [118,104,118,106],
  513. [119,70,119,71],
  514. [119,74,119,76],
  515. [119,91,119,93],
  516. [119,99,119,100],
  517. [119,105,119,106],
  518. [120,70,120,71],
  519. [120,74,120,76],
  520. [120,88,120,101],
  521. [120,105,120,106],
  522. [121,70,121,71],
  523. [121,74,121,76],
  524. [121,88,121,90],
  525. [121,98,121,101],
  526. [121,105,121,107],
  527. [122,70,122,71],
  528. [122,74,122,76],
  529. [122,89,122,91],
  530. [122,106,122,107],
  531. [123,69,123,71],
  532. [123,74,123,76],
  533. [123,90,123,92],
  534. [123,106,123,107],
  535. [124,69,124,71],
  536. [124,74,124,75],
  537. [124,91,124,94],
  538. [124,106,124,107],
  539. [125,69,125,71],
  540. [125,74,125,75],
  541. [125,92,125,95],
  542. [125,106,125,107],
  543. [126,69,126,70],
  544. [126,75,126,76],
  545. [126,94,126,97],
  546. [126,106,126,108],
  547. [127,69,127,70],
  548. [127,75,127,76],
  549. [127,96,127,99],
  550. [127,107,127,108],
  551. [128,69,128,71],
  552. [128,74,128,76],
  553. [128,98,128,103],
  554. [128,107,128,108],
  555. [129,69,129,71],
  556. [129,74,129,75],
  557. [129,101,129,108],
  558. [130,58,130,63],
  559. [130,70,130,71],
  560. [130,74,130,75],
  561. [131,57,131,59],
  562. [131,63,131,66],
  563. [131,69,131,71],
  564. [131,74,131,75],
  565. [132,58,132,59],
  566. [132,65,132,68],
  567. [132,69,132,71],
  568. [132,74,132,75],
  569. [133,58,133,60],
  570. [133,67,133,71],
  571. [133,74,133,75],
  572. [134,59,134,61],
  573. [134,68,134,70],
  574. [134,74,134,75],
  575. [135,60,135,62],
  576. [135,74,135,75],
  577. [136,61,136,63],
  578. [136,73,136,75],
  579. [137,62,137,65],
  580. [137,73,137,75],
  581. [138,64,138,66],
  582. [138,73,138,74],
  583. [139,65,139,68],
  584. [139,72,139,74],
  585. [140,67,140,74],
  586. [141,70,141,73],
  587. ];
  588.  
  589. var fontSize = 2;
  590. var letterOffset = 0;
  591. var alphabet = new Array(200);
  592. alphabet[58] = [
  593. [0,0,0,1],
  594. [2,0,2,1]
  595. ];
  596. alphabet[40] = [
  597. [0,2,1,0],
  598. [2,2,1,0]
  599. ];
  600. alphabet[41] = [
  601. [0,0,1,2],
  602. [2,0,1,2]
  603. ];
  604. alphabet[63] = [
  605. [1,0,0,0],
  606. [0,0,0,2],
  607. [0,2,1,2],
  608. [1,2,1,1],
  609. [1,1,2,1]
  610. ];
  611. alphabet[97] = [
  612. [2,0,0,0],
  613. [0,0,0,2],
  614. [0,2,2,2],
  615. [1,0,1,2]
  616. ];
  617. alphabet[98] = [
  618. [2,0,0,0],
  619. [0,0,0,2],
  620. [0,2,2,2],
  621. [2,2,2,0],
  622. [1,0,1,2]
  623. ];
  624. alphabet[99] = [
  625. [2,2,2,0],
  626. [2,0,0,0],
  627. [0,0,0,2]
  628. ];
  629. alphabet[100] = [
  630. [2,0,0,0],
  631. [0,0,0,1],
  632. [0,1,1,2],
  633. [1,2,2,1],
  634. [2,1,2,0]
  635. ];
  636. alphabet[101] = [
  637. [2,2,2,0],
  638. [2,0,0,0],
  639. [0,0,0,2],
  640. [1,0,1,2]
  641. ];
  642. alphabet[102] = [
  643. [2,0,0,0],
  644. [0,0,0,2],
  645. [1,0,1,2]
  646. ];
  647. alphabet[103] = [
  648. [1,1,1,2],
  649. [1,2,2,2],
  650. [2,2,2,0],
  651. [2,0,0,0],
  652. [0,0,0,2]
  653. ];
  654. alphabet[104] = [
  655. [0,0,2,0],
  656. [0,2,2,2],
  657. [1,0,1,2]
  658. ];
  659. alphabet[105] = [
  660. [0,0,0,2],
  661. [0,1,2,1],
  662. [2,0,2,2]
  663. ];
  664. alphabet[106] = [
  665. [0,0,0,2],
  666. [0,1,2,1],
  667. [2,0,2,1]
  668. ];
  669. alphabet[107] = [
  670. [0,0,2,0],
  671. [1,0,0,2],
  672. [1,0,2,2]
  673. ];
  674. alphabet[108] = [
  675. [0,0,2,0],
  676. [2,0,2,2]
  677. ];
  678. alphabet[109] = [
  679. [0,0,2,0],
  680. [0,0,2,1],
  681. [2,1,0,2],
  682. [0,2,2,2]
  683. ];
  684. alphabet[110] = [
  685. [0,0,2,0],
  686. [0,0,2,2],
  687. [0,2,2,2]
  688. ];
  689. alphabet[111] = [
  690. [2,0,0,0],
  691. [0,0,0,2],
  692. [0,2,2,2],
  693. [2,2,2,0]
  694. ];
  695. alphabet[112] = [
  696. [2,0,0,0],
  697. [0,0,0,2],
  698. [0,2,1,2],
  699. [1,2,1,0]
  700. ];
  701. alphabet[113] = [
  702. [2,0,0,0],
  703. [0,0,0,2],
  704. [0,2,2,2],
  705. [2,2,2,0],
  706. [1,1,2,2]
  707. ];
  708. alphabet[114] = [
  709. [2,0,0,0],
  710. [0,0,0,2],
  711. [0,2,1,2],
  712. [1,2,1,0],
  713. [1,1,2,2]
  714. ];
  715. alphabet[115] = [
  716. [0,0,0,2],
  717. [1,0,1,2],
  718. [2,0,2,2],
  719. [0,0,1,0],
  720. [1,2,2,2]
  721. ];
  722. alphabet[116] = [
  723. [0,0,0,2],
  724. [0,1,2,1]
  725. ];
  726. alphabet[117] = [
  727. [0,0,2,0],
  728. [0,2,2,2],
  729. [2,0,2,2]
  730. ];
  731. alphabet[118] = [
  732. [0,0,2,1],
  733. [0,2,2,1]
  734. ];
  735. alphabet[119] = [
  736. [0,0,2,0],
  737. [0,2,2,2],
  738. [2,0,1,1],
  739. [2,2,1,1]
  740. ];
  741. alphabet[120] = [
  742. [0,0,2,2],
  743. [2,0,0,2]
  744. ];
  745. alphabet[121] = [
  746. [0,0,1,1],
  747. [0,2,1,1],
  748. [1,1,2,1]
  749. ];
  750. alphabet[122] = [
  751. [0,0,0,2],
  752. [0,2,2,0],
  753. [2,0,2,2]
  754. ];
  755.  
  756.  
  757. function sa(f) {
  758. return f << 1
  759. }
  760.  
  761. function ta(f) {
  762. return f << 1
  763. }
  764.  
  765. function U() {
  766. //return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y
  767. }
  768.  
  769. function ba() {
  770. a.fillStyle = "#000000";
  771. a.font = "35px NovaSquare";
  772. a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300);
  773. a.font = "16px NovaSquare";
  774. a.fillText("Play the game on http://cursors.io/", 400 - a.measureText("Play the game on http://cursors.io/").width /
  775. 2, 330);
  776. top.location = "http://cursors.io";
  777. throw "Please do not embed our website, thank you.";
  778. }
  779.  
  780. function ua(f) {
  781. V(f)
  782. }
  783.  
  784. // Apparently unimportant
  785. function W(f, b) {
  786. J = f;
  787. K = b;
  788. k = v = f;
  789. q = w = b;
  790. B = v << 1;
  791. C = w << 1
  792. }
  793.  
  794. // Handles clicking
  795. function va(f) {
  796. if (D) return L = !1, V(f), !1;
  797. //U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock());
  798. if (L) L = !1, Q();
  799. else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q;
  800. else if (100 < t - ca && v == k && w == q) {
  801. ca = t;
  802. I.push([v << 1, w << 1, t]);
  803. wa(v, w, 10);
  804. var b = [v, w];
  805. N.push(b);
  806. setTimeout(function() {
  807. N.remove(b)
  808. }, 1E3)
  809. }
  810. return !1
  811. }
  812.  
  813. // Apparently unimportant
  814. function xa(f) {
  815. Y = !1
  816. }
  817.  
  818. // Sets local storage for cursor lock and drawing
  819. function ya() {
  820. A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0"))
  821. }
  822.  
  823. // Handles mouse movement and drawing
  824. function V(f) {
  825. if (U()) {
  826. var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0;
  827. f = f.webkitMovementY || f.mozMovementY || f.movementY || 0;
  828. 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1)
  829. } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1;
  830. k = v, q = w; /* Changed to allow movement through walls */
  831. lastX = posX;
  832. lastY = posY;
  833. posX = k;
  834. posY = q;
  835. if (debugMode) console.log(v + ", " + w);
  836. if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1),
  837. w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) {
  838. b = R;
  839. f = S;
  840. var a = k,
  841. d = q;
  842. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  843. var g = new ArrayBuffer(9),
  844. e = new DataView(g);
  845.  
  846. e.setUint8(0, 3);
  847. e.setUint16(1, b, !0);
  848. e.setUint16(3, f, !0);
  849. e.setUint16(5, a, !0);
  850. e.setUint16(7, d, !0);
  851. u.send(g)
  852.  
  853. if (markerEnabled) {
  854. e.setUint8(0, 3);
  855. e.setUint16(1, b+2, !0);
  856. e.setUint16(3, f, !0);
  857. e.setUint16(5, a+2, !0);
  858. e.setUint16(7, d, !0);
  859. u.send(g)
  860. e.setUint8(0, 3);
  861. e.setUint16(1, b, !0);
  862. e.setUint16(3, f+2, !0);
  863. e.setUint16(5, a, !0);
  864. e.setUint16(7, d+2, !0);
  865. u.send(g)
  866. e.setUint8(0, 3);
  867. e.setUint16(1, b-2, !0);
  868. e.setUint16(3, f, !0);
  869. e.setUint16(5, a-2, !0);
  870. e.setUint16(7, d, !0);
  871. u.send(g)
  872. e.setUint8(0, 3);
  873. e.setUint16(1, b, !0);
  874. e.setUint16(3, f-2, !0);
  875. e.setUint16(5, a, !0);
  876. e.setUint16(7, d-2, !0);
  877. u.send(g)
  878. }
  879. }
  880. R = k;
  881. S = q;
  882. da = t
  883. }
  884. }
  885.  
  886. // Apparently not important
  887. function Z() {
  888. ea(k, q) && Q();
  889. if (z(k, q)) {
  890. var a;
  891. a: {
  892. a = k;
  893. var b = q,
  894. c = [],
  895. d = new Uint8Array(12E4);
  896. c.push([a, b]);
  897. d[a + 400 * b] = 1;
  898. do {
  899. var g = c.shift(),
  900. e = g[0],
  901. g = g[1];
  902. if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) {
  903. if (!z(e, g)) {
  904. a = {
  905. x: e,
  906. y: g
  907. };
  908. break a
  909. }
  910. d[e -
  911. 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1);
  912. d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1);
  913. d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1);
  914. d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1)
  915. }
  916. } while (0 < c.length);
  917. a = {
  918. x: a,
  919. y: b
  920. }
  921. }
  922. k = a.x;
  923. q = a.y
  924. }
  925. if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y;
  926. ea(k, q) && Q()
  927. }
  928.  
  929. // Cleans up map on level transition
  930. function $() {
  931. console.log("Next map");
  932. initialLoad = true;
  933. for (var i = 0; i < maxButtons; i++)
  934. buttons[i] = new Array(3);
  935. buttonIndex = 0;
  936. T.set(za);
  937. r = [];
  938. I = [];
  939. O = []
  940. }
  941.  
  942. // Enables image smoothing
  943. function ga(f) {
  944. a.imageSmoothingEnabled = f;
  945. a.mozImageSmoothingEnabled = f;
  946. a.oImageSmoothingEnabled = f;
  947. a.webkitImageSmoothingEnabled = f
  948. }
  949.  
  950. // Prints connected message
  951. function Aa() {
  952. $();
  953. console.log("Connected!")
  954. }
  955.  
  956. // Prints socket closed message
  957. function Ba(a) {
  958. $();
  959. console.log("Socket closed: " + a.reason)
  960. }
  961.  
  962. // Prints socket error message
  963. function Ca(a) {
  964. console.log("Socket error")
  965. }
  966.  
  967. // Gets strings, but without it the map won't load
  968. function Da(a, b) {
  969. 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);
  970. 0 != d && (c += String.fromCharCode(d));
  971. return [c, b + 1]
  972. }
  973.  
  974. // You get a TERRIBLE framerate if you remove the contents of this function
  975. function Ea(a, b) {
  976. setTimeout(function() {
  977. var c = a.getUint16(b, !0),
  978. d = 0;
  979. a: for (; d < c; d++) {
  980. for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) {
  981. var l = N[n];
  982. if (l[0] == g && l[1] == e) {
  983. N.splice(n, 1);
  984. continue a
  985. }
  986. }
  987. I.push([g << 1, e << 1, t])
  988. }
  989. }, 100);
  990. return b +
  991. 2 + 4 * a.getUint16(b, !0)
  992. }
  993.  
  994. // Apparently not important
  995. function Fa(a, b) {
  996. !H.checked && setTimeout(function() {
  997. for (var c = a.getUint16(b, !0), d = 0; d < c; d++) {
  998. var g = a.getUint16(b + 2 + 8 * d, !0),
  999. e = a.getUint16(b + 4 + 8 * d, !0),
  1000. n = a.getUint16(b + 6 + 8 * d, !0),
  1001. l = a.getUint16(b + 8 + 8 * d, !0);
  1002. O.push([g << 1, e << 1, n << 1, l << 1, t])
  1003. }
  1004. }, 50);
  1005. return b + 2 + 8 * a.getUint16(b, !0)
  1006. }
  1007.  
  1008. // Draws the level. Or at least, without it the level doesn't show up.
  1009. function Ga(a) {
  1010. buttonIndex = 0;
  1011. initialLoad = false;
  1012. a = a.data;
  1013. var b = new DataView(a);
  1014. switch (b.getUint8(0)) {
  1015. case 0: // If this doesn't run then you see two of your cursor. One of them lags behind
  1016. ha = b.getUint32(1, !0);
  1017. break;
  1018. case 1: // Without this, doors don't show up
  1019. var c;
  1020. ia = c = b.getUint16(1, !0);
  1021. ja = 100 <= c;
  1022. var d = [],
  1023. g;
  1024. for (g in F) F.hasOwnProperty(g) && d.push(g);
  1025. for (var e =
  1026. 0; e < c; e++) {
  1027. g = b.getUint32(3 + 8 * e, !0);
  1028. var n = b.getUint16(7 + 8 * e, !0),
  1029. l = b.getUint16(9 + 8 * e, !0);
  1030. if (g != ha)
  1031. if (null != F[g]) {
  1032. for (var p = 0; p < d.length; p++)
  1033. if (d[p] == g) {
  1034. d.splice(p, 1);
  1035. break
  1036. }
  1037. g = F[g];
  1038. g.oldX = g.getX();
  1039. g.oldY = g.getY();
  1040. g.newX = n;
  1041. g.newY = l;
  1042. g.time = t
  1043. } else F[g] = new ka(n, l)
  1044. }
  1045. for (e = 0; e < d.length; e++) delete F[d[e]];
  1046. c = Ea(b, 3 + 8 * c);
  1047. g = b.getUint16(c, !0);
  1048. c += 2;
  1049. for (d = 0; d < g; d++) {
  1050. a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++)
  1051. if (r[e].id == n) {
  1052. var k = r[e];
  1053. if (1 == k.type)
  1054. for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m)
  1055. for (var h =
  1056. n; h < n + p; ++h) --T[h + 400 * m];
  1057. r.splice(e, 1);
  1058. break a
  1059. }c += 4
  1060. }
  1061. g = b.getUint16(c, !0);
  1062. c += 2;
  1063. for (d = 0; d < g; d++) {
  1064. a: {
  1065. e = b.getUint32(c, !0);
  1066. for (n = 0; n < r.length; n++)
  1067. if (r[n].id == e) {
  1068. e = r[n];
  1069. break a
  1070. }
  1071. e = {
  1072. id: e
  1073. };
  1074. r.push(e)
  1075. }
  1076. c += 4;c = la(b, c, e)
  1077. }
  1078. c = Fa(b, c);
  1079. if (a.byteLength < c + 4) break;
  1080. aa = b.getUint32(c, !0);
  1081. break;
  1082. case 4: // Without this the level don't show
  1083. $();
  1084. W(b.getUint16(1, !0), b.getUint16(3, !0));
  1085. g = b.getUint16(5, !0);
  1086. c = 7;
  1087. for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e);
  1088. a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0)));
  1089. Z();
  1090. break;
  1091. case 5: // Without this things don't trigger unless you are drawing. Also, you can't click buttons.
  1092. 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()
  1093. }
  1094. }
  1095.  
  1096. // Without this, your position only updates if you click or draw
  1097. function Q() {
  1098. lastFrame = currentFrame;
  1099. currentFrame = new Date().getTime();
  1100.  
  1101. if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) {
  1102. var a = new ArrayBuffer(9);
  1103. b = new DataView(a);
  1104. b.setUint8(0, 1);
  1105. b.setUint16(1, k, !0);
  1106. b.setUint16(3, q, !0);
  1107. b.setUint32(5, G, !0);
  1108. u.send(a);
  1109. J = k;
  1110. K = q
  1111. }
  1112.  
  1113. if (auraEnabled) // Drawing cursor aura
  1114. drawAura(J, K);
  1115. }
  1116.  
  1117. // Without this clicking doesn't actually get transmitted to the server
  1118. function wa(a, b, numClicks) {
  1119. if (!D && null != u && u.readyState == WebSocket.OPEN) {
  1120. var c = new ArrayBuffer(9),
  1121. d = new DataView(c);
  1122. d.setUint8(0, 2);
  1123. d.setUint16(1, a, !0);
  1124. d.setUint16(3, b, !0);
  1125. d.setUint32(5, G, !0);
  1126. for (var i = 0; i < numClicks; i++) { u.send(c) } // Changed to click multiple times
  1127. }
  1128. }
  1129.  
  1130. function la(f, b, c) {
  1131. function d() { // Handles drawing stuff
  1132. if (c.type == 4 && initialLoad) {
  1133. c.x = f.getUint16(b, !0);
  1134. buttons[buttonIndex][0] = c.x
  1135. b += 2;
  1136. c.y = f.getUint16(b, !0);
  1137. buttons[buttonIndex][1] = c.y
  1138. b += 2;
  1139. c.width = f.getUint16(b, !0);
  1140. b += 2;
  1141. c.height = f.getUint16(b, !0);
  1142. b += 2
  1143.  
  1144. buttonIndex++;
  1145. } else {
  1146. c.x = f.getUint16(b, !0);
  1147. b += 2;
  1148. c.y = f.getUint16(b, !0);
  1149. b += 2;
  1150. c.width = f.getUint16(b, !0);
  1151. b += 2;
  1152. c.height = f.getUint16(b, !0);
  1153. b += 2
  1154. }
  1155. }
  1156. function g() { // Handles coloring stuff
  1157. for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a;
  1158. b += 4;
  1159. c.color = "#" + a
  1160. }
  1161. var e = f.getUint8(b);
  1162. b += 1;
  1163. c.type = e;
  1164. switch (e) {
  1165. case 255:
  1166. break;
  1167. case 0: // Draws text
  1168. c.x = f.getUint16(b, !0);
  1169. b += 2;
  1170. c.y = f.getUint16(b, !0);
  1171. b += 2;
  1172. c.size = f.getUint8(b);
  1173. b += 1;
  1174. c.isCentered = !!f.getUint8(b);
  1175. b += 1;
  1176. e = Da(f, b);
  1177. c.text = e[0];
  1178. b = e[1];
  1179. break;
  1180. case 1: // May relate to cursor movement?
  1181. d();
  1182. var n = !c.color;
  1183. g();
  1184. var e = c.x | 0,
  1185. l = c.y | 0,
  1186. p = c.width | 0,
  1187. k = c.height | 0;
  1188. if (n)
  1189. for (n = l; n < l + k; ++n)
  1190. for (var m = e; m < e + p; ++m) ++T[m + 400 * n];
  1191. break;
  1192. case 2: // Draws exit points
  1193. d();
  1194. c.isBad = !!f.getUint8(b);
  1195. b += 1;
  1196. break;
  1197. case 3: // Handles the area triggers
  1198. d();
  1199. c.count = f.getUint16(b, !0);
  1200. b += 2;
  1201. g();
  1202. break;
  1203. case 4: // Something about buttons, but also affects doors and area triggers
  1204. d();
  1205. c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0;
  1206. c.count = f.getUint16(b, !0);
  1207. if (initialLoad) buttons[buttonIndex-1][2] = 1;
  1208. b += 2;
  1209. g();
  1210. break;
  1211. case 5:
  1212. c.x = f.getUint16(b, !0);
  1213. b += 2;
  1214. c.y = f.getUint16(b, !0);
  1215. b += 2;
  1216. c.queue = [
  1217. [0, c.x, c.y]
  1218. ];
  1219. c.potentialQueue = [];
  1220. c.explored = new Uint8Array(12E4);
  1221. c.img = a.createImageData(400, 300);
  1222. e = E.createElement("canvas");
  1223. e.width = 400;
  1224. e.height = 300;
  1225. c.canvas = e;
  1226. c.ctx = c.canvas.getContext("2d");
  1227. break;
  1228. default:
  1229. throw Error("Unknown object type " + e);
  1230. }
  1231. return b
  1232. }
  1233.  
  1234. function ea(a, b) {
  1235. if (-1 != J && -1 != K) {
  1236. var c = fa(J, K, a, b);
  1237. if (c.x != a || c.y != b) return !0
  1238. }
  1239. for (c = 0; c < r.length; c++) {
  1240. var d = r[c];
  1241. if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0
  1242. }
  1243. return !1
  1244. }
  1245.  
  1246. function ma() {
  1247. a.clearRect(0, 0, 800, 600);
  1248. a.save();
  1249. if (null != u && u.readyState != WebSocket.OPEN || L) {
  1250. var f;
  1251. if (null == u) f = "Click to begin";
  1252. else switch (u.readyState) {
  1253. case WebSocket.CONNECTING:
  1254. f = "Connecting";
  1255. break;
  1256. case WebSocket.CLOSING:
  1257. case WebSocket.CLOSED:
  1258. f = "Lost connection to server";
  1259. break;
  1260. default:
  1261. f = "Click to begin"
  1262. }
  1263. a.font = "60px NovaSquare";
  1264. a.fillText(f, 400 - a.measureText(f).width / 2, 315);
  1265. na();
  1266. oa(!1)
  1267. } else {
  1268. a.fillStyle = "#000000";
  1269. a.save();
  1270. a.globalAlpha = 1;
  1271. Ha();
  1272. for (f = 0; f < r.length; f++) {
  1273. var b = r[f];
  1274. if (0 == b.type) {
  1275. a.font = b.size + "px NovaSquare";
  1276. var c = b.x << 1,
  1277. d = b.y << 1;
  1278. b.isCentered && (c -= a.measureText(b.text).width / 2);
  1279. a.fillStyle = "#000000";
  1280. a.fillText(b.text,
  1281. c, d)
  1282. } 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;
  1283. 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;
  1284. else if (3 == b.type) {
  1285. var c = b.x << 1,
  1286. d = b.y << 1,
  1287. g = b.width << 1,
  1288. e = b.height << 1;
  1289. a.fillStyle = b.color;
  1290. a.globalAlpha = .2;
  1291. a.fillRect(c, d, g, e);
  1292. a.globalAlpha =
  1293. .5;
  1294. a.fillStyle = "#000000";
  1295. 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));
  1296. a.globalAlpha = 1
  1297. } else if (4 == b.type) {
  1298. c = b.x << 1;
  1299. d = b.y << 1;
  1300. g = b.width << 1;
  1301. e = b.height << 1;
  1302. a.fillStyle = b.color;
  1303. a.strokeStyle = b.color;
  1304. a.globalAlpha = 1;
  1305. a.fillRect(c, d, g, e);
  1306. a.globalAlpha = .2;
  1307. a.fillStyle = "#000000";
  1308. a.fillRect(c, d, g, e);
  1309. a.globalAlpha = 1;
  1310. a.fillStyle = b.color;
  1311. var n = 150 > t - b.lastClickAt,
  1312. l = n ? 8 : 12;
  1313. a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l);
  1314. a.strokeStyle = "#000000";
  1315. a.globalAlpha = .1;
  1316. a.beginPath();
  1317. a.moveTo(c, d);
  1318. a.lineTo(c + l, d + l);
  1319. a.moveTo(c + g, d);
  1320. a.lineTo(c + g - l, d + l);
  1321. a.moveTo(c, d + e);
  1322. a.lineTo(c + l, d + e - l);
  1323. a.moveTo(c + g, d + e);
  1324. a.lineTo(c + g - l, d + e - l);
  1325. a.moveTo(c, d);
  1326. a.rect(c, d, g, e);
  1327. a.rect(c + l, d + l, g - 2 * l, e - 2 * l);
  1328. a.stroke();
  1329. a.fillStyle = "#000000";
  1330. a.globalAlpha = .5;
  1331. 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,
  1332. c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16));
  1333. n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l));
  1334. a.globalAlpha = 1
  1335. } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600), ga(!0))
  1336. }
  1337. a.restore();
  1338. 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,
  1339. 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)));
  1340. na();
  1341. if (!H.checked) {
  1342. a.save();
  1343. a.strokeStyle = "#000000";
  1344. a.lineWidth = 1;
  1345. t = +new Date;
  1346. 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());
  1347. a.restore()
  1348. }
  1349. a.save();
  1350. for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) -
  1351. 6);
  1352. a.restore();
  1353. oa(!0)
  1354. }
  1355. a.restore();
  1356. A.requestAnimationFrame(ma)
  1357. }
  1358.  
  1359. function na() { // draws circles when you click
  1360. a.save();
  1361. a.strokeStyle = "#000000";
  1362. t = +new Date;
  1363. for (var f = 0; f < I.length; f++) {
  1364. var b = I[f],
  1365. c = (t - b[2]) / 1E3,
  1366. d = 1 - 2 * c;
  1367. 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())
  1368. }
  1369. a.restore()
  1370. }
  1371.  
  1372. function oa(f) {
  1373. if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5);
  1374. else {
  1375. var b = 0,
  1376. c = 0;
  1377. 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),
  1378. a.fill()), a.globalAlpha = .5, a.drawImage(P, B - 5, C - 5), a.restore()) : (b = B & 1, c = C & 1);
  1379. a.save();
  1380. 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());
  1381. a.globalAlpha = 1;
  1382. a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5)
  1383. }
  1384. a.restore()
  1385. }
  1386.  
  1387. function ka(a, b) {
  1388. this.oldX = this.newX = a;
  1389. this.oldY = this.newY = b;
  1390. this.time = t
  1391. }
  1392.  
  1393. function pa(a) {
  1394. return a * a * (3 - 2 * a)
  1395. }
  1396.  
  1397. function fa(a, b, c, d) {
  1398. a |= 0;
  1399. b |= 0;
  1400. c |= 0;
  1401. d |= 0;
  1402. if (z(a, b)) return {
  1403. x: a,
  1404. y: b
  1405. };
  1406. if (a == c && b == d) return {
  1407. x: c,
  1408. y: d
  1409. };
  1410. var g = a,
  1411. e = b;
  1412. c = c - a | 0;
  1413. d = d - b | 0;
  1414. var n =
  1415. 0,
  1416. l = 0,
  1417. p = 0,
  1418. k = 0;
  1419. 0 > c ? n = -1 : 0 < c && (n = 1);
  1420. 0 > d ? l = -1 : 0 < d && (l = 1);
  1421. 0 > c ? p = -1 : 0 < c && (p = 1);
  1422. var m = Math.abs(c) | 0,
  1423. h = Math.abs(d) | 0;
  1424. m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0);
  1425. c = m >> 1;
  1426. 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);
  1427. return {
  1428. x: g,
  1429. y: e
  1430. }
  1431. }
  1432.  
  1433. function z(a, b) {
  1434. return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b]
  1435. }
  1436.  
  1437. function Ja() {
  1438. for (var a = 0; a < r.length; a++) {
  1439. var b = r[a];
  1440. 5 == b.type && Ka(b)
  1441. }
  1442. }
  1443.  
  1444. function Ka(a) {
  1445. function b(a, b, c) {
  1446. e.push([c, a, b]);
  1447. l[a + 400 * b] = !0;
  1448. g(a, b)
  1449. }
  1450.  
  1451. function c(a, b, c) {
  1452. p.push([c,
  1453. a, b
  1454. ]);
  1455. l[a + 400 * b] = !0
  1456. }
  1457.  
  1458. function d(a, b) {
  1459. return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b]
  1460. }
  1461.  
  1462. function g(a, b) {
  1463. var c = 4 * (a + 400 * b);
  1464. k[c + 0] = 255;
  1465. k[c + 1] = 153;
  1466. k[c + 2] = 153;
  1467. k[c + 3] = 255
  1468. }
  1469. 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);
  1470. for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r);
  1471. for (r = 0; 50 > r && 0 != e.length; ++r) {
  1472. for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) {
  1473. var x = e[m][0];
  1474. .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]])
  1475. }
  1476. for (m = 0; m < q.length; ++m) {
  1477. var x = q[m][0],
  1478. h = q[m][1],
  1479. s = q[m][2],
  1480. qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1);
  1481. 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1));
  1482. 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1));
  1483. 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1));
  1484. 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1));
  1485. 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));
  1486. 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) :
  1487. b(h - 1, s + 1, x + Math.SQRT2));
  1488. 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));
  1489. 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))
  1490. }
  1491. }
  1492. a.ctx.putImageData(a.img, 0, 0)
  1493. }
  1494. var y, a, ia = 0,
  1495. v = 0,
  1496. w = 0,
  1497. B = 0,
  1498. C = 0,
  1499. k = 0,
  1500. q = 0,
  1501. J = -1,
  1502. K = -1,
  1503. M = null,
  1504. H = null,
  1505. P = new Image;
  1506. P.src = "img/cursor.png";
  1507. var Ia = P,
  1508. D = -1 != A.location.search.indexOf("editor"),
  1509. I = [],
  1510. O = [],
  1511. t = 0,
  1512. ca = 0,
  1513. u = null,
  1514. ha = -1,
  1515. F = {},
  1516. aa = 0,
  1517. ja = !1,
  1518. Y = !1,
  1519. R = 0,
  1520. S = 0,
  1521. da = 0,
  1522. X = !1,
  1523. L = !D && !0,
  1524. T = new Uint8Array(12E4),
  1525. r = [],
  1526. N = [];
  1527. Array.prototype.remove =
  1528. function(a) {
  1529. a = this.indexOf(a);
  1530. return -1 != a ? (this.splice(a, 1), !0) : !1
  1531. };
  1532. var G = 0;
  1533. ka.prototype = {
  1534. oldX: 0,
  1535. oldY: 0,
  1536. newX: 0,
  1537. newY: 0,
  1538. time: 0,
  1539. getX: function() {
  1540. var a = this.newX - this.oldX,
  1541. b = (t - this.time) / 100,
  1542. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1543. return this.oldX + b * a
  1544. },
  1545. getY: function() {
  1546. var a = this.newY - this.oldY,
  1547. b = (t - this.time) / 100,
  1548. b = pa(0 >= b ? 0 : 1 <= b ? 1 : b);
  1549. return this.oldY + b * a
  1550. }
  1551. };
  1552. var ra = function() {
  1553. function f() {
  1554. var a = 0,
  1555. b = 0,
  1556. c = v / 10,
  1557. d = w / 10;
  1558. n < c ? (c = Math.ceil(c), a = Math.floor(n)) : (c = Math.floor(c), a = Math.ceil(n));
  1559. l < d ? (d = Math.ceil(d), b = Math.floor(l)) :
  1560. (d = Math.floor(d), b = Math.ceil(l));
  1561. if (a > c) var e = c,
  1562. c = a,
  1563. a = e;
  1564. b > d && (e = d, d = b, b = e);
  1565. return {
  1566. sx: a,
  1567. sy: b,
  1568. fx: c,
  1569. fy: d
  1570. }
  1571. }
  1572.  
  1573. function b() {
  1574. e = !0;
  1575. n = v / 10;
  1576. l = w / 10
  1577. }
  1578.  
  1579. function c(a) {
  1580. return "0x" + parseInt(a.slice(1), 16).toString(16).toUpperCase()
  1581. }
  1582.  
  1583. function d(a, b, c, d, e) {
  1584. a = {
  1585. x: 10 * ~~(k / 10) - ~~(a / 2) + c,
  1586. y: 10 * ~~(q / 10) - ~~(b / 2) + d,
  1587. width: a,
  1588. height: b
  1589. };
  1590. for (var f in e) e.hasOwnProperty(f) && (a[f] = e[f]);
  1591. return a
  1592. }
  1593.  
  1594. function g(a, b) {
  1595. for (var c = null, d = Number.POSITIVE_INFINITY, e = 0; e < r.length; e++) {
  1596. var f = r[e];
  1597. if (f.hasOwnProperty("x") && f.hasOwnProperty("y") && f.hasOwnProperty("width") &&
  1598. f.hasOwnProperty("height")) {
  1599. var g = f.x + f.width / 2,
  1600. h = f.y + f.height / 2,
  1601. g = (a - g) * (a - g) + (b - h) * (b - h);
  1602. g < d && (d = g, c = f)
  1603. }
  1604. }
  1605. return c
  1606. }
  1607. var e = !1,
  1608. n = 0,
  1609. l = 0,
  1610. p = 1,
  1611. u = 200,
  1612. m = 150,
  1613. h = new Uint8Array(1200),
  1614. t = "#000000 #FF9999 #9999FF #FFFF99 #99FFFF #FF99FF #3333FF".split(" ");
  1615. E.addEventListener("mouseup", function() {
  1616. if (e) {
  1617. for (var a = f(), b = p, c = a.sy; c < a.fy; ++c)
  1618. for (var d = a.sx; d < a.fx; ++d) h[d + 40 * c] = b;
  1619. e = !1
  1620. }
  1621. });
  1622. E.addEventListener("mousemove", function() {});
  1623. A.generateCode = function() {
  1624. for (var a = "class Level? : public Level {\npublic:\n\tLevel?() : Level(" +
  1625. 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)
  1626. for (var f = 0; 40 > f; ++f)
  1627. if (!b[f + 40 * e]) {
  1628. var g = h[f + 40 * e];
  1629. if (0 != g) {
  1630. for (var k = f; 40 > f && h[f + 40 * e] == g && !b[f + 40 * e];) b[f + 40 * e] = !0, ++f;
  1631. var l = f--,
  1632. p = l - k,
  1633. q = e++;
  1634. a: for (; 30 > e;) {
  1635. for (var n = k; n < l; ++n) {
  1636. if (h[n + 40 * e] != g) break a;
  1637. if (b[n + 40 * e]) break a
  1638. }
  1639. for (n = k; n < l; ++n) b[n + 40 * e] = !0;
  1640. ++e
  1641. }
  1642. l = e - q;
  1643. e = q;
  1644. d.push({
  1645. x: 10 * k,
  1646. y: 10 * q,
  1647. width: 10 * p,
  1648. height: 10 * l,
  1649. color: g - 1
  1650. })
  1651. }
  1652. }
  1653. for (b = 0; b < d.length; b++) e = d[b], 0 ==
  1654. 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");
  1655. 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 +
  1656. ", " + 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"));
  1657. return a += "\t}\n};\n"
  1658. };
  1659. E.addEventListener("keydown", function(a) {
  1660. if (a.keyCode == 8) {
  1661. a.preventDefault();
  1662. if (message.length > 0) {
  1663. message = message.substring(0, message.length - 1);
  1664. messageDisplay.innerHTML = message;
  1665. }
  1666. }
  1667. else if (a.keyCode == 9) {
  1668. a.preventDefault();
  1669. }
  1670. if (D) {
  1671. var b = a.keyCode;
  1672. 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, {
  1673. type: 4,
  1674. color: t[p - 1],
  1675. colorCode: p - 1,
  1676. count: 5
  1677. })) : 90 == b ? r.pop() : 87 == b ? r.push(d(50, 50, -5, -5, {
  1678. type: 2,
  1679. isBad: !1
  1680. })) : 79 == b ? (u = k, m = q) : 78 == b ? 1 >= p || r.push(d(40, 40, 0, 0, {
  1681. type: 3,
  1682. color: t[p - 1],
  1683. colorCode: p - 1,
  1684. count: 1
  1685. })) : 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 +=
  1686. 10, 0 == b.height && r.splice(r.indexOf(b), 1)))
  1687. }
  1688. });
  1689. return {
  1690. renderEditor: function() {
  1691. if (D) {
  1692. a.save();
  1693. a.fillStyle = "#FF0000";
  1694. a.strokeStyle = "#FF0000";
  1695. a.lineWidth = 1;
  1696. a.globalAlpha = .09;
  1697. a.beginPath();
  1698. for (var b = 0; 400 > b; b += 10) a.moveTo((b << 1) + .5, 0), a.lineTo((b << 1) + .5, 600);
  1699. for (var c = 0; 300 > c; c += 10) a.moveTo(0, (c << 1) + .5), a.lineTo(800, (c << 1) + .5);
  1700. a.stroke();
  1701. a.lineWidth = 2;
  1702. a.beginPath();
  1703. a.moveTo(400.5, 0);
  1704. a.lineTo(400.5, 600);
  1705. a.moveTo(0, 300.5, 0);
  1706. a.lineTo(800, 300.5);
  1707. a.stroke();
  1708. a.lineWidth = 1;
  1709. a.globalAlpha = 1;
  1710. a.fillStyle = "#000000";
  1711. for (var d = f(), c = 0; 300 > c; c += 10)
  1712. for (b = 0; 400 > b; b += 10) {
  1713. var g = b / 10 | 0,
  1714. k = c / 10 | 0,
  1715. l = h[g + 40 * k];
  1716. e && g >= d.sx && g < d.fx && k >= d.sy && k < d.fy && (l = p);
  1717. 0 != l && (a.fillStyle = t[l - 1], a.fillRect(b << 1, c << 1, 20, 20))
  1718. }
  1719. a.save();
  1720. a.globalAlpha = .09;
  1721. a.fillStyle = "#0000FF";
  1722. a.beginPath();
  1723. a.arc(u << 1, m << 1, 20, 0, 2 * Math.PI, !1);
  1724. a.fill();
  1725. a.restore();
  1726. a.save();
  1727. a.fillStyle = "#FFFFFF";
  1728. a.strokeStyle = "#000000";
  1729. a.lineWidth = 2.5;
  1730. a.font = "14px NovaSquare";
  1731. a.globalAlpha = .5;
  1732. a.strokeText("Current color: ", 10, 590);
  1733. a.globalAlpha = 1;
  1734. a.fillText("Current color: ", 10,
  1735. 590);
  1736. 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));
  1737. a.restore();
  1738. a.restore()
  1739. }
  1740. },
  1741. initEditor: function() {
  1742. y.addEventListener("mousedown", b)
  1743. }
  1744. }
  1745. }(),
  1746. Ha = ra.renderEditor,
  1747. La = ra.initEditor,
  1748. za = new Uint8Array(12E4);
  1749. Array.prototype.remove = function(a) {
  1750. a = this.indexOf(a);
  1751. return -1 != a ? (this.splice(a, 1), !0) : !1
  1752. };
  1753.  
  1754. function handleKeyboard(e) {
  1755. if ((e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63 || e.keyCode == 58 || e.keyCode == 40 || e.keyCode == 41) {
  1756. message = message.concat(String.fromCharCode(e.keyCode));
  1757. messageDisplay.innerHTML = message;
  1758. return;
  1759. }
  1760. switch(e.keyCode) {
  1761. case 13:
  1762. drawWord(message, posX, posY);
  1763. message = "";
  1764. messageDisplay.innerHTML = message;
  1765. e.preventDefault();
  1766. break;
  1767. case 96: // Click all buttons
  1768. clickAllButtons();
  1769. break;
  1770. case 47:
  1771. movementEnabled = !movementEnabled
  1772. break;
  1773. case 45: // Toggle Aura
  1774. auraEnabled = !auraEnabled;
  1775. break;
  1776. case 43:
  1777. drawImage(posX, posY);
  1778. break;
  1779. case 42:
  1780. markerEnabled = !markerEnabled;
  1781. break;
  1782. default:
  1783. return;
  1784. }
  1785. }
  1786.  
  1787. function clickAllButtons() {
  1788. for (var i = 0; i < maxButtons; i++) {
  1789. if (buttons[i][0] == null) break;
  1790. wa(buttons[i][0], buttons[i][1], buttons[i][2]);
  1791. }
  1792. }
  1793.  
  1794. function drawAura(x, y) {
  1795. var dt = 360/(1000/40)/2;
  1796. if (u != null && u.readyState == WebSocket.OPEN) {
  1797. var g = new ArrayBuffer(9),
  1798. e = new DataView(g);
  1799. e.setUint8(0, 3);
  1800. e.setUint16(1, x+Math.sin(degToRad(auraTime+dt))*auraRadius, !0);
  1801. e.setUint16(3, y+Math.cos(degToRad(auraTime+dt))*auraRadius, !0);
  1802. e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0);
  1803. e.setUint16(7, y+Math.cos(degToRad(auraTime))*auraRadius, !0);
  1804. u.send(g)
  1805. }
  1806.  
  1807. auraTime += dt;
  1808. }
  1809.  
  1810. function degToRad(deg) {
  1811. return deg * (Math.PI / 180);
  1812. }
  1813.  
  1814. function radToDeg(rad) {
  1815. return rad * (180 / Math.PI);
  1816. }
  1817.  
  1818. var drawIndex = 0;
  1819. function drawImage(x, y) {
  1820. setTimeout(function () {
  1821. var g = new ArrayBuffer(9),
  1822. e = new DataView(g);
  1823.  
  1824. e.setUint8(0, 3);
  1825. e.setUint16(1, x+imgData[drawIndex][1]*imageScale, !0);
  1826. e.setUint16(3, y+imgData[drawIndex][0]*imageScale, !0);
  1827. e.setUint16(5, x+imgData[drawIndex][3]*imageScale, !0);
  1828. e.setUint16(7, y+imgData[drawIndex][2]*imageScale, !0);
  1829. u.send(g);
  1830.  
  1831. drawIndex++;
  1832. if (drawIndex < imgData.length)
  1833. drawImage(x, y);
  1834. else
  1835. drawIndex = 0;
  1836. }, 15)
  1837. }
  1838.  
  1839. function drawLetter(a, x, y) {
  1840. var letter = alphabet[a];
  1841.  
  1842. if (letter == null)
  1843. return;
  1844.  
  1845. var g = new ArrayBuffer(9),
  1846. e = new DataView(g);
  1847.  
  1848. for (var i = 0; i < letter.length; i++) {
  1849. e.setUint8(0, 3);
  1850. e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  1851. e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  1852. e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  1853. e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  1854. for (var j = 0; j < 4; j++) { u.send(g); }
  1855. }
  1856. }
  1857.  
  1858. var messageDisplay;
  1859. var message = new String();
  1860. var wordIndex = 0;
  1861. function drawWord(s, x, y) {
  1862. setTimeout(function () {
  1863. drawLetter(s.charCodeAt(0), x, y);
  1864. wordIndex++;
  1865. if (s.length > 0)
  1866. drawWord(s.substring(1, s.length), x+fontSize*3, y);
  1867. else {
  1868. wordIndex = 0;
  1869. letterOffset = 0;
  1870. }
  1871. }, 20);
  1872. }
  1873.  
  1874. function doit() {
  1875. document.body.innerHTML += '<div id="messageDisplay"></div>';
  1876. messageDisplay = document.getElementById("messageDisplay");
  1877.  
  1878. y = E.getElementById("canvas");
  1879. a = y.getContext("2d");
  1880. try {
  1881. A.top.location.origin != A.location.origin && ba()
  1882. } catch (f) {
  1883. ba()
  1884. }
  1885. y.onmousemove = ua;
  1886. y.onmousedown = va;
  1887. y.onmouseup = xa;
  1888. M = E.getElementById("noCursorLock");
  1889. H = E.getElementById("noDrawings");
  1890. null != localStorage && (M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1);
  1891. A.onbeforeunload = ya;
  1892. y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock;
  1893. y.style.cursor = "none";
  1894. La();
  1895. D || null == u && (u = new WebSocket("ws://s1.cursors.io:443/"), u.binaryType = "arraybuffer", u.onopen = Aa, u.onmessage = Ga, u.onclose =
  1896. Ba, u.onerror = Ca);
  1897. setInterval(Q, 50);
  1898. setInterval(Ja, 40);
  1899. A.requestAnimationFrame(ma)
  1900.  
  1901. document.onkeypress = handleKeyboard;
  1902. }
  1903.  
  1904. doit();
Advertisement
RAW Paste Data Copied
Advertisement