mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@638 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6b956dfe2a
commit
3b395263ce
3 changed files with 87 additions and 35 deletions
|
@ -8614,7 +8614,7 @@ static void autoloadgrps(const char *fn)
|
|||
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
|
||||
}
|
||||
|
||||
static int parsegroupfiles(scriptfile *script)
|
||||
static int parsedefinitions_game(scriptfile *script, const int preload)
|
||||
{
|
||||
int tokn;
|
||||
char *cmdtokptr;
|
||||
|
@ -8647,7 +8647,7 @@ static int parsegroupfiles(scriptfile *script)
|
|||
char *fn;
|
||||
|
||||
pathsearchmode = 1;
|
||||
if (!scriptfile_getstring(script,&fn))
|
||||
if (!scriptfile_getstring(script,&fn) && preload)
|
||||
{
|
||||
int j = initgroupfile(fn);
|
||||
|
||||
|
@ -8667,7 +8667,7 @@ static int parsegroupfiles(scriptfile *script)
|
|||
case T_CACHESIZE:
|
||||
{
|
||||
int j;
|
||||
if (scriptfile_getnumber(script,&j)) break;
|
||||
if (scriptfile_getnumber(script,&j) || !preload) break;
|
||||
|
||||
if (j > 0) MAXCACHE1DSIZE = j<<10;
|
||||
}
|
||||
|
@ -8687,13 +8687,14 @@ static int parsegroupfiles(scriptfile *script)
|
|||
}
|
||||
else
|
||||
{
|
||||
parsegroupfiles(included);
|
||||
parsedefinitions_game(included, preload);
|
||||
scriptfile_close(included);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case T_NOAUTOLOAD:
|
||||
if (preload)
|
||||
g_NoAutoLoad = 1;
|
||||
break;
|
||||
case T_MUSIC:
|
||||
|
@ -8715,15 +8716,18 @@ static int parsegroupfiles(scriptfile *script)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!preload)
|
||||
{
|
||||
if(ID==NULL)
|
||||
{
|
||||
initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
break;
|
||||
}
|
||||
#ifdef USE_OPENAL
|
||||
#ifdef USE_OPENAL
|
||||
if (AL_DefineMusic(ID,ext))
|
||||
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -8744,6 +8748,8 @@ static int parsegroupfiles(scriptfile *script)
|
|||
scriptfile_getstring(script,&name);
|
||||
}
|
||||
}
|
||||
if (!preload)
|
||||
{
|
||||
if(num==-1)
|
||||
{
|
||||
initprintf("Error: missing ID for sound definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
|
@ -8751,6 +8757,7 @@ static int parsegroupfiles(scriptfile *script)
|
|||
}
|
||||
if(AL_DefineSound(num,name))initprintf("Error: invalid sound ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case T_EOF:
|
||||
return(0);
|
||||
|
@ -8761,14 +8768,14 @@ static int parsegroupfiles(scriptfile *script)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int loadgroupfiles(const char *fn)
|
||||
static int loaddefinitions_game(const char *fn, const int preload)
|
||||
{
|
||||
scriptfile *script;
|
||||
|
||||
script = scriptfile_fromfile((char *)fn);
|
||||
if (!script) return -1;
|
||||
|
||||
parsegroupfiles(script);
|
||||
parsedefinitions_game(script, preload);
|
||||
|
||||
scriptfile_close(script);
|
||||
scriptfile_clearsymbols();
|
||||
|
@ -10289,7 +10296,7 @@ void app_main(int argc,const char **argv)
|
|||
autoloadgrps(duke3dgrp);
|
||||
}
|
||||
|
||||
loadgroupfiles(duke3ddef);
|
||||
loaddefinitions_game(duke3ddef, TRUE);
|
||||
|
||||
{
|
||||
struct strllist *s;
|
||||
|
@ -10371,8 +10378,11 @@ void app_main(int argc,const char **argv)
|
|||
}
|
||||
|
||||
if (quitevent) return;
|
||||
if (!loaddefinitionsfile(duke3ddef)) initprintf("Definitions file '%s' loaded.\n",duke3ddef);
|
||||
|
||||
if (!loaddefinitionsfile(duke3ddef))
|
||||
{
|
||||
initprintf("Definitions file '%s' loaded.\n",duke3ddef);
|
||||
loaddefinitions_game(duke3ddef, FALSE);
|
||||
}
|
||||
// initprintf("numplayers=%i\n",numplayers);
|
||||
|
||||
if (numplayers > 1)
|
||||
|
|
|
@ -1162,6 +1162,7 @@ void AudioUpdate(void) { MUSIC_Update(); }
|
|||
|
||||
|
||||
void playmusic(const char *fn);
|
||||
#if 0
|
||||
char *makename(char *destname,char *OGGname)
|
||||
{
|
||||
if (!(*OGGname))
|
||||
|
@ -1212,7 +1213,57 @@ int AL_DefineMusic(char *ID,char *name)
|
|||
// playmusicMAP(ID,sel);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
char *makename(char *destname,char *OGGname,char *origname)
|
||||
{
|
||||
if(!origname)return destname;
|
||||
if(destname)Bfree(destname);
|
||||
destname=Bcalloc(Bstrlen(OGGname)+Bstrlen(origname)+1,sizeof(char));
|
||||
if(!destname)return 0;
|
||||
Bstrcpy(destname,(*OGGname)?OGGname:origname);
|
||||
|
||||
if(*OGGname&&OGGname[Bstrlen(OGGname)-1]=='/')
|
||||
{
|
||||
while(*origname=='/')origname++;
|
||||
Bstrcat(destname,origname);
|
||||
}
|
||||
OGGname=Bstrchr(destname,'.');
|
||||
if(OGGname)Bstrcpy(OGGname,".ogg");else Bstrcat(destname,".ogg");
|
||||
return destname;
|
||||
}
|
||||
|
||||
int AL_DefineSound(int ID,char *name)
|
||||
{
|
||||
if(ID>=MAXSOUNDS)return 1;
|
||||
g_sounds[ID].filename1=makename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
||||
// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
|
||||
// loadsound(ID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AL_DefineMusic(char *ID,char *name)
|
||||
{
|
||||
int lev,ep,sel;char b1,b2;
|
||||
|
||||
if(!ID)return 1;
|
||||
if(!Bstrcmp(ID,"intro")) {sel=MAXVOLUMES*MAXLEVELS; ID=env_music_fn[0];}else
|
||||
if(!Bstrcmp(ID,"briefing")){sel=MAXVOLUMES*MAXLEVELS+1;ID=env_music_fn[1];}else
|
||||
if(!Bstrcmp(ID,"loading")) {sel=MAXVOLUMES*MAXLEVELS+2;ID=env_music_fn[2];}else
|
||||
{
|
||||
sscanf(ID,"%c%d%c%d",&b1,&ep,&b2,&lev);
|
||||
lev--;ep--;
|
||||
if(toupper(b1)!='E'||toupper(b2)!='L'||lev>=MAXLEVELS||ep>=MAXVOLUMES)return 1;
|
||||
sel=(ep*MAXLEVELS)+lev;
|
||||
ID=map[sel].musicfn;
|
||||
}
|
||||
|
||||
map[sel].musicfn1=makename(map[sel].musicfn1,name,ID);
|
||||
initprintf("%-15s | ",ID);
|
||||
initprintf("%3d %2d %2d | %s\n",sel,ep,lev,map[sel].musicfn1);
|
||||
// playmusicMAP(ID,sel);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
void playmusicMAP(const char *fn,const int sel)
|
||||
{
|
||||
Musicsize=0;
|
||||
|
|
|
@ -374,13 +374,9 @@ void MV_PlayVoice(VoiceNode *voice)
|
|||
|
||||
flags = DisableInterrupts();
|
||||
LL_SortedInsertion(&VoiceList, voice, prev, next, VoiceNode, priority);
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
{
|
||||
|
||||
if(!voice->bufsnd)voice->bufsnd=(char *)Bcalloc(0x8000*4,sizeof(char));
|
||||
if(!voice->bufsnd)initprintf("Attention. It gonna crash! Thank you."); // FIXME: change the msg
|
||||
}
|
||||
#endif
|
||||
RestoreInterrupts(flags);
|
||||
}
|
||||
|
||||
|
@ -396,12 +392,7 @@ void MV_StopVoice(VoiceNode *voice)
|
|||
unsigned int flags;
|
||||
|
||||
flags = DisableInterrupts();
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
{
|
||||
if(!voice->bufsnd)Bfree(voice->bufsnd);
|
||||
}
|
||||
#endif
|
||||
// move the voice from the play list to the free list
|
||||
LL_Remove(voice, next, prev);
|
||||
LL_Add(&VoicePool, voice, next, prev);
|
||||
|
|
Loading…
Reference in a new issue