通过读取游戏内存,绘制角色当前地图
var
MapBase:Cardinal = $86E9D78;
function TMain.GetMapPointByIndex(n: Cardinal): Word;
begin
Result:=pWord(MapBase + n * 2)^;
end;
Procedure TMain.pand(x:Integer;y:Integer;id_cl:integer);
begin
case id_cl of
0:begin
Img1.Canvas.Pen.Color:=clGreen;
end;
1:begin
Img1.Canvas.Pen.Color:=clYellow;
end;
2:begin
Img1.Canvas.Pen.Color:=clBlue;
end;
3:begin
Img1.Canvas.Pen.Color:=clWhite;
end;
4:begin
Img1.Canvas.Pen.Color:=clWhite;
end;
5:begin
Img1.Canvas.Pen.Color:=clBlue;
end;
6:begin
Img1.Canvas.Pen.Color:=clLime;
end;
7:begin
Img1.Canvas.Pen.Color:=clPurple;
end;
8:begin
Img1.Canvas.Pen.Color:=clWhite;
end;
9:begin
Img1.Canvas.Pen.Color:=clWhite;
end;
12:begin
Img1.Canvas.Pen.Color:=clWhite;
end;
end;
Img1.Canvas.Pen.Width:=2;
Img1.Canvas.MoveTo(y,x);
Img1.Canvas.LineTo(y,x);
end;
procedure TMain.DrawMap;
var
x,y,i:Integer;
n:word;
begin
i:=0;
for x := 0 to 255 do
begin
for y := 0 to 255 do
begin
n:=GetMapPointByIndex(i);
Inc(i);
pand(y,x,n);
end;
end;
end;
需添加控件image