diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-09-03 21:12:33 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-09-03 21:12:33 +0800 |
commit | 60dc3a30c160a7cc04fafdd25d774018e4723903 (patch) | |
tree | bb79aa30032843ffff9272845c00fcf4daf29451 /csrc/cards_ui.c | |
parent | 1fa37379c1b21a3cebb751d3b88cc0574f22d01b (diff) | |
download | rich4-60dc3a30c160a7cc04fafdd25d774018e4723903.tar.xz |
cardProc
Diffstat (limited to 'csrc/cards_ui.c')
-rw-r--r-- | csrc/cards_ui.c | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/csrc/cards_ui.c b/csrc/cards_ui.c index 4a065fa..86ddfe5 100644 --- a/csrc/cards_ui.c +++ b/csrc/cards_ui.c @@ -39,6 +39,86 @@ int fcn_4018e7(wProc a1, int a2) } } + +LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x4416f0 +{ + ebx = hWnd; + eax = message; + edx = lp; + + PAINTSTRUCT ps; /* esp */ + RECT rect; /* esp+8 */ + + if (message >= 0x202) { + if (message == WM_LBUTTONUP) { + if (dword [0x48c544] == 0) + return 0; + fcn.00451d4e(); + fcn.00402460(0); + sub.USER32.dll_PostMessageA_966(dword [0x48c544]); + return 0; + } + if (message >= 0x205) { + if (message == WM_RBUTTONUP) { + fcn.00402460(0); + sub.USER32.dll_PostMessageA_966(0); + return 0; + } + if (message == 0x401) { + dw_48c544 = 0; + fcn.00402460(1); + InvalidateRect(hWnd, NULL, FALSE); + return 0; + } + return DefWindowProcA(hWnd, message, wp, lp); + } else { + return DefWindowProcA(hWnd, message, wp, lp); + } + } + + if (message >= 0xf) { + if (message == 0xf) { + BeginPaint(hWnd, &ps); + GetCursorPos_35d(&rect); /* fcn_4021f8.c */ + IDirectDrawSurface_BltFast(pddrawsf1, rect.left, rect.top, pddrawsf2, &rect, 0x10); + GetCursorPos_250(&rect); /* fcn_4021f8.c */ + EndPaint(hWnd, &ps); + return 0; + } + if (message == 0x201) { + ebx = (uint16_t)dx; + edx >>= 16; /* unsigned shift */ + if (ebx < 0x13 || ebx >= 0x1a3 || edx < 0x87 || edx >= 0x12f) + return 0; + + eax = (edx-0x87) / 56; + esi = eax * 5; + eax = (ebx - 0x13) / 80; + ebx = esi + eax; + eax = current_player * 15; + if (byte [ebx + eax + 0x499120] == 0) + return 0; + + eax = (ebx % 5) * 80; + [esp+0x40] = eax + 0x14; + [esp+0x48] = eax + 0x62; + [esp+0x44] = (ebx / 5) * 56 + 0x88; + [esp+0x4c] = (ebx / 5) * 56 + 0xbe; + fcn.00451b9e(esp+0x40); + + ebx += current_player * 15; + eax = byte [ebx + 0x499120]; + dword [0x48c544] = eax; + fcn.004542ce(0x482322, 0); + return 0; + } + return DefWindowProcA(hWnd, message, wp, lp); + } else { + return DefWindowProcA(hWnd, message, wp, lp); + } + +} + void cards_ui() { int t[4]; /* esp + 0x80 */ @@ -61,7 +141,7 @@ void cards_ui() IDirectDrawSurface_Lock(pddrawsf2, NULL, &sfdesc1, 1, 0); fcn_004563f5(dw_48a08c, edi+12, 14, 130); IDirectDrawSurface_Unlock(pddrawsf2, NULL); - ebx = fcn_4018e7(0x4416f0, 0); + ebx = fcn_4018e7(cardProc, 0); fcn_00451edb(ebp, 0, 0x8028); if (ebx != 0) { edx = cards_table[ebx].name_ptr; /* cards_table has 8 bytes per item */ |