forked from elastomania/across
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MOUSE386.CPP
102 lines (84 loc) · 1.82 KB
/
MOUSE386.CPP
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "all.h"
int Enmou, Resolmou;
int Mostmoux, Mostmouy;
int Xsize, Ysize;
void initmou( int xs, int ys ) {
union REGS inregs, outregs;
inregs.x.eax = 0;
int386( 51, &inregs, &outregs );
Resolmou = 3;
Enmou = 1;
Xsize = xs<<Resolmou;
Ysize = ys<<Resolmou;
inregs.x.eax = 15;
inregs.x.ecx = 1;
inregs.x.edx = 1;
int386( 51, &inregs, &outregs);
inregs.x.eax=7;
inregs.x.ecx=0;
inregs.x.edx=10000;
int386(51,&inregs,&outregs);
inregs.x.eax=8;
inregs.x.ecx=0;
inregs.x.edx=10000;
int386(51,&inregs,&outregs);
inregs.x.eax=4;
inregs.x.ecx=5000;
inregs.x.edx=5000;
int386(51,&inregs,&outregs);
}
int getmou( int* px, int* py ) {
int i;
union REGS inregs,outregs;
inregs.x.eax=3;
int386(51,&inregs,&outregs);
if( Enmou ) {
Mostmoux = Mostmoux + (((unsigned short)(outregs.x.ecx))-5000);
Mostmouy = Mostmouy + (((unsigned short)(outregs.x.edx))-5000);
}
if( Mostmoux < 0 )
Mostmoux = 0;
if( Mostmoux >= Xsize )
Mostmoux = Xsize-1;
if( Mostmouy < 0 )
Mostmouy = 0;
if( Mostmouy >= Ysize )
Mostmouy = Ysize-1;
*px = Mostmoux>>Resolmou;
*py = Mostmouy>>Resolmou;
i=(outregs.x.ecx!=5000 || outregs.x.edx!=5000) && Enmou;
inregs.x.eax=4;
inregs.x.ecx=5000;
inregs.x.edx=5000;
int386(51,&inregs,&outregs);
return i;
}
void setmou( int x, int y ) {
Mostmoux = x*(1<<Resolmou);
Mostmouy = y*(1<<Resolmou);
}
int getbutbmou( void ) {
union REGS inregs,outregs;
inregs.x.eax=5;
inregs.x.ebx=0;
int386(51,&inregs,&outregs);
return outregs.x.ebx>0;
}
int getbutjmou( void ) {
union REGS inregs,outregs;
inregs.x.eax=5;
inregs.x.ebx=1;
int386(51,&inregs,&outregs);
return outregs.x.ebx>0;
}
void setresolmou( int k ) {
double valt;
int i = k-Resolmou;
if(i>0)
valt=1<<i;
else
valt=1/((double)((int) 1 << (-i)));
Mostmoux = Mostmoux*valt;
Mostmouy = Mostmouy*valt;
Resolmou = k;
}