Index: ctp2_code/ctp/c3.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/ctp/c3.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 c3.h
--- ctp2_code/ctp/c3.h	2 Feb 2004 13:02:49 -0000	1.1.1.2
+++ ctp2_code/ctp/c3.h	3 Feb 2004 20:12:00 -0000
@@ -33,7 +33,7 @@
 //
 //----------------------------------------------------------------------------
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
 #endif
 
@@ -50,12 +50,13 @@
 
 #endif
 
-#include <limits.h>
-#include <crtdbg.h>
+#include <limits.h>
+#if !defined(__GNUC__)
+#include <crtdbg.h>
+#endif
 #include <windows.h>
 #include <tchar.h>
 
-
 #define DIRECTINPUT_VERSION 0x0700
 
 #include "ddraw.h"
@@ -72,7 +73,10 @@
 #include <sys/stat.h>
 #include <stdarg.h>
 #include <time.h>
-
+
+#if defined(__GNUC__)
+#define _MAX_PATH PATH_MAX
+#endif
 
 #include "c3types.h"
 #include "c3debug.h"
Index: ctp2_code/ctp/c3types.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/ctp/c3types.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 c3types.h
--- ctp2_code/ctp/c3types.h	2 Feb 2004 12:30:22 -0000	1.1.1.1
+++ ctp2_code/ctp/c3types.h	3 Feb 2004 20:13:36 -0000
@@ -1,16 +1,37 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+//
+//----------------------------------------------------------------------------
 
-
-
-
-
-
-
-
-
-
-
-
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
+
 #ifndef __C3TYPES_H__
 #define __C3TYPES_H__
 
Index: ctp2_code/ctp/civ3_main.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/ctp/civ3_main.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 civ3_main.cpp
--- ctp2_code/ctp/civ3_main.cpp	2 Feb 2004 12:30:22 -0000	1.1.1.1
+++ ctp2_code/ctp/civ3_main.cpp	3 Feb 2004 20:42:26 -0000
@@ -1,16 +1,59 @@
- 
-
-
-
-
-
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// __GNUC__
+// - We are compiling with gcc
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+//
+//----------------------------------------------------------------------------
 
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
+#pragma once
+#endif
 
+#if 0 && defined(__GNUC__)
+#include <exception.h>
+#define __try __TRY
+#define __except __EXCEPT
+#endif
+ 
 #include "c3.h"
 
 #include "aui.h"
 #include "pixelutils.h"
-#include "ColorSet.h"
+#include "colorset.h"
 #include "civapp.h"
 
 #include "civ3_main.h"
@@ -41,17 +84,21 @@
 #include "c3_button.h"
 #include "c3_dropdown.h"
 #include "aui_ldl.h"
-#include "backgroundWin.h"
-#include "GameFile.h"
+#include "backgroundwin.h"
+#include "gamefile.h"
 #include "controlpanelwindow.h"
 #include "keypress.h"
+
+#if !defined(__GNUC__) // TODO: replacement needed (wine doesnt have these headers...)
 #include "directvideo.h"
 #include "videoutils.h"
+#endif
+
 #include "radarmap.h"
 #include "statswindow.h"
-#include "aui_DirectKeyboard.h"
+#include "aui_directkeyboard.h"
 #include "ancientwindows.h"
-#include "Splash.h"
+#include "splash.h"
 #include "bevellesswindow.h"
 
 
@@ -66,14 +113,14 @@
 #include "World.h"
 #include "gameinit.h"
 #include "TradePool.h"
-#include "Pollution.h"
+#include "pollution.h"
 #include "SelItem.h"
-#include "Player.h"
+#include "player.h"
 #include "UnitPool.h"
-#include "ProfileDB.h"
+#include "profileDB.h"
 #include "CivilisationDB.h"
 #include "TurnCnt.h"
-#include "constdb.h"
+#include "ConstDB.h"
 
 
 #include "RoboInit.h"
@@ -81,13 +128,13 @@
 
 
 
-#include "ScreenManager.h"
+#include "screenmanager.h"
 #include "Sprite.h"
 #include "UnitSpriteGroup.h"
-#include "TiledMap.h"
+#include "tiledmap.h"
 #include "SpriteStateDB.h"
 #include "SpriteGroupList.h"
-#include "Director.h"
+#include "director.h"
 
 
 #include "network.h"
@@ -108,7 +155,7 @@
 #include "spwindow.h"
 #include "scenariowindow.h"
 #include "initialplaywindow.h"
-#include "GrabItem.h"
+#include "grabitem.h"
 
 #include "appstrings.h"
 
@@ -121,18 +168,25 @@
 #include "cursormanager.h"
 #include "MainControlPanel.h"
 #include "ctp2_Window.h"
-#include "ctp2_MenuBar.h"
+#include "ctp2_menubar.h"
 
 
 #include <locale.h>
 
+#if !defined(ACTIVISION_ORIGINAL)
+#include <SDL.h>
+#include <SDL_mixer.h>
+#endif
+
 
-#include "CivScenarios.h"
+#include "civscenarios.h"
 extern CivScenarios		*g_civScenarios;
 
 #include "ctpregistry.h"
 
+#ifndef WM_MOUSEWHEEL
 #define WM_MOUSEWHEEL (WM_MOUSELAST+1)  
+#endif
 
 #ifdef _DEBUG
 #include "debug.h"
@@ -228,9 +282,6 @@
 SpriteStateDB               *g_theSpriteStateDB;
 
 
-
-
-
 SpriteStateDB				*g_theGoodsSpriteStateDB;
 SpriteStateDB				*g_theCitySpriteStateDB;
 
@@ -441,8 +492,6 @@
 	g_c3ui->RegisterObject( mouse );
 
 
-
-
 	SPLASH_STRING("Creating Keyboard...");
 
 	
@@ -453,12 +502,13 @@
 	g_c3ui->RegisterObject( keyboard );
 
 
-	
+#if !defined(__GNUC__)
 	aui_DirectMovieManager	*movieManager = new aui_DirectMovieManager();
 	Assert(movieManager != NULL);
 	if (movieManager != NULL) {
 		g_c3ui->RegisterObject(movieManager);
 	}
+#endif
 
 	
 	SPLASH_STRING("Starting Mouse...");
@@ -1241,6 +1291,15 @@
 void AtExitProc(void)
 {
 	printf("At exit.\n");
+
+#if !defined(ACTIVISION_ORIGINAL)
+# if 0
+    // What about this?
+    Mix_CloseAudio();
+# endif
+
+    SDL_Quit();
+#endif
 }
 
 BOOL g_no_timeslice; 
@@ -1424,6 +1483,7 @@
 	uint32	basePtr = ebp;
 
 	BOOL done = FALSE;
+#if !defined(__GNUC__)
 	while(!done) {
 		__try {
 			caller = *((unsigned *) (basePtr + 4));
@@ -1443,6 +1503,7 @@
 		
 		basePtr = * ((unsigned *) basePtr);  
 	}
+#endif
 
 	uint32 guid = rand() * rand() + rand();
 
@@ -1641,34 +1702,17 @@
 
 void main_ExceptionExecute(CivExceptionFunction function)
 {
-	
+#if !defined(__GNUC__)	
 	__try
 	{
 		function();
 	}
-
 	
 	__except (main_CivExceptionHandler(GetExceptionInformation()))
 	{
 
 		g_c3ui->DestroyDirectScreen();
 		ShowWindow(gHwnd, SW_HIDE);
-
-		
-
-
-
-
-
-
-
-
-
-		
-		
-		
-		
-		
 		
 		if (!s_cleaningUpTheApp) {
 			s_cleaningUpTheApp = TRUE;
@@ -1677,6 +1721,7 @@
 
 		exit(-1);
 	}
+#endif // !defined(__GNUC__)
 }
 
 BOOL main_CheckDirectX(void)
@@ -1751,7 +1796,9 @@
 	time_t		ltime;
 	struct tm	*now;
 
+#if defined(ACTIVISION_ORIGINAL)
 	atexit(AtExitProc);
+#endif
 
 	
 	
@@ -1866,16 +1913,33 @@
 #endif
 }
 
+#if !defined(__GNUC__)
 int WINAPI CivWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow);
+#else
+int CivMain(int argc, char **argv);
+#endif
 
 
 
-
-
-
+#if !defined(__GNUC__)
 
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
 {
+    // This stuff will have to be moved into a new int main(int argc, char **argv)
+    // once graphics are also ported to SDL
+#if !defined(ACTIVISION_ORIGINAL)
+# if defined(WIN32) || defined(_WINDOWS)
+    // Make sure old versions of DDHELP.EXE won't keep files open
+    HINSTANCE handle = LoadLibrary("DDRAW.DLL");
+    if (0 != handle) {
+        FreeLibrary(handle);
+        handle = 0;
+    }
+# endif // WIN32 || _WINDOWS
+
+   	atexit(AtExitProc);
+#endif // !ACTIVISION_ORIGINAL
+
 	__try {
 		return CivWinMain(hInstance, hPrevInstance, szCmdLine, iCmdShow);
 	} 
@@ -1887,20 +1951,6 @@
 	__except (main_CivExceptionHandler(GetExceptionInformation())){
 		g_c3ui->DestroyDirectScreen();
 		ShowWindow(gHwnd, SW_HIDE);
-
-
-
-
-
-
-
-
-
-		
-		
-		
-		
-		
 		
 		if (!s_cleaningUpTheApp) {
 			s_cleaningUpTheApp = TRUE;
@@ -1909,11 +1959,36 @@
 
 		exit(-1);
 	}
-#endif
+#endif // _DEBUG
 	return 0;
 }
 
+#else // defined(__GNUC__)
+
+int main(int argc, char **argv)
+{
+    int r;
 
+    r = CivMain(argc, argv);
+
+    if (r <  0) {
+#if defined(_DEBUG)
+        DoFinalCleanup();
+#else
+        g_c3ui->DestroyDirectScreen();
+        ShowWindow(gHwnd, SW_HIDE);
+        if (!s_cleaningUpTheApp) {
+            s_cleaningUpTheApp = TRUE;
+            g_civApp->CleanupApp();
+        }
+
+        exit(r);
+#endif
+    }
+
+    return 0;
+}
+#endif // !defined(__GNUC__)
 
 void main_DisplayPatchDisclaimer()
 {
@@ -1954,11 +2029,13 @@
 
 }
 
+#if !defined(__GNUC__)
 
 int WINAPI CivWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
 {
 	MSG			msg;
 
+
 	
 	HWND hwnd = FindWindow (gszMainWindowClass, gszMainWindowName);
 	if (hwnd) {
@@ -2165,7 +2242,178 @@
 	return msg.wParam;
 }
 
+#else // defined(__GNUC__)
+
+int
+CivMain(int argc, char *argv )
+{
+	MSG			msg;
+
+#if 0
+	// I guess this code checks to see if a civctp2 is already running,
+	// and if so, bring that window to the foreground.
+	
+	HWND hwnd = FindWindow (gszMainWindowClass, gszMainWindowName);
+	if (hwnd) {
+		
+		if (IsIconic(hwnd)) {
+			ShowWindow(hwnd, SW_RESTORE);
+		}
+		SetForegroundWindow (hwnd);
+		
+		return FALSE;
+	}
+#endif	
+	
+	
+	char exepath[_MAX_PATH];
+	char launchcommand[_MAX_PATH];
+	if(GetModuleFileName(NULL, exepath, _MAX_PATH) != 0) {
+			
+			ctpregistry_SetKeyValue(HKEY_CLASSES_ROOT, ".c2g", NULL, "c2gfile");
+			ctpregistry_SetKeyValue(HKEY_CLASSES_ROOT, "c2gfile", NULL, "Call to Power 2 saved game");
+			strcpy(launchcommand, exepath);
+			strcat(launchcommand, " -l\"%1\"");
+			ctpregistry_SetKeyValue(HKEY_CLASSES_ROOT, "c2gfile\\Shell\\Open\\command", NULL, launchcommand);
+			
+									 
+		char *lastbackslash = strrchr(exepath, '\\');
+		if(lastbackslash) {
+			*lastbackslash = 0;
+			SetCurrentDirectory(exepath);
+		}
+	}
+
+	
+	
+	g_e3Demo = false;
+
+	
+	appstrings_Initialize();
+
+	
+	setlocale(LC_COLLATE, appstrings_GetString(APPSTR_LOCALE));
+
+	
+	c3cpu_Initialize();
+	c3cpu_Examine();
+
+	if (!main_CheckDirectX()) {
+
+		c3errors_FatalDialog(appstrings_GetString(APPSTR_DIRECTX),
+								appstrings_GetString(APPSTR_NEEDDIRECTX));
+	}
+
+	
+#ifdef _DEBUG
+	main_InitializeLogs();
+#endif
+#if !defined(_DEBUG) && !defined(_BFR_)
+	
+	SECURITY_ATTRIBUTES		sa;
+
+	sa.nLength = sizeof(sa);
+	sa.lpSecurityDescriptor = NULL;
+	sa.bInheritHandle = TRUE;
+	
+	CreateDirectory((LPCTSTR)"logs", &sa);
+#endif
+
+
+    ParseCommandLine(argv);
+
+	if(g_e3Demo) {
+		if(!g_no_shell && !g_launchScenario) {
+			g_no_shell = TRUE;
+		}
+	}
+
+	g_civApp = new CivApp();
+
+	
+    if (g_cmdline_load) {
+        g_civApp->InitializeApp(NULL, argc);
+
+		ScenarioPack	*pack;
+		Scenario		*scen;
+
+		if (g_civScenarios->FindScenarioFromSaveFile(g_cmdline_load_filename, &pack, &scen)) {
+			
+			g_civPaths->SetCurScenarioPath(scen->m_path);
+			
+			
+			g_civPaths->SetCurScenarioPackPath(pack->m_path);
+
+			
+			g_theProfileDB->SetIsScenario(TRUE);
+
+			
+			if (g_civScenarios->ScenarioHasSavedGame(scen)) {
+				
+				spnewgamescreen_scenarioExitCallback(NULL, 0, 0, NULL);
+			} else {
+				
+				
+				spnewgamescreen_displayMyWindow();
+			}
+		} else {
+			main_RestoreGame(g_cmdline_load_filename);
+		}
+    } else if (g_no_shell) {
+		g_civApp->QuickInit(NULL, argc);
+	} else if (g_launchScenario) {	
+		g_civApp->InitializeApp(NULL, argc);
+		ScenarioPack	*pack;
+		Scenario		*scen;
+
+		if (g_civScenarios->FindScenario(g_scenarioName, &pack, &scen)) {
+			
+			g_civPaths->SetCurScenarioPath(scen->m_path);
+			
+			
+			g_civPaths->SetCurScenarioPackPath(pack->m_path);
+
+			
+			g_theProfileDB->SetIsScenario(TRUE);
+
+			
+			if (g_civScenarios->ScenarioHasSavedGame(scen)) {
+				
+				spnewgamescreen_scenarioExitCallback(NULL, 0, 0, NULL);
+			} else {
+				
+				
+				spnewgamescreen_displayMyWindow();
+			}
+		}
+	} else {
+		g_civApp->InitializeApp(NULL, argc);
+	}
+
+	
+	gDone = FALSE;
+
+    sint32 first_time_hack; 
+    first_time_hack = TRUE; 
+	while (!gDone) {
+		g_civApp->Process();
+
+		while (PeekMessage(&msg, gHwnd, 0, 0, PM_REMOVE) && !g_letUIProcess) {			
+			if (msg.message == WM_QUIT)
+				gDone = TRUE;
+
+			TranslateMessage(&msg);
+			DispatchMessage(&msg);
+		}
+
+		g_letUIProcess = FALSE;
+	}
+
+	return msg.wParam;
+}
+
 
+#endif // !defined(__GNUC__)
 
 
 
Index: ctp2_code/ctp/civ3_main.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/ctp/civ3_main.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 civ3_main.h
--- ctp2_code/ctp/civ3_main.h	2 Feb 2004 12:30:22 -0000	1.1.1.1
+++ ctp2_code/ctp/civ3_main.h	3 Feb 2004 20:43:08 -0000
@@ -1,17 +1,48 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// __GNUC__
+// - We are compiling with gcc
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+//
+//----------------------------------------------------------------------------
 
-
-
-
-
-
-
-
-
-
-
-
-
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
+
 #ifndef __CIV3_MAIN_H__
 #define __CIV3_MAIN_H__
 
Index: ctp2_code/ctp/ctp2_utils/c3files.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/ctp/ctp2_utils/c3files.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 c3files.cpp
--- ctp2_code/ctp/ctp2_utils/c3files.cpp	2 Feb 2004 12:30:23 -0000	1.1.1.1
+++ ctp2_code/ctp/ctp2_utils/c3files.cpp	3 Feb 2004 17:41:16 -0000
@@ -401,25 +401,11 @@
 
 		success = c3files_FindCDByName(k_CTP_CD_VOLUME_NAME, TRUE);
 
-
-
-
-
-
-
-
-		
 		
-		if (success && g_theProfileDB->IsProtected()) {
-			
+		if (success && g_theProfileDB->IsProtected()) {		
 			BOOL		valid;
-			
-			
 			BOOL		silent = TRUE;
 
-			
-			
-			
 			valid = tracklen_CheckTrackLengths();
 			
 
@@ -432,10 +418,7 @@
 			
 		}
 
-		if (!success) {
-			
-			
-			
+		if (!success) {			
 			int rval = MessageBox(g_c3ui->TheHWND(),
 									appstrings_GetString(APPSTR_INSERTCDROM), 
 									appstrings_GetString(APPSTR_CDROM), 
@@ -445,18 +428,7 @@
 										MB_SYSTEMMODAL |
 										MB_SETFOREGROUND);	
 
-
-
-
-
-
-
-
-
 			if (rval == IDCANCEL) {
-				
-				
-				
 				c3errors_ErrorDialog(appstrings_GetString(APPSTR_CDROM),
 										appstrings_GetString(APPSTR_NEEDCDROM));		
 				
@@ -482,10 +454,6 @@
 {
 	c3files_GetCDDrives();
 	BOOL success = c3files_FindCDByName(k_CTP_CD_VOLUME_NAME, TRUE);
-
-	
-	
-	
 }
 
 MBCHAR c3files_GetCTPCDDriveLetter(void)
Index: ctp2_code/sound/civsound.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/civsound.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 civsound.cpp
--- ctp2_code/sound/civsound.cpp	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/civsound.cpp	3 Feb 2004 21:02:44 -0000
@@ -1,4 +1,44 @@
-
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// USE_SDL
+// - USE SDL for sound, cdrom, ... TODO
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+// - sdl sound and cdrom
+//
+//----------------------------------------------------------------------------
 
 #include "c3.h"
 
@@ -6,25 +46,32 @@
 #include "SoundRecord.h"
 #include "prjfile.h"
 
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+#  include <SDL_rwops.h>
+#endif
+
 extern ProjectFile  *g_SoundPF;
 
-CivSound::CivSound(uint32 associatedObject, sint32 soundID)
+CivSound::CivSound(const uint32 &associatedObject, const sint32 &soundID)
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+  : m_hAudio(0),
+#else
+  : m_Audio(0), m_Channel(-1),
+#endif
+    m_associatedObject(associatedObject)
+
 {
     const char *fname;
 	if(soundID < 0)
-		fname = NULL;
+		fname = 0;
 	else
 		fname = g_theSoundDB->Get(soundID)->GetValue();
 
-    
-	m_associatedObject = associatedObject;
 	m_soundID = soundID;
     m_isPlaying = FALSE;
     m_isLooping = FALSE;
-    m_hAudio = NULL;
-
     
-    if (fname == NULL) {
+    if (0 == fname) {
         m_soundFilename[0] = 0;
         m_dataptr = NULL;
         m_datasize = 0;
@@ -36,26 +83,133 @@
     
     m_dataptr = g_SoundPF->getData(m_soundFilename, &m_datasize);
 
-    
-    m_hAudio = AIL_quick_load_mem(m_dataptr, m_datasize);
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+	m_hAudio = AIL_quick_load_mem(m_dataptr, m_datasize);
+#else
+# if 0
+    // Argh, audio format mismatch!!!
+	m_Audio = Mix_QuickLoad_RAW((Uint8 *) m_dataptr, (Uint32) m_datasize);
+# else 
+    m_Audio = Mix_LoadWAV_RW(SDL_RWFromMem(m_dataptr, m_datasize), 1);
+# endif
+#endif
 }
 
 CivSound::~CivSound()
 {
-    if (m_hAudio)
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+    if (m_hAudio) {
         AIL_quick_unload(m_hAudio);
+	}
+#else
+	if (m_Audio) {
+		Mix_FreeChunk(m_Audio);
+	}
+#endif
     
-    if (m_dataptr)
+    if (m_dataptr) {
         g_SoundPF->freeData(m_dataptr);
+	}
+}
+
+const uint32
+CivSound::GetAssociatedObject() const
+{
+	return m_associatedObject;
+}
+
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+Mix_Chunk *
+CivSound::GetAudio() const
+{
+	return m_Audio;
+}
+
+const int
+CivSound::GetChannel() const
+{
+    return m_Channel;
+}
+
+#else
+HAUDIO
+CivSound::GetHAudio() const
+{
+	return m_hAudio;
+}
+#endif
+
+MBCHAR
+*CivSound::GetSoundFilename()
+{
+	return m_soundFilename;
+}
+
+const sint32
+CivSound::GetSoundID() const
+{
+	return m_soundID;
+}
+
+const sint32
+CivSound::GetVolume()
+{
+	return m_volume;
+}
+
+const BOOL
+CivSound::IsLooping()
+{
+	return m_isLooping;
+}
+
+const BOOL
+CivSound::IsPlaying() const
+{
+	return m_isPlaying;
 }
 
-void CivSound::SetVolume(sint32 volume)
+void
+CivSound::SetChannel(const int &channel)
 {
-    if (m_hAudio == NULL)
+    m_Channel = channel;
+}
+
+void
+CivSound::SetIsLooping(const BOOL &looping)
+{
+	m_isLooping = looping;
+}
+
+void
+CivSound::SetIsPlaying(const BOOL &is)
+{
+	m_isPlaying = is;
+}
+
+void
+CivSound::SetVolume(const sint32 &volume)
+{
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+    if (0 == m_hAudio) {
+#else
+    if (0 == m_Audio) {
         return;
+    }
+#endif
 
+	// Assume max volume is 10...
 	sint32 scaledVolume = (sint32)((double)volume * 12.7);
 
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+	if (scaledVolume > MIX_MAX_VOLUME) {
+		Mix_VolumeChunk(m_Audio, MIX_MAX_VOLUME);
+	} else {
+		Mix_VolumeChunk(m_Audio, (Uint8) scaledVolume);
+	}
+#else
 	AIL_quick_set_volume(m_hAudio, scaledVolume, 64);
+#endif
 	m_volume = volume;
 }
+
Index: ctp2_code/sound/civsound.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/civsound.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 civsound.h
--- ctp2_code/sound/civsound.h	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/civsound.h	3 Feb 2004 21:03:00 -0000
@@ -1,6 +1,49 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// USE_SDL
+// - Use SDL for sound, cdrom, ... (TODO)
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+// - sdl sound and cdrom
+//
+//----------------------------------------------------------------------------
 
-
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
+
 #ifndef __CIVSOUND_H__
 #define __CIVSOUND_H__
 
@@ -9,25 +52,44 @@
 #undef STREAM_TYPE
 #endif
 
-#include "mss.h"
+#define USE_SDL 1
+
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+#  include "mss.h"
+#else // !ACTIVISION_ORIGINAL
+#  include <SDL.h>
+#  include <SDL_mixer.h>
+#endif // ACTIVISION_ORIGINAL
 
 class CivSound {
 public:
-	CivSound(uint32 associatedObject, sint32 soundID);
+	CivSound(const uint32 &associatedObject, const sint32 &soundID);
 	~CivSound();
 
-	uint32		GetAssociatedObject(void) const { return m_associatedObject; }
-	HAUDIO		GetHAudio(void) const { return m_hAudio; }
-	MBCHAR		*GetSoundFilename(void)  { return m_soundFilename; }
-	BOOL		IsPlaying(void) const { return m_isPlaying; }
-	void		SetIsPlaying(BOOL is) { m_isPlaying = is; }
-	sint32		GetSoundID(void) const { return m_soundID; }
-	void		SetIsLooping(BOOL looping) { m_isLooping = looping; }
-	BOOL		IsLooping(void) { return m_isLooping; }
-	sint32		GetVolume(void) { return m_volume; }
-	void		SetVolume(sint32 volume);
+	const uint32 GetAssociatedObject() const;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+	HAUDIO       GetHAudio() const;
+#else
+	Mix_Chunk    *GetAudio() const;
+    void         SetChannel(const int &channel);
+    const int    GetChannel() const;
+#endif
+	MBCHAR       *GetSoundFilename();
+	const BOOL   IsPlaying() const;
+	void         SetIsPlaying(const BOOL &is);
+	const sint32 GetSoundID() const;
+	void         SetIsLooping(const BOOL &looping);
+	const BOOL   IsLooping();
+	const sint32 GetVolume();
+	void         SetVolume(const sint32 &volume);
+
 private:
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	HAUDIO			m_hAudio;
+#else
+	Mix_Chunk      *m_Audio;
+    int             m_Channel;
+#endif
 	uint32 			m_associatedObject;
 	MBCHAR			m_soundFilename[_MAX_PATH];
 	BOOL			m_isPlaying;
Index: ctp2_code/sound/gamesounds.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/gamesounds.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gamesounds.cpp
--- ctp2_code/sound/gamesounds.cpp	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/gamesounds.cpp	3 Feb 2004 21:02:24 -0000
@@ -1,7 +1,43 @@
-
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+//
+//----------------------------------------------------------------------------
 
 #include "c3.h"
-#include "SoundManager.h"
+#include "soundmanager.h"
 #include "gamesounds.h"
 #include "SoundRecord.h"
 
Index: ctp2_code/sound/gamesounds.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/gamesounds.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gamesounds.h
--- ctp2_code/sound/gamesounds.h	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/gamesounds.h	3 Feb 2004 21:05:48 -0000
@@ -1,6 +1,44 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+//
+//----------------------------------------------------------------------------
 
-
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
 
 #ifndef __GAMESOUNDS_H__
 #define __GAMESOUNDS_H__
Index: ctp2_code/sound/soundevent.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/soundevent.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 soundevent.cpp
--- ctp2_code/sound/soundevent.cpp	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/soundevent.cpp	3 Feb 2004 21:07:14 -0000
@@ -1,7 +1,39 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - includes fixed for case sensitive filesystems
+//
+//----------------------------------------------------------------------------
 
 #include "c3.h"
 #include "Events.h"
-#include "SoundManager.h"
+#include "soundmanager.h"
 #include "gamesounds.h"
 #include "GameEventUser.h"
 #include "Unit.h"
Index: ctp2_code/sound/soundevent.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/soundevent.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 soundevent.h
--- ctp2_code/sound/soundevent.h	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/soundevent.h	3 Feb 2004 21:08:00 -0000
@@ -1,5 +1,37 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+//
+//----------------------------------------------------------------------------
 
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
+
 #ifndef SOUNDEVENT_H
 #define SOUNDEVENT_H
 
Index: ctp2_code/sound/soundmanager.cpp
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/soundmanager.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 soundmanager.cpp
--- ctp2_code/sound/soundmanager.cpp	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/soundmanager.cpp	3 Feb 2004 21:11:32 -0000
@@ -1,14 +1,54 @@
-
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+// USE_SDL
+// - Compile with sdl support instead of mss (define: civsound.h)
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+// - added sdl sound and cdrom support
+//
+//----------------------------------------------------------------------------
 
 #include "c3.h"
 #include "soundmanager.h"
-#include "PointerList.h"
-#include "ProfileDB.h"
+#include "pointerlist.h"
+#include "profileDB.h"
 #include "SoundRecord.h"
 #include "CivPaths.h"
 #include "c3files.h"
 #include "PlayListDB.h"
 #include "Gamesounds.h"
+#include <cctype>
 
 extern HWND			gHwnd;
 extern ProfileDB	*g_theProfileDB;
@@ -22,12 +62,11 @@
 #define k_CHECK_CD_PERIOD		4000	
 										
 
-void SoundManager::Initialize(void)
+void
+SoundManager::Initialize()
 {
 	uint32 volume = 100;
 
-
-
 	s_initSuccessful = FALSE;
 
 	g_soundManager = new SoundManager();
@@ -40,7 +79,8 @@
 	}
 }
 
-void SoundManager::Cleanup(void)
+void
+SoundManager::Cleanup()
 {
 	if (g_soundManager != NULL)
 		delete g_soundManager;
@@ -64,17 +104,22 @@
 	
 	m_oldRedbookVolume = 0;
 
-
-
-
-
-
-	
 	m_numTracks = 0;
 	m_curTrack = 0;
 	m_lastTrack = 0;
 
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+    m_cdrom = 0;
+    // Perhaps use 0 later on...
+    m_SDLInitFlags = SDL_INIT_NOPARACHUTE;
+
+    // Do not remove this or debugging won't work... :(
+# if defined(_DEBUG)
+    m_SDLInitFlags |= SDL_INIT_NOPARACHUTE;
+# endif
+#else // ACTIVISION_ORIGINAL || !USE_SDL
 	m_redbook = 0;
+#endif // defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
 	m_timeToCheckCD = 0;
 
 	m_sfxSounds = new PointerList<CivSound>;
@@ -90,9 +135,6 @@
 
 	m_usePlaySound = FALSE;
 
-
-	
-	
 	m_autoRepeat = TRUE;
 
 	if (m_usePlaySound) {
@@ -126,7 +168,8 @@
 	CleanupSoundDriver();
 }
 
-void SoundManager::DumpAllSounds(void)
+void
+SoundManager::DumpAllSounds()
 {
 	if (m_sfxSounds) {
 		m_sfxSounds->DeleteAll();
@@ -136,119 +179,219 @@
 	}
 }
 
-void SoundManager::InitSoundDriver(void)
+void
+SoundManager::InitSoundDriver()
 {
-	
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+	int errcode;
+	int use_digital;
+	int use_MIDI;
+	int output_rate;
+	Uint16 output_format;
+	int output_channels;
+#else // ACTIVISION_ORIGINAL || !USE_SDL
 	S32		errcode;
 	S32		use_digital;
 	S32		use_MIDI;
 	S32		output_rate;
 	S32		output_bits;
 	S32		output_channels;
-#ifdef _DEBUG
+#endif // defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+
+#if defined(_DEBUG) && defined(ACTIVISION_ORIGINAL)
 	use_digital = AIL_QUICK_USE_WAVEOUT;	
 #else
 	use_digital = 1;						
-#endif
-
-
-use_digital = 1;						
+#endif // defined(_DEBUG) && defined(ACTIVISION_ORIGINAL)
 
+	// Always sound?
+	use_digital = 1;						
 
 	use_MIDI = 0;			
-	output_channels = 2;	
-
-
-	
-	output_rate = 22050;	
-	output_bits = 16;		
-
-
-
 
+	// 22khz @ 16 Bit stereo
+	output_channels = 2;
+	output_rate = 22050;
 
+	MBCHAR *smname = "Sound Manager";
 
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+	output_format = AUDIO_S16SYS;
+    errcode = SDL_Init(SDL_INIT_AUDIO | m_SDLInitFlags);
+
+    if (errcode < 0) {
+        m_noSound = TRUE;
+        // char *err = SDL_GetError(); cerr << "SDL Init failed:" << err << endl;
+    } else {
+        errcode = Mix_OpenAudio(output_rate, output_format, output_channels, 8192);
+        if (errcode < 0) {
+            // char *err = SDL_GetError(); cerr << "Opening mixer failed:" << err << endl;
+            m_noSound = TRUE;
+        }
+    }
+#else // ACTIVISION_ORIGINAL || !USE_SDL
+   	output_bits = 16;
 	errcode = AIL_quick_startup(use_digital, use_MIDI, output_rate, output_bits,
 								output_channels);
-
-	MBCHAR *smname = "Sound Manager";
-
-	if (!errcode) {
-		
-
+   	if (!errcode) {	
 		m_noSound = TRUE;
 	}
+#endif // #if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
 
-	
 	InitRedbook();
 
 	
 	SetVolume(SOUNDTYPE_SFX, m_sfxVolume);
 	SetVolume(SOUNDTYPE_VOICE, m_voiceVolume);
 	SetVolume(SOUNDTYPE_MUSIC, m_musicVolume);
-
 }
 
-void SoundManager::CleanupSoundDriver(void)
+void
+SoundManager::CleanupSoundDriver()
 {
 	if (s_initSuccessful && !m_usePlaySound) {
 		CleanupRedbook();
 
-		
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+        if (!m_noSound) {
+            Mix_CloseAudio();
+        }
+
+        // SDL_Quit() -> civ_main.cpp:AtExitProc()
+#else // ACTIVISION_ORIGINAL || !USE_SDL
 		AIL_quick_shutdown();
+#endif // #if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
 	}
 }
 
-void SoundManager::InitRedbook(void)
+void
+SoundManager::InitRedbook()
 {
-	
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+    if (!m_cdrom) {
+        int errcode = SDL_Init(SDL_INIT_CDROM | m_SDLInitFlags);
+
+        Assert(0 == errcode);
+        if (errcode < 0) {
+            g_theProfileDB->SetUseRedbookAudio(FALSE);
+            return;
+        }
+
+        MBCHAR drive_letter = toupper(c3files_GetCTPCDDriveLetter());
+        int numDrives = SDL_CDNumDrives();
+        int drive = -1;
+        int i = 0;
+        
+        Assert(numDrives >= 0);
+
+        // Hack: We don't have the num of the SDL drive stored,
+        //       so we search for the drive with the drive letter stored
+        while ((i < numDrives) && (-1 == drive)) {
+            const char *cd_name = SDL_CDName(i);
+            if (cd_name) {
+                if (toupper(cd_name[0]) == drive_letter) {
+                    drive = i;
+                }
+            }
+            i++;
+        }
+
+        // No drive match?!
+        if (drive < 0) {
+            g_theProfileDB->SetUseRedbookAudio(FALSE);
+            return;
+        }
+        m_cdrom = SDL_CDOpen(drive);
+        Assert(m_cdrom != 0);
+        // No control structur?
+        if (!m_cdrom) {
+            g_theProfileDB->SetUseRedbookAudio(FALSE);
+            return;
+        }
+        CDstatus status = SDL_CDStatus(m_cdrom);
+    }
+#else // !USE_SDL || ACTIVISION_ORIGINAL
 	if (!m_redbook) {
 		MBCHAR drive = c3files_GetCTPCDDriveLetter();
 		m_redbook = AIL_redbook_open_drive(drive);
 		if (!m_redbook) {
-			
 			g_theProfileDB->SetUseRedbookAudio(FALSE);
 		}
 	}
+#endif // #if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
 }
 
-void SoundManager::CleanupRedbook(void)
+void
+SoundManager::CleanupRedbook()
 {
-	
-	if (m_redbook) {
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+    if (m_cdrom) {
+        SDL_CDClose(m_cdrom);
+        m_cdrom = 0;
+    }
+#else
+    if (m_redbook) {
 		AIL_redbook_stop(m_redbook);
 		AIL_redbook_close(m_redbook);
 		m_redbook = NULL;
 	}
+#endif
 }
 
-void SoundManager::ConvertCoordinates(sint32 x, sint32 y, sint32 *soundX, sint32 *soundY, sint32 *soundZ)
+void
+SoundManager::ConvertCoordinates(const sint32 &x, const sint32 &y,
+                                 sint32 &soundX, sint32 &soundY, sint32 &soundZ)
 {
-	*soundX = x;
-	*soundY = y;
-	*soundZ = 0;
+	soundX = x;
+	soundY = y;
+	soundZ = 0;
 }
 
-void SoundManager::ProcessRedbook(void)
+void
+SoundManager::ProcessRedbook()
 {
 	
 	if (!g_theProfileDB->IsUseRedbookAudio()) return;
 
 	if (!m_musicEnabled) return;
 
+
 	if (GetTickCount() > m_timeToCheckCD) {
-		U32 status;
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+        CDstatus status;
+        if (m_cdrom) {
+            status = SDL_CDStatus(m_cdrom);
+#else
+        U32 status;
 		if (m_redbook) {
 			status = AIL_redbook_status(m_redbook);
+#endif
 			switch (status) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			case REDBOOK_ERROR:
+#else
+            case CD_TRAYEMPTY:
+                break;
+            case CD_ERROR:
+#endif
 				break;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			case REDBOOK_PLAYING:
+#else
+            case CD_PLAYING:
+#endif
 				break;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			case REDBOOK_PAUSED:
+#else
+            case CD_PAUSED:
+#endif
 				break;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			case REDBOOK_STOPPED:
-				
+#else
+            case CD_STOPPED:
+#endif			
 				if (m_curTrack != -1) 
 					PickNextTrack();
 				
@@ -257,11 +400,13 @@
 				break;
 			}
 		}
+
 		m_timeToCheckCD = GetTickCount() + k_CHECK_CD_PERIOD;
 	}
 }
 
-void SoundManager::Process(const uint32 target_milliseconds, uint32 &used_milliseconds)
+void SoundManager::Process(const uint32 &target_milliseconds,
+                           uint32 &used_milliseconds)
 {
 	CivSound						*sound;
 
@@ -281,15 +426,18 @@
 			if (!sound) continue;
 			
 			if (sound->IsPlaying()) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 				if (AIL_quick_status(sound->GetHAudio()) == QSTAT_DONE) {
-					
+#else
+                if (!Mix_Playing(sound->GetChannel())) {
+#endif
 					m_soundWalker->Remove();
 
 					delete sound;
 				} else {
 					m_soundWalker->Next();
 				}
-			}		
+			}
 		}
 	}
 
@@ -302,7 +450,12 @@
 			if (!sound) continue;
 			
 			if (sound->IsPlaying()) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 				if (AIL_quick_status(sound->GetHAudio()) == QSTAT_DONE) {
+#else
+                if ((-1 == sound->GetChannel()) ||
+                    (!Mix_Playing(sound->GetChannel()))) {
+#endif
 					m_soundWalker->Remove();
 					delete sound;
 				} else {
@@ -332,13 +485,17 @@
 	return FALSE;
 }
 
-void SoundManager::AddGameSound(GAMESOUNDS sound)
+void
+SoundManager::AddGameSound(const GAMESOUNDS &sound)
 {
 	sint32 id = gamesounds_GetGameSoundID(sound);
 	AddSound(SOUNDTYPE_SFX, 0, id, 0, 0);
 }
 
-void SoundManager::AddSound(SOUNDTYPE type, uint32 associatedObject, sint32 soundID, sint32 x, sint32 y)
+void
+SoundManager::AddSound(const SOUNDTYPE &type,
+                       const uint32 &associatedObject,
+                       const sint32 &soundID, sint32 x, sint32 y)
 {
 	CivSound	*sound;
 	BOOL		found = FALSE;
@@ -350,10 +507,8 @@
 
 		return;
 	}
-
 	
 	sound = new CivSound(associatedObject, soundID);
-
 	
 	switch (type) {
 	case SOUNDTYPE_SFX:
@@ -376,17 +531,22 @@
 
 	if (!found)
 	{
-		
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 		AIL_quick_play(sound->GetHAudio(), 1);	
-
+#else
+        int channel = Mix_PlayChannel(-1, sound->GetAudio(), 0);
+        sound->SetChannel(channel);
+#endif
 		sound->SetIsPlaying(TRUE);
 	} else {
-		
 		delete sound;
 	}
 }
 
-void SoundManager::AddLoopingSound(SOUNDTYPE type, uint32 associatedObject, sint32 soundID, sint32 x, sint32 y)
+void
+SoundManager::AddLoopingSound(const SOUNDTYPE &type,
+                              const uint32 &associatedObject,
+                              const sint32 &soundID, sint32 x, sint32 y)
 {
 	CivSound	*sound;
 	CivSound	*existingSound = FindLoopingSound(type, associatedObject);
@@ -420,24 +580,38 @@
 		break;
 	}
 
-	
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	AIL_quick_play(sound->GetHAudio(), 0);	
+#else
+    int channel = Mix_PlayChannel(-1, sound->GetAudio(), -1);
+    sound->SetChannel(channel);
+#endif
 
 	sound->SetIsLooping(TRUE);
 	sound->SetIsPlaying(TRUE);
-
 }
 
-void SoundManager::TerminateLoopingSound(SOUNDTYPE type, uint32 associatedObject)
+void
+SoundManager::TerminateLoopingSound(const SOUNDTYPE &type,
+                                    const uint32 &associatedObject)
 {
 	CivSound *existingSound = FindLoopingSound(type, associatedObject);
 
 	if (!existingSound) return;
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	AIL_quick_halt(existingSound->GetHAudio());
+#else
+    int channel = existingSound->GetChannel();
+    if (channel >= 0) {
+        Mix_HaltChannel(channel);
+    }
+    existingSound->SetChannel(-1);
+#endif
 }
 
-void SoundManager::TerminateAllLoopingSounds(SOUNDTYPE type)
+void
+SoundManager::TerminateAllLoopingSounds(const SOUNDTYPE &type)
 {
 	PointerList<CivSound>::PointerListNode *node;
 
@@ -455,13 +629,22 @@
 	while (node) {
 		sound = node->GetObj();
 		if (sound && sound->IsLooping()) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			AIL_quick_halt(sound->GetHAudio());
+#else
+            int channel = sound->GetChannel();
+            if (channel >= 0) {
+                Mix_HaltChannel(channel);
+            }
+            sound->SetChannel(-1);
+#endif
 		}
 		node = node->GetNext();
 	}
 }
 
-void SoundManager::TerminateSounds(SOUNDTYPE type)
+void
+SoundManager::TerminateSounds(const SOUNDTYPE &type)
 {
 	PointerList<CivSound>::PointerListNode *node;
 
@@ -479,19 +662,28 @@
 	while (node) {
 		sound = node->GetObj();
 		if (sound) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 			AIL_quick_halt(sound->GetHAudio());
+#else
+            int channel = sound->GetChannel();
+            if (channel >= 0) {
+                Mix_HaltChannel(channel);
+            }
+#endif
 		}
 		node = node->GetNext();
 	}
 }
 
-void SoundManager::TerminateAllSounds(void)
+void
+SoundManager::TerminateAllSounds()
 {
 	TerminateSounds(SOUNDTYPE_SFX);
 	TerminateSounds(SOUNDTYPE_VOICE);
 }
 
-void SoundManager::SetVolume(SOUNDTYPE type, uint32 volume)
+void
+SoundManager::SetVolume(const SOUNDTYPE &type, const uint32 &volume)
 {
 	CivSound *sound;
 	
@@ -523,13 +715,20 @@
 		break;
 	case SOUNDTYPE_MUSIC:
 		m_musicVolume = volume;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 		if (m_redbook)
 			AIL_redbook_set_volume(m_redbook, (sint32)((double)volume * 12.7));
+#else
+        if (m_cdrom) {
+            // TODO: found nothing in reference
+        }   
+#endif
 		break;
 	}
 }
 
-void SoundManager::SetMasterVolume(uint32 volume)
+void
+SoundManager::SetMasterVolume(const uint32 &volume)
 {
 	if (m_noSound) return;
 
@@ -545,8 +744,7 @@
 		m_soundWalker->Next();
 	}
 	m_sfxVolume = volume;
-	
-	
+
 	m_soundWalker->SetList(m_voiceSounds);
 	while (m_soundWalker->IsValid()) {
 		sound = m_soundWalker->GetObj();
@@ -556,7 +754,22 @@
 	m_voiceVolume = volume;
 }
 
-CivSound *SoundManager::FindLoopingSound(SOUNDTYPE type, uint32 associatedObject)
+void
+SoundManager::DisableMusic()
+{
+    m_musicEnabled = FALSE;
+    TerminateMusic();
+}
+
+void
+SoundManager::EnableMusic()
+{
+    m_musicEnabled = TRUE;
+}
+
+CivSound
+*SoundManager::FindLoopingSound(const SOUNDTYPE &type,
+                                const uint32 &associatedObject)
 {
 	switch (type) {
 	case SOUNDTYPE_SFX:
@@ -579,7 +792,9 @@
 }
 
 
-CivSound *SoundManager::FindSound(SOUNDTYPE type, uint32 associatedObject)
+CivSound
+*SoundManager::FindSound(const SOUNDTYPE &type,
+                         const uint32 &associatedObject)
 {
 	switch (type) {
 	case SOUNDTYPE_SFX:
@@ -601,7 +816,73 @@
 	return NULL;
 }
 
-void SoundManager::SetPosition(SOUNDTYPE type, uint32 associatedObject, sint32 x, sint32 y)
+const MUSICSTYLE
+SoundManager::GetMusicStyle() const
+{
+    return m_style;
+}
+
+const sint32
+SoundManager::GetPlayListPosition() const
+{
+    return m_playListPosition;
+}
+
+const sint32
+SoundManager::GetLastTrack() const
+{
+    return m_lastTrack;
+}
+
+const sint32
+SoundManager::GetUserTrack() const
+{
+    return m_userTrack;
+}
+
+const BOOL
+SoundManager::IsAutoRepeat() const
+{
+    return m_autoRepeat;
+}
+
+const BOOL
+SoundManager::IsMusicEnabled() const
+{
+    return m_musicEnabled;
+}
+
+void
+SoundManager::SetAutoRepeat(const BOOL &autoRepeat)
+{
+    m_autoRepeat = autoRepeat;
+    PickNextTrack();
+}
+
+void
+SoundManager::SetLastTrack(const sint32 &track)
+{
+    m_lastTrack = track;
+}
+
+void
+SoundManager::SetMusicStyle(const MUSICSTYLE &style)
+{
+    m_style = style;
+    PickNextTrack();
+}
+
+void
+SoundManager::SetPlayListPosition(const sint32 &pos)
+{
+    m_playListPosition = pos;
+    PickNextTrack();
+}
+
+void
+SoundManager::SetPosition(const SOUNDTYPE &type,
+                          const uint32 &associatedObject,
+                          const sint32 &x, const sint32 &y)
 {
 	PointerList<CivSound>::PointerListNode *node;
 
@@ -620,30 +901,53 @@
 	
 	CivSound	*sound;
 	sint32		objectX, objectY, objectZ;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	HAUDIO		hAudio;
+#else
+    Mix_Chunk   *myChunk;
+#endif
 
-	ConvertCoordinates(x, y, &objectX, &objectY, &objectZ);
+	ConvertCoordinates(x, y, objectX, objectY, objectZ);
 
 	while (node) {
 		sound = node->GetObj();
 		if (sound) {
 			if (sound->GetAssociatedObject() == associatedObject) {
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+                sint32 panValue = 64;
 				hAudio = sound->GetHAudio();
-
-				sint32 panValue = 64;	
-
-				if (hAudio) {
-					AIL_quick_set_volume(hAudio, volume, panValue);
-				}
+                if (hAudio) {
+                    AIL_quick_set_volume(hAudio, volume, panValue);
+                }
+#else
+                myChunk = sound->GetAudio();
+                if (myChunk) {
+                    // Why set the volume again?
+                }
+#endif
 			}
 		}
 		node = node->GetNext();
 	}
 }
 
-void SoundManager::StartMusic(sint32 trackNum)
+void
+SoundManager::SetUserTrack(const sint32 &trackNum)
 {
-	
+    m_userTrack = trackNum;
+    PickNextTrack();
+}
+
+void
+SoundManager::StartMusic()
+{
+    StartMusic(m_curTrack);
+}
+
+void
+SoundManager::StartMusic(const sint32 &InTrackNum)
+{
+	sint32 trackNum = InTrackNum;
 	m_stopRedbookTemporarily = FALSE;
 
 	if (!g_theProfileDB->IsUseRedbookAudio() || !c3files_HasCD()) return;
@@ -654,20 +958,38 @@
 
 	if (m_curTrack == -1) return;
 
-	if (!m_redbook) return;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+    if (!m_redbook) {
+        return;
+    }
 
 	U32 status = AIL_redbook_status(m_redbook);
 
-	if (status == REDBOOK_ERROR) return;
-
+    if (status == REDBOOK_ERROR) {
+        return;
+    }
 	
 	if (AIL_redbook_track(m_redbook)) {
-		
 		AIL_redbook_stop(m_redbook);
 	}
+#else
+    if (!m_cdrom) {
+        return;
+    }
+
+    CDstatus status = SDL_CDStatus(m_cdrom);
+
+    if ((CD_ERROR == status) || (!CD_INDRIVE(status))) {
+        return;
+    }
+#endif
 
 	sint32 numTracks = 0;
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	numTracks = AIL_redbook_tracks(m_redbook);
+#else
+    numTracks = m_cdrom->numtracks;
+#endif
 	
 	if (numTracks <= 1) return;
 
@@ -678,15 +1000,17 @@
 
 	m_curTrack = trackNum;
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	U32 start, end;
 	AIL_redbook_track_info(m_redbook, trackNum, &start, &end);
 
-	
-	
-	
+    // Why?
 	TerminateAllSounds();
 
 	AIL_redbook_play(m_redbook, start, end);
+#else
+    SDL_CDPlayTracks(m_cdrom, trackNum, 0, 1, 0);
+#endif
 }
 
 void SoundManager::TerminateMusic(void)
@@ -697,16 +1021,26 @@
 
 	if (m_usePlaySound) return;
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	if (!m_redbook) return;
+#else
+    if (!m_cdrom) return;
+#endif
 
 	
 	m_stopRedbookTemporarily = TRUE;
 
-	
-	if (AIL_redbook_track(m_redbook)) {
-		
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+	if (AIL_redbook_track(m_redbook)) {		
 		AIL_redbook_stop(m_redbook);
 	}
+#else
+    CDstatus status = SDL_CDStatus(m_cdrom);
+
+    if (CD_PLAYING == status) {
+        SDL_CDStop(m_cdrom);
+    }
+#endif
 }
 
 void SoundManager::PickNextTrack(void)
@@ -734,9 +1068,7 @@
 	case MUSICSTYLE_USER:
 		
 		m_curTrack = m_userTrack + 2;
-		if (!m_autoRepeat && m_curTrack == m_lastTrack) {
-			
-			
+		if (!m_autoRepeat && m_curTrack == m_lastTrack) {			
 			m_curTrack = -1;
 		}
 		break;
@@ -744,7 +1076,8 @@
 	m_lastTrack = m_curTrack;
 }
 
-void SoundManager::StupidPlaySound(sint32 soundID)
+void
+SoundManager::StupidPlaySound(const sint32 &soundID)
 {
 	if (g_theSoundDB->Get(soundID)->GetValue()) {
 		MBCHAR		fullPath[_MAX_PATH];
@@ -760,19 +1093,25 @@
 	}
 }
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 S32 masterVolume;
+#endif
 
-void SoundManager::ReleaseSoundDriver(void)
+void
+SoundManager::ReleaseSoundDriver()
 {
 	if (m_usePlaySound) return;
 	if (m_noSound) return;
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	HDIGDRIVER		dig;
 	HMDIDRIVER		mdi;
 	HDLSDEVICE		dls;
+#endif
 
 	TerminateAllSounds();
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	AIL_quick_handles(&dig, &mdi, &dls);
 
 	S32 err;
@@ -784,14 +1123,17 @@
 
 	err = AIL_digital_handle_release(dig);
 	Assert(err);
+#endif
 }
 
 
-void SoundManager::ReacquireSoundDriver(void)
+void
+SoundManager::ReacquireSoundDriver()
 {
 	if (m_usePlaySound) return;
 	if (m_noSound) return;
 
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
 	HDIGDRIVER		dig;
 	HMDIDRIVER		mdi;
 	HDLSDEVICE		dls;
@@ -805,4 +1147,5 @@
 
 	
 	AIL_set_digital_master_volume(dig, masterVolume);
+#endif
 }
Index: ctp2_code/sound/soundmanager.h
===================================================================
RCS file: /home/cvs/ctp2win/ctp2/ctp2_code/sound/soundmanager.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 soundmanager.h
--- ctp2_code/sound/soundmanager.h	2 Feb 2004 12:30:36 -0000	1.1.1.1
+++ ctp2_code/sound/soundmanager.h	3 Feb 2004 21:11:04 -0000
@@ -1,11 +1,58 @@
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : General declarations
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2 
+// Source Code Project. Contact the authors at ctp2source@apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+// 
+// _DEBUG
+// - Generate debug version
+//
+// _MSC_VER		
+// - Use Microsoft C++ extensions when set.
+//
+// ACTIVISION_ORIGINAL
+// - Build original Activision binary
+//   ATTENTION: This collides with __GNUC__
+//
+// USE_SDL
+// - Compile with sdl support instead of mss (define: civsound.h)
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - #pragmas commented out
+// - includes fixed for case sensitive filesystems
+// - added sdl sound and cdrom support
+//
+//----------------------------------------------------------------------------
 
-
+#if defined(_MSC_VER) && (_MSC_VER > 1000)
 #pragma once
+#endif
+
 #ifndef __SOUNDMANAGER_H__
 #define __SOUNDMANAGER_H__
 
-#include "CivSound.h"
-#include "PointerList.h"
+#include "civsound.h"
+#include "pointerlist.h"
+
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+#include <SDL.h>
+#include <SDL_mixer.h>
+#endif
 
 template <class T> class PointerList;
 
@@ -36,66 +83,78 @@
 
 class SoundManager {
 public:
-	static void Initialize(void);
-	static void Cleanup(void);
+	static void Initialize();
+	static void Cleanup();
 
 	SoundManager();
 	~SoundManager();
 
-	void InitSoundDriver(void);
-	void CleanupSoundDriver(void);
+	void InitSoundDriver();
+	void CleanupSoundDriver();
 
-	void InitRedbook(void);
-	void CleanupRedbook(void);
+	void InitRedbook();
+	void CleanupRedbook();
 
-	void DumpAllSounds(void);
+	void DumpAllSounds();
 
-	void ConvertCoordinates(sint32 x, sint32 y, sint32 *soundX, sint32 *soundY, sint32 *soundZ);
+	void ConvertCoordinates(const sint32 &x, const sint32 &y,
+                            sint32 &soundX, sint32 &soundY, sint32 &soundZ);
 	void ProcessRedbook(void);
-	void Process(const uint32 target_milliseconds, uint32 &used_milliseconds);
+	void Process(const uint32 &target_milliseconds, uint32 &used_milliseconds);
 	
-	void AddGameSound(GAMESOUNDS sound);
-	void AddSound(SOUNDTYPE type, uint32 associatedObject, sint32 soundID, sint32 x=0, sint32 y=0);
-	void AddLoopingSound(SOUNDTYPE type, uint32 associatedObject, sint32 soundID, sint32 x=0, sint32 y=0);
-	void TerminateLoopingSound(SOUNDTYPE type, uint32 associatedObject);
-	void TerminateAllLoopingSounds(SOUNDTYPE type);
-	void TerminateSounds(SOUNDTYPE type);
+	void AddGameSound(const GAMESOUNDS &sound);
+	void AddSound(const SOUNDTYPE &type, const uint32 &associatedObject,
+                  const sint32 &soundID, sint32 x=0, sint32 y=0);
+	void AddLoopingSound(const SOUNDTYPE &type,
+                         const uint32 &associatedObject,
+                         const sint32 &soundID, sint32 x=0, sint32 y=0);
+	void TerminateLoopingSound(const SOUNDTYPE &type,
+                               const uint32 &associatedObject);
+	void TerminateAllLoopingSounds(const SOUNDTYPE &type);
+	void TerminateSounds(const SOUNDTYPE &type);
 	void TerminateAllSounds(void);
 
-	void SetVolume(SOUNDTYPE type, uint32 volume);
-	void SetMasterVolume(uint32 volume);
-	CivSound *FindSound(SOUNDTYPE type, uint32 associatedObject);
-	CivSound *FindLoopingSound(SOUNDTYPE type, uint32 associatedObject);
-	void SetPosition(SOUNDTYPE type, uint32 associatedObject, sint32 x, sint32 y);
-
+	void SetVolume(const SOUNDTYPE &type, const uint32 &volume);
+	void SetMasterVolume(const uint32 &volume);
+	CivSound *FindSound(const SOUNDTYPE &type,
+                        const uint32 &associatedObject);
+	CivSound *FindLoopingSound(const SOUNDTYPE &type, 
+                               const uint32 &associatedObject);
+	void SetPosition(const SOUNDTYPE &type,
+                     const uint32 &associatedObject,
+                     const sint32 &x, const sint32 &y);
 	
-	void		StartMusic(void) { StartMusic(m_curTrack); }
-	void		StartMusic(sint32 trackNum);
-	void		TerminateMusic(void);
-	void		PickNextTrack(void);
-
-	void		SetMusicStyle(MUSICSTYLE style) { m_style = style; PickNextTrack();}
-	void		SetUserTrack(sint32 trackNum) { m_userTrack = trackNum;  PickNextTrack();}
-	void		SetPlayListPosition(sint32 pos) { m_playListPosition = pos;  PickNextTrack();}
-	void		SetAutoRepeat(BOOL autoRepeat) { m_autoRepeat = autoRepeat;  PickNextTrack();}
-	MUSICSTYLE	GetMusicStyle(void) { return m_style; }
-	sint32		GetUserTrack(void) { return m_userTrack; }
-	sint32		GetPlayListPosition(void) { return m_playListPosition; }
+	void		StartMusic();
+	void		StartMusic(const sint32 &trackNum);
+	void		TerminateMusic();
+	void		PickNextTrack();
+
+	void		SetMusicStyle(const MUSICSTYLE &style);
+	void		SetUserTrack(const sint32 &trackNum);
+	void		SetPlayListPosition(const sint32 &pos);
+	void		SetAutoRepeat(const BOOL &autoRepeat);
+	const MUSICSTYLE GetMusicStyle(void) const;
+	const sint32     GetUserTrack(void) const;
+	const sint32     GetPlayListPosition(void) const;
 
-	void		EnableMusic(void) { m_musicEnabled = TRUE; }
-	void		DisableMusic(void) { m_musicEnabled = FALSE; TerminateMusic();}
+	void             EnableMusic();
+	void             DisableMusic();
 
-	BOOL		IsAutoRepeat( void ) const { return m_autoRepeat; }
-	BOOL		IsMusicEnabled( void ) const { return m_musicEnabled; }
+	const BOOL       IsAutoRepeat() const;
+	const BOOL       IsMusicEnabled() const;
 
-	sint32		GetLastTrack(void) const { return m_lastTrack; }
-	void		SetLastTrack(sint32 track) { m_lastTrack = track; }
+	const sint32     GetLastTrack() const;
+	void             SetLastTrack(const sint32 &track);
 
 	
-	void StupidPlaySound(sint32 soundID);
+	void StupidPlaySound(const sint32 &soundID);
+
+	void ReleaseSoundDriver();
+	void ReacquireSoundDriver();
 
-	void ReleaseSoundDriver(void);
-	void ReacquireSoundDriver(void);
+#if defined(USE_SDL) && !defined(ACTIVISION_ORIGINAL)
+    void SDL_ChannelCompleteCB(int channel);
+#endif
 
 private:
 	PointerList<CivSound>	*m_sfxSounds;
@@ -112,8 +171,12 @@
 	BOOL					m_noSound;
 	BOOL					m_usePlaySound;
 
-	
-	HREDBOOK				m_redbook;		
+#if defined(ACTIVISION_ORIGINAL) || !defined(USE_SDL)
+	HREDBOOK				m_redbook;
+#else
+    SDL_CD                  *m_cdrom;
+    Uint32                  m_SDLInitFlags;
+#endif
 	uint32					m_timeToCheckCD;
 	sint32					m_numTracks;
 	sint32					m_curTrack;
