UnlockPercent: Add fudge value

If you're hypothetically gating a Character behind 100% of Characters unlocked... that'll never come true!
To that end, allow a fudge value to be specified.
It's added to the unlock count before comparing it against the percentage.
This commit is contained in:
toaster 2023-10-20 14:27:19 +01:00
parent d122ddf1c7
commit dc72602b00
2 changed files with 10 additions and 3 deletions

View file

@ -2765,7 +2765,16 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
deh_warning("Condition challenge type \"%s\" invalid for condition ID %d", params[2], id+1);
return;
}
x2 = 0;
if (params[3])
{
// fudge value
x2 = atoi(params[3]);
}
}
else
x2 = 1; // guaranteed fudge for raw Unlockables count
}
else if ((offset=0) || fastcmp(params[0], "ADDON")
|| (++offset && fastcmp(params[0], "CREDITS"))

View file

@ -1351,7 +1351,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
case UC_UNLOCKPERCENT:
{
UINT16 i, unlocked = 0, total = 0;
UINT16 i, unlocked = cn->extrainfo2, total = 0;
// Special case for maps
if (cn->extrainfo1 == SECRET_MAP)
@ -1396,8 +1396,6 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
unlocked++;
}
unlocked++; // Try to account for this one too
}
else
{