mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Game defs: Split Anim_Create out of Anim_Setup and use it for the cutscene token.
git-svn-id: https://svn.eduke32.com/eduke32@6280 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7226eb346d
commit
aebd4c53c4
3 changed files with 28 additions and 22 deletions
|
@ -63,20 +63,20 @@ dukeanim_t *Anim_Find(const char *s)
|
|||
return (dukeanim_t *)(ptr == -1 ? NULL : (dukeanim_t *)ptr);
|
||||
}
|
||||
|
||||
dukeanim_t * Anim_Setup(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t))
|
||||
dukeanim_t * Anim_Create(char const * fn)
|
||||
{
|
||||
dukeanim_t * anim = Anim_Find(fn);
|
||||
|
||||
if (!anim)
|
||||
anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
|
||||
dukeanim_t * anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
|
||||
|
||||
hash_add(&h_dukeanim, fn, (intptr_t)anim, 0);
|
||||
|
||||
if (sound_func)
|
||||
anim->sound_func = sound_func;
|
||||
return anim;
|
||||
}
|
||||
|
||||
static dukeanim_t * Anim_Setup(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t))
|
||||
{
|
||||
dukeanim_t * anim = Anim_Create(fn);
|
||||
anim->framedelay = fdelay;
|
||||
|
||||
anim->sound_func = sound_func;
|
||||
return anim;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct
|
|||
extern dukeanim_t * g_animPtr;
|
||||
extern hashtable_t h_dukeanim;
|
||||
extern dukeanim_t * Anim_Find(const char *s);
|
||||
extern dukeanim_t * Anim_Setup(const char *fn, uint8_t framerate, void (*sound_func)(int32_t));
|
||||
extern dukeanim_t * Anim_Create(const char *fn);
|
||||
int32_t Anim_Play(const char *fn);
|
||||
void Anim_Init(void);
|
||||
|
||||
|
|
|
@ -5206,25 +5206,31 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
if (scriptfile_getbraces(pScript, &animEnd))
|
||||
break;
|
||||
|
||||
int32_t frameDelay = 10;
|
||||
|
||||
while (pScript->textptr < animEnd)
|
||||
{
|
||||
switch (getatoken(pScript, animTokens, ARRAY_SIZE(animTokens)))
|
||||
{
|
||||
case T_DELAY: scriptfile_getnumber(pScript, &frameDelay); break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!firstPass)
|
||||
{
|
||||
dukeanim_t *animPtr = Anim_Find(fileName);
|
||||
|
||||
if (!animPtr)
|
||||
animPtr = Anim_Setup(fileName, frameDelay, NULL);
|
||||
else
|
||||
animPtr->framedelay = frameDelay;
|
||||
{
|
||||
animPtr = Anim_Create(fileName);
|
||||
animPtr->framedelay = 10;
|
||||
}
|
||||
|
||||
int32_t temp;
|
||||
|
||||
while (pScript->textptr < animEnd)
|
||||
{
|
||||
switch (getatoken(pScript, animTokens, ARRAY_SIZE(animTokens)))
|
||||
{
|
||||
case T_DELAY:
|
||||
scriptfile_getnumber(pScript, &temp);
|
||||
animPtr->framedelay = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
pScript->textptr = animEnd;
|
||||
}
|
||||
break;
|
||||
case T_ANIMSOUNDS:
|
||||
|
|
Loading…
Reference in a new issue