From 287472628b86043c3fffef88b02b6002c5e6d8a5 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Thu, 4 Oct 2018 17:20:19 +0800 Subject: set_cursor_icon --- csrc/cards.c | 8 ++++---- csrc/fcn_4021f8.c | 11 +++++++---- csrc/media_init.c | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/csrc/cards.c b/csrc/cards.c index d8b868c..bb5a650 100644 --- a/csrc/cards.c +++ b/csrc/cards.c @@ -1265,9 +1265,9 @@ int red_card() consume_a_card(current_player, 24); return 1; } else { - fcn.004021f8(12, 15, 10); + set_cursor_icon(12, 15, 10); int selected_stock = stock_ui(1); - fcn.004021f8(41, 1, 0); + set_cursor_icon(41, 1, 0); player_action_1(1); if (selected_stock == 0) return 0; @@ -1292,9 +1292,9 @@ int black_card() t[i] = stocks[i].f20; if (players[current_player].who_plays == 1) { - fcn.004021f8(12, 15, 10); + set_cursor_icon(12, 15, 10); sel = stock_ui(2); - fcn.004021f8(41, 1, 0); + set_cursor_icon(41, 1, 0); player_action_1(1); } else { sel = fcn.0041e6f2(0); diff --git a/csrc/fcn_4021f8.c b/csrc/fcn_4021f8.c index 9ffcc95..f5b81bf 100644 --- a/csrc/fcn_4021f8.c +++ b/csrc/fcn_4021f8.c @@ -4,10 +4,13 @@ */ #include +#include "mkf/mkf.h" -void fcn_004021f8(int a1, int a2, int a3) +struct graph_st *current_cursors; // 0x48a0f4 + +void set_cursor_icon(int data0_idx, int a2, int a3) { - dw_48a0f4 = &data0->chunk_tab[a1]; + current_cursors = &data0->chunk_tab[data0_idx]; w_48a170 = a2; w_48a174 = a3; w_48a172 = w_48a176 = 0; @@ -46,7 +49,7 @@ void GetCursorPos_35d(RECT *rect) GetCursorPos(&p); if (rect != NULL) { - eax = w_48a172 * 12 + dw_48a0f4; + eax = ¤t_cursors[w_48a172]; edx = *(int16_t*)(eax + 4); /* sign extend */ edx = p.x - edx; eax = *(int16_t*)(eax + 6); @@ -93,7 +96,7 @@ void GetCursorPos_250(RECT *rect) GetCursorPos(&p); if (rect != NULL) { - eax = w_48a172 * 12 + dw_48a0f4; + eax = ¤t_cursors[w_48a172]; edx = *(int16_t*)(eax + 4); /* sign extend */ edx = p.x - edx; eax = *(int16_t*)(eax + 6); diff --git a/csrc/media_init.c b/csrc/media_init.c index 87f7158..56367fb 100644 --- a/csrc/media_init.c +++ b/csrc/media_init.c @@ -679,7 +679,7 @@ bool initialize() ghook = SetWindowsHookExA(WH_KEYBOARD, kbdProc, ghInstance, 0); init_data_and_timer(); mciSendStringA_5ba(); /* 0x4545ba */ - fcn_004021f8(0x29, 1, 0); + set_cursor_icon(41, 1, 0); b_46caf8 = 0; b_46caf9 = 0; b_46cafd = 0; -- cgit v1.2.3