From 003114074015aa6387cf8e11ee172e5439cc61b0 Mon Sep 17 00:00:00 2001 From: stevenaaus Date: Mon, 4 Aug 2014 00:08:22 +0000 Subject: [PATCH] 'cd next', 'cd prev' commands. 'cd play' plays track 1. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@950 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/Makefile | 2 ++ Quake/cd_sdl.c | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Quake/Makefile b/Quake/Makefile index 6b2afd21..30aa70f9 100644 --- a/Quake/Makefile +++ b/Quake/Makefile @@ -291,3 +291,5 @@ debug: clean: rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print) +install: quakespasm + cp quakespasm /usr/local/games/quake diff --git a/Quake/cd_sdl.c b/Quake/cd_sdl.c index b59d19b6..6a7fba3d 100644 --- a/Quake/cd_sdl.c +++ b/Quake/cd_sdl.c @@ -229,7 +229,7 @@ static void CD_f (void) Con_Printf("commands:"); Con_Printf("on, off, reset, remap, \n"); Con_Printf("play, stop, loop, pause, resume\n"); - Con_Printf("eject, info\n"); + Con_Printf("eject, info, next, prev\n"); return; } @@ -287,7 +287,10 @@ static void CD_f (void) if (q_strcasecmp(command, "play") == 0) { - CDAudio_Play((byte)atoi(Cmd_Argv (2)), false); + n = atoi(Cmd_Argv (2)); + if (n == 0) + n = 1; + CDAudio_Play((byte)n, false); return; } @@ -351,6 +354,22 @@ static void CD_f (void) return; } + if (q_strcasecmp(command, "next") == 0) + { + if (playTrack == cd_handle->numtracks) + playTrack = 0; + CDAudio_Play(playTrack + 1, playLooping); + return; + } + + if (q_strcasecmp(command, "prev") == 0) + { + if (playTrack == 1) + playTrack = cd_handle->numtracks + 1; + CDAudio_Play(playTrack - 1, playLooping); + return; + } + Con_Printf("cd: unknown command \"%s\".\n",command); }