Kyle Undefined
2012-03-31 04:37:56
Ok, so I'm using this script to slice an updated SPS image, a lot of the walking in MSI got messed up with the latest RS update (ex, Seers Yews/Magics). It does fine until it gets to #273, and just errors out.
Line 27 is this code in cropBitmap:
I honestly don't know why it's doing it, and I've been trying to get this to work for the past few hours.
Here's the new image that is being split up, http://srl.kyleundefined.com/runescape_surface.zip
Any help or ideas would be appreciated! Thanks.
program SPS_MapMaker;
{$i srl/srl.simba}
(**
* 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.bmp';
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;
var
t: integer;
begin
t := getSystemTime();
ClearDebug;
ForceDirectories(PATH_IMG);
sliceMap;
writeln('Took '+msToTime(getSystemTime - t, TIME_SHORT)+' to complete.');
end.
## Saved 269
## Saved 270
## Saved 271
## Saved 272
Error: Exception: You are accessing an invalid point, (7271,0) at bitmap[0] at line 27
The following bitmaps were not freed: [0, 1]
Line 27 is this code in cropBitmap:
fastSetPixel(result, x, y, fastGetPixel(bmp, x1 + x, y1 + y));I honestly don't know why it's doing it, and I've been trying to get this to work for the past few hours.
Here's the new image that is being split up, http://srl.kyleundefined.com/runescape_surface.zip
Any help or ideas would be appreciated! Thanks.


