Browse Source

Clean up UseScroll

pull/88/head
Anders Jenbo 7 years ago
parent
commit
797cf17c19
  1. 47
      Source/inv.cpp
  2. 2
      Source/inv.h

47
Source/inv.cpp

@ -2115,7 +2115,7 @@ BOOL __fastcall CanPut(int x, int y)
return TRUE; return TRUE;
} }
int __cdecl TryInvPut() BOOL __cdecl TryInvPut()
{ {
int dir; int dir;
@ -2524,38 +2524,29 @@ void __fastcall RemoveScroll(int pnum)
BOOL __cdecl UseScroll() BOOL __cdecl UseScroll()
{ {
int v0; // eax int i;
int v1; // esi
int v2; // ecx
int *v3; // edx
signed int v4; // esi
int *v5; // ecx
if (pcurs != CURSOR_HAND || leveltype == DTYPE_TOWN && !spelldata[plr[myplr]._pRSpell].sTownSpell) if (pcurs != CURSOR_HAND)
return FALSE;
if (leveltype == DTYPE_TOWN && !spelldata[plr[myplr]._pRSpell].sTownSpell)
return FALSE; return FALSE;
v0 = myplr;
v1 = 0; for (i = 0; i < plr[myplr]._pNumInv; i++) {
v2 = plr[myplr]._pNumInv; if (plr[myplr].InvList[i]._itype != -1
if (v2 <= 0) { && (plr[myplr].InvList[i]._iMiscId == IMISC_SCROLL || plr[myplr].InvList[i]._iMiscId == IMISC_SCROLLT)
LABEL_11: && plr[myplr].InvList[i]._iSpell == plr[myplr]._pRSpell) {
v4 = 0; return TRUE;
v5 = &plr[v0].SpdList[0]._iMiscId;
while (*(v5 - 53) == -1 || *v5 != IMISC_SCROLL && *v5 != IMISC_SCROLLT || v5[1] != plr[v0]._pRSpell) {
++v4;
v5 += 92;
if (v4 >= MAXBELTITEMS)
return FALSE;
} }
} else { }
v3 = &plr[v0].InvList[0]._iMiscId; for (i = 0; i < MAXBELTITEMS; i++) {
while (*(v3 - 53) == -1 || *v3 != IMISC_SCROLL && *v3 != IMISC_SCROLLT || v3[1] != plr[v0]._pRSpell) { if (plr[myplr].SpdList[i]._itype != -1
++v1; && (plr[myplr].SpdList[i]._iMiscId == IMISC_SCROLL || plr[myplr].SpdList[i]._iMiscId == IMISC_SCROLLT)
v3 += 92; && plr[myplr].SpdList[i]._iSpell == plr[myplr]._pRSpell) {
if (v1 >= v2) return TRUE;
goto LABEL_11;
} }
} }
return TRUE;
return FALSE;
} }
void __fastcall UseStaffCharge(int pnum) void __fastcall UseStaffCharge(int pnum)

2
Source/inv.h

@ -31,7 +31,7 @@ void __fastcall AutoGetItem(int pnum, int ii);
int __fastcall FindGetItem(int indx, WORD ci, int iseed); int __fastcall FindGetItem(int indx, WORD ci, int iseed);
void __fastcall SyncGetItem(int x, int y, int idx, WORD ci, int iseed); void __fastcall SyncGetItem(int x, int y, int idx, WORD ci, int iseed);
BOOL __fastcall CanPut(int x, int y); BOOL __fastcall CanPut(int x, int y);
int __cdecl TryInvPut(); BOOL __cdecl TryInvPut();
void __fastcall DrawInvMsg(char *msg); void __fastcall DrawInvMsg(char *msg);
int __fastcall InvPutItem(int pnum, int x, int y); int __fastcall InvPutItem(int pnum, int x, int y);
int __fastcall SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, unsigned int ibuff); int __fastcall SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, unsigned int ibuff);

Loading…
Cancel
Save