You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

146 lines
2.2 KiB

  1. define([
  2. ], function (
  3. ) {
  4. return {
  5. sheetHeight: 20,
  6. tiles: {
  7. default: 0.4,
  8. max: 0.55,
  9. 5: 0.7,
  10. 6: 0.9,
  11. 23: 0.9,
  12. 24: 0.9,
  13. 25: 0.9,
  14. 50: 1,
  15. 51: 1,
  16. 52: 1,
  17. 53: 0.7,
  18. 54: 0.5,
  19. 57: 1,
  20. 58: 1,
  21. 59: 1,
  22. 60: 0.9,
  23. 61: 0.9,
  24. 62: 0.75,
  25. 76: 0.9,
  26. 80: 1,
  27. 81: 1,
  28. 82: 1,
  29. 83: 1,
  30. 87: 1,
  31. 90: 1,
  32. 95: 1,
  33. 102: 0.9,
  34. 152: 0.9,
  35. 153: 1,
  36. 163: 0.9,
  37. //snow
  38. 176: 0.55,
  39. 184: 0.55,
  40. 185: 0.55
  41. },
  42. objects: {
  43. default: 0.9,
  44. 50: 1
  45. },
  46. walls: {
  47. default: 0.85,
  48. max: 1,
  49. 84: 1,
  50. 103: 0.9,
  51. 107: 0.9,
  52. 116: 1,
  53. 120: 0.9,
  54. 132: 0.9,
  55. 133: 0.9,
  56. 134: 0.85,
  57. 139: 1,
  58. 148: 1,
  59. 150: 0.85,
  60. 156: 1,
  61. 157: 1,
  62. 158: 1,
  63. 159: 1,
  64. 160: 0.9,
  65. 161: 1,
  66. 162: 1,
  67. 163: 1,
  68. 164: 0.8,
  69. 165: 1,
  70. 166: 0.95,
  71. 167: 1,
  72. 168: 1,
  73. 169: 1
  74. },
  75. tilesNoFlip: [
  76. 171, 179 //Stairs
  77. ],
  78. wallsNoFlip: [
  79. 156, 158, 162, 163, 167, 168, //Ledges
  80. 189, //Wall Sign
  81. 195, 196, 197, 198, 199, 200, 201, 202, 203, //Stone Ledges
  82. 204, 205, 206, 207, 214, 215, 220, 221, 222, 223 //Ship Edges
  83. ],
  84. objectsNoFlip: [
  85. 96, 101, //Clotheslines
  86. 103, 110, 118, 126, //Table Sides
  87. 120, 122, 140, //Wall-mounted plants
  88. 140, 143, //Ship oars
  89. 141, 142 //Ship Cannons
  90. ],
  91. getSheetNum: function (tile) {
  92. if (tile < 192)
  93. return 0;
  94. else if (tile < 448)
  95. return 1;
  96. return 2;
  97. },
  98. map: function (tile) {
  99. let sheetNum;
  100. if (tile < 192)
  101. sheetNum = 0;
  102. else if (tile < 448) {
  103. tile -= 192;
  104. sheetNum = 1;
  105. } else {
  106. tile -= 448;
  107. sheetNum = 2;
  108. }
  109. let tilesheet = [this.tiles, this.walls, this.objects][sheetNum];
  110. let alpha = (tilesheet[tile] || tilesheet.default);
  111. if (tilesheet.max != null) {
  112. alpha = alpha + (Math.random() * (alpha * 0.2));
  113. alpha = Math.min(1, alpha);
  114. }
  115. return alpha;
  116. },
  117. canFlip: function (tile) {
  118. let sheetNum;
  119. if (tile < 192)
  120. sheetNum = 0;
  121. else if (tile < 448) {
  122. tile -= 192;
  123. sheetNum = 1;
  124. } else {
  125. tile -= 448;
  126. sheetNum = 2;
  127. }
  128. let tilesheet = [this.tilesNoFlip, this.wallsNoFlip, this.objectsNoFlip][sheetNum];
  129. return (tilesheet.indexOf(tile) == -1);
  130. }
  131. };
  132. });