summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-09 22:31:20 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-09 22:31:46 +0800
commit793f4edb3e7733b2ceb22ddb7a621ab9cf7a3981 (patch)
tree32e5bf1e670ed6c301c25e915dfd9d0682ebeff8
parent4c4e478baca326252066fe5bfd97ff5115999fa5 (diff)
downloadrich4-793f4edb3e7733b2ceb22ddb7a621ab9cf7a3981.tar.xz
name selected_{card,tool}, player_cards
-rw-r--r--csrc/cards_ui.c22
-rw-r--r--csrc/player_info.h1
-rw-r--r--csrc/tools_ui.c12
3 files changed, 18 insertions, 17 deletions
diff --git a/csrc/cards_ui.c b/csrc/cards_ui.c
index 8fbce48..49cfd49 100644
--- a/csrc/cards_ui.c
+++ b/csrc/cards_ui.c
@@ -2,6 +2,8 @@
#include "global.h"
#include "sound_struct.h"
+uint8_t player_cards[60]; // 0x499120
+int selected_card; // 0x48c544
const char str_use[] = "\xa8\xcf\xa5\xce%s"; // 使用%s
typedef struct
@@ -70,18 +72,18 @@ void fcn_4542ce(sound_struct * a0, int a1)
fcn_4540d8(a0->sbuf, a0->f0, a1);
}
-LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x4416f0
+LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp)
{
- PAINTSTRUCT ps; /* esp */
- RECT rect2; /* esp+0x40 */
+ PAINTSTRUCT ps;
+ RECT rect2;
if (message >= 0x202) {
if (message == WM_LBUTTONUP) {
- if (dword [0x48c544] == 0)
+ if (selected_card == 0)
return 0;
fcn.00451d4e();
fcn.00402460(0);
- Post_0402_Message(dword [0x48c544]);
+ Post_0402_Message(selected_card);
return 0;
}
if (message >= 0x205) {
@@ -91,7 +93,7 @@ LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x44
return 0;
}
if (message == 0x401) {
- dw_48c544 = 0;
+ selected_card = 0;
fcn.00402460(1);
InvalidateRect(hWnd, NULL, FALSE);
return 0;
@@ -120,7 +122,7 @@ LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x44
esi = ((edx - 0x87) / 56) * 5;
ebx = esi + (ebx - 0x13) / 80;
eax = current_player * 15;
- if (byte [ebx + eax + 0x499120] == 0)
+ if (player_cards[current_player * 15 + ebx] == 0)
return 0;
int t1 = (ebx % 5) * 80;
@@ -131,9 +133,8 @@ LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x44
rect2.bottom = t2 + 0xbe;
fcn.00451b9e(&rect2);
- ebx += current_player * 15;
- eax = byte [ebx + 0x499120];
- dword [0x48c544] = eax;
+ eax = player_cards[current_player * 15 + ebx];
+ selected_card = eax;
fcn_4542ce(&snd0, 0);
return 0;
}
@@ -141,7 +142,6 @@ LRESULT CALLBACK cardProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp) // 0x44
} else {
return DefWindowProcA(hWnd, message, wp, lp);
}
-
}
void cards_ui()
diff --git a/csrc/player_info.h b/csrc/player_info.h
index 175353f..616422b 100644
--- a/csrc/player_info.h
+++ b/csrc/player_info.h
@@ -65,4 +65,5 @@ extern player_info rich4_players[]; /* 0x47e80c */
extern int nplayers; /* 0x499114 */
extern int current_player; /* 0x49910c */
+extern uint8_t player_cards[60]; /* 0x499120 */
extern uint8_t tool_amount[60]; /* 0x49915c */
diff --git a/csrc/tools_ui.c b/csrc/tools_ui.c
index efda386..a580b7e 100644
--- a/csrc/tools_ui.c
+++ b/csrc/tools_ui.c
@@ -3,6 +3,7 @@
const char str_cross_sym[] = "\xa1\xd1%d"; // x%d
char tab_48c548[16];
+int selected_tool; // 0x48c560
uint8_t tool_amount[60]; // 0x49915c 4*15
void fcn_447c6e(struct st *a1, struct st *a2, int player)
@@ -46,11 +47,11 @@ LRESULT CALLBACK toolsProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp)
if (message >= 0x202) {
if (message == 0x202) {
- if (dw_48c560 == 0)
+ if (selected_tool == 0)
return 0;
fcn.00451d4e();
fcn.00402460(0);
- Post_0402_Message(dw_48c560);
+ Post_0402_Message(selected_tool);
return 0;
}
if (message < 0x205) {
@@ -65,7 +66,7 @@ LRESULT CALLBACK toolsProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp)
return DefWindowProcA(hWnd, message, wp, lp);
} else {
edx = 0;
- dw_48c560 = 0;
+ selected_tool = 0;
fcn_00402460(1);
InvalidateRect(hWnd, NULL, FALSE);
return 0;
@@ -95,7 +96,7 @@ LRESULT CALLBACK toolsProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp)
ecx = ((edx - 0x87) / 56) * 5;
eax = (ebx - 0x13) / 80;
ebx = ecx + eax;
- if (byte [0x48c548 + ebx] == 0)
+ if (tab_48c548[ebx] == 0)
return 0;
eax = (ebx % 5) * 80;
@@ -107,8 +108,7 @@ LRESULT CALLBACK toolsProc(HWND hWnd, UINT message, WPARAM wp, LPARAM lp)
r1.bottom = eax + 0xbe;
fcn.00451b9e(&r1);
- eax = byte [ebx + 0x48c548];
- dw_48c560 = eax;
+ selected_tool = tab_48c548[ebx];
fcn_4542ce(&snd0, 0);
return 0;
}