📄 directx9hook.pas
字号:
fpslag:=mssincelastdraw/2; //there where 2 draws since the start of the measurement
xdelta:=(xdelta/mssincelastdraw)*(lag+lagfrommemory+fpslag);
ydelta:=(ydelta/mssincelastdraw)*(lag+lagfrommemory+fpslag);
end
else
begin
xdelta:=(xdelta/mssincelastdraw)*(lag+lagfrommemory);
ydelta:=(ydelta/mssincelastdraw)*(lag+lagfrommemory);
end;
end;
if zoom=1 then
begin
position.x:=xylist[closest].x-8+xdelta;
position.y:=xylist[closest].y-8+ydelta;
mysprite.draw(movementtexture,nil,nil,@position,D3DCOLOR_ARGB(255,255,255,255));
end;
if (bbb mod 4>=2) then //move the mouse, after recalculating the speed or when it's doing nothing
begin
//modify xd and yd with the predicted location (so move the mouse to the predicted location instead of the current location)
xd:=xd+xdelta;
yd:=yd+ydelta;
//--------------------------------------------------------------
if autoaim then
begin
xd2:=0;
yd2:=0;
if abs(xd)>mousespeedx[40] then
begin
//calculate the size of the movement
//(xd-mousespeedx[40]) = pixels needed to be moved (after a 40)
//(mousespeedx[40]-mousespeedx[35] / 5)=pixels moved for every step
xd2:=40+trunc((abs(xd)-mousespeedx[40])/((mousespeedx[40]-mousespeedx[35]) / 5));
if xd<0 then xd2:=-xd2;
end else
begin
//find the closest in the list
i:=20;
start:=1;
stop:=40;
while (i<stop) and not ((mousespeedx[i]<abs(xd)) and (mousespeedx[i+1]>xd)) do
begin
if mousespeedx[i]<abs(xd) then start:=i else stop:=i;
i:=start+(stop-start) div 2;
end;
if (i=1) and (mousespeedx[i]<xd) then i:=0;
if xd<0 then xd2:=-i else xd2:=i;
end;
//y
if abs(yd)>mousespeedy[40] then
begin
//calculate the size of the movement
//(yd-mousespeedy[40]) = pixels needed to be moved (after a 40)
//(mousespeedy[40]-mousespeedy[35] / 5)=pixels moved for every step
yd2:=40+trunc((abs(yd)-mousespeedy[40])/((mousespeedy[40]-mousespeedy[35]) / 5));
if yd<0 then yd2:=-yd2;
end else
begin
//find the closest in the list
i:=20;
start:=1;
stop:=40;
while (i<stop) and not ((mousespeedy[i]<abs(yd)) and (mousespeedy[i+1]>yd)) do
begin
if mousespeedy[i]<abs(yd) then start:=i else stop:=i;
i:=start+(stop-start) div 2;
end;
if (i=1) and (mousespeedy[i]<yd) then i:=0;
if yd<0 then yd2:=-i else yd2:=i;
end;
r.left:=trunc(vp.Width/2)-20;
r.Top:=trunc(vp.Height/2)+100;
r.Right:=r.left+800;
r.Bottom:=r.top+16;
tempstring:=format('xd=%.2f xd2=%d',[xd,xd2]);
cefont.DrawTextA(nil,pchar(tempstring),length(tempstring),r,0,D3DCOLOR_ARGB(255,255,255,255));
mouse_event(MOUSEEVENTF_MOVE,xd2,yd2,0,0);
if ((bbb mod 4)=2) and autoshoot then
begin
if not shot then
begin
//if s>=(lastshot+intervalbetweenshots) then
begin
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); //fire
shot:=true;
end;
end;
end;
end;
end;
position.x:=xylist[closest].x-8;
position.y:=xylist[closest].y-8;
mysprite.Draw(locktexture,nil,nil,@position,D3DCOLOR_ARGB(255,255,255,255));
if mousecallibrationactive then
begin
case mousecallibrationmode of
//-----------------------------------------------
//1
//-----------------------------------------------
1:
begin
// move the mouse 1 point on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,1,0,0,0);
inc(mousecallibrationmode);
end;
2:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationhorizontal1point:=position.x-mousecallibrationpreviouspos.x;
mouse_event(MOUSEEVENTF_MOVE,dword(-1),0,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
3:
begin
//mouse should be back at starting pos so:
//move the mouse up 1 notch in the vertical direction
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,0,1,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
4:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationvertical1point:=position.y-mousecallibrationpreviouspos.y;
mouse_event(MOUSEEVENTF_MOVE ,0,dword(-1),0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
//-----------------------------------------------
//2
//-----------------------------------------------
5:
begin
// move the mouse 2 points on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,2,0,0,0);
inc(mousecallibrationmode);
end;
6:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationhorizontal2point:=position.x-mousecallibrationpreviouspos.x;
mouse_event(MOUSEEVENTF_MOVE,dword(-2),0,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
7:
begin
//mouse should be back at starting pos so:
//move the mouse up 2 points in the vertical direction
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,0,2,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
8:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationvertical2point:=position.y-mousecallibrationpreviouspos.y;
mouse_event(MOUSEEVENTF_MOVE ,0,dword(-2),0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
//------------------------------------------------------
//5
//------------------------------------------------------
9:
begin
// move the mouse 5 points on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,5,0,0,0);
inc(mousecallibrationmode);
end;
10:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationhorizontal5point:=position.x-mousecallibrationpreviouspos.x;
mouse_event(MOUSEEVENTF_MOVE,dword(-5),0,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
11:
begin
//mouse should be back at starting pos so:
//move the mouse up 5 points in the vertical direction
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,0,5,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
12:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationvertical5point:=position.y-mousecallibrationpreviouspos.y;
mouse_event(MOUSEEVENTF_MOVE ,0,dword(-5),0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
//------------------------------------------------------
//10
//------------------------------------------------------
13:
begin
// move the mouse 10 points on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,10,0,0,0);
inc(mousecallibrationmode);
end;
14:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationhorizontal10point:=position.x-mousecallibrationpreviouspos.x;
mouse_event(MOUSEEVENTF_MOVE,dword(-10),0,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
15:
begin
//mouse should be back at starting pos so:
//move the mouse up 10 points in the vertical direction
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,0,10,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
16:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationvertical10point:=position.y-mousecallibrationpreviouspos.y;
mouse_event(MOUSEEVENTF_MOVE ,0,dword(-10),0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
//------------------------------------------------------
//20
//------------------------------------------------------
17:
begin
// move the mouse 20 points on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,20,0,0,0);
inc(mousecallibrationmode);
end;
18:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationhorizontal20point:=position.x-mousecallibrationpreviouspos.x;
mouse_event(MOUSEEVENTF_MOVE,dword(-20),0,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
19:
begin
//mouse should be back at starting pos so:
//move the mouse up 20 points in the vertical direction
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,0,20,0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
20:
begin
//the mouse has been moved and this is a updated scene
//newpos-oldpos = change
mousecallibrationvertical20point:=position.y-mousecallibrationpreviouspos.y;
mouse_event(MOUSEEVENTF_MOVE ,0,dword(-20),0,0); //move back and wait for next frame
inc(mousecallibrationmode);
end;
//----------------------------------------
//40
//----------------------------------------
21:
begin
// move the mouse 40 points on the x axis
mousecallibrationpreviouspos.x:=position.x;
mousecallibrationpreviouspos.y:=position.y;
mouse_event(MOUSEEVENTF_MOVE ,40,0,0,0);
inc(mousecallibrationmode);
end;
22:
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -