diff --git a/bin/the-field-1.0.2.js b/bin/the-field-1.0.4.js similarity index 99% rename from bin/the-field-1.0.2.js rename to bin/the-field-1.0.4.js index 67b8739..f0c0aa6 100644 --- a/bin/the-field-1.0.2.js +++ b/bin/the-field-1.0.4.js @@ -748,4 +748,4 @@ exports.MaskRect = geom_1.MaskRect; /***/ }) /******/ }); -//# sourceMappingURL=the-field-1.0.2.js.map \ No newline at end of file +//# sourceMappingURL=the-field-1.0.4.js.map \ No newline at end of file diff --git a/bin/the-field-1.0.2.js.map b/bin/the-field-1.0.4.js.map similarity index 99% rename from bin/the-field-1.0.2.js.map rename to bin/the-field-1.0.4.js.map index ec84737..e6085ad 100644 --- a/bin/the-field-1.0.2.js.map +++ b/bin/the-field-1.0.4.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://TheField/webpack/bootstrap","webpack://TheField/./src/field-of-view.ts","webpack://TheField/./src/geom/index.ts","webpack://TheField/./src/geom/mask-rect.ts","webpack://TheField/./src/geom/mask.ts","webpack://TheField/./src/geom/offset.ts","webpack://TheField/./src/geom/rectangle.ts","webpack://TheField/./src/geom/size.ts","webpack://TheField/./src/index.ts"],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QA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ACL,WAAC;AAAD,CAAC;AAhEY,oBAAI;;;;;;;;;;;;;;ACPjB;;;;;GAKG;;AAEH,2FAA+C;AAAvC,uDAAc;AACtB,sEAAgC;AAAxB,kCAAQ","file":"the-field-1.0.2.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/bin/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import * as geom from './geom';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\n/**\r\n * In the shadowcasting algorithm, each shadow is represented by a \"wedge\",\r\n * running from a \"low\" angle to a \"high\" angle. The wedges are all stored in\r\n * a simple number array, with two numbers for each wedge. These constants\r\n * (WEDGE_LOW and WEDGE_HIGH) help to identify which number is which.\r\n * WEDGE_COUNT is just how many numbers per wedge.\r\n */\r\nconst WEDGE_LOW = 0;\r\nconst WEDGE_HIGH = 1;\r\nconst WEDGE_COUNT = 2;\r\n\r\n/**\r\n * Bodies in this algorithm do not entirely fill their tiles. This is\r\n * implemented by adjusting the angles of the shadows the bodies cast,\r\n * making the wedge very slightly narrower. BODY_EPSILON represents the\r\n * amount of reduction on either side of the wedge.\r\n */\r\nconst BODY_EPSILON = 0.00001;\r\n\r\n/**\r\n * We avoid heap allocations during the core part of the algorithm by using this\r\n * preallocated offset object.\r\n */\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\n/**\r\n * For each number in the _tileFlags array, we store (1 << FLAGS_POW2) cells,\r\n * as bits where a true indicates the presence of a body.\r\n */\r\nconst FLAGS_POW2 = 5;\r\n\r\n/**\r\n * The FieldOFViewMap represents the map over which the field of view will be\r\n * computed. It starts out empty. You can add walls and bodies to it, and then\r\n * use getFieldOfView() to compute the field of view from a given point.\r\n */\r\nexport class FieldOfViewMap {\r\n private readonly _size = new geom.Size();\r\n private readonly _tileFlags: number[];\r\n\r\n constructor(width: number, height: number) {\r\n this._size.set(width, height);\r\n this._tileFlags = new Array((this._size.area >> FLAGS_POW2) + 1).fill(0);\r\n }\r\n\r\n // setup and maintenance\r\n\r\n addBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n this._tileFlags[index >> FLAGS_POW2] |= 1 << (index & ((1 << FLAGS_POW2) - 1));\r\n }\r\n\r\n removeBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n this._tileFlags[index >> FLAGS_POW2] &= ~(1 << (index & ((1 << FLAGS_POW2) - 1)));\r\n }\r\n\r\n getBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return (this._tileFlags[index >> FLAGS_POW2] & (1 << (index & ((1 << FLAGS_POW2) - 1)))) !== 0;\r\n }\r\n\r\n // execution\r\n\r\n /**\r\n * Compute the field of view for a camera at the given tile.\r\n * chebyshevRadius is the vision radius. It uses chebyshev distance\r\n * (https://en.wikipedia.org/wiki/Chebyshev_distance), which just means\r\n * that the limit of vision in a large empty field will be square.\r\n *\r\n * This returns a MaskRect, which indicates which tiles are visible.\r\n * maskRect.get(x, y) will return true for visible tiles.\r\n */\r\n getFieldOfView(x: number, y: number, chebyshevRadius: number): geom.MaskRect {\r\n const origin = new geom.Offset(x, y);\r\n const boundRect = new geom.Rectangle(\r\n origin.x - chebyshevRadius, origin.y - chebyshevRadius,\r\n chebyshevRadius * 2 + 1, chebyshevRadius * 2 + 1,\r\n );\r\n const mask = new geom.MaskRect(boundRect);\r\n // the player can always see itself\r\n mask.set(origin, true);\r\n // the field is divided into quadrants\r\n this._quadrant(mask, origin, chebyshevRadius, -1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, -1, 1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, 1);\r\n return mask;\r\n }\r\n\r\n private _quadrant(mask: geom.MaskRect, origin: geom.OffsetLike, chebyshevRadius: number,\r\n xDir: number, yDir: number) {\r\n const {x: startX, y: startY} = origin;\r\n const endDX = (Math.min(Math.max(startX + xDir * (chebyshevRadius + 1),\r\n -1), this._size.width) - startX) * xDir;\r\n const endDY = (Math.min(Math.max(startY + yDir * (chebyshevRadius + 1),\r\n -1), this._size.height) - startY) * yDir;\r\n if (endDX < 0 || endDY < 0) {\r\n // the origin is outside of the map\r\n return;\r\n }\r\n const startMapIndex = this._size.index(origin);\r\n const startMaskIndex = mask.index(origin);\r\n // Initial wedge is from slope zero to slope infinity (i.e. the whole quadrant)\r\n const wedges = [0, Number.POSITIVE_INFINITY];\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dy = 0, yMapIndex = startMapIndex, yMaskIndex = startMaskIndex;\r\n dy !== endDY && wedges.length > 0;\r\n dy ++, yMapIndex = yMapIndex + yDir * this._size.width, yMaskIndex = yMaskIndex + yDir * mask.width\r\n ) {\r\n const divYpos = 1 / (dy + 0.5);\r\n const divYneg = dy === 0 ? Number.POSITIVE_INFINITY : 1 / (dy - 0.5);\r\n let wedgeIndex = 0;\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dx = 0, mapIndex = yMapIndex, maskIndex = yMaskIndex,\r\n slopeY = -0.5 * divYpos, slopeX = 0.5 * divYneg;\r\n dx !== endDX && wedgeIndex !== wedges.length;\r\n dx ++, mapIndex = mapIndex + xDir, maskIndex = maskIndex + xDir,\r\n slopeY = slopeY + divYpos, slopeX = slopeX + divYneg\r\n ) {\r\n // the slopes of the four corners of this tile\r\n // these are named as follows:\r\n // slopeY is the slope closest to the Y axis\r\n // slopeX is the slope closest to the X axis\r\n // this is always true:\r\n // slopeY < slopeX\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---X\r\n // | | | C |\r\n // +---+---Y---+\r\n\r\n // advance the wedge index until this tile is not after the current wedge\r\n while (slopeY >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n wedgeIndex = wedgeIndex + WEDGE_COUNT;\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n }\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n\r\n // if the current wedge is after this tile, move on\r\n if (slopeX <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n continue;\r\n }\r\n\r\n // we can see this tile\r\n mask.setAt(maskIndex, true);\r\n\r\n // const/let must be at the top of a block, in order not to trigger deoptimization due to\r\n // https://github.com/nodejs/node/issues/9729\r\n {\r\n const body = (dx !== 0 || dy !== 0)\r\n && (this._tileFlags[mapIndex >> FLAGS_POW2]\r\n & (1 << (mapIndex & ((1 << FLAGS_POW2) - 1)))) !== 0;\r\n if (body) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX - BODY_EPSILON);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * This function cuts a range of angles out of the wedge array.\r\n */\r\nfunction cutWedge(wedges: number[], wedgeIndex: number, low: number, high: number): number {\r\n for (; ; ) {\r\n if (wedgeIndex === wedges.length) {\r\n return wedgeIndex;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n break;\r\n }\r\n // This next line is to cover a hypothetical edge case, where two slopes\r\n // are not the same, but are within the BODY_EPSILON distance. That\r\n // would be due to either floating point error or due to a very large\r\n // field radius. Either way I haven't been able to construct a test\r\n // case for it.\r\n wedgeIndex += WEDGE_COUNT;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // wedge is entirely occluded, remove it\r\n wedges.splice(wedgeIndex, WEDGE_COUNT);\r\n // now looking at the next wedge (or past the end)\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else if (high >= wedges[wedgeIndex + WEDGE_LOW]) {\r\n // low part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // still looking at the same wedge\r\n } else {\r\n // this cut doesn't reach the current wedge\r\n }\r\n } else if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // high part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_HIGH] = low;\r\n // move on to the next wedge\r\n wedgeIndex += WEDGE_COUNT;\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else {\r\n // middle part of wedge is occluded, split it\r\n wedges.splice(wedgeIndex, 0, wedges[wedgeIndex + WEDGE_LOW], low);\r\n wedgeIndex += WEDGE_COUNT;\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // now looking at the second wedge of the split\r\n }\r\n return wedgeIndex;\r\n}\r\n","export * from './offset';\r\nexport * from './size';\r\nexport * from './rectangle';\r\nexport * from './mask';\r\nexport * from './mask-rect';\r\n","import * as geom from '.';\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class MaskRect implements geom.RectangleLike {\r\n private readonly _rectangle = new geom.Rectangle();\r\n private readonly _mask: geom.Mask;\r\n private readonly _outsideValue: boolean;\r\n\r\n constructor(rect: geom.RectangleLike, initialValue = false, outsideValue = false) {\r\n this._rectangle.copyFrom(rect);\r\n this._mask = new geom.Mask(rect, initialValue);\r\n this._outsideValue = outsideValue;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `${this._rectangle.northWest}/${this._outsideValue}\\n${this._mask}`;\r\n }\r\n\r\n get westX() {\r\n return this._rectangle.westX;\r\n }\r\n\r\n get northY() {\r\n return this._rectangle.northY;\r\n }\r\n\r\n get width() {\r\n return this._rectangle.width;\r\n }\r\n\r\n get height() {\r\n return this._rectangle.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._mask.index(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest));\r\n }\r\n\r\n getAt(index: number) {\r\n return this._mask.getAt(index);\r\n }\r\n\r\n get(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n if (!this._rectangle.containsOffset(LOCAL_OFF)) {\r\n return this._outsideValue;\r\n }\r\n return this._mask.get(LOCAL_OFF.subtractOffset(this._rectangle.northWest));\r\n }\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._mask.setAt(index, value);\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n this._mask.set(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest), value);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n this._mask.forEach(cursor, (off, value) => {\r\n callback(off.addOffset(this._rectangle.northWest), value);\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport class Mask implements geom.SizeLike {\r\n private readonly _size = new geom.Size();\r\n private readonly _bits: boolean[];\r\n // TODO consider Uint8Array for bits\r\n\r\n constructor(size: geom.SizeLike, initialValue = false) {\r\n this._size.copyFrom(size);\r\n this._bits = new Array(this._size.area).fill(initialValue);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n let ret = '';\r\n const off = new geom.Offset();\r\n for (let y = 0; y < this._size.height; y ++) {\r\n for (let x = 0; x < this._size.width; x ++) {\r\n off.set(x, y);\r\n ret += this.get(off.set(x, y)) ? '☑' : '☐';\r\n }\r\n ret += '\\n';\r\n }\r\n return ret;\r\n }\r\n\r\n get width() {\r\n return this._size.width;\r\n }\r\n\r\n get height() {\r\n return this._size.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._size.index(off);\r\n }\r\n\r\n getAt(index: number) {\r\n return this._bits[index];\r\n }\r\n\r\n get(off: geom.OffsetLike) {\r\n return this.getAt(this.index(off));\r\n }\r\n\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._bits[index] = value;\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n return this.setAt(this.index(off), value);\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n let index = 0;\r\n this._size.forEach(cursor, (off) => {\r\n callback(off, this._bits[index]);\r\n index ++;\r\n });\r\n }\r\n}\r\n","export interface OffsetLike {\r\n readonly x: number;\r\n readonly y: number;\r\n}\r\n\r\nexport class Offset implements OffsetLike {\r\n x: number;\r\n y: number;\r\n\r\n constructor();\r\n constructor(x: number, y: number);\r\n constructor(x?: number, y?: number) {\r\n if (typeof x === 'undefined') {\r\n x = 0;\r\n }\r\n if (typeof y === 'undefined') {\r\n y = 0;\r\n }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n toString() {\r\n return `(${this.x},${this.y})`;\r\n }\r\n\r\n // mutators\r\n\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n copyFrom(other: OffsetLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n addOffset(off: OffsetLike) {\r\n this.x += off.x;\r\n this.y += off.y;\r\n return this;\r\n }\r\n\r\n subtractOffset(off: OffsetLike) {\r\n this.x -= off.x;\r\n this.y -= off.y;\r\n return this;\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface RectangleLike extends geom.SizeLike {\r\n readonly westX: number;\r\n readonly northY: number;\r\n}\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class Rectangle implements RectangleLike, geom.SizeLike {\r\n northWest: geom.Offset;\r\n size: geom.Size;\r\n\r\n constructor();\r\n constructor(westX: number, northY: number, width: number, height: number);\r\n constructor(westX?: number, northY?: number, width?: number, height?: number) {\r\n if (typeof westX === 'undefined') {\r\n westX = 0;\r\n }\r\n if (typeof northY === 'undefined') {\r\n northY = 0;\r\n }\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.northWest = new geom.Offset(westX, northY);\r\n this.size = new geom.Size(width, height);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.westX},${this.northY} ${this.width}x${this.height})`;\r\n }\r\n\r\n get northY() {\r\n return this.northWest.y;\r\n }\r\n\r\n get southY() {\r\n return this.northWest.y + this.size.height - 1;\r\n }\r\n\r\n get westX() {\r\n return this.northWest.x;\r\n }\r\n\r\n get eastX() {\r\n return this.northWest.x + this.size.width - 1;\r\n }\r\n\r\n get width() {\r\n return this.size.width;\r\n }\r\n\r\n get height() {\r\n return this.size.height;\r\n }\r\n\r\n get empty() {\r\n return this.size.empty;\r\n }\r\n\r\n get area() {\r\n return this.size.area;\r\n }\r\n\r\n // mutators\r\n\r\n copyFrom(other: RectangleLike) {\r\n this.northWest.set(other.westX, other.northY);\r\n this.size.set(other.width, other.height);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return this.size.containsOffset(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this.size.index(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface SizeLike {\r\n readonly width: number;\r\n readonly height: number;\r\n}\r\n\r\nexport class Size implements SizeLike {\r\n width: number;\r\n height: number;\r\n\r\n constructor();\r\n constructor(width: number, height: number);\r\n constructor(width?: number, height?: number) {\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.width}x${this.height})`;\r\n }\r\n\r\n get empty() {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n get area() {\r\n return this.width * this.height;\r\n }\r\n\r\n // mutators\r\n\r\n set(width: number, height: number) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n }\r\n\r\n copyFrom(other: SizeLike) {\r\n this.width = other.width;\r\n this.height = other.height;\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return off.x >= 0 && off.y >= 0 && off.x < this.width && off.y < this.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return off.y * this.width + off.x;\r\n }\r\n\r\n forEach(cursor: geom.Offset, callback: (offset: geom.Offset) => void) {\r\n for (let dy = 0; dy < this.height; dy ++) {\r\n for (let dx = 0; dx < this.width; dx ++) {\r\n cursor.x = dx;\r\n cursor.y = dy;\r\n callback(cursor);\r\n }\r\n }\r\n }\r\n}\r\n","/*\r\n * TheField\r\n * github.com/sbj42/the-field\r\n * James Clark\r\n * Licensed under the MIT license.\r\n */\r\n\r\nexport {FieldOfViewMap} from './field-of-view';\r\nexport {MaskRect} from './geom';\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://TheField/webpack/bootstrap","webpack://TheField/./src/field-of-view.ts","webpack://TheField/./src/geom/index.ts","webpack://TheField/./src/geom/mask-rect.ts","webpack://TheField/./src/geom/mask.ts","webpack://TheField/./src/geom/offset.ts","webpack://TheField/./src/geom/rectangle.ts","webpack://TheField/./src/geom/size.ts","webpack://TheField/./src/index.ts"],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;Q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I,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,sBAAO,GAAP,UAAQ,MAAmB,EAAE,QAAuC;QAChE,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAG,EAAE;YACtC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,EAAG,EAAE;gBACrC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;gBACd,QAAQ,CAAC,MAAM,CAAC,CAAC;aACpB;SACJ;IACL,CAAC;IACL,WAAC;AAAD,CAAC;AAhEY,oBAAI;;;;;;;;;;;;;;ACPjB;;;;;GAKG;;AAEH,2FAA+C;AAAvC,uDAAc;AACtB,sEAAgC;AAAxB,kCAAQ","file":"the-field-1.0.4.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/bin/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import * as geom from './geom';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\n/**\r\n * In the shadowcasting algorithm, each shadow is represented by a \"wedge\",\r\n * running from a \"low\" angle to a \"high\" angle. The wedges are all stored in\r\n * a simple number array, with two numbers for each wedge. These constants\r\n * (WEDGE_LOW and WEDGE_HIGH) help to identify which number is which.\r\n * WEDGE_COUNT is just how many numbers per wedge.\r\n */\r\nconst WEDGE_LOW = 0;\r\nconst WEDGE_HIGH = 1;\r\nconst WEDGE_COUNT = 2;\r\n\r\n/**\r\n * Bodies in this algorithm do not entirely fill their tiles. This is\r\n * implemented by adjusting the angles of the shadows the bodies cast,\r\n * making the wedge very slightly narrower. BODY_EPSILON represents the\r\n * amount of reduction on either side of the wedge.\r\n */\r\nconst BODY_EPSILON = 0.00001;\r\n\r\n/**\r\n * We avoid heap allocations during the core part of the algorithm by using this\r\n * preallocated offset object.\r\n */\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\n/**\r\n * For each number in the _tileFlags array, we store (1 << FLAGS_POW2) cells,\r\n * as bits where a true indicates the presence of a body.\r\n */\r\nconst FLAGS_POW2 = 5;\r\n\r\n/**\r\n * The FieldOFViewMap represents the map over which the field of view will be\r\n * computed. It starts out empty. You can add walls and bodies to it, and then\r\n * use getFieldOfView() to compute the field of view from a given point.\r\n */\r\nexport class FieldOfViewMap {\r\n private readonly _size = new geom.Size();\r\n private readonly _tileFlags: number[];\r\n\r\n constructor(width: number, height: number) {\r\n this._size.set(width, height);\r\n this._tileFlags = new Array((this._size.area >> FLAGS_POW2) + 1).fill(0);\r\n }\r\n\r\n // setup and maintenance\r\n\r\n addBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n this._tileFlags[index >> FLAGS_POW2] |= 1 << (index & ((1 << FLAGS_POW2) - 1));\r\n }\r\n\r\n removeBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n this._tileFlags[index >> FLAGS_POW2] &= ~(1 << (index & ((1 << FLAGS_POW2) - 1)));\r\n }\r\n\r\n getBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return (this._tileFlags[index >> FLAGS_POW2] & (1 << (index & ((1 << FLAGS_POW2) - 1)))) !== 0;\r\n }\r\n\r\n // execution\r\n\r\n /**\r\n * Compute the field of view for a camera at the given tile.\r\n * chebyshevRadius is the vision radius. It uses chebyshev distance\r\n * (https://en.wikipedia.org/wiki/Chebyshev_distance), which just means\r\n * that the limit of vision in a large empty field will be square.\r\n *\r\n * This returns a MaskRect, which indicates which tiles are visible.\r\n * maskRect.get(x, y) will return true for visible tiles.\r\n */\r\n getFieldOfView(x: number, y: number, chebyshevRadius: number): geom.MaskRect {\r\n const origin = new geom.Offset(x, y);\r\n const boundRect = new geom.Rectangle(\r\n origin.x - chebyshevRadius, origin.y - chebyshevRadius,\r\n chebyshevRadius * 2 + 1, chebyshevRadius * 2 + 1,\r\n );\r\n const mask = new geom.MaskRect(boundRect);\r\n // the player can always see itself\r\n mask.set(origin, true);\r\n // the field is divided into quadrants\r\n this._quadrant(mask, origin, chebyshevRadius, -1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, -1, 1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, 1);\r\n return mask;\r\n }\r\n\r\n private _quadrant(mask: geom.MaskRect, origin: geom.OffsetLike, chebyshevRadius: number,\r\n xDir: number, yDir: number) {\r\n const {x: startX, y: startY} = origin;\r\n const endDX = (Math.min(Math.max(startX + xDir * (chebyshevRadius + 1),\r\n -1), this._size.width) - startX) * xDir;\r\n const endDY = (Math.min(Math.max(startY + yDir * (chebyshevRadius + 1),\r\n -1), this._size.height) - startY) * yDir;\r\n if (endDX < 0 || endDY < 0) {\r\n // the origin is outside of the map\r\n return;\r\n }\r\n const startMapIndex = this._size.index(origin);\r\n const startMaskIndex = mask.index(origin);\r\n // Initial wedge is from slope zero to slope infinity (i.e. the whole quadrant)\r\n const wedges = [0, Number.POSITIVE_INFINITY];\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dy = 0, yMapIndex = startMapIndex, yMaskIndex = startMaskIndex;\r\n dy !== endDY && wedges.length > 0;\r\n dy ++, yMapIndex = yMapIndex + yDir * this._size.width, yMaskIndex = yMaskIndex + yDir * mask.width\r\n ) {\r\n const divYpos = 1 / (dy + 0.5);\r\n const divYneg = dy === 0 ? Number.POSITIVE_INFINITY : 1 / (dy - 0.5);\r\n let wedgeIndex = 0;\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dx = 0, mapIndex = yMapIndex, maskIndex = yMaskIndex,\r\n slopeY = -0.5 * divYpos, slopeX = 0.5 * divYneg;\r\n dx !== endDX && wedgeIndex !== wedges.length;\r\n dx ++, mapIndex = mapIndex + xDir, maskIndex = maskIndex + xDir,\r\n slopeY = slopeY + divYpos, slopeX = slopeX + divYneg\r\n ) {\r\n // the slopes of the four corners of this tile\r\n // these are named as follows:\r\n // slopeY is the slope closest to the Y axis\r\n // slopeX is the slope closest to the X axis\r\n // this is always true:\r\n // slopeY < slopeX\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---X\r\n // | | | C |\r\n // +---+---Y---+\r\n\r\n // advance the wedge index until this tile is not after the current wedge\r\n while (slopeY >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n wedgeIndex = wedgeIndex + WEDGE_COUNT;\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n }\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n\r\n // if the current wedge is after this tile, move on\r\n if (slopeX <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n continue;\r\n }\r\n\r\n // we can see this tile\r\n mask.setAt(maskIndex, true);\r\n\r\n // const/let must be at the top of a block, in order not to trigger deoptimization due to\r\n // https://github.com/nodejs/node/issues/9729\r\n {\r\n const body = (dx !== 0 || dy !== 0)\r\n && (this._tileFlags[mapIndex >> FLAGS_POW2]\r\n & (1 << (mapIndex & ((1 << FLAGS_POW2) - 1)))) !== 0;\r\n if (body) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX - BODY_EPSILON);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * This function cuts a range of angles out of the wedge array.\r\n */\r\nfunction cutWedge(wedges: number[], wedgeIndex: number, low: number, high: number): number {\r\n for (; ; ) {\r\n if (wedgeIndex === wedges.length) {\r\n return wedgeIndex;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n break;\r\n }\r\n // This next line is to cover a hypothetical edge case, where two slopes\r\n // are not the same, but are within the BODY_EPSILON distance. That\r\n // would be due to either floating point error or due to a very large\r\n // field radius. Either way I haven't been able to construct a test\r\n // case for it.\r\n wedgeIndex += WEDGE_COUNT;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // wedge is entirely occluded, remove it\r\n wedges.splice(wedgeIndex, WEDGE_COUNT);\r\n // now looking at the next wedge (or past the end)\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else if (high >= wedges[wedgeIndex + WEDGE_LOW]) {\r\n // low part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // still looking at the same wedge\r\n } else {\r\n // this cut doesn't reach the current wedge\r\n }\r\n } else if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // high part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_HIGH] = low;\r\n // move on to the next wedge\r\n wedgeIndex += WEDGE_COUNT;\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else {\r\n // middle part of wedge is occluded, split it\r\n wedges.splice(wedgeIndex, 0, wedges[wedgeIndex + WEDGE_LOW], low);\r\n wedgeIndex += WEDGE_COUNT;\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // now looking at the second wedge of the split\r\n }\r\n return wedgeIndex;\r\n}\r\n","export * from './offset';\r\nexport * from './size';\r\nexport * from './rectangle';\r\nexport * from './mask';\r\nexport * from './mask-rect';\r\n","import * as geom from '.';\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class MaskRect implements geom.RectangleLike {\r\n private readonly _rectangle = new geom.Rectangle();\r\n private readonly _mask: geom.Mask;\r\n private readonly _outsideValue: boolean;\r\n\r\n constructor(rect: geom.RectangleLike, initialValue = false, outsideValue = false) {\r\n this._rectangle.copyFrom(rect);\r\n this._mask = new geom.Mask(rect, initialValue);\r\n this._outsideValue = outsideValue;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `${this._rectangle.northWest}/${this._outsideValue}\\n${this._mask}`;\r\n }\r\n\r\n get westX() {\r\n return this._rectangle.westX;\r\n }\r\n\r\n get northY() {\r\n return this._rectangle.northY;\r\n }\r\n\r\n get width() {\r\n return this._rectangle.width;\r\n }\r\n\r\n get height() {\r\n return this._rectangle.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._mask.index(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest));\r\n }\r\n\r\n getAt(index: number) {\r\n return this._mask.getAt(index);\r\n }\r\n\r\n get(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n if (!this._rectangle.containsOffset(LOCAL_OFF)) {\r\n return this._outsideValue;\r\n }\r\n return this._mask.get(LOCAL_OFF.subtractOffset(this._rectangle.northWest));\r\n }\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._mask.setAt(index, value);\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n this._mask.set(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest), value);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n this._mask.forEach(cursor, (off, value) => {\r\n callback(off.addOffset(this._rectangle.northWest), value);\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport class Mask implements geom.SizeLike {\r\n private readonly _size = new geom.Size();\r\n private readonly _bits: boolean[];\r\n // TODO consider Uint8Array for bits\r\n\r\n constructor(size: geom.SizeLike, initialValue = false) {\r\n this._size.copyFrom(size);\r\n this._bits = new Array(this._size.area).fill(initialValue);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n let ret = '';\r\n const off = new geom.Offset();\r\n for (let y = 0; y < this._size.height; y ++) {\r\n for (let x = 0; x < this._size.width; x ++) {\r\n off.set(x, y);\r\n ret += this.get(off.set(x, y)) ? '☑' : '☐';\r\n }\r\n ret += '\\n';\r\n }\r\n return ret;\r\n }\r\n\r\n get width() {\r\n return this._size.width;\r\n }\r\n\r\n get height() {\r\n return this._size.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._size.index(off);\r\n }\r\n\r\n getAt(index: number) {\r\n return this._bits[index];\r\n }\r\n\r\n get(off: geom.OffsetLike) {\r\n return this.getAt(this.index(off));\r\n }\r\n\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._bits[index] = value;\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n return this.setAt(this.index(off), value);\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n let index = 0;\r\n this._size.forEach(cursor, (off) => {\r\n callback(off, this._bits[index]);\r\n index ++;\r\n });\r\n }\r\n}\r\n","export interface OffsetLike {\r\n readonly x: number;\r\n readonly y: number;\r\n}\r\n\r\nexport class Offset implements OffsetLike {\r\n x: number;\r\n y: number;\r\n\r\n constructor();\r\n constructor(x: number, y: number);\r\n constructor(x?: number, y?: number) {\r\n if (typeof x === 'undefined') {\r\n x = 0;\r\n }\r\n if (typeof y === 'undefined') {\r\n y = 0;\r\n }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n toString() {\r\n return `(${this.x},${this.y})`;\r\n }\r\n\r\n // mutators\r\n\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n copyFrom(other: OffsetLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n addOffset(off: OffsetLike) {\r\n this.x += off.x;\r\n this.y += off.y;\r\n return this;\r\n }\r\n\r\n subtractOffset(off: OffsetLike) {\r\n this.x -= off.x;\r\n this.y -= off.y;\r\n return this;\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface RectangleLike extends geom.SizeLike {\r\n readonly westX: number;\r\n readonly northY: number;\r\n}\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class Rectangle implements RectangleLike, geom.SizeLike {\r\n northWest: geom.Offset;\r\n size: geom.Size;\r\n\r\n constructor();\r\n constructor(westX: number, northY: number, width: number, height: number);\r\n constructor(westX?: number, northY?: number, width?: number, height?: number) {\r\n if (typeof westX === 'undefined') {\r\n westX = 0;\r\n }\r\n if (typeof northY === 'undefined') {\r\n northY = 0;\r\n }\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.northWest = new geom.Offset(westX, northY);\r\n this.size = new geom.Size(width, height);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.westX},${this.northY} ${this.width}x${this.height})`;\r\n }\r\n\r\n get northY() {\r\n return this.northWest.y;\r\n }\r\n\r\n get southY() {\r\n return this.northWest.y + this.size.height - 1;\r\n }\r\n\r\n get westX() {\r\n return this.northWest.x;\r\n }\r\n\r\n get eastX() {\r\n return this.northWest.x + this.size.width - 1;\r\n }\r\n\r\n get width() {\r\n return this.size.width;\r\n }\r\n\r\n get height() {\r\n return this.size.height;\r\n }\r\n\r\n get empty() {\r\n return this.size.empty;\r\n }\r\n\r\n get area() {\r\n return this.size.area;\r\n }\r\n\r\n // mutators\r\n\r\n copyFrom(other: RectangleLike) {\r\n this.northWest.set(other.westX, other.northY);\r\n this.size.set(other.width, other.height);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return this.size.containsOffset(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this.size.index(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface SizeLike {\r\n readonly width: number;\r\n readonly height: number;\r\n}\r\n\r\nexport class Size implements SizeLike {\r\n width: number;\r\n height: number;\r\n\r\n constructor();\r\n constructor(width: number, height: number);\r\n constructor(width?: number, height?: number) {\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.width}x${this.height})`;\r\n }\r\n\r\n get empty() {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n get area() {\r\n return this.width * this.height;\r\n }\r\n\r\n // mutators\r\n\r\n set(width: number, height: number) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n }\r\n\r\n copyFrom(other: SizeLike) {\r\n this.width = other.width;\r\n this.height = other.height;\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return off.x >= 0 && off.y >= 0 && off.x < this.width && off.y < this.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return off.y * this.width + off.x;\r\n }\r\n\r\n forEach(cursor: geom.Offset, callback: (offset: geom.Offset) => void) {\r\n for (let dy = 0; dy < this.height; dy ++) {\r\n for (let dx = 0; dx < this.width; dx ++) {\r\n cursor.x = dx;\r\n cursor.y = dy;\r\n callback(cursor);\r\n }\r\n }\r\n }\r\n}\r\n","/*\r\n * TheField\r\n * github.com/sbj42/the-field\r\n * James Clark\r\n * Licensed under the MIT license.\r\n */\r\n\r\nexport {FieldOfViewMap} from './field-of-view';\r\nexport {MaskRect} from './geom';\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/bin/the-field-1.0.2.min.js b/bin/the-field-1.0.4.min.js similarity index 99% rename from bin/the-field-1.0.2.min.js rename to bin/the-field-1.0.4.min.js index 1bec4e9..abdcd5d 100644 --- a/bin/the-field-1.0.2.min.js +++ b/bin/the-field-1.0.4.min.js @@ -1,2 +1,2 @@ var TheField=function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/bin/",i(i.s=1)}([function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(3)),r(i(4)),r(i(5)),r(i(6)),r(i(7))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(2);e.FieldOfViewMap=r.FieldOfViewMap;var n=i(0);e.MaskRect=n.MaskRect},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),n=new r.Offset,o=function(){function t(t,e){this._size=new r.Size,this._size.set(t,e),this._tileFlags=new Array(1+(this._size.area>>5)).fill(0)}return t.prototype.addBody=function(t,e){n.set(t,e);var i=this._size.index(n);this._tileFlags[i>>5]|=1<<(31&i)},t.prototype.removeBody=function(t,e){n.set(t,e);var i=this._size.index(n);this._tileFlags[i>>5]&=~(1<<(31&i))},t.prototype.getBody=function(t,e){n.set(t,e);var i=this._size.index(n);return 0!=(this._tileFlags[i>>5]&1<<(31&i))},t.prototype.getFieldOfView=function(t,e,i){var n=new r.Offset(t,e),o=new r.Rectangle(n.x-i,n.y-i,2*i+1,2*i+1),s=new r.MaskRect(o);return s.set(n,!0),this._quadrant(s,n,i,-1,-1),this._quadrant(s,n,i,1,-1),this._quadrant(s,n,i,-1,1),this._quadrant(s,n,i,1,1),s},t.prototype._quadrant=function(t,e,i,r,n){var o=e.x,u=e.y,h=(Math.min(Math.max(o+r*(i+1),-1),this._size.width)-o)*r,f=(Math.min(Math.max(u+n*(i+1),-1),this._size.height)-u)*n;if(!(h<0||f<0))for(var c=this._size.index(e),a=t.index(e),p=[0,Number.POSITIVE_INFINITY],y=0,d=c,l=a;y!==f&&p.length>0;y++,d+=n*this._size.width,l+=n*t.width)for(var g=1/(y+.5),b=0===y?Number.POSITIVE_INFINITY:1/(y-.5),_=0,O=0,v=d,m=l,w=-.5*g,x=.5*b;O!==h&&_!==p.length;O++,v+=r,m+=r,w+=g,x+=b){for(;w>=p[_+1]&&!((_+=2)>=p.length););if(_>=p.length)break;if(!(x<=p[_+0]))t.setAt(m,!0),(0!==O||0!==y)&&0!=(this._tileFlags[v>>5]&1<<(31&v))&&(_=s(p,_,w+1e-5,x-1e-5))}},t}();function s(t,e,i,r){for(;;){if(e===t.length)return e;if(i<=t[e+1])break;e+=2}if(i<=t[e+0]){if(r>=t[e+1])return t.splice(e,2),s(t,e,i,r);r>=t[e+0]&&(t[e+0]=r)}else{if(r>=t[e+1])return t[e+1]=i,s(t,e+=2,i,r);t.splice(e,0,t[e+0],i),t[(e+=2)+0]=r}return e}e.FieldOfViewMap=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.toString=function(){return"("+this.x+","+this.y+")"},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.addOffset=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.subtractOffset=function(t){return this.x-=t.x,this.y-=t.y,this},t}();e.Offset=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.width=t,this.height=e}return t.prototype.toString=function(){return"("+this.width+"x"+this.height+")"},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.width||0===this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){return this.width=t,this.height=e,this},t.prototype.copyFrom=function(t){return this.width=t.width,this.height=t.height,this},t.prototype.containsOffset=function(t){return t.x>=0&&t.y>=0&&t.x