diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-08-28 21:08:18 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-08-28 21:08:18 +0800 |
commit | b28de07b875088906b51f53f653f1f14fe38d328 (patch) | |
tree | d7afad016a72c1bfade120442071d38e2f671f7b | |
parent | b321cda560d417617df3713489b4a57cc4a00911 (diff) | |
download | rich4-b28de07b875088906b51f53f653f1f14fe38d328.tar.xz |
fcn_4021f8
-rw-r--r-- | csrc/fcn_4021f8.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/csrc/fcn_4021f8.c b/csrc/fcn_4021f8.c new file mode 100644 index 0000000..3c0f8dd --- /dev/null +++ b/csrc/fcn_4021f8.c @@ -0,0 +1,103 @@ +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(0); +} + +/* 0x0040235d */ +void GetCursorPos_35d(int * a1) +{ + POINT p; /* @ esp */ + + if (b_48a178 != 1) + return; + + if (b_46caf9 != 0) + return; + + if ((b_48a179 & 1) == 0) + return; + + GetCursorPos(&p); + if (a1 != 0) { + 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 >= a1[2] || ecx <= a1[0] || eax >= a1[3] || esi <= a1[1]) { + eax = dw_48a0ec; + if (eax >= a1[2]) + return; + eax += 0x20; + if (eax <= a1[0]) + return; + eax = dw_48a0f0; + if (eax >= a1[3]) + return; + eax += 0x20; + if (eax <= a1[1]) + return; + } + } + b_48a17a = 1; + IDirectDrawSurface_Lock(pddrawsf1, NULL, &sfdesc2, 1, 0); + dw_46cb1c = dw_48a11c; + fcn_00401f5e(); + IDirectDrawSurface_Unlock(pddrawsf1, NULL); + b_48a17a = 0; + b_48a179 &= ~1; +} + +/* 0x00402250 */ +void GetCursorPos_250(int * a1) +{ + POINT p; + + if (b_48a178 != 1) + return; + + if (b_46caf9 != 0) + return; + + if ((b_48a179 & 1) == 0) + return; + + GetCursorPos(&p); + if (a1 != 0) { + 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 >= a1[2] || ecx <= a1[0] || eax >= a1[3] || esi <= a1[1]) { + eax = dw_48a0ec; + if (eax >= a1[2]) + return; + eax += 0x20; + if (eax <= a1[0]) + return; + eax = dw_48a0f0; + if (eax >= a1[3]) + return; + eax += 0x20; + if (eax <= a1[1]) + return; + } + } + b_48a17a = 1; + IDirectDrawSurface_Lock(pddrawsf1, NULL, &sfdesc2, 1, 0); + dw_46cb1c = dw_48a11c; + fcn_00401e59(p.x, p.y); + IDirectDrawSurface_Unlock(pddrawsf1, NULL); + b_48a17a = 0; + b_48a179 |= 1; +} |