diff --git a/src/deh_soc.c b/src/deh_soc.c index a748747c1..a092384f6 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2620,6 +2620,12 @@ static void readcondition(UINT16 set, UINT32 id, char *word2) stringvar = Z_StrDup(params[1]); re = -1; } + else if (fastcmp(params[0], "SPRAYCAN")) + { + PARAMCHECK(1); + ty = UC_SPRAYCAN; + re = get_skincolor(params[1]); + } else if ((offset=0) || fastcmp(params[0], "AND") || (++offset && fastcmp(params[0], "COMMA"))) { diff --git a/src/m_cond.c b/src/m_cond.c index ae8143b2d..dee2c008e 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1059,6 +1059,14 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return false; case UC_PASSWORD: return (cn->stringvar == NULL); + case UC_SPRAYCAN: + { + if (cn->requirement <= 0 + || cn->requirement >= MAXCANCOLORS) + return false; + + return gamedata->spraycans[cn->requirement].got; + } // Just for string building case UC_AND: @@ -1511,6 +1519,24 @@ static const char *M_GetConditionString(condition_t *cn) return NULL; case UC_PASSWORD: return "enter a secret password"; + case UC_SPRAYCAN: + { + if (cn->requirement <= 0 + || cn->requirement >= MAXCANCOLORS) + return va("INVALID SPRAYCAN COLOR \"%d\"", cn->requirement); + + INT32 checkLevel = gamedata->spraycans[cn->requirement].map - 1; + + if (checkLevel < 0 || checkLevel >= nummapheaders || !mapheaderinfo[checkLevel]) + return va("INVALID SPRAYCAN MAP \"%d:%d\"", cn->requirement, checkLevel); + + title = BUILDCONDITIONTITLE(checkLevel); + + work = va("%s: grab the spraycan", title); + + Z_Free(title); + return work; + } case UC_AND: return "&"; diff --git a/src/m_cond.h b/src/m_cond.h index e01c1b2d9..09c850aa6 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -58,6 +58,8 @@ typedef enum UC_PASSWORD, // Type in something funny + UC_SPRAYCAN, // Grab a spraycan + // Just for string building UC_AND, UC_COMMA,