Better names for anim playback functions

git-svn-id: https://svn.eduke32.com/eduke32@5615 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-02-07 02:38:28 +00:00
parent 023bc40020
commit 69c928aa33
5 changed files with 42 additions and 42 deletions

View file

@ -39,15 +39,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
hashtable_t h_dukeanim = { 8, NULL }; hashtable_t h_dukeanim = { 8, NULL };
dukeanim_t * g_animPtr; dukeanim_t * g_animPtr;
dukeanim_t *G_FindAnim(const char *s) dukeanim_t *Anim_Find(const char *s)
{ {
intptr_t ptr = hash_findcase(&h_dukeanim, s); intptr_t ptr = hash_findcase(&h_dukeanim, s);
return (dukeanim_t *)(ptr == -1 ? NULL : (dukeanim_t *)ptr); return (dukeanim_t *)(ptr == -1 ? NULL : (dukeanim_t *)ptr);
} }
dukeanim_t * G_DefineAnim(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t)) dukeanim_t * Anim_Setup(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t))
{ {
dukeanim_t * anim = G_FindAnim(fn); dukeanim_t * anim = Anim_Find(fn);
if (!anim) if (!anim)
anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t)); anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));
@ -62,27 +62,27 @@ dukeanim_t * G_DefineAnim(const char *fn, uint8_t fdelay, void (*sound_func)(int
return anim; return anim;
} }
void G_InitAnim(void) void Anim_Init(void)
{ {
hash_init(&h_dukeanim); hash_init(&h_dukeanim);
G_DefineAnim("logo.anm", 9, logoanimsounds); Anim_Setup("logo.anm", 9, logoanimsounds);
G_DefineAnim("3dr.anm", 10, NULL); Anim_Setup("3dr.anm", 10, NULL);
G_DefineAnim("vol4e1.anm", 10, endanimvol41); Anim_Setup("vol4e1.anm", 10, endanimvol41);
G_DefineAnim("vol4e2.anm", 14, endanimvol42); Anim_Setup("vol4e2.anm", 14, endanimvol42);
G_DefineAnim("vol4e3.anm", 10, endanimvol43); Anim_Setup("vol4e3.anm", 10, endanimvol43);
G_DefineAnim("vol41a.anm", 14, first4animsounds); Anim_Setup("vol41a.anm", 14, first4animsounds);
G_DefineAnim("vol42a.anm", 18, intro4animsounds); Anim_Setup("vol42a.anm", 18, intro4animsounds);
G_DefineAnim("vol43a.anm", 10, intro42animsounds); Anim_Setup("vol43a.anm", 10, intro42animsounds);
G_DefineAnim("duketeam.anm", 10, NULL); Anim_Setup("duketeam.anm", 10, NULL);
G_DefineAnim("radlogo.anm", 10, NULL); Anim_Setup("radlogo.anm", 10, NULL);
G_DefineAnim("cineov2.anm", 18, endanimsounds); Anim_Setup("cineov2.anm", 18, endanimsounds);
G_DefineAnim("cineov3.anm", 10, endanimsounds); Anim_Setup("cineov3.anm", 10, endanimsounds);
} }
int32_t G_PlayAnim(const char *fn) int32_t Anim_Play(const char *fn)
{ {
dukeanim_t *anim = G_FindAnim(fn); dukeanim_t *anim = Anim_Find(fn);
if (!anim) if (!anim)
{ {

View file

@ -37,9 +37,9 @@ 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 * G_FindAnim(const char *s); extern dukeanim_t * Anim_Find(const char *s);
extern dukeanim_t * G_DefineAnim(const char *fn, uint8_t framerate, void (*sound_func)(int32_t)); extern dukeanim_t * Anim_Setup(const char *fn, uint8_t framerate, void (*sound_func)(int32_t));
int32_t G_PlayAnim(const char *fn); int32_t Anim_Play(const char *fn);
void G_InitAnim(void); void Anim_Init(void);
#endif #endif

View file

@ -6700,10 +6700,10 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
*/ */
anim = G_FindAnim(animname); anim = Anim_Find(animname);
if (!anim) if (!anim)
anim = G_DefineAnim(animname, delay, NULL); anim = Anim_Setup(animname, delay, NULL);
else else
anim->framedelay = delay; anim->framedelay = delay;
} }
@ -6720,7 +6720,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
scriptfile_getstring(script, &animname); scriptfile_getstring(script, &animname);
if (animname) if (animname)
anim = G_FindAnim(animname); anim = Anim_Find(animname);
if (!anim) if (!anim)
{ {
@ -6752,7 +6752,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
scriptfile_getstring(script, &animname); scriptfile_getstring(script, &animname);
if (animname) if (animname)
anim = G_FindAnim(animname); anim = Anim_Find(animname);
continue; continue;
} }
@ -7685,7 +7685,7 @@ static void G_DisplayLogo(void)
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!I_CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
G_PlayAnim("logo.anm"); Anim_Play("logo.anm");
G_FadePalette(0,0,0,252); G_FadePalette(0,0,0,252);
I_ClearAllInput(); I_ClearAllInput();
} }
@ -7727,7 +7727,7 @@ static void G_DisplayLogo(void)
if (i != -1) if (i != -1)
{ {
kclose(i); kclose(i);
G_PlayAnim("3dr.anm"); Anim_Play("3dr.anm");
G_FadePalette(0,0,0,252); G_FadePalette(0,0,0,252);
I_ClearAllInput(); I_ClearAllInput();
} }
@ -8745,7 +8745,7 @@ int32_t app_main(int32_t argc, char const * const * argv)
if (quitevent) return 4; if (quitevent) return 4;
G_InitAnim(); Anim_Init();
const char *defsfile = G_DefFile(); const char *defsfile = G_DefFile();
uint32_t stime = getticks(); uint32_t stime = getticks();
@ -9492,7 +9492,7 @@ VOL1_END:
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE)) if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE))
{ {
fadepal(0,0,0, 252,0,-4); fadepal(0,0,0, 252,0,-4);
G_PlayAnim("cineov2.anm"); Anim_Play("cineov2.anm");
I_ClearAllInput(); I_ClearAllInput();
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
@ -9528,19 +9528,19 @@ VOL1_END:
fadepal(0,0,0, 252,0,-4); fadepal(0,0,0, 252,0,-4);
I_ClearAllInput(); I_ClearAllInput();
t = G_PlayAnim("vol4e1.anm"); t = Anim_Play("vol4e1.anm");
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
if (t) if (t)
goto end_vol4e; goto end_vol4e;
t = G_PlayAnim("vol4e2.anm"); t = Anim_Play("vol4e2.anm");
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
if (t) if (t)
goto end_vol4e; goto end_vol4e;
G_PlayAnim("vol4e3.anm"); Anim_Play("vol4e3.anm");
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
} }
@ -9581,7 +9581,7 @@ VOL4_DUKETEAM:
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
G_PlayAnim("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
@ -9607,7 +9607,7 @@ VOL4_END:
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE)) if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE))
{ {
fadepal(0,0,0, 252,0,-4); fadepal(0,0,0, 252,0,-4);
G_PlayAnim("cineov3.anm"); Anim_Play("cineov3.anm");
I_ClearAllInput(); I_ClearAllInput();
ototalclock = totalclock+200; ototalclock = totalclock+200;
while (totalclock < ototalclock) while (totalclock < ototalclock)
@ -9622,7 +9622,7 @@ VOL4_END:
if (G_GetLogoFlags() & LOGO_NOE3RADLOGO) if (G_GetLogoFlags() & LOGO_NOE3RADLOGO)
goto ENDANM; goto ENDANM;
G_PlayAnim("RADLOGO.ANM"); Anim_Play("RADLOGO.ANM");
if (ud.lockout == 0 && !I_CheckAllInput()) if (ud.lockout == 0 && !I_CheckAllInput())
{ {
@ -9658,7 +9658,7 @@ ENDANM:
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
G_PlayAnim("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();

View file

@ -2741,12 +2741,12 @@ nullquote:
if (tw == CON_IFCUTSCENE) if (tw == CON_IFCUTSCENE)
{ {
VM_CONDITIONAL(g_animPtr == G_FindAnim(ScriptQuotes[j])); VM_CONDITIONAL(g_animPtr == Anim_Find(ScriptQuotes[j]));
continue; continue;
} }
tw = ps->palette; tw = ps->palette;
G_PlayAnim(ScriptQuotes[j]); Anim_Play(ScriptQuotes[j]);
P_SetGamePalette(ps, tw, 2 + 16); P_SetGamePalette(ps, tw, 2 + 16);
continue; continue;
} }

View file

@ -1387,19 +1387,19 @@ void G_NewGame(int32_t vn, int32_t ln, int32_t sk)
clearview(0L); clearview(0L);
nextpage(); nextpage();
i = G_PlayAnim("vol41a.anm"); i = Anim_Play("vol41a.anm");
clearview(0L); clearview(0L);
nextpage(); nextpage();
if (i) if (i)
goto end_vol4a; goto end_vol4a;
i = G_PlayAnim("vol42a.anm"); i = Anim_Play("vol42a.anm");
clearview(0L); clearview(0L);
nextpage(); nextpage();
if (i) if (i)
goto end_vol4a; goto end_vol4a;
G_PlayAnim("vol43a.anm"); Anim_Play("vol43a.anm");
clearview(0L); clearview(0L);
nextpage(); nextpage();