Browse Source

Merge pull request #935 from qndel/ReleaseChrBtns

ReleaseChrBtns bin exact
pull/88/head
Robin Eklind 7 years ago committed by GitHub
parent
commit
4d16a54da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 78
      Source/control.cpp
  2. 4
      Source/control.h
  3. 12
      structs.h

78
Source/control.cpp

@ -9,7 +9,7 @@ void *pChrButtons;
BOOL drawhpflag; // idb BOOL drawhpflag; // idb
BOOL dropGoldFlag; BOOL dropGoldFlag;
int panbtn[8]; int panbtn[8];
int chrbtn[4]; BOOL chrbtn[4];
void *pMultiBtns; void *pMultiBtns;
void *pPanelButtons; void *pPanelButtons;
void *pChrPanel; void *pChrPanel;
@ -154,7 +154,7 @@ char *PanBtnStr[8] = {
"Send Message", "Send Message",
"Player Attack" "Player Attack"
}; };
int attribute_inc_rects[4][4] = { RECT32 attribute_inc_rects[4] = {
{ 137, 138, 41, 22 }, { 137, 138, 41, 22 },
{ 137, 166, 41, 22 }, { 137, 166, 41, 22 },
{ 137, 195, 41, 22 }, { 137, 195, 41, 22 },
@ -2199,11 +2199,11 @@ void CheckChrBtns()
default: default:
continue; continue;
} }
if (MouseX >= attribute_inc_rects[i][0] if (MouseX >= attribute_inc_rects[i].x
&& MouseX <= attribute_inc_rects[i][0] + attribute_inc_rects[i][2] && MouseX <= attribute_inc_rects[i].x + attribute_inc_rects[i].w
&& MouseY >= attribute_inc_rects[i][1] && MouseY >= attribute_inc_rects[i].y
&& MouseY <= attribute_inc_rects[i][3] + attribute_inc_rects[i][1]) { && MouseY <= attribute_inc_rects[i].y + attribute_inc_rects[i].h) {
chrbtn[i] = 1; chrbtn[i] = TRUE;
chrbtnactive = TRUE; chrbtnactive = TRUE;
} }
} }
@ -2212,49 +2212,37 @@ void CheckChrBtns()
void ReleaseChrBtns() void ReleaseChrBtns()
{ {
signed int v0; // esi int i;
int *v1; // eax
signed int v2; // eax
int v3; // ecx
int v4; // ecx
unsigned char v5; // dl
chrbtnactive = FALSE; chrbtnactive = FALSE;
v0 = 0; for (i = 0; i < 4; ++i) {
do { if (chrbtn[i]) {
v1 = &chrbtn[v0]; chrbtn[i] = FALSE;
if (*v1) { if (MouseX >= attribute_inc_rects[i].x
*v1 = 0; && MouseX <= attribute_inc_rects[i].x + attribute_inc_rects[i].w
v2 = v0; && MouseY >= attribute_inc_rects[i].y
v3 = attribute_inc_rects[v0][0]; && MouseY <= attribute_inc_rects[i].y + attribute_inc_rects[i].h) {
if (MouseX >= v3 && MouseX <= v3 + attribute_inc_rects[v2][2]) { switch (i) {
v4 = attribute_inc_rects[v2][1]; case 0:
if (MouseY >= v4 && MouseY <= v4 + attribute_inc_rects[v2][3]) { NetSendCmdParam1(TRUE, CMD_ADDSTR, 1);
if (v0) { plr[myplr]._pStatPts--;
switch (v0) { break;
case ATTRIB_MAG: case 1:
v5 = CMD_ADDMAG; NetSendCmdParam1(TRUE, CMD_ADDMAG, 1);
break; plr[myplr]._pStatPts--;
case ATTRIB_DEX: break;
v5 = CMD_ADDDEX; case 2:
break; NetSendCmdParam1(TRUE, CMD_ADDDEX, 1);
case ATTRIB_VIT: plr[myplr]._pStatPts--;
v5 = CMD_ADDVIT; break;
break; case 3:
default: NetSendCmdParam1(TRUE, CMD_ADDVIT, 1);
goto LABEL_16; plr[myplr]._pStatPts--;
} break;
} else {
v5 = CMD_ADDSTR;
}
NetSendCmdParam1(TRUE, v5, 1u);
--plr[myplr]._pStatPts;
} }
} }
} }
LABEL_16: }
++v0;
} while (v0 < 4);
} }
void DrawDurIcon() void DrawDurIcon()

4
Source/control.h

@ -7,7 +7,7 @@ extern void *pChrButtons;
extern BOOL drawhpflag; // idb extern BOOL drawhpflag; // idb
extern BOOL dropGoldFlag; extern BOOL dropGoldFlag;
extern int panbtn[8]; extern int panbtn[8];
extern int chrbtn[4]; extern BOOL chrbtn[4];
extern void *pMultiBtns; extern void *pMultiBtns;
extern void *pPanelButtons; extern void *pPanelButtons;
extern void *pChrPanel; extern void *pChrPanel;
@ -131,7 +131,7 @@ extern char SpellITbl[MAX_SPELLS];
extern int PanBtnPos[8][5]; extern int PanBtnPos[8][5];
extern char *PanBtnHotKey[8]; extern char *PanBtnHotKey[8];
extern char *PanBtnStr[8]; extern char *PanBtnStr[8];
extern int attribute_inc_rects[4][4]; extern RECT32 attribute_inc_rects[4];
extern int SpellPages[6][7]; extern int SpellPages[6][7];
#endif /* __CONTROL_H__ */ #endif /* __CONTROL_H__ */

12
structs.h

@ -1,3 +1,15 @@
//////////////////////////////////////////////////
// control
//////////////////////////////////////////////////
// size: 0x10
typedef struct RECT32 {
int x;
int y;
int w;
int h;
} RECT32;
////////////////////////////////////////////////// //////////////////////////////////////////////////
// items // items
////////////////////////////////////////////////// //////////////////////////////////////////////////

Loading…
Cancel
Save