mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +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);
|
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);
|
dukeanim_t * anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
|
||||||
|
|
||||||
if (!anim)
|
|
||||||
anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
|
|
||||||
|
|
||||||
hash_add(&h_dukeanim, fn, (intptr_t)anim, 0);
|
hash_add(&h_dukeanim, fn, (intptr_t)anim, 0);
|
||||||
|
|
||||||
if (sound_func)
|
return anim;
|
||||||
anim->sound_func = sound_func;
|
}
|
||||||
|
|
||||||
|
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->framedelay = fdelay;
|
||||||
|
anim->sound_func = sound_func;
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct
|
||||||
extern dukeanim_t * g_animPtr;
|
extern dukeanim_t * g_animPtr;
|
||||||
extern hashtable_t h_dukeanim;
|
extern hashtable_t h_dukeanim;
|
||||||
extern dukeanim_t * Anim_Find(const char *s);
|
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);
|
int32_t Anim_Play(const char *fn);
|
||||||
void Anim_Init(void);
|
void Anim_Init(void);
|
||||||
|
|
||||||
|
|
|
@ -5206,25 +5206,31 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
||||||
if (scriptfile_getbraces(pScript, &animEnd))
|
if (scriptfile_getbraces(pScript, &animEnd))
|
||||||
break;
|
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)
|
if (!firstPass)
|
||||||
{
|
{
|
||||||
dukeanim_t *animPtr = Anim_Find(fileName);
|
dukeanim_t *animPtr = Anim_Find(fileName);
|
||||||
|
|
||||||
if (!animPtr)
|
if (!animPtr)
|
||||||
animPtr = Anim_Setup(fileName, frameDelay, NULL);
|
{
|
||||||
else
|
animPtr = Anim_Create(fileName);
|
||||||
animPtr->framedelay = frameDelay;
|
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;
|
break;
|
||||||
case T_ANIMSOUNDS:
|
case T_ANIMSOUNDS:
|
||||||
|
|
Loading…
Reference in a new issue