[Gcblue-commits] gcb_wx/src/common tcOggStreamer.cpp,1.11,1.12 tcOptions.cpp,1.13,1.14 tcSoundConsol
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:14
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/common Modified Files: tcOggStreamer.cpp tcOptions.cpp tcSoundConsole.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcSoundConsole.cpp 2 Nov 2004 04:23:55 -0000 1.10 --- tcSoundConsole.cpp 7 Dec 2004 04:00:28 -0000 1.11 *************** *** 42,45 **** --- 42,48 ---- } + /** + * + */ void tcSoundConsole::Draw() { *************** *** 55,58 **** --- 58,66 ---- } + if (!IsBackgroundEnabled()) + { + DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0, 0, 0, 0.5f), FILL_ON); + } + DrawChildren(); Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcOggStreamer.cpp 5 Dec 2004 02:49:47 -0000 1.11 --- tcOggStreamer.cpp 7 Dec 2004 04:00:28 -0000 1.12 *************** *** 289,296 **** if (IsStopped()) { ! alSourcePlay(source); #ifdef _DEBUG fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif } --- 289,300 ---- if (IsStopped()) { ! ! alSourceStop(source); ! alSourcePlay(source); // crashes frequently in OpenAL32.dll thread after here ! #ifdef _DEBUG fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif + return true; } Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcOptions.cpp 6 Nov 2004 15:13:41 -0000 1.13 --- tcOptions.cpp 7 Dec 2004 04:00:28 -0000 1.14 *************** *** 38,172 **** int tcOptions::Init() { ! tsOptionInfo oi; ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 2; ! oi.mpAssociated = &mnViewMode; ! oi.mzCaption[0] = "Omniscient view"; ! oi.mzCaption[1] = "Omniscient, no sensor tags"; ! oi.mzCaption[2] = "Legal view"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mnCommandMode; ! oi.mzCaption[0] = "Control all"; ! oi.mzCaption[1] = "Legal control (alliance only)"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = NULL; ! oi.mzCaption[0] = "Test 1"; ! oi.mzCaption[1] = "Test 2"; ! oi.mzCaption[2] = "Test 3"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &disableSound; ! oi.mzCaption[0] = "Sound Enabled"; ! oi.mzCaption[1] = "Sound Disabled"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbPlayMusic; ! oi.mzCaption[0] = "Music OFF"; ! oi.mzCaption[1] = "Music ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbShowMapDebug; ! oi.mzCaption[0] = "Map debug OFF"; ! oi.mzCaption[1] = "Map debug ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 0; ! oi.mpAssociated = &debugLevel; ! oi.mzCaption[0] = "Debug OFF"; ! oi.mzCaption[1] = "Debug 1"; ! oi.mzCaption[2] = "Debug 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = &mnMapMode; ! oi.mzCaption[0] = "MM 0"; ! oi.mzCaption[1] = "MM 1"; ! oi.mzCaption[2] = "MM 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbFillRangeCircles; ! oi.mzCaption[0] = "Circle sensor regions"; ! oi.mzCaption[1] = "Filled sensor regions"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbTextureMappedMaps; ! oi.mzCaption[0] = "Use bitmap maps"; ! oi.mzCaption[1] = "Use texture-mapped maps"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbUseNTDS; ! oi.mzCaption[0] = "Icon (2525B) symbols"; ! oi.mzCaption[1] = "NTDS symbols"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 4; ! oi.mnValue = 1; ! oi.mpAssociated = &mn3DCheatMode; ! oi.mzCaption[0] = "Own-alliance 3D only"; ! oi.mzCaption[1] = "Track 3D"; ! oi.mzCaption[2] = "Track 3D+"; ! oi.mzCaption[3] = "Cheat"; ! AddOption(oi); ! Serialize(true); // read option state from file (options.dat) ! // work around for sound disable via text xml file, cleanup later ! if (OptionStringExists("DisableSound")) ! { ! disableSound = true; ! maOptionInfo[3].mnValue = 1; ! Serialize(false); ! } ! return true; } /******************************************************************************/ void tcOptions::AddOption(tsOptionInfo& oi) { ! tsOptionInfo *poi; ! if (mnNumOptions >= N_OPTIONS) {return;} // no room for more options ! poi = &maOptionInfo[mnNumOptions++]; ! poi->meType = oi.meType; ! poi->mnStateCount = oi.mnStateCount; ! poi->mnValue = oi.mnValue; ! poi->mpAssociated = oi.mpAssociated; ! if (poi->mpAssociated != NULL) {*poi->mpAssociated = poi->mnValue;} ! for(int k=0;(k<poi->mnStateCount)&&(k<N_OPTION_VALUES);k++) ! { ! poi->mzCaption[k] = oi.mzCaption[k]; ! } } --- 38,174 ---- int tcOptions::Init() { ! tsOptionInfo oi; ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 2; ! oi.mpAssociated = &mnViewMode; ! oi.mzCaption[0] = "Omniscient view"; ! oi.mzCaption[1] = "Omniscient, no sensor tags"; ! oi.mzCaption[2] = "Legal view"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mnCommandMode; ! oi.mzCaption[0] = "Control all"; ! oi.mzCaption[1] = "Legal control (alliance only)"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = NULL; ! oi.mzCaption[0] = "Test 1"; ! oi.mzCaption[1] = "Test 2"; ! oi.mzCaption[2] = "Test 3"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &disableSound; ! oi.mzCaption[0] = "Sound Enabled"; ! oi.mzCaption[1] = "Sound Disabled"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbPlayMusic; ! oi.mzCaption[0] = "Music OFF"; ! oi.mzCaption[1] = "Music ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbShowMapDebug; ! oi.mzCaption[0] = "Map debug OFF"; ! oi.mzCaption[1] = "Map debug ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 0; ! oi.mpAssociated = &debugLevel; ! oi.mzCaption[0] = "Debug OFF"; ! oi.mzCaption[1] = "Debug 1"; ! oi.mzCaption[2] = "Debug 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = &mnMapMode; ! oi.mzCaption[0] = "MM 0"; ! oi.mzCaption[1] = "MM 1"; ! oi.mzCaption[2] = "MM 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbFillRangeCircles; ! oi.mzCaption[0] = "Circle sensor regions"; ! oi.mzCaption[1] = "Filled sensor regions"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbTextureMappedMaps; ! oi.mzCaption[0] = "Use bitmap maps"; ! oi.mzCaption[1] = "Use texture-mapped maps"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbUseNTDS; ! oi.mzCaption[0] = "Icon (2525B) symbols"; ! oi.mzCaption[1] = "NTDS symbols"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 4; ! oi.mnValue = 1; ! oi.mpAssociated = &mn3DCheatMode; ! oi.mzCaption[0] = "Own-alliance 3D only"; ! oi.mzCaption[1] = "Track 3D"; ! oi.mzCaption[2] = "Track 3D+"; ! oi.mzCaption[3] = "Cheat"; ! AddOption(oi); ! Serialize(true); // read option state from file (options.dat) ! // work around for sound disable via text xml file, cleanup later ! if (OptionStringExists("DisableSound")) ! { ! disableSound = true; ! maOptionInfo[3].mnValue = 1; ! Serialize(false); ! } ! log3DModelDetails = OptionStringExists("Log3DModelDetails"); ! ! return true; } /******************************************************************************/ void tcOptions::AddOption(tsOptionInfo& oi) { ! tsOptionInfo *poi; ! if (mnNumOptions >= N_OPTIONS) {return;} // no room for more options ! poi = &maOptionInfo[mnNumOptions++]; ! poi->meType = oi.meType; ! poi->mnStateCount = oi.mnStateCount; ! poi->mnValue = oi.mnValue; ! poi->mpAssociated = oi.mpAssociated; ! if (poi->mpAssociated != NULL) {*poi->mpAssociated = poi->mnValue;} ! for(int k=0;(k<poi->mnStateCount)&&(k<N_OPTION_VALUES);k++) ! { ! poi->mzCaption[k] = oi.mzCaption[k]; ! } } *************** *** 188,192 **** child = node->InsertEndChild(TiXmlText("default")); } ! return child->Value(); } --- 190,194 ---- child = node->InsertEndChild(TiXmlText("default")); } ! return child->Value(); } *************** *** 222,226 **** child = node->InsertEndChild(TiXmlText(optionValue)); } ! } --- 224,228 ---- child = node->InsertEndChild(TiXmlText(optionValue)); } ! } *************** *** 228,275 **** void tcOptions::Serialize(int abRead) { ! tcFile file; ! bool bWrite = !abRead; ! unsigned nReadCount; ! if (abRead) ! { // load options from file ! if (file.Open("options.dat",tcFile::modeRead)==0) ! { ! bWrite = true; // create and write defaults to file ! } ! else ! { ! for(int k=0;(k<mnNumOptions)&&(!bWrite);k++) ! { ! nReadCount = file.Read(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! if (maOptionInfo[k].mpAssociated != NULL) { ! *maOptionInfo[k].mpAssociated = maOptionInfo[k].mnValue; } ! if (nReadCount != sizeof(maOptionInfo[k].mnValue)) { ! WTL("tcOptions::Serialize - corrupt options.dat file, creating new default"); ! bWrite = true; } ! } ! file.Close(); ! } ! } ! if (bWrite) ! { ! if (file.Open("options.dat",tcFile::modeCreate|tcFile::modeWrite)==0) ! { ! WTL("tcOptions::Serialize - failed to create options.dat"); ! return; ! } ! else ! { ! for(int k=0;k<mnNumOptions;k++) ! { ! file.Write(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! } ! file.Close(); ! } ! } } --- 230,277 ---- void tcOptions::Serialize(int abRead) { ! tcFile file; ! bool bWrite = !abRead; ! unsigned nReadCount; ! if (abRead) ! { // load options from file ! if (file.Open("options.dat",tcFile::modeRead)==0) ! { ! bWrite = true; // create and write defaults to file ! } ! else ! { ! for(int k=0;(k<mnNumOptions)&&(!bWrite);k++) { ! nReadCount = file.Read(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! if (maOptionInfo[k].mpAssociated != NULL) ! { ! *maOptionInfo[k].mpAssociated = maOptionInfo[k].mnValue; ! } ! if (nReadCount != sizeof(maOptionInfo[k].mnValue)) ! { ! WTL("tcOptions::Serialize - corrupt options.dat file, creating new default"); ! bWrite = true; ! } } ! file.Close(); ! } ! } ! if (bWrite) ! { ! if (file.Open("options.dat",tcFile::modeCreate|tcFile::modeWrite)==0) ! { ! WTL("tcOptions::Serialize - failed to create options.dat"); ! return; ! } ! else ! { ! for(int k=0;k<mnNumOptions;k++) { ! file.Write(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); } ! file.Close(); ! } ! } } *************** *** 278,288 **** void tcOptions::Synchronize() { ! for(int n=0;n<mnNumOptions;n++) ! { ! if (maOptionInfo[n].mpAssociated != NULL) ! { ! maOptionInfo[n].mnValue = *maOptionInfo[n].mpAssociated; ! } ! } } /******************************************************************************/ --- 280,290 ---- void tcOptions::Synchronize() { ! for(int n=0;n<mnNumOptions;n++) ! { ! if (maOptionInfo[n].mpAssociated != NULL) ! { ! maOptionInfo[n].mnValue = *maOptionInfo[n].mpAssociated; ! } ! } } /******************************************************************************/ *************** *** 328,332 **** if (childNode) { ! fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); } */ --- 330,334 ---- if (childNode) { ! fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); } */ |