Fix anim definition problem

git-svn-id: https://svn.eduke32.com/eduke32@5626 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-02-13 21:06:31 +00:00
parent 5672004ba1
commit 0e2eed5ee9

View file

@ -5194,13 +5194,8 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
} }
} }
// if (!preload) if (!preload)
{ {
/*
if (check_file_exist(animname))
break;
*/
anim = Anim_Find(animname); anim = Anim_Find(animname);
if (!anim) if (!anim)
@ -5212,8 +5207,19 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
case T_ANIMSOUNDS: case T_ANIMSOUNDS:
{ {
char *otokptr = script->ltextptr;
char *animsoundsend = NULL; char *animsoundsend = NULL;
if (scriptfile_getbraces(script, &animsoundsend))
break;
if (preload)
{
while (script->textptr < animsoundsend)
script->textptr++;
break;
}
char *otokptr = script->ltextptr;
int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN; int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN;
dukeanim_t *anim = NULL; dukeanim_t *anim = NULL;
char *animname = NULL; char *animname = NULL;
@ -5230,8 +5236,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
} }
if (scriptfile_getbraces(script, &animsoundsend))
break;
if (anim->sounds) if (anim->sounds)
{ {
@ -5241,22 +5245,12 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
anim->numsounds = 0; anim->numsounds = 0;
} }
if (!preload)
anim->sounds = (uint16_t *)Xcalloc(allocsz, 2 * sizeof(uint16_t)); anim->sounds = (uint16_t *)Xcalloc(allocsz, 2 * sizeof(uint16_t));
while (script->textptr < animsoundsend) while (script->textptr < animsoundsend)
{ {
int32_t framenum, soundnum; int32_t framenum, soundnum;
if (preload)
{
// dummy
scriptfile_getstring(script, &animname);
if (animname)
anim = Anim_Find(animname);
continue;
}
// HACK: we've reached the end of the list // HACK: we've reached the end of the list
// (hack because it relies on knowledge of // (hack because it relies on knowledge of
// how scriptfile_* preprocesses the text) // how scriptfile_* preprocesses the text)
@ -5318,8 +5312,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
numpairs++; numpairs++;
} }
if (!preload)
{
if (!bad) if (!bad)
{ {
anim->numsounds = numpairs; anim->numsounds = numpairs;
@ -5333,7 +5325,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
animname); animname);
} }
} }
}
break; break;
case T_SOUND: case T_SOUND: