From 1b91c1bae3f85b59224e4f09c608865307228f29 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 18 Nov 2006 08:46:58 +0000 Subject: [PATCH] This probably fixes building with SDL on Windows git-svn-id: https://svn.eduke32.com/eduke32@346 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile | 20 +++++++++++++------- polymer/eduke32/source/game.c | 4 +--- polymer/eduke32/source/jaudiolib/sdlmusic.c | 21 ++++++--------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index d4dde8902..807d644c8 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -66,15 +66,17 @@ JMACTOBJ=$(OBJ)/util_lib.$o \ $(OBJ)/mathutil.$o \ $(OBJ)/scriplib.$o +AUDIOLIB_FX_STUB=$(OBJ)/audiolib_fxstub.$o +AUDIOLIB_MUSIC_STUB=$(OBJ)/audiolib_musicstub.$o + AUDIOLIB_FX_SDL=$(OBJ)/mv_mix.$o \ $(OBJ)/mv_mix16.$o \ $(OBJ)/mvreverb.$o \ $(OBJ)/ll_man.$o \ $(OBJ)/fx_man.$o \ - $(OBJ)/dsl.$o \ - $(OBJ)/pitch.$o \ - $(OBJ)/multivoc.$o - + $(OBJ)/dsl.$o \ + $(OBJ)/pitch.$o \ + $(OBJ)/multivoc.$o AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o \ $(OBJ)/unixglob.$o @@ -123,13 +125,17 @@ ifeq ($(PLATFORM),WINDOWS) endif ifeq ($(RENDERTYPE),SDL) - OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell sdl-config --cflags)) - LIBS+= -lSDL_mixer + OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell sdl-config --cflags)) ifneq (0,$(JFAUD)) AUDIOLIBOBJ=$(AUDIOLIB_JFAUD) else - AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_SDL) $(AUDIOLIB_FX_SDL) $(OBJ)/sounds.$o + ifneq ($(PLATFORM),WINDOWS) + AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_SDL) $(AUDIOLIB_FX_SDL) $(OBJ)/sounds.$o + LIBS+= -lSDL_mixer + else + AUDIOLIBOBJ=$(AUDIOLIB_MUSIC_STUB) $(AUDIOLIB_FX_STUB) $(OBJ)/sounds.$o + endif endif ifeq (1,$(HAVE_GTK2)) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b17bb69a4..3d245eec6 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7001,9 +7001,7 @@ PALONLY: #pragma optimize("",on) #endif -static char terminx[64] = - { "Undead TC still sucks." - }; +static char terminx[64] = { "Undead TC still sucks." }; char cheatquotes[][MAXCHEATLEN] = { diff --git a/polymer/eduke32/source/jaudiolib/sdlmusic.c b/polymer/eduke32/source/jaudiolib/sdlmusic.c index 121e1a3ed..01fec0bd3 100755 --- a/polymer/eduke32/source/jaudiolib/sdlmusic.c +++ b/polymer/eduke32/source/jaudiolib/sdlmusic.c @@ -71,16 +71,8 @@ int MUSIC_ErrorCode = MUSIC_Ok; static char warningMessage[80]; static char errorMessage[80]; -static int fx_initialized = 0; -static int numChannels = MIX_CHANNELS; -static void(*callback)(unsigned long); -static int reverseStereo = 0; -static int reverbDelay = 256; -static int reverbLevel = 0; -static int fastReverb = 0; static FILE *debug_file = NULL; static int initialized_debugging = 0; -static int mixerIsStereo = 1; // This gets called all over the place for information and debugging messages. // If the user set the DUKESND_DEBUG environment variable, the messages @@ -126,6 +118,7 @@ static void init_debugging(void) initialized_debugging = 1; } // init_debugging +#if 0 static void setWarningMessage(const char *msg) { strncpy(warningMessage, msg, sizeof(warningMessage)); @@ -133,7 +126,7 @@ static void setWarningMessage(const char *msg) warningMessage[sizeof(warningMessage) - 1] = '\0'; musdebug("Warning message set to [%s].", warningMessage); } // setErrorMessage - +#endif static void setErrorMessage(const char *msg) { @@ -278,7 +271,7 @@ void MUSIC_Continue(void) if (Mix_PausedMusic()) Mix_ResumeMusic(); else if (music_songdata) - MUSIC_PlaySong(music_songdata, MUSIC_PlayOnce); + MUSIC_PlaySong((unsigned char *)music_songdata, MUSIC_PlayOnce); } // MUSIC_Continue @@ -315,7 +308,7 @@ int MUSIC_PlaySong(unsigned char *song, int loopflag) MUSIC_StopSong(); - music_songdata = song; + music_songdata = (char *)song; // !!! FIXME: This could be a problem...SDL/SDL_mixer wants a RWops, which // !!! FIXME: is an i/o abstraction. Since we already have the MIDI data @@ -335,8 +328,6 @@ int MUSIC_PlaySong(unsigned char *song, int loopflag) } // MUSIC_PlaySong -extern char ApogeePath[256] = "/tmp/"; - // Duke3D-specific. --ryan. void PlayMusic(char *_filename) { @@ -344,7 +335,7 @@ void PlayMusic(char *_filename) //strcpy(filename, _filename); //FixFilePath(filename); - char filename[MAX_PATH]; + char filename[BMAX_PATH]; long handle; long size; void *song; @@ -381,7 +372,7 @@ void PlayMusic(char *_filename) } // if // save the file somewhere, so SDL_mixer can load it - GetUnixPathFromEnvironment(filename, MAX_PATH, "tmpsong.mid"); + GetUnixPathFromEnvironment(filename, BMAX_PATH, "tmpsong.mid"); handle = SafeOpenWrite(filename, filetype_binary); SafeWrite(handle, song, size);