From aca7533f55c98cc615add042391ae7865ef79f98 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 14 Feb 2016 03:49:38 +0000 Subject: [PATCH] Fix animsounds git-svn-id: https://svn.eduke32.com/eduke32@5628 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index bef3d27de..1b7149094 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -5207,6 +5207,14 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload) break; case T_ANIMSOUNDS: { + + char *otokptr = script->ltextptr; + int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN; + dukeanim_t *anim = NULL; + char *animname = NULL; + + scriptfile_getstring(script, &animname); + char *animsoundsend = NULL; if (scriptfile_getbraces(script, &animsoundsend)) @@ -5215,16 +5223,22 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload) if (preload) { while (script->textptr < animsoundsend) - script->textptr++; + { + int32_t dummy; + + // HACK: we've reached the end of the list + // (hack because it relies on knowledge of + // how scriptfile_* preprocesses the text) + if (animsoundsend - script->textptr == 1) + break; + + if (scriptfile_getnumber(script, &dummy)) + break; + } + break; } - char *otokptr = script->ltextptr; - int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN; - dukeanim_t *anim = NULL; - char *animname = NULL; - - scriptfile_getstring(script, &animname); if (animname) anim = Anim_Find(animname);