mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 09:42:57 +00:00
Emblem number in emblem definition is optional. If none is supplied, place in first free slot.
This commit is contained in:
parent
bc30bd06df
commit
00cad05550
1 changed files with 58 additions and 50 deletions
104
src/dehacked.c
104
src/dehacked.c
|
@ -3511,15 +3511,16 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
continue;
|
||||
}
|
||||
word2 = strtok(NULL, " ");
|
||||
if (fastcmp(word, "CHARACTER"))
|
||||
{
|
||||
if (word2) {
|
||||
strupr(word2);
|
||||
if (word2[strlen(word2)-1] == '\n')
|
||||
word2[strlen(word2)-1] = '\0';
|
||||
if (word2[strlen(word2) - 1] == '\n')
|
||||
word2[strlen(word2) - 1] = '\0';
|
||||
i = atoi(word2);
|
||||
} else
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
if (fastcmp(word, "CHARACTER"))
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue