home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58b_TRIBES.iso / Tribes / base / scripts.vol / Options.cs < prev    next >
Encoding:
Text File  |  1998-12-16  |  20.0 KB  |  633 lines

  1. //------------------------------------
  2. //
  3. // OPTIONS screen functions
  4. //
  5. //------------------------------------
  6.  
  7. function OptionsGui::onOpen()
  8. {
  9.    //the IRC options page
  10.    IRCOptions::init();
  11.  
  12.    OptionsMovement::init();
  13.    OptionsVideo::init();
  14.    OptionsGraphics::init();
  15.    OptionsNetwork::init();
  16.    OptionsSound::init();
  17. }
  18.  
  19. function OptionsGui::onClose()
  20. {
  21.    //the IRC options page
  22.    IRCOptions::Shutdown();
  23.  
  24.    OptionsNetwork::shutdown();
  25. }
  26.  
  27. //---  OPTIONS VIDEO  ------------------------------------------------
  28.  
  29. function OptionsVideo::init()
  30. {
  31.    //validate the prefs
  32.    OptionsVideo::validate();
  33.  
  34.    //set the values in the controls
  35.    OptionsVideoMode::update();
  36.    FGCombo::setSelected(IDCTG_OPTS_VID_FULLSCRN, FGCombo::findEntry(IDCTG_OPTS_VID_FULLSCRN, $pref::VideoFullScreenDriver));
  37.    FGCombo::setSelected(IDCTG_OPTS_VID_WINDOW, FGCombo::findEntry(IDCTG_OPTS_VID_WINDOW, $pref::VideoWindowedDriver));
  38.    FGCombo::setSelected(IDCTG_OPTS_VID_RES, FGCombo::findEntry(IDCTG_OPTS_VID_RES, $pref::VideoFullScreenRes));
  39.  
  40.    $pref::VideoGamma = $pref::Display::gammaValue / 2;
  41.    if ($pref::VideoGamma == 0) $pref::VideoGamma = 0.5;
  42.    Control::setValue(IDCTG_OPTS_VID_GAMMA, $pref::VideoGamma);
  43. }
  44.  
  45. function OptionsVideo::validate()
  46. {
  47.    if ($pref::VideoFullScreen == "") $pref::VideoFullScreen = "FALSE";
  48.    if ($pref::VideoFullScreenDriver == "")
  49.    {
  50.       if (isGfxDriver(MainWindow, "Glide")) $pref::VideoFullScreenDriver = "Glide";
  51.       else $pref::VideoFullScreenDriver = "Software";
  52.    }
  53.    if ($pref::VideoWindowedDriver == "") $pref::VideoWindowedDriver = "Software";
  54.    if ($pref::VideoFullScreenRes == "") $pref::VideoFullScreenRes = "640x480";
  55.    if ($pref::VideoGamma == "") $pref::VideoGamma = "0.5";
  56. }
  57.  
  58. function OptionsVideo::onApply()
  59. {
  60.    //store the prefs...
  61.    $pref::VideoFullScreen       = Control::getValue(IDCTG_OPTS_VID_MODE_FS);
  62.    $pref::VideoFullScreenDriver = Control::getValue(IDCTG_OPTS_VID_FULLSCRN); 
  63.    $pref::VideoWindowedDriver   = Control::getValue(IDCTG_OPTS_VID_WINDOW);
  64.    $pref::VideoFullScreenRes    = Control::getValue(IDCTG_OPTS_VID_RES);
  65.  
  66.    //validate the prefs
  67.    OptionsVideo::validate();
  68.  
  69.    //apply the prefs
  70.    OptionsVideo::apply();
  71. }
  72.  
  73. $firstTimeThroughApply = true;
  74.  
  75. function OptionsVideo::apply()
  76. {
  77.    setWindowedDevice(MainWindow, $pref::VideoWindowedDriver);
  78.    %temp = setFullscreenDevice(MainWindow, $pref::VideoFullScreenDriver);
  79.  
  80.    if (String::ICompare(%temp, "false") == 0) {
  81.       %temp = setFullscreenDevice(MainWindow, "Software");
  82.       if (String::ICompare(%temp, "false") != 0)
  83.          $pref::VideoFullScreenDriver = "Software";
  84.    }
  85.  
  86.    %fs = false;
  87.    if (String::ICompare($pref::VideoFullScreen, "TRUE") == 0) {
  88.       // set fs mode
  89.       setFullscreenMode(MainWindow, "true");
  90.       %fs = true;
  91.    }
  92.    else {
  93.       // set windowed mode
  94.       setFullscreenMode(MainWindow, "false");
  95.  
  96.       if ($firstTimeThroughApply == true) {
  97.          if (GUI::isIn8BitMode() == "true") {
  98.             GUI::issue8BitWarning();
  99.          }
  100.          $firstTimeThroughApply = false;
  101.       }
  102.    }
  103.  
  104.    if ($pref::VideoFullScreenRes != "") {
  105.       setFSResolution(MainWindow, $pref::VideoFullScreenRes);
  106.    }
  107.    if (%fs == true) {
  108.       if (isVirtualFS(MainWindow) == true) {
  109.          echo("Virtual FS");
  110.          $useLowRes3D = true;
  111.       } else {
  112.          $useLowRes3D = false;
  113.       }
  114.    }
  115.  
  116.    flushTextureCache();
  117. }
  118.  
  119. function OptionsVideoMode::update()
  120. {
  121.    Control::setValue(IDCTG_OPTS_VID_MODE_FS, $pref::VideoFullScreen);
  122.    if (! String::ICompare($pref::VideoFullScreen, "FALSE"))
  123.    {
  124.       Control::setValue(IDCTG_OPTS_VID_MODE_WIN, "TRUE");
  125.    }
  126.    else
  127.    {
  128.       Control::setValue(IDCTG_OPTS_VID_MODE_WIN, "FALSE");
  129.    }
  130. }
  131.  
  132. function OptionsVideo::setGamma()
  133. {
  134.    $pref::VideoGamma = Control::getValue(IDCTG_OPTS_VID_GAMMA);
  135.    setGamma(MainWindow, 0.05 + (1.95 * $pref::VideoGamma));
  136. }
  137.  
  138. //---  OPTIONS MOVEMENT  ------------------------------------------------
  139.  
  140. $minMouseSensitivity = 0.0002;
  141. $maxMouseSensitivity = 0.004;
  142.  
  143. function OptionsMovement::init()
  144. {
  145.    %sensitivity = Client::getMouseSensitivity("playMap.sae");
  146.    %percentage = (%sensitivity - $minMouseSensitivity) / ($maxMouseSensitivity - $minMouseSensitivity);
  147.    Control::setValue(IDCTG_OPTS_CFG_MOUSE_SENSITIVE, %percentage);
  148.    Control::setValue(IDCTG_OPTS_CFG_MOUSE_X_FLIP, Client::getMouseXAxisFlip("playMap.sae"));
  149.    Control::setValue(IDCTG_OPTS_CFG_MOUSE_Y_FLIP, Client::getMouseYAxisFlip("playMap.sae"));
  150.  
  151.    if ($pref::freeLookAlwaysOn == "")
  152.    {
  153.       $pref::freeLookAlwaysOn = "TRUE";
  154.       $pref::freeLook = "TRUE";
  155.    }
  156.    Control::setValue(OptionsMovement::freeLook, $pref::freeLookAlwaysOn);
  157. }
  158.  
  159. function OptionsMovement::updateMouse()
  160. {
  161.    editActionMap("playMap.sae");
  162.  
  163.    //calculate the sensitivity
  164.    %percentage = Control::getValue(IDCTG_OPTS_CFG_MOUSE_SENSITIVE);
  165.    %sensitivity = $minMouseSensitivity + (%percentage * ($maxMouseSensitivity - $minMouseSensitivity));
  166.  
  167.    if (String::ICompare(Control::getValue(IDCTG_OPTS_CFG_MOUSE_X_FLIP), "TRUE") == 0)
  168.    {
  169.       bindAction(mouse0, xaxis0, TO, IDACTION_YAW, Scale, %sensitivity);
  170.    }
  171.    else
  172.    {
  173.       bindAction(mouse0, xaxis0, TO, IDACTION_YAW, Flip, Scale, %sensitivity);
  174.    }
  175.  
  176.    if (String::ICompare(Control::getValue(IDCTG_OPTS_CFG_MOUSE_Y_FLIP), "TRUE") == 0)
  177.    {
  178.       bindAction(mouse0, yaxis0, TO, IDACTION_PITCH, Scale, %sensitivity);
  179.    }
  180.    else
  181.    {
  182.       bindAction(mouse0, yaxis0, TO, IDACTION_PITCH, Flip, Scale, %sensitivity);
  183.    }
  184. }
  185.  
  186. function setFreeLook(%value)
  187. {
  188.    if (String::ICompare($pref::freeLookAlwaysOn, "FALSE") == 0)
  189.    {
  190.       echo("DdbEBUG:  freelook: " @ %value);
  191.       $pref::freeLook = %value;
  192.    }
  193.    else                                             
  194.    {
  195.       $pref::freeLook = TRUE;
  196.    }
  197. }
  198.  
  199. //---  OPTIONS GRAPHICS  ------------------------------------------------
  200.  
  201. function OptionsGraphics::init()
  202. {
  203.    FGSlider::setDiscretePositions(OptionsTextureDetail, 0);
  204.    FGSlider::setDiscretePositions(OptionsTerrainDetail, 0);
  205.    FGSlider::setDiscretePositions(OptionsLightingDetail, 0);
  206.    FGSlider::setDiscretePositions(OptionsDecalDetail, 0);
  207.    FGSlider::setDiscretePositions(OptionsShapeDetail, 0);
  208.    FGSlider::setDiscretePositions(OptionsDamageDetail, 3);
  209.    Control::setValue(OptionsTextureDetail, $pref::TerrainTextureDetail);
  210.    Control::setValue(OptionsTerrainDetail, $pref::TerrainDetail);
  211.    Control::setValue(OptionsLightingDetail, $pref::dynamicLightDistance/200);
  212.    Control::setValue(OptionsDecalDetail, $pref::NumDecals/50);
  213.    Control::setValue(OptionsShapeDetail, ($pref::staticShapeDetail - 0.2)/0.8);
  214.    Control::setValue(OptionsDamageDetail, $pref::damageSkinDetail);
  215. }
  216.  
  217. function OptionsGraphics::setLowDetail()
  218. {
  219.    Control::setValue(OptionsTextureDetail, 0.0);
  220.    Control::setValue(OptionsTerrainDetail, 0.0);
  221.    Control::setValue(OptionsLightingDetail, 0.0);
  222.    Control::setValue(OptionsDecalDetail, 0.0);
  223.    Control::setValue(OptionsShapeDetail, 0.0);
  224.    Control::setValue(OptionsDamageDetail, 0);
  225.    
  226.    OptionsTextureDetail::onAction();
  227.    OptionsTerrainDetail::onAction();
  228.    OptionsLightingDetail::onAction();
  229.    OptionsDecalDetail::onAction();
  230.    OptionsShapeDetail::onAction();
  231.    OptionsDamageDetail::onAction();
  232. }
  233.  
  234. function OptionsGraphics::setMediumDetail()
  235. {
  236.    Control::setValue(OptionsTextureDetail, 0.5);
  237.    Control::setValue(OptionsTerrainDetail, 0.5);
  238.    Control::setValue(OptionsLightingDetail, 0.5);
  239.    Control::setValue(OptionsDecalDetail, 0.5);
  240.    Control::setValue(OptionsShapeDetail, 0.5);
  241.    Control::setValue(OptionsDamageDetail, 1);
  242.  
  243.    OptionsTextureDetail::onAction();
  244.    OptionsTerrainDetail::onAction();
  245.    OptionsLightingDetail::onAction();
  246.    OptionsDecalDetail::onAction();
  247.    OptionsShapeDetail::onAction();
  248.    OptionsDamageDetail::onAction();
  249. }
  250.  
  251. function OptionsGraphics::setHighDetail()
  252. {
  253.    Control::setValue(OptionsTextureDetail, 1.0);
  254.    Control::setValue(OptionsTerrainDetail, 1.0);
  255.    Control::setValue(OptionsLightingDetail, 1.0);
  256.    Control::setValue(OptionsDecalDetail, 1.0);
  257.    Control::setValue(OptionsShapeDetail, 1.0);
  258.    Control::setValue(OptionsDamageDetail, 2);
  259.  
  260.    OptionsTextureDetail::onAction();
  261.    OptionsTerrainDetail::onAction();
  262.    OptionsLightingDetail::onAction();
  263.    OptionsDecalDetail::onAction();
  264.    OptionsShapeDetail::onAction();
  265.    OptionsDamageDetail::onAction();
  266. }
  267.  
  268. function OptionsTextureDetail::onAction()
  269. {
  270.    %val = Control::getValue(OptionsTextureDetail);
  271.    $pref::TerrainTextureDetail = %val;
  272.    $pref::InteriorTextureDetail = floor(((%val)* -8)+ 8);
  273.    $pref::skyDetail = floor(%val * 1.99);
  274.    $pref::starDetail = floor(%val * 1.99);
  275.    $pref::mipcap = floor(%val * 4.99) + 5;
  276.    flushTextureCache();
  277. }                             
  278.  
  279. function OptionsTerrainDetail::onAction()
  280. {
  281.    $pref::TerrainDetail =  Control::getValue(OptionsTerrainDetail);
  282.    $pref::TerrainPerspectiveDistance = Control::getValue(OptionsTerrainDetail);
  283.    $pref::TerrainVisibleDistance = (Control::getValue(OptionsTerrainDetail) * 1300) + 200 ;
  284.    $pref::WeatherPrecipitation = floor(Control::getValue(OptionsTerrainDetail) * 1.4);
  285. }
  286.  
  287. function OptionsLightingDetail::onAction()
  288. {
  289.    $pref::dynamicLightDistance = Control::getValue(OptionsLightingDetail) * 200;
  290.    $pref::interiorLightUpdateMS = ((1.0 - Control::getValue(OptionsLightingDetail)) * 984) + 16;
  291. }
  292.  
  293. function OptionsDecalDetail::onAction()
  294. {
  295.    $pref::NumDecals = Control::getValue(OptionsDecalDetail) * 50;
  296.    $pref::maxNumSmokePuffs = (Control::getValue(OptionsDecalDetail) * 240) + 10;
  297. }
  298.  
  299. function OptionsShapeDetail::onAction()
  300. {
  301.    $pref::staticShapeDetail = (Control::getValue(OptionsShapeDetail) * 0.8) + 0.2;
  302.    $pref::vehicleShapeDetail = (Control::getValue(OptionsShapeDetail) * 0.8) + 0.2;
  303.    $pref::playerShapeDetail = (Control::getValue(OptionsShapeDetail) * 0.8) + 0.2;
  304. }
  305.  
  306. function OptionsDamageDetail::onAction()
  307. {
  308.    $pref::damageSkinDetail = Control::getValue(OptionsDamageDetail);
  309. }
  310.  
  311.  
  312. //---  OPTIONS NETWORK  ------------------------------------------------
  313.  
  314. function OptionsNetwork::init()
  315. {
  316.    //make sure the fields are valid
  317.    OptionsNetwork::validate();
  318.  
  319.    //initalize the gui
  320.     Control::setValue(NetworkAutoRefresh, $pref::AutoRefresh);
  321.     Control::setValue(NetworkHostPublic, $Server::HostPublicGame);
  322.    Control::setValue(NetworkPortNumber, $server::port);
  323.    Control::setValue(NetworkPacketRate, $pref::packetRate);
  324.    Control::setValue(NetworkPacketSize, $pref::packetSize);
  325.    OptionsNetwork::setPacketFrame();
  326.  
  327.    //setup the master server list
  328.    FGMasterList::clear(OptionsNetworkMasterList);
  329.  
  330.    //popuplate the list
  331.    $MasterCount = 0;
  332.    while($Server::MasterAddress[$MasterCount] != "")
  333.    {
  334.       OptionsNetwork::addMaster($Server::MasterName[$MasterCount], $Server::MasterAddress[$MasterCount], $MasterCount);
  335.       $MasterCount++;
  336.    }
  337.  
  338.    if ($Server::CurrentMaster == "") $Server::CurrentMaster = 0;
  339.    if ($MasterCount > 0)
  340.    {
  341.       if ($Server::CurrentMaster >= $MasterCount) $Server::CurrentMaster = 0;
  342.       Control::setActive(OptionsNetworkRemoveMaster, true);
  343.       FGMasterList::setSelected(OptionsNetworkMasterList, $Server::CurrentMaster);
  344.    }
  345.    else
  346.    {
  347.       Control::setActive(OptionsNetworkRemoveMaster, true);
  348.    }
  349. }
  350.  
  351. function OptionsNetwork::addMaster(%name, %addr, %id)
  352. {
  353.    if (%name == "") %name = "Tribes Master";
  354.    if (%addr != "")
  355.    {
  356.       FGMasterList::addEntry(OptionsNetworkMasterList, %name, %addr, %id);
  357.       $Server::MasterName[%id] = %name;
  358.       $Server::MasterAddress[%id] = %addr;
  359.    }
  360. }
  361.  
  362. function OptionsNetwork::deleteSelectedMaster()
  363. {
  364.    if ($Server::CurrentMaster >= 0)
  365.    {
  366.       //replace the current entry with the last
  367.       if ($Server::CurrentMaster < $MasterCount - 1)
  368.       {
  369.          $Server::MasterName[$Server::CurrentMaster] = $Server::MasterName[$MasterCount - 1];
  370.          $Server::MasterAddress[$Server::CurrentMaster] = $Server::MasterAddress[$MasterCount - 1];
  371.       }
  372.       $Server::MasterName[$MasterCount - 1] = "";
  373.       $Server::MasterAddress[$MasterCount - 1] = "";
  374.  
  375.       FGMasterlist::clear(OptionsNetworkMasterList);
  376.  
  377.       //popuplate the list
  378.       $MasterCount = 0;
  379.       while($Server::MasterAddress[$MasterCount] != "")
  380.       {
  381.          OptionsNetwork::addMaster($Server::MasterName[$MasterCount], $Server::MasterAddress[$MasterCount], $MasterCount);
  382.          $MasterCount++;
  383.       }
  384.    }
  385.    if ($MasterCount > 0)
  386.    {
  387.       if ($Server::CurrentMaster >= $MasterCount) $Server::CurrentMaster = 0;
  388.       Control::setActive(OptionsNetworkRemoveMaster, TRUE);
  389.       FGMasterList::setSelected(OptionsNetworkMasterList, $Server::CurrentMaster);
  390.         selectNewMaster();
  391.    }
  392.    else
  393.    {
  394.       Control::setActive(OptionsNetworkRemoveMaster, FALSE);
  395.    }
  396. }
  397.  
  398. function OptionsNetwork::verifyMaster()
  399. {
  400.    %name = Control::getValue(OptionsNetworkMasterName);
  401.    %addr = Control::getValue(OptionsNetworkMasterAddress);
  402.    if (%name != "" && %addr != "")
  403.    {
  404.       Control::setActive(DialogReturnButton, true);
  405.    }
  406.    else
  407.    {
  408.       Control::setActive(DialogReturnButton, false);
  409.    }
  410. }
  411.  
  412. function OptionsNetwork::newMaster()
  413. {
  414.    %name = Control::getValue(OptionsNetworkMasterName);
  415.    %addr = Control::getValue(OptionsNetworkMasterAddress);
  416.    OptionsNetwork::addMaster(%name, %addr, $MasterCount);
  417.  
  418.    $Server::CurrentMaster = $MasterCount;
  419.    FGMasterList::setSelected(OptionsNetworkMasterList, $Server::CurrentMaster);
  420.    Control::setActive(OptionsNetworkRemoveMaster, true);
  421.  
  422.    $MasterCount++;
  423.  
  424.    GuiPopDialog(MainWindow, 0);
  425.     selectNewMaster();
  426. }
  427.  
  428. function OptionsNetwork::warnPublicServer()
  429. {
  430.    GuiPushDialog(MainWindow, "gui\\hostwarn.gui");
  431. }
  432.  
  433. function OptionsGui::HostPublicOK()
  434. {
  435.    $Server::HostPublicGame = true;
  436.    GuiPopDialog(MainWindow, 1);
  437. }
  438.  
  439. function OptionsNetwork::HostPublicCancel()
  440. {
  441.    $Server::HostPublicGame = false;
  442.    Control::setValue(NetworkHostPublic, "FALSE");
  443.    GuiPopDialog(MainWindow, 1);
  444. }
  445.  
  446. function OptionsNetwork::shutdown()
  447. {
  448.    OptionsNetwork::validate();
  449. }
  450.  
  451. function OptionsNetwork::setPacketFrame()
  452. {
  453.    %value = 1.0 - (($pref::packetFrame - 32) / (128 - 32));
  454.    Control::setValue(NetworkPacketFrame, %value);
  455. }
  456.  
  457. function NetworkPacketFrame::onAction()
  458. {
  459.    %value = 1.0 - Control::getValue(NetworkPacketFrame);
  460.    $pref::packetFrame = 32 + (%value * (128 - 32));
  461. }
  462.  
  463. function OptionsNetwork::validate()
  464. {
  465.     if ($pref::AutoRefresh == "") $pref::AutoRefresh = TRUE;
  466.     if ($Server::HostPublicGame == "") $Server::HostPublicGame = FALSE;
  467.  
  468.    if ($pref::packetRate < 1) $pref::packetRate = 10;
  469.    if ($pref::packetRate > 30) $pref::packetRate = 30;
  470.    Control::setValue(NetworkPacketRate, $pref::packetRate);
  471.  
  472.    if ($pref::packetSize < 100) $pref::packetSize = 200;
  473.    if ($pref::packetSize > 500) $pref::packetSize = 500;
  474.    Control::setValue(NetworkPacketSize, $pref::packetSize);
  475.  
  476.    if ($pref::packetFrame < 32) $pref::packetFrame = 96;
  477.    if ($pref::packetFrame > 128) $pref::packetFrame = 128;
  478.    OptionsNetwork::setPacketFrame();
  479. }
  480.  
  481.  
  482. function OptionsNetwork::setT1Defaults()
  483. {
  484.    $pref::packetRate = 15;
  485.    $pref::packetSize = 400;
  486.    $pref::packetFrame = 32;
  487.    Control::setValue(NetworkPacketRate, $pref::packetRate);
  488.    Control::setValue(NetworkPacketSize, $pref::packetSize);
  489.    OptionsNetwork::setPacketFrame();
  490. }
  491.  
  492. function OptionsNetwork::setISDNDefaults()
  493. {
  494.    $pref::packetRate = 15;
  495.    $pref::packetSize = 300;
  496.    $pref::packetFrame = 32;
  497.    Control::setValue(NetworkPacketRate, $pref::packetRate);
  498.    Control::setValue(NetworkPacketSize, $pref::packetSize);
  499.    OptionsNetwork::setPacketFrame();
  500. }
  501.  
  502. function OptionsNetwork::setModemDefaults()
  503. {
  504.    $pref::packetRate = 10;
  505.    $pref::packetSize = 200;
  506.    $pref::packetFrame = 96;
  507.    Control::setValue(NetworkPacketRate, $pref::packetRate);
  508.    Control::setValue(NetworkPacketSize, $pref::packetSize);
  509.    OptionsNetwork::setPacketFrame();
  510. }
  511.  
  512. //---  OPTIONS SOUND  ------------------------------------------------
  513.  
  514. function OptionsSound::init()
  515. {
  516.    sfxClose();
  517.  
  518.    %SFX_QUERY_DSOUND     = 1; 
  519.    %SFX_QUERY_DSOUND3D   = 2;
  520.    %SFX_QUERY_AUREAL3D   = 3;
  521.    %SFX_QUERY_LIVE3D     = 4;
  522.  
  523.    FGSlider::setDiscretePositions(OptionsSoundCDVolume, 0);
  524.    FGSlider::setDiscretePositions(OptionsSound2DVolume, 0);
  525.    FGSlider::setDiscretePositions(OptionsSound3DVolume, 0);
  526.    Control::setValue(OptionsSoundCDVolume, $pref::cdVolume);
  527.    Control::setValue(OptionsSound2DVolume, $pref::sfx2dVolume);
  528.    Control::setValue(OptionsSound3DVolume, $pref::sfx3dVolume);
  529.  
  530.    //setup the 3d sound driver combo
  531.    FGCombo::clear(OptionsSound3DDriver);
  532.    if (sfxQuery(%SFX_QUERY_DSOUND)) FGCombo::addEntry(OptionsSound3DDriver, "Direct Sound", %SFX_QUERY_DSOUND);
  533.    //if (sfxQuery(%SFX_QUERY_DSOUND3D)) FGCombo::addEntry(OptionsSound3DDriver, "Direct Sound 3D", %SFX_QUERY_DSOUND3D);
  534.    //if (sfxQuery(%SFX_QUERY_AUREAL3D)) FGCombo::addEntry(OptionsSound3DDriver, "Aureal Sound 3D", %SFX_QUERY_AUREAL3D);
  535.    //if (sfxQuery(%SFX_QUERY_LIVE3D)) FGCombo::addEntry(OptionsSound3DDriver, "Sound Blaster Live 3D", %SFX_QUERY_LIVE3D);
  536.  
  537.    if ($pref::useDSound) FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_DSOUND);
  538.    //else if ($pref::useDSound3D) FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_DSOUND3D);
  539.    //else if ($pref::useAureal3D) FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_AUREAL3D);
  540.    //else if ($pref::useLive3D) FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_LIVE3D);
  541.    else
  542.    {
  543.       $pref::useDSound = FALSE;
  544.       $pref::useDSound3D = FALSE;
  545.       $pref::useAureal3D = FALSE;
  546.       $pref::useLive3D = FALSE;
  547.  
  548.       FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_DSOUND);
  549.       //FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_DSOUND3D);
  550.       //FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_AUREAL3D);
  551.       //FGCombo::setSelected(OptionsSound3DDriver, %SFX_QUERY_LIVE3D);
  552.  
  553.       %entry = FGCombo::getSelected(OptionsSound3DDriver);
  554.       if (%entry == %SFX_QUERY_DSOUND) $pref::useDSound = TRUE;
  555.       //else if (%entry == %SFX_QUERY_DSOUND3D) $pref::useDSound3D = TRUE;
  556.       //else if (%entry == %SFX_QUERY_AUREAL3D) $pref::useAureal3D = TRUE;
  557.       //else if (%entry == %SFX_QUERY_LIVE3D) $pref::useLive3D = TRUE;
  558.  
  559.    }
  560.  
  561.    //open sound
  562.    sfxOpen();
  563.  
  564.    //intialize a var
  565.    if ($pref::playVoices == "") $pref::playVoices = true;
  566.    Control::setValue(OptionsSoundPlayVoices, $pref::playVoices);
  567. }
  568.  
  569. function OptionsSound3DDriver::onAction()
  570. {
  571.    %SFX_QUERY_DSOUND     = 1; 
  572.    %SFX_QUERY_DSOUND3D   = 2;
  573.    %SFX_QUERY_AUREAL3D   = 3;
  574.    %SFX_QUERY_LIVE3D     = 4;
  575.  
  576.    sfxClose();
  577.  
  578.    $pref::useDSound = FALSE;
  579.    $pref::useDSound3D = FALSE;
  580.    $pref::useAureal3D = FALSE;
  581.    $pref::useLive3D = FALSE;
  582.  
  583.    %entry = FGCombo::getSelected(OptionsSound3DDriver);
  584.    echo("Survey says: " @ %entry);
  585.    if (%entry == %SFX_QUERY_DSOUND) $pref::useDSound = TRUE;
  586.    //else if (%entry == %SFX_QUERY_DSOUND3D) $pref::useDSound3D = TRUE;
  587.    //else if (%entry == %SFX_QUERY_AUREAL3D) $pref::useAureal3D = TRUE;
  588.    //else if (%entry == %SFX_QUERY_LIVE3D) $pref::useLive3D = TRUE;
  589.  
  590.    sfxOpen();
  591. }
  592.  
  593. function OptionsSoundCDVolume::onAction()
  594. {
  595.    $pref::CDVolume = Control::getValue(OptionsSoundCDVolume);
  596.    rbSetVolume(CD, 1 - $pref::CDVolume);
  597. }                             
  598.  
  599. function OptionsSoundCDMusic::onAction()
  600. {
  601.    if ($pref::CDMusic)
  602.    {
  603.       echo("Music is ON");
  604.       $userCDOverride = False;
  605.       newRedBook (CD, MainWindow);
  606.       if ($cdTrack != "" && $cdTrack != 0)
  607.          {
  608.             rbSetPlayMode (CD, $cdPlayMode);
  609.             rbPlay (CD, $cdTrack);
  610.          }
  611.    }
  612.    else
  613.    {
  614.       echo("Music is OFF");
  615.       rbSetPlayMode (CD, 0);
  616.       rbStop (CD);
  617.       deleteObject (CD);
  618.    }
  619. }
  620.  
  621. function OptionsSound2DVolume::onAction()
  622. {
  623.    $pref::sfx2dVolume = 0.01 + (0.99 * Control::getValue(OptionsSound2DVolume));
  624. }                             
  625.  
  626. function OptionsSound3DVolume::onAction()
  627. {
  628.    $pref::sfx3dVolume = 0.01 + (0.99 * Control::getValue(OptionsSound3DVolume));
  629. }                             
  630.  
  631.  
  632.  
  633.