@@ -11,7 +11,6 @@ const handleParallel = require('./handle-parallel.js');
11
11
12
12
const arrayToMinimapMarkerBuffer = require ( './array-to-minimap-marker.js' ) ;
13
13
const colors = require ( './colors.js' ) ;
14
- const idToXyz = require ( './id-to-xyz.js' ) ;
15
14
const pixelDataToMapBuffer = require ( './pixel-data-to-map.js' ) ;
16
15
const pixelDataToPathBuffer = require ( './pixel-data-to-path.js' ) ;
17
16
@@ -42,22 +41,21 @@ const writeBuffer = (fileName, buffer) => {
42
41
43
42
const forEachTile = ( context , map , callback , name , floorID ) => {
44
43
const isGroundFloor = floorID == '07' ;
44
+ const z = Number ( floorID ) ;
45
45
const bounds = GLOBALS . bounds ;
46
46
const image = new Image ( ) ;
47
47
image . src = map ;
48
48
context . drawImage ( image , 0 , 0 , bounds . width , bounds . height ) ;
49
49
// Extract each 256×256px tile.
50
50
let yOffset = 0 ;
51
51
while ( yOffset < bounds . height ) {
52
- const y = bounds . yMin + ( yOffset / 256 ) ;
53
- const yID = String ( y ) . padStart ( 3 , '0' ) ;
52
+ const y = bounds . yMin + yOffset ;
54
53
let xOffset = 0 ;
55
54
while ( xOffset < bounds . width ) {
56
- const x = bounds . xMin + ( xOffset / 256 ) ;
57
- const xID = String ( x ) . padStart ( 3 , '0' ) ;
55
+ const x = bounds . xMin + xOffset ;
58
56
const pixels = context . getImageData ( xOffset , yOffset , 256 , 256 ) ;
59
57
const buffer = callback ( pixels , isGroundFloor ) ;
60
- const id = `${ xID } ${ yID } ${ floorID } ` ;
58
+ const id = `${ x } _ ${ y } _ ${ z } ` ;
61
59
if ( buffer ) {
62
60
addResult ( id , name , buffer ) ;
63
61
}
@@ -127,14 +125,12 @@ const convertToMinimap = async (dataDirectory, outputPath, includeMarkers, overl
127
125
data . pathBuffer = EMPTY_PATH_BUFFER ;
128
126
}
129
127
// Generate the Tibia 11-compatible minimap PNGs.
130
- const coords = idToXyz ( id ) ;
131
- const minimapId = `${ coords . x * 256 } _${ coords . y * 256 } _${ coords . z } ` ;
132
128
writeBuffer (
133
- `${ outputPath } /Minimap_Color_${ minimapId } .png` ,
129
+ `${ outputPath } /Minimap_Color_${ id } .png` ,
134
130
wrapColorData ( data . mapBuffer , { overlayGrid } )
135
131
) ;
136
132
writeBuffer (
137
- `${ outputPath } /Minimap_WaypointCost_${ minimapId } .png` ,
133
+ `${ outputPath } /Minimap_WaypointCost_${ id } .png` ,
138
134
wrapWaypointData ( data . pathBuffer )
139
135
) ;
140
136
}
0 commit comments