]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cd_win.c
call reset functions in init code (not necessary currently, as the compilers currentl...
[xonotic/darkplaces.git] / cd_win.c
index 8fba829a58c6677bb99fd376284bd5ed67da3e88..e3359487ff4365be89808dde7d0da11ee3d4e802 100644 (file)
--- a/cd_win.c
+++ b/cd_win.c
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 See the GNU General Public License for more details.
 
@@ -107,7 +107,7 @@ void CDAudio_Play(qbyte track, qboolean looping)
 
        if (!enabled)
                return;
-       
+
        if (!cdValid)
        {
                CDAudio_GetAudioDiskInfo();
@@ -180,7 +180,7 @@ void CDAudio_Stop(void)
 
        if (!enabled)
                return;
-       
+
        if (!playing)
                return;
 
@@ -219,13 +219,13 @@ void CDAudio_Resume(void)
 
        if (!enabled)
                return;
-       
+
        if (!cdValid)
                return;
 
        if (!wasPlaying)
                return;
-       
+
        mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0);
        mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0);
        mciPlayParms.dwCallback = (DWORD)mainwindow;
@@ -360,7 +360,7 @@ static void CD_f (void)
 
 LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-       if (lParam != wDeviceID)
+       if (lParam != (LPARAM)wDeviceID)
                return 1;
 
        switch (wParam)
@@ -418,10 +418,7 @@ void CDAudio_Update(void)
 
 int CDAudio_Init(void)
 {
-       DWORD   dwReturn;
-       MCI_OPEN_PARMS  mciOpenParms;
-       MCI_SET_PARMS   mciSetParms;
-       int                             n;
+       int n;
 
        if (cls.state == ca_dedicated)
                return -1;
@@ -429,6 +426,22 @@ int CDAudio_Init(void)
        if (COM_CheckParm("-nocdaudio") || COM_CheckParm("-safe"))
                return -1;
 
+       for (n = 0; n < 100; n++)
+               remap[n] = n;
+       cdaudioinitialized = true;
+       enabled = true;
+
+       Cmd_AddCommand("cd", CD_f);
+
+       return 0;
+}
+
+int CDAudio_Startup(void)
+{
+       DWORD   dwReturn;
+       MCI_OPEN_PARMS  mciOpenParms;
+       MCI_SET_PARMS   mciSetParms;
+
        mciOpenParms.lpstrDeviceType = "cdaudio";
        if ((dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD) (LPVOID) &mciOpenParms)))
        {
@@ -446,21 +459,15 @@ int CDAudio_Init(void)
                return -1;
        }
 
-       for (n = 0; n < 100; n++)
-               remap[n] = n;
-       cdaudioinitialized = true;
-       initialized = true;
-       enabled = true;
-
        if (CDAudio_GetAudioDiskInfo())
        {
-               Con_Printf("CDAudio_Init: No CD in player.\n");
+               Con_DPrintf("CDAudio_Init: No CD in player.\n");
                cdValid = false;
        }
 
-       Cmd_AddCommand ("cd", CD_f);
+       initialized = true;
 
-       Con_Printf("CD Audio Initialized\n");
+       Con_DPrintf("CD Audio Initialized\n");
 
        return 0;
 }
@@ -473,13 +480,6 @@ void CDAudio_Shutdown(void)
        CDAudio_Stop();
        if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
                Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
+       initialized = false;
 }
 
-
-void CDAudio_Open(void)
-{
-}
-
-void CDAudio_Close(void)
-{
-}