mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
UC_PASSWORD
Unlockable type that supports entering (case-insensitive) string
This commit is contained in:
parent
f106d14d69
commit
e162fffecf
4 changed files with 62 additions and 2 deletions
|
|
@ -2585,6 +2585,13 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
|
||||||
//PARAMCHECK(1);
|
//PARAMCHECK(1);
|
||||||
ty = UC_ADDON + offset;
|
ty = UC_ADDON + offset;
|
||||||
}
|
}
|
||||||
|
else if (fastcmp(params[0], "PASSWORD"))
|
||||||
|
{
|
||||||
|
PARAMCHECK(1);
|
||||||
|
ty = UC_PASSWORD;
|
||||||
|
stringvar = Z_StrDup(params[1]);
|
||||||
|
re = -1;
|
||||||
|
}
|
||||||
else if ((offset=0) || fastcmp(params[0], "AND")
|
else if ((offset=0) || fastcmp(params[0], "AND")
|
||||||
|| (++offset && fastcmp(params[0], "COMMA")))
|
|| (++offset && fastcmp(params[0], "COMMA")))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
43
src/m_cond.c
43
src/m_cond.c
|
|
@ -844,6 +844,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
case UC_PASSWORD:
|
||||||
|
return (cn->stringvar == NULL);
|
||||||
|
|
||||||
// Just for string building
|
// Just for string building
|
||||||
case UC_AND:
|
case UC_AND:
|
||||||
|
|
@ -1292,6 +1294,8 @@ static const char *M_GetConditionString(condition_t *cn)
|
||||||
if (gamedata->evercrashed)
|
if (gamedata->evercrashed)
|
||||||
return "launch \"Dr. Robotnik's Ring Racers\" again after a game crash";
|
return "launch \"Dr. Robotnik's Ring Racers\" again after a game crash";
|
||||||
return NULL;
|
return NULL;
|
||||||
|
case UC_PASSWORD:
|
||||||
|
return "enter a secret password";
|
||||||
|
|
||||||
case UC_AND:
|
case UC_AND:
|
||||||
return "&";
|
return "&";
|
||||||
|
|
@ -1610,7 +1614,7 @@ char *M_BuildConditionSetString(UINT16 unlockid)
|
||||||
|
|
||||||
static boolean M_CheckUnlockConditions(player_t *player)
|
static boolean M_CheckUnlockConditions(player_t *player)
|
||||||
{
|
{
|
||||||
INT32 i;
|
UINT32 i;
|
||||||
conditionset_t *c;
|
conditionset_t *c;
|
||||||
boolean ret;
|
boolean ret;
|
||||||
|
|
||||||
|
|
@ -1629,6 +1633,43 @@ static boolean M_CheckUnlockConditions(player_t *player)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean M_ConditionInterpret(const char *password)
|
||||||
|
{
|
||||||
|
UINT32 i, j;
|
||||||
|
conditionset_t *c;
|
||||||
|
condition_t *cn;
|
||||||
|
|
||||||
|
for (i = 0; i < MAXCONDITIONSETS; ++i)
|
||||||
|
{
|
||||||
|
c = &conditionSets[i];
|
||||||
|
|
||||||
|
if (!c->numconditions || gamedata->achieved[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (j = 0; j < c->numconditions; ++j)
|
||||||
|
{
|
||||||
|
cn = &c->condition[j];
|
||||||
|
|
||||||
|
if (cn->type != UC_PASSWORD)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (cn->stringvar == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (stricmp(cn->stringvar, password))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Remove the password for this session.
|
||||||
|
Z_Free(cn->stringvar);
|
||||||
|
cn->stringvar = NULL;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall)
|
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall)
|
||||||
{
|
{
|
||||||
UINT16 i = 0, response = 0, newkeys = 0;
|
UINT16 i = 0, response = 0, newkeys = 0;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ typedef enum
|
||||||
UC_REPLAY, // Save a replay
|
UC_REPLAY, // Save a replay
|
||||||
UC_CRASH, // Hee ho !
|
UC_CRASH, // Hee ho !
|
||||||
|
|
||||||
|
UC_PASSWORD, // Type in something funny
|
||||||
|
|
||||||
// Just for string building
|
// Just for string building
|
||||||
UC_AND,
|
UC_AND,
|
||||||
UC_COMMA,
|
UC_COMMA,
|
||||||
|
|
@ -333,6 +335,7 @@ void M_ClearStats(void);
|
||||||
boolean M_NotFreePlay(player_t *player);
|
boolean M_NotFreePlay(player_t *player);
|
||||||
|
|
||||||
// Updating conditions and unlockables
|
// Updating conditions and unlockables
|
||||||
|
boolean M_ConditionInterpret(const char *password);
|
||||||
boolean M_CheckCondition(condition_t *cn, player_t *player);
|
boolean M_CheckCondition(condition_t *cn, player_t *player);
|
||||||
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall);
|
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,8 +173,17 @@ void M_ExtrasTick(void)
|
||||||
|
|
||||||
if (menutyping.active == false && cv_dummyextraspassword.string[0] != '\0')
|
if (menutyping.active == false && cv_dummyextraspassword.string[0] != '\0')
|
||||||
{
|
{
|
||||||
if (cht_Interpret(cv_dummyextraspassword.string) == true)
|
if (M_ConditionInterpret(cv_dummyextraspassword.string) == true)
|
||||||
|
{
|
||||||
|
if (M_UpdateUnlockablesAndExtraEmblems(true, true))
|
||||||
|
{
|
||||||
|
M_Challenges(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cht_Interpret(cv_dummyextraspassword.string) == true)
|
||||||
|
{
|
||||||
M_InitExtras(-1);
|
M_InitExtras(-1);
|
||||||
|
}
|
||||||
|
|
||||||
CV_StealthSet(&cv_dummyextraspassword, "");
|
CV_StealthSet(&cv_dummyextraspassword, "");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue