UCRP_HASFOLLOWER

Self-explanatory.
- `Condition1 = HasFollower Buzz_Bomber`
    - "with Buzz Bomber in tow"
    - Combine with Podium checks or other completion-based challenges.
This commit is contained in:
toaster 2023-10-19 18:06:27 +01:00
parent 0478d9a2e3
commit d2d7830afc
3 changed files with 41 additions and 1 deletions

View file

@ -2844,6 +2844,13 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
return;
}
}
else if (fastcmp(params[0], "HASFOLLOWER"))
{
PARAMCHECK(1);
ty = UCRP_HASFOLLOWER;
stringvar = Z_StrDup(params[1]);
re = -1;
}
else if (fastcmp(params[0], "ISDIFFICULTY"))
{
//PARAMCHECK(1);

View file

@ -1103,7 +1103,7 @@ void M_FinaliseGameData(void)
void M_UpdateConditionSetsPending(void)
{
UINT32 i, j;
UINT32 i, j, k;
conditionset_t *c;
condition_t *cn;
@ -1139,6 +1139,29 @@ void M_UpdateConditionSetsPending(void)
break;
}
case UCRP_HASFOLLOWER:
{
// match deh_soc readfollower()
for (k = 0; cn->stringvar[k]; k++)
{
if (cn->stringvar[k] == '_')
cn->stringvar[k] = ' ';
}
cn->requirement = K_FollowerAvailable(cn->stringvar);
if (cn->requirement < 0)
{
CONS_Alert(CONS_WARNING, "UC TYPE %u: Invalid character %s for condition ID %d", cn->type, cn->stringvar, cn->id+1);
continue;
}
Z_Free(cn->stringvar);
cn->stringvar = NULL;
break;
}
case UCRP_WETPLAYER:
{
if (cn->extrainfo1)
@ -1460,6 +1483,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
skins[player->skin].kartweight,
skins[player->skin].flags
) == (unsigned)cn->requirement);
case UCRP_HASFOLLOWER:
return (cn->requirement != -1 && player->followerskin == cn->requirement);
case UCRP_ISDIFFICULTY:
if (grandprixinfo.gp == false)
return (gamespeed >= cn->requirement);
@ -2272,6 +2297,13 @@ static const char *M_GetConditionString(condition_t *cn)
return va("as %s", work);
case UCRP_ISENGINECLASS:
return va("with engine class %c", 'A' + cn->requirement);
case UCRP_HASFOLLOWER:
if (cn->requirement < 0 || !followers[cn->requirement].name[0])
return va("INVALID FOLLOWER CONDITION \"%d:%d\"", cn->type, cn->requirement);
work = (K_FollowerUsable(cn->requirement))
? followers[cn->requirement].name
: "???";
return va("with %s in tow", work);
case UCRP_ISDIFFICULTY:
{
const char *speedtext = "";

View file

@ -87,6 +87,7 @@ typedef enum
UCRP_ISCHARACTER, // character == [skin]
UCRP_ISENGINECLASS, // engine class [class]
UCRP_HASFOLLOWER, // follower == [followerskin]
UCRP_ISDIFFICULTY, // difficulty >= [difficulty]
UCRP_PODIUMCUP, // cup == [cup] [optional: >= grade OR place]