UCRP_RINGS, UCRP_RINGSEXACT

`Rings 10` - "with at least 10 Rings"
`RingsExact -14` - "with exactly -14 Rings"
(`Rings 20` will also be parsed as "with exactly -20 Rings")
This commit is contained in:
toaster 2023-10-15 00:17:20 +01:00
parent b2aac22856
commit 6b2e0a508d
3 changed files with 29 additions and 1 deletions

View file

@ -2935,6 +2935,19 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
return;
}
}
else if ((offset=0) || fastcmp(params[0], "RINGS")
|| (++offset && fastcmp(params[0], "RINGSEXACT")))
{
PARAMCHECK(1);
ty = UCRP_RINGS + offset;
re = get_number(params[1]);
if (re < -20 || re > 20)
{
deh_warning("Invalid ring count %d for condition ID %d", re, id+1);
return;
}
}
else if (fastcmp(params[0], "TRIGGER"))
{
PARAMCHECK(1);

View file

@ -1585,6 +1585,11 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
&& player->realtime < timelimitintics
&& (timelimitintics + extratimeintics + secretextratime - player->realtime) >= (unsigned)cn->requirement);
case UCRP_RINGS:
return (player->hudrings >= cn->requirement);
case UCRP_RINGSEXACT:
return (player->hudrings == cn->requirement);
case UCRP_TRIGGER: // requires map trigger set
return !!(player->roundconditions.unlocktriggers & (1 << cn->requirement));
@ -2260,6 +2265,13 @@ static const char *M_GetConditionString(condition_t *cn)
G_TicsToSeconds(cn->requirement),
G_TicsToCentiseconds(cn->requirement));
case UCRP_RINGS:
if (cn->requirement != 20)
return va("with at least %d Rings", cn->requirement);
// FALLTHRU
case UCRP_RINGSEXACT:
return va("with exactly %d Rings", cn->requirement);
case UCRP_TRIGGER:
return "do something special";

View file

@ -107,6 +107,9 @@ typedef enum
UCRP_FINISHTIMEEXACT, // Finish == [time, tics]
UCRP_FINISHTIMELEFT, // Finish with at least [time, tics] to spare
UCRP_RINGS, // Finish >= [rings]
UCRP_RINGSEXACT, // Finish == [rings]
UCRP_TRIGGER, // Map execution trigger [id]
UCRP_FALLOFF, // Fall off (or don't)
@ -119,7 +122,7 @@ typedef enum
UCRP_LANDMINEDUNK, // huh? you died? that's weird. all i did was try to hug you...
UCRP_HITMIDAIR, // Hit another player mid-air with a kartfielditem
UCRP_WETPLAYER, // Don't touch [fluid]
UCRP_WETPLAYER, // Don't touch [strictness] [fluid]
} conditiontype_t;
// Condition Set information