From 4dd6b733d6936c37e9bb67a0f60df9166f55af26 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 16:23:01 -0400 Subject: [PATCH 1/3] MUSICPOSITION -> MUSICPOS * Added muspos level header var to lua # Conflicts: # src/dehacked.c # src/lua_maplib.c # src/p_setup.c --- src/dehacked.c | 6 +++--- src/doomstat.h | 2 +- src/lua_maplib.c | 2 ++ src/p_setup.c | 2 +- src/s_sound.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3786a805a..0bb118682 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1151,8 +1151,8 @@ static void readlevelheader(MYFILE *f, INT32 num) #endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); - else if (fastcmp(word, "MUSICPOSITION")) - mapheaderinfo[num-1]->musposition = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICPOS")) + mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); @@ -1449,7 +1449,7 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) { cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; } - else if (fastcmp(word, "MUSICPOSITION")) + else if (fastcmp(word, "MUSICPOS")) { cutscenes[num]->scene[scenenum].musswitchposition = (UINT32)get_number(word2); } diff --git a/src/doomstat.h b/src/doomstat.h index 610c21941..723132ff6 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -225,7 +225,7 @@ typedef struct INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. - UINT32 musposition; ///< Music position to jump to. + UINT32 muspos; ///< Music position to jump to. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. INT16 skynum; ///< Sky number to use. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index b929fc0bc..c0ce46030 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1760,6 +1760,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) lua_pushinteger(L, header->mustrack); + else if (fastcmp(field,"muspos")) + lua_pushinteger(L, header->muspos); else if (fastcmp(field,"forcecharacter")) lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) diff --git a/src/p_setup.c b/src/p_setup.c index a579f65dd..d9330f175 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -208,7 +208,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; - mapheaderinfo[num]->musposition = 0; + mapheaderinfo[num]->muspos = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; diff --git a/src/s_sound.c b/src/s_sound.c index 604b710ee..03e724a4d 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1741,7 +1741,7 @@ void S_Start(void) strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); mapmusname[6] = 0; mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); - mapmusposition = mapheaderinfo[gamemap-1]->musposition; + mapmusposition = mapheaderinfo[gamemap-1]->muspos; } if (cv_resetmusic.value) From 48b6255e93a65b0b90c97ec1d2580f759720071a Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 21:42:39 -0400 Subject: [PATCH 2/3] Case-insensitive music_name comparison --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 03e724a4d..805be2650 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1584,7 +1584,7 @@ void S_ChangeMusicAdvanced(const char *mmusic, UINT16 mflags, boolean looping, U I_FadeSong(0, prefadems, S_ChangeMusicToQueue); return; } - else if (strncmp(music_name, newmusic, 6) || (mflags & MUSIC_FORCERESET)) + else if (strnicmp(music_name, newmusic, 6) || (mflags & MUSIC_FORCERESET)) { CONS_Debug(DBG_DETAILED, "Now playing song %s\n", newmusic); From 9f3549e5e15e5aed4cc48a21d5971b699b0e1ef0 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 25 Aug 2018 21:53:22 -0400 Subject: [PATCH 3/3] Remove tolower music_name, because we do case-insensitive matching now --- src/s_sound.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 805be2650..129cc5f39 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1562,10 +1562,6 @@ void S_ChangeMusicAdvanced(const char *mmusic, UINT16 mflags, boolean looping, U #endif newmusic[6] = 0; - int i; - for (i = 0; newmusic[i]; i++) { - newmusic[i] = tolower(newmusic[i]); - } // No Music (empty string) if (newmusic[0] == 0)