-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapmaker.simba
More file actions
53 lines (44 loc) · 1.21 KB
/
Copy pathmapmaker.simba
File metadata and controls
53 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
program SPS_MapMaker;
(**
* Running this script loads SPS/worldmap.png and slices the huge map
* into 500x500 pieces, which over lap each other by 100 pixels. The process
* will take several minutes. Images are saved to SPS_IMG_PATH.
*
* - marpis
*)
const
PATH_MAP = IncludePath + 'SPS\img\runescape_surface\runescape_surface_map.png';
PATH_IMG = IncludePath + 'SPS\img\runescape_surface\';
function cropBitmap(bmp, x1, y1, x2, y2: integer): integer;
var
x, y, w, h: integer;
begin
w := (x2 - x1 + 1);
h := (y2 - y1 + 1);
result := bitmapFromString(w, h, '');
for x := 0 to (w - 1) do
for y := 0 to (h - 1) do
fastSetPixel(result, x, y, fastGetPixel(bmp, x1 + x, y1 + y));
end;
procedure sliceMap;
var
mapBMP, tmpBMP: integer;
x, y, i, x1, y1, x2, y2: integer;
begin
mapBMP := loadBitmap(PATH_MAP);
for x := 0 to 17 do
for y := 0 to 15 do
begin
tmpBMP := cropBitmap(mapBMP, x * 400, y * 400, x * 400 + 499, y * 400 + 499);
saveBitmap(tmpBMP, PATH_IMG + toStr(x)+'_'+toStr(y)+'.bmp');
freeBitmap(tmpBMP);
inc(i);
writeln('## Saved '+toStr(i));
end;
freeBitmap(mapBMP);
end;
begin
ClearDebug;
ForceDirectory(PATH_IMG);
sliceMap;
end.