diff --git a/Source/inv.cpp b/Source/inv.cpp index 02f344106..cda1b6f25 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1564,6 +1564,48 @@ void RemoveInvItem(int pnum, int iv) } } +#ifdef HELLFIRE +BOOL inv_420FD0(int pnum) +{ + ItemStruct tmp; + ItemStruct *item; + int i, old_item_cnt, new_item_index; + + if (plr[pnum]._pgfxnum != 0) { + plr[pnum]._pgfxnum = 0; + plr[pnum]._pGFXLoad = 0; + SetPlrAnims(pnum); + } + for (i = 0, item = plr[pnum].InvBody; i < NUM_INVLOC; i++, item++) { + item->_itype = ITYPE_NONE; + } + old_item_cnt = plr[pnum]._pNumInv; + memset(plr[pnum].InvGrid, 0, sizeof (plr[pnum].InvGrid)); + plr[pnum]._pNumInv = 0; + for (i = 0; i < old_item_cnt; i++) { + item = &plr[pnum].InvList[i]; + if (item->_itype == ITYPE_GOLD) { + new_item_index = plr[pnum]._pNumInv; + // BUGFIX: new_item_index may be greater or equal to NUM_INV_GRID_ELEM + tmp = *item; + item->_itype = ITYPE_NONE; + plr[pnum].InvList[new_item_index] = tmp; + plr[pnum]._pNumInv++; + plr[pnum].InvGrid[i] = plr[pnum]._pNumInv; + } + else { + item->_itype = ITYPE_NONE; + } + } + ; + for (i = 0, item = plr[pnum].SpdList; i < MAXBELTITEMS; i++, item++) { + item->_itype = ITYPE_NONE; + } + CalcPlrItemVals(pnum, FALSE); + return FALSE; +} +#endif + void RemoveSpdBarItem(int pnum, int iv) { plr[pnum].SpdList[iv]._itype = ITYPE_NONE; diff --git a/Source/inv.h b/Source/inv.h index 0ef9c39ca..ef3dbd554 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -20,6 +20,9 @@ void CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, BOOL bId); void CheckInvCut(int pnum, int mx, int my); void inv_update_rem_item(int pnum, BYTE iv); void RemoveInvItem(int pnum, int iv); +#ifdef HELLFIRE +BOOL inv_420FD0(int pnum); +#endif void RemoveSpdBarItem(int pnum, int iv); void CheckInvItem(); void CheckInvScrn();