From 6c82de82e4aa8a78e8382e69785c3406cb261f63 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 7 Aug 2014 05:26:55 -0400 Subject: [PATCH 1/2] Add Tune words Next to freeslot mus, allow those to be played in tunes command. --- src/d_netcmd.c | 10 ++++++++-- src/dehacked.c | 6 ++++-- src/dehacked.h | 3 +++ src/sdl/i_cdmus.c | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 13cf2fed9..f77cdee83 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3763,6 +3763,8 @@ static void Command_Displayplayer_f(void) CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer); } +#include "dehacked.h" +#include "fastcmp.h" static void Command_Tunes_f(void) { const char *tunearg; @@ -3788,9 +3790,13 @@ static void Command_Tunes_f(void) tune = mapheaderinfo[gamemap-1]->musicslot; track = mapheaderinfo[gamemap-1]->musicslottrack; } - else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') + else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') && (strlen(tunearg) < 3)) tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); - + else if (fastncmp("mus_",tunearg,4)) //yellowtd: why not just give both tune options? + tune = get_mus(tunearg+4); + else if (tunearg) + tune = get_mus(tunearg); + if (tune >= NUMMUSIC) { CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1); diff --git a/src/dehacked.c b/src/dehacked.c index b92850cce..af0e40819 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -65,7 +65,7 @@ static mobjtype_t get_mobjtype(const char *word); static statenum_t get_state(const char *word); static spritenum_t get_sprite(const char *word); static sfxenum_t get_sfx(const char *word); -static UINT16 get_mus(const char *word); +//static UINT16 get_mus(const char *word); static hudnum_t get_huditem(const char *word); #ifndef HAVE_BLUA static powertype_t get_power(const char *word); @@ -7987,7 +7987,9 @@ static sfxenum_t get_sfx(const char *word) return sfx_None; } -static UINT16 get_mus(const char *word) +//yellowtd: make get_mus an extern +//static UINT16 get_mus(const char *word) +extern UINT16 get_mus(const char *word) { // Returns the value of SFX_ enumerations UINT16 i; if (*word >= '0' && *word <= '9') diff --git a/src/dehacked.h b/src/dehacked.h index d87d22679..1c6bd6553 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -41,6 +41,9 @@ void DEH_Check(void); fixed_t get_number(const char *word); +//yellowtd: make get_mus an extern +extern UINT16 get_mus(const char *word); + #ifdef HAVE_BLUA boolean LUA_SetLuaAction(void *state, const char *actiontocompare); const char *LUA_GetActionName(void *action); diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c index fc35eb9cf..73857af58 100644 --- a/src/sdl/i_cdmus.c +++ b/src/sdl/i_cdmus.c @@ -1,3 +1,4 @@ +#ifdef HAVE_SDL #include "../command.h" #include "../s_sound.h" #include "../i_sound.h" @@ -36,3 +37,4 @@ boolean I_SetVolumeCD(int volume) return false; } +#endif From de573814c48a94aece6a74e856c3ca210c3f7d1f Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 7 Aug 2014 05:37:49 -0400 Subject: [PATCH 2/2] shortfix --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f77cdee83..e4669c093 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3790,7 +3790,7 @@ static void Command_Tunes_f(void) tune = mapheaderinfo[gamemap-1]->musicslot; track = mapheaderinfo[gamemap-1]->musicslottrack; } - else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') && (strlen(tunearg) < 3)) + else if ((toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') && (strlen(tunearg) < 3)) tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); else if (fastncmp("mus_",tunearg,4)) //yellowtd: why not just give both tune options? tune = get_mus(tunearg+4);