mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-01 08:51:21 +00:00
M_CheckCondition, conditiontype_t, etc: More fine-grained control over your condition string
- UCRP_PREFIX_ISMAP: a prefix version of UCRP_ISMAP
- The condition string for UC_EMBLEM has been updated to match other relevant prefixes.
- UC_COMMA: a second string-relevance-only condition, for inserting a comma where only a human could find it natural
This commit is contained in:
parent
bd54a789a2
commit
06bde8b40e
3 changed files with 34 additions and 19 deletions
|
|
@ -2487,10 +2487,11 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
|
|||
//PARAMCHECK(1);
|
||||
ty = UC_CRASH;
|
||||
}
|
||||
else if (fastcmp(params[0], "AND"))
|
||||
else if ((offset=0) || fastcmp(params[0], "AND")
|
||||
|| (++offset && fastcmp(params[0], "COMMA")))
|
||||
{
|
||||
//PARAMCHECK(1);
|
||||
ty = UC_AND;
|
||||
ty = UC_AND + offset;
|
||||
}
|
||||
else if ((offset=0) || fastcmp(params[0], "PREFIX_GRANDPRIX")
|
||||
|| (++offset && fastcmp(params[0], "PREFIX_BONUSROUND"))
|
||||
|
|
@ -2501,10 +2502,11 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
|
|||
//PARAMCHECK(1);
|
||||
ty = UCRP_PREFIX_GRANDPRIX + offset;
|
||||
}
|
||||
else if (fastcmp(params[0], "ISMAP"))
|
||||
else if ((offset=0) || fastcmp(params[0], "PREFIX_ISMAP")
|
||||
|| (++offset && fastcmp(params[0], "ISMAP")))
|
||||
{
|
||||
PARAMCHECK(1);
|
||||
ty = UCRP_ISMAP;
|
||||
ty = UCRP_PREFIX_ISMAP + offset;
|
||||
re = G_MapNumber(params[1]);
|
||||
|
||||
if (re >= nummapheaders)
|
||||
|
|
|
|||
37
src/m_cond.c
37
src/m_cond.c
|
|
@ -623,7 +623,9 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
|
|||
}
|
||||
return false;
|
||||
|
||||
case UC_AND: // Just for string building
|
||||
// Just for string building
|
||||
case UC_AND:
|
||||
case UC_COMMA:
|
||||
return true;
|
||||
|
||||
case UCRP_PREFIX_GRANDPRIX:
|
||||
|
|
@ -637,6 +639,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
|
|||
case UCRP_PREFIX_SEALEDSTAR:
|
||||
return (specialstageinfo.valid == true);
|
||||
|
||||
case UCRP_PREFIX_ISMAP:
|
||||
case UCRP_ISMAP:
|
||||
return (gamemap == cn->requirement+1);
|
||||
case UCRP_ISCHARACTER:
|
||||
|
|
@ -844,7 +847,7 @@ static const char *M_GetConditionString(condition_t *cn)
|
|||
Z_Free(title);
|
||||
return va("INVALID MEDAL COLOR \"%d:%d\"", cn->requirement, checkLevel);
|
||||
}
|
||||
work = va("Get the %s Medal for %s", skincolors[emblemlocations[i].color].name, title);
|
||||
work = va("TIME ATTACK: Get the %s Medal for %s", skincolors[emblemlocations[i].color].name, title);
|
||||
break;
|
||||
case ET_GLOBAL:
|
||||
{
|
||||
|
|
@ -870,16 +873,16 @@ static const char *M_GetConditionString(condition_t *cn)
|
|||
|
||||
if (emblemlocations[i].flags & GE_TIMED)
|
||||
{
|
||||
work = va("Find %s%s%s in %s before %i:%02i.%02i",
|
||||
astr, colorstr, medalstr, title,
|
||||
work = va("%s: Find %s%s%s before %i:%02i.%02i",
|
||||
title, astr, colorstr, medalstr,
|
||||
G_TicsToMinutes(emblemlocations[i].var, true),
|
||||
G_TicsToSeconds(emblemlocations[i].var),
|
||||
G_TicsToCentiseconds(emblemlocations[i].var));
|
||||
}
|
||||
else
|
||||
{
|
||||
work = va("Find %s%s%s in %s",
|
||||
astr, colorstr, medalstr, title);
|
||||
work = va("%s: Find %s%s%s",
|
||||
title, astr, colorstr, medalstr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -903,6 +906,8 @@ static const char *M_GetConditionString(condition_t *cn)
|
|||
|
||||
case UC_AND:
|
||||
return "&";
|
||||
case UC_COMMA:
|
||||
return ",";
|
||||
|
||||
case UCRP_PREFIX_GRANDPRIX:
|
||||
return "GRAND PRIX:";
|
||||
|
|
@ -917,12 +922,20 @@ static const char *M_GetConditionString(condition_t *cn)
|
|||
case UCRP_PREFIX_SEALEDSTAR:
|
||||
return "SEALED STAR:";
|
||||
|
||||
case UCRP_PREFIX_ISMAP:
|
||||
if (cn->requirement >= nummapheaders || !mapheaderinfo[cn->requirement])
|
||||
return va("INVALID MAP CONDITION \"%d:%d\"", cn->type, cn->requirement);
|
||||
|
||||
title = BUILDCONDITIONTITLE(cn->requirement);
|
||||
work = va("%s:", title);
|
||||
Z_Free(title);
|
||||
return work;
|
||||
case UCRP_ISMAP:
|
||||
if (cn->requirement >= nummapheaders || !mapheaderinfo[cn->requirement])
|
||||
return va("INVALID MAP CONDITION \"%d:%d\"", cn->type, cn->requirement);
|
||||
|
||||
title = BUILDCONDITIONTITLE(cn->requirement);
|
||||
work = va("On %s,", title);
|
||||
work = va("On %s", title);
|
||||
Z_Free(title);
|
||||
return work;
|
||||
case UCRP_ISCHARACTER:
|
||||
|
|
@ -992,25 +1005,21 @@ char *M_BuildConditionSetString(UINT8 unlockid)
|
|||
{
|
||||
cn = &c->condition[i];
|
||||
|
||||
if (i > 0)
|
||||
if (i > 0 && (cn->type != UC_COMMA))
|
||||
{
|
||||
if (lastID != cn->id)
|
||||
{
|
||||
worklen = 4;
|
||||
strncat(message, "\nOR ", len);
|
||||
}
|
||||
else //if (cn->type >= UCRP_REQUIRESPLAYING)
|
||||
else
|
||||
{
|
||||
worklen = 1;
|
||||
strncat(message, " ", len);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
worklen = 3;
|
||||
strncat(message, "\n& ", len);
|
||||
}*/
|
||||
len -= worklen;
|
||||
}
|
||||
|
||||
lastID = cn->id;
|
||||
|
||||
work = M_GetConditionString(cn);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ typedef enum
|
|||
|
||||
UC_CRASH, // Hee ho !
|
||||
|
||||
UC_AND, // Just for string building
|
||||
// Just for string building
|
||||
UC_AND,
|
||||
UC_COMMA,
|
||||
|
||||
UCRP_REQUIRESPLAYING, // All conditions below this can only be checked if (Playing() && gamestate == GS_LEVEL).
|
||||
|
||||
|
|
@ -55,7 +57,9 @@ typedef enum
|
|||
UCRP_PREFIX_BREAKTHECAPSULES, // BREAK THE CAPSULES:
|
||||
UCRP_PREFIX_SEALEDSTAR, // SEALED STAR:
|
||||
|
||||
UCRP_PREFIX_ISMAP, // name of [map]:
|
||||
UCRP_ISMAP, // gamemap == [map]
|
||||
|
||||
UCRP_ISCHARACTER, // character == [skin]
|
||||
|
||||
UCRP_FINISHCOOL, // Finish in good standing
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue