From e0ca98602dc7398c619bd8749f00967172a77ef7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Aug 2020 22:29:45 +0200 Subject: [PATCH] - made Blood's inventory cycle-able. IMO it's a totally annoying limitations to block wraparound of the cursor. --- source/blood/src/player.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index e65348fc3..7600c4ab0 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -545,29 +545,42 @@ void packPrevItem(PLAYER *pPlayer) { if (pPlayer->packItemTime > 0) { - for (int nPrev = ClipLow(pPlayer->packItemId-1,0); nPrev >= 0; nPrev--) + for (int i = 0; i < 2; i++) { - if (pPlayer->packSlots[nPrev].curAmount) + for (int nPrev = pPlayer->packItemId-1; nPrev >= 0; nPrev--) { - pPlayer->packItemId = nPrev; - break; + if (pPlayer->packSlots[nPrev].curAmount) + { + pPlayer->packItemId = nPrev; + pPlayer->packItemTime = 600; + return; + } } + pPlayer->packItemId = 4; + if (pPlayer->packSlots[4].curAmount) break; } } + pPlayer->packItemTime = 600; } -void packNextItem(PLAYER *pPlayer) +void packNextItem(PLAYER* pPlayer) { if (pPlayer->packItemTime > 0) { - for (int nNext = ClipHigh(pPlayer->packItemId+1,5); nNext < 5; nNext++) + for (int i = 0; i < 2; i++) { - if (pPlayer->packSlots[nNext].curAmount) + for (int nNext = pPlayer->packItemId + 1; nNext < 5; nNext++) { - pPlayer->packItemId = nNext; - break; + if (pPlayer->packSlots[nNext].curAmount) + { + pPlayer->packItemId = nNext; + pPlayer->packItemTime = 600; + return; + } } + pPlayer->packItemId = 0; + if (pPlayer->packSlots[0].curAmount) break; } } pPlayer->packItemTime = 600;