diff --git a/Makefile.am b/Makefile.am index 1f4a523..c306e35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ ## If you don't want it to overwrite it, ## Please disable it in the Anjuta project configuration -SUBDIRS = src +SUBDIRS = src bomberclonedocdir = ${prefix}/doc/bomberclone bomberclonedoc_DATA = \ @@ -17,8 +17,6 @@ bomberclonedoc_DATA = \ EXTRA_DIST = bomberclone.prj $(bomberclonedoc_DATA) - - # Copy all the spec files. Of cource, only one is actually used. dist-hook: for specfile in *.spec; do \ diff --git a/bomberclone.prj b/bomberclone.prj index c667f71..f2db375 100644 --- a/bomberclone.prj +++ b/bomberclone.prj @@ -111,7 +111,9 @@ module.source.files=\ single.c\ sysfunc.h\ mapmenu.c\ - special.c + special.c\ + sound.h\ + sound.c module.pixmap.name=pixmaps module.pixmap.type= diff --git a/config.h.in b/config.h.in index f497108..7899174 100644 --- a/config.h.in +++ b/config.h.in @@ -23,3 +23,6 @@ /* Version number of package */ #undef VERSION +/* SDL_mixer */ +#undef HAVE_SDL_MIXER + diff --git a/configure.in b/configure.in index 0c22c5f..5f3bc38 100644 --- a/configure.in +++ b/configure.in @@ -46,6 +46,27 @@ esac CFLAGS="$CFLAGS -Wall" +dnl SDL_mixer ********************************** +AC_ARG_WITH(sdlmixer-prefix, [ --with-sdlmixer-prefix=PFX prefix where SDL_mixer library is installed], sdlmixer_prefix="$withval", sdlmixer_prefix="") + +if test x"$sdlmixer_prefix" != "x"; then + SDLMIXER_LIB="-L$sdlmixer_prefix/lib" + SDLMIXER_CFLAGS="-I$sdlmixer_prefix/include" + LDFLAGS="$SDLMIXER_LIB $LDFLAGS" + CFLAGS="$CFLAGS $SDLMIXER_CFLAGS" +fi + +AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, have_sdl_mixer="yes", have_sdl_mixer="no" , ) + +if test "x$have_sdl_mixer" = "xyes"; then + AC_DEFINE(HAVE_SDL_MIXER, [1], [SDL_mixer]) + LIBS="$LIBS -lSDL_mixer" +else + AC_MSG_WARN([*** libSDL_mixer not found. Make sure you have the development package of SDL_mixer installed - (www.libsdl.org) - or try to use --with-sdlmixer-prefix option]) +fi + + + dnl Checks for library functions. diff --git a/src/Makefile.am b/src/Makefile.am index 7f801f2..87d0537 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,9 @@ bomberclone_SOURCES = \ keybinput.h \ keybinput.c \ single.c \ - special.c + special.c \ + sound.h \ + sound.c ## bomberclone_LDADD = diff --git a/src/bomb.c b/src/bomb.c index 6393e58..4ad3695 100644 --- a/src/bomb.c +++ b/src/bomb.c @@ -3,7 +3,7 @@ #include "bomberclone.h" #include "network.h" #include "gfx.h" - +#include "sound.h" void @@ -58,6 +58,8 @@ bomb_explode (int p, int b, int net) if (GT_MP_PTPM && net) /* from now on only the server let the bomb explode */ net_game_send_bomb (p, b); + + snd_play (SND_explode); }; diff --git a/src/bomberclone.h b/src/bomberclone.h index d37860d..3a103e6 100644 --- a/src/bomberclone.h +++ b/src/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.25 2003/05/19 21:51:35 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.26 2003/05/26 20:25:54 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -33,7 +33,11 @@ #include #endif #include -#include "../config.h" + +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include "gfx.h" #include "network.h" #include "sysfunc.h" @@ -221,7 +225,7 @@ void menu_clearkeybuff(); // configuration extern void configuration (); -extern void game_init (); +extern void game_init (int argc, char **argv); extern int ReadConfig(); extern int WriteConfig(); extern void ReadPrgArgs (int argc, char **argv); diff --git a/src/configuration.c b/src/configuration.c index 1c69303..b94c5eb 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -8,9 +8,10 @@ #include "packets.h" #include "gfx.h" #include "chat.h" +#include "sound.h" void -game_init () +game_init (int argc, char **argv) { int i; @@ -51,7 +52,23 @@ game_init () sprintf (bman.datapath, PACKAGE_DATA_DIR); bman.fieldpath[0] = 0; bman.random_map = 2; + snd.inited = 0; init_map_tileset(); + + d_printf ("\n\n ***** Bomberclone Version %s \n\n",VERSION); + if (ReadConfig()) { + gfx_init (); + menu_get_text ("Please You Playername", bman.playername, LEN_PLAYERNAME-1); + bman.playername[LEN_PLAYERNAME-1] = 0; + } else { + gfx_init (); + if (bman.askplayername) + menu_get_text ("Please You Playername", bman.playername, LEN_PLAYERNAME); + else menu_clearkeybuff(); + } + ReadPrgArgs (argc, argv); + + snd_init (); }; int diff --git a/src/gfx.c b/src/gfx.c index 64d59ec..d9dae88 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -3,6 +3,7 @@ #include #include "bomberclone.h" #include "gfx.h" +#include "sound.h" int UpdateRects_nr = 0; SDL_Rect UpdateRects[MAX_UPDATERECTS]; @@ -464,6 +465,7 @@ gfx_game_init () menu_displaytext ("Loading..", "Please Wait", 32, 128, 32); gfx_load_tileset (gfx.tileset); gfx_load_players (gfx.block.x, gfx.block.y); + snd_load (gfx.tileset); }; void diff --git a/src/main.c b/src/main.c index 1867ade..f0a62d6 100644 --- a/src/main.c +++ b/src/main.c @@ -31,19 +31,7 @@ main (int argc, char **argv) SDL_WM_SetCaption(text , NULL); SDL_EnableUNICODE(1); - game_init (argv); - d_printf ("\n\n ***** Bomberclone Version %s \n\n",VERSION); - if (ReadConfig()) { - gfx_init (); - menu_get_text ("Please You Playername", bman.playername, LEN_PLAYERNAME-1); - bman.playername[LEN_PLAYERNAME-1] = 0; - } else { - gfx_init (); - if (bman.askplayername) - menu_get_text ("Please You Playername", bman.playername, LEN_PLAYERNAME); - else menu_clearkeybuff(); - } - ReadPrgArgs (argc, argv); + game_init (argc, argv); sprintf(text,"Welcome to BomberClone"); while (menuselect != -1 && bman.state != GS_quit) { diff --git a/src/player.c b/src/player.c index a36b3e2..7e8af47 100644 --- a/src/player.c +++ b/src/player.c @@ -3,7 +3,7 @@ #include #include "bomberclone.h" #include "network.h" - +#include "sound.h" void draw_player (_player * player) @@ -371,6 +371,8 @@ player_drop_bomb (int pl_nr) if (GT_MP_PTPS) bomb->to = bomb->to + ((2 * RESENDCACHE_RETRY) / TIME_FACTOR); } + + snd_play (SND_bombdrop); } }; @@ -415,6 +417,8 @@ player_died (_player * player, signed char dead_by) if (GT_MP_PTP) net_game_send_player (bman.p_nr); + + snd_play (SND_dead); }; diff --git a/src/single.c b/src/single.c index 26a62bb..72b1c5b 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.19 2003/05/25 22:24:47 stpohle Exp $ */ +/* $Id: single.c,v 1.20 2003/05/26 20:25:54 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -282,7 +282,6 @@ ai_findnearbombs (_point pos) while (!done) { done = 1; - printf (" c "); /* check every direction again */ for (d = 0; d < 4; d++) if (dist[d].x >= 0 && dist[d].x < bman.fieldsize.x &&