- Timestamp:
- 07/19/11 10:52:17 (13 years ago)
- Location:
- ps/trunk/binaries/data/mods/public/maps/random/rmgen
- Files:
-
- 4 edited
-
map.js (modified) (5 diffs)
-
painter.js (modified) (2 diffs)
-
placer.js (modified) (2 diffs)
-
tileclass.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/maps/random/rmgen/map.js
r9725 r9882 21 21 for (var i = 0; i < size; i++) 22 22 { 23 this.texture[i] = new Uint16Array( Math.floor(size)); // uint16 - texture IDs // HACK: typed arrays require integer arguments23 this.texture[i] = new Uint16Array(size); // uint16 - texture IDs 24 24 this.terrainObjects[i] = new Array(size); // array of entities 25 this.area[i] = new Uint16Array( Math.floor(size)); // uint16 - area IDs // HACK: typed arrays require integer arguments25 this.area[i] = new Uint16Array(size); // uint16 - area IDs 26 26 27 27 for (var j = 0; j < size; j++) … … 36 36 for (var i = 0; i < mapSize; i++) 37 37 { 38 this.height[i] = new Float32Array( Math.floor(mapSize)); // float32 // HACK: typed arrays require integer arguments38 this.height[i] = new Float32Array(mapSize); // float32 39 39 40 40 for (var j = 0; j < mapSize; j++) … … 98 98 if (g_MapSettings.CircularMap) 99 99 { // Within map circle 100 var halfSize = 0.5*this.size;100 var halfSize = Math.floor(0.5*this.size); 101 101 var dx = (x - halfSize); 102 102 var dz = (z - halfSize); 103 return Math. sqrt(dx*dx + dz*dz) < (halfSize - 1.5);103 return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize; 104 104 } 105 105 else … … 301 301 // Flat because it's easier to handle by the engine 302 302 var mapSize = size+1; 303 var height16 = new Uint16Array( Math.floor(mapSize*mapSize)); // uint16 // HACK: typed arrays require integer arguments303 var height16 = new Uint16Array(mapSize*mapSize); // uint16 304 304 for (var x = 0; x < mapSize; x++) 305 305 { … … 333 333 334 334 // Convert 2D tile data to flat array 335 var tileIndex = new Uint16Array( Math.floor(size*size)); // uint16 // HACK: typed arrays require integer arguments336 var tilePriority = new Uint16Array( Math.floor(size*size)); // uint16 // HACK: typed arrays require integer arguments335 var tileIndex = new Uint16Array(size*size); // uint16 336 var tilePriority = new Uint16Array(size*size); // uint16 337 337 for (var x = 0; x < size; x++) 338 338 { -
ps/trunk/binaries/data/mods/public/maps/random/rmgen/painter.js
r9435 r9882 70 70 for (var i = 0; i < size; ++i) 71 71 { 72 saw[i] = new Uint8Array( Math.floor(size)); // bool / uint8 // HACK: typed arrays require integer arguments73 dist[i] = new Uint16Array( Math.floor(size)); // uint16 // HACK: typed arrays require integer arguments72 saw[i] = new Uint8Array(size); // bool / uint8 73 dist[i] = new Uint16Array(size); // uint16 74 74 } 75 75 … … 222 222 for (var i = 0; i < mapSize; ++i) 223 223 { 224 saw[i] = new Uint8Array( Math.floor(mapSize)); // bool / uint8 // HACK: typed arrays require integer arguments225 dist[i] = new Uint16Array( Math.floor(mapSize)); // uint16 // HACK: typed arrays require integer arguments226 gotHeightPt[i] = new Uint8Array( Math.floor(mapSize)); // bool / uint8 // HACK: typed arrays require integer arguments227 newHeight[i] = new Float32Array( Math.floor(mapSize)); // float32 // HACK: typed arrays require integer arguments224 saw[i] = new Uint8Array(mapSize); // bool / uint8 225 dist[i] = new Uint16Array(mapSize); // uint16 226 gotHeightPt[i] = new Uint8Array(mapSize); // bool / uint8 227 newHeight[i] = new Float32Array(mapSize); // float32 228 228 } 229 229 -
ps/trunk/binaries/data/mods/public/maps/random/rmgen/placer.js
r9435 r9882 36 36 for (var i = 0; i < size; ++i) 37 37 { 38 gotRet[i] = new Uint8Array( Math.floor(size)); // bool / uint8 // HACK: typed arrays require integer arguments38 gotRet[i] = new Uint8Array(size); // bool / uint8 39 39 } 40 40 … … 50 50 } 51 51 52 var noise = new Float32Array( Math.floor(intPerim)); //float32 // HACK: typed arrays require integer arguments53 var ctrlCoords = new Float32Array( Math.floor(ctrlPts+1)); //float32 // HACK: typed arrays require integer arguments54 var ctrlVals = new Float32Array( Math.floor(ctrlPts+1)); //float32 // HACK: typed arrays require integer arguments52 var noise = new Float32Array(intPerim); //float32 53 var ctrlCoords = new Float32Array(ctrlPts+1); //float32 54 var ctrlVals = new Float32Array(ctrlPts+1); //float32 55 55 56 56 // Generate some interpolated noise -
ps/trunk/binaries/data/mods/public/maps/random/rmgen/tileclass.js
r9435 r9882 14 14 } 15 15 16 this.vals = new Int16Array( Math.floor(2*this.nn)); // int16 // HACK: typed arrays require integer arguments16 this.vals = new Int16Array(2*this.nn); // int16 17 17 } 18 18 … … 79 79 for (var i=0; i < size; ++i) 80 80 { 81 this.inclusionCount[i] = new Int16Array( Math.floor(size)); //int16 // HACK: typed arrays require integer arguments81 this.inclusionCount[i] = new Int16Array(size); //int16 82 82 this.rangeCount[i] = new RangeOp(size); 83 83 }
Note:
See TracChangeset
for help on using the changeset viewer.
