remove two redundant functions from cd_funcs_t and convert all the cd

plugins to using pre-initialized structs
This commit is contained in:
Bill Currie 2004-01-20 08:34:57 +00:00
parent ce3c58e238
commit f7fe0a4a8c
7 changed files with 260 additions and 169 deletions

View file

@ -47,9 +47,7 @@ typedef struct cd_funcs_s {
P_CDAudio_Pause pCDAudio_Pause; P_CDAudio_Pause pCDAudio_Pause;
P_CDAudio_Play pCDAudio_Play; P_CDAudio_Play pCDAudio_Play;
P_CDAudio_Resume pCDAudio_Resume; P_CDAudio_Resume pCDAudio_Resume;
P_CDAudio_Shutdown pCDAudio_Shutdown;
P_CDAudio_Update pCDAudio_Update; P_CDAudio_Update pCDAudio_Update;
P_CDAudio_Init pCDAudio_Init;
} cd_funcs_t; } cd_funcs_t;
typedef struct cd_data_s { typedef struct cd_data_s {

View file

@ -66,16 +66,9 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "compat.h" #include "compat.h"
static plugin_t plugin_info;
static plugin_data_t plugin_info_data;
static plugin_funcs_t plugin_info_funcs;
static general_data_t plugin_info_general_data; static general_data_t plugin_info_general_data;
static general_funcs_t plugin_info_general_funcs; static general_funcs_t plugin_info_general_funcs;
//static cd_data_t plugin_info_cd_data;
static cd_funcs_t plugin_info_cd_funcs;
/* static qboolean cdValid = false; *//* removed, not using a cd. */
static qboolean playing = false; static qboolean playing = false;
static qboolean wasPlaying = false; static qboolean wasPlaying = false;
static qboolean mus_enabled = false; static qboolean mus_enabled = false;
@ -425,7 +418,6 @@ static void
Mus_VolChange (cvar_t *bgmvolume) Mus_VolChange (cvar_t *bgmvolume)
{ {
Sys_Printf ("Entering Mus_VolChange\n"); Sys_Printf ("Entering Mus_VolChange\n");
} }
static void static void
@ -441,33 +433,50 @@ I_OGGMus_Init (void)
"Volume of CD music"); "Volume of CD music");
} }
static general_funcs_t plugin_info_general_funcs = {
I_OGGMus_Init,
I_OGGMus_Shutdown,
};
static cd_funcs_t plugin_info_cd_funcs = {
I_OGG_f,
I_OGGMus_Pause,
I_OGGMus_Play,
I_OGGMus_Resume,
I_OGGMus_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"OGG Music output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n",
&plugin_info_funcs,
&plugin_info_data,
};
PLUGIN_INFO (cd, file) PLUGIN_INFO (cd, file)
{ {
plugin_info.type = qfp_cd; /* enum, leave */
plugin_info.api_version = QFPLUGIN_VERSION; /* version symbol. leave */
plugin_info.plugin_version = "0.1"; /* plugin version, increment */
plugin_info.description = "OGG Music output\n"
"Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n";
plugin_info.functions = &plugin_info_funcs;
plugin_info.data = &plugin_info_data;
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_OGGMus_Init;
plugin_info_general_funcs.p_Shutdown = I_OGGMus_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_OGGMus_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_OGGMus_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_OGGMus_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_OGGMus_Update;
plugin_info_cd_funcs.pCD_f = I_OGG_f;
return &plugin_info; return &plugin_info;
} }

View file

@ -455,33 +455,50 @@ I_CDAudio_Init (void)
"Volume of CD music"); "Volume of CD music");
} }
PLUGIN_INFO(cd, linux) static general_funcs_t plugin_info_general_funcs = {
{ I_CDAudio_Init,
plugin_info.type = qfp_cd; I_CDAudio_Shutdown,
plugin_info.api_version = QFPLUGIN_VERSION; };
plugin_info.plugin_version = "0.1";
plugin_info.description = "Linux CD Audio output" static cd_funcs_t plugin_info_cd_funcs = {
I_CD_f,
I_CDAudio_Pause,
I_CDAudio_Play,
I_CDAudio_Resume,
I_CDAudio_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"Linux CD Audio output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n" "Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n"; "Please see the file \"AUTHORS\" for a list of contributors\n",
plugin_info.functions = &plugin_info_funcs; &plugin_info_funcs,
plugin_info.data = &plugin_info_data; &plugin_info_data,
};
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_CDAudio_Init;
plugin_info_general_funcs.p_Shutdown = I_CDAudio_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_CDAudio_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_CDAudio_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_CDAudio_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_CDAudio_Update;
plugin_info_cd_funcs.pCD_f = I_CD_f;
PLUGIN_INFO (cd, linux)
{
return &plugin_info; return &plugin_info;
} }

View file

@ -282,33 +282,50 @@ I_CDAudio_Init (void)
Sys_Printf ("CD Audio Initialized.\n"); Sys_Printf ("CD Audio Initialized.\n");
} }
PLUGIN_INFO(cd, sdl) static general_funcs_t plugin_info_general_funcs = {
{ I_CDAudio_Init,
plugin_info.type = qfp_cd; I_CDAudio_Shutdown,
plugin_info.api_version = QFPLUGIN_VERSION; };
plugin_info.plugin_version = "0.1";
plugin_info.description = "SDL CD Audio output" static cd_funcs_t plugin_info_cd_funcs = {
I_CD_f,
I_CDAudio_Pause,
I_CDAudio_Play,
I_CDAudio_Resume,
I_CDAudio_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"SDL CD Audio output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n" "Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n"; "Please see the file \"AUTHORS\" for a list of contributors\n",
plugin_info.functions = &plugin_info_funcs; &plugin_info_funcs,
plugin_info.data = &plugin_info_data; &plugin_info_data,
};
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_CDAudio_Init;
plugin_info_general_funcs.p_Shutdown = I_CDAudio_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_CDAudio_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_CDAudio_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_CDAudio_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_CDAudio_Update;
plugin_info_cd_funcs.pCD_f = I_CD_f;
PLUGIN_INFO (cd, sdl)
{
return &plugin_info; return &plugin_info;
} }

View file

@ -363,33 +363,50 @@ I_SGI_Init (void)
return ; return ;
} }
PLUGIN_INFO(cd, sgi) static general_funcs_t plugin_info_general_funcs = {
{ I_SGI_Init,
plugin_info.type = qfp_cd; I_SGI_Shutdown,
plugin_info.api_version = QFPLUGIN_VERSION; };
plugin_info.plugin_version = "0.1";
plugin_info.description = "SGI (CD) Audio output" static cd_funcs_t plugin_info_cd_funcs = {
I_SGI_f,
I_SGI_Pause,
I_SGI_Play,
I_SGI_Resume,
I_SGI_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"SGI CD Audio output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n" "Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n"; "Please see the file \"AUTHORS\" for a list of contributors\n",
plugin_info.functions = &plugin_info_funcs; &plugin_info_funcs,
plugin_info.data = &plugin_info_data; &plugin_info_data,
};
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_SGI_Init;
plugin_info_general_funcs.p_Shutdown = I_SGI_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_SGI_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_SGI_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_SGI_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_SGI_Update;
plugin_info_cd_funcs.pCD_f = I_SGI_f;
PLUGIN_INFO (cd, sgi)
{
return &plugin_info; return &plugin_info;
} }

View file

@ -500,34 +500,50 @@ I_CDAudio_Init (void)
} }
} }
PLUGIN_INFO(cd, win) static general_funcs_t plugin_info_general_funcs = {
{ I_CDAudio_Init,
plugin_info.type = qfp_cd; I_CDAudio_Shutdown,
plugin_info.api_version = QFPLUGIN_VERSION; };
plugin_info.plugin_version = "0.1";
plugin_info.description = "Windows CD Audio output" static cd_funcs_t plugin_info_cd_funcs = {
I_CD_f,
I_CDAudio_Pause,
I_CDAudio_Play,
I_CDAudio_Resume,
I_CDAudio_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"Windows CD Audio output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n" "Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n"; "Please see the file \"AUTHORS\" for a list of contributors\n",
plugin_info.functions = &plugin_info_funcs; &plugin_info_funcs,
&plugin_info_data,
plugin_info.data = &plugin_info_data; };
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_CDAudio_Init;
plugin_info_general_funcs.p_Shutdown = I_CDAudio_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_CDAudio_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_CDAudio_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_CDAudio_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_CDAudio_Update;
plugin_info_cd_funcs.pCD_f = I_CD_f;
PLUGIN_INFO (cd, win)
{
return &plugin_info; return &plugin_info;
} }

View file

@ -533,33 +533,50 @@ I_XMMS_f (void)
return; return;
} }
PLUGIN_INFO(cd, xmms) static general_funcs_t plugin_info_general_funcs = {
{ I_XMMS_Init,
plugin_info.type = qfp_cd; I_XMMS_Shutdown,
plugin_info.api_version = QFPLUGIN_VERSION; };
plugin_info.plugin_version = "0.1";
plugin_info.description = "Linux XMMS (CD) Audio output" static cd_funcs_t plugin_info_cd_funcs = {
I_XMMS_f,
I_XMMS_Pause,
I_XMMS_Play,
I_XMMS_Resume,
I_XMMS_Update,
};
static plugin_funcs_t plugin_info_funcs = {
&plugin_info_general_funcs,
0,
&plugin_info_cd_funcs,
0,
0,
0,
};
static plugin_data_t plugin_info_data = {
&plugin_info_general_data,
0,
0,
0,
0,
0,
};
static plugin_t plugin_info = {
qfp_cd,
0,
QFPLUGIN_VERSION,
"0.1",
"Linux XMMS Audio output\n",
"Copyright (C) 2001 contributors of the QuakeForge project\n" "Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n"; "Please see the file \"AUTHORS\" for a list of contributors\n",
plugin_info.functions = &plugin_info_funcs; &plugin_info_funcs,
plugin_info.data = &plugin_info_data; &plugin_info_data,
};
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_XMMS_Init;
plugin_info_general_funcs.p_Shutdown = I_XMMS_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_XMMS_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_XMMS_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_XMMS_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_XMMS_Update;
plugin_info_cd_funcs.pCD_f = I_XMMS_f;
PLUGIN_INFO (cd, xmms)
{
return &plugin_info; return &plugin_info;
} }