[Scummvm-git-logs] scummvm master -> 5dda3f7fd1fe55cf5d693f8b7fe03e5c7d72d571
dreammaster
noreply at scummvm.org
Thu Jan 26 03:14:40 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5dda3f7fd1 MM: MM1: Fix item selection in selectTreasure2
Commit: 5dda3f7fd1fe55cf5d693f8b7fe03e5c7d72d571
https://github.com/scummvm/scummvm/commit/5dda3f7fd1fe55cf5d693f8b7fe03e5c7d72d571
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-01-25T19:14:35-08:00
Commit Message:
MM: MM1: Fix item selection in selectTreasure2
Changed paths:
engines/mm/mm1/game/combat.cpp
diff --git a/engines/mm/mm1/game/combat.cpp b/engines/mm/mm1/game/combat.cpp
index 9848b2c3dae..d6880fb5999 100644
--- a/engines/mm/mm1/game/combat.cpp
+++ b/engines/mm/mm1/game/combat.cpp
@@ -406,28 +406,25 @@ void Combat::selectTreasure() {
void Combat::selectTreasure2(int count) {
_treasureFlags[count - 1] = true;
+ // Select item base and step offset
int idx = getRandomNumber(0, 5);
- // FIXME: Should these be used instead of _val1 class variable?
-#if 0
static const byte TREASURES_ARR1[6] = { 1, 61, 86, 121, 156, 171 };
static const byte TREASURES_ARR2[6] = { 12, 5, 7, 7, 3, 12 };
- byte val1 = TREASURES_ARR1[idx];
- byte val2 = TREASURES_ARR2[idx];
-#endif
+ byte itemId = TREASURES_ARR1[idx];
+ byte rndCount = TREASURES_ARR2[idx];
for (idx = 0; idx < count; ++idx)
- _val1 += _allowFight;
-
- _val1 += getRandomNumber(_allowFight) - 1;
+ itemId += rndCount;
+ itemId += getRandomNumber(rndCount) - 1;
auto &treasure = g_globals->_treasure;
if (!treasure._items[0])
- treasure._items[0] = _val1;
+ treasure._items[0] = itemId;
else if (!treasure._items[1])
- treasure._items[1] = _val1;
+ treasure._items[1] = itemId;
else if (!treasure._items[2])
- treasure._items[2] = _val1;
+ treasure._items[2] = itemId;
}
void Combat::nextRound() {
More information about the Scummvm-git-logs
mailing list