mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fixes
git-svn-id: https://svn.eduke32.com/eduke32@642 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9fc846754f
commit
02c5d0b87b
11 changed files with 87 additions and 153 deletions
|
@ -15,7 +15,7 @@ BUILD32_ON_64 = 0
|
|||
# Debugging options
|
||||
RELEASE?=1
|
||||
NOSOUND?=0
|
||||
USE_OPENAL?=0
|
||||
USE_OPENAL?=1
|
||||
|
||||
# build locations
|
||||
|
||||
|
@ -82,10 +82,6 @@ AUDIOLIB_FX_SDL=$(OBJ)/ll_man.$o \
|
|||
$(OBJ)/pitch.$o \
|
||||
$(OBJ)/multivoc.$o
|
||||
|
||||
ifeq ($(USE_OPENAL),1)
|
||||
AUDIOLIB_FX_SDL += $(OBJ)/openal.$o
|
||||
endif
|
||||
|
||||
AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o
|
||||
|
||||
AUDIOLIB_FX=$(OBJ)/pitch.$o \
|
||||
|
|
|
@ -5379,7 +5379,7 @@ int spawn(int j, int pn)
|
|||
break;
|
||||
|
||||
case WATERDRIP__STATIC:
|
||||
if ((j >= 0 && sprite[j].statnum == 10) || sprite[j].statnum == 1)
|
||||
if (j >= 0 && (sprite[j].statnum == 10 || sprite[j].statnum == 1))
|
||||
{
|
||||
sp->shade = 32;
|
||||
if (sprite[j].pal != 1)
|
||||
|
@ -7995,7 +7995,7 @@ static void nonsharedkeys(void)
|
|||
if (playmusicMAP(&map[(unsigned char)music_select].musicfn[0],music_select))
|
||||
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn1[0]);
|
||||
else
|
||||
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn1[0]);
|
||||
Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn[0]);
|
||||
FTA(26,g_player[myconnectindex].ps);
|
||||
}
|
||||
return;
|
||||
|
@ -8806,7 +8806,7 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
|||
initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
break;
|
||||
}
|
||||
#ifdef USE_OPENAL
|
||||
|
||||
i = pathsearchmode;
|
||||
pathsearchmode = 1;
|
||||
if (findfrompath(fn,&tfn) < 0)
|
||||
|
@ -8827,7 +8827,6 @@ static int parsedefinitions_game(scriptfile *script, const int preload)
|
|||
|
||||
if (AL_DefineMusic(ID,fn))
|
||||
initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -442,6 +442,7 @@ static const char *keyw[] =
|
|||
"digitalnumberz", // 312
|
||||
"spritenopal", // 313
|
||||
"hitradiusvar", // 314
|
||||
"rotatesprite16", // 315
|
||||
"<null>"
|
||||
};
|
||||
|
||||
|
@ -3528,6 +3529,7 @@ static int parsecommand(void)
|
|||
transvar();
|
||||
return 0;
|
||||
|
||||
case CON_ROTATESPRITE16:
|
||||
case CON_ROTATESPRITE:
|
||||
if (parsing_event == 0 && parsing_state == 0)
|
||||
{
|
||||
|
|
|
@ -799,5 +799,6 @@ enum keywords
|
|||
CON_DIGITALNUMBERZ, // 312
|
||||
CON_SPRITENOPAL, // 313
|
||||
CON_HITRADIUSVAR, // 314
|
||||
CON_ROTATESPRITE16, // 315
|
||||
END
|
||||
};
|
||||
|
|
|
@ -5601,6 +5601,7 @@ static int parse(void)
|
|||
break;
|
||||
}
|
||||
|
||||
case CON_ROTATESPRITE16:
|
||||
case CON_ROTATESPRITE:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -5610,7 +5611,8 @@ static int parse(void)
|
|||
int x1=GetGameVarID(*insptr++,g_i,g_p), y1=GetGameVarID(*insptr++,g_i,g_p);
|
||||
int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p);
|
||||
|
||||
rotatesprite(x<<16,y<<16,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2);
|
||||
if (tw == CON_ROTATESPRITE){x<<=16;y<<=16;}
|
||||
rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6298,7 +6300,7 @@ static int parse(void)
|
|||
}
|
||||
if (fta_quotes[sq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,sq);
|
||||
if (fta_quotes[dq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,dq);
|
||||
insptr += 5;
|
||||
insptr += 4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,6 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
|
|||
|
||||
#include "dsl.h"
|
||||
#include "compat.h"
|
||||
#ifdef USE_OPENAL
|
||||
#include "openal.h"
|
||||
#endif
|
||||
#include "SDL.h"
|
||||
#include "SDL_mixer.h"
|
||||
|
||||
|
@ -118,10 +115,6 @@ static void mixer_callback(int chan, void *stream, int len, void *udata)
|
|||
|
||||
/* len should equal _BufferSize, else this is screwed up */
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
AL_Update();
|
||||
#endif
|
||||
|
||||
stptr = (Uint8 *)stream;
|
||||
|
||||
if (_remainder > 0)
|
||||
|
|
|
@ -39,6 +39,9 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
|||
#include <duke3d.h>
|
||||
#ifdef _WIN32
|
||||
#include "dsoundout.h"
|
||||
#ifdef USE_OPENAL
|
||||
#include "openal.h"
|
||||
#endif
|
||||
#else
|
||||
#include "dsl.h"
|
||||
#endif
|
||||
|
@ -49,9 +52,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
|||
#include "pitch.h"
|
||||
#include "multivoc.h"
|
||||
#include "_multivc.h"
|
||||
#ifdef USE_OPENAL
|
||||
#include "openal.h"
|
||||
#endif
|
||||
|
||||
#define STEREO 1
|
||||
#define SIXTEEN_BIT 2
|
||||
|
@ -2865,6 +2865,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
|
|||
MV_SetReverseStereo(FALSE);
|
||||
|
||||
// Initialize the sound card
|
||||
#if defined(_WIN32)
|
||||
#ifdef USE_OPENAL
|
||||
if (AL_Init())
|
||||
{
|
||||
|
@ -2879,7 +2880,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
|
||||
status = DSOUND_Init(soundcard, MixRate, numchannels, samplebits, TotalBufferSize);
|
||||
if (status != DSOUND_Ok)
|
||||
{
|
||||
|
@ -2979,11 +2980,10 @@ int MV_Shutdown(void)
|
|||
MV_StopPlayback();
|
||||
|
||||
// Shutdown the sound card
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Shutdown();
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
#ifdef USE_OPENAL
|
||||
AL_Shutdown();
|
||||
#endif
|
||||
DSOUND_Shutdown();
|
||||
#else
|
||||
DSL_Shutdown();
|
||||
|
|
|
@ -191,7 +191,6 @@ void MUSIC_SetVolume
|
|||
volume = max(0, volume);
|
||||
volume = min(volume, 255);
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_SetMusicVolume(volume);
|
||||
#endif
|
||||
if (MUSIC_SoundDevice != -1)
|
||||
|
@ -300,7 +299,6 @@ void MUSIC_Continue
|
|||
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Continue();
|
||||
#endif
|
||||
MIDI_ContinueSong();
|
||||
|
@ -320,7 +318,6 @@ void MUSIC_Pause
|
|||
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Pause();
|
||||
#endif
|
||||
MIDI_PauseSong();
|
||||
|
@ -340,7 +337,6 @@ int MUSIC_StopSong
|
|||
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Stop();
|
||||
#endif
|
||||
MUSIC_StopFade();
|
||||
|
@ -366,9 +362,9 @@ int MUSIC_PlaySong
|
|||
int status;
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_PlaySong((unsigned char *)song,loopflag);
|
||||
if(openal_disabled || AL_isntALmusic())
|
||||
AL_PlaySong((char *)song,loopflag);
|
||||
|
||||
if(AL_isntALmusic())
|
||||
#endif
|
||||
{
|
||||
MUSIC_StopSong();
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct SD
|
|||
sounddef def;
|
||||
}sounddef1;
|
||||
|
||||
sounddef1 sounds1[2];
|
||||
sounddef1 music;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows
|
||||
|
@ -262,6 +262,7 @@ extern ov_callbacks cb;
|
|||
|
||||
int AL_Init()
|
||||
{
|
||||
Bmemset(&music,0,sizeof(music)); // "music.def.size=0" means music not playing
|
||||
if (loadaldriver())
|
||||
{
|
||||
initprintf("Failed loading OpenAL driver.\nDownload OpenAL 1.1 or greater from http://www.openal.org/downloads.html.");
|
||||
|
@ -319,23 +320,12 @@ int AL_Init()
|
|||
}
|
||||
else initprintf("OpenAL initialization failed.\n");
|
||||
|
||||
ALdoing="Open";
|
||||
balGenBuffers(16, sounds1[1].buffers);
|
||||
check(1);
|
||||
balGenSources(1,&sounds1[1].source);
|
||||
check(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AL_Shutdown()
|
||||
{
|
||||
ALdoing="Delete source";
|
||||
balDeleteSources(1,&sounds1[1].source);
|
||||
check(1);
|
||||
ALdoing="Delete buffers";
|
||||
balDeleteBuffers(16, sounds1[1].buffers);
|
||||
check(1);
|
||||
if (openal_disabled)return;
|
||||
|
||||
ALdoing="Shut";
|
||||
balcMakeContextCurrent(NULL);
|
||||
|
@ -346,9 +336,8 @@ void AL_Shutdown()
|
|||
unloadaldriver();
|
||||
}
|
||||
|
||||
#define BUFFER_SIZE (4096 * 4*8*8)
|
||||
#define BUFFER_SIZE 65536 // (4096 * 4*8*8)
|
||||
int AL_MusicVolume;
|
||||
sounddef1 music;
|
||||
extern int Musicsize;
|
||||
|
||||
|
||||
|
@ -428,12 +417,11 @@ void AL_Stop()
|
|||
Bmemset(&music,0,sizeof(sounddef1));
|
||||
}
|
||||
|
||||
static char pcm[BUFFER_SIZE];
|
||||
|
||||
int stream(ALuint buffer)
|
||||
{
|
||||
ALsizei size=0;
|
||||
int section,result;
|
||||
static char pcm[BUFFER_SIZE];
|
||||
|
||||
while (size<BUFFER_SIZE)
|
||||
{
|
||||
|
|
|
@ -54,10 +54,6 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
|
|||
#include <SDL_mixer.h>
|
||||
#include "music.h"
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
#include "openal.h"
|
||||
#endif
|
||||
|
||||
#define __FX_TRUE (1 == 1)
|
||||
#define __FX_FALSE (!__FX_TRUE)
|
||||
|
||||
|
@ -324,7 +320,7 @@ int MUSIC_Init(int SoundCard, int Address)
|
|||
// Use an external MIDI player if the user has specified to do so
|
||||
char *command = getenv("EDUKE32_MIDI_CMD");
|
||||
external_midi = (command != NULL && command[0] != 0);
|
||||
if (external_midi)
|
||||
if(external_midi)
|
||||
Mix_SetMusicCMD(command);
|
||||
|
||||
init_debugging();
|
||||
|
@ -349,7 +345,7 @@ int MUSIC_Shutdown(void)
|
|||
musdebug("shutting down sound subsystem.");
|
||||
|
||||
// TODO - make sure this is being called from the menu -- SA
|
||||
if (external_midi)
|
||||
if(external_midi)
|
||||
Mix_SetMusicCMD(NULL);
|
||||
|
||||
MUSIC_StopSong();
|
||||
|
@ -380,11 +376,6 @@ void MUSIC_SetVolume(int volume)
|
|||
volume = max(0, volume);
|
||||
volume = min(volume, 255);
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_SetMusicVolume(volume);
|
||||
#endif
|
||||
|
||||
Mix_VolumeMusic(volume >> 1); // convert 0-255 to 0-128.
|
||||
} // MUSIC_SetVolume
|
||||
|
||||
|
@ -421,37 +412,21 @@ int MUSIC_SongPlaying(void)
|
|||
|
||||
void MUSIC_Continue(void)
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Continue();
|
||||
#endif
|
||||
if (Mix_PausedMusic())
|
||||
Mix_ResumeMusic();
|
||||
else if (music_songdata
|
||||
#ifdef USE_OPENAL
|
||||
&& (openal_disabled || AL_isntALmusic())
|
||||
#endif
|
||||
)
|
||||
else if (music_songdata)
|
||||
MUSIC_PlaySong((unsigned char *)music_songdata, MUSIC_PlayOnce);
|
||||
} // MUSIC_Continue
|
||||
|
||||
|
||||
void MUSIC_Pause(void)
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Pause();
|
||||
#endif
|
||||
Mix_PauseMusic();
|
||||
} // MUSIC_Pause
|
||||
|
||||
|
||||
int MUSIC_StopSong(void)
|
||||
{
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
AL_Stop();
|
||||
#endif
|
||||
//if (!fx_initialized)
|
||||
if (!Mix_QuerySpec(NULL, NULL, NULL))
|
||||
{
|
||||
|
@ -475,6 +450,7 @@ int MUSIC_StopSong(void)
|
|||
int MUSIC_PlaySong(unsigned char *song, int loopflag)
|
||||
{
|
||||
//SDL_RWops *rw;
|
||||
|
||||
MUSIC_StopSong();
|
||||
|
||||
music_songdata = (char *)song;
|
||||
|
@ -492,12 +468,13 @@ int MUSIC_PlaySong(unsigned char *song, int loopflag)
|
|||
music_musicchunk = Mix_LoadMUS_RW(rw);
|
||||
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
|
||||
*/
|
||||
|
||||
return(MUSIC_Ok);
|
||||
} // MUSIC_PlaySong
|
||||
|
||||
|
||||
// Duke3D-specific. --ryan.
|
||||
void PlayMusic(char *_filename, int loopflag)
|
||||
void PlayMusic(char *_filename)
|
||||
{
|
||||
//char filename[MAX_PATH];
|
||||
//strcpy(filename, _filename);
|
||||
|
@ -509,89 +486,67 @@ void PlayMusic(char *_filename, int loopflag)
|
|||
void *song;
|
||||
int rc;
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
if (!openal_disabled)
|
||||
MUSIC_StopSong();
|
||||
initprintf("trying to play %s\n",_filename);
|
||||
// Read from a groupfile, write it to disk so SDL_mixer can read it.
|
||||
// Lame. --ryan.
|
||||
handle = kopen4load(_filename, 0);
|
||||
if (handle == -1)
|
||||
return;
|
||||
|
||||
size = kfilelength(handle);
|
||||
if (size == -1)
|
||||
{
|
||||
int fp;
|
||||
int l;
|
||||
kclose(handle);
|
||||
return;
|
||||
} // if
|
||||
|
||||
fp = kopen4load(_filename,0);
|
||||
|
||||
if (fp == -1) return;
|
||||
|
||||
l = kfilelength(fp);
|
||||
MUSIC_StopSong();
|
||||
Musicsize=0;
|
||||
if (!MusicPtr)MusicPtr=Bcalloc(1,l);
|
||||
else MusicPtr=Brealloc(MusicPtr,l);
|
||||
Musicsize=l;
|
||||
|
||||
kread(fp, MusicPtr, l);
|
||||
kclose(fp);
|
||||
AL_PlaySong((char *)MusicPtr,loopflag);
|
||||
}
|
||||
if (openal_disabled || AL_isntALmusic())
|
||||
#endif
|
||||
song = malloc(size);
|
||||
if (song == NULL)
|
||||
{
|
||||
MUSIC_StopSong();
|
||||
kclose(handle);
|
||||
return;
|
||||
} // if
|
||||
|
||||
rc = kread(handle, song, size);
|
||||
kclose(handle);
|
||||
if (rc != size)
|
||||
{
|
||||
Bfree(song);
|
||||
return;
|
||||
} // if
|
||||
|
||||
// save the file somewhere, so SDL_mixer can load it
|
||||
{
|
||||
char *user = getenv("USERNAME");
|
||||
|
||||
if (user) Bsprintf(tempbuf,"duke3d_%s.%d",user,getpid());
|
||||
else Bsprintf(tempbuf,"duke3d.%d",getpid());
|
||||
|
||||
GetUnixPathFromEnvironment(filename, BMAX_PATH, tempbuf);
|
||||
|
||||
handle = SafeOpenWrite(filename, filetype_binary);
|
||||
|
||||
// Read from a groupfile, write it to disk so SDL_mixer can read it.
|
||||
// Lame. --ryan.
|
||||
handle = kopen4load(_filename, 0);
|
||||
if (handle == -1)
|
||||
return;
|
||||
|
||||
size = kfilelength(handle);
|
||||
if (size == -1)
|
||||
midifn = Bstrdup(filename);
|
||||
|
||||
SafeWrite(handle, song, size);
|
||||
close(handle);
|
||||
Bfree(song);
|
||||
|
||||
//music_songdata = song;
|
||||
|
||||
music_musicchunk = Mix_LoadMUS(filename);
|
||||
initprintf("filename: %s\n",filename);
|
||||
if (music_musicchunk != NULL)
|
||||
{
|
||||
kclose(handle);
|
||||
return;
|
||||
// !!! FIXME: I set the music to loop. Hope that's okay. --ryan.
|
||||
initprintf("playing..\n");
|
||||
Musicsize = size;
|
||||
Mix_PlayMusic(music_musicchunk, -1);
|
||||
} // if
|
||||
|
||||
song = malloc(size);
|
||||
if (song == NULL)
|
||||
{
|
||||
kclose(handle);
|
||||
return;
|
||||
} // if
|
||||
|
||||
rc = kread(handle, song, size);
|
||||
kclose(handle);
|
||||
if (rc != size)
|
||||
{
|
||||
Bfree(song);
|
||||
return;
|
||||
} // if
|
||||
|
||||
// save the file somewhere, so SDL_mixer can load it
|
||||
{
|
||||
char *user = getenv("USERNAME");
|
||||
|
||||
if (user) Bsprintf(tempbuf,"duke3d-%s.%d.mid",user,getpid());
|
||||
else Bsprintf(tempbuf,"duke3d.%d.mid",getpid());
|
||||
|
||||
GetUnixPathFromEnvironment(filename, BMAX_PATH, tempbuf);
|
||||
|
||||
handle = SafeOpenWrite(filename, filetype_binary);
|
||||
|
||||
if (handle == -1)
|
||||
return;
|
||||
|
||||
midifn = Bstrdup(filename);
|
||||
|
||||
SafeWrite(handle, song, size);
|
||||
close(handle);
|
||||
Bfree(song);
|
||||
|
||||
//music_songdata = song;
|
||||
|
||||
music_musicchunk = Mix_LoadMUS(filename);
|
||||
if (music_musicchunk != NULL)
|
||||
{
|
||||
// !!! FIXME: I set the music to loop. Hope that's okay. --ryan.
|
||||
Mix_PlayMusic(music_musicchunk, -1);
|
||||
} // if
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "util_lib.h"
|
||||
#include "osd.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef USE_OPENAL
|
||||
#include "openal.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define LOUDESTVOLUME 150
|
||||
|
||||
|
|
Loading…
Reference in a new issue