Even more conversion, lots of superfluous macro removal

This commit is contained in:
iikorni
2026-08-29 23:14:23 -05:00
parent 70e5c02355
commit de75b014b3
102 changed files with 7060 additions and 8179 deletions
+19 -21
View File
@@ -43,18 +43,18 @@
#include "quakedef.hpp"
static qboolean cdValid = false;
static qboolean playing = false;
static qboolean wasPlaying = false;
static qboolean enabled = true;
static qboolean playLooping = false;
static bool cdValid = false;
static bool playing = false;
static bool wasPlaying = false;
static bool enabled = true;
static bool playLooping = false;
static byte remap[100];
static byte playTrack;
static double endOfTrack = -1.0, pausetime = -1.0;
static SDL_CD *cd_handle;
static int cd_dev = -1;
static float old_cdvolume;
static qboolean hw_vol_works = true;
static bool hw_vol_works = true;
static void CDAudio_Eject(void)
@@ -84,7 +84,7 @@ static int CDAudio_GetAudioDiskInfo(void)
return 0;
}
int CDAudio_Play(byte track, qboolean looping)
int CDAudio_Play(byte track, bool looping)
{
int len_m, len_s, len_f;
@@ -370,21 +370,21 @@ static void CD_f (void)
Con_Printf ("cd: unknown command \"%s\"\n", command);
}
static qboolean CD_GetVolume (void *unused)
static bool CD_GetVolume (void *unused)
{
/* FIXME: write proper code in here when SDL
supports cdrom volume control some day. */
return false;
}
static qboolean CD_SetVolume (void *unused)
static bool CD_SetVolume (void *unused)
{
/* FIXME: write proper code in here when SDL
supports cdrom volume control some day. */
return false;
}
static qboolean CDAudio_SetVolume (float value)
static bool CDAudio_SetVolume (float value)
{
if (!cd_handle || !enabled)
return false;
@@ -485,11 +485,11 @@ static void export_cddev_arg (void)
/* Bad ugly hack to workaround SDL's cdrom device detection.
* not needed for windows due to the way SDL_cdrom works. */
#if !defined(_WIN32)
int i = COM_CheckParm("-cddev");
if (i != 0 && i < com_argc - 1 && com_argv[i+1][0] != '\0')
auto i = common::check_param("-cddev");
if (i.has_value() && i.value() < com_argc - 1 && com_argv[i.value()+1][0] != '\0')
{
static char arg[64];
q_snprintf(arg, sizeof(arg), "SDL_CDROM=%s", com_argv[i+1]);
q_snprintf(arg, sizeof(arg), "SDL_CDROM=%s", com_argv[i.value()+1]);
putenv(arg);
}
#endif
@@ -497,9 +497,7 @@ static void export_cddev_arg (void)
int CDAudio_Init(void)
{
int i, sdl_num_drives;
if (safemode || COM_CheckParm("-nocdaudio"))
if (safemode || common::check_param("-nocdaudio").has_value())
return -1;
export_cddev_arg();
@@ -510,22 +508,22 @@ int CDAudio_Init(void)
return -1;
}
sdl_num_drives = SDL_CDNumDrives ();
const int sdl_num_drives = SDL_CDNumDrives();
Con_Printf ("SDL detected %d CD-ROM drive%c\n", sdl_num_drives,
sdl_num_drives == 1 ? ' ' : 's');
if (sdl_num_drives < 1)
return -1;
if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1)
if (const auto dev = common::check_param("-cddev"); dev.has_value() && dev.value() < com_argc - 1)
{
const char *userdev = get_cddev_arg(com_argv[i+1]);
const char *userdev = get_cddev_arg(com_argv[dev.value()+1]);
if (!userdev)
{
Con_Printf("Invalid argument to -cddev\n");
return -1;
}
for (i = 0; i < sdl_num_drives; i++)
for (auto i = 0; i < sdl_num_drives; i++)
{
if (!q_strcasecmp(SDL_CDName(i), userdev))
{
@@ -551,7 +549,7 @@ int CDAudio_Init(void)
return -1;
}
for (i = 0; i < 100; i++)
for (auto i = 0; i < 100; i++)
remap[i] = i;
enabled = true;
old_cdvolume = bgmvolume.value;