Emblem number in emblem definition is optional. If none is supplied, place in first free slot.

This commit is contained in:
MascaraSnake 2019-02-03 17:03:33 +01:00
parent bc30bd06df
commit 00cad05550
1 changed files with 58 additions and 50 deletions

View File

@ -3511,15 +3511,16 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
continue;
}
word2 = strtok(NULL, " ");
if (word2) {
strupr(word2);
if (word2[strlen(word2) - 1] == '\n')
word2[strlen(word2) - 1] = '\0';
i = atoi(word2);
}
else
i = 0;
if (fastcmp(word, "CHARACTER"))
{
if (word2) {
strupr(word2);
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
} else
i = 0;
if (i >= 0 && i < 32)
readPlayer(f, i);
else
@ -3529,13 +3530,58 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
}
continue;
}
else if (fastcmp(word, "EMBLEM"))
{
if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f);
}
else
{
if (!word2)
i = numemblems + 1;
if (i > 0 && i <= MAXEMBLEMS)
{
if (numemblems < i)
numemblems = i;
reademblemdata(f, i);
}
else
{
deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS);
ignorelines(f);
}
}
}
else if (fastcmp(word, "EXTRAEMBLEM"))
{
if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f);
}
else
{
if (!word2)
i = numextraemblems + 1;
if (i > 0 && i <= MAXEXTRAEMBLEMS)
{
if (numextraemblems < i)
numextraemblems = i;
readextraemblemdata(f, i);
}
else
{
deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS);
ignorelines(f);
}
}
}
if (word2)
{
strupr(word2);
if (word2[strlen(word2)-1] == '\n')
word2[strlen(word2)-1] = '\0';
i = atoi(word2);
if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
@ -3658,44 +3704,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
ignorelines(f);
}
}
else if (fastcmp(word, "EMBLEM"))
{
if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f);
}
else if (i > 0 && i <= MAXEMBLEMS)
{
if (numemblems < i)
numemblems = i;
reademblemdata(f, i);
}
else
{
deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS);
ignorelines(f);
}
}
else if (fastcmp(word, "EXTRAEMBLEM"))
{
if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f);
}
else if (i > 0 && i <= MAXEXTRAEMBLEMS)
{
if (numextraemblems < i)
numextraemblems = i;
readextraemblemdata(f, i);
}
else
{
deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS);
ignorelines(f);
}
}
else if (fastcmp(word, "UNLOCKABLE"))
{
if (!mainfile && !gamedataadded)