Implement "renamefile" during game-side def parsing (normally for "loadgrp" et al.) in addition to engine-side def parsing.

git-svn-id: https://svn.eduke32.com/eduke32@5140 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-04-12 08:07:45 +00:00
parent 9a8941ef41
commit 896ae2894c
2 changed files with 27 additions and 2 deletions

View file

@ -9103,6 +9103,8 @@ enum
T_DEFINESOUND,
T_INCLUDEDEFAULT,
T_RENAMEFILE,
};
static int32_t parsegroupfiles(scriptfile *script);
@ -9139,7 +9141,8 @@ static int32_t parsegroupfiles(scriptfile *script)
{ "includedefault", T_INCLUDEDEFAULT },
{ "#includedefault", T_INCLUDEDEFAULT },
{ "loadgrp", T_LOADGRP },
{ "noautoload", T_NOAUTOLOAD }
{ "noautoload", T_NOAUTOLOAD },
{ "renamefile", T_RENAMEFILE },
};
while (1)
@ -9187,6 +9190,16 @@ static int32_t parsegroupfiles(scriptfile *script)
case T_NOAUTOLOAD:
NoAutoLoad = 1;
break;
case T_RENAMEFILE:
{
int32_t crcval = 0, filenum = -1;
char *newname = NULL;
if (scriptfile_getnumber(script,&crcval)) break;
if (scriptfile_getnumber(script,&filenum)) break;
if (scriptfile_getstring(script,&newname)) break;
krename(crcval, filenum, newname);
}
break;
case T_EOF:
return(0);
default:

View file

@ -231,7 +231,8 @@ enum gametokens
T_ANIMSOUNDS,
T_NOFLOORPALRANGE,
T_ID,
T_DELAY
T_DELAY,
T_RENAMEFILE,
};
@ -9492,6 +9493,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
{ "sound", T_SOUND },
{ "cutscene", T_CUTSCENE },
{ "animsounds", T_ANIMSOUNDS },
{ "renamefile", T_RENAMEFILE },
};
static const tokenlist sound_musictokens[] =
@ -9797,6 +9799,16 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
}
}
break;
case T_RENAMEFILE:
{
int32_t crcval = 0, filenum = -1;
char *newname = NULL;
if (scriptfile_getnumber(script,&crcval)) break;
if (scriptfile_getnumber(script,&filenum)) break;
if (scriptfile_getstring(script,&newname)) break;
krename(crcval, filenum, newname);
}
break;
case T_EOF:
return(0);
default: