From c1bb4b27256bbd9931d2f39629f3e23015b510aa Mon Sep 17 00:00:00 2001 From: cypress Date: Thu, 20 Jul 2023 12:55:17 -0400 Subject: [PATCH] VITA/NX: Add music streaming --- source/bgmusic.c | 2 +- source/menu.c | 15 +++++++++++++++ source/pr_cmds.c | 9 ++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/bgmusic.c b/source/bgmusic.c index 65df3ca..e036848 100644 --- a/source/bgmusic.c +++ b/source/bgmusic.c @@ -26,7 +26,7 @@ #include "snd_codec.h" #include "bgmusic.h" -#define MUSIC_DIRNAME "music" +#define MUSIC_DIRNAME "tracks" qboolean bgmloop; cvar_t bgm_extmusic = {"bgm_extmusic", "1", CVAR_ARCHIVE}; diff --git a/source/menu.c b/source/menu.c index 84b2ad5..2b0e24d 100644 --- a/source/menu.c +++ b/source/menu.c @@ -1005,6 +1005,8 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("deathmatch 0\n"); Cbuf_AddText ("coop 0\n"); + Cbuf_AddText ("music_loop\n"); + Cbuf_AddText ("music_stop\n"); Cbuf_AddText ("map ndu\n"); loadingScreen = 1; loadname2 = "ndu"; @@ -1022,6 +1024,8 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("deathmatch 0\n"); Cbuf_AddText ("coop 0\n"); Cbuf_AddText ("map warehouse\n"); + Cbuf_AddText ("music_loop\n"); + Cbuf_AddText ("music_stop\n"); loadingScreen = 1; loadname2 = "warehouse"; loadnamespec = "Warehouse"; @@ -1038,6 +1042,8 @@ void M_SinglePlayer_Key (int key) Cbuf_AddText ("deathmatch 0\n"); Cbuf_AddText ("coop 0\n"); Cbuf_AddText ("map christmas_special\n"); + Cbuf_AddText ("music_loop\n"); + Cbuf_AddText ("music_stop\n"); loadingScreen = 1; loadname2 = "christmas_special"; loadnamespec = "Christmas Special"; @@ -1678,6 +1684,8 @@ void M_Menu_Maps_Key (int key) Cbuf_AddText ("maxplayers 1\n"); Cbuf_AddText ("deathmatch 0\n"); Cbuf_AddText ("coop 0\n"); + Cbuf_AddText ("music_loop\n"); + Cbuf_AddText ("music_stop\n"); char map_selection[MAX_QPATH]; strcpy(map_selection, custom_maps[m_maps_cursor + multiplier].map_name); @@ -4417,12 +4425,19 @@ void M_Init (void) Map_Finder(); } +qboolean music_init = false; void M_Draw (void) { if (m_state == m_none || key_dest != key_menu) return; + if (!music_init) { + Cbuf_AddText("music tensioned_by_the_damned\n"); + Cbuf_AddText("music_loop\n"); + music_init = true; + } + if (!m_recursiveDraw) { //scr_copyeverything = 1; diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 3816da5..3ae0130 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -1255,12 +1255,11 @@ songegg(trackname) */ void PF_SongEgg (void) { - char trackname; - - trackname = G_STRING(OFS_PARM0); + char* s; + s = G_STRING(OFS_PARM0); - MSG_WriteByte (&sv.reliable_datagram, svc_songegg); - MSG_WriteString (&sv.reliable_datagram, trackname); + Cbuf_AddText ("music_loop\n"); + Cbuf_AddText (va("music %s\n",s)); } /*