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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Copyright (C) 2018 Iru Cai <mytbk920423@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <windows.h>
void fcn_004021f8(int a1, int a2, int a3)
{
dw_48a0f4 = dw_46cb10 + 12 + a1 * 12;
w_48a170 = a2;
w_48a174 = a3;
w_48a172 = w_48a176 = 0;
GetCursorPos_35d(NULL);
GetCursorPos_250(NULL);
}
void fcn_00402460(int a1)
{
if (a1 == 1) {
b_48a178 = (uint8_t)a1;
if ((b_48a179 & 1) != 0)
return;
GetCursorPos_250(NULL);
return;
}
if ((b_48a179 & 1) != 0) {
GetCursorPos_35d(NULL);
}
b_48a178 = (uint8_t)a1;
}
/* 0x0040235d */
void GetCursorPos_35d(RECT *rect)
{
POINT p;
if (b_48a178 != 1)
return;
if (b_46caf9 != 0)
return;
if ((b_48a179 & 1) == 0)
return;
GetCursorPos(&p);
if (rect != NULL) {
eax = w_48a172 * 12 + dw_48a0f4;
edx = *(int16_t*)(eax + 4); /* sign extend */
edx = p.x - edx;
eax = *(int16_t*)(eax + 6);
eax = p.y - eax;
ecx = edx + 0x20;
esi = eax + 0x20;
if (edx >= rect->right || ecx <= rect->left || eax >= rect->bottom || esi <= rect->top) {
eax = dw_48a0ec;
if (eax >= rect->right)
return;
eax += 0x20;
if (eax <= rect->left)
return;
eax = dw_48a0f0;
if (eax >= rect->bottom)
return;
eax += 0x20;
if (eax <= rect->top)
return;
}
}
b_48a17a = 1;
IDirectDrawSurface_Lock(pddrawsf1, NULL, &sfdesc2, 1, 0);
st_46cb14.f8 = dw_48a11c;
fcn_00401f5e();
IDirectDrawSurface_Unlock(pddrawsf1, NULL);
b_48a17a = 0;
b_48a179 &= ~1;
}
/* 0x00402250 */
void GetCursorPos_250(RECT *rect)
{
POINT p;
if (b_48a178 != 1)
return;
if (b_46caf9 != 0)
return;
if ((b_48a179 & 1) == 0)
return;
GetCursorPos(&p);
if (rect != NULL) {
eax = w_48a172 * 12 + dw_48a0f4;
edx = *(int16_t*)(eax + 4); /* sign extend */
edx = p.x - edx;
eax = *(int16_t*)(eax + 6);
eax = p.y - eax;
ecx = edx + 0x20;
esi = eax + 0x20;
if (edx >= rect->right || ecx <= rect->left || eax >= rect->bottom || esi <= rect->top) {
eax = dw_48a0ec;
if (eax >= rect->right)
return;
eax += 0x20;
if (eax <= rect->left)
return;
eax = dw_48a0f0;
if (eax >= rect->bottom)
return;
eax += 0x20;
if (eax <= rect->top)
return;
}
}
b_48a17a = 1;
IDirectDrawSurface_Lock(pddrawsf1, NULL, &sfdesc2, 1, 0);
st_46cb14.f8 = dw_48a11c;
fcn_00401e59(p.x, p.y);
IDirectDrawSurface_Unlock(pddrawsf1, NULL);
b_48a17a = 0;
b_48a179 |= 1;
}
|