mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
The cdrom code now uses strequal where appropriate. Also, playing track 0
now stops the CD from playing. CD track 0 is used this way already, even by the Id-licensed mission packs.
This commit is contained in:
parent
a96536c896
commit
27d177f978
4 changed files with 49 additions and 48 deletions
|
@ -134,7 +134,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
track = remap[track];
|
||||
|
||||
if (track < 1 || track > maxTrack) {
|
||||
Con_DPrintf ("CDAudio: Bad track number %u.\n", track);
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
// don't try to play a non-audio track
|
||||
|
@ -257,19 +257,19 @@ CD_f (void)
|
|||
|
||||
command = Cmd_Argv (1);
|
||||
|
||||
if (strcasecmp (command, "on") == 0) {
|
||||
if (strequal (command, "on")) {
|
||||
mus_enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "off") == 0) {
|
||||
if (strequal (command, "off")) {
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
mus_enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "reset") == 0) {
|
||||
if (strequal (command, "reset")) {
|
||||
mus_enabled = true;
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
|
@ -279,7 +279,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "remap") == 0) {
|
||||
if (strequal (command, "remap")) {
|
||||
ret = Cmd_Argc () - 2;
|
||||
if (ret <= 0) {
|
||||
for (n = 1; n < 100; n++)
|
||||
|
@ -292,7 +292,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "close") == 0) {
|
||||
if (strequal (command, "close")) {
|
||||
CDAudio_CloseDoor ();
|
||||
return;
|
||||
}
|
||||
|
@ -305,32 +305,32 @@ CD_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "play") == 0) {
|
||||
if (strequal (command, "play")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "loop") == 0) {
|
||||
if (strequal (command, "loop")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "stop") == 0) {
|
||||
if (strequal (command, "stop")) {
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "pause") == 0) {
|
||||
if (strequal (command, "pause")) {
|
||||
CDAudio_Pause ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "resume") == 0) {
|
||||
if (strequal (command, "resume")) {
|
||||
CDAudio_Resume ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "eject") == 0) {
|
||||
if (strequal (command, "eject")) {
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
CDAudio_Eject ();
|
||||
|
@ -338,7 +338,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "info") == 0) {
|
||||
if (strequal (command, "info")) {
|
||||
Con_Printf ("%u tracks\n", maxTrack);
|
||||
if (playing)
|
||||
Con_Printf ("Currently %s track %u\n",
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "QF/compat.h"
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
|
@ -83,7 +84,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
}
|
||||
|
||||
if ((track < 1) || (track >= cd_id->numtracks)) {
|
||||
Con_DPrintf ("CDAudio: Bad track number: %d\n", track);
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
track--; /* Convert track from person to SDL
|
||||
|
@ -239,10 +240,10 @@ CD_f (void)
|
|||
return;
|
||||
|
||||
command = Cmd_Argv (1);
|
||||
if (!strcasecmp (command, "on")) {
|
||||
if (strequal (command, "on")) {
|
||||
enabled = true;
|
||||
}
|
||||
if (!strcasecmp (command, "off")) {
|
||||
if (strequal (command, "off")) {
|
||||
if (!cd_id)
|
||||
return;
|
||||
cdstate = SDL_CDStatus (cd_id);
|
||||
|
@ -251,31 +252,31 @@ CD_f (void)
|
|||
enabled = false;
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "play")) {
|
||||
if (strequal (command, "play")) {
|
||||
CDAudio_Play (atoi (Cmd_Argv (2)), false);
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "loop")) {
|
||||
if (strequal (command, "loop")) {
|
||||
CDAudio_Play (atoi (Cmd_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "stop")) {
|
||||
if (strequal (command, "stop")) {
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "pause")) {
|
||||
if (strequal (command, "pause")) {
|
||||
CDAudio_Pause ();
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "resume")) {
|
||||
if (strequal (command, "resume")) {
|
||||
CDAudio_Resume ();
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "eject")) {
|
||||
if (strequal (command, "eject")) {
|
||||
CDAudio_Eject ();
|
||||
return;
|
||||
}
|
||||
if (!strcasecmp (command, "info")) {
|
||||
if (strequal (command, "info")) {
|
||||
if (!cd_id)
|
||||
return;
|
||||
cdstate = SDL_CDStatus (cd_id);
|
||||
|
|
|
@ -115,7 +115,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
track = remap[track];
|
||||
|
||||
if (track < 1 || track > maxtrack) {
|
||||
Con_DPrintf ("CDAudio_Play: Bad track number %u.\n", track);
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
// don't try to play a non-audio track
|
||||
|
@ -191,18 +191,18 @@ CD_f (void)
|
|||
|
||||
command = Cmd_Argv (1);
|
||||
|
||||
if (strcasecmp (command, "on") == 0) {
|
||||
if (strequal (command, "on")) {
|
||||
enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "off") == 0) {
|
||||
if (strequal (command, "off")) {
|
||||
CDAudio_Stop ();
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "reset") == 0) {
|
||||
if (strequal (command, "reset")) {
|
||||
enabled = true;
|
||||
CDAudio_Stop ();
|
||||
|
||||
|
@ -212,7 +212,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "remap") == 0) {
|
||||
if (strequal (command, "remap")) {
|
||||
ret = Cmd_Argc () - 2;
|
||||
|
||||
if (ret <= 0) {
|
||||
|
@ -228,38 +228,38 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "play") == 0) {
|
||||
if (strequal (command, "play")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "loop") == 0) {
|
||||
if (strequal (command, "loop")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "stop") == 0) {
|
||||
if (strequal (command, "stop")) {
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "pause") == 0) {
|
||||
if (strequal (command, "pause")) {
|
||||
CDAudio_Pause ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "resume") == 0) {
|
||||
if (strequal (command, "resume")) {
|
||||
CDAudio_Resume ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "eject") == 0) {
|
||||
if (strequal (command, "eject")) {
|
||||
CDAudio_Stop ();
|
||||
CDAudio_Eject ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "info") == 0) {
|
||||
if (strequal (command, "info")) {
|
||||
Con_Printf ("%u tracks\n", CDAudio_MaxTrack ());
|
||||
if (CDAudio_GetState () == CD_PLAYING)
|
||||
Con_Printf ("Currently %s track %u\n",
|
||||
|
|
|
@ -142,7 +142,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
track = remap[track];
|
||||
|
||||
if (track < 1 || track > maxTrack) {
|
||||
Con_DPrintf ("CDAudio: Bad track number %u.\n", track);
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
// don't try to play a non-audio track
|
||||
|
@ -287,19 +287,19 @@ CD_f (void)
|
|||
|
||||
command = Cmd_Argv (1);
|
||||
|
||||
if (strcasecmp (command, "on") == 0) {
|
||||
if (strequal (command, "on")) {
|
||||
enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "off") == 0) {
|
||||
if (strequal (command, "off")) {
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "reset") == 0) {
|
||||
if (strequal (command, "reset")) {
|
||||
enabled = true;
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
|
@ -309,7 +309,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "remap") == 0) {
|
||||
if (strequal (command, "remap")) {
|
||||
ret = Cmd_Argc () - 2;
|
||||
if (ret <= 0) {
|
||||
for (n = 1; n < 100; n++)
|
||||
|
@ -322,7 +322,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "close") == 0) {
|
||||
if (strequal (command, "close")) {
|
||||
CDAudio_CloseDoor ();
|
||||
return;
|
||||
}
|
||||
|
@ -335,32 +335,32 @@ CD_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "play") == 0) {
|
||||
if (strequal (command, "play")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "loop") == 0) {
|
||||
if (strequal (command, "loop")) {
|
||||
CDAudio_Play ((byte) atoi (Cmd_Argv (2)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "stop") == 0) {
|
||||
if (strequal (command, "stop")) {
|
||||
CDAudio_Stop ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "pause") == 0) {
|
||||
if (strequal (command, "pause")) {
|
||||
CDAudio_Pause ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "resume") == 0) {
|
||||
if (strequal (command, "resume")) {
|
||||
CDAudio_Resume ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "eject") == 0) {
|
||||
if (strequal (command, "eject")) {
|
||||
if (playing)
|
||||
CDAudio_Stop ();
|
||||
CDAudio_Eject ();
|
||||
|
@ -368,7 +368,7 @@ CD_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcasecmp (command, "info") == 0) {
|
||||
if (strequal (command, "info")) {
|
||||
Con_Printf ("%u tracks\n", maxTrack);
|
||||
if (playing)
|
||||
Con_Printf ("Currently %s track %u\n",
|
||||
|
|
Loading…
Reference in a new issue