Browse Source

Stores.cpp (#551)

* Clean up FreeStoreMem

* Clean up AddSLine

* Clean up AddSText

* Clean up SmithSellOk
pull/25/head
Anders Jenbo 7 years ago committed by Robin Eklind
parent
commit
57d7c99a8f
  1. 4
      Source/inv.cpp
  2. 76
      Source/stores.cpp
  3. 4
      Source/stores.h
  4. 2
      structs.h

4
Source/inv.cpp

@ -1029,7 +1029,7 @@ LABEL_18:
goto LABEL_146;
qmemcpy(&tempitem, &plr[v3].HoldItem, sizeof(tempitem));
v27 = &plr[v3].InvBody[INVLOC_HAND_RIGHT];
if (v26 != 5)
if (v26 != ITYPE_SHIELD)
v27 = &plr[v3].InvBody[INVLOC_HAND_LEFT];
v28 = p;
qmemcpy(&plr[v3].HoldItem, v27, sizeof(plr[v3].HoldItem));
@ -1242,7 +1242,7 @@ LABEL_18:
}
v54 = *(int *)((char *)&plr[0].SpdList[0]._itype + v53);
if (v54 != -1) {
if (v54 == 11) {
if (v54 == ITYPE_GOLD) {
v55 = *(int *)((char *)&plr[0].SpdList[0]._ivalue + v53);
v56 = plr[v3].HoldItem._ivalue;
v57 = v55 + v56;

76
Source/stores.cpp

@ -132,19 +132,17 @@ void __cdecl SetupTownStores()
void __cdecl FreeStoreMem()
{
void *v0; // ecx
void *v1; // ecx
void *v2; // ecx
void *p;
v0 = pSTextBoxCels;
pSTextBoxCels = 0;
mem_free_dbg(v0);
v1 = pCelBuff;
pCelBuff = 0;
mem_free_dbg(v1);
v2 = pSTextSlidCels;
pSTextSlidCels = 0;
mem_free_dbg(v2);
p = pSTextBoxCels;
pSTextBoxCels = NULL;
mem_free_dbg(p);
p = pCelBuff;
pCelBuff = NULL;
mem_free_dbg(p);
p = pSTextSlidCels;
pSTextSlidCels = NULL;
mem_free_dbg(p);
}
void __cdecl DrawSTextBack()
@ -373,13 +371,10 @@ void __fastcall ClearSText(int s, int e)
void __fastcall AddSLine(int y)
{
int v1; // ecx
v1 = y;
stext[v1]._sx = 0;
stext[v1]._syoff = 0;
stext[v1]._sstr[0] = 0;
stext[v1]._sline = 1;
stext[y]._sx = 0;
stext[y]._syoff = 0;
stext[y]._sstr[0] = 0;
stext[y]._sline = 1;
}
void __fastcall AddSTextVal(int y, int val)
@ -392,18 +387,15 @@ void __fastcall OffsetSTextY(int y, int yo)
stext[y]._syoff = yo;
}
void __fastcall AddSText(int x, int y, unsigned char j, char *str, int clr, int sel)
void __fastcall AddSText(int x, int y, int j, char *str, int clr, int sel)
{
int v6; // esi
v6 = y;
stext[v6]._syoff = 0;
stext[v6]._sx = x;
stext[y]._sx = x;
stext[y]._syoff = 0;
strcpy(stext[y]._sstr, str);
stext[v6]._sline = 0;
stext[v6]._sjust = j;
_LOBYTE(stext[v6]._sclr) = clr;
stext[v6]._ssel = sel;
stext[y]._sjust = j;
stext[y]._sclr = clr;
stext[y]._sline = 0;
stext[y]._ssel = sel;
}
void __cdecl StoreAutoPlace()
@ -829,16 +821,22 @@ BOOLEAN __cdecl S_StartSPBuy()
// 6A6BB8: using guessed type int stextscrl;
// 6A8A28: using guessed type int stextsel;
BOOLEAN __fastcall SmithSellOk(int i)
{
if (plr[myplr].InvList[i]._itype != ITYPE_NONE
&& plr[myplr].InvList[i]._itype
&& plr[myplr].InvList[i]._itype != ITYPE_GOLD
&& plr[myplr].InvList[i]._itype != ITYPE_0E
&& plr[myplr].InvList[i]._itype != ITYPE_STAFF)
return plr[myplr].InvList[i].IDidx != IDI_LAZSTAFF;
else
return 0;
BOOL __fastcall SmithSellOk(int i)
{
if (plr[myplr].InvList[i]._itype == ITYPE_NONE)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_MISC)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_GOLD)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_0E)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_STAFF)
return FALSE;
if (plr[myplr].InvList[i].IDidx == IDI_LAZSTAFF)
return FALSE;
return TRUE;
}
void __fastcall S_ScrollSSell(int idx)

4
Source/stores.h

@ -48,7 +48,7 @@ void __fastcall ClearSText(int s, int e);
void __fastcall AddSLine(int y);
void __fastcall AddSTextVal(int y, int val);
void __fastcall OffsetSTextY(int y, int yo);
void __fastcall AddSText(int x, int y, unsigned char j, char *str, int clr, int sel);
void __fastcall AddSText(int x, int y, int j, char *str, int clr, int sel);
void __cdecl StoreAutoPlace();
void __cdecl S_StartSmith();
void __fastcall S_ScrollSBuy(int idx);
@ -56,7 +56,7 @@ void __fastcall PrintStoreItem(ItemStruct *x, int l, char iclr);
void __cdecl S_StartSBuy();
void __fastcall S_ScrollSPBuy(int idx);
BOOLEAN __cdecl S_StartSPBuy();
BOOLEAN __fastcall SmithSellOk(int i);
BOOL __fastcall SmithSellOk(int i);
void __fastcall S_ScrollSSell(int idx);
void __cdecl S_StartSSell();
BOOLEAN __fastcall SmithRepairOk(int i);

2
structs.h

@ -1521,7 +1521,7 @@ typedef struct STextStruct {
int _syoff;
char _sstr[128];
int _sjust;
int _sclr;
char _sclr;
int _sline;
int _ssel;
int _sval;

Loading…
Cancel
Save