definecheatdescription

git-svn-id: https://svn.eduke32.com/eduke32@7896 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-07 19:12:15 +00:00 committed by Christoph Oelckers
parent ba91dd0120
commit dcdabd30d3
2 changed files with 40 additions and 0 deletions

View file

@ -191,6 +191,7 @@ static tokenmap_t const vm_keywords[] =
{ "default", CON_DEFAULT },
{ "define", CON_DEFINE },
{ "definecheat", CON_DEFINECHEAT },
{ "definecheatdescription", CON_DEFINECHEATDESCRIPTION },
{ "definegamefuncname", CON_DEFINEGAMEFUNCNAME },
{ "definegametype", CON_DEFINEGAMETYPE },
{ "definelevelname", CON_DEFINELEVELNAME },
@ -620,6 +621,7 @@ static tokenmap_t const vm_keywords[] =
{ "print", CON_QUOTE },
{ "dc", CON_DEFINECHEAT },
{ "dcd", CON_DEFINECHEATDESCRIPTION },
{ "udc", CON_UNDEFINECHEAT },
{ "ck", CON_CHEATKEYS },
@ -5573,6 +5575,43 @@ repeatcase:
}
continue;
case CON_DEFINECHEATDESCRIPTION:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);
k = g_scriptPtr[-1];
if (EDUKE32_PREDICT_FALSE((unsigned)k >= NUMCHEATS))
{
initprintf("%s:%d: error: cheat number exceeds limit of %d.\n",g_scriptFileName,g_lineNumber,NUMCHEATS);
g_errorCnt++;
scriptSkipLine();
continue;
}
g_scriptPtr--;
i = 0;
scriptSkipSpaces();
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
{
*(CheatDescriptions[k]+i) = *textptr;
textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= MAXCHEATDESC-1))
{
initprintf("%s:%d: warning: truncating cheat text to %d characters.\n",g_scriptFileName,g_lineNumber,MAXCHEATDESC-1);
g_warningCnt++;
scriptSkipLine();
break;
}
}
*(CheatDescriptions[k]+i) = '\0';
continue;
case CON_CHEATKEYS:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);

View file

@ -1343,6 +1343,7 @@ enum IterationTypes_t
TRANSFORM(CON_DEFAULT) DELIMITER \
TRANSFORM(CON_DEFINE) DELIMITER \
TRANSFORM(CON_DEFINECHEAT) DELIMITER \
TRANSFORM(CON_DEFINECHEATDESCRIPTION) DELIMITER \
TRANSFORM(CON_DEFINEGAMEFUNCNAME) DELIMITER \
TRANSFORM(CON_DEFINEGAMETYPE) DELIMITER \
TRANSFORM(CON_DEFINELEVELNAME) DELIMITER \