aka Reb3lzrr
- Joined
- Aug 23, 2006
- Messages
- 325
- Reaction score
- 47
Ey all,
I decided to release KSM Specifications
A little snippet for Pascal:
Definition
Addidional info:
Loading
as you see, we skip 4 bytes, these are ALWAYS (1,0,0,0)
This is the most plain version of loading a KSM...
have fun
gz reb3lzrr
I decided to release KSM Specifications
A little snippet for Pascal:
Definition
Code:
TKalServerPixel = class
private
public
collision : word; //Mobs spawn YES/NO
additional_info : word; //Like town or so
end;
TKalServerMap = array[0..255] of array[0..256] of TKalServerPixel;
TKSM = class
private
public
map : TKalServerMap;
procedure LoadFromFile(FileLocation:String);
constructor Create; overload;
end;
Addidional info:
Code:
0=nothing special
1=OneWayPortal ( THESE ARE THE PORTALS USED BY INIXSOFT)
2=TwoWayPortal (not used by engine)
4=PkFree
6=Town
16=Castle
Loading
Code:
constructor TKSM.Create;
var
x,y:Byte;
begin
For x:=0 to 255 do
begin
For y:=0 to 255 do
begin
Self.Map[x,y]:=TKalServerPixel.Create;
end;
end;
end;
procedure TKSM.LoadFromFile(FileLocation:String);
var
MemStream:TMemoryStream;
Buf:Word;
x,y:Byte;
begin
try
MemStream:=TMemoryStream.Create;
MemStream.LoadFromFile(FileLocation);
MemStream.Position:=4;
For x:=0 to 255 do
begin
For y:=0 to 255 do
begin
MemStream.ReadBuffer(Buf,SizeOf(Buf));
Self.map[x,y].Collision:=Buf;
MemStream.ReadBuffer(Buf,SizeOf(Buf));
Self.map[x,y].additional_info:=Buf;
end;
end;
except
ShowMessage('error has occured');
end;
MemStream.Free;
end;
This is the most plain version of loading a KSM...
have fun
gz reb3lzrr