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

4
Source/control.h

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

Loading…
Cancel
Save